Can I make a splitter stay centered using the Form designer

  • Thread starter Thread starter Teis Draiby
  • Start date Start date
T

Teis Draiby

In a window containing two controls divided by a splitter, I want this
splitter to stay centered when the window is resized.

Is there any trick to do this in the Windows Form Designer or do I have to
implement this programatically?


Regards, Teis
 
You need to implement this programmatically by calculating the position in
the OnSizeChanged override or SizeChanged event.

If the user is not supposed to touch it it's probably best not even to use a
splitter but just calculate the positions and sizes of the controls either
side of the centre.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Yes, I want the user to be able to move the splitter.
Why? Is there any disadvantages using splitters that I should know of?
Performance issues e.g..


You need to implement this programmatically by calculating the position in
the OnSizeChanged override or SizeChanged event.

If the user is not supposed to touch it it's probably best not even to use a
splitter but just calculate the positions and sizes of the controls either
side of the centre.


 
Why? Is there any disadvantages using splitters that I should know of?
Performance issues e.g..

No. I wondered why you wanted to have a splitter and automatically
reposition it to the center of the form. I figured one or the other but not
both.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Ah! Sorry,
what I need is to scale both controls equally. I just wanted to make the
question more eh... clear.

Thanks, Teis
 
Back
Top