在C#中调用DrawRectangle方法时如何使用XOR模式
正如标题所说,我想用XOR模式画一些东西,因为我想在一段时间后清理它。
我正在使用 C#(窗口窗体)和 Visual Studio 2010。
有人可以帮助我吗?
As the title says, I want to paint something with XOR mode because I want to clean it after a period of time.
I'm using C# (Window Form) with Visual Studio 2010.
Can anybody help me with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我为 .net 做了一个很好的扩展:
Usage
Or
I made a nice extension for .net:
Usage
Or
您可以使用 Windows API 函数。我将导入包装在静态类
Win32
中。使用这些定义,您可以像这样进行绘制。
请注意,.NET 通过 Graphics 对象提供的标准绘图函数在反转模式下不起作用。您必须使用 API 的函数,此处以
MoveToEx
和LineTo
为例。我从我的代码项目文章 Drag-and-Drop ListBox。
You can use Windows API functions. I wrapped the imports in the static class
Win32
.Using these definitions you can draw like this
Note that the standard drawing functions provided by .NET through the
Graphics
object do not work in inverted mode. You must use the functions of the API, shown here withMoveToEx
andLineTo
as an example.I extracted these examples from my Code Project article Drag-and-Drop ListBox.
您应该更具体地说明您正在使用的内容,但我假设使用 GDI+ 和 Windows 窗体。
You should be more specific about what you are using, but I am assuming GDI+ and Windows Forms.