Alaska Software Inc. - SetWindowRgn()
Username: Password:
AuthorTopic: SetWindowRgn()
Jim LeeSetWindowRgn()
on Wed, 03 Oct 2018 01:22:54 +0200
Carlos a Beling Re: SetWindowRgn()
on Wed, 03 Oct 2018 10:55:04 -0300
Hello Jim:
good morning.
Manyt thanks.
Very, very nice.

Fraternally
Beling

Em 02/10/2018 20:22, Jim Lee escreveu:
> hi
> using "SetWindowRgn" you can create much more than round/eclipse Mask
> instead of a Handle from CreateEllipticRgn()
>     hRgn := CreateEllipticRgn(nLeftRect,nTopRect,nRightRect,nBottomRect)
> you also can assign a Array with a RECT() Structure
> AADD(aRegion,{116,29,124,30})
> ! Note : Coordinate must close lines at Start / End
> as you see Mask is transparency. we can use it on ever Control which
> have a Handle ( o:getHWND() )
> this Sample use a Bitmap on o:DrawingArea od a Dialog without Titlebar
> as i use oDlg as Parent all get transparent except those Region i want
> to show Bitmap
Jim LeeRe: SetWindowRgn()
on Mon, 08 Oct 2018 10:33:12 +0200
SetWindowRgn() and GraBox() Parameter are allmost the same

Windows API Functon like SetWindowRgn() use upper left as 0,0
while Xbase++ default use lower left as 0.0

you can use HelloWorld() Array from Sample with GraBox() this Way

 use GRA Function
   oDlg:drawingarea:Paint := {|| UseGra(oDlg,HelloWorld()) }
   oDlg:create()

 API_SetRegion( oDlg, HelloWorld() )

* ------------------------------------------- *

PROCEDURE UseGra(oDlg,aBox)
LOCAL i,iMax := LEN(aBox)
LOCAL aAttr := Array( GRA_AA_COUNT )        Area Attribut
LOCAL aSize := oDlg:drawingarea:CurrentSize()
LOCAL oPS
LOCAL aRect

   oPS := oDlg:drawingarea:lockPS()
   aAttr [ GRA_AA_COLOR  ] := GRA_CLR_CYAN
   GraSetAttrArea(oPS, aAttr )

   FOR i := 1 TO iMax
      aRect := ACLONE(aBox[i])

       XBP_ORIGIN_BOTTOMLEFT (Xbase++ default)
      aRect[2] := aSize[2] - aRect[2]
      aRect[4] := aSize[2] - aRect[4]

      GraBox(oPS,{aRect[1],aRect[2]},;
                           {aRect[3],aRect[4]},,,GRA_FILL)
      SLEEP(1)
   NEXT
   oDlg:drawingarea:unlockPS()
RETURN
Peter AlderliestenRe: SetWindowRgn()
on Tue, 09 Oct 2018 09:45:53 +0200
Jim,

> Windows API Functon like SetWindowRgn() use upper left as 0,0
> while Xbase++ default use lower left as 0.0

I will have to test that for the GRA functions.
I changed all of my code to use top left coördinates. Basically because my
dialogs then behave conforming the Windows standard when you resize a
dialog by moving the bottom border.
Internally I worked top left already and as most of my components are
inherited from the Xbase++ objects the change was doable, but it still took
me a couple of days.

Peter