Results 1 to 18 of 18

Thread: Get graphics behind form...

  1. #1

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    Arrow 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?

  2. #2

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    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....

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    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.
    I don't live here any more.

  4. #4

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    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...
    Last edited by Latin4567; Sep 3rd, 2005 at 07:48 PM.

  5. #5

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    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?

  6. #6

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    Re: Get graphics behind form...

    *bump*

  7. #7
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Get graphics behind form...

    Have you tried using the form's Opacity property? Works for me.
    I don't live here any more.

  8. #8
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    297

    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)

  9. #9

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    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...
    Last edited by Latin4567; Sep 4th, 2005 at 07:28 PM.

  10. #10

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    Re: Get graphics behind form...

    i figured it out using this code:

    VB Code:
    1. Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
    2.         Dim d As IntPtr = New IntPtr(GetWindowDC(GetDesktopWindow))
    3.         Dim x As Graphics = Graphics.FromHdc(d)
    4.         x.DrawImage(My.Resources.alpha, Me.Location)
    5.     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?

  11. #11
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Get graphics behind form...

    Opacity works perfectly...
    Attached Images Attached Images  
    I don't live here any more.

  12. #12

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    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...
    Attached Images Attached Images  
    Last edited by Latin4567; Sep 5th, 2005 at 01:46 PM.

  13. #13

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    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?
    Last edited by Latin4567; Sep 5th, 2005 at 01:48 PM.

  14. #14
    New Member
    Join Date
    Sep 2005
    Location
    KSA - Riyadh
    Posts
    4

    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

  15. #15

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    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...

  16. #16
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    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.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  17. #17

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    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.

  18. #18

    Thread Starter
    Addicted Member Latin4567's Avatar
    Join Date
    Jan 2005
    Posts
    202

    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>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width