formのCursorプロパティに変更したいカーソルをセットします。
namespace MouseCursor;
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
var cs = new List<Cursor>
{
Cursors.AppStarting,
Cursors.Arrow,
Cursors.Cross,
Cursors.Default,
Cursors.Hand,
Cursors.Help,
Cursors.HSplit,
Cursors.IBeam,
Cursors.No,
Cursors.NoMove2D,
Cursors.NoMoveHoriz,
Cursors.NoMoveVert,
Cursors.PanEast,
Cursors.PanNE,
Cursors.PanNorth,
Cursors.PanNW,
Cursors.PanSE,
Cursors.PanSouth,
Cursors.PanSW,
Cursors.PanWest,
Cursors.SizeAll,
Cursors.SizeNESW,
Cursors.SizeNS,
Cursors.SizeNWSE,
Cursors.SizeWE,
Cursors.UpArrow,
Cursors.VSplit,
Cursors.WaitCursor,
};
int i = 0;
MouseDown += (s, e) =>
{
Cursor = cs[i];
Text = String.Format("{0}", cs[i]);
i++;
if (i >= cs.Count) i = 0;
};
}
}
コメント