mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8af8823ee4 | ||
|
|
ec0a1b710e | ||
|
|
2ac2e84161 | ||
|
|
14dc1741f7 | ||
|
|
fbed195194 |
@@ -379,7 +379,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
using (Font font = new Font("Arial", 9F))
|
using (Font font = new Font("Arial", 9F))
|
||||||
{
|
{
|
||||||
SizeF textSize = g.MeasureString(text2, font);
|
SizeF textSize = g.MeasureString(text2, font);
|
||||||
g.DrawString(text2, font, Brushes.White, (MaxColumns * 3 - textSize.Width), 25);
|
g.DrawString(text2, font, Brushes.White, (MaxColumns * 3 - textSize.Width)+1, 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using CustomControls;
|
using CustomControls;
|
||||||
|
using WinFormsSliderBar;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Windows.Forms.DataVisualization.Charting;
|
using System.Windows.Forms.DataVisualization.Charting;
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ public static class ControlHelper
|
|||||||
foreMain = SystemColors.ControlText;
|
foreMain = SystemColors.ControlText;
|
||||||
foreAccent = Color.LightGray;
|
foreAccent = Color.LightGray;
|
||||||
borderMain = Color.LightGray;
|
borderMain = Color.LightGray;
|
||||||
buttonMain = Color.FromArgb(255, 230, 230, 230);
|
buttonMain = Color.FromArgb(255, 250, 250, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
container.BackColor = formBack;
|
container.BackColor = formBack;
|
||||||
@@ -53,7 +54,7 @@ public static class ControlHelper
|
|||||||
public static void Resize(RForm container, float baseScale = 2)
|
public static void Resize(RForm container, float baseScale = 2)
|
||||||
{
|
{
|
||||||
_scale = GetDpiScale(container).Value / baseScale;
|
_scale = GetDpiScale(container).Value / baseScale;
|
||||||
ResizeControls(container.Controls);
|
if (Math.Abs(_scale - 1) > 0.2) ResizeControls(container.Controls);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,9 +66,11 @@ public static class ControlHelper
|
|||||||
if (button != null && button.Image is not null)
|
if (button != null && button.Image is not null)
|
||||||
button.Image = ResizeImage(button.Image);
|
button.Image = ResizeImage(button.Image);
|
||||||
|
|
||||||
|
/*
|
||||||
var pictureBox = control as PictureBox;
|
var pictureBox = control as PictureBox;
|
||||||
if (pictureBox != null && pictureBox.BackgroundImage is not null)
|
if (pictureBox != null && pictureBox.BackgroundImage is not null)
|
||||||
pictureBox.BackgroundImage = ResizeImage(pictureBox.BackgroundImage);
|
pictureBox.BackgroundImage = ResizeImage(pictureBox.BackgroundImage);
|
||||||
|
*/
|
||||||
|
|
||||||
ResizeControls(control.Controls);
|
ResizeControls(control.Controls);
|
||||||
}
|
}
|
||||||
@@ -111,6 +114,11 @@ public static class ControlHelper
|
|||||||
gb.ForeColor = foreMain;
|
gb.ForeColor = foreMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sl = control as Slider;
|
||||||
|
if (sl != null)
|
||||||
|
{
|
||||||
|
sl.borderColor = buttonMain;
|
||||||
|
}
|
||||||
|
|
||||||
var chart = control as Chart;
|
var chart = control as Chart;
|
||||||
if (chart != null)
|
if (chart != null)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ namespace CustomControls
|
|||||||
return (int)registryValueObject <= 0;
|
return (int)registryValueObject <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool InitTheme(bool setDPI = true)
|
public bool InitTheme(bool setDPI = false)
|
||||||
{
|
{
|
||||||
bool newDarkTheme = CheckSystemDarkModeStatus();
|
bool newDarkTheme = CheckSystemDarkModeStatus();
|
||||||
bool changed = (darkTheme != newDarkTheme);
|
bool changed = (darkTheme != newDarkTheme);
|
||||||
@@ -52,11 +53,6 @@ namespace CustomControls
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class RTrackBar : TrackBar
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RComboBox : ComboBox
|
public class RComboBox : ComboBox
|
||||||
{
|
{
|
||||||
private Color borderColor = Color.Gray;
|
private Color borderColor = Color.Gray;
|
||||||
@@ -73,6 +69,8 @@ namespace CustomControls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Color buttonColor = Color.FromArgb(255,230, 230, 230);
|
private Color buttonColor = Color.FromArgb(255,230, 230, 230);
|
||||||
[DefaultValue(typeof(Color), "230, 230, 230")]
|
[DefaultValue(typeof(Color), "230, 230, 230")]
|
||||||
public Color ButtonColor
|
public Color ButtonColor
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.41</AssemblyVersion>
|
<AssemblyVersion>0.42</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -674,6 +674,7 @@ public class NativeMethods
|
|||||||
|
|
||||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||||
|
|
||||||
|
/*
|
||||||
var hrDC = PowerWriteDCValueIndex(
|
var hrDC = PowerWriteDCValueIndex(
|
||||||
IntPtr.Zero,
|
IntPtr.Zero,
|
||||||
activeSchemeGuid,
|
activeSchemeGuid,
|
||||||
@@ -682,6 +683,7 @@ public class NativeMethods
|
|||||||
boost);
|
boost);
|
||||||
|
|
||||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||||
|
*/
|
||||||
|
|
||||||
Logger.WriteLine("Boost " + boost);
|
Logger.WriteLine("Boost " + boost);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,13 +103,13 @@ namespace GHelper
|
|||||||
case UserPreferenceCategory.General:
|
case UserPreferenceCategory.General:
|
||||||
Debug.WriteLine("Theme Changed");
|
Debug.WriteLine("Theme Changed");
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
settingsForm.InitTheme(false);
|
settingsForm.InitTheme();
|
||||||
|
|
||||||
if (settingsForm.fans is not null && settingsForm.fans.Text != "")
|
if (settingsForm.fans is not null && settingsForm.fans.Text != "")
|
||||||
settingsForm.fans.InitTheme(false);
|
settingsForm.fans.InitTheme();
|
||||||
|
|
||||||
if (settingsForm.keyb is not null && settingsForm.keyb.Text != "")
|
if (settingsForm.keyb is not null && settingsForm.keyb.Text != "")
|
||||||
settingsForm.keyb.InitTheme(false);
|
settingsForm.keyb.InitTheme();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
35
app/Settings.Designer.cs
generated
35
app/Settings.Designer.cs
generated
@@ -40,12 +40,12 @@ namespace GHelper
|
|||||||
pictureMatrix = new PictureBox();
|
pictureMatrix = new PictureBox();
|
||||||
labelMatrix = new Label();
|
labelMatrix = new Label();
|
||||||
panelBattery = new Panel();
|
panelBattery = new Panel();
|
||||||
|
sliderBattery = new WinFormsSliderBar.Slider();
|
||||||
labelModel = new Label();
|
labelModel = new Label();
|
||||||
labelVersion = new Label();
|
labelVersion = new Label();
|
||||||
labelBattery = new Label();
|
labelBattery = new Label();
|
||||||
pictureBattery = new PictureBox();
|
pictureBattery = new PictureBox();
|
||||||
labelBatteryTitle = new Label();
|
labelBatteryTitle = new Label();
|
||||||
trackBattery = new TrackBar();
|
|
||||||
panelFooter = new Panel();
|
panelFooter = new Panel();
|
||||||
buttonQuit = new RButton();
|
buttonQuit = new RButton();
|
||||||
checkStartup = new CheckBox();
|
checkStartup = new CheckBox();
|
||||||
@@ -93,7 +93,6 @@ namespace GHelper
|
|||||||
((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit();
|
||||||
panelBattery.SuspendLayout();
|
panelBattery.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBattery).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBattery).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)trackBattery).BeginInit();
|
|
||||||
panelFooter.SuspendLayout();
|
panelFooter.SuspendLayout();
|
||||||
panelPerformance.SuspendLayout();
|
panelPerformance.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)picturePerf).BeginInit();
|
((System.ComponentModel.ISupportInitialize)picturePerf).BeginInit();
|
||||||
@@ -237,12 +236,12 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
panelBattery.AutoSize = true;
|
panelBattery.AutoSize = true;
|
||||||
panelBattery.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
panelBattery.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
|
panelBattery.Controls.Add(sliderBattery);
|
||||||
panelBattery.Controls.Add(labelModel);
|
panelBattery.Controls.Add(labelModel);
|
||||||
panelBattery.Controls.Add(labelVersion);
|
panelBattery.Controls.Add(labelVersion);
|
||||||
panelBattery.Controls.Add(labelBattery);
|
panelBattery.Controls.Add(labelBattery);
|
||||||
panelBattery.Controls.Add(pictureBattery);
|
panelBattery.Controls.Add(pictureBattery);
|
||||||
panelBattery.Controls.Add(labelBatteryTitle);
|
panelBattery.Controls.Add(labelBatteryTitle);
|
||||||
panelBattery.Controls.Add(trackBattery);
|
|
||||||
panelBattery.Dock = DockStyle.Top;
|
panelBattery.Dock = DockStyle.Top;
|
||||||
panelBattery.Location = new Point(10, 926);
|
panelBattery.Location = new Point(10, 926);
|
||||||
panelBattery.Margin = new Padding(8);
|
panelBattery.Margin = new Padding(8);
|
||||||
@@ -251,6 +250,17 @@ namespace GHelper
|
|||||||
panelBattery.Size = new Size(810, 163);
|
panelBattery.Size = new Size(810, 163);
|
||||||
panelBattery.TabIndex = 34;
|
panelBattery.TabIndex = 34;
|
||||||
//
|
//
|
||||||
|
// sliderBattery
|
||||||
|
//
|
||||||
|
sliderBattery.Location = new Point(16, 70);
|
||||||
|
sliderBattery.Max = 100;
|
||||||
|
sliderBattery.Min = 50;
|
||||||
|
sliderBattery.Name = "sliderBattery";
|
||||||
|
sliderBattery.Size = new Size(772, 40);
|
||||||
|
sliderBattery.TabIndex = 39;
|
||||||
|
sliderBattery.Text = "sliderBattery";
|
||||||
|
sliderBattery.Value = 80;
|
||||||
|
//
|
||||||
// labelModel
|
// labelModel
|
||||||
//
|
//
|
||||||
labelModel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
labelModel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
@@ -307,22 +317,6 @@ namespace GHelper
|
|||||||
labelBatteryTitle.TabIndex = 34;
|
labelBatteryTitle.TabIndex = 34;
|
||||||
labelBatteryTitle.Text = "Battery Charge Limit";
|
labelBatteryTitle.Text = "Battery Charge Limit";
|
||||||
//
|
//
|
||||||
// trackBattery
|
|
||||||
//
|
|
||||||
trackBattery.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
trackBattery.LargeChange = 10;
|
|
||||||
trackBattery.Location = new Point(20, 52);
|
|
||||||
trackBattery.Margin = new Padding(8, 4, 8, 4);
|
|
||||||
trackBattery.Maximum = 100;
|
|
||||||
trackBattery.Minimum = 50;
|
|
||||||
trackBattery.Name = "trackBattery";
|
|
||||||
trackBattery.Size = new Size(766, 90);
|
|
||||||
trackBattery.SmallChange = 5;
|
|
||||||
trackBattery.TabIndex = 33;
|
|
||||||
trackBattery.TickFrequency = 10;
|
|
||||||
trackBattery.TickStyle = TickStyle.TopLeft;
|
|
||||||
trackBattery.Value = 100;
|
|
||||||
//
|
|
||||||
// panelFooter
|
// panelFooter
|
||||||
//
|
//
|
||||||
panelFooter.AutoSize = true;
|
panelFooter.AutoSize = true;
|
||||||
@@ -1033,7 +1027,6 @@ namespace GHelper
|
|||||||
panelBattery.ResumeLayout(false);
|
panelBattery.ResumeLayout(false);
|
||||||
panelBattery.PerformLayout();
|
panelBattery.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBattery).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureBattery).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)trackBattery).EndInit();
|
|
||||||
panelFooter.ResumeLayout(false);
|
panelFooter.ResumeLayout(false);
|
||||||
panelFooter.PerformLayout();
|
panelFooter.PerformLayout();
|
||||||
panelPerformance.ResumeLayout(false);
|
panelPerformance.ResumeLayout(false);
|
||||||
@@ -1069,7 +1062,6 @@ namespace GHelper
|
|||||||
private Label labelBattery;
|
private Label labelBattery;
|
||||||
private PictureBox pictureBattery;
|
private PictureBox pictureBattery;
|
||||||
private Label labelBatteryTitle;
|
private Label labelBatteryTitle;
|
||||||
private TrackBar trackBattery;
|
|
||||||
private Panel panelFooter;
|
private Panel panelFooter;
|
||||||
private RButton buttonQuit;
|
private RButton buttonQuit;
|
||||||
private CheckBox checkStartup;
|
private CheckBox checkStartup;
|
||||||
@@ -1118,5 +1110,6 @@ namespace GHelper
|
|||||||
private RButton buttonFans;
|
private RButton buttonFans;
|
||||||
private Label labelMidFan;
|
private Label labelMidFan;
|
||||||
private Label labelModel;
|
private Label labelModel;
|
||||||
|
private WinFormsSliderBar.Slider sliderBattery;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ namespace GHelper
|
|||||||
public SettingsForm()
|
public SettingsForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
InitTheme();
|
InitTheme(true);
|
||||||
|
|
||||||
FormClosing += SettingsForm_FormClosing;
|
FormClosing += SettingsForm_FormClosing;
|
||||||
|
|
||||||
@@ -115,11 +115,9 @@ namespace GHelper
|
|||||||
button120Hz.MouseMove += Button120Hz_MouseHover;
|
button120Hz.MouseMove += Button120Hz_MouseHover;
|
||||||
button120Hz.MouseLeave += ButtonScreen_MouseLeave;
|
button120Hz.MouseLeave += ButtonScreen_MouseLeave;
|
||||||
|
|
||||||
trackBattery.ValueChanged += TrackBattery_ValueChanged;
|
sliderBattery.ValueChanged += SliderBattery_ValueChanged;
|
||||||
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
|
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
|
||||||
|
|
||||||
//buttonStandard.Image = (Image)(new Bitmap(buttonStandard.Image, new Size(16, 16)));
|
|
||||||
|
|
||||||
aTimer = new System.Timers.Timer(500);
|
aTimer = new System.Timers.Timer(500);
|
||||||
aTimer.Elapsed += OnTimedEvent;
|
aTimer.Elapsed += OnTimedEvent;
|
||||||
|
|
||||||
@@ -146,10 +144,9 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SliderBattery_ValueChanged(object? sender, EventArgs e)
|
||||||
private void TrackBattery_ValueChanged(object? sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
SetBatteryChargeLimit(trackBattery.Value);
|
SetBatteryChargeLimit(sliderBattery.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -362,7 +359,8 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
format1 = "H:mm";
|
format1 = "H:mm";
|
||||||
format2 = "";
|
format2 = "";
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
format1 = "h:mm";
|
format1 = "h:mm";
|
||||||
format2 = "tt";
|
format2 = "tt";
|
||||||
@@ -372,7 +370,8 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
format1 = format1.Replace(":", " ");
|
format1 = format1.Replace(":", " ");
|
||||||
matrixTick = 0;
|
matrixTick = 0;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
matrixTick++;
|
matrixTick++;
|
||||||
}
|
}
|
||||||
@@ -936,7 +935,8 @@ namespace GHelper
|
|||||||
|
|
||||||
labelPerf.Text = "Performance Mode+";
|
labelPerf.Text = "Performance Mode+";
|
||||||
|
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
labelPerf.Text = "Performance Mode";
|
labelPerf.Text = "Performance Mode";
|
||||||
}
|
}
|
||||||
@@ -1324,8 +1324,10 @@ namespace GHelper
|
|||||||
|
|
||||||
if (limit < 40 || limit > 100) return;
|
if (limit < 40 || limit > 100) return;
|
||||||
|
|
||||||
|
//Debug.WriteLine(limit);
|
||||||
|
|
||||||
labelBatteryTitle.Text = "Battery Charge Limit: " + limit.ToString() + "%";
|
labelBatteryTitle.Text = "Battery Charge Limit: " + limit.ToString() + "%";
|
||||||
trackBattery.Value = limit;
|
sliderBattery.Value = limit;
|
||||||
|
|
||||||
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit);
|
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit);
|
||||||
Program.config.setConfig("charge_limit", limit);
|
Program.config.setConfig("charge_limit", limit);
|
||||||
|
|||||||
168
app/Slider.cs
Normal file
168
app/Slider.cs
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
|
namespace WinFormsSliderBar
|
||||||
|
{
|
||||||
|
public static class GraphicsExtensions
|
||||||
|
{
|
||||||
|
public static void DrawCircle(this Graphics g, Pen pen,
|
||||||
|
float centerX, float centerY, float radius)
|
||||||
|
{
|
||||||
|
g.DrawEllipse(pen, centerX - radius, centerY - radius,
|
||||||
|
radius + radius, radius + radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void FillCircle(this Graphics g, Brush brush,
|
||||||
|
float centerX, float centerY, float radius)
|
||||||
|
{
|
||||||
|
g.FillEllipse(brush, centerX - radius, centerY - radius,
|
||||||
|
radius + radius, radius + radius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Slider : Control
|
||||||
|
{
|
||||||
|
private float _radius;
|
||||||
|
private PointF _thumbPos;
|
||||||
|
private SizeF _barSize;
|
||||||
|
private PointF _barPos;
|
||||||
|
|
||||||
|
private int _step = 5;
|
||||||
|
|
||||||
|
public Color accentColor = Color.FromArgb(255, 58, 174, 239);
|
||||||
|
public Color borderColor = Color.White;
|
||||||
|
|
||||||
|
public event EventHandler ValueChanged;
|
||||||
|
|
||||||
|
public Slider()
|
||||||
|
{
|
||||||
|
// This reduces flicker
|
||||||
|
DoubleBuffered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _min = 0;
|
||||||
|
public int Min
|
||||||
|
{
|
||||||
|
get => _min;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_min = value;
|
||||||
|
RecalculateParameters();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _max = 100;
|
||||||
|
public int Max
|
||||||
|
{
|
||||||
|
get => _max;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_max = value;
|
||||||
|
RecalculateParameters();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _value = 50;
|
||||||
|
public int Value
|
||||||
|
{
|
||||||
|
get => _value;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
value = (int)Math.Round(value / (float)_step) * _step;
|
||||||
|
|
||||||
|
if (_value != value)
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
ValueChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
RecalculateParameters();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnPaint(e);
|
||||||
|
|
||||||
|
Brush brushAccent = new SolidBrush(accentColor);
|
||||||
|
Brush brushEmpty = new SolidBrush(Color.Gray);
|
||||||
|
Brush brushBorder = new SolidBrush(borderColor);
|
||||||
|
|
||||||
|
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
e.Graphics.FillRectangle(brushEmpty,
|
||||||
|
_barPos.X, _barPos.Y, _barSize.Width, _barSize.Height);
|
||||||
|
e.Graphics.FillRectangle(brushAccent,
|
||||||
|
_barPos.X, _barPos.Y, _thumbPos.X - _barPos.X, _barSize.Height);
|
||||||
|
|
||||||
|
e.Graphics.FillCircle(brushBorder, _thumbPos.X, _thumbPos.Y, _radius);
|
||||||
|
e.Graphics.FillCircle(brushAccent, _thumbPos.X, _thumbPos.Y, 0.7f * _radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnResize(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnResize(e);
|
||||||
|
RecalculateParameters();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RecalculateParameters()
|
||||||
|
{
|
||||||
|
_radius = 0.4F * ClientSize.Height;
|
||||||
|
_barSize = new SizeF(ClientSize.Width - 4 * _radius, ClientSize.Height * 0.15F);
|
||||||
|
_barPos = new PointF(_radius, (ClientSize.Height - _barSize.Height) / 2);
|
||||||
|
_thumbPos = new PointF(
|
||||||
|
_barSize.Width / (Max - Min) * (Value - Min) + _barPos.X,
|
||||||
|
_barPos.Y + 0.5f * _barSize.Height);
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _moving = false;
|
||||||
|
SizeF _delta;
|
||||||
|
|
||||||
|
protected override void OnMouseDown(MouseEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnMouseDown(e);
|
||||||
|
|
||||||
|
// Difference between tumb and mouse position.
|
||||||
|
_delta = new SizeF(e.Location.X - _thumbPos.X, e.Location.Y - _thumbPos.Y);
|
||||||
|
if (_delta.Width * _delta.Width + _delta.Height * _delta.Height <= _radius * _radius)
|
||||||
|
{
|
||||||
|
// Clicking inside thumb.
|
||||||
|
_moving = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_calculateValue(e);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _calculateValue(MouseEventArgs e)
|
||||||
|
{
|
||||||
|
float thumbX = e.Location.X; // - _delta.Width;
|
||||||
|
if (thumbX < _barPos.X)
|
||||||
|
{
|
||||||
|
thumbX = _barPos.X;
|
||||||
|
}
|
||||||
|
else if (thumbX > _barPos.X + _barSize.Width)
|
||||||
|
{
|
||||||
|
thumbX = _barPos.X + _barSize.Width;
|
||||||
|
}
|
||||||
|
Value = (int)Math.Round(Min + (thumbX - _barPos.X) * (Max - Min) / _barSize.Width);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnMouseMove(MouseEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnMouseMove(e);
|
||||||
|
if (_moving)
|
||||||
|
{
|
||||||
|
_calculateValue(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnMouseUp(MouseEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnMouseUp(e);
|
||||||
|
_moving = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -61,7 +61,8 @@ PPTs are shown for G14 2022, for other models PPTs will be different as they are
|
|||||||
## :question: FAQ
|
## :question: FAQ
|
||||||
|
|
||||||
### How do I stop Armory Crate install popup appearing every time I press M4 / Rog key?
|
### How do I stop Armory Crate install popup appearing every time I press M4 / Rog key?
|
||||||
Go to BIOS (F2 on boot), open Advanced Settings and disable "Armory Control Interface". If it still appears - delete or move somwhere following file C:\Windows\System32\ASUSACCI\ArmouryCrateKeyControl.exe
|
Go to BIOS (F2 on boot), open Advanced Settings and disable "Armory Control Interface".
|
||||||
|
If it still appears - delete or move somwhere following file ``C:\Windows\System32\ASUSACCI\ArmouryCrateKeyControl.exe``
|
||||||
|
|
||||||
### Why Ultimate GPU mode is not available on my laptop?
|
### Why Ultimate GPU mode is not available on my laptop?
|
||||||
Ultimate mode is supported (by hardware) only on G14 2022 (and possibly other models from 2022+)
|
Ultimate mode is supported (by hardware) only on G14 2022 (and possibly other models from 2022+)
|
||||||
|
|||||||
Reference in New Issue
Block a user