- Код: Выделить всё
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Public Class ColorsOfSystem
Shared ReadOnly Property Labels() As String()
Get
Return New String() _
{ _
"ActiveBorder", _
"ActiveCaption", _
"ActiveCaptionText", _
"AppWorkspace", _
"ButtonFace", _
"ButtonHighlight", _
"ButtonShadow", _
"Control", _
"ControlDark", _
"ControlDarkDark", _
"ControlLight", _
"ControlLightLight", _
"ControlText", _
"Desktop", _
"GradientActiveCaption", _
"GradientInactiveCaption", _
"GrayText", _
"Highlight", _
"HighlightText", _
"HotTrack", _
"InactiveBorder", _
"InactiveCaption", _
"InactiveCaptionText", _
"Info", _
"InfoText", _
"Menu", _
"MenuBar", _
"MenuHighlight", _
"MenuText", _
"ScrollBar", _
"Window", _
"WindowFrame", _
"WindowText" _
}
End Get
End Property
'SystemColors.ActiveBorder
'SystemColors.ActiveCaption
'SystemColors.ActiveCaptionText
'SystemColors.AppWorkspace
'SystemColors.ButtonFace
'SystemColors.ButtonHighlight
'SystemColors.ButtonShadow
'SystemColors.Control
'SystemColors.ControlDark
'SystemColors.ControlDarkDark
'SystemColors.ControlLight
'SystemColors.ControlLightLight
'SystemColors.ControlText
'SystemColors.Desktop
'SystemColors.GradientActiveCaption
'SystemColors.GradientInactiveCaption
'SystemColors.GrayText
'SystemColors.Highlight
'SystemColors.HighlightText
'SystemColors.HotTrack
'SystemColors.InactiveBorder
'SystemColors.InactiveCaption
'SystemColors.InactiveCaptionText
'SystemColors.Info
'SystemColors.InfoText
'SystemColors.Menu
'SystemColors.MenuBar
'SystemColors.MenuHighlight
'SystemColors.MenuText
'SystemColors.ScrollBar
'SystemColors.Window
'SystemColors.WindowFrame
'SystemColors.WindowText
Shared ReadOnly Property Count() As Integer
Get
Return Labels.Length
End Get
End Property
End Class
Class GetSystemColorsNow
Inherits Form
Protected MyStep As Integer = Font.Height
Protected iCount As Integer
Protected astrLabels() As String
Shared Sub Main()
Application.Run(New GetSystemColorsNow)
End Sub
Sub New()
Text = "GetSystemColorsNow"
iCount = ColorsOfSystem.Count
astrLabels = ColorsOfSystem.Labels
Dim PanelPoint As New Point(10, 10)
Dim PanelSize As New Size(30, Font.Height)
Dim pnlActiveBorder As New Panel()
Dim pnlActiveCaption As New Panel()
Dim pnlActiveCaptionText As New Panel()
Dim pnlAppWorkspace As New Panel()
Dim pnlButtonFace As New Panel()
Dim pnlButtonHighlight As New Panel()
Dim pnlButtonShadow As New Panel()
Dim pnlControl As New Panel()
Dim pnlControlDark As New Panel()
Dim pnlControlDarkDark As New Panel()
Dim pnlControlLight As New Panel()
Dim pnlControlLightLight As New Panel()
Dim pnlControlText As New Panel()
Dim pnlDesktop As New Panel()
Dim pnlGradientActiveCaption As New Panel()
Dim pnlGradientInactiveCaption As New Panel()
Dim pnlGrayText As New Panel()
Dim pnlHighlight As New Panel()
Dim pnlHighlightText As New Panel()
Dim pnlHotTrack As New Panel()
Dim pnlInactiveBorder As New Panel()
Dim pnlInactiveCaption As New Panel()
Dim pnlInactiveCaptionText As New Panel()
Dim pnlInfo As New Panel()
Dim pnlInfoText As New Panel()
Dim pnlMenu As New Panel()
Dim pnlMenuBar As New Panel()
Dim pnlMenuHighlight As New Panel()
Dim pnlMenuText As New Panel()
Dim pnlScrollBar As New Panel()
Dim pnlWindow As New Panel()
Dim pnlWindowFrame As New Panel()
Dim pnlWindowText As New Panel()
pnlActiveBorder.Parent = Me
pnlActiveCaption.Parent = Me
pnlActiveCaptionText.Parent = Me
pnlAppWorkspace.Parent = Me
pnlButtonFace.Parent = Me
pnlButtonHighlight.Parent = Me
pnlButtonShadow.Parent = Me
pnlControl.Parent = Me
pnlControlDark.Parent = Me
pnlControlDarkDark.Parent = Me
pnlControlLight.Parent = Me
pnlControlLightLight.Parent = Me
pnlControlText.Parent = Me
pnlDesktop.Parent = Me
pnlGradientActiveCaption.Parent = Me
pnlGradientInactiveCaption.Parent = Me
pnlGrayText.Parent = Me
pnlHighlight.Parent = Me
pnlHighlightText.Parent = Me
pnlHotTrack.Parent = Me
pnlInactiveBorder.Parent = Me
pnlInactiveCaption.Parent = Me
pnlInactiveCaptionText.Parent = Me
pnlInfo.Parent = Me
pnlInfoText.Parent = Me
pnlMenu.Parent = Me
pnlMenuBar.Parent = Me
pnlMenuHighlight.Parent = Me
pnlMenuText.Parent = Me
pnlScrollBar.Parent = Me
pnlWindow.Parent = Me
pnlWindowFrame.Parent = Me
pnlWindowText.Parent = Me
pnlActiveBorder.Size = PanelSize
pnlActiveCaption.Size = PanelSize
pnlActiveCaptionText.Size = PanelSize
pnlAppWorkspace.Size = PanelSize
pnlButtonFace.Size = PanelSize
pnlButtonHighlight.Size = PanelSize
pnlButtonShadow.Size = PanelSize
pnlControl.Size = PanelSize
pnlControlDark.Size = PanelSize
pnlControlDarkDark.Size = PanelSize
pnlControlLight.Size = PanelSize
pnlControlLightLight.Size = PanelSize
pnlControlText.Size = PanelSize
pnlDesktop.Size = PanelSize
pnlGradientActiveCaption.Size = PanelSize
pnlGradientInactiveCaption.Size = PanelSize
pnlGrayText.Size = PanelSize
pnlHighlight.Size = PanelSize
pnlHighlightText.Size = PanelSize
pnlHotTrack.Size = PanelSize
pnlInactiveBorder.Size = PanelSize
pnlInactiveCaption.Size = PanelSize
pnlInactiveCaptionText.Size = PanelSize
pnlInfo.Size = PanelSize
pnlInfoText.Size = PanelSize
pnlMenu.Size = PanelSize
pnlMenuBar.Size = PanelSize
pnlMenuHighlight.Size = PanelSize
pnlMenuText.Size = PanelSize
pnlScrollBar.Size = PanelSize
pnlWindow.Size = PanelSize
pnlWindowFrame.Size = PanelSize
pnlWindowText.Size = PanelSize
pnlActiveBorder.BackColor = SystemColors.ActiveBorder
pnlActiveCaption.BackColor = SystemColors.ActiveCaption
pnlActiveCaptionText.BackColor = SystemColors.ActiveCaptionText
pnlAppWorkspace.BackColor = SystemColors.AppWorkspace
pnlButtonFace.BackColor = SystemColors.ButtonFace 'SystemColors.ButtonFace Not Support in NET1.X
pnlButtonHighlight.BackColor = SystemColors.ButtonHighlight 'SystemColors.ButtonHighlight Not Support in NET1.X
pnlButtonShadow.BackColor = SystemColors.ButtonShadow 'SystemColors.ButtonShadow Not Support in NET1.X
pnlControl.BackColor = SystemColors.Control
pnlControlDark.BackColor = SystemColors.ControlDark
pnlControlDarkDark.BackColor = SystemColors.ControlDarkDark
pnlControlLight.BackColor = SystemColors.ControlLight
pnlControlLightLight.BackColor = SystemColors.ControlLightLight
pnlControlText.BackColor = SystemColors.ControlText
pnlDesktop.BackColor = SystemColors.Desktop
pnlGradientActiveCaption.BackColor = SystemColors.GradientActiveCaption 'SystemColors.GradientActiveCaption Not Support in NET1.X
pnlGradientInactiveCaption.BackColor = SystemColors.GradientInactiveCaption 'SystemColors.GradientInactiveCaption Not Support in NET1.X
pnlGrayText.BackColor = SystemColors.GrayText
pnlHighlight.BackColor = SystemColors.Highlight
pnlHighlightText.BackColor = SystemColors.HighlightText
pnlHotTrack.BackColor = SystemColors.HotTrack
pnlInactiveBorder.BackColor = SystemColors.InactiveBorder
pnlInactiveCaption.BackColor = SystemColors.InactiveCaption
pnlInactiveCaptionText.BackColor = SystemColors.InactiveCaptionText
pnlInfo.BackColor = SystemColors.Info
pnlInfoText.BackColor = SystemColors.InfoText
pnlMenu.BackColor = SystemColors.Menu
pnlMenuBar.BackColor = SystemColors.MenuBar 'SystemColors.MenuBar Not Support in NET1.X
pnlMenuHighlight.BackColor = SystemColors.MenuHighlight 'SystemColors.MenuHighlight Not Support in NET1.X
pnlMenuText.BackColor = SystemColors.MenuText
pnlScrollBar.BackColor = SystemColors.ScrollBar
pnlWindow.BackColor = SystemColors.Window
pnlWindowFrame.BackColor = SystemColors.WindowFrame
pnlWindowText.BackColor = SystemColors.WindowText
pnlActiveBorder.Location = PanelPoint
PanelPoint.Y += MyStep
pnlActiveCaption.Location = PanelPoint
PanelPoint.Y += MyStep
pnlActiveCaptionText.Location = PanelPoint
PanelPoint.Y += MyStep
pnlAppWorkspace.Location = PanelPoint
PanelPoint.Y += MyStep
pnlButtonFace.Location = PanelPoint
PanelPoint.Y += MyStep
pnlButtonHighlight.Location = PanelPoint
PanelPoint.Y += MyStep
pnlButtonShadow.Location = PanelPoint
PanelPoint.Y += MyStep
pnlControl.Location = PanelPoint
PanelPoint.Y += MyStep
pnlControlDark.Location = PanelPoint
PanelPoint.Y += MyStep
pnlControlDarkDark.Location = PanelPoint
PanelPoint.Y += MyStep
pnlControlLight.Location = PanelPoint
PanelPoint.Y += MyStep
pnlControlLightLight.Location = PanelPoint
PanelPoint.Y += MyStep
pnlControlText.Location = PanelPoint
PanelPoint.Y += MyStep
pnlDesktop.Location = PanelPoint
PanelPoint.Y += MyStep
pnlGradientActiveCaption.Location = PanelPoint
PanelPoint.Y += MyStep
pnlGradientInactiveCaption.Location = PanelPoint
PanelPoint.Y += MyStep
pnlGrayText.Location = PanelPoint
PanelPoint.Y += MyStep
pnlHighlight.Location = PanelPoint
PanelPoint.X = 160
PanelPoint.Y = 10
pnlHighlightText.Location = PanelPoint
PanelPoint.Y += MyStep
pnlHotTrack.Location = PanelPoint
PanelPoint.Y += MyStep
pnlInactiveBorder.Location = PanelPoint
PanelPoint.Y += MyStep
pnlInactiveCaption.Location = PanelPoint
PanelPoint.Y += MyStep
pnlInactiveCaptionText.Location = PanelPoint
PanelPoint.Y += MyStep
pnlInfo.Location = PanelPoint
PanelPoint.Y += MyStep
pnlInfoText.Location = PanelPoint
PanelPoint.Y += MyStep
pnlMenu.Location = PanelPoint
PanelPoint.Y += MyStep
pnlMenuBar.Location = PanelPoint
PanelPoint.Y += MyStep
pnlMenuHighlight.Location = PanelPoint
PanelPoint.Y += MyStep
pnlMenuText.Location = PanelPoint
PanelPoint.Y += MyStep
pnlScrollBar.Location = PanelPoint
PanelPoint.Y += MyStep
pnlWindow.Location = PanelPoint
PanelPoint.Y += MyStep
pnlWindowFrame.Location = PanelPoint
PanelPoint.Y += MyStep
pnlWindowText.Location = PanelPoint
End Sub
Protected Overrides Sub OnPaint(ByVal pea As PaintEventArgs)
Dim grfx As Graphics = pea.Graphics
Dim br As New SolidBrush(ForeColor)
Dim I As Integer
For I = 0 To iCount - 1
If I < 18 Then
grfx.DrawString(astrLabels(I), Font, br, 40, 10 + I * MyStep)
Else
grfx.DrawString(astrLabels(I), Font, br, 190, (10 + I * MyStep) - (18 * MyStep))
End If
Next
End Sub
End Class
- Код: Выделить всё
Shared ReadOnly Property Values() As String()
Get
Return New String() _
{ _
SystemInformation.ActiveWindowTrackingDelay.ToString(), _
'...
SystemInformation.WorkingArea.ToString() _
}
End Get
End Property
Rem фрагмент кода с книги Чарльза Петцольда - Программирование для Microsoft Windows на Microsoft Visual Basic .NET.
Rem Programming Microsoft Windows with Microsoft Visual Basic .NET
Спасибо за внимание.