123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- using SuperMap.Data;
- using System;
- using System.Collections.Generic;
- using WeifenLuo.WinFormsUI.Docking;
- using WWPipeLine.MapBasic.Conditions;
- using WWPipeLine.MapBasic;
- namespace WWPipeLine.MapTools.Conditions.Locations
- {
- public class DWzuobiao : ConditionPanel
- {
- private Sunny.UI.UILabel uiLabel2;
- private Sunny.UI.UILabel uiLabel1;
- private Sunny.UI.UITextBox tbX;
- private Sunny.UI.UITextBox tbY;
- private Sunny.UI.UIGroupBox uiGroupBox1;
- public DWzuobiao() : base()
- {
- this.ConditionPanelName = "按照坐标定位";
- InitializeComponent();
- }
- protected override void OnLoad(EventArgs e)
- {
- }
- public override object Do(DockPanel dockPanel = null)
- {
- this.IsShowResultWindow = false;
- double pointX = 0.0d;
- double pointY = 0.0d;
- if (!double.TryParse(tbX.Text, out pointX) || !double.TryParse(tbY.Text, out pointY))
- {
- Sunny.UI.UIMessageTip.ShowError("请输入正确的坐标!仅能输入数字、小数点", 5000); return false;
- }
- MapControl.Map.Center = new Point2D(pointX, pointY);
- MapControl.Map.Refresh();
- return true;
- }
- private void tbY_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
- {
- //只能输入 48代表0 57代表9,46代表小数点 8代表Backspace退格键
- if ((e.KeyChar < 48 || e.KeyChar > 57) && (e.KeyChar < 96 || e.KeyChar > 105) && (e.KeyChar != 46) && (e.KeyChar != 8))
- e.Handled = true;
- }
- private void tbX_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
- {
- if ((e.KeyChar < 48 || e.KeyChar > 57) && (e.KeyChar < 96 || e.KeyChar > 105) && (e.KeyChar != 46) && (e.KeyChar != 8))
- e.Handled = true;
- }
- private void InitializeComponent()
- {
- this.uiGroupBox1 = new Sunny.UI.UIGroupBox();
- this.tbY = new Sunny.UI.UITextBox();
- this.tbX = new Sunny.UI.UITextBox();
- this.uiLabel2 = new Sunny.UI.UILabel();
- this.uiLabel1 = new Sunny.UI.UILabel();
- this.uiGroupBox1.SuspendLayout();
- this.SuspendLayout();
- //
- // uiGroupBox1
- //
- this.uiGroupBox1.Controls.Add(this.tbY);
- this.uiGroupBox1.Controls.Add(this.tbX);
- this.uiGroupBox1.Controls.Add(this.uiLabel2);
- this.uiGroupBox1.Controls.Add(this.uiLabel1);
- this.uiGroupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.uiGroupBox1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
- this.uiGroupBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiGroupBox1.Location = new System.Drawing.Point(0, 0);
- this.uiGroupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.uiGroupBox1.MinimumSize = new System.Drawing.Size(1, 1);
- this.uiGroupBox1.Name = "uiGroupBox1";
- this.uiGroupBox1.Padding = new System.Windows.Forms.Padding(0, 32, 0, 0);
- this.uiGroupBox1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.uiGroupBox1.Size = new System.Drawing.Size(404, 183);
- this.uiGroupBox1.Style = Sunny.UI.UIStyle.Gray;
- this.uiGroupBox1.TabIndex = 0;
- this.uiGroupBox1.Text = "按坐标定位";
- this.uiGroupBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // tbY
- //
- this.tbY.Cursor = System.Windows.Forms.Cursors.IBeam;
- this.tbY.FillColor = System.Drawing.Color.White;
- this.tbY.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.tbY.Location = new System.Drawing.Point(92, 87);
- this.tbY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.tbY.Maximum = 2147483647D;
- this.tbY.Minimum = -2147483648D;
- this.tbY.MinimumSize = new System.Drawing.Size(1, 1);
- this.tbY.Name = "tbY";
- this.tbY.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.tbY.Size = new System.Drawing.Size(253, 29);
- this.tbY.Style = Sunny.UI.UIStyle.Gray;
- this.tbY.TabIndex = 3;
- this.tbY.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
- this.tbY.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbY_KeyPress);
- //
- // tbX
- //
- this.tbX.Cursor = System.Windows.Forms.Cursors.IBeam;
- this.tbX.FillColor = System.Drawing.Color.White;
- this.tbX.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.tbX.Location = new System.Drawing.Point(92, 44);
- this.tbX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.tbX.Maximum = 2147483647D;
- this.tbX.Minimum = -2147483648D;
- this.tbX.MinimumSize = new System.Drawing.Size(1, 1);
- this.tbX.Name = "tbX";
- this.tbX.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.tbX.Size = new System.Drawing.Size(253, 29);
- this.tbX.Style = Sunny.UI.UIStyle.Gray;
- this.tbX.TabIndex = 2;
- this.tbX.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
- this.tbX.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbX_KeyPress);
- //
- // uiLabel2
- //
- this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiLabel2.Location = new System.Drawing.Point(16, 93);
- this.uiLabel2.Name = "uiLabel2";
- this.uiLabel2.Size = new System.Drawing.Size(69, 23);
- this.uiLabel2.Style = Sunny.UI.UIStyle.Gray;
- this.uiLabel2.TabIndex = 1;
- this.uiLabel2.Text = "Y坐标:";
- this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // uiLabel1
- //
- this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiLabel1.Location = new System.Drawing.Point(16, 50);
- this.uiLabel1.Name = "uiLabel1";
- this.uiLabel1.Size = new System.Drawing.Size(69, 23);
- this.uiLabel1.Style = Sunny.UI.UIStyle.Gray;
- this.uiLabel1.TabIndex = 0;
- this.uiLabel1.Text = "X坐标:";
- this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // zuobiao
- //
- this.Controls.Add(this.uiGroupBox1);
- this.Name = "zuobiao";
- this.Size = new System.Drawing.Size(404, 183);
- this.uiGroupBox1.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- }
- }
|