DWzuobiao.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using SuperMap.Data;
  2. using System;
  3. using System.Collections.Generic;
  4. using WeifenLuo.WinFormsUI.Docking;
  5. using WWPipeLine.MapBasic.Conditions;
  6. using WWPipeLine.MapBasic;
  7. namespace WWPipeLine.MapTools.Conditions.Locations
  8. {
  9. public class DWzuobiao : ConditionPanel
  10. {
  11. private Sunny.UI.UILabel uiLabel2;
  12. private Sunny.UI.UILabel uiLabel1;
  13. private Sunny.UI.UITextBox tbX;
  14. private Sunny.UI.UITextBox tbY;
  15. private Sunny.UI.UIGroupBox uiGroupBox1;
  16. public DWzuobiao() : base()
  17. {
  18. this.ConditionPanelName = "按照坐标定位";
  19. InitializeComponent();
  20. }
  21. protected override void OnLoad(EventArgs e)
  22. {
  23. }
  24. public override object Do(DockPanel dockPanel = null)
  25. {
  26. this.IsShowResultWindow = false;
  27. double pointX = 0.0d;
  28. double pointY = 0.0d;
  29. if (!double.TryParse(tbX.Text, out pointX) || !double.TryParse(tbY.Text, out pointY))
  30. {
  31. Sunny.UI.UIMessageTip.ShowError("请输入正确的坐标!仅能输入数字、小数点", 5000); return false;
  32. }
  33. MapControl.Map.Center = new Point2D(pointX, pointY);
  34. MapControl.Map.Refresh();
  35. return true;
  36. }
  37. private void tbY_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
  38. {
  39. //只能输入 48代表0 57代表9,46代表小数点 8代表Backspace退格键
  40. if ((e.KeyChar < 48 || e.KeyChar > 57) && (e.KeyChar < 96 || e.KeyChar > 105) && (e.KeyChar != 46) && (e.KeyChar != 8))
  41. e.Handled = true;
  42. }
  43. private void tbX_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
  44. {
  45. if ((e.KeyChar < 48 || e.KeyChar > 57) && (e.KeyChar < 96 || e.KeyChar > 105) && (e.KeyChar != 46) && (e.KeyChar != 8))
  46. e.Handled = true;
  47. }
  48. private void InitializeComponent()
  49. {
  50. this.uiGroupBox1 = new Sunny.UI.UIGroupBox();
  51. this.tbY = new Sunny.UI.UITextBox();
  52. this.tbX = new Sunny.UI.UITextBox();
  53. this.uiLabel2 = new Sunny.UI.UILabel();
  54. this.uiLabel1 = new Sunny.UI.UILabel();
  55. this.uiGroupBox1.SuspendLayout();
  56. this.SuspendLayout();
  57. //
  58. // uiGroupBox1
  59. //
  60. this.uiGroupBox1.Controls.Add(this.tbY);
  61. this.uiGroupBox1.Controls.Add(this.tbX);
  62. this.uiGroupBox1.Controls.Add(this.uiLabel2);
  63. this.uiGroupBox1.Controls.Add(this.uiLabel1);
  64. this.uiGroupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
  65. this.uiGroupBox1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
  66. this.uiGroupBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
  67. this.uiGroupBox1.Location = new System.Drawing.Point(0, 0);
  68. this.uiGroupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  69. this.uiGroupBox1.MinimumSize = new System.Drawing.Size(1, 1);
  70. this.uiGroupBox1.Name = "uiGroupBox1";
  71. this.uiGroupBox1.Padding = new System.Windows.Forms.Padding(0, 32, 0, 0);
  72. this.uiGroupBox1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  73. this.uiGroupBox1.Size = new System.Drawing.Size(404, 183);
  74. this.uiGroupBox1.Style = Sunny.UI.UIStyle.Gray;
  75. this.uiGroupBox1.TabIndex = 0;
  76. this.uiGroupBox1.Text = "按坐标定位";
  77. this.uiGroupBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
  78. //
  79. // tbY
  80. //
  81. this.tbY.Cursor = System.Windows.Forms.Cursors.IBeam;
  82. this.tbY.FillColor = System.Drawing.Color.White;
  83. this.tbY.Font = new System.Drawing.Font("微软雅黑", 12F);
  84. this.tbY.Location = new System.Drawing.Point(92, 87);
  85. this.tbY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  86. this.tbY.Maximum = 2147483647D;
  87. this.tbY.Minimum = -2147483648D;
  88. this.tbY.MinimumSize = new System.Drawing.Size(1, 1);
  89. this.tbY.Name = "tbY";
  90. this.tbY.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  91. this.tbY.Size = new System.Drawing.Size(253, 29);
  92. this.tbY.Style = Sunny.UI.UIStyle.Gray;
  93. this.tbY.TabIndex = 3;
  94. this.tbY.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
  95. this.tbY.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbY_KeyPress);
  96. //
  97. // tbX
  98. //
  99. this.tbX.Cursor = System.Windows.Forms.Cursors.IBeam;
  100. this.tbX.FillColor = System.Drawing.Color.White;
  101. this.tbX.Font = new System.Drawing.Font("微软雅黑", 12F);
  102. this.tbX.Location = new System.Drawing.Point(92, 44);
  103. this.tbX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  104. this.tbX.Maximum = 2147483647D;
  105. this.tbX.Minimum = -2147483648D;
  106. this.tbX.MinimumSize = new System.Drawing.Size(1, 1);
  107. this.tbX.Name = "tbX";
  108. this.tbX.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  109. this.tbX.Size = new System.Drawing.Size(253, 29);
  110. this.tbX.Style = Sunny.UI.UIStyle.Gray;
  111. this.tbX.TabIndex = 2;
  112. this.tbX.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
  113. this.tbX.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbX_KeyPress);
  114. //
  115. // uiLabel2
  116. //
  117. this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F);
  118. this.uiLabel2.Location = new System.Drawing.Point(16, 93);
  119. this.uiLabel2.Name = "uiLabel2";
  120. this.uiLabel2.Size = new System.Drawing.Size(69, 23);
  121. this.uiLabel2.Style = Sunny.UI.UIStyle.Gray;
  122. this.uiLabel2.TabIndex = 1;
  123. this.uiLabel2.Text = "Y坐标:";
  124. this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  125. //
  126. // uiLabel1
  127. //
  128. this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F);
  129. this.uiLabel1.Location = new System.Drawing.Point(16, 50);
  130. this.uiLabel1.Name = "uiLabel1";
  131. this.uiLabel1.Size = new System.Drawing.Size(69, 23);
  132. this.uiLabel1.Style = Sunny.UI.UIStyle.Gray;
  133. this.uiLabel1.TabIndex = 0;
  134. this.uiLabel1.Text = "X坐标:";
  135. this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  136. //
  137. // zuobiao
  138. //
  139. this.Controls.Add(this.uiGroupBox1);
  140. this.Name = "zuobiao";
  141. this.Size = new System.Drawing.Size(404, 183);
  142. this.uiGroupBox1.ResumeLayout(false);
  143. this.ResumeLayout(false);
  144. }
  145. }
  146. }