Search code examples
c#winformsvisual-studiowinapiuisplitviewcontroller

Fix a Split Container Control in Windows Forms


I am using Visual Studio to coding Windows Forms applications. There is a control named Split Container in the toolbox.

This Control provides two connected panels which are separated where their edges touch. The user can resize these two panels by dragging the separator between them.

enter image description here

What I want is to fix the separator so that the user can't drag it anymore. I want to do that in runtime so that the separator can be fixed and variable again. I didn't saw a property for fixing the separator.

How can I fix the separator of a Split Container?


Solution

  • Use the property

    MySplitContainer.IsSplitterFixed = true;
    

    When you want to en/disable functions of Controls, take a look at the "IsSomething = true/false;" methods of the control - you will find things like IsReadyOnly.. etc.