| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Tool;
- namespace Core.Mes.Client.Comm.Control
- {
- //[DefaultBindingProperty("defualtValue")]
- //[DefaultProperty("defualtValue")]
- public partial class LabelTextBox : UserControl, LabelControlInterface
- {
- public LabelTextBox()
- {
- InitializeComponent();
- }
- [Browsable(true), Category("原始系统控件")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- public Label Label
- {
- get
- {
- return this.label1;
- }
- }
- [Browsable(true), Category("原始系统控件")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- public TextBox TextBox
- {
- get
- {
- return this.textBox1;
- }
- }
- [Browsable(true), Category("原始系统控件")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- public CheckBox CheckBox
- {
- get
- {
- return this.checkBox1;
- }
- }
- [Browsable(true), Category("外观")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- public string Caption
- {
- get
- {
- return this.label1.Text;
- }
- set
- {
- this.label1.Text = value;
- }
- }
- [Browsable(true), Category("外观")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- //[Bindable(true, BindingDirection.TwoWay)]
- public override string Text
- {
- get
- {
- return this.textBox1.Text;
- }
- set
- {
- this.textBox1.Text = value;
- //DataBindings["Text"].WriteValue();
- }
- }
- [Browsable(true), Category("外观")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- public bool CheckBoxVisible
- {
- get { return this.checkBox1.Visible; }
- set
- {
- this.checkBox1.Visible = value;
- }
- }
- [Browsable(true), Category("外观")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- public bool Checked
- {
- get { return this.checkBox1.Checked; }
- set
- {
- this.checkBox1.Checked = value;
- }
- }
- [Browsable(true), Category("外观")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- public bool TextBoxEnabled
- {
- get { return this.textBox1.Enabled; }
- set { this.textBox1.Enabled = value; }
- }
- private void checkBox1_VisibleChanged(object sender, EventArgs e)
- {
- if (checkBox1.Visible == false)
- {
- label1.Location = checkBox1.Location;
- this.checkBox1.Checked = true;
- }
- else
- {
- int x = checkBox1.Location.X + checkBox1.Size.Width + 2;
- label1.Location = new Point(x, checkBox1.Location.Y);
- }
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- this.textBox1.Enabled = checkBox1.Checked;
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- if (DataBindings["Text"] != null)
- {
- DataBindings["Text"].WriteValue();
- }
- }
- private void label1_MouseClick(object sender, MouseEventArgs e)
- {
- if (this.checkBox1.Visible == true)
- {
- this.checkBox1.Checked = !checkBox1.Checked;
- }
- }
- }
- }
|