Get graphics behind form...
I have been searching and searching for months for a way to get the graphics BEHIND the active form so i can do alphablended forms via png images....kinda like some of the new windows vista stuff... I know it can be done because stardock's desktopx supports png transparency and it can do it ontop of other windows...
remember, im not trying to make the form semi-transparent, im trying to make regions of the form semitransparent... so i can have semi-transparent ui's and such...
any ideas? api's?
Re: Get graphics behind form...
robdog... could you please post here? i think i saw you mention an api that does somthing like this once....
Re: Get graphics behind form...
You could always just set the Form's Transparency key to a known color in your background bitmap.
OR
Assign a custom-shaped region to your form's region property. both can be done without api and give good results (the region one is better because you don't get the form's border in the way). I havent got any code though.
Re: Get graphics behind form...
I dont think you quite understand what im trying to do... im not trying to do a transparency key... im essentially trying to alphablend a png image on to the desktop.the formborder isnt a problem cause i just set its border style to none.... this can only be accomplished if i can get the graphics for the forms underneath and alphablend the png onto that. so i probably will need to iterate through all other windows and the desktop and get their graphics properties. the only problem is i have no idea how to iterate through all the windows...
Re: Get graphics behind form...
ok i did a little more research and i think what i need to do is enumerate all active windows.. does anyone have any examples of this?
Re: Get graphics behind form...
Re: Get graphics behind form...
Have you tried using the form's Opacity property? Works for me.
Re: Get graphics behind form...
might help:
http://groups.google.co.uk...
could you hide the form, take a screenshot, show form again (though this probably would flicker too much)
Re: Get graphics behind form...
omg i cant use the opacity property... you guys still dont get it....
im trying to do this: http://www.codeproject.com/gdi/pxalphablend.asp
i cant use the opacity property because the alpha images obviosly dont have the same transparency on every pixel....
and i tried hiding the form months ago.... way too much flicker and it uses way too much cpu...
I also tried looping through each pixel in the image and creating a form for each pixel which was the exact color and opacity of the specified pixel.... it works fine, except you would need a super computer to run it cause the form took an hour to load...
Re: Get graphics behind form...
i figured it out using this code:
VB Code:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim d As IntPtr = New IntPtr(GetWindowDC(GetDesktopWindow))
Dim x As Graphics = Graphics.FromHdc(d)
x.DrawImage(My.Resources.alpha, Me.Location)
End Sub
the only problem is the windows below my form dont redraw when it moves so it leaves a trail.... how can i get the bellow forms to update themselves whenever my form's location changes?
1 Attachment(s)
Re: Get graphics behind form...
Opacity works perfectly...
1 Attachment(s)
Re: Get graphics behind form...
no, it does not..... each pixel on the png i am using has a diffrent alpha.... so i cant just set the whole form to one opacity level... I need to literally alpha-blend pngs to the desktop.... i need to be able to use drop-shadows and smooth edges.... kinda like the windows vista stuff...
Re: Get graphics behind form...
ok, as i said before, i got it working with the GetDesktopWindow() api by drawing the png to the desktop window....
But how can I get all the windows under my app to repaint themselves when my form is moved so my png doesnt leave a trail?
Re: Get graphics behind form...
Hello
OK, Latin4567
try to put Ur code in a timer
I believe It will work
let me know plz
thanks all
Re: Get graphics behind form...
I have it in a timer...
it works, but it flickers, and if the window below has animation, it cant do it....
so back to a previous idea...
Does anyone know how to iterate through all the desktop windows and get their graphics objects... This will presumably use the GetWindow api... PLEASE HELP...
Re: Get graphics behind form...
Why not use a second form to trail the mainform? If you do it by intercepting and sending Windows messages it should be pretty accurate.
Re: Get graphics behind form...
I tried that and it worked but it flickered... I am going to do some more experimentation with it tomorrow however.
Re: Get graphics behind form...
Ok I am going to use the InvalidateRect API to do it. Does anyone have a working example of how to convert values into the Long type so you can pass them to an API function>