From d8f66d1a82e551dd0e82d6205ac42c1985c804d0 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Tue, 3 Apr 2018 11:14:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=20UButton=20=E5=92=8C=20weig?= =?UTF-8?q?htControl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Form1.Designer.cs | 123 ++++++++++++---------- Test/Form1.resx | 12 +-- Test/Form2.Designer.cs | 96 +++++++++++++++++ Test/Form2.cs | 52 +++++++++ Test/Form2.resx | 120 +++++++++++++++++++++ Test/Program.cs | 74 ++++++++++++- Test/TBtn.cs | 58 ++++++++++ Test/Test.csproj | 15 +++ WinFormControl/UButton.cs | 37 ++++++- WinFormControl/UWeightControl.Designer.cs | 45 ++++---- WinFormControl/UWeightControl.resx | 16 ++- 11 files changed, 563 insertions(+), 85 deletions(-) create mode 100644 Test/Form2.Designer.cs create mode 100644 Test/Form2.cs create mode 100644 Test/Form2.resx create mode 100644 Test/TBtn.cs diff --git a/Test/Form1.Designer.cs b/Test/Form1.Designer.cs index 23ec7ec..9304651 100644 --- a/Test/Form1.Designer.cs +++ b/Test/Form1.Designer.cs @@ -28,18 +28,19 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.uButton1 = new WinFormControl.UButton(); - this.uScanPanel1 = new WinFormControl.UScanPanel(); - this.uTimerLabel1 = new WinFormControl.UTimerLabel(); - this.uWeightControl1 = new WinFormControl.UWeightControl(); this.uDataGridView1 = new WinFormControl.UDataGridView(); this.RID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.RName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.uWeightControl1 = new WinFormControl.UWeightControl(); + this.uTimerLabel1 = new WinFormControl.UTimerLabel(); + this.uButton1 = new WinFormControl.UButton(); + this.uScanPanel1 = new WinFormControl.UScanPanel(); + this.tBtn1 = new Test.TBtn(); ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); this.SuspendLayout(); // @@ -52,54 +53,6 @@ this.comboBox1.Size = new System.Drawing.Size(121, 28); this.comboBox1.TabIndex = 3; // - // uButton1 - // - this.uButton1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("uButton1.BackgroundImage"))); - this.uButton1.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); - this.uButton1.FlatAppearance.BorderSize = 0; - this.uButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.uButton1.ForeColor = System.Drawing.Color.Black; - this.uButton1.Location = new System.Drawing.Point(254, 239); - this.uButton1.Name = "uButton1"; - this.uButton1.PlaySound = true; - this.uButton1.Size = new System.Drawing.Size(130, 47); - this.uButton1.SoundType = WinFormControl.SoundType.Di; - this.uButton1.TabIndex = 2; - this.uButton1.Text = "uButton1"; - this.uButton1.UseVisualStyleBackColor = true; - this.uButton1.Click += new System.EventHandler(this.uButton1_Click); - // - // uScanPanel1 - // - this.uScanPanel1.BackColor = System.Drawing.Color.Transparent; - this.uScanPanel1.Location = new System.Drawing.Point(101, 182); - this.uScanPanel1.Name = "uScanPanel1"; - this.uScanPanel1.Size = new System.Drawing.Size(303, 32); - this.uScanPanel1.TabIndex = 1; - this.uScanPanel1.BeforeScan += new System.Action(this.uScanPanel1_BeforeScan); - this.uScanPanel1.AfterScan += new System.Action(this.uScanPanel1_AfterScan); - // - // uTimerLabel1 - // - this.uTimerLabel1.AutoSize = true; - this.uTimerLabel1.BackColor = System.Drawing.Color.Transparent; - this.uTimerLabel1.Font = new System.Drawing.Font("宋体", 15F); - this.uTimerLabel1.Format = "M月d日 H:m:s"; - this.uTimerLabel1.Location = new System.Drawing.Point(315, 124); - this.uTimerLabel1.Name = "uTimerLabel1"; - this.uTimerLabel1.Size = new System.Drawing.Size(159, 20); - this.uTimerLabel1.TabIndex = 4; - this.uTimerLabel1.Text = "3月30日 11:37:0"; - // - // uWeightControl1 - // - this.uWeightControl1.BackColor = System.Drawing.Color.Transparent; - this.uWeightControl1.Location = new System.Drawing.Point(12, 12); - this.uWeightControl1.Name = "uWeightControl1"; - this.uWeightControl1.Size = new System.Drawing.Size(349, 78); - this.uWeightControl1.TabIndex = 5; - this.uWeightControl1.WeightFalg = null; - // // uDataGridView1 // this.uDataGridView1.AllowUserToAddRows = false; @@ -148,12 +101,75 @@ this.RName.Name = "RName"; this.RName.ReadOnly = true; // + // uWeightControl1 + // + this.uWeightControl1.BackColor = System.Drawing.Color.Transparent; + this.uWeightControl1.Location = new System.Drawing.Point(12, 12); + this.uWeightControl1.Name = "uWeightControl1"; + this.uWeightControl1.Size = new System.Drawing.Size(349, 78); + this.uWeightControl1.TabIndex = 5; + this.uWeightControl1.WeightFalg = null; + // + // uTimerLabel1 + // + this.uTimerLabel1.AutoSize = true; + this.uTimerLabel1.BackColor = System.Drawing.Color.Transparent; + this.uTimerLabel1.Font = new System.Drawing.Font("宋体", 15F); + this.uTimerLabel1.Format = "M月d日 H:m:s"; + this.uTimerLabel1.Location = new System.Drawing.Point(315, 124); + this.uTimerLabel1.Name = "uTimerLabel1"; + this.uTimerLabel1.Size = new System.Drawing.Size(139, 20); + this.uTimerLabel1.TabIndex = 4; + this.uTimerLabel1.Text = "4月3日 9:37:9"; + // + // uButton1 + // + this.uButton1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("uButton1.BackgroundImage"))); + this.uButton1.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.uButton1.FlatAppearance.BorderSize = 0; + this.uButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.uButton1.ForeColor = System.Drawing.Color.Black; + this.uButton1.Location = new System.Drawing.Point(254, 239); + this.uButton1.Name = "uButton1"; + this.uButton1.PlaySound = true; + this.uButton1.Size = new System.Drawing.Size(130, 47); + this.uButton1.SoundType = WinFormControl.SoundType.Di; + this.uButton1.TabIndex = 2; + this.uButton1.Text = "uButton1"; + this.uButton1.UseVisualStyleBackColor = true; + this.uButton1.Click += new System.EventHandler(this.uButton1_Click); + // + // uScanPanel1 + // + this.uScanPanel1.BackColor = System.Drawing.Color.Transparent; + this.uScanPanel1.Location = new System.Drawing.Point(101, 182); + this.uScanPanel1.Name = "uScanPanel1"; + this.uScanPanel1.Size = new System.Drawing.Size(303, 32); + this.uScanPanel1.TabIndex = 1; + this.uScanPanel1.BeforeScan += new System.Action(this.uScanPanel1_BeforeScan); + this.uScanPanel1.AfterScan += new System.Action(this.uScanPanel1_AfterScan); + // + // tBtn1 + // + this.tBtn1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(133)))), ((int)(((byte)(255))))); + this.tBtn1.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(204)))), ((int)(((byte)(112))))); + this.tBtn1.FlatAppearance.BorderSize = 0; + this.tBtn1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.tBtn1.ForeColor = System.Drawing.Color.White; + this.tBtn1.Location = new System.Drawing.Point(372, 310); + this.tBtn1.Name = "tBtn1"; + this.tBtn1.Size = new System.Drawing.Size(181, 69); + this.tBtn1.TabIndex = 7; + this.tBtn1.Text = "tBtn1"; + this.tBtn1.UseVisualStyleBackColor = false; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(922, 453); + this.Controls.Add(this.tBtn1); this.Controls.Add(this.uDataGridView1); this.Controls.Add(this.uWeightControl1); this.Controls.Add(this.uTimerLabel1); @@ -179,5 +195,6 @@ private WinFormControl.UDataGridView uDataGridView1; private System.Windows.Forms.DataGridViewTextBoxColumn RID; private System.Windows.Forms.DataGridViewTextBoxColumn RName; + private TBtn tBtn1; } } \ No newline at end of file diff --git a/Test/Form1.resx b/Test/Form1.resx index 7672ca5..92858b8 100644 --- a/Test/Form1.resx +++ b/Test/Form1.resx @@ -117,6 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + + + True + @@ -126,10 +132,4 @@ KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= - - True - - - True - \ No newline at end of file diff --git a/Test/Form2.Designer.cs b/Test/Form2.Designer.cs new file mode 100644 index 0000000..6caa34c --- /dev/null +++ b/Test/Form2.Designer.cs @@ -0,0 +1,96 @@ +namespace Test +{ + partial class Form2 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panel1 = new System.Windows.Forms.Panel(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.panel2 = new System.Windows.Forms.Panel(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.Controls.Add(this.flowLayoutPanel1); + this.panel1.Location = new System.Drawing.Point(44, 35); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(265, 424); + this.panel1.TabIndex = 0; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(263, 422); + this.flowLayoutPanel1.TabIndex = 0; + // + // panel2 + // + this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel2.Controls.Add(this.flowLayoutPanel2); + this.panel2.Location = new System.Drawing.Point(374, 36); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(265, 424); + this.panel2.TabIndex = 1; + // + // flowLayoutPanel2 + // + this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 0); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(263, 422); + this.flowLayoutPanel2.TabIndex = 0; + // + // Form2 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(679, 501); + this.Controls.Add(this.panel2); + this.Controls.Add(this.panel1); + this.Name = "Form2"; + this.Text = "Form2"; + this.panel1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + } +} \ No newline at end of file diff --git a/Test/Form2.cs b/Test/Form2.cs new file mode 100644 index 0000000..e7f8e2a --- /dev/null +++ b/Test/Form2.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using WinFormControl; + +namespace Test +{ + public partial class Form2 : Form + { + public Form2() + { + InitializeComponent(); + + for (var i = 0; i < 10; i++) + { + var btn = new TBtn() { Text = "鲜品白条一级", Width = 90, Height = 55, Margin = new Padding(8, 14, 8, 0), }; + flowLayoutPanel1.Controls.Add(btn); + } + + for (var i = 0; i < 10; i++) + { + var btn = new UButton() { Text = "鲜品白条一级", Width = 90, Height = 55, Margin = new Padding(8, 14, 8, 0), WithStataHode = true }; + if (i % 3 == 0) + btn.AsClicked = true; + if (i == 5) + { + btn.WithStataHode = true; + btn.Click += delegate + { + System.Threading.Thread.Sleep(2000); + + }; + } + if (i == 8) + { + btn.WithStataHode = true; + btn.Click += delegate + { + throw new Exception("error"); + }; + } + flowLayoutPanel2.Controls.Add(btn); + } + } + } +} diff --git a/Test/Form2.resx b/Test/Form2.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Test/Form2.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Test/Program.cs b/Test/Program.cs index d312a51..283e1f2 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using WinFormControl; namespace Test { @@ -14,9 +17,74 @@ namespace Test [STAThread] static void Main() { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + try + { + //处理未捕获的异常 + Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); + //处理UI线程异常 + Application.ThreadException += Application_ThreadException; + //处理非UI线程异常 + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + + var aProcessName = Process.GetCurrentProcess().ProcessName; + if ((Process.GetProcessesByName(aProcessName)).GetUpperBound(0) > 0) + { + SoundPalyUtil.PlaySound(SoundType.Error); + UMessageBox.Show(@"系统已经在运行中,如果要重新启动,请从进程中关闭...", @"系统警告"); + } + else + { + // Mapper.Initialize(cfg => { + // cfg.AddProfile(); + // cfg.CreateMap(); + // }); + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form2()); + } + } + catch (Exception e) + { + // LogUtil.WriteError(e); + + SoundPalyUtil.PlaySound(SoundType.Error); + UMessageBox.Show("错误:" + e.Message + " \n详细信息:" + e.StackTrace); + //UMessageBox.Show("错误:" + e.Message ); + } + } + + /// + /// 在发生未处理异常时处理的方法 + /// + /// + /// + private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) + { + var ex = e.Exception; + var err = String.Empty; + if (ex != null) + { + //LogUtil.WriteError(ex); + err = ex.Message; + } + SoundPalyUtil.PlaySound(SoundType.Error); + UMessageBox.Show("错误:" + ex.Message + " \n详细信息:" + ex.StackTrace); + // UMessageBox.Show("错误:" + err); + } + + private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + var err = String.Empty; + var ex = e.ExceptionObject as Exception; + if (ex != null) + { + //LogUtil.WriteError(ex); + err = ex.Message; + } + SoundPalyUtil.PlaySound(SoundType.Error); + UMessageBox.Show("错误:" + ex.Message + " \n详细信息:" + ex.StackTrace); + //UMessageBox.Show("错误:" + err); } } } diff --git a/Test/TBtn.cs b/Test/TBtn.cs new file mode 100644 index 0000000..5667d89 --- /dev/null +++ b/Test/TBtn.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Test +{ + class TBtn : Button + { + public TBtn() + { + //this.UseVisualStyleBackColor = true; + this.BackColor = Color.FromArgb(51, 133, 255); + this.ForeColor = Color.White; + this.FlatStyle = FlatStyle.Flat; + this.FlatAppearance.BorderSize = 0; + this.FlatAppearance.BorderColor = Color.FromArgb(45, 204, 112); + } + + protected override void OnMouseDown(MouseEventArgs mevent) + { + if (mevent.Button == MouseButtons.Left) + { + this.BackColor = Color.Red; + } + base.OnMouseDown(mevent); + } + + protected override void OnClick(EventArgs e) + { + try + { + this.Enabled = false; + base.OnClick(e); + } + finally + { + this.Enabled = true; + } + } + + protected override void OnEnabledChanged(EventArgs e) + { + base.OnEnabledChanged(e); + if (Enabled) + { + this.BackColor = Color.FromArgb(51, 133, 255); + } + else + { + this.BackColor = Color.FromArgb(209, 213, 216); + } + } + } +} diff --git a/Test/Test.csproj b/Test/Test.csproj index 88f27b0..a7a737f 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -43,6 +43,9 @@ + + obj\Debug\Test.exe + @@ -51,11 +54,23 @@ Form1.cs + + Form + + + Form2.cs + + + Component + Form1.cs + + Form2.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/WinFormControl/UButton.cs b/WinFormControl/UButton.cs index c954740..4c67173 100644 --- a/WinFormControl/UButton.cs +++ b/WinFormControl/UButton.cs @@ -27,6 +27,38 @@ namespace WinFormControl [Browsable(true), Category("Sound"), Description("声音类型")] public SoundType SoundType { get; set; } + [Browsable(true), Description("状态保持")] + public bool WithStataHode { get; set; } + + private bool clicked; + public bool AsClicked + { + get { return clicked; } + set + { + if (clicked == value) + return; + clicked = value; + AsClickedChanged(); + } + } + + void AsClickedChanged() + { + if (!WithStataHode) + return; + if (clicked) + { + this.BackgroundImage = Resources.onclickBtn; + this.ForeColor = Color.White; + } + else + { + this.BackgroundImage = Resources.simpleBtn; + this.ForeColor = Color.Black; + } + } + protected override void OnMouseDown(MouseEventArgs mevent) { if (mevent.Button == MouseButtons.Left) @@ -45,10 +77,13 @@ namespace WinFormControl if (PlaySound) SoundPalyUtil.PlaySound(SoundType); base.OnClick(e); + this.Enabled = true; + AsClicked = !clicked; } - finally + catch { this.Enabled = true; + throw; } } diff --git a/WinFormControl/UWeightControl.Designer.cs b/WinFormControl/UWeightControl.Designer.cs index 7b7e393..f5cbc48 100644 --- a/WinFormControl/UWeightControl.Designer.cs +++ b/WinFormControl/UWeightControl.Designer.cs @@ -29,28 +29,13 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UWeightControl)); - this.weightSwitch = new System.Windows.Forms.Button(); this.panel2 = new System.Windows.Forms.Panel(); this.lblChengZhong = new System.Windows.Forms.Label(); + this.weightSwitch = new WinFormControl.UButton(); this.settingBtn = new WinFormControl.UButton(); this.panel2.SuspendLayout(); this.SuspendLayout(); // - // weightSwitch - // - this.weightSwitch.BackColor = System.Drawing.Color.Transparent; - this.weightSwitch.BackgroundImage = global::WinFormControl.Properties.Resources.simpleBtn; - this.weightSwitch.FlatAppearance.BorderSize = 0; - this.weightSwitch.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.weightSwitch.Font = new System.Drawing.Font("宋体", 15F); - this.weightSwitch.Location = new System.Drawing.Point(231, 43); - this.weightSwitch.Name = "weightSwitch"; - this.weightSwitch.Size = new System.Drawing.Size(111, 34); - this.weightSwitch.TabIndex = 2; - this.weightSwitch.Text = "启用称重"; - this.weightSwitch.UseVisualStyleBackColor = false; - this.weightSwitch.Click += new System.EventHandler(this.weightSwitch_Click); - // // panel2 // this.panel2.BackColor = System.Drawing.Color.Black; @@ -71,8 +56,29 @@ this.lblChengZhong.TabIndex = 0; this.lblChengZhong.Text = "0.00"; // + // weightSwitch + // + this.weightSwitch.AsClicked = false; + this.weightSwitch.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("weightSwitch.BackgroundImage"))); + this.weightSwitch.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.weightSwitch.FlatAppearance.BorderSize = 0; + this.weightSwitch.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.weightSwitch.Font = new System.Drawing.Font("宋体", 15F); + this.weightSwitch.ForeColor = System.Drawing.Color.Black; + this.weightSwitch.Location = new System.Drawing.Point(231, 43); + this.weightSwitch.Name = "weightSwitch"; + this.weightSwitch.PlaySound = false; + this.weightSwitch.Size = new System.Drawing.Size(111, 34); + this.weightSwitch.SoundType = WinFormControl.SoundType.Click; + this.weightSwitch.TabIndex = 2; + this.weightSwitch.Text = "启用称重"; + this.weightSwitch.UseVisualStyleBackColor = true; + this.weightSwitch.WithStataHode = true; + this.weightSwitch.Click += new System.EventHandler(this.weightSwitch_Click); + // // settingBtn // + this.settingBtn.AsClicked = false; this.settingBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("settingBtn.BackgroundImage"))); this.settingBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); this.settingBtn.FlatAppearance.BorderSize = 0; @@ -81,10 +87,13 @@ this.settingBtn.ForeColor = System.Drawing.Color.Black; this.settingBtn.Location = new System.Drawing.Point(231, 0); this.settingBtn.Name = "settingBtn"; + this.settingBtn.PlaySound = false; this.settingBtn.Size = new System.Drawing.Size(111, 34); + this.settingBtn.SoundType = WinFormControl.SoundType.Click; this.settingBtn.TabIndex = 41; this.settingBtn.Text = "称 设 置"; this.settingBtn.UseVisualStyleBackColor = true; + this.settingBtn.WithStataHode = false; this.settingBtn.Click += new System.EventHandler(this.settingBtn_Click); // // UWeightControl @@ -92,9 +101,9 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Transparent; + this.Controls.Add(this.weightSwitch); this.Controls.Add(this.settingBtn); this.Controls.Add(this.panel2); - this.Controls.Add(this.weightSwitch); this.Name = "UWeightControl"; this.Size = new System.Drawing.Size(349, 78); this.panel2.ResumeLayout(false); @@ -105,9 +114,9 @@ #endregion - private System.Windows.Forms.Button weightSwitch; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Label lblChengZhong; private UButton settingBtn; + private UButton weightSwitch; } } diff --git a/WinFormControl/UWeightControl.resx b/WinFormControl/UWeightControl.resx index 75fda3d..58da616 100644 --- a/WinFormControl/UWeightControl.resx +++ b/WinFormControl/UWeightControl.resx @@ -117,19 +117,27 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - True True - + True + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + True + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO