1. Use the MouseMove event in an untitled form to determine if the mouse coordinates reach the edge of the form, and if so, change the mouse pointer to a two-headed arrow that resizes the form.
private void Form1_mousemove (object sender, System.Windows.Forms.MouseEventArgs e)
{
if (0 = = e.x)
{
This. Cursor = Cursors.sizewe;
}
Change it to this, it's strange (can't be written: E. X >= this. Width)
else if (e.x >= this. WIDTH-2)
{
This. Cursor = Cursors.sizewe;
}
Else
{
This. Cursor = Cursors.Default;
}
}
2. However, the cursor class provided by C#.net can only do transformations between the cursor shapes provided by Windows, and the cursor class does not seem to support animations and multi-color files. I want to use my own bitmap file as the cursor, how should I do?Scenario: Use a mouse file to define your own mouse pointer. cursor.current=new Cursor (@ "C:\my.cur");or:cursor cur=new Cursor (@ "C:\my.cur");This . Cursor = Cur;by Adding the above code to the form's constructor, you can change the mouse pointer shape.
My.cur is a mouse bitmap file, the mouse picture directly as a file into the project, in the project to select the added files after the properties, modify the generated attribute value for embedded resources, so you can compile into the EXE to take.
Change the mouse pointer shape using C #