-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5835c14
commit 23a123d
Showing
7 changed files
with
103 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Imports System.Windows.Forms.VisualStyles | ||
Imports StaxRip.UI | ||
|
||
Public Class CheckBoxRendererEx | ||
|
||
Public Shared Sub DrawCheckBox(g As Graphics, glyphLocation As Point, state As CheckBoxState) | ||
DrawCheckBox(g, New Rectangle(glyphLocation, GetGlyphSize(g, state)), state) | ||
End Sub | ||
|
||
Public Shared Sub DrawCheckBox(g As Graphics, rect As Rectangle, state As CheckBoxState) | ||
If ThemeManager.CurrentTheme.Name = ThemeManager.DefaultThemeName OrElse DesignHelp.IsDesignMode Then | ||
CheckBoxRenderer.DrawCheckBox(g, rect.Location, state) | ||
Return | ||
End If | ||
|
||
Dim checked = state = CheckBoxState.CheckedDisabled OrElse state = CheckBoxState.CheckedHot OrElse state = CheckBoxState.CheckedNormal OrElse state = CheckBoxState.CheckedPressed | ||
Dim theme = ThemeManager.CurrentTheme.General.Controls.CheckBox | ||
Dim backColor = If(checked, theme.BoxCheckedColor, theme.BoxColor) | ||
Dim penColor = theme.CheckmarkColor | ||
|
||
Select Case state | ||
Case CheckBoxState.CheckedNormal | ||
Using brush As New SolidBrush(backColor) | ||
g.FillRectangle(brush, rect) | ||
End Using | ||
|
||
Dim penStrength = 4 | ||
|
||
Dim startX1 = rect.Left + rect.Width / 4.5F | ||
Dim startY1 = rect.Top + rect.Height / 2.25F | ||
Dim endX1 = rect.Left + rect.Width / 3.0F | ||
Dim endY1 = rect.Top + rect.Height / 1.2F | ||
|
||
Dim startX2 = rect.Left + rect.Width / 3.1F | ||
Dim startY2 = rect.Top + rect.Height / 1.3F | ||
Dim endX2 = rect.Left + rect.Width / 1.2F | ||
Dim endY2 = rect.Top + rect.Height / 5.0F | ||
|
||
Using pen As New Pen(penColor, penStrength) | ||
g.DrawLine(pen, startX1, startY1, endX1, endY1) | ||
g.DrawLine(pen, startX2, startY2, endX2, endY2) | ||
End Using | ||
Case CheckBoxState.UncheckedNormal | ||
Using brush As New SolidBrush(backColor) | ||
g.FillRectangle(brush, rect) | ||
End Using | ||
End Select | ||
End Sub | ||
|
||
Public Shared Function GetGlyphSize(g As Graphics, state As CheckBoxState) As Size | ||
Return CheckBoxRenderer.GetGlyphSize(g, state) | ||
End Function | ||
|
||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters