Results 1 to 2 of 2

Thread: fast round windows in Win32

  1. #1

    Thread Starter
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    fast round windows in Win32

    Hello -
    recently I have been trying to use round windows for an application.
    These must be moved, but do not have to be resized.
    Unfortunately, I have tried a few ways and they all seem to be VERY slow at rendering the window whenever I move it.
    Both CRgn (MFC) and HRGN (using CreateEllipticRegion() and SetWindowRgn()) are way to slow for my use. If I just have a 200x200 box, keeping it rectangle, it's fine.

    So, is there a faster way to have transparent space?
    Or even is there a way which I can control which pixels get drawn and which do not? The windows are only 200x200, so just looping and calculating where to start and end the loop will make it < 40000 calculations, which is fast enough easily.

    Thanks for your help.
    sql_lall

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: fast round windows in Win32

    If you have Win2K+, try using alpha blending. Make a circle in Paint/Photoshop etc. Make sure it sits on a solid colour background, like white (255,255,255), green (0,255,0) etc. Use it as the background for your window. Then set your window as Layered (SetWindowLong and WS_EX_LAYERED) and use SetLayeredWindowAttributes to make the form transparent. Pass the long rgb value of your background colour, and voila, Windows draws that colour transparent.

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