Windows窗体中可聚焦,无边框,透明的背景控件? [英] A focusable, borderless, transparent background control in windows forms?

查看:150
本文介绍了Windows窗体中可聚焦,无边框,透明的背景控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个可聚焦(可以提高GotFocus和LostFocus事件),无边框和透明背景控制与文本显示。你知道任何一个或一个自定义的吗?



请不要建议我链接到 Alpha混合透明文本框(在CodeProject中,我已经尝试了它并不够好(渲染的文本看起来比缺少抗锯齿更糟)。除了带有过度使用的CreateParams的RichTextBox之外,我没有找到任何控制权。但我不想使用RichTextBox,它不重量轻,甚至使用它,我必须自定义一些与事件相关的方法...



我非常感谢您的帮助!

谢谢。

I''m looking for a focusable (can raise GotFocus and LostFocus event), borderless and transparent background control with text presentation. Do you know any already made one or a custom one?

Please don''t suggest me the link to Alpha blend transparent textbox (right in CodeProject), I''ve tried it and it''s not fine enough (the rendered text looks worse than lacking of antialiasing). I don''t find any control for that purpose except the RichTextBox with over ridden CreateParams. But I don''t want to use RichTextBox, it''s not light weight and even using it, I have to customize some event-related methods...

Your help would be highly appreciated!
Thanks.

推荐答案

突然间,我脑海里浮现出一种想法,帮助我解决这个问题。我不相信有这么简单的解决方案。



我想要的控件是一个非常常见的自定义控件。它被称为 UserControl 。我用添加到UserControl控件的标签测试它并将标签'Dock设置为DockStyle.Fill,将文本设置为我想要的任何东西,将UserControl的BackColor设置为Color.Transparent和wowww,有效。我想过自己画字符串,但想知道它是如何得到并失去焦点的? UserControl正是我想要的......



感谢上帝!
Suddenly there is a thought springing in my mind which helps me solve this. I can''t believe there is such a simple solution.

The control I want is a very common control for customization. It''s called UserControl. I tested it with a label added to a UserControl''s Controls and set the label''s Dock to DockStyle.Fill, set the text to any thing I want, set the UserControl''s BackColor to Color.Transparent and wowww, it worked. I thought of drawing string myself but wondered how it gets and loses focus? UserControl is exactly what I want...

Thank God!


当然。您可以获得完整的此类控件库。删除Windows窗体并使用WPF。您将获得所需的所有渲染选项。
Sure. You can get an entirely library of such controls. Drop Windows Forms and use WPF. You get all the rendering options you could ever want.


这篇关于Windows窗体中可聚焦,无边框,透明的背景控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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