mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Allow DPI changes via text input
This commit is contained in:
64
app/AsusMouseSettings.Designer.cs
generated
64
app/AsusMouseSettings.Designer.cs
generated
@@ -44,8 +44,8 @@
|
|||||||
sliderDPI = new UI.Slider();
|
sliderDPI = new UI.Slider();
|
||||||
tableLayoutPanel1 = new TableLayoutPanel();
|
tableLayoutPanel1 = new TableLayoutPanel();
|
||||||
labelMinDPI = new Label();
|
labelMinDPI = new Label();
|
||||||
labelDPIValue = new Label();
|
|
||||||
labelMaxDPI = new Label();
|
labelMaxDPI = new Label();
|
||||||
|
numericUpDownCurrentDPI = new NumericUpDown();
|
||||||
panelDPITile = new Panel();
|
panelDPITile = new Panel();
|
||||||
pictureDPIColor = new PictureBox();
|
pictureDPIColor = new PictureBox();
|
||||||
buttonDPIColor = new UI.RButton();
|
buttonDPIColor = new UI.RButton();
|
||||||
@@ -94,6 +94,7 @@
|
|||||||
panelPerformanceOther.SuspendLayout();
|
panelPerformanceOther.SuspendLayout();
|
||||||
panelDPISettings.SuspendLayout();
|
panelDPISettings.SuspendLayout();
|
||||||
tableLayoutPanel1.SuspendLayout();
|
tableLayoutPanel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownCurrentDPI).BeginInit();
|
||||||
panelDPITile.SuspendLayout();
|
panelDPITile.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureDPIColor).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureDPIColor).BeginInit();
|
||||||
tableDPI.SuspendLayout();
|
tableDPI.SuspendLayout();
|
||||||
@@ -159,7 +160,7 @@
|
|||||||
panelPerformance.Location = new Point(11, 68);
|
panelPerformance.Location = new Point(11, 68);
|
||||||
panelPerformance.Name = "panelPerformance";
|
panelPerformance.Name = "panelPerformance";
|
||||||
panelPerformance.Padding = new Padding(0, 11, 0, 25);
|
panelPerformance.Padding = new Padding(0, 11, 0, 25);
|
||||||
panelPerformance.Size = new Size(654, 401);
|
panelPerformance.Size = new Size(654, 408);
|
||||||
panelPerformance.TabIndex = 1;
|
panelPerformance.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// panelPerformanceOther
|
// panelPerformanceOther
|
||||||
@@ -174,7 +175,7 @@
|
|||||||
panelPerformanceOther.Controls.Add(comboBoxPollingRate);
|
panelPerformanceOther.Controls.Add(comboBoxPollingRate);
|
||||||
panelPerformanceOther.Controls.Add(labelPollingRate);
|
panelPerformanceOther.Controls.Add(labelPollingRate);
|
||||||
panelPerformanceOther.Dock = DockStyle.Top;
|
panelPerformanceOther.Dock = DockStyle.Top;
|
||||||
panelPerformanceOther.Location = new Point(0, 233);
|
panelPerformanceOther.Location = new Point(0, 240);
|
||||||
panelPerformanceOther.Name = "panelPerformanceOther";
|
panelPerformanceOther.Name = "panelPerformanceOther";
|
||||||
panelPerformanceOther.Padding = new Padding(0, 11, 0, 11);
|
panelPerformanceOther.Padding = new Padding(0, 11, 0, 11);
|
||||||
panelPerformanceOther.Size = new Size(654, 143);
|
panelPerformanceOther.Size = new Size(654, 143);
|
||||||
@@ -270,14 +271,14 @@
|
|||||||
panelDPISettings.Dock = DockStyle.Top;
|
panelDPISettings.Dock = DockStyle.Top;
|
||||||
panelDPISettings.Location = new Point(0, 137);
|
panelDPISettings.Location = new Point(0, 137);
|
||||||
panelDPISettings.Name = "panelDPISettings";
|
panelDPISettings.Name = "panelDPISettings";
|
||||||
panelDPISettings.Size = new Size(654, 96);
|
panelDPISettings.Size = new Size(654, 103);
|
||||||
panelDPISettings.TabIndex = 44;
|
panelDPISettings.TabIndex = 44;
|
||||||
//
|
//
|
||||||
// sliderDPI
|
// sliderDPI
|
||||||
//
|
//
|
||||||
sliderDPI.AccessibleName = "DPI Slider";
|
sliderDPI.AccessibleName = "DPI Slider";
|
||||||
sliderDPI.Dock = DockStyle.Top;
|
sliderDPI.Dock = DockStyle.Top;
|
||||||
sliderDPI.Location = new Point(0, 66);
|
sliderDPI.Location = new Point(0, 73);
|
||||||
sliderDPI.Max = 35000;
|
sliderDPI.Max = 35000;
|
||||||
sliderDPI.Min = 100;
|
sliderDPI.Min = 100;
|
||||||
sliderDPI.Name = "sliderDPI";
|
sliderDPI.Name = "sliderDPI";
|
||||||
@@ -293,54 +294,58 @@
|
|||||||
tableLayoutPanel1.AutoSize = true;
|
tableLayoutPanel1.AutoSize = true;
|
||||||
tableLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
tableLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
tableLayoutPanel1.ColumnCount = 3;
|
tableLayoutPanel1.ColumnCount = 3;
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F));
|
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 38F));
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F));
|
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 24F));
|
||||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F));
|
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 38F));
|
||||||
tableLayoutPanel1.Controls.Add(labelMinDPI, 0, 0);
|
tableLayoutPanel1.Controls.Add(labelMinDPI, 0, 0);
|
||||||
tableLayoutPanel1.Controls.Add(labelDPIValue, 1, 0);
|
|
||||||
tableLayoutPanel1.Controls.Add(labelMaxDPI, 2, 0);
|
tableLayoutPanel1.Controls.Add(labelMaxDPI, 2, 0);
|
||||||
|
tableLayoutPanel1.Controls.Add(numericUpDownCurrentDPI, 1, 0);
|
||||||
tableLayoutPanel1.Dock = DockStyle.Top;
|
tableLayoutPanel1.Dock = DockStyle.Top;
|
||||||
tableLayoutPanel1.GrowStyle = TableLayoutPanelGrowStyle.FixedSize;
|
tableLayoutPanel1.GrowStyle = TableLayoutPanelGrowStyle.FixedSize;
|
||||||
tableLayoutPanel1.Location = new Point(0, 40);
|
tableLayoutPanel1.Location = new Point(0, 40);
|
||||||
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
tableLayoutPanel1.RowCount = 1;
|
tableLayoutPanel1.RowCount = 1;
|
||||||
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||||
tableLayoutPanel1.Size = new Size(654, 26);
|
tableLayoutPanel1.Size = new Size(654, 33);
|
||||||
tableLayoutPanel1.TabIndex = 47;
|
tableLayoutPanel1.TabIndex = 47;
|
||||||
//
|
//
|
||||||
// labelMinDPI
|
// labelMinDPI
|
||||||
//
|
//
|
||||||
|
labelMinDPI.Dock = DockStyle.Fill;
|
||||||
labelMinDPI.ForeColor = SystemColors.GrayText;
|
labelMinDPI.ForeColor = SystemColors.GrayText;
|
||||||
labelMinDPI.Location = new Point(6, 0);
|
labelMinDPI.Location = new Point(6, 0);
|
||||||
labelMinDPI.Margin = new Padding(6, 0, 6, 0);
|
labelMinDPI.Margin = new Padding(6, 0, 6, 0);
|
||||||
labelMinDPI.Name = "labelMinDPI";
|
labelMinDPI.Name = "labelMinDPI";
|
||||||
labelMinDPI.Size = new Size(105, 26);
|
labelMinDPI.Size = new Size(236, 33);
|
||||||
labelMinDPI.TabIndex = 45;
|
labelMinDPI.TabIndex = 45;
|
||||||
labelMinDPI.Text = "100";
|
labelMinDPI.Text = "100";
|
||||||
//
|
//
|
||||||
// labelDPIValue
|
|
||||||
//
|
|
||||||
labelDPIValue.Anchor = AnchorStyles.Top;
|
|
||||||
labelDPIValue.Location = new Point(271, 0);
|
|
||||||
labelDPIValue.Margin = new Padding(6, 0, 6, 0);
|
|
||||||
labelDPIValue.Name = "labelDPIValue";
|
|
||||||
labelDPIValue.Size = new Size(111, 26);
|
|
||||||
labelDPIValue.TabIndex = 44;
|
|
||||||
labelDPIValue.Text = "2000";
|
|
||||||
labelDPIValue.TextAlign = ContentAlignment.TopCenter;
|
|
||||||
//
|
|
||||||
// labelMaxDPI
|
// labelMaxDPI
|
||||||
//
|
//
|
||||||
labelMaxDPI.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
labelMaxDPI.Dock = DockStyle.Fill;
|
||||||
labelMaxDPI.ForeColor = SystemColors.GrayText;
|
labelMaxDPI.ForeColor = SystemColors.GrayText;
|
||||||
labelMaxDPI.Location = new Point(543, 0);
|
labelMaxDPI.Location = new Point(410, 0);
|
||||||
labelMaxDPI.Margin = new Padding(6, 0, 6, 0);
|
labelMaxDPI.Margin = new Padding(6, 0, 6, 0);
|
||||||
labelMaxDPI.Name = "labelMaxDPI";
|
labelMaxDPI.Name = "labelMaxDPI";
|
||||||
labelMaxDPI.Size = new Size(105, 26);
|
labelMaxDPI.Size = new Size(238, 33);
|
||||||
labelMaxDPI.TabIndex = 46;
|
labelMaxDPI.TabIndex = 46;
|
||||||
labelMaxDPI.Text = " 35000";
|
labelMaxDPI.Text = " 35000";
|
||||||
labelMaxDPI.TextAlign = ContentAlignment.TopRight;
|
labelMaxDPI.TextAlign = ContentAlignment.TopRight;
|
||||||
//
|
//
|
||||||
|
// numericUpDownCurrentDPI
|
||||||
|
//
|
||||||
|
numericUpDownCurrentDPI.BorderStyle = BorderStyle.None;
|
||||||
|
numericUpDownCurrentDPI.Dock = DockStyle.Fill;
|
||||||
|
numericUpDownCurrentDPI.Increment = new decimal(new int[] { 50, 0, 0, 0 });
|
||||||
|
numericUpDownCurrentDPI.Location = new Point(251, 3);
|
||||||
|
numericUpDownCurrentDPI.Maximum = new decimal(new int[] { 35000, 0, 0, 0 });
|
||||||
|
numericUpDownCurrentDPI.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
|
numericUpDownCurrentDPI.Name = "numericUpDownCurrentDPI";
|
||||||
|
numericUpDownCurrentDPI.Size = new Size(150, 27);
|
||||||
|
numericUpDownCurrentDPI.TabIndex = 47;
|
||||||
|
numericUpDownCurrentDPI.TextAlign = HorizontalAlignment.Center;
|
||||||
|
numericUpDownCurrentDPI.Value = new decimal(new int[] { 2000, 0, 0, 0 });
|
||||||
|
//
|
||||||
// panelDPITile
|
// panelDPITile
|
||||||
//
|
//
|
||||||
panelDPITile.Controls.Add(pictureDPIColor);
|
panelDPITile.Controls.Add(pictureDPIColor);
|
||||||
@@ -545,7 +550,7 @@
|
|||||||
panelLighting.Controls.Add(panelLightingContent);
|
panelLighting.Controls.Add(panelLightingContent);
|
||||||
panelLighting.Controls.Add(panelLightingHeader);
|
panelLighting.Controls.Add(panelLightingHeader);
|
||||||
panelLighting.Dock = DockStyle.Top;
|
panelLighting.Dock = DockStyle.Top;
|
||||||
panelLighting.Location = new Point(11, 469);
|
panelLighting.Location = new Point(11, 476);
|
||||||
panelLighting.Name = "panelLighting";
|
panelLighting.Name = "panelLighting";
|
||||||
panelLighting.Padding = new Padding(0, 0, 0, 25);
|
panelLighting.Padding = new Padding(0, 0, 0, 25);
|
||||||
panelLighting.Size = new Size(654, 271);
|
panelLighting.Size = new Size(654, 271);
|
||||||
@@ -734,7 +739,7 @@
|
|||||||
panelEnergy.Controls.Add(labelAutoPowerOff);
|
panelEnergy.Controls.Add(labelAutoPowerOff);
|
||||||
panelEnergy.Controls.Add(panelEnergyHeader);
|
panelEnergy.Controls.Add(panelEnergyHeader);
|
||||||
panelEnergy.Dock = DockStyle.Top;
|
panelEnergy.Dock = DockStyle.Top;
|
||||||
panelEnergy.Location = new Point(11, 740);
|
panelEnergy.Location = new Point(11, 747);
|
||||||
panelEnergy.Name = "panelEnergy";
|
panelEnergy.Name = "panelEnergy";
|
||||||
panelEnergy.Padding = new Padding(0, 0, 0, 25);
|
panelEnergy.Padding = new Padding(0, 0, 0, 25);
|
||||||
panelEnergy.Size = new Size(654, 143);
|
panelEnergy.Size = new Size(654, 143);
|
||||||
@@ -915,7 +920,7 @@
|
|||||||
panelBottomButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
panelBottomButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
panelBottomButtons.Controls.Add(buttonSync);
|
panelBottomButtons.Controls.Add(buttonSync);
|
||||||
panelBottomButtons.Dock = DockStyle.Top;
|
panelBottomButtons.Dock = DockStyle.Top;
|
||||||
panelBottomButtons.Location = new Point(11, 883);
|
panelBottomButtons.Location = new Point(11, 890);
|
||||||
panelBottomButtons.Name = "panelBottomButtons";
|
panelBottomButtons.Name = "panelBottomButtons";
|
||||||
panelBottomButtons.Size = new Size(654, 67);
|
panelBottomButtons.Size = new Size(654, 67);
|
||||||
panelBottomButtons.TabIndex = 47;
|
panelBottomButtons.TabIndex = 47;
|
||||||
@@ -950,6 +955,7 @@
|
|||||||
panelDPISettings.ResumeLayout(false);
|
panelDPISettings.ResumeLayout(false);
|
||||||
panelDPISettings.PerformLayout();
|
panelDPISettings.PerformLayout();
|
||||||
tableLayoutPanel1.ResumeLayout(false);
|
tableLayoutPanel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownCurrentDPI).EndInit();
|
||||||
panelDPITile.ResumeLayout(false);
|
panelDPITile.ResumeLayout(false);
|
||||||
panelDPITile.PerformLayout();
|
panelDPITile.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureDPIColor).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureDPIColor).EndInit();
|
||||||
@@ -1003,7 +1009,6 @@
|
|||||||
private Panel panelDPISettings;
|
private Panel panelDPISettings;
|
||||||
private TableLayoutPanel tableLayoutPanel1;
|
private TableLayoutPanel tableLayoutPanel1;
|
||||||
private Label labelMinDPI;
|
private Label labelMinDPI;
|
||||||
private Label labelDPIValue;
|
|
||||||
private Label labelMaxDPI;
|
private Label labelMaxDPI;
|
||||||
private Panel panelDPITile;
|
private Panel panelDPITile;
|
||||||
private Label labelDPI;
|
private Label labelDPI;
|
||||||
@@ -1041,5 +1046,6 @@
|
|||||||
private PictureBox pictureBoxBatteryState;
|
private PictureBox pictureBoxBatteryState;
|
||||||
private UI.RButton buttonSync;
|
private UI.RButton buttonSync;
|
||||||
private Panel panelBottomButtons;
|
private Panel panelBottomButtons;
|
||||||
|
private NumericUpDown numericUpDownCurrentDPI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,8 @@ namespace GHelper
|
|||||||
private readonly AsusMouse mouse;
|
private readonly AsusMouse mouse;
|
||||||
private readonly RButton[] dpiButtons;
|
private readonly RButton[] dpiButtons;
|
||||||
|
|
||||||
|
private bool updateMouseDPI = true;
|
||||||
|
|
||||||
public AsusMouseSettings(AsusMouse mouse)
|
public AsusMouseSettings(AsusMouse mouse)
|
||||||
{
|
{
|
||||||
this.mouse = mouse;
|
this.mouse = mouse;
|
||||||
@@ -55,7 +57,9 @@ namespace GHelper
|
|||||||
comboProfile.DropDownClosed += ComboProfile_DropDownClosed;
|
comboProfile.DropDownClosed += ComboProfile_DropDownClosed;
|
||||||
|
|
||||||
sliderDPI.ValueChanged += SliderDPI_ValueChanged;
|
sliderDPI.ValueChanged += SliderDPI_ValueChanged;
|
||||||
|
numericUpDownCurrentDPI.ValueChanged += NumericUpDownCurrentDPI_ValueChanged;
|
||||||
sliderDPI.MouseUp += SliderDPI_MouseUp;
|
sliderDPI.MouseUp += SliderDPI_MouseUp;
|
||||||
|
sliderDPI.MouseDown += SliderDPI_MouseDown;
|
||||||
buttonDPIColor.Click += ButtonDPIColor_Click;
|
buttonDPIColor.Click += ButtonDPIColor_Click;
|
||||||
buttonDPI1.Click += ButtonDPI_Click;
|
buttonDPI1.Click += ButtonDPI_Click;
|
||||||
buttonDPI2.Click += ButtonDPI_Click;
|
buttonDPI2.Click += ButtonDPI_Click;
|
||||||
@@ -265,11 +269,32 @@ namespace GHelper
|
|||||||
|
|
||||||
private void SliderDPI_ValueChanged(object? sender, EventArgs e)
|
private void SliderDPI_ValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
labelDPIValue.Text = sliderDPI.Value.ToString();
|
numericUpDownCurrentDPI.Value = sliderDPI.Value;
|
||||||
|
UpdateMouseDPISettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NumericUpDownCurrentDPI_ValueChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
sliderDPI.Value = (int)numericUpDownCurrentDPI.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SliderDPI_MouseDown(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
updateMouseDPI = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SliderDPI_MouseUp(object? sender, MouseEventArgs e)
|
private void SliderDPI_MouseUp(object? sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
|
updateMouseDPI = true;
|
||||||
|
UpdateMouseDPISettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateMouseDPISettings()
|
||||||
|
{
|
||||||
|
if (!updateMouseDPI)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
AsusMouseDPI dpi = mouse.DpiSettings[mouse.DpiProfile - 1];
|
AsusMouseDPI dpi = mouse.DpiSettings[mouse.DpiProfile - 1];
|
||||||
dpi.DPI = (uint)sliderDPI.Value;
|
dpi.DPI = (uint)sliderDPI.Value;
|
||||||
|
|
||||||
@@ -320,6 +345,9 @@ namespace GHelper
|
|||||||
sliderDPI.Max = mouse.MaxDPI();
|
sliderDPI.Max = mouse.MaxDPI();
|
||||||
sliderDPI.Min = mouse.MinDPI();
|
sliderDPI.Min = mouse.MinDPI();
|
||||||
|
|
||||||
|
numericUpDownCurrentDPI.Minimum = mouse.MinDPI();
|
||||||
|
numericUpDownCurrentDPI.Maximum = mouse.MaxDPI();
|
||||||
|
|
||||||
|
|
||||||
if (!mouse.HasDPIColors())
|
if (!mouse.HasDPIColors())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,6 +77,12 @@ public static class ControlHelper
|
|||||||
combo.ButtonColor = RForm.buttonMain;
|
combo.ButtonColor = RForm.buttonMain;
|
||||||
combo.ArrowColor = RForm.foreMain;
|
combo.ArrowColor = RForm.foreMain;
|
||||||
}
|
}
|
||||||
|
var numbericUpDown = control as NumericUpDown;
|
||||||
|
if(numbericUpDown is not null)
|
||||||
|
{
|
||||||
|
numbericUpDown.ForeColor = RForm.foreMain;
|
||||||
|
numbericUpDown.BackColor = RForm.buttonMain;
|
||||||
|
}
|
||||||
|
|
||||||
var gb = control as GroupBox;
|
var gb = control as GroupBox;
|
||||||
if (gb != null)
|
if (gb != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user