Skip to content

Commit

Permalink
Version 3.15.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaskohl committed Nov 21, 2021
1 parent 4128235 commit f92c2b7
Show file tree
Hide file tree
Showing 33 changed files with 1,801 additions and 629 deletions.
17 changes: 8 additions & 9 deletions CapsLockIndicatorV3/AdvancedSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions CapsLockIndicatorV3/AdvancedSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public AdvancedSettings()
}

pictureBox1.Image = IconExtractor.GetIcon("imageres.dll", 79, 48)?.ToBitmap();

Text = strings.advancedSettingsTitle;
label2.Text = strings.headerWarning;
label3.Text = strings.advancedSettingsWarning;
checkBox1.Text = strings.advancedSettingsConfirmation;
button1.Text = strings.ok;
}

private void ListView1_ItemActivate(object sender, EventArgs e)
Expand Down
3 changes: 0 additions & 3 deletions CapsLockIndicatorV3/AdvancedSettings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="label3.Text" xml:space="preserve">
<value>Changing advanced settings may cause unexpected behaviour and may lead to an unstable state of CapsLock Indicator. Please restart CapsLock Indicator after changing settings. Only change settings if you know what you are doing! Use this editor at your own risk!</value>
</data>
<metadata name="contextMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
Expand Down
21 changes: 17 additions & 4 deletions CapsLockIndicatorV3/BetterCheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,21 @@ public bool DarkMode
}
}

const int STARTX = 16;
const int STARTX = 13;
int StartX => (int)(DPIHelper.GetScalingFactorPercent(Handle) * STARTX);
const int STARTY = 1;

private TextFormatFlags TextRenderingFlags
{
get
{
var flags = TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.WordBreak;
if (!ShowKeyboardCues)
flags |= TextFormatFlags.HidePrefix;
return flags;
}
}

private static readonly Color N_Border = Color.FromArgb(137, 137, 137);
private static readonly Color N_Background = Color.FromArgb(0, 0, 0);
private static readonly Color N_Check = Color.FromArgb(222, 222, 222);
Expand Down Expand Up @@ -68,11 +80,12 @@ protected override void OnPaint(PaintEventArgs e)

if (!Enabled && FlatStyle != FlatStyle.System)
{
e.Graphics.SetClip(new Rectangle(STARTX, 0, Width - STARTX, Height));
var bounds = new Rectangle(StartX, 0, Width - StartX, Height);
e.Graphics.SetClip(bounds);
e.Graphics.Clear(bgColor);
e.Graphics.ResetClip();
// Use legacy "DrawText" to make it look exactly the same as default
TextRenderer.DrawText(e.Graphics, Text, Font, new Point(STARTX, STARTY), ForeColor.Blend(bgColor, 0.5d));
TextRenderer.DrawText(e.Graphics, base.Text, base.Font, bounds, base.ForeColor.Blend(bgColor, 0.5d), TextRenderingFlags);
}
}
else
Expand Down Expand Up @@ -153,7 +166,7 @@ protected override void OnPaint(PaintEventArgs e)
var textY = Height / 2 - textSz.Height / 2;
var textPt = new Point(boxSize + textMargin, textY);

TextRenderer.DrawText(e.Graphics, Text, Font, textPt, fg);
TextRenderer.DrawText(e.Graphics, Text, Font, new Rectangle(StartX, 0, Width - StartX, Height), fg, TextRenderingFlags);

var focusRect = new Rectangle(textPt, textSz);

Expand Down
Loading

0 comments on commit f92c2b7

Please sign in to comment.