Splitter Container Resize

J

Jeffrey Walton

Hi All,

I have a horizontal Splitter, for which I would like the top panel to
remain 20 pixels in height. I do this because I have a containter on
it, and I overide the OnPaint method. It is being painted as a band
similar to that of Disk Defragmentor.

Any ideas on how to disable a Splitter panel from being resized? I've
locked the controls (it stops me from resizing it at design time);
I've set SplitterFixedPanel = Panel1 [1,5]; and I've set
SplitterDistance to the same as design time [2]. Overriding Moving
events causes a runtime error when I try to force the control's height
back to the desired height through the Height property [3, 4]. From
[5,6]: "Use the Panel1 [or Panel2] property to configure the left
panel of a vertical SplitContainer or the top panel of a horizontal
SplitContainer. For example, you can specify the minimum size of the
panel by changing the value of the Panel1MinSize property, set the
FixedPanel property to Panel1 so that the panel remains the same size
when the container is resized, or you can get or set the panel's
BackgroundImage and BackgroundImageLayout properties."

Nothing stops this damn thing from moving. Any help would be
appreciated.

Thanks,
Jeff
[1] http://msdn2.microsoft.com/en-us/library/system.windows.forms.splitcontainer.fixedpanel(vs.80).aspx
[2] http://msdn2.microsoft.com/en-us/li...s.splitcontainer.splitterdistance(VS.80).aspx
[3] http://msdn2.microsoft.com/en-us/li...rms.splitcontainer.splittermoving(VS.80).aspx
[4] http://msdn2.microsoft.com/en-us/li...orms.splitcontainer.splittermoved(VS.80).aspx
[5] http://msdn2.microsoft.com/en-us/library/system.windows.forms.splitcontainer.panel1(VS.80).aspx
[6] http://msdn2.microsoft.com/en-us/library/system.windows.forms.splitcontainer.panel2(VS.80).aspx
 
G

Guest

You should look at SplitContainer which offers Panel1MinSize and
Panel2MinSize. This would do what you are looking for, in my opinion.
 
J

Jeffrey Walton

Hi Mike,

Thanks. I tried that also. I suppose this is another bug. I'm amazed
that so many of these exist. How did the Framework (2.0) get through
QA??? I've had problems with ListView/SelectedNode after ExpandAll,
setting the application icon, this issue, and three more - and this is
one project. It never ends. I guess this is why when visiting MSDN's
pages, their sample code receives a single star rating.

Jeff

You should look at SplitContainer which offers Panel1MinSize and
Panel2MinSize. This would do what you are looking for, in my opinion.



Jeffrey Walton said:
I have a horizontal Splitter, for which I would like the top panel to
remain 20 pixels in height. I do this because I have a containter on
it, and I overide the OnPaint method. It is being painted as a band
similar to that of Disk Defragmentor.
Any ideas on how to disable a Splitter panel from being resized? I've
locked the controls (it stops me from resizing it at design time);
I've set SplitterFixedPanel = Panel1 [1,5]; and I've set
SplitterDistance to the same as design time [2]. Overriding Moving
events causes a runtime error when I try to force the control's height
back to the desired height through the Height property [3, 4]. From
[5,6]: "Use the Panel1 [or Panel2] property to configure the left
panel of a vertical SplitContainer or the top panel of a horizontal
SplitContainer. For example, you can specify the minimum size of the
panel by changing the value of the Panel1MinSize property, set the
FixedPanel property to Panel1 so that the panel remains the same size
when the container is resized, or you can get or set the panel's
BackgroundImage and BackgroundImageLayout properties."
Nothing stops this damn thing from moving. Any help would be
appreciated.

- Show quoted text -
 
G

Guest

I'm sorry you are having trouble with this. I just tried it here, where all
I have is VS 2008 express. It works as advertised for me in this environment.

Jeffrey Walton said:
Hi Mike,

Thanks. I tried that also. I suppose this is another bug. I'm amazed
that so many of these exist. How did the Framework (2.0) get through
QA??? I've had problems with ListView/SelectedNode after ExpandAll,
setting the application icon, this issue, and three more - and this is
one project. It never ends. I guess this is why when visiting MSDN's
pages, their sample code receives a single star rating.

Jeff

You should look at SplitContainer which offers Panel1MinSize and
Panel2MinSize. This would do what you are looking for, in my opinion.



Jeffrey Walton said:
I have a horizontal Splitter, for which I would like the top panel to
remain 20 pixels in height. I do this because I have a containter on
it, and I overide the OnPaint method. It is being painted as a band
similar to that of Disk Defragmentor.
Any ideas on how to disable a Splitter panel from being resized? I've
locked the controls (it stops me from resizing it at design time);
I've set SplitterFixedPanel = Panel1 [1,5]; and I've set
SplitterDistance to the same as design time [2]. Overriding Moving
events causes a runtime error when I try to force the control's height
back to the desired height through the Height property [3, 4]. From
[5,6]: "Use the Panel1 [or Panel2] property to configure the left
panel of a vertical SplitContainer or the top panel of a horizontal
SplitContainer. For example, you can specify the minimum size of the
panel by changing the value of the Panel1MinSize property, set the
FixedPanel property to Panel1 so that the panel remains the same size
when the container is resized, or you can get or set the panel's
BackgroundImage and BackgroundImageLayout properties."
Nothing stops this damn thing from moving. Any help would be
appreciated.

- Show quoted text -
 

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