You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.7 KiB

3 years ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace UserControlLib
  11. {
  12. public partial class User_LabelText : UserControl
  13. {
  14. public User_LabelText()
  15. {
  16. InitializeComponent();
  17. }
  18. private void User_LabelText_Load(object sender, EventArgs e)
  19. {
  20. textBox.Location = new Point(label.Location.X + label.Width + 3, label.Location.Y - 4);
  21. textBox.Width = Width - label.Width - 6;
  22. // textBox.ReadOnly = true;
  23. }
  24. public string LabelText
  25. {
  26. get
  27. {
  28. return label.Text.Replace(":", "");
  29. }
  30. set
  31. {
  32. label.Text = value+":";
  33. }
  34. }
  35. public new string Text
  36. {
  37. get
  38. {
  39. return textBox.Text;
  40. }
  41. set
  42. {
  43. textBox.Text = value;
  44. }
  45. }
  46. public string GroupId { get; set; }
  47. public string TagTypeId { get; set; }
  48. public void TagValueChanged(string tagTypeId, string value)
  49. {
  50. if (tagTypeId == TagTypeId)
  51. {
  52. textBox.Text = value;
  53. }
  54. }
  55. private void User_LabelText_SizeChanged(object sender, EventArgs e)
  56. {
  57. textBox.Width = Width - label.Width - 6;
  58. }
  59. private void label_TextChanged(object sender, EventArgs e)
  60. {
  61. textBox.Width = Width - label.Width - 6;
  62. }
  63. }
  64. }