欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#實(shí)現(xiàn)鼠標(biāo)左右鍵切換效果

 更新時(shí)間:2022年12月21日 10:02:55   作者:芝麻粒兒  
這篇文章主要為大家詳細(xì)介紹了如何利用C#實(shí)現(xiàn)鼠標(biāo)左右鍵切換功能,文中的示例代碼講解詳細(xì),對(duì)我們學(xué)習(xí)C#有一定的幫助,感興趣的小伙伴可以跟隨小編一起了解一下

實(shí)踐過(guò)程

效果

代碼

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SwapMouseButton")]
    public extern static int SwapMouseButton(int bSwap);

    private void button1_Click(object sender, EventArgs e)
    {
        SwapMouseButton(1);
    }

    private void button2_Click(object sender, EventArgs e)
    {
        SwapMouseButton(0);
    }
}
partial class Form1
{
    /// <summary>
    /// 必需的設(shè)計(jì)器變量。
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// 清理所有正在使用的資源。
    /// </summary>
    /// <param name="disposing">如果應(yīng)釋放托管資源,為 true;否則為 false。</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows 窗體設(shè)計(jì)器生成的代碼

    /// <summary>
    /// 設(shè)計(jì)器支持所需的方法 - 不要
    /// 使用代碼編輯器修改此方法的內(nèi)容。
    /// </summary>
    private void InitializeComponent()
    {
        this.button1 = new System.Windows.Forms.Button();
        this.button2 = new System.Windows.Forms.Button();
        this.SuspendLayout();
        // 
        // button1
        // 
        this.button1.Location = new System.Drawing.Point(34, 52);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(75, 23);
        this.button1.TabIndex = 0;
        this.button1.Text = "左鍵";
        this.button1.UseVisualStyleBackColor = true;
        this.button1.Click += new System.EventHandler(this.button1_Click);
        // 
        // button2
        // 
        this.button2.Location = new System.Drawing.Point(136, 52);
        this.button2.Name = "button2";
        this.button2.Size = new System.Drawing.Size(75, 23);
        this.button2.TabIndex = 1;
        this.button2.Text = "右鍵";
        this.button2.UseVisualStyleBackColor = true;
        this.button2.Click += new System.EventHandler(this.button2_Click);
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(247, 100);
        this.Controls.Add(this.button2);
        this.Controls.Add(this.button1);
        this.Name = "Form1";
        this.Text = "左右鍵的切換";
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Button button2;
}

到此這篇關(guān)于C#實(shí)現(xiàn)鼠標(biāo)左右鍵切換效果的文章就介紹到這了,更多相關(guān)C#鼠標(biāo)左右鍵切換內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • C#列表List<T>、HashSet和只讀集合介紹

    C#列表List<T>、HashSet和只讀集合介紹

    這篇文章介紹了C#中的列表List<T>、HashSet和只讀集合,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-05-05
  • c# Async streams的使用解析

    c# Async streams的使用解析

    這篇文章主要介紹了c# Async streams的使用解析,幫助大家更好的理解和學(xué)習(xí)使用c#,感興趣的朋友可以了解下
    2021-04-04
  • C# Winform實(shí)現(xiàn)石頭剪刀布游戲

    C# Winform實(shí)現(xiàn)石頭剪刀布游戲

    這篇文章主要為大家詳細(xì)介紹了Winform實(shí)現(xiàn)石頭剪刀布游戲,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-01-01
  • C#中重載相等(==)運(yùn)算符示例

    C#中重載相等(==)運(yùn)算符示例

    這篇文章主要介紹了C#中重載相等(==)運(yùn)算符示例,運(yùn)算符重載一直是一個(gè)很詭異事情,本文通過(guò)實(shí)例探討由運(yùn)算符重載引出的一個(gè)問(wèn)題,需要的朋友可以參考下
    2015-06-06
  • C#多線程基礎(chǔ)知識(shí)匯總

    C#多線程基礎(chǔ)知識(shí)匯總

    這篇文章主要介紹了C#多線程基礎(chǔ)知識(shí)的相關(guān)資料,文中示例代碼非常詳細(xì),幫助大家更好的理解和學(xué)習(xí),感興趣的朋友可以了解下
    2020-07-07
  • 利用C#實(shí)現(xiàn)獲取當(dāng)前設(shè)備硬件信息

    利用C#實(shí)現(xiàn)獲取當(dāng)前設(shè)備硬件信息

    這篇文章主要為大家詳細(xì)介紹了如何利用C#實(shí)現(xiàn)獲取當(dāng)前設(shè)備硬件信息的功能,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起了解一下
    2023-03-03
  • C#實(shí)現(xiàn)圖片切割的方法

    C#實(shí)現(xiàn)圖片切割的方法

    這篇文章主要介紹了C#實(shí)現(xiàn)圖片切割的方法,涉及C#使用Graphics實(shí)現(xiàn)圖片屬性的相關(guān)設(shè)置、保存等操作技巧,需要的朋友可以參考下
    2017-06-06
  • C#基礎(chǔ):Dispose()、Close()、Finalize()的區(qū)別詳解

    C#基礎(chǔ):Dispose()、Close()、Finalize()的區(qū)別詳解

    本篇文章是對(duì)c#中的Dispose()、Close()、Finalize()的區(qū)別進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
    2013-05-05
  • C#實(shí)現(xiàn)自定義打印文字和圖片的示例代碼

    C#實(shí)現(xiàn)自定義打印文字和圖片的示例代碼

    本文主要介紹了C#實(shí)現(xiàn)自定義打印文字和圖片的示例代碼,C#中打印其實(shí)就是自己繪圖+調(diào)用系統(tǒng)打印函數(shù),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-04-04
  • FtpHelper實(shí)現(xiàn)ftp服務(wù)器文件讀寫(xiě)操作(C#)

    FtpHelper實(shí)現(xiàn)ftp服務(wù)器文件讀寫(xiě)操作(C#)

    這篇文章主要為大家詳細(xì)介紹了FtpHelper實(shí)現(xiàn)ftp服務(wù)器文件讀寫(xiě)操作,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-03-03

最新評(píng)論