Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDraw standard system buttons (min, max, restore, help, scroll arrows, etc.)
Keywordsframe, draw frame, buttons, help, close, min, max, restore, scroll
CategoriesGraphics, Windows
 
Use the DrawFrameControl API function. It takes as parameters a device context on which to draw, a RECT structure indicating where to draw, a frame image type, and a frame image state. The state may include a modifier indicating disabled, pushed, etc.

The DrawFrame subroutine shown in the following code wraps this API call.

 
' Draw a frame control image.
Private Sub DrawFrame(ByVal hDC As Long, ByVal X As Long, _
    ByVal Y As Long, ByVal wid As Long, ByVal hgt As Long, _
    ByVal frame_type As Long, ByVal frame_state As Long, _
    Optional ByVal frame_status As Long = 0)
Dim r As RECT

    With r
        .Left = X
        .Right = X + wid
        .Top = Y
        .Bottom = Y + hgt
    End With

    DrawFrameControl hDC, r, frame_type, frame_state Or _
        frame_status
End Sub
 
The following code shows how to call DrawFrame.
 
DrawFrame hDC, 110, 10, 16, 14, DFC_CAPTION, _
    DFCS_CAPTIONCLOSE
DrawFrame hDC, 130, 10, 16, 14, DFC_CAPTION, _
    DFCS_CAPTIONRESTORE
DrawFrame hDC, 150, 10, 16, 14, DFC_CAPTION, DFCS_CAPTIONMIN
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated