文件名称:事件 的用法.pdf
文件大小:140KB
文件格式:PDF
更新时间:2022-09-10 09:59:54
事件
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WindowsFormsApplication7 { public class btnClass:System.Windows.Forms.Button { public btnClass() { base.Click += btnClass_Click; } int clickTimes = 1; public event DGTripleClick dgTriple; void btnClass_Click(object sender, EventArgs e) { if (clickTimes < 3) { clickTimes++; } else { if (dgTriple != null) { dgTriple(); } clickTimes = 1; } } } public delegate void DGTripleClick(); } public Form1() { InitializeComponent(); this.btnClass1.dgTriple += TripleClick; } public void TripleClick() { MessageBox.Show("3333"); }