Can I make a splitter stay centered using the Form designer

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
 
B

Bob Powell [MVP]

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.
 
T

Teis Draiby

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.


 
B

Bob Powell [MVP]

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.
 
T

Teis Draiby

Ah! Sorry,
what I need is to scale both controls equally. I just wanted to make the
question more eh... clear.

Thanks, Teis
 

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

Top