Added custom drag grips to each side

This commit is contained in:
Jaex 2016-09-30 21:57:16 +03:00
parent eff05bc15c
commit 81a124453f
5 changed files with 48 additions and 6 deletions

View file

@ -1190,6 +1190,16 @@ internal static System.Drawing.Bitmap tick {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ui_radio_button_uncheck {
get {
object obj = ResourceManager.GetObject("ui_radio_button_uncheck", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to Capture.
/// </summary>

View file

@ -489,4 +489,7 @@ Distance: {6:0.00} px / Angle: {7:0.00}°</value>
<data name="layer__pencil" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\layer--pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ui_radio_button_uncheck" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ui-radio-button-uncheck.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

View file

@ -264,6 +264,7 @@ private void CreateMenu()
CanOverflow = false,
ClickThrough = true,
Dock = DockStyle.None,
GripStyle = ToolStripGripStyle.Hidden,
Location = new Point(0, 0),
MinimumSize = new Size(100, 30),
Padding = new Padding(0, 0, 0, 0),
@ -271,16 +272,26 @@ private void CreateMenu()
Text = "ToolStrip"
};
tsMain.GripMouseDown += (sender, e) =>
{
NativeMethods.ReleaseCapture(tsMain.Handle);
NativeMethods.DefWindowProc(menuForm.Handle, (uint)WindowsMessages.SYSCOMMAND, (UIntPtr)NativeConstants.MOUSE_MOVE, IntPtr.Zero);
};
tsMain.SuspendLayout();
menuForm.Controls.Add(tsMain);
ToolStripLabel tslDragLeft = new ToolStripLabel()
{
DisplayStyle = ToolStripItemDisplayStyle.Image,
Image = Resources.ui_radio_button_uncheck,
Margin = new Padding(0),
Padding = new Padding(2)
};
tslDragLeft.MouseDown += (sender, e) =>
{
NativeMethods.ReleaseCapture();
NativeMethods.DefWindowProc(menuForm.Handle, (uint)WindowsMessages.SYSCOMMAND, (UIntPtr)NativeConstants.MOUSE_MOVE, IntPtr.Zero);
};
tsMain.Items.Add(tslDragLeft);
#region Editor mode
if (form.Mode == RegionCaptureMode.Editor)
@ -780,6 +791,23 @@ private void CreateMenu()
#endregion Options
ToolStripLabel tslDragRight = new ToolStripLabel()
{
Alignment = ToolStripItemAlignment.Right,
DisplayStyle = ToolStripItemDisplayStyle.Image,
Image = Resources.ui_radio_button_uncheck,
Margin = new Padding(0),
Padding = new Padding(2)
};
tslDragRight.MouseDown += (sender, e) =>
{
NativeMethods.ReleaseCapture();
NativeMethods.DefWindowProc(menuForm.Handle, (uint)WindowsMessages.SYSCOMMAND, (UIntPtr)NativeConstants.MOUSE_MOVE, IntPtr.Zero);
};
tsMain.Items.Add(tslDragRight);
tsMain.ResumeLayout(false);
tsMain.PerformLayout();
menuForm.ResumeLayout(false);

View file

@ -170,6 +170,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Resources\ui-radio-button-uncheck.png" />
<None Include="Resources\layer--pencil.png" />
<None Include="Resources\printer.png" />
<None Include="Resources\drive-globe.png" />