/// <summary> /// Initialize a new instance of the KryptonPaletteHeader class. /// </summary> /// <param name="redirect">Redirector to inherit values from.</param> /// <param name="backStyle">Background style.</param> /// <param name="borderStyle">Border style.</param> /// <param name="contentStyle">Content style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public KryptonPaletteHeader(PaletteRedirect redirect, PaletteBackStyle backStyle, PaletteBorderStyle borderStyle, PaletteContentStyle contentStyle, NeedPaintHandler needPaint) { // Create the storage objects StateCommon = new PaletteHeaderRedirect(redirect, backStyle, borderStyle, contentStyle, needPaint); StateDisabled = new PaletteTripleMetric(StateCommon, needPaint); StateNormal = new PaletteTripleMetric(StateCommon, needPaint); }
/// <summary> /// Initialize a new instance of the KryptonHeader class. /// </summary> public KryptonHeader() { // The header cannot take the focus SetStyle(ControlStyles.Selectable, false); // Set default values _style = HeaderStyle.Primary; _orientation = VisualOrientation.Top; AllowButtonSpecToolTips = false; AllowButtonSpecToolTipPriority = false; // Create storage objects Values = new HeaderValues(NeedPaintDelegate); Values.TextChanged += OnHeaderTextChanged; ButtonSpecs = new HeaderButtonSpecCollection(this); // Create the palette storage StateCommon = new PaletteHeaderRedirect(Redirector, PaletteBackStyle.HeaderPrimary, PaletteBorderStyle.HeaderPrimary, PaletteContentStyle.HeaderPrimary, NeedPaintDelegate); StateDisabled = new PaletteTripleMetric(StateCommon, NeedPaintDelegate); StateNormal = new PaletteTripleMetric(StateCommon, NeedPaintDelegate); // Our view contains background and border with content inside _drawDocker = new ViewDrawDocker(StateNormal.Back, StateNormal.Border, null); _drawContent = new ViewDrawContent(StateNormal.Content, Values, Orientation); _drawDocker.Add(_drawContent, ViewDockStyle.Fill); // Create the view manager instance ViewManager = new ViewManager(this, _drawDocker); // Create button specification collection manager _buttonManager = new ButtonSpecManagerDraw(this, Redirector, ButtonSpecs, null, new ViewDrawDocker[] { _drawDocker }, new IPaletteMetric[] { StateCommon }, new PaletteMetricInt[] { PaletteMetricInt.HeaderButtonEdgeInsetPrimary }, new PaletteMetricPadding[] { PaletteMetricPadding.HeaderButtonPaddingPrimary }, CreateToolStripRenderer, NeedPaintDelegate); // Create the manager for handling tooltips ToolTipManager = new ToolTipManager(); ToolTipManager.ShowToolTip += OnShowToolTip; ToolTipManager.CancelToolTip += OnCancelToolTip; _buttonManager.ToolTipManager = ToolTipManager; // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }