ComponentFactory.Krypton.Toolkit.KryptonSplitContainerDesigner.Initialize C# (CSharp) Method

Initialize() public method

Initializes the designer with the specified component.
public Initialize ( IComponent component ) : void
component IComponent The IComponent to associate with the designer.
return void
        public override void Initialize(IComponent component)
        {
            Debug.Assert(component != null);

            // Validate the parameter reference
            if (component == null) throw new ArgumentNullException("component");

            // Let base class do standard stuff
            base.Initialize(component);

            // The resizing handles around the control need to change depending on the
            // value of the AutoSize and AutoSizeMode properties. When in AutoSize you
            // do not get the resizing handles, otherwise you do.
            AutoResizeHandles = true;

            // Acquire service interfaces
            _designerHost = (IDesignerHost)GetService(typeof(IDesignerHost));
            _selectionService = (ISelectionService)GetService(typeof(ISelectionService));
            _behaviorService = (BehaviorService)GetService(typeof(BehaviorService));

            // Remember the actual control being designed
            _splitContainer = component as KryptonSplitContainer;

            // Create a new adorner and add our splitter glyph
            _adorner = new Adorner();
            _adorner.Glyphs.Add(new KryptonSplitContainerGlyph(_selectionService, _behaviorService, _adorner, this));
            _behaviorService.Adorners.Add(_adorner);

            // Let the two panels in the container be designable
            if (_splitContainer != null)
            {
                EnableDesignMode(_splitContainer.Panel1, "Panel1");
                EnableDesignMode(_splitContainer.Panel2, "Panel2");
            }
        }