Bing In

Bing In

  • NA
  • 30
  • 9k

windows form solution

Oct 1 2016 3:20 AM
output number of click 
edit the code below 
 
 

 
using System;
using System.Windows.Forms;
class MainApp : System.Windows.Forms.Button Mybtn;
{
public MainApp()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.MyBtn = new System.Windows.Forms.Button();
this.MyBtn.Location = new System.Drawing.Point(20, 20);
this.MyBtn.Size = new System.Drawing.Size(100, 50);
this.MyBtn.Test = "button";
this.MyBtn.Click += new System.EventHandler(this.MyBtn_Click);
this.Controls.Add(this.MyBtn);
}
public static void Main()
{
Application.Run(new MainApp());
}
private void Form_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form_MouseDown);
 
Console.WriteLine("number of click : {0}", e.Button);
Console.WriteLine();
}
}
}

Attachment: ControlTest1.zip

Answers (3)