c# - 透明表单无法正确显示文本
我的项目的想法是在透明表单控件上显示纯文本。
我已经使用这种技术使表单透明:
BackColor = Color.Lime;
TransparencyKey = Color.Lime;
我遇到的问题是文本周围的彩色边缘。我尝试过使用图形绘制抗锯齿文本并使用标签显示文本,但都不起作用。我的文字周围仍然有看起来很恶心、像素化、石灰质的边缘。
我环顾四周 - 帖子通常关注的是使表单透明而不是处理这个问题。
The idea of my project is to show solid text on a transparent form control.
I have used this technique to make the form transparent:
BackColor = Color.Lime;
TransparencyKey = Color.Lime;
The problem I'm having is coloured edges around the text. I've tried drawing anti-aliased text using graphics and displaying the text using labels but neither worked. I still have disgusting-looking, pixelated, lime edges around my text.
I looked around a little - posts are usually concerned with making the form transparent not dealing with this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
TextRenderingHint.AntiAliasGridFit
获得合理输出。但如果您打算使用大字体,它的渲染效果就不会太好,因为它无法真正正确地抗锯齿。
一般来说,字体的本质是有一个可以绘制的背景。如果透明表单上有黑色文本,并且最终用户有黑色背景,则最终用户将看不到任何内容。
You can get reasonable output by using
TextRenderingHint.AntiAliasGridFit
.But if you plan on using large fonts, it won't render too well since it can't really antialias properly.
The nature of fonts, in general, is to have a background to draw on. If you have black text on a transparent form, and the end user has a black background-- the end user isn't going to see anything.