czy można to jakoś inaczej napisać? jak mogę się odwołać do formy?
int s_width = Screen.PrimaryScreen.Bounds.Width;
int s_height = Screen.PrimaryScreen.Bounds.Height;
int x_cu = Cursor.Position.X;
int y_cu = Cursor.Position.Y;
int x_lo = this.Location.X;
int y_lo = this.Location.Y;
int y_height = this.Size.Height;
int x_width = this.Size.Width;
s_height = s_height / 2;
s_width = s_width / 2;
if (x_cu < x_lo || y_cu < y_lo || x_cu > x_lo + x_width || y_cu > y_lo + y_height)
{
Cursor.Position = new Point(s_width, s_height);
}
albo
Form2 form2 = new Form2();
int x_lo = form2.Location.X;
int y_lo = form2.Location.Y;
int y_height = form2.Size.Height;
int x_width = form2.Size.Width;
ale to nie działa jak powinno