SoFunction
Updated on 2025-03-07

C# Implement automatic hidden form dragging to the edge of the screen


private void hide_Load(object sender, EventArgs e)
{
StopRectTimer = new ();
+= new EventHandler(timer1_Tick);
= 100;
= true;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (())
{
switch ()
{
case :
= new Point(, 0);
break;
case :
= new Point(0, );
break;
case :
= new Point( - , );
break;
}
}
else
{
switch ()
{
case :
= new Point(, ( - 2) * (-1));
break;
case :
= new Point((-1) * ( - 2), );
break;
case :
= new Point( - 2, );
break;
}
}
}
internal AnchorStyles StopAanhor = ;
private void mStopAnhor()
{
if ( <= 0)
{
StopAanhor = ;
}
else if ( <= 0)
{
StopAanhor = ;
}
else if ( >= - )
{
StopAanhor = ;
}
else
{
StopAanhor = ;
}
}
private void hide_LocationChanged(object sender, EventArgs e)
{
();
}