Problem with SplitContainer control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kulabhishek
    New Member
    • Dec 2008
    • 26

    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.Pane l2;
    }
    2. panel2 : splitContainer_Panel2_Resize
    {
    splitContainer. FixedPanel = FixedPanel.Pane l1;
    }

    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
  • vekipeki
    Recognized Expert New Member
    • Nov 2007
    • 229

    #2
    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?

    Comment

    • kulabhishek
      New Member
      • Dec 2008
      • 26

      #3
      Its user control, Like textbox i am resizing the control itself.

      Comment

      • vekipeki
        Recognized Expert New Member
        • Nov 2007
        • 229

        #4
        But you are talking about resizing while in designer mode, not in runtime?

        Comment

        • kulabhishek
          New Member
          • Dec 2008
          • 26

          #5
          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.

          Comment

          • vekipeki
            Recognized Expert New Member
            • Nov 2007
            • 229

            #6
            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.

            Comment

            Working...