Home > Net >  Turn on the pop-up window cover textbox, automatically removed
Turn on the pop-up window cover textbox, automatically removed

Time:04-08

When the textbox enter incidents will automatically pop up a child form,
The following figure

Under normal circumstances, the child form is not cover the textbox,
If manual covering mobile child form textbox,
The following figure, the child form to cover the textbox,


For help, when manual covering mobile child form textbox, want the child window to automatically jump to the top left corner,
How to implement

CodePudding user response:

 private void _form2_LocationChanged (object sender, EventArgs e) 
{
Point p=this. TextBox1. PointToClient (_form2. PointToScreen (new Point (0, 0)));
Int x=p.X - 8;
Int y=p.Y - 28;
Bool b1=x & lt; This. The textBox1. Width & amp; & X & gt; - _form2. Width;
Bool b2=y & lt; This. The textBox1. Height & amp; & Y & gt; - _form2. Height;
If (b1 & amp; & B2)
{
_form2. Location=new Point (0, 0);
}
}

CodePudding user response:

Do you want to write a drop-down control, we also have written, but not in form, direct Contrls. Add (userContrl) and then adjust the position of the userContrl
  •  Tags:  
  • C#
  • Related