Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4/32, VB5, VB6
Expertise: Intermediate
Aug 4, 2003

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 Long
End Type

Private Declare Function SetWindowRgn Lib "user32" _
	(ByVal hWnd As Long, ByVal hRgn As Long, _
	ByVal bRedraw As Boolean) As Long

Private Declare Function CreatePolygonRgn _
	Lib gdi32 (ByRef lpPoint As POINTAPI, _
	ByVal nCount As Long, _
	ByVal nPolyFillMode As Long) As Long

Private 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
Andrew Holliday
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date