Winforms 应用程序中的填充橡皮筋
如何在不透明度为 0.3 的 Windows 窗体上绘制零不透明度橡皮筋? (橡皮筋是在 Microsoft 示例之后制作的
更新:
我需要橡皮筋来像遮罩一样工作,如果你使用 Jing 或任何其他屏幕截图工具,当你尝试制作屏幕截图时,你会确切地看到我需要做什么:屏幕会消失。半透明,当您进行选择时,您将看到不透明度为 0 的选择
how can i draw a zero opacity rubber band over a windows form with 0.3 opacity?
(The rubber band is made after a Microsoft example
Update:
I need that rubber band to work something like a mask. If you use Jing or any other screen shot tool, you will see EXACTLY what I need to do when do you try to make a screenshot: the screen goes semi-opaque and when you make the selection, you will see the 0 opacity selection
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只需使用附加表单,而不将其显示在任务栏中或其他表单选项中。设置表单的区域,使其仅显示橡皮筋。并确保两个窗口的行为就像一个窗口一样(移动、关闭……)。我知道这不是一种优雅的方式,但只需做一点工作就可以产生良好的结果。您可以确保表单位于表单层次结构的顶部并且仍然没有获得焦点。
通过设置好区域,所有事件都将转为另一种形式。
这就是我解决等效问题的方法(我并不是说这是一个很好的解决方案,但它确实有效)
Just use an additional form, without showing it in the taskbar, or other Form-options. Set the region of the form that it only shows the rubber band. And make sure both windows behave as if it was one window (moving, closing,...). I know it's not an elegant way, but with a little work it can produce good results. You can make sure that the form is on top in the form-hierarchy and still doen't receive focus.
By setting the region good, all events will go to the other form.
That's the way I worked out an equivalent problem (I don't say it's a good solution, but it works)
这是您要找的机器人吗?
Is this the droid you were looking for?
绘图时需要使用部分不透明的颜色:
在
MyDrawReversibleRectangle
方法中从链接文章更新了行:You need to use a partially opaque color when drawing:
Updated line from linked article, in the
MyDrawReversibleRectangle
method:我使用了 @Dearmash 在我的开源应用程序 BugTracker.NET 附带的屏幕捕获实用程序中提供的代码。该应用程序不是很大,因此如果您正在执行屏幕捕获操作,这可能是一个很好的起点。更多信息请参见:
http://ifdefine.com/博客/帖子/Screen-capture-utility-in-C-NET.aspx
I used the code that @Dearmash supplied in the screen capture utility that comes with my open source app BugTracker.NET. The app isn't very big, so if you are doing screen capture stuff, it might be a good starting point. More info here:
http://ifdefined.com/blog/post/Screen-capture-utility-in-C-NET.aspx