I have a splitContainer. I want to resize the form inside the splitContaner's panel to scale with when I move the splitter as below. But my form doesn't get redrawn. Any suggestion, thank so much!
private void splitContainer1_SplitterMoved(System.Object sender, System.Windows.Forms.SplitterEventArgs e)
{
// Define what happens when the splitter is no longer moving.
Cursor.Current = System.Windows.Forms.Cursors.Default;
statictisTableDisplayForm1.ClientSize = new Size(statictisTableDisplayForm1.Width, splitContainer1.SplitterDistance);
statictisTableDisplayForm1.Invalidate();
statictisTableDisplayForm1.Refresh();
Refresh();
}
Anchor
, Dock
.So better create a UserControl which will contain controls and logic of your StatictisTableDisplayForm
and place it to SplitContainer panel with Dock
set to Fill
. That will automatically resize user control when you move the splitter.
Note: if you have to use StatictisTableDisplayForm
on it's own too, then just place same user control to this form.