CodePanic! > C#.NET Tips > 今ここ
■マウスカーソルの形状を変更する(ユーザー定義)
マウスカーソル形状を
ユーザー定義のマウスカーソルファイル(.cur)
に変更する場合の例です。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// デフォルトのカーソルに戻す
this.Cursor = Cursors.Default;
}
private void Form1_Load(object sender, EventArgs e)
{
// ユーザー定義のカーソルに変更
this.Cursor = @"c:\temp\custom.cur";
}
}
}
Copyright © 2008.07 - shougo suzaki
|