Results 1 to 3 of 3

Thread: Circle on a form with VBA

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Posts
    1

    Circle on a form with VBA

    I want to draw a circle on a form in visual basic editor as you can do in VB6 with the shape control. I searched for that control but it is nowhere to be found and I have no idea how to do it elseway...

    Any help would be welcome!

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Luton, UK
    Posts
    178
    Use the Drawing toolbar and record a macro to get the base code.
    Regards
    BrianB
    -------------------------------

  3. #3
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    You can use the API to draw this on, here's a sample taken from allapi.net using the Ellipse API call:

    VB Code:
    1. Private Type POINTAPI
    2.     x As Long
    3.     y As Long
    4. End Type
    5.  
    6. Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
    7.  
    8. Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, _
    9. ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, _
    10. ByVal Y2 As Long) As Long
    11.  
    12. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    13.  
    14.  
    15. Private Sub UserForm_Click()
    16.     Dim Position As POINTAPI
    17.     GetCursorPos Position
    18.    
    19.     Ellipse GetWindowDC(0), Position.x - 5, Position.y - 5, _
    20.     Position.x + 5, Position.y + 5
    21. End Sub

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width