• Welcome to Theos PowerBasic Museum 2017.

News:

Attachments are only available to registered users.
Please register using your full, real name.

Main Menu

Region made easy

Started by Patrice Terrier, October 09, 2008, 06:30:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

Do you know that a layered window doesn't require anymore the use of region (at least you don't have to handle it yourself).

All you have to do is to use the %WS_EX_LAYERED extended style when you create the main window, and to specify the color that will be used as the transparent color (very often the RGB(255,0,255) magenta color).

Here is what to do:

    ' Window Extended Style
       dwExStyle =
%WS_EX_LAYERED

     ' Windows Style
       dwStyle = %WS_POPUP

     ' Create The Window
       MyTitle$ = "AeroGL"
       hMain = CreateWindowEx(dwExStyle, _            ' Extended Style For The Window
                              zClass, _               ' Class Name
                              (MyTitle$), _           ' Window Title
                              dwStyle, _              ' Defined Window Style
                              x, y, _                 ' Window Position
                              rc.nRight - rc.nLeft, _ ' Calculate Window Width
                              rc.nBottom - rc.nTop, _ ' Calculate Window Height
                              %NULL, _                ' No Parent Window
                              %NULL, _                ' No Menu
                              wc.hInstance, _         ' Instance
                              BYVAL %NULL)            ' Dont Pass Anything To WM_CREATE
'
       IF hMain THEN

         
IF (dwExStyle AND %WS_EX_LAYERED) THEN
             CALL SetLayeredWindowAttributes(hMain, RGB(255,0,255), 255, %LWA_ALPHA OR %LWA_COLORKEY)
          END IF

etc.

Added:
See the example there

...

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com