When
I create an application containing a menu, I always add two line controls
to the form and position them in the resize event such as to create an
etched line below the menu. This code uses VB's Line method instead, and
when called from the Form_Paint event, guarantees the line will always
fill the client area of the form.
For this demo, I've placed the code in command buttons so you can see the
difference between the etched and raised look. |
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
' applications, but you may not reproduce
' or publish this code on any web site,
' online service, or distribute as source
' on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Declare Function GetSysColor Lib "user32" _
(ByVal nIndex As Long) As Long
Private Const COLOR_BTNFACE = 15
Private Const COLOR_BTNSHADOW = 16
Private Sub Command1_Click()
'raised
Me.Line (0, 15)-(ScaleWidth, 15), GetSysColor(COLOR_BTNSHADOW)
Me.Line (0, 0)-(ScaleWidth, 0), vbWhite
End Sub
Private Sub Command2_Click()
'etched
Me.Line (0, 15)-(ScaleWidth, 15), vbWhite
Me.Line (0, 0)-(ScaleWidth, 0), GetSysColor(COLOR_BTNSHADOW)
End Sub |