您好,欢迎访问一九零五行业门户网

C#获取系统当前鼠标的图案示例代码

c#获取系统当前鼠标的图案代码如下: 
using system.runtime.interopservices; [structlayout(layoutkind.sequential)] struct cursorinfo { public int cbsize; public int flags; public intptr hcursor; public point ptscreenpos; } [dllimport("user32.dll")] static extern bool getcursorinfo(out cursorinfo pci); private const int cursor_showing= 0x00000001; private void button1_click(object sender, eventargs e) { cursorinfo vcurosrinfo; vcurosrinfo.cbsize = marshal.sizeof(typeof(cursorinfo)); getcursorinfo(out vcurosrinfo); if ((vcurosrinfo.flags & cursor_showing) != cursor_showing) return; cursor vcursor = new cursor(vcurosrinfo.hcursor); graphics vgraphics = graphics.fromhwnd(handle); rectangle vrectangle = new rectangle(0, 0, 32, 32); vgraphics.fillrectangle(new solidbrush(backcolor), vrectangle); vcursor.draw(vgraphics, vrectangle); }
以上就是c#获取系统当前鼠标的图案示例代码的详细内容。
其它类似信息

推荐信息