i want to create a textbox for single click and a label for double click on a picture box in windows form dynamically .
but when i give a double click it creates 2 text boxes for me but not a label. so please help me...!!
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
sai kiran reddyPosted Sep 3, 2015, 7:32 AM
Rahul PrajapatPosted Aug 30, 2015, 8:54 PM
It helps to other.
sai kiran reddyPosted Aug 30, 2015, 11:56 AM
Rahul PrajapatPosted Aug 27, 2015, 9:27 PM
{
InitializeComponent();
Timer1.Interval = 300;
}
int a = 100;
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
Timer1.Start();
}
private void pictureBox1_MouseDoubleClick(object sender, MouseEventArgs e)
{
Timer1.Stop();
Label lbl = new Label();
lbl.Location = new Point(0 + a, 200);
lbl.Text = "Double Click";
this.Controls.Add(lbl);
a += 100;
}
private void create_TextBox()
{
TextBox tb = new TextBox();
tb.Location = new Point(0 + a, 300);
tb.Text = "Single Click";
this.Controls.Add(tb);
a += 100;
Timer1.Stop();
}
private void timer1_Tick(object sender, EventArgs e)
{
create_TextBox();
}