Circle? 
Author Message
 Circle?

Does anyone know how to call the vb "circle" function in Access 2000?

Thanks



Thu, 21 Mar 2002 03:00:00 GMT  
 Circle?
Do you mean the method off the Report object?

Yes, I do. But did you try looking in help by looking for
Circle in the object browser and hitting F1? There is an
example right there that I believe even compiles and runs.

--
MichKa

-------------------------------------
don't send questions by e-mail unless
you're paying for it. (TANSTAAFL!) :-)

random junk of dubious value and
replica error and problem fixing at:
http://www.trigeminal.com


Quote:
> Does anyone know how to call the vb "circle" function in
Access 2000?

> Thanks



Thu, 21 Mar 2002 03:00:00 GMT  
 Circle?
Actually, I mean the graphical circle function and I'd like to use it on a
form to draw some graphics at run-time.  Thanks.



Quote:
> Do you mean the method off the Report object?

> Yes, I do. But did you try looking in help by looking for
> Circle in the object browser and hitting F1? There is an
> example right there that I believe even compiles and runs.

> --
> MichKa

> -------------------------------------
> don't send questions by e-mail unless
> you're paying for it. (TANSTAAFL!) :-)

> random junk of dubious value and
> replica error and problem fixing at:
> http://www.trigeminal.com



> > Does anyone know how to call the vb "circle" function in
> Access 2000?

> > Thanks



Fri, 22 Mar 2002 03:00:00 GMT  
 Circle?
Please note that Access forms do not support the Circle function or other
native API functions.  For more details, refer to

< http://www.mvps.org/access/api/api0053.htm >

But if you still want to do this, you can try something like the following.

Private Sub Command0_Click()
Dim hWnd As Long
Dim hDC As Long

    hWnd = fGetClientHandle(Me)
    hDC = apiGetDC(hWnd)
    Call apiArc(hDC, 10, 10, 50, 50, _
                    100, 100, 150, 150)
    Call apiReleaseDC(hWnd, hDC)
End Sub

where the rest of the Form's class module contains the following code

' ********** Code Start ***********
Private Declare Function apiArc Lib "gdi32" _
    Alias "Arc" _
    (ByVal hDC As Long, _
    ByVal X1 As Long, _
    ByVal Y1 As Long, _
    ByVal X2 As Long, _
    ByVal Y2 As Long, _
    ByVal X3 As Long, _
    ByVal Y3 As Long, _
    ByVal X4 As Long, _
    ByVal Y4 As Long) _
    As Long

'   retrieves the name of the class to which the specified window belongs.
Private Declare Function apiGetClassName Lib "user32" _
    Alias "GetClassNameA" _
    (ByVal hWnd As Long, _
    ByVal lpClassname As String, _
    ByVal nMaxCount As Long) _
    As Long

'   retrieves a handle to a window that has the specified relationship
'   (Z order or owner) to the specified window.
Private Declare Function apiGetWindow Lib "user32" _
    Alias "GetWindow" _
    (ByVal hWnd As Long, _
    ByVal wCmd As Long) _
    As Long

'   function retrieves a handle to a display device context (DC) for the
client
'   area of a specified window or for the entire screen.
Private Declare Function apiGetDC Lib "user32" _
    Alias "GetDC" _
    (ByVal hWnd As Long) _
    As Long

'   releases a device context (DC), freeing it for use by other
applications.
Private Declare Function apiReleaseDC Lib "user32" _
    Alias "ReleaseDC" _
    (ByVal hWnd As Long, _
    ByVal hDC As Long) _
    As Long

 '  handle identifies the child window at the top of the Z order,
'  if the specified window is a parent window
Private Const GW_CHILD = 5
'   Returns a handle to the window below the given window.
Private Const GW_HWNDNEXT = 2
Private Const MAX_LEN = 255
'  class name for an Access form's client window
Private Const ACC_FORM_CLIENT_CLASS = "OFormSub"
'   class name for the child window of an Access form's Client window
Private Const ACC_FORM_CLIENT_CHILD_CLASS = "OFEDT"
'   Copies the source rectangle directly to the destination rectangle.

Function fGetClientHandle(frm As Form) As Long
'   Returns a handle to the client window of a form
'   An Access form's hWnd is actually bound to the
'   recordselector "window"
'
Dim hWnd As Long

    '   get the first child window of the form
    hWnd = apiGetWindow(frm.hWnd, GW_CHILD)

    '   iterate through all child windows of the form
    Do While hWnd
        '   if we locate the client area whose class name is "OFormSub"
        If fGetClassName(hWnd) = ACC_FORM_CLIENT_CLASS Then
            '   the Client window's child is a window with the class
            '   name of OFEDT, so just verify that we're looking at the
            '   right window
            If fGetClassName(apiGetWindow( _
                hWnd, GW_CHILD)) = _
                    ACC_FORM_CLIENT_CHILD_CLASS Then
                            '   if we found a match, then return
                            '   the handle and we're outta here.
                            fGetClientHandle = hWnd
                            Exit Do
            End If
        End If
        '   get a handle to the next child window
        hWnd = apiGetWindow(hWnd, GW_HWNDNEXT)
    Loop
End Function

Private Function fGetClassName(hWnd As Long) As String
    Dim strBuffer As String
    Dim lngCount As Long

    strBuffer = String$(MAX_LEN - 1, 0)
    lngCount = apiGetClassName(hWnd, strBuffer, MAX_LEN)
    If lngCount > 0 Then
        fGetClassName = Left$(strBuffer, lngCount)
    End If
End Function
'*********** Code End ************

  -- Dev


Quote:
> Actually, I mean the graphical circle function and I'd like to use it on a
> form to draw some graphics at run-time.  Thanks.



Fri, 22 Mar 2002 03:00:00 GMT  
 Circle?
I feared Access would make this trying.  You're information is great, I
checked out your link as well, and will try it this afternoon.  Thanks!

- Shaq

P.S. Sorry to multipost, I didn't know this was bad etiquette.


Quote:
> Please note that Access forms do not support the Circle function or other
> native API functions.  For more details, refer to

> < http://www.mvps.org/access/api/api0053.htm >

> But if you still want to do this, you can try something like the
following.

> Private Sub Command0_Click()
> Dim hWnd As Long
> Dim hDC As Long

>     hWnd = fGetClientHandle(Me)
>     hDC = apiGetDC(hWnd)
>     Call apiArc(hDC, 10, 10, 50, 50, _
>                     100, 100, 150, 150)
>     Call apiReleaseDC(hWnd, hDC)
> End Sub

> where the rest of the Form's class module contains the following code

> ' ********** Code Start ***********
> Private Declare Function apiArc Lib "gdi32" _
>     Alias "Arc" _
>     (ByVal hDC As Long, _
>     ByVal X1 As Long, _
>     ByVal Y1 As Long, _
>     ByVal X2 As Long, _
>     ByVal Y2 As Long, _
>     ByVal X3 As Long, _
>     ByVal Y3 As Long, _
>     ByVal X4 As Long, _
>     ByVal Y4 As Long) _
>     As Long

> '   retrieves the name of the class to which the specified window belongs.
> Private Declare Function apiGetClassName Lib "user32" _
>     Alias "GetClassNameA" _
>     (ByVal hWnd As Long, _
>     ByVal lpClassname As String, _
>     ByVal nMaxCount As Long) _
>     As Long

> '   retrieves a handle to a window that has the specified relationship
> '   (Z order or owner) to the specified window.
> Private Declare Function apiGetWindow Lib "user32" _
>     Alias "GetWindow" _
>     (ByVal hWnd As Long, _
>     ByVal wCmd As Long) _
>     As Long

> '   function retrieves a handle to a display device context (DC) for the
> client
> '   area of a specified window or for the entire screen.
> Private Declare Function apiGetDC Lib "user32" _
>     Alias "GetDC" _
>     (ByVal hWnd As Long) _
>     As Long

> '   releases a device context (DC), freeing it for use by other
> applications.
> Private Declare Function apiReleaseDC Lib "user32" _
>     Alias "ReleaseDC" _
>     (ByVal hWnd As Long, _
>     ByVal hDC As Long) _
>     As Long

>  '  handle identifies the child window at the top of the Z order,
> '  if the specified window is a parent window
> Private Const GW_CHILD = 5
> '   Returns a handle to the window below the given window.
> Private Const GW_HWNDNEXT = 2
> Private Const MAX_LEN = 255
> '  class name for an Access form's client window
> Private Const ACC_FORM_CLIENT_CLASS = "OFormSub"
> '   class name for the child window of an Access form's Client window
> Private Const ACC_FORM_CLIENT_CHILD_CLASS = "OFEDT"
> '   Copies the source rectangle directly to the destination rectangle.

> Function fGetClientHandle(frm As Form) As Long
> '   Returns a handle to the client window of a form
> '   An Access form's hWnd is actually bound to the
> '   recordselector "window"
> '
> Dim hWnd As Long

>     '   get the first child window of the form
>     hWnd = apiGetWindow(frm.hWnd, GW_CHILD)

>     '   iterate through all child windows of the form
>     Do While hWnd
>         '   if we locate the client area whose class name is "OFormSub"
>         If fGetClassName(hWnd) = ACC_FORM_CLIENT_CLASS Then
>             '   the Client window's child is a window with the class
>             '   name of OFEDT, so just verify that we're looking at the
>             '   right window
>             If fGetClassName(apiGetWindow( _
>                 hWnd, GW_CHILD)) = _
>                     ACC_FORM_CLIENT_CHILD_CLASS Then
>                             '   if we found a match, then return
>                             '   the handle and we're outta here.
>                             fGetClientHandle = hWnd
>                             Exit Do
>             End If
>         End If
>         '   get a handle to the next child window
>         hWnd = apiGetWindow(hWnd, GW_HWNDNEXT)
>     Loop
> End Function

> Private Function fGetClassName(hWnd As Long) As String
>     Dim strBuffer As String
>     Dim lngCount As Long

>     strBuffer = String$(MAX_LEN - 1, 0)
>     lngCount = apiGetClassName(hWnd, strBuffer, MAX_LEN)
>     If lngCount > 0 Then
>         fGetClassName = Left$(strBuffer, lngCount)
>     End If
> End Function
> '*********** Code End ************

>   -- Dev



> > Actually, I mean the graphical circle function and I'd like to use it on
a
> > form to draw some graphics at run-time.  Thanks.



Fri, 22 Mar 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Can I draw a circle?

2. Queryresult to diagram/circles

3. How to jump out of this circle?

4. Create line or circle on user Forms

5. How draw circle in UserForm in Word?

6. Line and circles with VB.net

7. drawing lines and circles

8. shapes (circle)

9. Format for ellipse using CIRCLE

10. How to repeat circles

11. plotting circles

12. Circle drawing for PowerBASIC

 

 
Powered by phpBB® Forum Software