Force form resize to diagonaly only

I have a c# windows form project. I want the form to maintain the aspect ratio if the user grabs the resize grip in bottom corner. In other words for the form to resize diagonally only. Does anyone have a sample code or class to perform this?

I am using Visual Studio 2017 pro with a c# .NET 4.6.2 winform project.
LVL 1
Don VonderBurgPresident/CEOAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aranaCommented:
so what if the user grabs form from one side? would this allow user to resize freely horizontally?, is that what you want?
0
Don VonderBurgPresident/CEOAuthor Commented:
I would like to prevent a side grab if possible too. But I was taking it one step at a time.
0
aranaCommented:
I suggest you override WndProc

newwidth= (ratio width * Form height) / ratio height
newheight=(ratio height * Form width) / ratio width

Here is an example with code where this technique is used, this one uses WndProc because resizing using windows forms events makes it flicker a lot, (it is a post event)) but with WndProc all calculations and redraws are done before the actual resize happens.
Resize and Keep AR
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Don VonderBurgPresident/CEOAuthor Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.