Skip to content

Commit 32621a1

Browse files
committed
v2.2.4
1 parent 53dd986 commit 32621a1

File tree

12 files changed

+127
-60
lines changed

12 files changed

+127
-60
lines changed

.vs/QuickLibrary/v16/.suo

4.5 KB
Binary file not shown.
8 KB
Binary file not shown.

QuickLibrary/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.9.0")]
36-
[assembly: AssemblyFileVersion("2.9.0")]
35+
[assembly: AssemblyVersion("2.2.4")]
36+
[assembly: AssemblyFileVersion("2.2.4")]
3737
[assembly: NeutralResourcesLanguage("en")]

QuickLibrary/QlibCheckBox.cs

Lines changed: 117 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Drawing;
34
using System.Drawing.Drawing2D;
45
using System.Drawing.Text;
@@ -8,102 +9,167 @@ namespace QuickLibrary
89
{
910
public class QlibCheckBox : CheckBox
1011
{
12+
// PRIVATE FIELDS
13+
1114
private bool darkMode = false;
1215
private string darkText;
1316
private bool hovered = false;
1417
private bool pressed = false;
1518

16-
public string Text
17-
{
18-
get
19-
{
20-
if (darkMode)
21-
{
22-
return darkText;
23-
}
24-
else
25-
{
26-
return base.Text;
27-
}
28-
}
19+
// HIDDEN PROPS
2920

30-
set
31-
{
32-
if (darkMode)
33-
{
34-
darkText = value;
35-
}
36-
else
37-
{
38-
base.Text = value;
39-
}
40-
}
21+
[Browsable(false)]
22+
public new Appearance Appearance => base.Appearance;
23+
24+
[Browsable(false)]
25+
public new Color ForeColor => base.ForeColor;
26+
27+
[Browsable(false)]
28+
public new Color BackColor => base.BackColor;
29+
30+
[Browsable(false)]
31+
public new Image BackgroundImage => base.BackgroundImage;
32+
33+
[Browsable(false)]
34+
public new ImageLayout BackgroundImageLayout => base.BackgroundImageLayout;
35+
36+
[Browsable(false)]
37+
public new ContentAlignment CheckAlign => base.CheckAlign;
38+
39+
[Browsable(false)]
40+
public new Image Image => base.Image;
41+
42+
[Browsable(false)]
43+
public new Cursor Cursor => base.Cursor;
44+
45+
[Browsable(false)]
46+
public new CheckState CheckState => base.CheckState;
47+
48+
[Browsable(false)]
49+
public new FlatButtonAppearance FlatAppearance => base.FlatAppearance;
50+
51+
[Browsable(false)]
52+
public new FlatStyle FlatStyle => base.FlatStyle;
53+
54+
[Browsable(false)]
55+
public new ContentAlignment ImageAlign => base.ImageAlign;
56+
57+
[Browsable(false)]
58+
public new int ImageIndex => base.ImageIndex;
59+
60+
[Browsable(false)]
61+
public new string ImageKey => base.ImageKey;
62+
63+
[Browsable(false)]
64+
public new Padding Padding => base.Padding;
65+
66+
[Browsable(false)]
67+
public new RightToLeft RightToLeft => base.RightToLeft;
68+
69+
[Browsable(false)]
70+
public new bool AutoSize => base.AutoSize;
71+
72+
[Browsable(false)]
73+
public new DockStyle Dock => base.Dock;
74+
75+
[Browsable(false)]
76+
public new Size MinimumSize => base.MinimumSize;
77+
78+
[Browsable(false)]
79+
public new Size MaximumSize => base.MaximumSize;
80+
81+
[Browsable(false)]
82+
public new bool ThreeState => base.ThreeState;
83+
84+
[Browsable(false)]
85+
public new bool AutoCheck => base.AutoCheck;
86+
87+
// PUBLIC PROPS
88+
89+
[Category("Qlib props"), Browsable(true), Description("Dark mode")]
90+
public bool DarkMode
91+
{
92+
get { return darkMode; }
93+
set { SetDarkMode(value); }
4194
}
4295

96+
// CONSTRUCTOR
97+
4398
public QlibCheckBox()
4499
{
45100
if (darkMode)
46101
{
47-
SetStyle(ControlStyles.UserPaint, true);
48-
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
49-
50-
this.MouseEnter += CustomCheckBox_MouseEnter;
51-
this.MouseLeave += CustomCheckBox_MouseLeave;
52-
this.MouseDown += CustomCheckBox_MouseDown;
53-
this.MouseUp += CustomCheckBox_MouseUp;
102+
54103
}
55104
}
56105

106+
// PRIVATE BODY
107+
57108
private void CustomCheckBox_MouseUp(object sender, MouseEventArgs e)
58109
{
59110
pressed = false;
60-
this.Refresh();
111+
Refresh();
61112
}
62113

63114
private void CustomCheckBox_MouseDown(object sender, MouseEventArgs e)
64115
{
65116
pressed = true;
66-
this.Refresh();
117+
Refresh();
67118
}
68119

69120
private void CustomCheckBox_MouseLeave(object sender, EventArgs e)
70121
{
71122
hovered = false;
72-
this.Refresh();
123+
Refresh();
73124
}
74125

75126
private void CustomCheckBox_MouseEnter(object sender, EventArgs e)
76127
{
77128
hovered = true;
78-
this.Refresh();
129+
Refresh();
79130
}
80131

81-
public void SetDarkMode(bool dark)
132+
private void SetDarkMode(bool dark)
82133
{
83-
this.darkMode = dark;
134+
darkMode = dark;
84135

85136
if (dark)
86137
{
87-
darkText = this.Text;
88-
this.Text = " ";
138+
base.BackColor = ThemeManager.DarkBackColor;
139+
base.ForeColor = Color.White;
140+
darkText = Text;
141+
//Text = " ";
142+
143+
SetStyle(ControlStyles.UserPaint, true);
144+
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
145+
146+
MouseEnter += CustomCheckBox_MouseEnter;
147+
MouseLeave += CustomCheckBox_MouseLeave;
148+
MouseDown += CustomCheckBox_MouseDown;
149+
MouseUp += CustomCheckBox_MouseUp;
150+
}
151+
else
152+
{
153+
base.BackColor = ThemeManager.LightBackColor;
154+
base.ForeColor = Color.Black;
89155
}
90156
}
91157

92158
protected override void OnPaint(PaintEventArgs e)
93159
{
94160
if (darkMode)
95161
{
96-
int top = (this.Height / 2) - 8;
162+
int top = (Height / 2) - 8;
97163

98-
e.Graphics.Clear(this.BackColor);
164+
e.Graphics.Clear(BackColor);
99165

100-
if (this.pressed)
166+
if (pressed)
101167
{
102168
e.Graphics.FillRectangle(new SolidBrush(ThemeManager.PressedColor), new Rectangle(0, top + 2, 13, 13));
103169
}
104170
else
105171
{
106-
if (this.hovered)
172+
if (hovered)
107173
{
108174
e.Graphics.FillRectangle(new SolidBrush(ThemeManager.DarkHoverColor), new Rectangle(0, top + 2, 13, 13));
109175
}
@@ -113,19 +179,19 @@ protected override void OnPaint(PaintEventArgs e)
113179
}
114180
}
115181

116-
if (this.Focused)
182+
if (Focused)
117183
{
118184
e.Graphics.DrawRectangle(new Pen(ThemeManager.BorderColor, 2), new Rectangle(1, top + 3, 11, 11));
119185
}
120186

121-
if (this.Checked)
187+
if (Checked)
122188
{
123189
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
124190

125-
if (this.Enabled)
191+
if (Enabled)
126192
{
127-
e.Graphics.DrawLine(new Pen(this.ForeColor, 2), 2, top + 7, 5, top + 10);
128-
e.Graphics.DrawLine(new Pen(this.ForeColor, 2), 5, top + 11, 12, top + 4);
193+
e.Graphics.DrawLine(new Pen(ForeColor, 2), 2, top + 7, 5, top + 10);
194+
e.Graphics.DrawLine(new Pen(ForeColor, 2), 5, top + 11, 12, top + 4);
129195
}
130196
else
131197
{
@@ -135,13 +201,13 @@ protected override void OnPaint(PaintEventArgs e)
135201
}
136202

137203
e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
138-
if (this.Enabled)
204+
if (Enabled)
139205
{
140-
e.Graphics.DrawString(darkText, this.Font, new SolidBrush(this.ForeColor), 17, top);
206+
e.Graphics.DrawString(Text, Font, new SolidBrush(ForeColor), 17, top);
141207
}
142208
else
143209
{
144-
e.Graphics.DrawString(darkText, this.Font, new SolidBrush(ThemeManager.BorderColor), 17, top);
210+
e.Graphics.DrawString(Text, Font, new SolidBrush(ThemeManager.BorderColor), 17, top);
145211
}
146212
}
147213
else

QuickLibrary/QlibFixedForm.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ public bool AlternativeAppearance
8383
set { SetDarkMode(darkMode, value); }
8484
}
8585

86+
// CONSTRUCTOR
87+
8688
public QlibFixedForm()
8789
{
8890
base.FormBorderStyle = FormBorderStyle.None;
@@ -100,6 +102,8 @@ public QlibFixedForm()
100102
TextChanged += QlibFixedForm_TextChanged;
101103
}
102104

105+
// PRIVATE BODY
106+
103107
protected override void OnHandleCreated(EventArgs e)
104108
{
105109
(new DropShadow()).ApplyShadows(this);

QuickLibrary/QlibNumeric.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ public QlibNumeric()
126126
numeric.ValueChanged += Numeric_ValueChanged;
127127
}
128128

129+
// PRIVATE BODY
130+
129131
private void DownBtn_Click(object sender, EventArgs e)
130132
{
131133
numeric.DownButton();
@@ -136,8 +138,6 @@ private void UpBtn_Click(object sender, EventArgs e)
136138
numeric.UpButton();
137139
}
138140

139-
// PRIVATE BODY
140-
141141
private void Numeric_ValueChanged(object sender, EventArgs e)
142142
{
143143
OnValueChanged(e);
@@ -174,8 +174,6 @@ protected override void OnPaint(PaintEventArgs e)
174174
}
175175
}
176176

177-
// PUBLIC METHODS
178-
179177
private void SetDarkMode(bool dark)
180178
{
181179
darkMode = dark;

QuickLibrary/QlibTextBox.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ private void QlibTextBox_SizeChanged(object sender, EventArgs e)
116116
textBox.Size = new Size(Size.Width - 14, textBox.Size.Height);
117117
}
118118

119-
// PUBLIC METHODS
120-
121119
private void SetDarkMode(bool dark)
122120
{
123121
darkMode = dark;
1 KB
Binary file not shown.
6 KB
Binary file not shown.
1 KB
Binary file not shown.

0 commit comments

Comments
 (0)