devxlogo

Create Unconventional Windows to Dazzle Users

Create Unconventional Windows to Dazzle Users

When designing a portion of an application that must grab users’ attention quickly&3151;such as your companys splash screen?you might want to create a nonrectangular window. This code shows you how to create a V-shaped window based on nine points:

Private Type POINTAPI	x As Long	y As LongEnd TypePrivate Declare Function SetWindowRgn Lib "user32" _	(ByVal hWnd As Long, ByVal hRgn As Long, _	ByVal bRedraw As Boolean) As LongPrivate Declare Function CreatePolygonRgn _	Lib gdi32 (ByRef lpPoint As POINTAPI, _	ByVal nCount As Long, _	ByVal nPolyFillMode As Long) As LongPrivate Sub Form_Load()	Dim lhandle As Long	Dim lpPoint(0 To 8) As POINTAPI	lpPoint(0).x = 0	lpPoint(0).y = 0	lpPoint(1).x = 20	lpPoint(1).y = 150	lpPoint(2).x = 60	lpPoint(2).y = 150	lpPoint(3).x = 80	lpPoint(3).y = 0	lpPoint(4).x = 52	lpPoint(4).y = 0	lpPoint(5).x = 46	lpPoint(5).y = 120	lpPoint(6).x = 40	lpPoint(6).y = 120	lpPoint(7).x = 32	lpPoint(7).y = 0	lpPoint(8).x = 0	lpPoint(8).y = 0	lhandle = CreatePolygonRgn(lpPoint(0), 9, 1)	Call SetWindowRgn(Me.hWnd, lhandle, True)End Sub

devx-admin

Share the Post: