UserSetValue.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using Sunny.UI;
  11. using static Sunny.UI.UITextBox;
  12. namespace Scada
  13. {
  14. public partial class UserSetValue : UIUserControl
  15. {
  16. public UserSetValue()
  17. {
  18. InitializeComponent();
  19. }
  20. private string deviceVarName = "名称";
  21. [Description("设备变量名称")]
  22. [Category("自定义属性")]
  23. [Browsable(true)]
  24. public string DeviceVarName
  25. {
  26. get { return deviceVarName; }
  27. set
  28. {
  29. deviceVarName = value;
  30. this.lbl_Name.Text = deviceVarName;
  31. }
  32. }
  33. private string varValue = "";
  34. [Description("变量值")]
  35. [Category("自定义属性")]
  36. [Browsable(true)]
  37. public string VarValue
  38. {
  39. get { return varValue; }
  40. set
  41. {
  42. varValue = value;
  43. this.txt_Value.Text = varValue;
  44. }
  45. }
  46. private UIEditType dataType = UIEditType.Double;
  47. [Browsable(true)]
  48. [Category("自定义属性")]
  49. [Description("数值类型")]
  50. public UIEditType DataType
  51. {
  52. get { return dataType; }
  53. set
  54. {
  55. dataType = value;
  56. this.txt_Value.Type = dataType;
  57. }
  58. }
  59. private string unit = "单位";
  60. [Description("设置或获取单位")]
  61. [Category("自定义属性")]
  62. [Browsable(true)]
  63. public string Unit
  64. {
  65. get { return unit; }
  66. set
  67. {
  68. unit = value;
  69. this.lbl_Unit.Text = unit;
  70. }
  71. }
  72. private void txt_Value_TextChanged(object sender, EventArgs e)
  73. {
  74. VarValue = this.txt_Value.Text;
  75. }
  76. private string variableName = "";
  77. [Browsable(true)]
  78. [Category("自定义属性")]
  79. [Description("获取变量名称")]
  80. public string VariableName
  81. {
  82. get { return variableName; }
  83. set { variableName = value; }
  84. }
  85. }
  86. }