Scaling two Windows Forms controls while keeping the same ratio
I have 2 controls in a resize-able panel (1 datagridview and 1 textbox) with some space betwen and I need them both to scale in all directions with the panel. Problem is, since they're vertically stacked they run into each other when the panel scales vertically. I think I need some way to scale vertically while keeping the开发者_如何转开发 same ratio of the total panel size (ie, if the panel is scaled 2x, each control is scaled 2x) instead of anchoring them to all sides. Using C# if that matters, but I'm hoping for a non-programmatic solution.
A TableLayoutPanel was designed to provide this kind of scaling support. You'll need three rows with the middle one Absolute and the top and bottom Percent. Dock fill the controls in the rows, the rest is automatic.
精彩评论