Skip to content

Commit ba78680

Browse files
committed
v2.2.6
1 parent 224df50 commit ba78680

File tree

14 files changed

+240
-122
lines changed

14 files changed

+240
-122
lines changed

.vs/QuickLibrary/v16/.suo

5 KB
Binary file not shown.
4 KB
Binary file not shown.

QuickLibrary/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// set of attributes. Change these attribute values to modify the information
77
// associated with an assembly.
88
[assembly: AssemblyTitle("QuickLibrary")]
9-
[assembly: AssemblyDescription("Windows Forms Control library for Quick Picture Viewer, Quick Screen Recorder...")]
9+
[assembly: AssemblyDescription("WinForms Control class library for \"Quick\" apps and Tinote Sticky Notes (.NET Framework).")]
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("Module Art")]
1212
[assembly: AssemblyProduct("QuickLibrary")]
@@ -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.2.4")]
36-
[assembly: AssemblyFileVersion("2.2.4")]
35+
[assembly: AssemblyVersion("2.2.6")]
36+
[assembly: AssemblyFileVersion("2.2.6")]
3737
[assembly: NeutralResourcesLanguage("en")]

QuickLibrary/QlibCheckBox.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class QlibCheckBox : CheckBox
1212
// PRIVATE FIELDS
1313

1414
private bool darkMode = false;
15-
private string darkText;
1615
private bool hovered = false;
1716
private bool pressed = false;
1817

@@ -97,10 +96,7 @@ public bool DarkMode
9796

9897
public QlibCheckBox()
9998
{
100-
if (darkMode)
101-
{
102-
103-
}
99+
104100
}
105101

106102
// PRIVATE BODY
@@ -137,8 +133,6 @@ private void SetDarkMode(bool dark)
137133
{
138134
base.BackColor = ThemeManager.DarkBackColor;
139135
base.ForeColor = Color.White;
140-
darkText = Text;
141-
//Text = " ";
142136

143137
SetStyle(ControlStyles.UserPaint, true);
144138
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
@@ -190,13 +184,13 @@ protected override void OnPaint(PaintEventArgs e)
190184

191185
if (Enabled)
192186
{
193-
e.Graphics.DrawLine(new Pen(ForeColor, 2), 2, top + 8, 5, top + 11);
194-
e.Graphics.DrawLine(new Pen(ForeColor, 2), 5, top + 12, 12, top + 5);
187+
e.Graphics.DrawLine(new Pen(ForeColor, 2), 2, top + 9, 5, top + 12);
188+
e.Graphics.DrawLine(new Pen(ForeColor, 2), 5, top + 13, 12, top + 6);
195189
}
196190
else
197191
{
198-
e.Graphics.DrawLine(new Pen(ThemeManager.BorderColor, 2), 2, top + 8, 5, top + 11);
199-
e.Graphics.DrawLine(new Pen(ThemeManager.BorderColor, 2), 5, top + 12, 12, top + 5);
192+
e.Graphics.DrawLine(new Pen(ThemeManager.BorderColor, 2), 2, top + 9, 5, top + 12);
193+
e.Graphics.DrawLine(new Pen(ThemeManager.BorderColor, 2), 5, top + 13, 12, top + 6);
200194
}
201195
}
202196

QuickLibrary/QlibFixedForm.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class QlibFixedForm : Form
1212

1313
private bool darkMode = false;
1414
private bool alternativeAppearance = false;
15+
private Color customBackColor = Color.White;
1516

1617
// HIDDEN PROPS
1718

@@ -62,6 +63,20 @@ public class QlibFixedForm : Form
6263

6364
// PUBLIC PROPS
6465

66+
[Category("Qlib props"), Browsable(true), Description("Custom back color")]
67+
public Color CustomBackColor
68+
{
69+
get { return customBackColor; }
70+
set
71+
{
72+
customBackColor = value;
73+
base.BackColor = value;
74+
}
75+
}
76+
77+
[Category("Qlib props"), Browsable(true), Description("Custom back color")]
78+
public bool CustomBack { get; set; } = false;
79+
6580
[Category("Qlib props"), Browsable(true), Description("Draggable form")]
6681
public bool Draggable { get; set; } = false;
6782

@@ -160,7 +175,11 @@ private void SetDarkMode(bool dark, bool alternative)
160175
{
161176
base.ForeColor = Color.White;
162177

163-
if (alternative)
178+
if (CustomBack)
179+
{
180+
base.BackColor = customBackColor;
181+
}
182+
else if (alternative)
164183
{
165184
base.BackColor = ThemeManager.DarkMainColor;
166185
}
@@ -173,7 +192,11 @@ private void SetDarkMode(bool dark, bool alternative)
173192
{
174193
base.ForeColor = Color.Black;
175194

176-
if (alternative)
195+
if (CustomBack)
196+
{
197+
base.BackColor = customBackColor;
198+
}
199+
else if (alternative)
177200
{
178201
base.BackColor = ThemeManager.LightMainColor;
179202
}

QuickLibrary/QlibRadio.cs

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.Drawing;
4+
using System.Drawing.Drawing2D;
5+
using System.Drawing.Text;
6+
using System.Windows.Forms;
7+
8+
namespace QuickLibrary
9+
{
10+
public class QlibRadio : RadioButton
11+
{
12+
// PRIVATE FIELDS
13+
14+
private bool darkMode = false;
15+
private bool hovered = false;
16+
private bool pressed = false;
17+
18+
// HIDDEN PROPS
19+
20+
[Browsable(false)]
21+
public new Appearance Appearance => base.Appearance;
22+
23+
[Browsable(false)]
24+
public new Color ForeColor => base.ForeColor;
25+
26+
[Browsable(false)]
27+
public new Color BackColor => base.BackColor;
28+
29+
[Browsable(false)]
30+
public new Image BackgroundImage => base.BackgroundImage;
31+
32+
[Browsable(false)]
33+
public new ImageLayout BackgroundImageLayout => base.BackgroundImageLayout;
34+
35+
[Browsable(false)]
36+
public new ContentAlignment CheckAlign => base.CheckAlign;
37+
38+
[Browsable(false)]
39+
public new Image Image => base.Image;
40+
41+
[Browsable(false)]
42+
public new Cursor Cursor => base.Cursor;
43+
44+
[Browsable(false)]
45+
public new FlatButtonAppearance FlatAppearance => base.FlatAppearance;
46+
47+
[Browsable(false)]
48+
public new FlatStyle FlatStyle => base.FlatStyle;
49+
50+
[Browsable(false)]
51+
public new ContentAlignment ImageAlign => base.ImageAlign;
52+
53+
[Browsable(false)]
54+
public new int ImageIndex => base.ImageIndex;
55+
56+
[Browsable(false)]
57+
public new string ImageKey => base.ImageKey;
58+
59+
[Browsable(false)]
60+
public new Padding Padding => base.Padding;
61+
62+
[Browsable(false)]
63+
public new RightToLeft RightToLeft => base.RightToLeft;
64+
65+
[Browsable(false)]
66+
public new bool AutoSize => base.AutoSize;
67+
68+
[Browsable(false)]
69+
public new DockStyle Dock => base.Dock;
70+
71+
[Browsable(false)]
72+
public new Size MinimumSize => base.MinimumSize;
73+
74+
[Browsable(false)]
75+
public new Size MaximumSize => base.MaximumSize;
76+
77+
[Browsable(false)]
78+
public new bool AutoCheck => base.AutoCheck;
79+
80+
// PUBLIC PROPS
81+
82+
[Category("Qlib props"), Browsable(true), Description("Dark mode")]
83+
public bool DarkMode
84+
{
85+
get { return darkMode; }
86+
set { SetDarkMode(value); }
87+
}
88+
89+
// CONSTRUCTOR
90+
91+
public QlibRadio()
92+
{
93+
94+
}
95+
96+
// PRIVATE BODY
97+
98+
private void CustomCheckBox_MouseUp(object sender, MouseEventArgs e)
99+
{
100+
pressed = false;
101+
Refresh();
102+
}
103+
104+
private void CustomCheckBox_MouseDown(object sender, MouseEventArgs e)
105+
{
106+
pressed = true;
107+
Refresh();
108+
}
109+
110+
private void CustomCheckBox_MouseLeave(object sender, EventArgs e)
111+
{
112+
hovered = false;
113+
Refresh();
114+
}
115+
116+
private void CustomCheckBox_MouseEnter(object sender, EventArgs e)
117+
{
118+
hovered = true;
119+
Refresh();
120+
}
121+
122+
private void SetDarkMode(bool dark)
123+
{
124+
darkMode = dark;
125+
126+
if (dark)
127+
{
128+
base.BackColor = ThemeManager.DarkBackColor;
129+
base.ForeColor = Color.White;
130+
131+
SetStyle(ControlStyles.UserPaint, true);
132+
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
133+
134+
MouseEnter += CustomCheckBox_MouseEnter;
135+
MouseLeave += CustomCheckBox_MouseLeave;
136+
MouseDown += CustomCheckBox_MouseDown;
137+
MouseUp += CustomCheckBox_MouseUp;
138+
}
139+
else
140+
{
141+
base.BackColor = ThemeManager.LightBackColor;
142+
base.ForeColor = Color.Black;
143+
}
144+
}
145+
146+
protected override void OnPaint(PaintEventArgs e)
147+
{
148+
if (darkMode)
149+
{
150+
int top = (Height / 2) - 8;
151+
152+
e.Graphics.Clear(ThemeManager.DarkBackColor);
153+
154+
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
155+
156+
if (pressed)
157+
{
158+
e.Graphics.FillEllipse(new SolidBrush(ThemeManager.PressedColor), new Rectangle(0, top + 2, 15, 15));
159+
}
160+
else
161+
{
162+
if (hovered)
163+
{
164+
e.Graphics.FillEllipse(new SolidBrush(ThemeManager.DarkHoverColor), new Rectangle(0, top + 2, 15, 15));
165+
}
166+
else
167+
{
168+
e.Graphics.FillEllipse(new SolidBrush(ThemeManager.DarkSecondColor), new Rectangle(0, top + 2, 15, 15));
169+
}
170+
}
171+
172+
if (Focused)
173+
{
174+
e.Graphics.DrawEllipse(new Pen(ThemeManager.BorderColor, 2), new Rectangle(1, top + 3, 13, 13));
175+
}
176+
177+
if (Checked)
178+
{
179+
if (Enabled)
180+
{
181+
e.Graphics.FillEllipse(new SolidBrush(ForeColor), new Rectangle(4, top + 6, 7, 7));
182+
}
183+
else
184+
{
185+
e.Graphics.FillEllipse(new SolidBrush(ThemeManager.BorderColor), new Rectangle(4, top + 6, 7, 7));
186+
}
187+
}
188+
189+
e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
190+
if (Enabled)
191+
{
192+
e.Graphics.DrawString(Text, Font, new SolidBrush(ForeColor), 22, top);
193+
}
194+
else
195+
{
196+
e.Graphics.DrawString(Text, Font, new SolidBrush(ThemeManager.BorderColor), 22, top);
197+
}
198+
}
199+
else
200+
{
201+
base.OnPaint(e);
202+
}
203+
}
204+
}
205+
}

0 commit comments

Comments
 (0)