예제 #1
0
        /// <summary>
        /// Initialize a new instance of the KryptonBorderEdge class.
        /// </summary>
        public KryptonBorderEdge()
        {
            // The label cannot take the focus
            SetStyle(ControlStyles.Selectable, false);

            // Set default label style
            _orientation = Orientation.Horizontal;

            // Create the palette storage
            _borderRedirect = new PaletteBorderInheritRedirect(Redirector, PaletteBorderStyle.ControlClient);
            StateCommon     = new PaletteBorderEdgeRedirect(_borderRedirect, NeedPaintDelegate);
            StateDisabled   = new PaletteBorderEdge(StateCommon, NeedPaintDelegate);
            StateNormal     = new PaletteBorderEdge(StateCommon, NeedPaintDelegate);
            _stateCurrent   = StateNormal;
            _state          = PaletteState.Normal;

            // Our view contains just a simple canvas that covers entire client area
            _drawPanel = new ViewDrawPanel(StateNormal);

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

            // We want to be auto sized by default, but not the property default!
            AutoSize     = true;
            AutoSizeMode = AutoSizeMode.GrowAndShrink;
        }
예제 #2
0
        /// <summary>
        /// Initialize a new instance of the KryptonGroupPanel class.
        /// </summary>
        /// <param name="alignControl">Container control for alignment.</param>
        /// <param name="stateCommon">Common appearance state to inherit from.</param>
        /// <param name="stateDisabled">Disabled appearance state.</param>
        /// <param name="stateNormal">Normal appearance state.</param>
        /// <param name="layoutHandler">Callback delegate for layout processing.</param>
        public KryptonGroupPanel(Control alignControl,
                                 PaletteDoubleRedirect stateCommon,
                                 PaletteDouble stateDisabled,
                                 PaletteDouble stateNormal,
                                 NeedPaintHandler layoutHandler)
            : base(stateCommon, stateDisabled, stateNormal)
        {
            // Remember the delegate used to notify layouts
            _layoutHandler = layoutHandler;

            // Create the forced overrides to enforce the graphics option we want
            _forcedDisabled = new PaletteBackInheritForced(stateDisabled.Back);
            _forcedNormal   = new PaletteBackInheritForced(stateNormal.Back);

            // We never allow the anti alias option as it prevent transparent background working
            _forcedDisabled.ForceGraphicsHint = PaletteGraphicsHint.None;
            _forcedNormal.ForceGraphicsHint   = PaletteGraphicsHint.None;

            // Set the correct initial palettes
            ViewDrawPanel.SetPalettes(Enabled ? _forcedNormal : _forcedDisabled);

            // Make sure the alignment of the group panel is as that of the parent
            ViewManager.AlignControl = alignControl;
        }