public static string ShowText(string strTexte, bool bEditable) { CFormZoomText form = new CFormZoomText(); Point pt = Cursor.Position; if (pt.X + form.Width > Screen.PrimaryScreen.WorkingArea.Width) { pt.X = Screen.PrimaryScreen.WorkingArea.Width - form.Width; } if (pt.Y + form.Height > Screen.PrimaryScreen.WorkingArea.Height) { pt.Y = Screen.PrimaryScreen.WorkingArea.Height - form.Height; } form.StartPosition = FormStartPosition.Manual; form.Location = pt; CWin32Traducteur.Translate(form); if (bEditable) { form.m_txtZoom.ReadOnly = false; form.m_lnkOk.Visible = true; } else { form.m_txtZoom.ReadOnly = true; form.m_lnkOk.Visible = false; } form.m_txtZoom.Text = strTexte; if (form.ShowDialog() == DialogResult.OK) { strTexte = form.m_txtZoom.Text; } form.Dispose(); return(strTexte); }
protected override void OnMouseUp(DataGridViewCellMouseEventArgs e) { base.OnMouseUp(e); if ((e.Button & MouseButtons.Left) == MouseButtons.Left && DataGridView != null && DataGridView.ReadOnly && CanBeZoomed(null, e.RowIndex)) { Size sz = GetSize(e.RowIndex); if (e.X > sz.Width - 10 && e.Y > sz.Height - 10) { string strVal = ""; try { strVal = this.GetValue(e.RowIndex).ToString(); CFormZoomText.ShowText(strVal, false); } catch { } } } }
//------------------------------------- private void m_btnZoom_Click(object sender, EventArgs e) { Text = CFormZoomText.ShowText(Text, true); }