|Title||Change a Frame control's background color|
|Keywords||Frame, control, BackColor, background, color|
Thanks to Rob Crombie.
Normally when you change a Frame control's BackColor property, the part of the control above the upper line sticks up and looks ugly. This routine covers that area with a Shape control that has the same color as the parent form, effectively hiding that area.
Public Sub HideTheUglyTopOfFrame(cFrame As Frame, cShape As _
Shape, Optional FillColor As Long = -1)
'Sorry, but I must set the frame's Font (as it affects
' the size of the area above the top border)
cFrame.Font = "MS Sans Serif"
cFrame.FontBold = False
cFrame.FontSize = 8
cFrame.Caption = "" 'Place your own descriptive Label
' within the Frame, instead.
.BackStyle = 1 'Opaque
.BorderStyle = 0 'Transparent
.Height = 105
.Left = 0
.Top = 0
.Width = cFrame.Width + 300 'To avoid slight lack
' of (right) coverage on larger frames.
If FillColor = -1 Then
.BackColor = cFrame.Parent.BackColor
'Caller must have the frame in non Form
' container, and has passed me it's backcolor
.BackColor = FillColor