110,536
社区成员
发帖
与我相关
我的任务
分享
private void calibriToolStripMenuItem_Click(object sender, EventArgs e)
{
contentRichTextBox.SelectionFont = new Font("Calibri", defaultFontSize,
FontStyle.Regular);
}
private void letterButton_Click(object sender, EventArgs e)
{
var control = createNewFormBase.LastFocusedTextBox;
if (control is TextBox)
{
TextBox textBox = (TextBox)control;
if (textBox.ReadOnly == true)
return;
string s = textBox.Text;
var index = textBox.SelectionStart;
textBox.Text = s.Insert(index, ((Control)sender).Text);
textBox.SelectionStart = index + 1;
textBox.Focus();
}
else if (control is RichTextBox)
{
RichTextBox richTextBox = (RichTextBox)control;
if (richTextBox.ReadOnly == true)
return;
string s = richTextBox.Text;
var index = richTextBox.SelectionStart;
richTextBox.Text = s.Insert(index, ((Control)sender).Text);
richTextBox.SelectionStart = index + 1;
richTextBox.Focus();
}
else
{
// 提示错误信息
}
}