I made a windows form with many dropdown list which are placed inside a grid(not a datagrid) and when I use anchor=left right top bottom and dock=fill options in all of them, the form resize gets slow on runtime.
What's the problem with dock and anchor options?
Is it a general problem with forms? Is it a general disadvantage of using .net components and windows forms?
I don't have any custom events handled on control resize, so the problem is about the controls Microsoft developed. Should I avoid using dock=fill?
It's a normal that it consumes your processor as on every resize move form
forms resize table layout panel
which forces resize and reposition child controls (dropdowns), as there is anchor
property setuped.
There is a trick to avoid to create a frustration for user when resizing:
Use SuspendLayout()
and ResumeLayout()
on BeginResize()
and EndResize()
event handlers.
Look here for concrete example:
Prevent window redraw when resizing c# windows forms
Should work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With