469,325 Members | 1,365 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,325 developers. It's quick & easy.

Problem with SplitContainer control

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
5 4518
vekipeki
229 Expert 100+
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
Its user control, Like textbox i am resizing the control itself.
Feb 20 '09 #3
vekipeki
229 Expert 100+
But you are talking about resizing while in designer mode, not in runtime?
Feb 20 '09 #4
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
229 Expert 100+
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.

Similar topics

1 post views Thread by Tom Bianchi | last post: by
7 posts views Thread by newscorrespondent | last post: by
reply views Thread by Ronald S. Cook | last post: by
2 posts views Thread by Doc John | last post: by
10 posts views Thread by Rotsey | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.