|
-
Jun 4th, 2000, 06:44 PM
#1
Thread Starter
Junior Member
Hi Everybody
I wanted a creat a Oval shaped command button ??? pl. tell me how to create ?? is it possible to create thru VB6 ???
Thanks in advance
sanju
-
Jun 4th, 2000, 07:09 PM
#2
Guru
Everything's possible! Well, not everything, but this is...
Put this code behind your form:
Code:
Option Explicit
Private Declare Function CreateEllipticRgnIndirect Lib "gdi32" (lpRect As RECT) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub MakeOval(Ctl As Control)
Dim RC As RECT, hRgn As Long
Call GetWindowRect(Ctl.hWnd, RC)
RC.Right = RC.Right - RC.Left
RC.Bottom = RC.Bottom - RC.Top
RC.Left = 0: RC.Top = 0
hRgn = CreateEllipticRgnIndirect(RC)
Call SetWindowRgn(Ctl.hWnd, hRgn, True)
Call DeleteObject(hRgn)
End Sub
Then use the MakeOval sub.
For example, use this code and click the button Command1 to make itself become oval-shaped.
Code:
Private Sub Command1_Click()
Call MakeOval(Command1)
End Sub
-
Jun 4th, 2000, 09:33 PM
#3
Fanatic Member
The Oval command button does not look complete. Only the sides are visible.
-
Jun 4th, 2000, 09:56 PM
#4
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
|