mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Add Pin to Top button to Inspect Window tool
This commit is contained in:
parent
7efc14112c
commit
8446c57ca5
3 changed files with 52 additions and 3 deletions
10
ShareX/Forms/InspectWindowForm.Designer.cs
generated
10
ShareX/Forms/InspectWindowForm.Designer.cs
generated
|
@ -35,6 +35,7 @@ private void InitializeComponent()
|
||||||
this.btnInspectWindow = new System.Windows.Forms.Button();
|
this.btnInspectWindow = new System.Windows.Forms.Button();
|
||||||
this.btnInspectControl = new System.Windows.Forms.Button();
|
this.btnInspectControl = new System.Windows.Forms.Button();
|
||||||
this.btnRefresh = new System.Windows.Forms.Button();
|
this.btnRefresh = new System.Windows.Forms.Button();
|
||||||
|
this.btnPinToTop = new System.Windows.Forms.Button();
|
||||||
this.pInfo.SuspendLayout();
|
this.pInfo.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
@ -74,10 +75,18 @@ private void InitializeComponent()
|
||||||
this.btnRefresh.UseVisualStyleBackColor = true;
|
this.btnRefresh.UseVisualStyleBackColor = true;
|
||||||
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
|
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
|
||||||
//
|
//
|
||||||
|
// btnPinToTop
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.btnPinToTop, "btnPinToTop");
|
||||||
|
this.btnPinToTop.Name = "btnPinToTop";
|
||||||
|
this.btnPinToTop.UseVisualStyleBackColor = true;
|
||||||
|
this.btnPinToTop.Click += new System.EventHandler(this.btnPinToTop_Click);
|
||||||
|
//
|
||||||
// InspectWindowForm
|
// InspectWindowForm
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.btnPinToTop);
|
||||||
this.Controls.Add(this.btnRefresh);
|
this.Controls.Add(this.btnRefresh);
|
||||||
this.Controls.Add(this.btnInspectControl);
|
this.Controls.Add(this.btnInspectControl);
|
||||||
this.Controls.Add(this.btnInspectWindow);
|
this.Controls.Add(this.btnInspectWindow);
|
||||||
|
@ -95,5 +104,6 @@ private void InitializeComponent()
|
||||||
private System.Windows.Forms.Button btnInspectWindow;
|
private System.Windows.Forms.Button btnInspectWindow;
|
||||||
private System.Windows.Forms.Button btnInspectControl;
|
private System.Windows.Forms.Button btnInspectControl;
|
||||||
private System.Windows.Forms.Button btnRefresh;
|
private System.Windows.Forms.Button btnRefresh;
|
||||||
|
private System.Windows.Forms.Button btnPinToTop;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -124,5 +124,17 @@ private void btnRefresh_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateWindowInfo();
|
UpdateWindowInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnPinToTop_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (SelectedWindow == null) return;
|
||||||
|
// Determine current Pinned status to toggle pin
|
||||||
|
IntPtr style = NativeMethods.GetWindowLong(SelectedWindow.Handle, NativeConstants.GWL_EXSTYLE);
|
||||||
|
SpecialWindowHandles flag = (style.ToInt32() & (int)WindowStyles.WS_EX_TOPMOST) != 0 ?
|
||||||
|
SpecialWindowHandles.HWND_NOTOPMOST : SpecialWindowHandles.HWND_TOPMOST;
|
||||||
|
|
||||||
|
NativeMethods.SetWindowPos(SelectedWindow.Handle, (IntPtr)flag,
|
||||||
|
0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -135,6 +135,9 @@
|
||||||
<data name="rtbInfo.TabIndex" type="System.Int32, mscorlib">
|
<data name="rtbInfo.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="rtbInfo.Text" xml:space="preserve">
|
||||||
|
<value />
|
||||||
|
</data>
|
||||||
<data name=">>rtbInfo.Name" xml:space="preserve">
|
<data name=">>rtbInfo.Name" xml:space="preserve">
|
||||||
<value>rtbInfo</value>
|
<value>rtbInfo</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -172,7 +175,7 @@
|
||||||
<value>$this</value>
|
<value>$this</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>pInfo.ZOrder" xml:space="preserve">
|
<data name=">>pInfo.ZOrder" xml:space="preserve">
|
||||||
<value>3</value>
|
<value>4</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnInspectWindow.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="btnInspectWindow.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>8, 8</value>
|
<value>8, 8</value>
|
||||||
|
@ -196,7 +199,7 @@
|
||||||
<value>$this</value>
|
<value>$this</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>btnInspectWindow.ZOrder" xml:space="preserve">
|
<data name=">>btnInspectWindow.ZOrder" xml:space="preserve">
|
||||||
<value>2</value>
|
<value>3</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnInspectControl.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="btnInspectControl.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>160, 8</value>
|
<value>160, 8</value>
|
||||||
|
@ -220,7 +223,7 @@
|
||||||
<value>$this</value>
|
<value>$this</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>btnInspectControl.ZOrder" xml:space="preserve">
|
<data name=">>btnInspectControl.ZOrder" xml:space="preserve">
|
||||||
<value>1</value>
|
<value>2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnRefresh.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="btnRefresh.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>312, 8</value>
|
<value>312, 8</value>
|
||||||
|
@ -244,6 +247,30 @@
|
||||||
<value>$this</value>
|
<value>$this</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>btnRefresh.ZOrder" xml:space="preserve">
|
<data name=">>btnRefresh.ZOrder" xml:space="preserve">
|
||||||
|
<value>1</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPinToTop.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>460, 8</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPinToTop.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>144, 23</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPinToTop.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>3</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPinToTop.Text" xml:space="preserve">
|
||||||
|
<value>Pin to Top</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnPinToTop.Name" xml:space="preserve">
|
||||||
|
<value>btnPinToTop</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnPinToTop.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnPinToTop.Parent" xml:space="preserve">
|
||||||
|
<value>$this</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnPinToTop.ZOrder" xml:space="preserve">
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</data>
|
</data>
|
||||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
|
Loading…
Reference in a new issue