Changes in FrmToolbox

This commit is contained in:
2017-12-11 02:13:54 +01:00
parent 2d168c5be6
commit ee38bf9546
5 changed files with 61 additions and 15 deletions

View File

@@ -133,5 +133,14 @@ namespace VAR.Toolbox.Code
public const int VK_MBUTTON = 0x04; public const int VK_MBUTTON = 0x04;
public const int VK_LBUTTON = 0x01; public const int VK_LBUTTON = 0x01;
public const int VK_RBUTTON = 0x02; public const int VK_RBUTTON = 0x02;
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
} }
} }

View File

@@ -28,11 +28,11 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmToolbox));
this.btnBase64 = new System.Windows.Forms.Button(); this.btnBase64 = new System.Windows.Forms.Button();
this.btnProxyCmd = new System.Windows.Forms.Button(); this.btnProxyCmd = new System.Windows.Forms.Button();
this.btnWebcam = new System.Windows.Forms.Button(); this.btnWebcam = new System.Windows.Forms.Button();
this.btnTunnelTCP = new System.Windows.Forms.Button(); this.btnTunnelTCP = new System.Windows.Forms.Button();
this.lblToolbox = new System.Windows.Forms.Label();
this.pnlSuspension1 = new VAR.Toolbox.UI.PnlSuspension(); this.pnlSuspension1 = new VAR.Toolbox.UI.PnlSuspension();
this.pnlCover1 = new VAR.Toolbox.UI.PnlCover(); this.pnlCover1 = new VAR.Toolbox.UI.PnlCover();
this.SuspendLayout(); this.SuspendLayout();
@@ -41,10 +41,10 @@
// //
this.btnBase64.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.btnBase64.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.btnBase64.Location = new System.Drawing.Point(18, 18); this.btnBase64.Location = new System.Drawing.Point(13, 80);
this.btnBase64.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.btnBase64.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnBase64.Name = "btnBase64"; this.btnBase64.Name = "btnBase64";
this.btnBase64.Size = new System.Drawing.Size(278, 52); this.btnBase64.Size = new System.Drawing.Size(238, 52);
this.btnBase64.TabIndex = 0; this.btnBase64.TabIndex = 0;
this.btnBase64.Text = "Base64"; this.btnBase64.Text = "Base64";
this.btnBase64.UseVisualStyleBackColor = true; this.btnBase64.UseVisualStyleBackColor = true;
@@ -54,10 +54,10 @@
// //
this.btnProxyCmd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.btnProxyCmd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.btnProxyCmd.Location = new System.Drawing.Point(18, 80); this.btnProxyCmd.Location = new System.Drawing.Point(13, 142);
this.btnProxyCmd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.btnProxyCmd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnProxyCmd.Name = "btnProxyCmd"; this.btnProxyCmd.Name = "btnProxyCmd";
this.btnProxyCmd.Size = new System.Drawing.Size(278, 55); this.btnProxyCmd.Size = new System.Drawing.Size(238, 55);
this.btnProxyCmd.TabIndex = 1; this.btnProxyCmd.TabIndex = 1;
this.btnProxyCmd.Text = "ProxyCmd"; this.btnProxyCmd.Text = "ProxyCmd";
this.btnProxyCmd.UseVisualStyleBackColor = true; this.btnProxyCmd.UseVisualStyleBackColor = true;
@@ -67,10 +67,10 @@
// //
this.btnWebcam.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.btnWebcam.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.btnWebcam.Location = new System.Drawing.Point(18, 145); this.btnWebcam.Location = new System.Drawing.Point(13, 207);
this.btnWebcam.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.btnWebcam.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnWebcam.Name = "btnWebcam"; this.btnWebcam.Name = "btnWebcam";
this.btnWebcam.Size = new System.Drawing.Size(278, 55); this.btnWebcam.Size = new System.Drawing.Size(238, 55);
this.btnWebcam.TabIndex = 2; this.btnWebcam.TabIndex = 2;
this.btnWebcam.Text = "Webcam"; this.btnWebcam.Text = "Webcam";
this.btnWebcam.UseVisualStyleBackColor = true; this.btnWebcam.UseVisualStyleBackColor = true;
@@ -80,37 +80,50 @@
// //
this.btnTunnelTCP.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.btnTunnelTCP.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.btnTunnelTCP.Location = new System.Drawing.Point(18, 208); this.btnTunnelTCP.Location = new System.Drawing.Point(13, 270);
this.btnTunnelTCP.Name = "btnTunnelTCP"; this.btnTunnelTCP.Name = "btnTunnelTCP";
this.btnTunnelTCP.Size = new System.Drawing.Size(278, 55); this.btnTunnelTCP.Size = new System.Drawing.Size(238, 55);
this.btnTunnelTCP.TabIndex = 5; this.btnTunnelTCP.TabIndex = 5;
this.btnTunnelTCP.Text = "TunnelTCP"; this.btnTunnelTCP.Text = "TunnelTCP";
this.btnTunnelTCP.UseVisualStyleBackColor = true; this.btnTunnelTCP.UseVisualStyleBackColor = true;
this.btnTunnelTCP.Click += new System.EventHandler(this.btnTunnelTCP_Click); this.btnTunnelTCP.Click += new System.EventHandler(this.btnTunnelTCP_Click);
// //
// lblToolbox
//
this.lblToolbox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblToolbox.Font = new System.Drawing.Font("Arial Narrow", 28F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblToolbox.Location = new System.Drawing.Point(12, 9);
this.lblToolbox.Name = "lblToolbox";
this.lblToolbox.Size = new System.Drawing.Size(239, 66);
this.lblToolbox.TabIndex = 6;
this.lblToolbox.Text = "Toolbox";
this.lblToolbox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pnlSuspension1 // pnlSuspension1
// //
this.pnlSuspension1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) this.pnlSuspension1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pnlSuspension1.Location = new System.Drawing.Point(18, 432); this.pnlSuspension1.Location = new System.Drawing.Point(18, 505);
this.pnlSuspension1.Name = "pnlSuspension1"; this.pnlSuspension1.Name = "pnlSuspension1";
this.pnlSuspension1.Size = new System.Drawing.Size(278, 175); this.pnlSuspension1.Size = new System.Drawing.Size(232, 175);
this.pnlSuspension1.TabIndex = 4; this.pnlSuspension1.TabIndex = 4;
// //
// pnlCover1 // pnlCover1
// //
this.pnlCover1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) this.pnlCover1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pnlCover1.Location = new System.Drawing.Point(18, 278); this.pnlCover1.Location = new System.Drawing.Point(18, 351);
this.pnlCover1.Name = "pnlCover1"; this.pnlCover1.Name = "pnlCover1";
this.pnlCover1.Size = new System.Drawing.Size(278, 148); this.pnlCover1.Size = new System.Drawing.Size(232, 148);
this.pnlCover1.TabIndex = 3; this.pnlCover1.TabIndex = 3;
// //
// FrmToolbox // FrmToolbox
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(309, 619); this.ClientSize = new System.Drawing.Size(263, 692);
this.Controls.Add(this.lblToolbox);
this.Controls.Add(this.btnTunnelTCP); this.Controls.Add(this.btnTunnelTCP);
this.Controls.Add(this.pnlSuspension1); this.Controls.Add(this.pnlSuspension1);
this.Controls.Add(this.pnlCover1); this.Controls.Add(this.pnlCover1);
@@ -137,6 +150,7 @@
private PnlCover pnlCover1; private PnlCover pnlCover1;
private PnlSuspension pnlSuspension1; private PnlSuspension pnlSuspension1;
private System.Windows.Forms.Button btnTunnelTCP; private System.Windows.Forms.Button btnTunnelTCP;
private System.Windows.Forms.Label lblToolbox;
} }
} }

View File

@@ -1,7 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using System.Windows.Forms;
using VAR.Toolbox.Code;
namespace VAR.Toolbox.UI namespace VAR.Toolbox.UI
{ {
@@ -10,6 +11,9 @@ namespace VAR.Toolbox.UI
public FrmToolbox() public FrmToolbox()
{ {
InitializeComponent(); InitializeComponent();
MouseDown += DragWindow_MouseDown;
lblToolbox.MouseDown += DragWindow_MouseDown;
} }
private void FrmToolbox_Load(object sender, EventArgs e) private void FrmToolbox_Load(object sender, EventArgs e)
@@ -37,6 +41,14 @@ namespace VAR.Toolbox.UI
CreateWindow(typeof(FrmTunnelTCP)); CreateWindow(typeof(FrmTunnelTCP));
} }
private void DragWindow_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
User32.ReleaseCapture();
User32.SendMessage(Handle, User32.WM_NCLBUTTONDOWN, User32.HT_CAPTION, 0);
}
}
#region Window handling #region Window handling
private Form CreateWindow(Type type) private Form CreateWindow(Type type)
@@ -48,6 +60,10 @@ namespace VAR.Toolbox.UI
} }
_forms.Add(frm); _forms.Add(frm);
frm.FormClosing += frmChild_FormClosing; frm.FormClosing += frmChild_FormClosing;
if ((frm is IFormWithIcon) == false)
{
frm.Icon = Icon;
}
frm.Show(); frm.Show();
return frm; return frm;
} }

View File

@@ -0,0 +1,6 @@
namespace VAR.Toolbox.UI
{
public interface IFormWithIcon
{
}
}

View File

@@ -131,6 +131,7 @@
<Compile Include="UI\FrmWebcam.Designer.cs"> <Compile Include="UI\FrmWebcam.Designer.cs">
<DependentUpon>FrmWebcam.cs</DependentUpon> <DependentUpon>FrmWebcam.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\IFormWithIcon.cs" />
<Compile Include="UI\PnlCover.cs"> <Compile Include="UI\PnlCover.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>