玻璃窗和文本框 [英] glass windows and textboxes

查看:90
本文介绍了玻璃窗和文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用的是visual basic .net。 Visual Studio 2005.框架版本:2.0 Service Pack 2



我想把文本框放到玻璃上。但是,当我这样做时,文本框文本也会变为玻璃效果。我在网上和我看的每个地方都搜索过,人们说改变Forms TransparencyKey。我试过这个,它对我不起作用。有关如何使其正常工作的任何建议? (如果只有一种方法可以在vb.net中使用Delphi文本框。我已经搞乱了Delphi IDE,并且表单设计器允许你设置玻璃,你可以在文本框中放置一个文本框,它会呈现正确的方法)

Hi,
I am using visual basic .net. Visual studio 2005. Framework Version: 2.0 service pack 2

I want to put a textbox onto glass. However, when I do, the textbox text also goes to glass effect. I have searched online and everywhere I look, people says to change the Forms TransparencyKey. I tried this, it doesnt work for me. Any suggestions on how to get this to work right? (If only there were a way to use the Delphi Textbox in vb.net. I''ve messed around with the Delphi IDE and the form designer allows you to set glass and you can put a textbox in the glass, and it renders the right way)

推荐答案

据我所知,为了使其正常工作,控件不能基于窗口句柄(HWND)。



因此,我可以看到3个解决方案:



  • 使用WPF而不是WinForms
  • 隐藏文本框并仅在使用不透明背景进行编辑时显示。我认为这是Windows资源管理器采用的方法
  • 实现自己的文本框,而不是基于句柄
As far as I know, to make it works properly, the control must not be based on a window handle (HWND).

Thus, I can see 3 solutions:

  • Uses WPF instead of WinForms
  • Hide the text box and display it only when editing with an opaque background. I would think that this is the approch taken by Windows Explorer
  • Implement your own text box which is not based on an handle


并没有完全解决这个问题,但是经过对互联网的充分挖掘,我找到了解决玻璃上文本框渲染的方法。它适用于Windows 7.不确定vista。这里是我找到解决方案的链接解决方案。它在c#中,但很容易移植到vb.net。还有一个下载示例项目的链接。
Didnt exactly solve it on my own, however after enough digging around on the internet, i found a solution to the textbox rendering on glass. it works on windows 7. not sure about vista. here is the link where i found the solution Solution . it is in c#, but easily ported to vb.net. there is also a link to download a sample project.


这篇关于玻璃窗和文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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