public override void OnMouseDown(int Button, int Shift, int X, int Y) { IPoint pMovePt = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); pMovePt = GIS.GraphicEdit.SnapSetting.getSnapPoint(pMovePt); txt_x.Text = Math.Round(pMovePt.X, 3).ToString(); txt_y.Text = Math.Round(pMovePt.Y, 3).ToString(); if (txt_x.FindForm() != null && txt_x.FindForm().Owner != null && txt_x.FindForm().Owner != GIS.Common.DataEditCommon.g_pAxMapControl.FindForm()) { txt_x.FindForm().Owner.WindowState = FormWindowState.Maximized; } }
public TextBoxAppender(TextBox textBox) { var frm = textBox.FindForm(); if (frm == null) return; frm.FormClosing += delegate { Close(); }; _textBox = textBox; Name = "TextBoxAppender"; }
private CErrorTextBoxHandler(TextBox i_txtBox) { // VBConversions Note: Non-static class variable initialization is below. Class variables cannot be initially assigned non-static values in C#. C_BACKCOLOR_ERROR = System.Drawing.Color.Pink; m_txtBox = i_txtBox; m_txtBox.Tag = this; m_form = i_txtBox.FindForm(); addErrorMark(); try { m_txtBox.Focus(); m_txtBox.TextChanged += handle_changed; m_txtBox.Leave += handle_leave; } catch (Exception) { m_form.KeyDown += keydown_in_form; } }
private bool ValidateNoParameters(TextBox textBoxEntry) { // pick out the <param> values in the server url string string parameters = BlogProviderParameters.ExtractParameterList(textBoxEntry.Text.Trim()); // if there are values then tell the user they must fill them in if (parameters.Length > 0) { DisplayMessage.Show(MessageId.ServerParameterNotSpecified, textBoxEntry.FindForm(), parameters.ToString()); textBoxEntry.Focus(); return false; } else { return true; } }
/// <summary> /// �ڵ�ͼ��ʰȡ�㣬�Զ����textbox /// </summary> /// <params name="txtX">X����TextBox�ؼ�</params> /// <params name="txtY">Y����TextBox�ؼ�</params> public static void PickUpPoint(TextBox txtX, TextBox txtY) { if (txtX.FindForm().Owner != null && txtX.FindForm().Owner != g_pAxMapControl.FindForm()) txtX.FindForm().Owner.WindowState = FormWindowState.Minimized; ICommand command = new GIS.SpecialGraphic.DrawPoint(txtX, txtY); command.OnCreate(g_pMyMapCtrl); if (command.Enabled) g_pAxMapControl.CurrentTool = (ITool)command; }
public static void SetAllKeyBoardWithForm(TextBox txt, int keyboardType) { if (keyboardType == 7) { return; } Form frm=null; if (keyboardType == 1) { if (allKeyBoardForm == null) { allKeyBoardForm = new VitualKeyboardForm(); } frm = allKeyBoardForm; allKeyBoardForm.InputTextBox = txt; #if DEBUG Console.WriteLine("SetAllKeyBoardWithForm开始显示键盘VitualKeyboardForm"); #endif } else { if (numKeyBoardForm == null) { numKeyBoardForm = new VitualNumKeyboardForm(); } frm = numKeyBoardForm; numKeyBoardForm.InputTextBox = txt; #if DEBUG Console.WriteLine("SetAllKeyBoardWithForm开始显示键盘numKeyBoardForm"); #endif } Point point = txt.Parent.PointToScreen(txt.Location); #if DEBUG Console.WriteLine("转化屏幕的坐标是:X=" + point.X.ToString() + "=Y=" + point.Y.ToString()); #endif int height = txt.Parent.Parent.Height; // allKeyBoard2.InputTextBox = txt; #if DEBUG Console.WriteLine("userinput下划线的坐标是:X=" + txt.Parent.Location.X.ToString() + "=Y=" + txt.Parent.Location.Y.ToString() + "userinput高度:" + height.ToString() + "键盘窗体高度:" + frm.Height.ToString() + "键盘窗体宽度:" + frm.Width.ToString()); #endif frm.Hide(); #if DEBUG Console.WriteLine("转化前键盘的坐标是:X=" + frm.Location.X.ToString() + "=Y=" + frm.Location.Y.ToString()+"-txt所在窗体的宽度为:"+txt.FindForm().Width.ToString()); #endif int tmpx = point.X; int SH = Screen.PrimaryScreen.Bounds.Height; int SW = Screen.PrimaryScreen.Bounds.Width; if (SW< tmpx + frm.Width) { tmpx =SW - frm.Width - 30; } // if (txt.FindForm().Width < tmpx + frm.Width) // { //tmpx = txt.FindForm().Width - frm.Width - 30; // } if (point.Y > frm.Height+14) { if (txt is HintTextBox) { frm.Location = new Point(tmpx - 14, point.Y - frm.Height - 15); } else { frm.Location = new Point(tmpx, point.Y - frm.Height); } } else { if (txt is HintTextBox) { frm.Location = new Point(tmpx - 14, point.Y + height - 14 + 1); } else { frm.Location = new Point(tmpx, point.Y + height + 1); } } frm.TabStop = false; #if DEBUG //allKeyBoardForm.BringToFront(); Console.WriteLine("转化后键盘的坐标是:X=" + frm.Location.X.ToString() + "=Y=" + frm.Location.Y.ToString()); #endif // frm.ShowDialog(); // frm.Show(); frm.Visible = true; }
public static void SetAllKeyBoard2(TextBox txt) { allKeyBoard.InputTextBox = txt; Point point = txt.Parent.PointToScreen(txt.Location); Form frm = allKeyBoard.FindForm(); if (frm == null) { // Console.WriteLine(""); txt.FindForm().Controls.Add(allKeyBoard); } else { frm.Controls.Remove(allKeyBoard); txt.FindForm().Controls.Add(allKeyBoard); } if (point.Y > allKeyBoard.Height + txt.Height) { allKeyBoard.Location = new Point(point.X, point.Y - allKeyBoard.Height - txt.Height + 20); } else { allKeyBoard.Location = new Point(point.X, point.Y + txt.Height + 1); } allKeyBoard.Visible = true; }
public static void SetAllKeyBoard(TextBox txt) { allKeyBoard2.InputTextBox = txt; Point point = txt.Parent.PointToScreen(txt.Location); #if DEBUG Console.WriteLine("转化屏幕的坐标是:X=" + point.X.ToString() + "=Y=" + point.Y.ToString()); #endif Form frm = allKeyBoard2.FindForm(); if (frm == null) { txt.FindForm().Controls.Add(allKeyBoard2); } else { frm.Controls.Remove(allKeyBoard2); txt.FindForm().Controls.Add(allKeyBoard2); } // allKeyBoard2.InputTextBox = txt; #if DEBUG Console.WriteLine("txt下划线的坐标是:X=" + txt.Location.X.ToString() + "=Y=" + txt.Location.Y.ToString() + "txt高度:" + txt.Height.ToString() + "键盘高度:" + allKeyBoard2.Height.ToString() + "键盘宽度:" + allKeyBoard2.Width.ToString()); Console.WriteLine("转化前键盘的坐标是:X=" + allKeyBoard2.Location.X.ToString() + "=Y=" + allKeyBoard2.Location.Y.ToString()); #endif int tmpx = point.X-30; if (txt.FindForm().Width < point.X + allKeyBoard2.Width) { tmpx=txt.FindForm().Width-allKeyBoard2.Width-30; } if (point.Y > allKeyBoard2.Height + txt.Height) { allKeyBoard2.Location = new Point(tmpx, point.Y - allKeyBoard2.Height - txt.Height + 20); } else { allKeyBoard2.Location = new Point(tmpx, point.Y + txt.Height + 1); } allKeyBoard2.TabStop = false; allKeyBoard2.BringToFront(); #if DEBUG Console.WriteLine("转化后键盘的坐标是:X=" + allKeyBoard2.Location.X.ToString() + "=Y=" + allKeyBoard2.Location.Y.ToString()); #endif allKeyBoard2.Visible = true; }
//private static public static void ShowInput(TextBox txt) { //.ShowToTextBox(txt); VitualKeyBoardPanel panel=new VitualKeyBoardPanel(); panel.InputTextBox = txt; Form form = new Form(); // Form formBorder = new Form(); // formBorder.Paint += new PaintEventHandler(formBorder_Paint); //form.FormBorderStyle = FormBorderStyle.FixedToolWindow; form.FormBorderStyle = FormBorderStyle.None; panel.Paint += new PaintEventHandler(formBorder_Paint); form.Width = panel.Width; form.Height = panel.Height; panel.Dock = DockStyle.Fill; form.Controls.Add(panel); Point point=txt.FindForm().PointToScreen(txt.Location); form.StartPosition = FormStartPosition.Manual; if (point.Y > panel.Height+txt.Height) { form.Location = new Point(point.X, point.Y -panel.Height- txt.Height+20); } else { form.Location = new Point(point.X, point.Y + txt.Height+1); } //txt.Text = point.X.ToString() + "-" + point.Y.ToString()+"-"+txt.Height; //form.StartPosition = FormStartPosition.CenterParent; // form.Paint += new PaintEventHandler(form_Paint); // MainForm.BackColor = Color.Blue; form.ShowDialog(); }