Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
System.Windows.Forms.PaintEventArgs) Handles _
MyBase.Paint
Dim x As Integer
Dim y As Integer
DrawSample(e.Graphics, x, y, SystemColors.ActiveBorder)
DrawSample(e.Graphics, x, y, SystemColors.ActiveCaption)
DrawSample(e.Graphics, x, y, _
SystemColors.ActiveCaptionText)
DrawSample(e.Graphics, x, y, SystemColors.AppWorkspace)
DrawSample(e.Graphics, x, y, SystemColors.Control)
DrawSample(e.Graphics, x, y, SystemColors.ControlDark)
DrawSample(e.Graphics, x, y, _
SystemColors.ControlDarkDark)
DrawSample(e.Graphics, x, y, SystemColors.ControlLight)
DrawSample(e.Graphics, x, y, _
SystemColors.ControlLightLight)
DrawSample(e.Graphics, x, y, SystemColors.ControlText)
DrawSample(e.Graphics, x, y, SystemColors.Desktop)
DrawSample(e.Graphics, x, y, SystemColors.GrayText)
DrawSample(e.Graphics, x, y, SystemColors.Highlight)
DrawSample(e.Graphics, x, y, SystemColors.HighlightText)
DrawSample(e.Graphics, x, y, SystemColors.HotTrack)
DrawSample(e.Graphics, x, y, _
SystemColors.InactiveBorder)
DrawSample(e.Graphics, x, y, _
SystemColors.InactiveCaption)
DrawSample(e.Graphics, x, y, _
SystemColors.InactiveCaptionText)
DrawSample(e.Graphics, x, y, SystemColors.Info)
DrawSample(e.Graphics, x, y, SystemColors.InfoText)
DrawSample(e.Graphics, x, y, SystemColors.Menu)
DrawSample(e.Graphics, x, y, SystemColors.MenuText)
DrawSample(e.Graphics, x, y, SystemColors.ScrollBar)
DrawSample(e.Graphics, x, y, SystemColors.Window)
DrawSample(e.Graphics, x, y, SystemColors.WindowFrame)
DrawSample(e.Graphics, x, y, SystemColors.WindowText)
End Sub
Private Sub DrawSample(ByVal gr As Graphics, ByRef x As _
Integer, ByRef y As Integer, ByVal clr As Color)
gr.DrawString(clr.Name, Me.Font, Brushes.Black, x, y)
Dim the_brush As New SolidBrush(clr)
gr.FillRectangle(the_brush, x, y + 15, 100, 20)
gr.DrawRectangle(Pens.Black, x, y + 15, 100, 20)
y += 40
If y + 40 > Me.ClientRectangle.Height Then
x += 150
y = 0
End If
End Sub
|