in My LocationChanged event, i’d like to change the width/Height when i get closer with the screen borders.
i’m currently using the following code:
private void Form1_LocationChanged(object sender, EventArgs e)
{
int BORDER_SIZE = 100;
Rectangle border = new Rectangle(
BORDER_SIZE,
BORDER_SIZE,
Screen.PrimaryScreen.Bounds.Width - BORDER_SIZE,
Screen.PrimaryScreen.Bounds.Height - BORDER_SIZE);
if(!border.Contains(Cursor.Position) )
{
this.Height = 400;
this.Width = 50;
radPanel1.Height = 400;
radPanel1.Width = 50;
this.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
radMenu1.Orientation = System.Windows.Forms.Orientation.Vertical;
}
When i drag my form to the border in question (keeping my click pressed) it is working, i see my height and width changing but when i release my mouse, the width and height go back to their default values.
I don’t understand why.
Moreover, the anchor does not work.
What am i missing please?
Thanks in advance
it drives me crazy
resolved using the link posted