コード例 #1
0
        /// <summary>
        /// Initialize a new instance of the KryptonGroup class.
        /// </summary>
        public KryptonGroup()
        {
            // Create the palette storage
            StateCommon   = new PaletteDoubleRedirect(Redirector, PaletteBackStyle.ControlClient, PaletteBorderStyle.ControlClient, NeedPaintDelegate);
            StateDisabled = new PaletteDouble(StateCommon, NeedPaintDelegate);
            StateNormal   = new PaletteDouble(StateCommon, NeedPaintDelegate);

            // Create the internal panel used for containing content
            Panel = new KryptonGroupPanel(this, StateCommon, StateDisabled, StateNormal, OnGroupPanelPaint)
            {
                // Make sure the panel back style always mimics our back style
                PanelBackStyle = PaletteBackStyle.ControlClient
            };

            // Create the element that fills the remainder space and remembers fill rectange
            _layoutFill = new ViewLayoutFill(Panel);

            // Create view for the control border and background
            _drawDocker = new ViewDrawDocker(StateNormal.Back, StateNormal.Border)
            {
                { _layoutFill, ViewDockStyle.Fill }
            };

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

            // We want to default to shrinking and growing (base class defaults to GrowOnly)
            AutoSizeMode = AutoSizeMode.GrowAndShrink;

            // Add panel to the controls collection
            ((KryptonReadOnlyControls)Controls).AddInternal(Panel);
        }
コード例 #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 KryptonGroupPanel;

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

            // If inside a Krypton group 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 KryptonGroup) || (_panel.Parent is KryptonHeaderGroup)))
                {
                    descriptor.SetValue(component, true);
                }
            }
        }