private void moreButton_Click(object sender, System.EventArgs e) { Point location = optionsTextBox.PointToScreen(new Point(0, 20)); optionsSelectorForm.Location = location; optionsSelectorForm.Show(); //optionsSelectorForm.ShowDialog(Project.mainForm); }
//------------------------------------------------------------------------------------------------------ #region ** private stuff private void ShowNote(Rectangle r, bool editMode) { if (!Visible) { // position form Left = r.Right + 1; Top = r.Y - 30; // store cell position r = RectangleToClient(r); _ptCell = new Point(r.Right, r.Top); // start showing/editing the note _editing = editMode; if (editMode) { // show the form Show(); // move the cursor over the editor Point pt = new Point(_txtNote.Width / 2, _txtNote.Height / 2); Cursor.Position = _txtNote.PointToScreen(pt); // place selection at the end _txtNote.SelectionStart = 32000; } else { // disable editor so it won't get the focus _txtNote.Enabled = false; // show the form Show(); // re-enable editor so it doesn't look disabled _txtNote.Enabled = true; } } }
private void ShowInputPanel(TextBox TargetControl) { Point controlLocation=Point.Empty; Point inputPanelLocation=Point.Empty; controlLocation = TargetControl.PointToScreen(controlLocation); Rectangle ScreenWorkArea = Screen.FromPoint(controlLocation).WorkingArea; //If Not frminptForm.Visible Then frminptForm.CurrentUsedControl = TargetControl; inputPanelLocation.X = controlLocation.X; inputPanelLocation.Y = controlLocation.Y + 30; if (controlLocation.X + frminptForm.Width > ScreenWorkArea.Width) //右边界超出屏幕 { inputPanelLocation.X = ScreenWorkArea.Width - frminptForm.Width; } if (controlLocation.Y + TargetControl.Height + frminptForm.Height + 30 > ScreenWorkArea.Height) //下边界超出屏幕 { inputPanelLocation.Y = controlLocation.Y - 30 - frminptForm.Height; } if (controlLocation.X < 0) //左边界超出屏幕 { inputPanelLocation.X = 0; } frminptForm.SetBounds(inputPanelLocation.X, inputPanelLocation.Y, 592, 264); frminptForm.Show(); }