将 MaskedTextBox 与文本一起使用

发布于 2024-10-01 11:31:42 字数 327 浏览 0 评论 0原文

我面临着一个困扰我的简单问题...

我有一个 MaskedTextBox,我希望用户能够在末尾输入 3 个数字:

“我的 Masked 文本框:XXX”

该文本将被翻译。问题是,该控件使用 Microsoft 的配方来验证输入,在本例中,最终显示将如下所示:

“My M_sked Text Box : _

字母 'a' 被视为控制字符而不是简单的文本字符。我可以反斜杠它,但是当文本被翻译时,我必须再做一次,我认为必须做这样的事情是荒谬的......

我希望我说得很清楚......

提前感谢您的帮助!

I'm facing a simple problem that bugs me...

I have a MaskedTextBox and I want the user to be able to enter 3 numbers at the end :

"My Masked Text Box : XXX"

This text will be translated. The problem is, this control uses Microsoft's recipe to validate the input and in this example, the final display will look like this :

"My M_sked Text Box : _"

The letter 'a' is considered like a control caracter instead of a simple text caracter. I can backslash it but when the text is translated I have to do it again and I think it's ridiculous to have to do something like that...

I hope I'm being clear...

Thanks in advance for your help !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

桃扇骨 2024-10-08 11:31:42

'a' 需要作为文字引用。掩码应类似于:

My M\asked Text Box : 000

您应该使用“9”而不是“0”作为可选数字字符的占位符。

当然,与掩码选项匹配的任何其他字符也应该是“文字”。

http://msdn.microsoft.com/en -us/library/system.windows.forms.maskedtextbox.mask.aspx


阅读评论后,我想添加另一个建议(您清楚地了解文字 - 问题是您的翻译。

)通过过滤器运行翻译后的文本字符串是否可行,该过滤器在可能的情况下放置文字引号?这不是一个很好的解决方案,因为如果微软添加了新的控制字符,它会破坏你的过滤器,但我认为它会起作用。

The 'a' needs to be quoted as a literal. The Mask should be something like:

My M\asked Text Box : 000

You should use '9' rather than '0' as the placeholder for an optional numerical character.

Of course any other of the characters that match mask options should be 'literal' too.

http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask.aspx


After reading the comments I'd like to add another suggestion (you clearly understood about literals -- the problem is your translation.)

Would it be feasible to run the translated text strings through a filter that put literal-quotes in where possible? It's not that nice a solution, because if Microsoft added new control characters it'll break your filter, but I think it would work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文