コード例 #1
0
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The IComponent to associate with the designer.</param>
        public override void Initialize(IComponent component)
        {
            // Perform common base class initializating
            base.Initialize(component);

            // Remember references to components involved in design
            _panel = component as KryptonSplitterPanel;

            // Acquire service interfaces
            _selectionService = (ISelectionService)GetService(typeof(ISelectionService));

            // Hook into changes in selected component
            IComponentChangeService service = (IComponentChangeService)GetService(typeof(IComponentChangeService));

            if (service != null)
            {
                service.ComponentChanged += OnComponentChanged;
            }

            // If inside a Krypton split container then always lock the component from user size/location change
            if (_panel != null)
            {
                PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component)["Locked"];
                if ((descriptor != null) && (_panel.Parent is KryptonSplitContainer))
                {
                    descriptor.SetValue(component, true);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The IComponent to associate with the designer.</param>
        public override void Initialize(IComponent component)
        {
            // Perform common base class initializating
            base.Initialize(component);

            // Remember references to components involved in design
            _panel = component as KryptonSplitterPanel;

            // Acquire service interfaces
            _selectionService = (ISelectionService)GetService(typeof(ISelectionService));

            // Hook into changes in selected component
            IComponentChangeService service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
            if (service != null)
                service.ComponentChanged += new ComponentChangedEventHandler(OnComponentChanged);

            // If inside a Krypton split container then always lock the component from user size/location change
            if (_panel != null)
            {
                PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component)["Locked"];
                if ((descriptor != null) && (_panel.Parent is KryptonSplitContainer))
                    descriptor.SetValue(component, true);
            }
        }
コード例 #3
0
        /// <summary>
        /// Initialize a new instance of the KryptonSplitContainer class.
        /// </summary>
        public KryptonSplitContainer()
        {
            // Create the palette storage
            _stateCommon = new PaletteSplitContainerRedirect(Redirector, PaletteBackStyle.PanelClient,
                                                             PaletteBorderStyle.ControlClient, PaletteBackStyle.SeparatorLowProfile,
                                                             PaletteBorderStyle.SeparatorLowProfile, NeedPaintDelegate);

            _stateDisabled = new PaletteSplitContainer(_stateCommon, _stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate);
            _stateNormal = new PaletteSplitContainer(_stateCommon, _stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate);
            _stateTracking = new PaletteSeparatorPadding(_stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate);
            _statePressed = new PaletteSeparatorPadding(_stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate);

            // Our view contains just a simple canvas that covers entire client area and a separator view
            _drawSeparator = new ViewDrawSeparator(_stateDisabled.Separator, _stateNormal.Separator, _stateTracking, _statePressed,
                                                   _stateDisabled.Separator, _stateNormal.Separator, _stateTracking, _statePressed,
                                                    PaletteMetricPadding.SeparatorPaddingLowProfile, Orientation.Vertical);

            _drawPanel = new ViewDrawPanel(_stateNormal.Back);
            _drawPanel.Add(_drawSeparator);

            // Create a separator controller to handle separator style behaviour
            _separatorController = new SeparatorController(this, _drawSeparator, true, true, NeedPaintDelegate);

            // Assign the controller to the view element to treat as a separator
            _drawSeparator.MouseController = _separatorController;
            _drawSeparator.KeyController = _separatorController;
            _drawSeparator.SourceController = _separatorController;

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawPanel);

            // Set other internal starting values
            _splitterDistance = 50;
            _splitterPercent = 1f / 3f;
            _splitterIncrement = 1;
            _panel1MinSize = 25;
            _panel2MinSize = 25;
            _splitterWidth = 5;
            _fixedDistance = 50;
            _fixedPanel = FixedPanel.None;
            _orientation = Orientation.Vertical;

            // Create the two fixed child panels
            _panel1 = new KryptonSplitterPanel(this);
            _panel2 = new KryptonSplitterPanel(this);

            // Add both panels to the controls collection
            ((KryptonReadOnlyControls)Controls).AddInternal(_panel1);
            ((KryptonReadOnlyControls)Controls).AddInternal(_panel2);
        }