By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,983 Members | 2,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,983 IT Pros & Developers. It's quick & easy.

Problem with SplitContainer control

P: 26
Hello,

I have developed one user control using SplitContainer.
It is simply like two textboxes connected to each other with splitter in between them.

Whenever I increase width of the control
1. By dragging it with right edge, I want the splitter and the left textbox to remain fixed and
2. By dragging it with left edge, I want the splitter and the right textbox to remain fixed.

We can set only one of the panels as FixedPanel.

Initially i set splitContainer.FixedPanel = FixedPanel.None;

then at runtime in event handlers for

1. panel1 : in splitContainer_Panel1_Resize
{
splitContainer.FixedPanel = FixedPanel.Panel2;
}
2. panel2 : splitContainer_Panel2_Resize
{
splitContainer.FixedPanel = FixedPanel.Panel1;
}

but whether I resize from right edge or left edge the event handler for Panel1 is always getting called first and then for second. And these both event handlers get called multiple times so this is not working.

How can this problem be solved?????

Regards
Abhishek
Feb 20 '09 #1
Share this Question
Share on Google+
5 Replies


vekipeki
Expert 100+
P: 229
How did you implement control resizing? Is it a Form, or a custom Control which can be resized in your parent Form?

I am asking because I don't understand which edge you are referring to when saying "dragging it with left/right edge" - Form's edge or Control's edge?
Feb 20 '09 #2

P: 26
Its user control, Like textbox i am resizing the control itself.
Feb 20 '09 #3

vekipeki
Expert 100+
P: 229
But you are talking about resizing while in designer mode, not in runtime?
Feb 20 '09 #4

P: 26
No. Resizing at runtime.

The user can drag and drop control on grid at runtime and then I am allowing user to resize the control at runtime, and above problem is coming at runtime.
Feb 20 '09 #5

vekipeki
Expert 100+
P: 229
That's why I asked about how you implemented control resizing. I believe you had to write some code of your own (handling some MouseDown/MouseMove events), or used some open-source solution. In that case you should have the information about the edge being dragged inside those handlers, which will help you decide which of the panels should remain static.

It's too late to set the FixedPanel property inside the Resize event handler, since it means that resizing has already been done for that control. So, you have to fix your panels when handing MouseDown.
Feb 20 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.