diff --git a/src/Taskbar/Taskbar.cs b/src/Taskbar/Taskbar.cs
index dff1d24..0b04b7f 100644
--- a/src/Taskbar/Taskbar.cs
+++ b/src/Taskbar/Taskbar.cs
@@ -37,13 +37,23 @@ public class Taskbar
///
private class Shared
{
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public static Point Location(Screen Screen, Enums.EdgeLocationType Edge, int Width, int Height, int Pixel = 32, Enums.Type Type = Enums.Type.Simple)
{
try
{
Enums.LocationType LocationType = Type switch
{
- Enums.Type.Advanced => Simple.Detect(Screen), //Change function advanced detection
+ Enums.Type.Advanced => Advanced.Position,
_ => Simple.Detect(Screen),
};
@@ -372,7 +382,7 @@ static Advanced()
};
//Get the taskbar window rect in screen coordinates
- GetWindowRect(Handle, ref Values.BarData.Rect);
+ _ = GetWindowRect(Handle, ref Values.BarData.Rect);
}
catch
{
@@ -561,6 +571,65 @@ public static void Show()
}
}
+ ///
+ /// Gets taskbar size.
+ ///
+ ///
+ public static Size Size()
+ {
+ try
+ {
+ //Detecting position
+ //width - height
+ return new(0, 0);
+ }
+ catch
+ {
+ throw new Exception(Values.Exception);
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static Point Location(Screen Screen, Enums.EdgeLocationType Edge, int Width, int Height, int Pixel = 32)
+ {
+ try
+ {
+ return Shared.Location(Screen, Edge, Width, Height, Pixel, Enums.Type.Advanced);
+ }
+ catch
+ {
+ throw new Exception(Values.Exception);
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static Point SingleLocation(Enums.EdgeLocationType Edge, int Width, int Height, int Pixel = 32)
+ {
+ try
+ {
+ return Location(Screen.PrimaryScreen, Edge, Width, Height, Pixel);
+ }
+ catch
+ {
+ throw new Exception(Values.Exception);
+ }
+ }
+
///
///
///
@@ -729,11 +798,10 @@ public static bool RefreshAll()
{
try
{
- //! SHAppBarMessage returns IntPtr.Zero **if it fails**
- //return SHAppBarMessage(Enums.MessageType.GetTaskbarPos, ref Values.BarData) != IntPtr.Zero;
- SHAppBarMessage(Enums.MessageType.GetTaskbarPos, ref Values.BarData);
+ RefreshData();
- return RefreshData();
+ //! SHAppBarMessage returns IntPtr.Zero **if it fails**
+ return SHAppBarMessage(Enums.MessageType.GetTaskbarPos, ref Values.BarData) != IntPtr.Zero;
}
catch
{
diff --git a/src/Taskbar_CR/Main.Designer.cs b/src/Taskbar_CR/Main.Designer.cs
index 3b8f30c..171d114 100644
--- a/src/Taskbar_CR/Main.Designer.cs
+++ b/src/Taskbar_CR/Main.Designer.cs
@@ -45,6 +45,7 @@ private void InitializeComponent()
this.button14 = new System.Windows.Forms.Button();
this.button15 = new System.Windows.Forms.Button();
this.button16 = new System.Windows.Forms.Button();
+ this.button17 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
@@ -129,7 +130,7 @@ private void InitializeComponent()
//
// button9
//
- this.button9.Location = new System.Drawing.Point(324, 246);
+ this.button9.Location = new System.Drawing.Point(12, 316);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(150, 64);
this.button9.TabIndex = 8;
@@ -139,7 +140,7 @@ private void InitializeComponent()
//
// button10
//
- this.button10.Location = new System.Drawing.Point(12, 316);
+ this.button10.Location = new System.Drawing.Point(168, 316);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(150, 64);
this.button10.TabIndex = 9;
@@ -149,7 +150,7 @@ private void InitializeComponent()
//
// button11
//
- this.button11.Location = new System.Drawing.Point(168, 316);
+ this.button11.Location = new System.Drawing.Point(324, 316);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(150, 64);
this.button11.TabIndex = 10;
@@ -159,7 +160,7 @@ private void InitializeComponent()
//
// button12
//
- this.button12.Location = new System.Drawing.Point(12, 386);
+ this.button12.Location = new System.Drawing.Point(168, 386);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(150, 64);
this.button12.TabIndex = 11;
@@ -169,7 +170,7 @@ private void InitializeComponent()
//
// button13
//
- this.button13.Location = new System.Drawing.Point(324, 316);
+ this.button13.Location = new System.Drawing.Point(12, 386);
this.button13.Name = "button13";
this.button13.Size = new System.Drawing.Size(150, 64);
this.button13.TabIndex = 12;
@@ -207,11 +208,22 @@ private void InitializeComponent()
this.button16.UseVisualStyleBackColor = true;
this.button16.Click += new System.EventHandler(this.Button16_Click);
//
+ // button17
+ //
+ this.button17.Location = new System.Drawing.Point(324, 246);
+ this.button17.Name = "button17";
+ this.button17.Size = new System.Drawing.Size(150, 64);
+ this.button17.TabIndex = 16;
+ this.button17.Text = "Advanced\r\nSingle Location";
+ this.button17.UseVisualStyleBackColor = true;
+ this.button17.Click += new System.EventHandler(this.Button17_Click);
+ //
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(486, 462);
+ this.Controls.Add(this.button17);
this.Controls.Add(this.button16);
this.Controls.Add(this.button15);
this.Controls.Add(this.button14);
@@ -228,7 +240,7 @@ private void InitializeComponent()
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
@@ -258,5 +270,6 @@ private void InitializeComponent()
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Button button15;
private System.Windows.Forms.Button button16;
+ private System.Windows.Forms.Button button17;
}
}
\ No newline at end of file
diff --git a/src/Taskbar_CR/Main.cs b/src/Taskbar_CR/Main.cs
index ee64a05..854cff4 100644
--- a/src/Taskbar_CR/Main.cs
+++ b/src/Taskbar_CR/Main.cs
@@ -40,66 +40,6 @@ private void Button2_Click(object sender, EventArgs e)
}
}
- private void Button3_Click(object sender, EventArgs e)
- {
- MessageBox.Show(Advanced.AlwaysOnTop.ToString());
- }
-
- private void Button4_Click(object sender, EventArgs e)
- {
- MessageBox.Show(Advanced.AutoHide.ToString());
- }
-
- private void Button5_Click(object sender, EventArgs e)
- {
- MessageBox.Show(Advanced.Position.ToString());
- }
-
- private void Button6_Click(object sender, EventArgs e)
- {
- Advanced.Hide();
- }
-
- private void Button7_Click(object sender, EventArgs e)
- {
- Advanced.Show();
- }
-
- private void Button9_Click(object sender, EventArgs e)
- {
- List Rectangle = Advanced.FindDockedTaskbarsList;
-
- foreach (Rectangle Var in Rectangle)
- {
- MessageBox.Show("X: " + Var.X + "\nY: " + Var.Y + "\nWidth: " + Var.Width + "\nHeight: " + Var.Height);
- }
- }
-
- private void Button10_Click(object sender, EventArgs e)
- {
- Dictionary Rectangle = Advanced.FindDockedTaskbarsDictionary;
-
- foreach (KeyValuePair Var in Rectangle)
- {
- MessageBox.Show("Screen " + Var.Key + " =>\n" + "\tX: " + Var.Value.X + "\n\tY: " + Var.Value.Y + "\n\tWidth: " + Var.Value.Width + "\n\tHeight: " + Var.Value.Height);
- }
- }
-
- private void Button11_Click(object sender, EventArgs e)
- {
- MessageBox.Show(Advanced.Data.Rect.Left + "\n" + Advanced.Data.Rect.Top + "\n" + Advanced.Data.Rect.Right + "\n" + Advanced.Data.Rect.Bot);
- }
-
- private void Button13_Click(object sender, EventArgs e)
- {
- Advanced.RefreshData();
- }
-
- private void Button12_Click(object sender, EventArgs e)
- {
- Advanced.RefreshAll();
- }
-
private void Button14_Click(object sender, EventArgs e)
{
Location = Simple.SingleLocation(Enums.EdgeLocationType.TopLeft, Width, Height, 32);
@@ -114,9 +54,9 @@ private void Button14_Click(object sender, EventArgs e)
Thread.Sleep(750);
Location = Simple.SingleLocation(Enums.EdgeLocationType.BotRight, Width, Height, 32);
Thread.Sleep(750);
- Location = Simple.SingleLocation(Enums.EdgeLocationType.LeftCenter, Width, Height);
+ Location = Simple.SingleLocation(Enums.EdgeLocationType.LeftCenter, Width, Height, 32);
Thread.Sleep(750);
- Location = Simple.SingleLocation(Enums.EdgeLocationType.RightCenter, Width, Height);
+ Location = Simple.SingleLocation(Enums.EdgeLocationType.RightCenter, Width, Height, 32);
Thread.Sleep(750);
Location = Simple.SingleLocation(Enums.EdgeLocationType.CalcCenter, Width, Height);
Thread.Sleep(750);
@@ -256,7 +196,7 @@ private void Button16_Click(object sender, EventArgs e)
MessageBox.Show("Screen " + Var.Key + " =>\n" + "\tX: " + Var.Value.X + "\n\tY: " + Var.Value.Y);
}
- Location = Simple.MultiLocationDictionary(Enums.EdgeLocationType.LeftCenter, Width, Height);
+ Location = Simple.MultiLocationDictionary(Enums.EdgeLocationType.LeftCenter, Width, Height, 32);
foreach (KeyValuePair Var in Location)
{
@@ -264,7 +204,7 @@ private void Button16_Click(object sender, EventArgs e)
MessageBox.Show("Screen " + Var.Key + " =>\n" + "\tX: " + Var.Value.X + "\n\tY: " + Var.Value.Y);
}
- Location = Simple.MultiLocationDictionary(Enums.EdgeLocationType.RightCenter, Width, Height);
+ Location = Simple.MultiLocationDictionary(Enums.EdgeLocationType.RightCenter, Width, Height, 32);
foreach (KeyValuePair Var in Location)
{
@@ -288,5 +228,88 @@ private void Button16_Click(object sender, EventArgs e)
MessageBox.Show("Screen " + Var.Key + " =>\n" + "\tX: " + Var.Value.X + "\n\tY: " + Var.Value.Y);
}
}
+
+ private void Button3_Click(object sender, EventArgs e)
+ {
+ MessageBox.Show(Advanced.AlwaysOnTop.ToString());
+ }
+
+ private void Button4_Click(object sender, EventArgs e)
+ {
+ MessageBox.Show(Advanced.AutoHide.ToString());
+ }
+
+ private void Button5_Click(object sender, EventArgs e)
+ {
+ MessageBox.Show(Advanced.Position.ToString());
+ }
+
+ private void Button6_Click(object sender, EventArgs e)
+ {
+ Advanced.Hide();
+ }
+
+ private void Button7_Click(object sender, EventArgs e)
+ {
+ Advanced.Show();
+ }
+
+ private void Button17_Click(object sender, EventArgs e)
+ {
+ Location = Advanced.SingleLocation(Enums.EdgeLocationType.TopLeft, Width, Height, 32);
+ Thread.Sleep(750);
+ Location = Advanced.SingleLocation(Enums.EdgeLocationType.TopCenter, Width, Height, 32);
+ Thread.Sleep(750);
+ Location = Advanced.SingleLocation(Enums.EdgeLocationType.TopRight, Width, Height, 32);
+ Thread.Sleep(750);
+ Location = Advanced.SingleLocation(Enums.EdgeLocationType.BotLeft, Width, Height, 32);
+ Thread.Sleep(750);
+ Location = Advanced.SingleLocation(Enums.EdgeLocationType.BotCenter, Width, Height, 32);
+ Thread.Sleep(750);
+ Location = Advanced.SingleLocation(Enums.EdgeLocationType.BotRight, Width, Height, 32);
+ Thread.Sleep(750);
+ Location = Advanced.SingleLocation(Enums.EdgeLocationType.LeftCenter, Width, Height, 32);
+ Thread.Sleep(750);
+ Location = Advanced.SingleLocation(Enums.EdgeLocationType.RightCenter, Width, Height, 32);
+ Thread.Sleep(750);
+ Location = Advanced.SingleLocation(Enums.EdgeLocationType.CalcCenter, Width, Height);
+ Thread.Sleep(750);
+ Location = Advanced.SingleLocation(Enums.EdgeLocationType.FullCenter, Width, Height);
+ }
+
+ private void Button9_Click(object sender, EventArgs e)
+ {
+ List Rectangle = Advanced.FindDockedTaskbarsList;
+
+ foreach (Rectangle Var in Rectangle)
+ {
+ MessageBox.Show("X: " + Var.X + "\nY: " + Var.Y + "\nWidth: " + Var.Width + "\nHeight: " + Var.Height);
+ }
+ }
+
+ private void Button10_Click(object sender, EventArgs e)
+ {
+ Dictionary Rectangle = Advanced.FindDockedTaskbarsDictionary;
+
+ foreach (KeyValuePair Var in Rectangle)
+ {
+ MessageBox.Show("Screen " + Var.Key + " =>\n" + "\tX: " + Var.Value.X + "\n\tY: " + Var.Value.Y + "\n\tWidth: " + Var.Value.Width + "\n\tHeight: " + Var.Value.Height);
+ }
+ }
+
+ private void Button11_Click(object sender, EventArgs e)
+ {
+ MessageBox.Show(Advanced.Data.Rect.Left + "\n" + Advanced.Data.Rect.Top + "\n" + Advanced.Data.Rect.Right + "\n" + Advanced.Data.Rect.Bot);
+ }
+
+ private void Button13_Click(object sender, EventArgs e)
+ {
+ Advanced.RefreshData();
+ }
+
+ private void Button12_Click(object sender, EventArgs e)
+ {
+ Advanced.RefreshAll();
+ }
}
}
\ No newline at end of file
diff --git a/src/Taskbar_CR/Main.resx b/src/Taskbar_CR/Main.resx
index 5e21712..03371f8 100644
--- a/src/Taskbar_CR/Main.resx
+++ b/src/Taskbar_CR/Main.resx
@@ -165,6 +165,9 @@
True
+
+ True
+
True