
Making a round command button
Quote:
>This is a multi-part message in MIME format.
>------=_NextPart_000_0013_01BE5F4E.61938C20
>Content-Type: text/plain;
> charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>Is there a way to make a round command button by superimposing a circle =
>shape over a command button? How would it be coded?
You can use two API's to create round command buttons. Paste the
following
declarations into the General Declarations section of a form:
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 Long) As Long
Paste the following code in the Form_Load event to make Command1
round. It
will have a diameter equal to the width of the rectangular button in
design
mode:
Dim lHr As Long, lDl As Long
Dim lUsew As Long, lUseh As Long
Command1.Height = Command1.Width
lUsew = Command1.Width / Screen.TwipsPerPixelX
lUseh = Command1.Height / Screen.TwipsPerPixelY
lHr = CreateEllipticRgn(0, 0, lUsew, lUseh)
lDl = SetWindowRgn(Command1.hWnd, lHr, True)
You can also make elliptical buttons by not setting the button height
equal to
its width.
HTH,
Ed Phillippe