METextSelectItem.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. namespace TSZ.DotNetDll.WinForms
  2. {
  3. using System;
  4. using System.Threading;
  5. using System.Windows.Forms;
  6. public class METextSelectItem : MultiEditorItem
  7. {
  8. private TextSelect ctrl;
  9. public event EventHandler ButtonClick;
  10. public METextSelectItem(string strLable) : this(strLable, string.Empty)
  11. {
  12. }
  13. public METextSelectItem(string strLable, string strText) : base(strLable, MEItemDataTypes.TextSelect, 60)
  14. {
  15. this.ctrl = new TextSelect();
  16. this.ctrl.TextBoxCtrl.TextChanged += new EventHandler(this.Editor_ValueChanged);
  17. this.ctrl.ButtonCtrl.Click += new EventHandler(this.ButtonCtrl_Click);
  18. this.Text = strText;
  19. }
  20. private void ButtonCtrl_Click(object sender, EventArgs e)
  21. {
  22. this.OnButtonClick(e);
  23. }
  24. protected virtual void OnButtonClick(EventArgs e)
  25. {
  26. if (this.ButtonClick != null)
  27. {
  28. this.ButtonClick(this, e);
  29. }
  30. }
  31. public override System.Windows.Forms.Control Control
  32. {
  33. get
  34. {
  35. return this.ctrl;
  36. }
  37. }
  38. public override MEDataTypes MEDataType
  39. {
  40. get
  41. {
  42. return MEDataTypes.String;
  43. }
  44. }
  45. public override string Text
  46. {
  47. get
  48. {
  49. return this.ctrl.TextBoxCtrl.Text;
  50. }
  51. set
  52. {
  53. this.ctrl.TextBoxCtrl.Text = value;
  54. }
  55. }
  56. public override object Value
  57. {
  58. get
  59. {
  60. return this.Text;
  61. }
  62. set
  63. {
  64. if (value == null)
  65. {
  66. this.Text = string.Empty;
  67. }
  68. else
  69. {
  70. this.Text = value.ToString();
  71. }
  72. }
  73. }
  74. }
  75. }