|
-
Aug 7th, 2001, 12:20 AM
#1
Thread Starter
Junior Member
Weird shaped forms
I've seen a wizard that uses the Windows API to make forms that aren't square: no title bar, circular, that sort of thing. Was wondering what the code/API call for it is. And if anyone knows where the wizard is it might save me some time !!!
Thanks.
-
Aug 7th, 2001, 05:55 AM
#2
PowerPoster
Here is the code
VB Code:
Option Explicit
'// WIN32API Function
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
'// WIN32API Structure
Private Type POINTAPI
x As Long
y As Long
End Type
'// WIN32API Constant
Private Const WINDING = 2
Private Sub Form_Load()
Load frmSample
frmSample.Show
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload frmSample
End Sub
Private Sub CmdAction_Click(Index As Integer)
Dim hRgn As Long
Dim pt(4) As POINTAPI
Select Case Index
Case 0 '// Ellipse
hRgn = CreateEllipticRgn(0, 0, 200, 400)
Case 1 '// Triangle
pt(0).x = 200
pt(0).y = 0
pt(1).x = 400
pt(1).y = 500
pt(2).x = 0
pt(2).y = 500
pt(3).x = 200
pt(3).y = 0
hRgn = CreatePolygonRgn(pt(0), 4, WINDING)
Case 2 '// Round Rect
hRgn = CreateRoundRectRgn(0, 0, 400, 400, 50, 50)
Case 3 '// Circle
hRgn = CreateEllipticRgn(0, 0, 300, 300)
End Select
SetWindowRgn frmSample.hWnd, hRgn, True
End Sub
regards,
-
Aug 7th, 2001, 07:24 AM
#3
Member
Re: Weird shaped forms
Originally posted by NaiK
I've seen a wizard that uses the Windows API to make forms that aren't square: no title bar, circular, that sort of thing. Was wondering what the code/API call for it is. And if anyone knows where the wizard is it might save me some time !!!
Thanks.
Easier but requires custom control: The PolyForm control at http://www.geocities.com/SiliconValley/Haven/2118
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|