DWzuobiao.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.UITextBox tbY;
  12. private Sunny.UI.UITextBox tbX;
  13. private Sunny.UI.UILabel uiLabel2;
  14. private Sunny.UI.UILabel uiLabel1;
  15. public DWzuobiao() : base()
  16. {
  17. this.ConditionPanelName = "按照坐标定位";
  18. InitializeComponent();
  19. this.SetSize(400, 185);
  20. this.IsShowResultWindow = false;
  21. }
  22. public override object Do(DockPanel dockPanel = null)
  23. {
  24. double pointX = 0.0d;
  25. double pointY = 0.0d;
  26. if (!double.TryParse(tbX.Text, out pointX) || !double.TryParse(tbY.Text, out pointY))
  27. {
  28. Sunny.UI.UIMessageTip.ShowError("请输入正确的坐标!仅能输入数字、小数点"); return false;
  29. }
  30. MapControl.Map.Center = new Point2D(pointX, pointY);
  31. MapControl.Map.Refresh();
  32. return true;
  33. }
  34. private void InitializeComponent()
  35. {
  36. this.tbY = new Sunny.UI.UITextBox();
  37. this.tbX = new Sunny.UI.UITextBox();
  38. this.uiLabel2 = new Sunny.UI.UILabel();
  39. this.uiLabel1 = new Sunny.UI.UILabel();
  40. this.SuspendLayout();
  41. //
  42. // tbY
  43. //
  44. this.tbY.Cursor = System.Windows.Forms.Cursors.IBeam;
  45. this.tbY.FillColor = System.Drawing.Color.White;
  46. this.tbY.Font = new System.Drawing.Font("微软雅黑", 12F);
  47. this.tbY.Location = new System.Drawing.Point(98, 53);
  48. this.tbY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  49. this.tbY.Maximum = 2147483647D;
  50. this.tbY.Minimum = -2147483648D;
  51. this.tbY.MinimumSize = new System.Drawing.Size(1, 1);
  52. this.tbY.Name = "tbY";
  53. this.tbY.Size = new System.Drawing.Size(253, 29);
  54. this.tbY.TabIndex = 7;
  55. this.tbY.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
  56. this.tbY.KeyPress += new System.Windows.Forms.KeyPressEventHandler(ComsStatic.uiTextBox_num_KeyPress);
  57. //
  58. // tbX
  59. //
  60. this.tbX.Cursor = System.Windows.Forms.Cursors.IBeam;
  61. this.tbX.FillColor = System.Drawing.Color.White;
  62. this.tbX.Font = new System.Drawing.Font("微软雅黑", 12F);
  63. this.tbX.Location = new System.Drawing.Point(98, 10);
  64. this.tbX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  65. this.tbX.Maximum = 2147483647D;
  66. this.tbX.Minimum = -2147483648D;
  67. this.tbX.MinimumSize = new System.Drawing.Size(1, 1);
  68. this.tbX.Name = "tbX";
  69. this.tbX.Size = new System.Drawing.Size(253, 29);
  70. this.tbX.TabIndex = 6;
  71. this.tbX.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
  72. this.tbX.KeyPress += new System.Windows.Forms.KeyPressEventHandler(ComsStatic.uiTextBox_num_KeyPress);
  73. //
  74. // uiLabel2
  75. //
  76. this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F);
  77. this.uiLabel2.Location = new System.Drawing.Point(22, 59);
  78. this.uiLabel2.Name = "uiLabel2";
  79. this.uiLabel2.Size = new System.Drawing.Size(69, 23);
  80. this.uiLabel2.TabIndex = 5;
  81. this.uiLabel2.Text = "Y坐标:";
  82. this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  83. //
  84. // uiLabel1
  85. //
  86. this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F);
  87. this.uiLabel1.Location = new System.Drawing.Point(22, 16);
  88. this.uiLabel1.Name = "uiLabel1";
  89. this.uiLabel1.Size = new System.Drawing.Size(69, 23);
  90. this.uiLabel1.TabIndex = 4;
  91. this.uiLabel1.Text = "X坐标:";
  92. this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  93. //
  94. // DWzuobiao
  95. //
  96. this.Controls.Add(this.tbY);
  97. this.Controls.Add(this.tbX);
  98. this.Controls.Add(this.uiLabel2);
  99. this.Controls.Add(this.uiLabel1);
  100. this.Name = "DWzuobiao";
  101. this.Size = new System.Drawing.Size(400, 100);
  102. this.ResumeLayout(false);
  103. }
  104. }
  105. }