Page 1 of 1

Skinning the Window with Regions

Posted: Wed Nov 02, 2005 3:16 am
by roachofdeath
Code updated For 5.20+

This is a simple set of procedures to skin the window into an ellipse, rectangle, or round rectangle. It only needs to be called once (it does not need to be under repeat). It will only work under Windows Operating Systems.

Code: Select all

; SkinWindow with Regions
; by roachofdeath
; 11/01/05

Procedure Set(hwnd,b)
  SetWindowRgn_(hwnd,b,1)
EndProcedure
Procedure rectangle(hwnd,x,y,w,h)
  ok=CreateRectRgn_(x,y,w,h)
  Set(hwnd,ok)
EndProcedure
ProcedureDLL elliptical(hwnd,x,y,w,h)
  ok=CreateEllipticRgn_(x,y,w,h)
  Set(hwnd,ok)
EndProcedure
ProcedureDLL roundrectangle(hwnd,x,y,w,h,ew,eh)
  ok=CreateRoundRectRgn_(x,y,w,h,ew,eh)
  Set(hwnd,ok)
EndProcedure

;---[EXAMPLE

OpenWindow(0,100,40,500,500,"Skin Window Example",0)
i = 0
Repeat
  roundrectangle(WindowID(0),100,40,500,500,i,i)
  i+2
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow: End
  EndSelect
ForEver

Posted: Wed Nov 02, 2005 3:49 am
by rsts
Actually kinda cool effect.

Nice code - thanks.

Posted: Wed Nov 02, 2005 9:32 am
by dell_jockey
very nice, thanks a lot!