CodeItBetter Programming Another VB Programming Blog

How to create Circular Controls

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'Controls - How to create Circular Controls

Option Explicit
 
'Add a Command Button to your Form.

Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, _
    ByVal X2 As Long, ByVal Y2 As Long) As Long
Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, _
    ByVal bRedraw As Long) As Long
 
Function CircleIt(Contrl As Control)
    Dim hr&, dl&, usew&, useh&
    hwndDest = Contrl.hWnd
    usew& = Contrl.Width / Screen.TwipsPerPixelX
    useh& = Contrl.Height / Screen.TwipsPerPixelY
    hr& = CreateEllipticRgn(0, 0, usew&, useh&)
    dl& = SetWindowRgn(hwndDest, hr, True)
End Function
 
'How can I call this function:
Private Sub Command1_Click()
    'To Create Circulare Command Button
    Call CircleIt(Command1)
End Sub

Related posts:

  1. How to create circular forms
  2. How to create fancy oval forms
  3. How to create rounded Form
  4. How to Dynamically create controls at runtime using Controls.Add and place them in a scrolled window
  5. How to create form and controls dynamically
  6. How to create Controls in a form runtime (without creating in design time)
  7. How to create a email link in your form
  8. How to create controls at run time
  9. How to use MouseDown/DoubleClick events for those Controls don’t have it
  10. How to show your form in different way

Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.