Quantcast
Viewing all articles
Browse latest Browse all 12583

text box

hello i have a textbox ( the properties  visible=false;) and a picture box

here some of my codes :

  private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
   preX = e.X;
   preY = e.Y;

}

private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{

if (e.X > preX)
{
if (e.Y > preY)
{
txtw = e.X - preX;
txth = e.Y - preY;
textBox2.SetBounds(preX, preY, txtw, txth);    // txtw: textbox width ; txth: textbox height 
textBox2.Visible = true;

}
else
{
txtw = e.X - preX;
txth = preY - e.Y;
textBox2.SetBounds(preX, preY, txtw, txth);
textBox2.Visible = true;
}
}
else
{
if (e.Y > preY)
{
txtw = preX- e.X;
txth = e.Y - preY;
textBox2.SetBounds(preX, preY, txtw, txth);
textBox2.Visible = true;
}
else
{
txtw = preX - e.X;
txth = preY - e.Y;
textBox2.SetBounds(preX, preY, txtw, txth);
textBox2.Visible = true;

}
}

the problem is that the textbox is placed in a wrong position except the first case 

any idea why?? 


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>