/// ------------------------------------------------------------------------------------ /// <summary> /// Choose a symbol for the footnote /// </summary> /// ------------------------------------------------------------------------------------ private void btnChooseSymbol_Click(object sender, System.EventArgs e) { using (Font fnt = new Font(txtMarker.Font.Name, 20)) using (SymbolChooserDlg dlg = new SymbolChooserDlg(fnt, UnicodeCharProps, m_helpTopicProvider)) { // Make the initial character in the symbol dialog the last character in the // marker string. if (txtMarker.Text != string.Empty) { dlg.ChosenSymbol = txtMarker.Text.Substring(txtMarker.Text.Length - 1, 1); } else { dlg.ChosenSymbol = "*"; txtMarker.SelectionLength = 1; txtMarker.SelectionStart = 0; } if (dlg.ShowDialog() == DialogResult.OK) { int prevSelStart = txtMarker.SelectionStart; // If any text is selected then remove it first. if (txtMarker.SelectionLength > 0) { txtMarker.Text = txtMarker.Text.Remove(txtMarker.SelectionStart, txtMarker.SelectionLength); } txtMarker.Text = txtMarker.Text.Insert(prevSelStart, dlg.ChosenSymbol); txtMarker.SelectionLength = 0; txtMarker.SelectionStart = (prevSelStart < kMaxMarkerLength ? prevSelStart + 1 : kMaxMarkerLength); txtMarker.Focus(); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Choose a symbol for the footnote /// </summary> /// ------------------------------------------------------------------------------------ private void btnChooseSymbol_Click(object sender, System.EventArgs e) { using (Font fnt = new Font(txtMarker.Font.Name, 20)) using (SymbolChooserDlg dlg = new SymbolChooserDlg(fnt, UnicodeCharProps, m_helpTopicProvider)) { // Make the initial character in the symbol dialog the last character in the // marker string. if (txtMarker.Text != string.Empty) dlg.ChosenSymbol = txtMarker.Text.Substring(txtMarker.Text.Length - 1, 1); else { dlg.ChosenSymbol = "*"; txtMarker.SelectionLength = 1; txtMarker.SelectionStart = 0; } if (dlg.ShowDialog() == DialogResult.OK) { int prevSelStart = txtMarker.SelectionStart; // If any text is selected then remove it first. if (txtMarker.SelectionLength > 0) { txtMarker.Text = txtMarker.Text.Remove(txtMarker.SelectionStart, txtMarker.SelectionLength); } txtMarker.Text = txtMarker.Text.Insert(prevSelStart, dlg.ChosenSymbol); txtMarker.SelectionLength = 0; txtMarker.SelectionStart = (prevSelStart < kMaxMarkerLength ? prevSelStart + 1 : kMaxMarkerLength); txtMarker.Focus(); } } }