如何使用 RichTextBox 去除烦人的 BEEP [英] How to remove annoying BEEP with RichTextBox

查看:40
本文介绍了如何使用 RichTextBox 去除烦人的 BEEP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个新表单上放置了一个 RichTextBox 控件并启动了该项目.所以 RichTextBox.Text = "";

I placed a RichTextBox control on a new form and launched the project. So the RichTextBox.Text = "";

每次我按向上或向下键时,我都会听到烦人的 BEEP 声音!如何摆脱这个问题?

Each time I press Up or Down keys I heard the annoying BEEP sound! How to get rid of this issue?

在 KeyDown 方法中使用e.SuppressKeyPress = true"锁定光标位置.

Using "e.SuppressKeyPress = true" in the KeyDown method locks the Cursor position.

推荐答案

好吧,您可以尝试仅在脱字符号在第一行且键在上,或者在最后一行且键在下时才抑制键或在位置 0 且键在左等.

Well, you can try suppressing the key only if the caret is on the first line and the key is up, or on the last line and the key is down or in position 0 and the key is left, etc.

也就是说,这是大多数文本框的行为方式,并且声音是在您的操作系统首选项中设置的.如果您尝试将插入符号移出文本框的限制,您会在 Wordpad 或 Outlook 中得到同样的提示音.

That said, this is how most textboxes behave, and the sound is set in your operating system preferences. You'd get the same beep in, say, Wordpad or Outlook, if you try to move the caret beyond the limit of a textbox.

这篇关于如何使用 RichTextBox 去除烦人的 BEEP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆