修改工具栏排列
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@@ -48,13 +48,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Camera.cs" />
|
<Compile Include="Camera.cs" />
|
||||||
<Compile Include="Setting.cs">
|
<Compile Include="Setting.cs" />
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Setting.Designer.cs">
|
<Compile Include="Setting.Designer.cs">
|
||||||
<DependentUpon>Setting.cs</DependentUpon>
|
<DependentUpon>Setting.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ToolStripNumericUpDown.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<EmbeddedResource Include="Setting.resx">
|
<EmbeddedResource Include="Setting.resx">
|
||||||
|
|||||||
@@ -20,12 +20,14 @@ namespace Camera
|
|||||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||||
this.picBoxCamera = new System.Windows.Forms.PictureBox();
|
this.picBoxCamera = new System.Windows.Forms.PictureBox();
|
||||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||||
|
this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
|
||||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox();
|
this.toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox();
|
||||||
|
this.toolStrip2 = new System.Windows.Forms.ToolStrip();
|
||||||
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
|
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
|
||||||
this.toolStripNumericUpDown1 = new ToolStripNumericUpDown();
|
this.toolStripNumericUpDown1 = new ToolStripNumericUpDown();
|
||||||
this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
|
this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
|
||||||
@@ -45,6 +47,8 @@ namespace Camera
|
|||||||
this.splitContainer2.Panel2.SuspendLayout();
|
this.splitContainer2.Panel2.SuspendLayout();
|
||||||
this.splitContainer2.SuspendLayout();
|
this.splitContainer2.SuspendLayout();
|
||||||
this.toolStrip1.SuspendLayout();
|
this.toolStrip1.SuspendLayout();
|
||||||
|
this.toolStrip2.SuspendLayout();
|
||||||
|
this.toolStripContainer1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -91,8 +95,21 @@ namespace Camera
|
|||||||
//
|
//
|
||||||
// splitContainer2.Panel1
|
// splitContainer2.Panel1
|
||||||
//
|
//
|
||||||
this.splitContainer2.Panel1.Controls.Add(this.toolStrip1);
|
this.splitContainer2.Panel1.Controls.Add(this.toolStripContainer1);
|
||||||
this.splitContainer2.Panel1MinSize = 40;
|
this.splitContainer2.Panel1MinSize = 120;
|
||||||
|
//
|
||||||
|
// toolStripContainer1
|
||||||
|
//
|
||||||
|
this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.toolStripContainer1.Name = "toolStripContainer1";
|
||||||
|
this.toolStripContainer1.Size = new System.Drawing.Size(559, 120);
|
||||||
|
this.toolStripContainer1.TabIndex = 0;
|
||||||
|
this.toolStripContainer1.Text = "toolStripContainer1";
|
||||||
|
this.toolStripContainer1.TopToolStripPanel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.toolStripContainer1.TopToolStripPanel.Padding = new System.Windows.Forms.Padding(0);
|
||||||
|
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip1);
|
||||||
|
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip2);
|
||||||
//
|
//
|
||||||
// splitContainer2.Panel2
|
// splitContainer2.Panel2
|
||||||
//
|
//
|
||||||
@@ -104,32 +121,24 @@ namespace Camera
|
|||||||
//
|
//
|
||||||
// toolStrip1
|
// toolStrip1
|
||||||
//
|
//
|
||||||
this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None;
|
this.toolStrip1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.toolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
|
||||||
this.toolStrip1.ImageScalingSize = new System.Drawing.Size(32, 32);
|
this.toolStrip1.ImageScalingSize = new System.Drawing.Size(32, 32);
|
||||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.toolStripButton1,
|
this.toolStripButton1,
|
||||||
this.toolStripButton2,
|
this.toolStripButton2,
|
||||||
this.toolStripButton3,
|
this.toolStripButton3,
|
||||||
this.toolStripButton4,
|
this.toolStripButton4,
|
||||||
this.toolStripTextBox1,
|
this.toolStripTextBox1});
|
||||||
this.toolStripLabel1,
|
|
||||||
this.toolStripNumericUpDown1,
|
|
||||||
this.toolStripLabel2,
|
|
||||||
this.toolStripNumericUpDown2,
|
|
||||||
this.toolStripLabel3,
|
|
||||||
this.toolStripNumericUpDown3,
|
|
||||||
this.toolStripLabel4,
|
|
||||||
this.toolStripNumericUpDown4});
|
|
||||||
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
|
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.toolStrip1.Name = "toolStrip1";
|
this.toolStrip1.Name = "toolStrip1";
|
||||||
this.toolStrip1.Size = new System.Drawing.Size(58, 25);
|
this.toolStrip1.Size = new System.Drawing.Size(200, 25);
|
||||||
this.toolStrip1.TabIndex = 0;
|
this.toolStrip1.TabIndex = 0;
|
||||||
this.toolStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStrip1_ItemClicked);
|
this.toolStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStrip1_ItemClicked);
|
||||||
//
|
//
|
||||||
// toolStripButton1
|
// toolStripButton1
|
||||||
//
|
//
|
||||||
this.toolStripButton1.CheckOnClick = true;
|
this.toolStripButton1.CheckOnClick = true;
|
||||||
this.toolStripButton1.Checked = false;
|
|
||||||
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
this.toolStripButton1.Name = "toolStripButton1";
|
this.toolStripButton1.Name = "toolStripButton1";
|
||||||
this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
|
this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
|
||||||
@@ -139,7 +148,6 @@ namespace Camera
|
|||||||
// toolStripButton2
|
// toolStripButton2
|
||||||
//
|
//
|
||||||
this.toolStripButton2.CheckOnClick = true;
|
this.toolStripButton2.CheckOnClick = true;
|
||||||
this.toolStripButton2.Checked = false;
|
|
||||||
this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
this.toolStripButton2.Name = "toolStripButton2";
|
this.toolStripButton2.Name = "toolStripButton2";
|
||||||
this.toolStripButton2.Size = new System.Drawing.Size(23, 22);
|
this.toolStripButton2.Size = new System.Drawing.Size(23, 22);
|
||||||
@@ -166,7 +174,7 @@ namespace Camera
|
|||||||
//
|
//
|
||||||
// toolStripTextBox1
|
// toolStripTextBox1
|
||||||
//
|
//
|
||||||
this.toolStripTextBox1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
this.toolStripTextBox1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Left;
|
||||||
this.toolStripTextBox1.Margin = new System.Windows.Forms.Padding(0, 2, 3, 2);
|
this.toolStripTextBox1.Margin = new System.Windows.Forms.Padding(0, 2, 3, 2);
|
||||||
this.toolStripTextBox1.Name = "toolStripTextBox1";
|
this.toolStripTextBox1.Name = "toolStripTextBox1";
|
||||||
this.toolStripTextBox1.Size = new System.Drawing.Size(60, 27);
|
this.toolStripTextBox1.Size = new System.Drawing.Size(60, 27);
|
||||||
@@ -175,12 +183,29 @@ namespace Camera
|
|||||||
this.toolStripTextBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ToolStripTextBox1_KeyDown);
|
this.toolStripTextBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ToolStripTextBox1_KeyDown);
|
||||||
this.toolStripTextBox1.TextChanged += new System.EventHandler(this.ToolStripTextBox1_TextChanged);
|
this.toolStripTextBox1.TextChanged += new System.EventHandler(this.ToolStripTextBox1_TextChanged);
|
||||||
//
|
//
|
||||||
|
// toolStrip2
|
||||||
|
//
|
||||||
|
this.toolStrip2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.toolStrip2.Location = new System.Drawing.Point(0, 25);
|
||||||
|
this.toolStrip2.ImageScalingSize = new System.Drawing.Size(32, 32);
|
||||||
|
this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.toolStripLabel1,
|
||||||
|
this.toolStripNumericUpDown1,
|
||||||
|
this.toolStripLabel2,
|
||||||
|
this.toolStripNumericUpDown2,
|
||||||
|
this.toolStripLabel3,
|
||||||
|
this.toolStripNumericUpDown3,
|
||||||
|
this.toolStripLabel4,
|
||||||
|
this.toolStripNumericUpDown4});
|
||||||
|
this.toolStrip2.Name = "toolStrip2";
|
||||||
|
this.toolStrip2.Size = new System.Drawing.Size(353, 30);
|
||||||
|
this.toolStrip2.TabIndex = 1;
|
||||||
|
//
|
||||||
// toolStripLabel1
|
// toolStripLabel1
|
||||||
//
|
//
|
||||||
this.toolStripLabel1.Name = "toolStripLabel1";
|
this.toolStripLabel1.Name = "toolStripLabel1";
|
||||||
this.toolStripLabel1.Size = new System.Drawing.Size(23, 27);
|
this.toolStripLabel1.Size = new System.Drawing.Size(23, 27);
|
||||||
this.toolStripLabel1.Text = "X:";
|
this.toolStripLabel1.Text = "X:";
|
||||||
this.toolStripLabel1.Visible = false;
|
|
||||||
//
|
//
|
||||||
// toolStripNumericUpDown1
|
// toolStripNumericUpDown1
|
||||||
//
|
//
|
||||||
@@ -209,7 +234,6 @@ namespace Camera
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
this.toolStripNumericUpDown1.Visible = false;
|
|
||||||
this.toolStripNumericUpDown1.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown1_ValueChanged);
|
this.toolStripNumericUpDown1.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown1_ValueChanged);
|
||||||
//
|
//
|
||||||
// toolStripLabel2
|
// toolStripLabel2
|
||||||
@@ -217,7 +241,6 @@ namespace Camera
|
|||||||
this.toolStripLabel2.Name = "toolStripLabel2";
|
this.toolStripLabel2.Name = "toolStripLabel2";
|
||||||
this.toolStripLabel2.Size = new System.Drawing.Size(22, 27);
|
this.toolStripLabel2.Size = new System.Drawing.Size(22, 27);
|
||||||
this.toolStripLabel2.Text = "Y:";
|
this.toolStripLabel2.Text = "Y:";
|
||||||
this.toolStripLabel2.Visible = false;
|
|
||||||
//
|
//
|
||||||
// toolStripNumericUpDown2
|
// toolStripNumericUpDown2
|
||||||
//
|
//
|
||||||
@@ -246,15 +269,13 @@ namespace Camera
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
this.toolStripNumericUpDown2.Visible = false;
|
|
||||||
this.toolStripNumericUpDown2.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown2_ValueChanged);
|
this.toolStripNumericUpDown2.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown2_ValueChanged);
|
||||||
//
|
//
|
||||||
// toolStripLabel3
|
// toolStripLabel3
|
||||||
//
|
//
|
||||||
this.toolStripLabel3.Name = "toolStripLabel3";
|
this.toolStripLabel3.Name = "toolStripLabel3";
|
||||||
this.toolStripLabel3.Size = new System.Drawing.Size(28, 27);
|
this.toolStripLabel3.Size = new System.Drawing.Size(28, 27);
|
||||||
this.toolStripLabel3.Text = "W:";
|
this.toolStripLabel3.Text = "宽:";
|
||||||
this.toolStripLabel3.Visible = false;
|
|
||||||
//
|
//
|
||||||
// toolStripNumericUpDown3
|
// toolStripNumericUpDown3
|
||||||
//
|
//
|
||||||
@@ -283,15 +304,13 @@ namespace Camera
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
this.toolStripNumericUpDown3.Visible = false;
|
|
||||||
this.toolStripNumericUpDown3.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown3_ValueChanged);
|
this.toolStripNumericUpDown3.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown3_ValueChanged);
|
||||||
//
|
//
|
||||||
// toolStripLabel4
|
// toolStripLabel4
|
||||||
//
|
//
|
||||||
this.toolStripLabel4.Name = "toolStripLabel4";
|
this.toolStripLabel4.Name = "toolStripLabel4";
|
||||||
this.toolStripLabel4.Size = new System.Drawing.Size(25, 27);
|
this.toolStripLabel4.Size = new System.Drawing.Size(28, 27);
|
||||||
this.toolStripLabel4.Text = "H:";
|
this.toolStripLabel4.Text = "高:";
|
||||||
this.toolStripLabel4.Visible = false;
|
|
||||||
//
|
//
|
||||||
// toolStripNumericUpDown4
|
// toolStripNumericUpDown4
|
||||||
//
|
//
|
||||||
@@ -320,7 +339,6 @@ namespace Camera
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
this.toolStripNumericUpDown4.Visible = false;
|
|
||||||
this.toolStripNumericUpDown4.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown4_ValueChanged);
|
this.toolStripNumericUpDown4.ValueChanged += new System.EventHandler(this.ToolStripNumericUpDown4_ValueChanged);
|
||||||
//
|
//
|
||||||
// dataGridView1
|
// dataGridView1
|
||||||
@@ -331,9 +349,9 @@ namespace Camera
|
|||||||
this.dataGridView1.ColumnHeadersHeight = 25;
|
this.dataGridView1.ColumnHeadersHeight = 25;
|
||||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||||
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.dataGridView1.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||||
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
|
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.dataGridView1.Name = "dataGridView1";
|
this.dataGridView1.Name = "dataGridView1";
|
||||||
this.dataGridView1.ReadOnly = false;
|
|
||||||
this.dataGridView1.RowHeadersVisible = false;
|
this.dataGridView1.RowHeadersVisible = false;
|
||||||
this.dataGridView1.RowTemplate.Height = 25;
|
this.dataGridView1.RowTemplate.Height = 25;
|
||||||
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
@@ -364,6 +382,10 @@ namespace Camera
|
|||||||
this.splitContainer2.ResumeLayout(false);
|
this.splitContainer2.ResumeLayout(false);
|
||||||
this.toolStrip1.ResumeLayout(false);
|
this.toolStrip1.ResumeLayout(false);
|
||||||
this.toolStrip1.PerformLayout();
|
this.toolStrip1.PerformLayout();
|
||||||
|
this.toolStrip2.ResumeLayout(false);
|
||||||
|
this.toolStrip2.PerformLayout();
|
||||||
|
this.toolStripContainer1.ResumeLayout(false);
|
||||||
|
this.toolStripContainer1.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
@@ -374,7 +396,9 @@ namespace Camera
|
|||||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||||
private System.Windows.Forms.SplitContainer splitContainer2;
|
private System.Windows.Forms.SplitContainer splitContainer2;
|
||||||
private System.Windows.Forms.PictureBox picBoxCamera;
|
private System.Windows.Forms.PictureBox picBoxCamera;
|
||||||
|
private System.Windows.Forms.ToolStripContainer toolStripContainer1;
|
||||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||||
|
private System.Windows.Forms.ToolStrip toolStrip2;
|
||||||
private System.Windows.Forms.ToolStripButton toolStripButton1;
|
private System.Windows.Forms.ToolStripButton toolStripButton1;
|
||||||
private System.Windows.Forms.ToolStripButton toolStripButton2;
|
private System.Windows.Forms.ToolStripButton toolStripButton2;
|
||||||
private System.Windows.Forms.ToolStripButton toolStripButton3;
|
private System.Windows.Forms.ToolStripButton toolStripButton3;
|
||||||
|
|||||||
@@ -11,6 +11,110 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace Camera
|
namespace Camera
|
||||||
{
|
{
|
||||||
|
// 自定义ToolStripNumericUpDown控件
|
||||||
|
[System.ComponentModel.ToolboxItem(false)]
|
||||||
|
[System.ComponentModel.DesignerCategory("Code")]
|
||||||
|
public class ToolStripNumericUpDown : ToolStripControlHost
|
||||||
|
{
|
||||||
|
private NumericUpDown _numericUpDown;
|
||||||
|
|
||||||
|
// 公开的无参构造函数 - 设计器必需
|
||||||
|
public ToolStripNumericUpDown() : this(new NumericUpDown()) { }
|
||||||
|
|
||||||
|
// 私有的带参数构造函数 - 仅用于无参构造函数调用
|
||||||
|
private ToolStripNumericUpDown(NumericUpDown numericUpDown) : base(numericUpDown)
|
||||||
|
{
|
||||||
|
_numericUpDown = numericUpDown ?? throw new ArgumentNullException(nameof(numericUpDown));
|
||||||
|
this.AutoSize = false;
|
||||||
|
|
||||||
|
// 设置NumericUpDown的基本属性
|
||||||
|
_numericUpDown.Size = new Size(60, 22);
|
||||||
|
_numericUpDown.TextAlign = HorizontalAlignment.Right;
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.ComponentModel.Browsable(false)]
|
||||||
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
|
public NumericUpDown NumericUpDownControl => _numericUpDown;
|
||||||
|
|
||||||
|
// 下面的属性、事件都保持不变
|
||||||
|
public decimal Value
|
||||||
|
{
|
||||||
|
get => _numericUpDown.Value;
|
||||||
|
set => _numericUpDown.Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal Minimum
|
||||||
|
{
|
||||||
|
get => _numericUpDown.Minimum;
|
||||||
|
set => _numericUpDown.Minimum = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal Maximum
|
||||||
|
{
|
||||||
|
get => _numericUpDown.Maximum;
|
||||||
|
set => _numericUpDown.Maximum = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public decimal Increment
|
||||||
|
{
|
||||||
|
get => _numericUpDown.Increment;
|
||||||
|
set => _numericUpDown.Increment = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int DecimalPlaces
|
||||||
|
{
|
||||||
|
get => _numericUpDown.DecimalPlaces;
|
||||||
|
set => _numericUpDown.DecimalPlaces = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
|
public new string Text
|
||||||
|
{
|
||||||
|
get => _numericUpDown.Text;
|
||||||
|
set => _numericUpDown.Text = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler ValueChanged;
|
||||||
|
|
||||||
|
protected override void OnSubscribeControlEvents(Control control)
|
||||||
|
{
|
||||||
|
base.OnSubscribeControlEvents(control);
|
||||||
|
if (control is NumericUpDown nud)
|
||||||
|
nud.ValueChanged += Nud_ValueChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnUnsubscribeControlEvents(Control control)
|
||||||
|
{
|
||||||
|
base.OnUnsubscribeControlEvents(control);
|
||||||
|
if (control is NumericUpDown nud)
|
||||||
|
nud.ValueChanged -= Nud_ValueChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Nud_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ValueChanged?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Size DefaultSize => new Size(60, 27);
|
||||||
|
|
||||||
|
// 重写GetPreferredSize以改进布局
|
||||||
|
public override Size GetPreferredSize(Size constrainingSize)
|
||||||
|
{
|
||||||
|
return new Size(base.GetPreferredSize(constrainingSize).Width, 27);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理资源
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && _numericUpDown != null)
|
||||||
|
{
|
||||||
|
_numericUpDown.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public partial class Setting : Form
|
public partial class Setting : Form
|
||||||
{
|
{
|
||||||
private Camera _camera;
|
private Camera _camera;
|
||||||
|
|||||||
@@ -118,6 +118,9 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>147, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
</root>
|
</root>
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Camera
|
|
||||||
{
|
|
||||||
// 自定义ToolStripNumericUpDown控件
|
|
||||||
[System.ComponentModel.ToolboxItem(false)]
|
|
||||||
[System.ComponentModel.DesignerCategory("Code")]
|
|
||||||
public class ToolStripNumericUpDown : ToolStripControlHost
|
|
||||||
{
|
|
||||||
private NumericUpDown _numericUpDown;
|
|
||||||
|
|
||||||
// 公开的无参构造函数 - 设计器必需
|
|
||||||
public ToolStripNumericUpDown() : this(new NumericUpDown()) { }
|
|
||||||
|
|
||||||
// 私有的带参数构造函数 - 仅用于无参构造函数调用
|
|
||||||
private ToolStripNumericUpDown(NumericUpDown numericUpDown) : base(numericUpDown)
|
|
||||||
{
|
|
||||||
_numericUpDown = numericUpDown ?? throw new ArgumentNullException(nameof(numericUpDown));
|
|
||||||
this.AutoSize = false;
|
|
||||||
|
|
||||||
// 设置NumericUpDown的基本属性
|
|
||||||
_numericUpDown.Size = new Size(60, 22);
|
|
||||||
_numericUpDown.TextAlign = HorizontalAlignment.Right;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.Browsable(false)]
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
||||||
public NumericUpDown NumericUpDownControl => _numericUpDown;
|
|
||||||
|
|
||||||
// 下面的属性、事件都保持不变
|
|
||||||
public decimal Value
|
|
||||||
{
|
|
||||||
get => _numericUpDown.Value;
|
|
||||||
set => _numericUpDown.Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public decimal Minimum
|
|
||||||
{
|
|
||||||
get => _numericUpDown.Minimum;
|
|
||||||
set => _numericUpDown.Minimum = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public decimal Maximum
|
|
||||||
{
|
|
||||||
get => _numericUpDown.Maximum;
|
|
||||||
set => _numericUpDown.Maximum = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public decimal Increment
|
|
||||||
{
|
|
||||||
get => _numericUpDown.Increment;
|
|
||||||
set => _numericUpDown.Increment = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int DecimalPlaces
|
|
||||||
{
|
|
||||||
get => _numericUpDown.DecimalPlaces;
|
|
||||||
set => _numericUpDown.DecimalPlaces = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Browsable(false)]
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
||||||
public new string Text
|
|
||||||
{
|
|
||||||
get => _numericUpDown.Text;
|
|
||||||
set => _numericUpDown.Text = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public event EventHandler ValueChanged;
|
|
||||||
|
|
||||||
protected override void OnSubscribeControlEvents(Control control)
|
|
||||||
{
|
|
||||||
base.OnSubscribeControlEvents(control);
|
|
||||||
if (control is NumericUpDown nud)
|
|
||||||
nud.ValueChanged += Nud_ValueChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnUnsubscribeControlEvents(Control control)
|
|
||||||
{
|
|
||||||
base.OnUnsubscribeControlEvents(control);
|
|
||||||
if (control is NumericUpDown nud)
|
|
||||||
nud.ValueChanged -= Nud_ValueChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Nud_ValueChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
ValueChanged?.Invoke(this, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Size DefaultSize => new Size(60, 27);
|
|
||||||
|
|
||||||
// 重写GetPreferredSize以改进布局
|
|
||||||
public override Size GetPreferredSize(Size constrainingSize)
|
|
||||||
{
|
|
||||||
return new Size(base.GetPreferredSize(constrainingSize).Width, 27);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 清理资源
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && _numericUpDown != null)
|
|
||||||
{
|
|
||||||
_numericUpDown.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user