国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

在.NET中實現彩色光標,動畫光標和自定義光標

2024-07-10 12:59:02
字體:
來源:轉載
供稿:網友
菜鳥學堂:
面是完整的例子,可以通過命令行編譯即可看到效果。

test.cs

using system;
using system.drawing;
using system.windows.forms;
using system.runtime.interopservices;
using system.reflection;

namespace colorcursor
{
/// <summary>
/// 本例子的作用:
/// 在.net中實現彩色光標,動畫光標和自定義光標。
/// </summary>
public class form1 : system.windows.forms.form
{
[dllimport("user32.dll")]
public static extern intptr loadcursorfromfile( string filename );

[dllimport("user32.dll")]
public static extern intptr setcursor( intptr cursorhandle );

[dllimport("user32.dll")]
public static extern uint destroycursor( intptr cursorhandle );


[stathread]
static void main()
{
application.run(new form1());
}

public form1()
{
this.text = "歡迎光臨【孟憲會之精彩世界】:http://dotnet.aspx.cc/";
cursor mycursor = new cursor(cursor.current.handle);
//dinosau2.ani為windows自帶的光標:
intptr colorcursorhandle = loadcursorfromfile(@"c:/winnt/cursors/dinosau2.ani" );
mycursor.gettype().invokemember("handle",bindingflags.public |
bindingflags.nonpublic | bindingflags.instance |
bindingflags.setfield,null,mycursor,
new object [] { colorcursorhandle } );
this.cursor = mycursor;
}
}
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新泰市| 康定县| 砚山县| 景洪市| 宜兰县| 灵武市| 东至县| 怀柔区| 共和县| 高阳县| 武定县| 布尔津县| 巨野县| 灌阳县| 巨鹿县| 白水县| 和田市| 行唐县| 横峰县| 海口市| 永嘉县| 烟台市| 杭州市| 黔西县| 连平县| 东乌珠穆沁旗| 绥中县| 白银市| 延吉市| 通道| 贵南县| 漠河县| 林州市| 怀化市| 吉木乃县| 通海县| 集安市| 洪湖市| 大兴区| 新巴尔虎右旗| 崇左市|