c# - 按钮单击事件c#中的旋转光标

c# - 按钮单击事件c#中的旋转光标,第1张

我想在button1_click上不断开始光标旋转并在button2_click上停止旋转

我的光标是: c# - 按钮单击事件c#中的旋转光标,enter image description here,第2张

我的输出是: c# - 按钮单击事件c#中的旋转光标,enter image description here,第3张

我想在单击开始按钮时旋转这一个光标,并在停止按钮单击事件

上停止旋转

这是我的代码:但我已经采取静态4光标来漫游,这是不正确的.. 这仍然是我的代码:

 public Form1()
    {
        InitializeComponent();
        //this.Cursor = new Cursor(Application.StartupPath   "\1.cur");            
    }
    [System.Runtime.InteropServices.DllImport("user32.dll")]
    public static extern IntPtr LoadCursorFromFile(string fileName);
    Cursor myCursor;
    int a;
    private void button1_Click(object sender, EventArgs e)
    {
        IntPtr handle1 = LoadCursorFromFile("E:/Cursor_Rotate/WindowsFormsApplication5/WindowsFormsApplication5/1.cur");
        IntPtr handle2 = LoadCursorFromFile("E:/Cursor_Rotate/WindowsFormsApplication5/WindowsFormsApplication5/2.cur");
        IntPtr handle3 = LoadCursorFromFile("E:/Cursor_Rotate/WindowsFormsApplication5/WindowsFormsApplication5/3.cur");
        IntPtr handle4 = LoadCursorFromFile("E:/Cursor_Rotate/WindowsFormsApplication5/WindowsFormsApplication5/4.cur");
        myCursor = new Cursor(handle1);
        this.Cursor = myCursor;
        a = 1;
        Thread.Sleep(500);
        myCursor = new Cursor(handle2);
        this.Cursor = myCursor;
        a = 2;
        Thread.Sleep(500);
        myCursor = new Cursor(handle3);
        this.Cursor = myCursor;
        a = 3;
        Thread.Sleep(500);
        myCursor = new Cursor(handle4);
        this.Cursor = myCursor;
        a = 4;
    }

    private void button2_Click(object sender, EventArgs e)
    {

    }

最佳答案:

0 个答案:

没有答案
本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复