Windows contains a function "DrawFrameControl" to create an image of several standard Windows "widgets" -- check boxes, menu items, scroll bar controls and so forth. The functions in this module expose this function to your application. You might want to use these simulated controls for several reasons. Perhaps you are creating documentation of the appearance of a form, and you wish to create a graphic you can display or print. You might be creating lightweight "graphical" user controls and wanting to draw the appearance of the controls on your user control rather than using an actual control. The controls are drawn by Windows, their appearance depends on the users' Windows color and font preferences.
Procedure Name | Type | Description |
(Declarations) | Declarations | Declarations and private variables for the modSimulatedControls module. |
DrawCaptionClose | Procedure | Draw the image of the titlebar "close" button on a form or picture box. |
DrawCaptionHelp | Procedure | Draw the image of the titlebar "help" button on a form or picture box. |
DrawCaptionMax | Procedure | Draw the image of the titlebar "maximize" button on a form or picture box. |
DrawCaptionMin | Procedure | Draw the image of the titlebar "minimize" button on a form or picture box. |
DrawCaptionRestore | Procedure | Draw the image of the titlebar "restore" button on a form or picture box. |
DrawCheckBox | Procedure | Draw the image of a check box on a form or picture box. |
DrawMenuArrow | Procedure | Draw the image of a menu arrow on a form or picture box. |
DrawMenuArrowRight | Procedure | Draw the image of a menu arrow on a form or picture box (used for right-to-left language versions of Windows). |
DrawMenuBullet | Procedure | Draw the image of a menu bullet on a form or picture box. |
DrawMenuCheck | Procedure | Draw the image of a menu check mark on a form or picture box. |
DrawOptionButton | Procedure | Draw the image of an option button on a form or picture box. |
DrawPushButton | Procedure | Draw the image of a push bottom on a form or picture box. |
DrawScrollComboBox | Procedure | Draw the image of a combo box down-arrow on a form or picture box. |
DrawScrollDown | Procedure | Draw the image of a scroll bar down-arrow on a form or picture box. |
DrawScrollLeft | Procedure | Draw the image of a scrollbar left arrow on a form or picture box. |
DrawScrollRight | Procedure | Draw the image of a scrollbar right arrow on a form or picture box. |
DrawScrollSizeGrip | Procedure | Draw the image of a form's sizing grip on a form or picture box. |
DrawScrollSizeGripRight | Procedure | Draw the image of a form's sizing grip on a form or picture box (used for right-to-left language versions of Windows). |
DrawScrollUp | Procedure | Draw the image of a scrollbar up arrow on a form or picture box. |
DrawTriStateCheckBox | Procedure | Draw the image of a three-state check box on a form or picture box. |
' Example of modSimulatedControls ' ' To try this example, do the following: ' 1. Create a new form ' 2. Paste all the code from this example to the new form's module. 'Private Sub Form_Paint() ' ' Example of modSimulatedControls ' ' DrawCaptionClose Me.hDC, 20, 10 ' DrawCaptionHelp Me.hDC, 20, 25 ' DrawCaptionMax Me.hDC, 20, 40 ' DrawCaptionMin Me.hDC, 20, 55 ' DrawCaptionRestore Me.hDC, 20, 70 ' ' DrawCheckBox Me.hDC, 20, 85, True ' DrawCheckBox Me.hDC, 20, 100, False ' ' DrawMenuArrow Me.hDC, 20, 115 ' DrawMenuArrowRight Me.hDC, 20, 130 ' DrawMenuBullet Me.hDC, 20, 145 ' DrawMenuCheck Me.hDC, 20, 160 ' ' DrawOptionButton Me.hDC, 20, 175, True ' DrawOptionButton Me.hDC, 20, 190, False ' ' DrawScrollComboBox Me.hDC, 50, 10 ' DrawScrollDown Me.hDC, 50, 25 ' DrawScrollLeft Me.hDC, 50, 40 ' DrawScrollRight Me.hDC, 50, 55 ' DrawScrollSizeGrip Me.hDC, 50, 70 ' DrawScrollSizeGripRight Me.hDC, 50, 85 ' DrawScrollUp Me.hDC, 50, 100 ' ' DrawTriStateCheckBox Me.hDC, 50, 115, vbChecked ' DrawTriStateCheckBox Me.hDC, 50, 130, vbUnchecked ' DrawTriStateCheckBox Me.hDC, 50, 145, vbGrayed ' ' DrawPushButton Me.hDC, "Hello There", 100, 5, 200, 25, True ' DrawPushButton Me.hDC, "Hello There", 100, 30, 200, 55, False ' 'End Sub
The source code in Total Visual Sourcebook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.
Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!
Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!
"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."
Van T. Dinh, Microsoft MVP