//public void ShowHide(object sender, KeyPressedEventArgs e) //{ // ShowHide(); //} public void ShowHide() { if (MWindow.IsVisible) { MWindow.Hide(); MTextBox.SelectAll(); } else { MWindow.Show(); MTextBox.SelectAll(); MTextBox.Focus(); MWindow.Activate(); } }
protected void EditValue(MedSheetCell cell) { MedSheet control = base.GetCurrentControl as MedSheet; _textBox.Text = ""; _textBox.Location = cell.DrawRectangel.Location; _textBox.Width = cell.DrawRectangel.Width; _textBox.Height = cell.DrawRectangel.Height; _textBox.Parent = control; MedSheetRow row = control.Rows[cell.RowIndex]; if (!string.IsNullOrEmpty(row.DictTableName) && !string.IsNullOrEmpty(row.DictValueFieldName)) { DataRow[] rows = BuildPopupItemsData(row.DictTableName, row.DictWhereString); string displayName = !string.IsNullOrEmpty(row.DisplayFieldName) ? row.DisplayFieldName.ToUpper() : row.DictValueFieldName.ToUpper(); //Dialog.ShowCustomSelection(rows, displayName, _textBox, // new System.Drawing.Size(_textBox.Width, 300), new EventHandler(delegate(object sender1, EventArgs e1) // { // if (sender1 is int) // { // int result = (int)sender1; // if (result > -1) // { // _textBox.Text = rows[result][row.DisplayFieldName].ToString(); // _textBox.Tag = cell; // TextBox_LostFocus(null, null); // } // } // })); } else { _textBox.BorderStyle = BorderStyle.FixedSingle; _textBox.Text = cell.Value == null ? "" : cell.Value.ToString(); _textBox.Tag = cell; _textBox.Visible = true; _textBox.Focus(); } }