سلام.
من یه richTextBox تو WPF درست کردم. می خوام فشار داده شدن enter یا space bar رو تشخیص بدم. با روش های Windows Form نمیشه.
میشه راهنمایی کنید.
سلام.
من یه richTextBox تو WPF درست کردم. می خوام فشار داده شدن enter یا space bar رو تشخیص بدم. با روش های Windows Form نمیشه.
میشه راهنمایی کنید.
<RichTextBox Name="t" PreviewKeyDown="t_PreviewKeyDown"></RichTextBox>
privatevoid t_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
MessageBox.Show("Enter");
if (e.Key == Key.Space)
MessageBox.Show("Space");
}
Close your eyes, take a deep breath, click your heels three times, and say, "There's no better thing than Inversion of Control and Dependency Injection, generic specialization, the decorator pattern, chains of responsibilities, and extensible software."