C# 模拟带屏幕设备并将其调暗的最佳方法
我已经在这个问题上摸索了几个月了,但我仍然不确定我能做些什么来实现想要的目标。
我需要构建一个真实的设备,即存在于现实世界中并且上面有屏幕的设备。到目前为止,我已经通过几种不同的方式完成了它,例如使用面板来模拟布局等。现在我正在使用代码构建每个控件。
问题是,有没有更好的方法来绘制这个屏幕? 如何使其变暗、变暗或变清晰? 处理完面板后,我总是在面板后面看到透明的背景。有什么办法可以消除这种重影效应吗?
提前致谢!
I've been messing around with this for a couple of months and I'm still not certain of what I can do to accomplish want a want.
I need to build a real device, that is, that exists in the real world and has a screen on it. So far, I have done it in a few different ways, like, using panels to simulate lays, etc. Now I'm currently building each control using code.
The thing is, is there any better way to draw this screen?
How can I dim it, make it darker or clearer?
I keep getting a transparent background behind the panels after I dispose them. Is there any way to remove this ghosting effect?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
基本上,您想要一个位于表单顶部的覆盖层。
开源项目 ObjectListView 实现了类似的覆盖。我破解了一点,它起作用了。
您可以在以下位置下载解决方案:
https://github.com/hamxiaoz/Misc/tree/master/DimScreen
构建解决方案并拖动轨迹栏,您可以看到表单变暗。您可以点击覆盖层。我想这就是你想要的。
Basically you want a overlay that's on top of your form.
The open source project ObjectListView implements a similar overlay. I hacked a little bit and it works.
You can download the solution at:
https://github.com/hamxiaoz/Misc/tree/master/DimScreen
Build the solution and drag the trackbar you can see the form is dimmed. And you can click through the overlay. I think that's what you want.
侵入性最小的方法可能是黑色或灰色的半透明覆盖层。只需根据需要不断调整透明度,直到它看起来像您想要的那样。
我不知道这是否有效,但它至少应该说明该技术:
The least invasive way would probably be a black or grey semi-transparent overlay. Just keep adjusting the transparency as needed until it looks the way you want it to.
I don't know if this works or not, but it should at least illustrate the technique:
我添加了一些东西以使其更加高效。这是我的代码。
I've added something to make it more productive. Here is my code.