如何使只读文本框中的文字不褪色?

发布于 2024-11-15 06:30:14 字数 163 浏览 2 评论 0原文

我正在开发一款 Windows Phone 7 Silverlight 益智游戏,有点像数独。我为拼图的每个单元格都有文本框。玩家一开始就得到了数字,我不希望他们能够编辑这些单元格,所以我将它们设置为只读,但颜色变得褪色并且难以阅读。我想做的是改变文本的颜色,但无论我改变什么,它都保持相同的褪色颜色。这可能吗?

I'm working on a Windows Phone 7 Silverlight puzzle game that is sort of like sudoku. I have text boxes for each cell of the puzzle. The player is given numbers to start out with and I don't want them to be able to edit those cells so I made them read only, but the color becomes faded and hard to read. What I'm trying to do is change the color of the text but no matter what I change it to it stays the same faded color. Is this even possible?

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

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

发布评论

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

评论(3

灯角 2024-11-22 06:30:14

您需要在表达式混合中编辑文本框的模板。它的状态将具有只读状态,您需要对其进行调整以满足您的需求。更多信息请参见此处

You'd need to edit the template of the textbox in expression blend. Its states would have a read-only state which you need to tweak to your satisfaction. More info here.

書生途 2024-11-22 06:30:14

TextBox 执行此操作的方式不是更改颜色,而是更改不透明度。要更改此设置,您需要重新设置文本框的样式并调整不透明度以获得正确的视觉状态。

如果您没有过多使用过 Expression Blend,那么您需要查找有关“编辑控制模板”和“视觉状态管理器”的教程。

The way the TextBox does this is not to alter the colour but the opacity. To change this you'll need to re-style the TextBox and tweak the opacity for the correct Visual State.

If you haven't worked with Expression Blend too much then you'll want to look up tutorials on "Editing Control Templates" and the "Visual State Manager".

凑诗 2024-11-22 06:30:14

最快、最简单的方法是用 0% 不透明度的矩形覆盖该框,然后实际上不将其设置为只读。该矩形将阻止用户的任何点击操作,如果您想让其稍后可编辑,您可以折叠该矩形。

当然,它不“正确”,但它有效且简单。

The fastest, easiest way is to make a rectangle with 0% opacity cover up the box, and then don't actually make it read only. The rectangle will block any tap action from the user, and if you want to make it editable later, you can collapse the rectangle.

Sure, its not "correct" but it works and its easy.

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