SplitterDistance has changed in OnFormClosing

  • Thread starter Thread starter Andrus
  • Start date Start date
A

Andrus

I have .NET 3.5 WinForms application. This contains form with
horizontal SplitContainer.

I set SplitterDistance to 30 in OnLoad()
However its value is 41 on OnFormClosing().

I want to obtain original value (30) for restore.
Any idea why value is changing automatically and how to get real value ?

Andrus.

protected override void OnLoad(System.EventArgs e) {
base.OnLoad(e);
splitContainer1.SplitterDistance = 30;
// production code: splitContainer1.SplitterDistance =
// Settings.SplitterDistance;
}

protected override void OnFormClosing(FormClosingEventArgs e) {
// for unknown reason SplitterDistance in 41 here.
Settings.SplitterDistance = splitContainer1.SplitterDistance;
base.OnFormClosing(e);
}
 
Windows is a real mess concerning sizes of items in windows.

I had problems with a window with a menubar and 3 statusbars being
unable to determine the size of the window left not covered by
something.
 
Marra,
Windows is a real mess concerning sizes of items in windows.

I had problems with a window with a menubar and 3 statusbars being
unable to determine the size of the window left not covered by
something.

It is interesting that SplitterDistance increases not by certain number of
pixels but by some factor.

First increase is from 30 to 41, i.e 11 pixels.
Seceon increase is frm 41 to a larger number of pixels.

This increasing seems to stop when SplitterDistance reaches to the value
which is set in Form Designer.
Any idea how to fix this ?

Andrus.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top