I have a windows form which I am using as a desktop application.
Now I want that the form should not go outside desktop borders when I drag it.
I know that the whole window doesnt disappear but I want to display all four corners.
I have set the “border style = Fixed Tool window”,and coded to move form programmatically.
So instead of this:
---------------------- ! ! ! --------------- ! ! ! ! ! ! ! --------------- ! ! ----------------------
I want this:
------------------------ ! ! ! -------------! ! ! !! ! ! !! ! -------------! ! ! ------------------------
You can use the
LocationChangedevent and compare it toScreen.AllScreens[0].Boundsthis is the primary monitor, if you have multiple monitors you could change then index to select which screen you limit your form to.