Private m_ColorNames As Collection
Private m_ColorValues As Collection
Private Sub AddColor(ByVal color_name As String, ByVal _
color_value As OLE_COLOR)
m_ColorNames.Add color_name
m_ColorValues.Add color_value
End Sub
Private Sub Form_Load()
Dim gap As Single
Dim hgt As Single
Dim Dx As Single
Dim Dy As Single
Dim x As Single
Dim y As Single
Dim i As Integer
Set m_ColorNames = New Collection
Set m_ColorValues = New Collection
AddColor "vb3DDKShadow", vb3DDKShadow
AddColor "vb3DFace", vb3DFace
AddColor "vb3DHighlight", vb3DHighlight
AddColor "vb3DLight", vb3DLight
AddColor "vb3DShadow", vb3DShadow
AddColor "vbActiveBorder", vbActiveBorder
AddColor "vbActiveTitleBar", vbActiveTitleBar
AddColor "vbActiveTitleBarText", vbActiveTitleBarText
AddColor "vbApplicationWorkspace", _
vbApplicationWorkspace
AddColor "vbButtonFace", vbButtonFace
AddColor "vbButtonShadow", vbButtonShadow
AddColor "vbButtonText", vbButtonText
AddColor "vbDesktop", vbDesktop
AddColor "vbGrayText", vbGrayText
AddColor "vbHighlight", vbHighlight
AddColor "vbHighlightText", vbHighlightText
AddColor "vbInactiveBorder", vbInactiveBorder
AddColor "vbInactiveCaptionText", vbInactiveCaptionText
AddColor "vbInactiveTitleBar", vbInactiveTitleBar
AddColor "vbInactiveTitleBarText", _
vbInactiveTitleBarText
AddColor "vbInfoBackground", vbInfoBackground
AddColor "vbInfoText", vbInfoText
AddColor "vbMenuBar", vbMenuBar
AddColor "vbMenuText", vbMenuText
AddColor "vbScrollBars", vbScrollBars
AddColor "vbTitleBarText", vbTitleBarText
AddColor "vbWindowBackground", vbWindowBackground
AddColor "vbWindowFrame", vbWindowFrame
AddColor "vbWindowText", vbWindowText
gap = lblName(0).Top - picSample(0).Top
hgt = gap + lblName(0).Height + 120
Dx = picSample(0).Width + 120
Dy = gap + lblName(0).Height + 120
x = 120
y = 120
For i = 1 To m_ColorNames.Count
Load picSample(i)
picSample(i).Move x, y
picSample(i).BackColor = m_ColorValues(i)
picSample(i).Visible = True
Load lblName(i)
lblName(i).Move x, y + gap
lblName(i).Caption = m_ColorNames(i)
lblName(i).Visible = True
y = y + Dy
If y + hgt > ScaleHeight Then
y = 120
x = x + Dx
End If
Next i
End Sub
|