Skinning the Window with Regions

Share your advanced PureBasic knowledge/code with the community.
roachofdeath
User
User
Posts: 78
Joined: Sun Apr 24, 2005 3:22 am

Skinning the Window with Regions

Post 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
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Actually kinda cool effect.

Nice code - thanks.
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

very nice, thanks a lot!
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
Post Reply