Example #1
0
        public DualSplitContainer()
        {
            _leftSplitter  = new VerticalSplitter(0, this.Width / 2);
            _rightSplitter = new VerticalSplitter(this.Width / 2, this.Width);

            _mainpanel  = new TransparentPanel();
            _leftPanel  = new TransparentPanel();
            _rightPanel = new TransparentPanel();

            _leftSplitter.BackColor  = Color.Cyan;
            _rightSplitter.BackColor = Color.Blue;
            _mainpanel.BackColor     = Color.Red;
            _leftPanel.BackColor     = Color.Green;
            _rightPanel.BackColor    = Color.Pink;

            this.Controls.AddRange(new Control[] {
                _mainpanel,
                _leftPanel,
                _rightPanel,
                _leftSplitter,
                _rightSplitter
            });

            _leftPanel.Anchor  = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom);
            _rightPanel.Anchor = (AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom);
            _mainpanel.Anchor  = (AnchorStyles.Top | AnchorStyles.Bottom);

            //_rightSplitter.LocationChanged += RSplitterlocationChanged;
            //_leftSplitter.LocationChanged += LSplitterlocationChanged;
            _rightSplitter.SplitValueChanged += RSplitterlocationChanged;
            _leftSplitter.SplitValueChanged  += LSplitterlocationChanged;

            Locked = false;
        }
Example #2
0
        private void SplitterLocationChanged(VerticalSplitter movingSplitter, VerticalSplitter coupledSplitter, EventHandler coupledSplitterHandler)
        {
            coupledSplitter.SplitValueChanged -= coupledSplitterHandler;
            syncSplitters(movingSplitter, coupledSplitter);
            coupledSplitter.SplitValueChanged += coupledSplitterHandler;
            DrawPanels();

            _ratioLS = Convert.ToDouble(_leftSplitter.Position) / (_leftSplitter.MaximumPosition - _leftSplitter.MinimumPosition);
        }
Example #3
0
        private void syncSplitters(VerticalSplitter movedSplitter, VerticalSplitter splitterToSync)
        {
            var newX = movedSplitter.Location.X;

            splitterToSync.Position = this.Width - newX - splitterToSync.Width;
        }