public KryptonTreeView() { //double buffer SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); UpdateStyles(); // Configure the TreeView control for owner-draw. this.DrawMode = TreeViewDrawMode.OwnerDrawText; // add Palette Handler // Cache the current global palette setting _palette = KryptonManager.CurrentGlobalPalette; // Hook into palette events if (_palette != null) { _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint); } // We want to be notified whenever the global palette changes KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); // Create redirection object to the base palette _paletteRedirect = new PaletteRedirect(_palette); // Create accessor objects for the back, border and content _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); }
public MyUserControl() { // To remove flicker we use double buffering for drawing SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); // Cache the current global palette setting _palette = KryptonManager.CurrentGlobalPalette; // Hook into palette events if (_palette != null) { _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint); } // We want to be notified whenever the global palette changes KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); // Create redirection object to the base palette _paletteRedirect = new PaletteRedirect(_palette); // Create accessor objects for the back, border and content _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); }
public KryptonSlider() { //(1) To remove flicker we use double buffering for drawing SetStyle(ControlStyles.SupportsTransparentBackColor, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); //Initialize Component InitializeComponent(); //(5) Create redirection object to the base palette // add Palette Handler if (_palette != null) { _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint); } KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); _palette = KryptonManager.CurrentGlobalPalette; _paletteRedirect = new PaletteRedirect(_palette); //(6) Create accessor objects for the back, border and content m_paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); m_paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); m_paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); //Set Back Color this.BackColor = System.Drawing.Color.Transparent; }
public KryptonCalendar() { //To remove flicker we use double buffering for drawing SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); //Create redirection object to the base palette if (((this._palette != null))) { this._palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(this.OnPalettePaint); } KryptonManager.GlobalPaletteChanged += new EventHandler(this.OnGlobalPaletteChanged); this._palette = KryptonManager.CurrentGlobalPalette; this._paletteRedirect = new PaletteRedirect(this._palette); //Create accessor objects for the back, border and content m_paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); m_paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); m_paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); ColorTable = KryptonCalendar.ct; this.InitColors(); }
public KryptonGrid() { SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); _palette = KryptonManager.CurrentGlobalPalette; if (_palette != null) { _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint); } KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); _paletteRedirect = new PaletteRedirect(_palette); _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); this.RowTemplate.DefaultCellStyle.SelectionBackColor = Color.Transparent; this.DefaultCellStyle.SelectionBackColor = Color.Transparent; this.DefaultCellStyle.SelectionForeColor = Color.Navy; this.RowTemplate.DefaultCellStyle.SelectionForeColor = Color.Navy; this.AlternatingRowsDefaultCellStyle.BackColor = _palette.ColorTable.ToolStripGradientBegin; BackgroundColor = Color.FromArgb(179, 196, 216); }
/// <summary> /// Creates a new instace of the Analog Clock control. /// </summary> public AnalogClock() { InitializeComponent(); SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); //SetStyle(ControlStyles.Opaque, true); //SetStyle(ControlStyles.SupportsTransparentBackColor, true); if (((_palette != null))) { _palette.PalettePaint += OnPalettePaint; } KryptonManager.GlobalPaletteChanged += OnGlobalPaletteChanged; _palette = KryptonManager.CurrentGlobalPalette; _paletteRedirect = new PaletteRedirect(_palette); _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); InitialiseColours(); BackColor = Color.Transparent; }
/// <summary> /// Initialize a new instance of the KryptonContextMenuRadioButton class. /// </summary> /// <param name="initialText">Initial text for display.</param> public KryptonContextMenuRadioButton(string initialText) { // Default fields _enabled = true; _autoClose = false; _text = initialText; _extraText = string.Empty; _image = null; _imageTransparentColor = Color.Empty; _checked = false; _autoCheck = true; _style = LabelStyle.NormalPanel; Images = new RadioButtonImages(); // Create the redirectors _stateCommonRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalPanel); StateRadioButtonImages = new PaletteRedirectRadioButton(Images); // Create the states StateCommon = new PaletteContent(_stateCommonRedirect); StateDisabled = new PaletteContent(StateCommon); StateNormal = new PaletteContent(StateCommon); OverrideFocus = new PaletteContent(_stateCommonRedirect); // Override the normal/disabled values with the focus, when the control has focus OverrideNormal = new PaletteContentInheritOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride, false); OverrideDisabled = new PaletteContentInheritOverride(OverrideFocus, StateDisabled, PaletteState.FocusOverride, false); }
public KryptonKnobControlEnhanced() { _dottedPen = new Pen(KryptonKnobUtilities.GetDarkColour(BackColor, 40)) { DashStyle = DashStyle.Dash, DashCap = DashCap.Flat }; InitializeComponent(); _knobTypeface = new Font(Font.FontFamily, Font.Size); _scaleTypeface = new Font(Font.FontFamily, Font.Size); // Properties initialisation // "start angle" and "end angle" possible values: // 90 = bottom (minimum value for "start angle") // 180 = left // 270 = top // 360 = right // 450 = bottom again (maximum value for "end angle") // So the couple (90, 450) will give an entire circle and the couple (180, 360) will give half a circle. _startAngle = 135; _endAngle = 405; _deltaAngle = _endAngle - _startAngle; _minimum = 0; _maximum = 100; _scaleDivisions = 11; _scaleSubDivisions = 4; _mouseWheelBarPartitions = 10; _scaleColour = Color.Black; _knobBackColour = Color.White; SetDimensions(); if (((_palette != null))) { _palette.PalettePaint += OnPalettePaint; } KryptonManager.GlobalPaletteChanged += OnGlobalPaletteChanged; _palette = KryptonManager.CurrentGlobalPalette; _paletteRedirect = new PaletteRedirect(_palette); _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); InitiliseColourScheme(); }
/// <summary> /// Initialize a new instance of the PaletteGroupBoxRedirect class. /// </summary> /// <param name="redirectDouble">inheritance redirection for group border/background.</param> /// <param name="redirectContent">inheritance redirection for group header.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteGroupBoxRedirect(PaletteRedirect redirectDouble, PaletteRedirect redirectContent, NeedPaintHandler needPaint) : base(redirectDouble, PaletteBackStyle.ControlGroupBox, PaletteBorderStyle.ControlGroupBox, needPaint) { Debug.Assert(redirectDouble != null); Debug.Assert(redirectContent != null); _contentInherit = new PaletteContentInheritRedirect(redirectContent, PaletteContentStyle.LabelGroupBoxCaption); Content = new PaletteContent(_contentInherit, needPaint); }
// public EngineLabel() { _style = LabelStyle.NormalControl; _paletteCommonRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); ReadOnly = true; TabStop = false; if (!WinFormsUtility.IsDesignerHosted(this)) { StateCommon.Back.Color1 = GetResolvedPalette().GetBackColor1(PaletteBackStyle.PanelClient, PaletteState.Normal); StateCommon.Border.Draw = InheritBool.False; } }
public KryptonListView() { SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor | ControlStyles.EnableNotifyMessage, true); UpdateStyles(); OwnerDraw = true; _originalFont = (Font)Font.Clone(); _originalForeColour = (Color)ForeColor; _palette = KryptonManager.CurrentGlobalPalette; if (_palette != null) { _palette.PalettePaint += OnPalettePaint; } KryptonManager.GlobalPaletteChanged += OnGlobalPaletteChanged; _paletteRedirect = new PaletteRedirect(_palette); _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); InitialiseColours(); lvwColumnSorter = new ListViewColumnSorter(); this.ListViewItemSorter = lvwColumnSorter; if (_selectEntireRowOnSubItem) { FullRowSelect = true; } _enableVistaCheckBoxes = Utility.IsVistaOrHigher(); InitializeComponent(); _designMode = (Process.GetCurrentProcess().ProcessName == "devenv"); if (SmallImageList == null) { SmallImageList = ilHeight; } }
/// <summary> /// Initialize a new instance of the PaletteContextMenuItemState class. /// </summary> /// <param name="redirectItemHighlight">Redirector for ItemHighlight.</param> /// <param name="redirectItemImage">Redirector for ItemImage.</param> /// <param name="redirectItemShortcutText">Redirector for ItemShortcutText.</param> /// <param name="redirectItemSplit">Redirector for ItemSplit.</param> /// <param name="redirectItemTextAlternate">Redirector for ItemTextStandard.</param> /// <param name="redirectItemTextStandard">Redirector for ItemTextAlternate.</param> public PaletteContextMenuItemState(PaletteDoubleMetricRedirect redirectItemHighlight, PaletteTripleJustImageRedirect redirectItemImage, PaletteContentInheritRedirect redirectItemShortcutText, PaletteDoubleRedirect redirectItemSplit, PaletteContentInheritRedirect redirectItemTextStandard, PaletteContentInheritRedirect redirectItemTextAlternate) { ItemHighlight = new PaletteDoubleMetric(redirectItemHighlight); ItemImage = new PaletteTripleJustImage(redirectItemImage); ItemShortcutText = new PaletteContentJustShortText(redirectItemShortcutText); ItemSplit = new PaletteDouble(redirectItemSplit); ItemTextStandard = new PaletteContentJustText(redirectItemTextStandard); ItemTextAlternate = new PaletteContentJustText(redirectItemTextAlternate); }
/// <summary> /// Initialize a new instance of the KryptonPaletteLabel class. /// </summary> /// <param name="redirect">Redirector to inherit values from.</param> /// <param name="contentStyle">Content style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public KryptonPaletteLabel(PaletteRedirect redirect, PaletteContentStyle contentStyle, NeedPaintHandler needPaint) { // Create the storage objects _stateInherit = new PaletteContentInheritRedirect(redirect, contentStyle); StateCommon = new PaletteContent(_stateInherit, needPaint); StateDisabled = new PaletteContent(StateCommon, needPaint); StateNormal = new PaletteContent(StateCommon, needPaint); OverrideFocus = new PaletteContent(_stateInherit, needPaint); OverrideVisited = new PaletteContent(_stateInherit, needPaint); OverrideNotVisited = new PaletteContent(_stateInherit, needPaint); OverridePressed = new PaletteContent(_stateInherit, needPaint); }
void RefreshPalette() { palette = paletteMode == PaletteMode.Global ? KryptonManager.CurrentGlobalPalette : KryptonManager.GetPaletteForMode(paletteMode); renderer = palette.GetRenderer(); paletteRedirect = new PaletteRedirect(palette); paletteBackground = new PaletteBackInheritRedirect(paletteRedirect); labelStyle = new PaletteContentInheritRedirect(paletteRedirect); paletteBackground.Style = PaletteBackStyle.InputControlStandalone; labelStyle.Style = PaletteContentStyle.LabelNormalControl; Refresh(); }
/// <summary> /// Initialize a new instance of the PaletteRibbonTabContentRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection instance.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteRibbonTabContentRedirect(PaletteRedirect redirect, NeedPaintHandler needPaint) { Debug.Assert(redirect != null); // Store the provided paint notification delegate NeedPaint = needPaint; _drawRedirect = new PaletteRibbonDoubleRedirect(redirect, PaletteRibbonBackStyle.RibbonTab, PaletteRibbonTextStyle.RibbonTab, needPaint); _contentInherit = new PaletteContentInheritRedirect(redirect); _content = new PaletteNavContent(_contentInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteContextMenuItemStateRedirect class. /// </summary> public PaletteContextMenuItemStateRedirect() { _itemHighlight = new PaletteRedirectDouble(); _itemImage = new PaletteRedirectTriple(); _itemShortcutText = new PaletteRedirectContent(); _itemSplit = new PaletteRedirectDouble(); _itemStandard = new PaletteRedirectContent(); _itemAlternate = new PaletteRedirectContent(); _redirectItemHighlight = new PaletteDoubleMetricRedirect(_itemHighlight, PaletteBackStyle.ContextMenuItemHighlight, PaletteBorderStyle.ContextMenuItemHighlight); _redirectItemImage = new PaletteTripleJustImageRedirect(_itemImage, PaletteBackStyle.ContextMenuItemImage, PaletteBorderStyle.ContextMenuItemImage, PaletteContentStyle.ContextMenuItemImage); _redirectItemShortcutText = new PaletteContentInheritRedirect(_itemShortcutText, PaletteContentStyle.ContextMenuItemShortcutText); _redirectItemSplit = new PaletteDoubleRedirect(_itemSplit, PaletteBackStyle.ContextMenuSeparator, PaletteBorderStyle.ContextMenuSeparator); _redirectItemTextStandard = new PaletteContentInheritRedirect(_itemStandard, PaletteContentStyle.ContextMenuItemTextStandard); _redirectItemTextAlternate = new PaletteContentInheritRedirect(_itemAlternate, PaletteContentStyle.ContextMenuItemTextAlternate); }
/// <summary> /// Constructor /// </summary> public KryptonOutlookGridGroupBox() { // To remove flicker we use double buffering for drawing SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); InitializeComponent(); columnsList = new List <OutlookGridGroupBoxColumn>(); // Cache the current global palette setting _palette = KryptonManager.CurrentGlobalPalette; // Hook into palette events if (_palette != null) { _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint); } // (4) We want to be notified whenever the global palette changes KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); // Create redirection object to the base palette _paletteRedirect = new PaletteRedirect(_palette); // Create accessor objects for the back, border and content // Store the inherit instances _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); _paletteDataGridView = new PaletteDataGridViewRedirect(_paletteRedirect, null); _paletteDataGridViewAll = new PaletteDataGridViewAll(_paletteDataGridView, null); // Create storage that maps onto the inherit instances _border = new PaletteBorder(_paletteBorder, null); _dragColumnToGroupText = LanguageManager.Instance.GetStringGB("DRAGCOLUMNTOGROUP"); using (Graphics g = CreateGraphics()) { factorX = g.DpiX > 96 ? (1f * g.DpiX / 96) : 1f; factorY = g.DpiY > 96 ? (1f * g.DpiY / 96) : 1f; } }
/// <summary> /// Initialize a new instance of the PaletteTripleJustImageRedirect class. /// </summary> /// <param name="redirect">inheritance redirection instance.</param> /// <param name="backStyle">Initial background style.</param> /// <param name="borderStyle">Initial border style.</param> /// <param name="contentStyle">Initial content style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteTripleJustImageRedirect(PaletteRedirect redirect, PaletteBackStyle backStyle, PaletteBorderStyle borderStyle, PaletteContentStyle contentStyle, NeedPaintHandler needPaint) { // Store the provided paint notification delegate NeedPaint = needPaint; // Store the inherit instances _backInherit = new PaletteBackInheritRedirect(redirect, backStyle); _borderInherit = new PaletteBorderInheritRedirect(redirect, borderStyle); _contentInherit = new PaletteContentInheritRedirect(redirect, contentStyle); // Create storage that maps onto the inherit instances Back = new PaletteBack(_backInherit, needPaint); Border = new PaletteBorder(_borderInherit, needPaint); Content = new PaletteContentJustImage(_contentInherit, needPaint); }
public KryptonFlowLayoutPanel() { SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); _palette = KryptonManager.CurrentGlobalPalette; if (_palette != null) { _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint); } KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); _paletteRedirect = new PaletteRedirect(_palette); _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); }
/// <summary> /// Initialize a new instance of the PaletteDataGridViewTripleRedirect class. /// </summary> /// <param name="redirect">inheritance redirection instance.</param> /// <param name="backStyle">Initial background style.</param> /// <param name="borderStyle">Initial border style.</param> /// <param name="contentStyle">Initial content style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteDataGridViewTripleRedirect(PaletteRedirect redirect, PaletteBackStyle backStyle, PaletteBorderStyle borderStyle, PaletteContentStyle contentStyle, NeedPaintHandler needPaint) { Debug.Assert(redirect != null); // Store the provided paint notification delegate NeedPaint = needPaint; // Store the inherit instances _backInherit = new PaletteBackInheritRedirect(redirect, backStyle); _borderInherit = new PaletteBorderInheritRedirect(redirect, borderStyle); _contentInherit = new PaletteContentInheritRedirect(redirect, contentStyle); // Create storage that maps onto the inherit instances Back = new PaletteBack(_backInherit, needPaint); Border = new PaletteBorder(_borderInherit, needPaint); Content = new PaletteDataGridViewContentCommon(_contentInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteContextMenuRedirect class. /// </summary> /// <param name="redirect">inheritance redirection.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteContextMenuRedirect(PaletteRedirect redirect, NeedPaintHandler needPaint) { Debug.Assert(redirect != null); // Create the palette storage ControlInner = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuInner, PaletteBorderStyle.ContextMenuInner, needPaint); ControlOuter = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuOuter, PaletteBorderStyle.ContextMenuOuter, needPaint); Heading = new PaletteTripleRedirect(redirect, PaletteBackStyle.ContextMenuHeading, PaletteBorderStyle.ContextMenuHeading, PaletteContentStyle.ContextMenuHeading, needPaint); ItemHighlight = new PaletteDoubleMetricRedirect(redirect, PaletteBackStyle.ContextMenuItemHighlight, PaletteBorderStyle.ContextMenuItemHighlight, needPaint); ItemImage = new PaletteTripleJustImageRedirect(redirect, PaletteBackStyle.ContextMenuItemImage, PaletteBorderStyle.ContextMenuItemImage, PaletteContentStyle.ContextMenuItemImage, needPaint); ItemImageColumn = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuItemImageColumn, PaletteBorderStyle.ContextMenuItemImageColumn, needPaint); ItemShortcutTextRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemShortcutText); ItemShortcutText = new PaletteContentJustShortText(ItemShortcutTextRedirect, needPaint); ItemSplit = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuItemSplit, PaletteBorderStyle.ContextMenuItemSplit, needPaint); ItemTextAlternateRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemTextAlternate); ItemTextAlternate = new PaletteContentJustText(ItemTextAlternateRedirect, needPaint); ItemTextStandardRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemTextStandard); ItemTextStandard = new PaletteContentJustText(ItemTextStandardRedirect, needPaint); Separator = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuSeparator, PaletteBorderStyle.ContextMenuSeparator, needPaint); }
public KryptonToggleSwitchAndroidRenderer() { if (((_palette != null))) { _palette.PalettePaint += OnPalettePaint; } KryptonManager.GlobalPaletteChanged += OnGlobalPaletteChanged; _palette = KryptonManager.CurrentGlobalPalette; _paletteRedirect = new PaletteRedirect(_palette); _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); InitialiseColours(); }
public KryptonKnobControl() { this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.SetStyle(ControlStyles.ResizeRedraw, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //Create redirection object to the base palette if (((this._palette != null))) { this._palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(this.OnPalettePaint); } KryptonManager.GlobalPaletteChanged += new EventHandler(this.OnGlobalPaletteChanged); this._palette = KryptonManager.CurrentGlobalPalette; this._paletteRedirect = new PaletteRedirect(this._palette); //Create accessor objects for the back, border and content m_paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); m_paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); m_paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); InitColors(); //This call is required by the Windows Form Designer. InitializeComponent(); this.ImeMode = ImeMode.On; this.Name = "Knob"; this.Resize += new EventHandler(this.Knob_Resize); //this.ValueChanged += new ValueChangedEventHandler(this.ValueChanged); DottedPen = new Pen(getDarkColor(_KnobBorderColour, 40)); DottedPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; DottedPen.DashCap = System.Drawing.Drawing2D.DashCap.Round; setDimensions(); InitColors(); }
/// <summary> /// Initialize a new instance of the KryptonLinkLabel class. /// </summary> public KryptonLinkLabel() { // The link label cannot take the focus SetStyle(ControlStyles.Selectable, true); // Turn off the target functionality present in the base class EnabledTarget = false; // Create the override states that redirect without inheriting _stateVisitedRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalPanel); _stateNotVisitedRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalPanel); _statePressedRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalPanel); _stateFocusRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalPanel); OverrideVisited = new PaletteContent(_stateVisitedRedirect, NeedPaintDelegate); OverrideNotVisited = new PaletteContent(_stateNotVisitedRedirect, NeedPaintDelegate); OverrideFocus = new PaletteContent(_stateFocusRedirect, NeedPaintDelegate); OverridePressed = new PaletteContent(_statePressedRedirect, NeedPaintDelegate); // Override the normal state to implement the underling logic _inheritBehavior = new LinkLabelBehaviorInherit(StateNormal, KryptonLinkBehavior.AlwaysUnderline); // Create the override handling classes _overrideVisited = new PaletteContentInheritOverride(OverrideVisited, _inheritBehavior, PaletteState.LinkVisitedOverride, false); _overrideNotVisited = new PaletteContentInheritOverride(OverrideNotVisited, _overrideVisited, PaletteState.LinkNotVisitedOverride, true); _overrideFocusNotVisited = new PaletteContentInheritOverride(OverrideFocus, _overrideNotVisited, PaletteState.FocusOverride, false); _overridePressed = new PaletteContentInheritOverride(OverridePressed, _inheritBehavior, PaletteState.LinkPressedOverride, false); _overridePressedFocus = new PaletteContentInheritOverride(OverrideFocus, _overridePressed, PaletteState.FocusOverride, false); // Create controller for updating the view state/click events _controller = new LinkLabelController(ViewDrawContent, StateDisabled, _overrideFocusNotVisited, _overrideFocusNotVisited, _overridePressedFocus, _overridePressed, NeedPaintDelegate); _controller.Click += OnControllerClick; ViewDrawContent.MouseController = _controller; ViewDrawContent.KeyController = _controller; ViewDrawContent.SourceController = _controller; // Set initial palette for drawing the content ViewDrawContent.SetPalette(_overrideFocusNotVisited); }
//constructor public KryptonPowerComboBox() { this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.SetStyle(ControlStyles.EnableNotifyMessage, true); UpdateStyles(); this.ComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.ComboBox.DrawItem += new DrawItemEventHandler(OnDrawItem); this.ForeColor = this.ComboBox.ForeColor; this.Font = this.ComboBox.Font; // Cache the current global palette setting _palette = KryptonManager.CurrentGlobalPalette; // Hook into palette events if (_palette != null) { _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint); } // We want to be notified whenever the global palette changes KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); // Create redirection object to the base palette _paletteRedirect = new PaletteRedirect(_palette); _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); InitColours(); if (_alternateRowColorEnabled) { this.GridColour = _alternateRowColor; } }
/// <summary> /// Initialize a new instance of the KryptonLabel class. /// </summary> public KryptonLabel() { SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // The label cannot take the focus SetStyle(ControlStyles.Selectable, false); // Set default properties _style = LabelStyle.NormalPanel; _useMnemonic = true; _orientation = VisualOrientation.Top; _target = null; EnabledTarget = true; // Create content storage Values = new LabelValues(NeedPaintDelegate); Values.TextChanged += OnLabelTextChanged; // Create palette redirector _paletteCommonRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalPanel); // Create the palette provider StateCommon = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); StateDisabled = new PaletteContent(StateCommon, NeedPaintDelegate); StateNormal = new PaletteContent(StateCommon, NeedPaintDelegate); // Our view contains background and border with content inside _drawContent = new ViewDrawContent(StateNormal, this, VisualOrientation.Top) { UseMnemonic = _useMnemonic }; // Create the view manager instance ViewManager = new ViewManager(this, _drawContent); // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }
public KryptonTimeFrame() { SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true); UpdateStyles(); // add Palette Handler if (_palette != null) { _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint); } KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); _palette = KryptonManager.CurrentGlobalPalette; _paletteRedirect = new PaletteRedirect(_palette); _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); InitColors(); }
public KryptonTreeViewExt() { SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); UpdateStyles(); this.DrawMode = TreeViewDrawMode.OwnerDrawAll; //SetStyle(ControlStyles.UserPaint, true); // add Palette Handler // Cache the current global palette setting _palette = KryptonManager.CurrentGlobalPalette; // Hook into palette events if (_palette != null) { _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint); } // We want to be notified whenever the global palette changes KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged); // Create redirection object to the base palette _paletteRedirect = new PaletteRedirect(_palette); // Create accessor objects for the back, border and content _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); _paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); //vista _enableVistaCheckBoxes = Utility.IsVista(); _enableVistaSigns = Utility.IsVista(); InitColors(); //for image list InitializeComponent(); }
/// <summary> /// Initialize a new instance of the RadioButton class. /// </summary> public KryptonRadioButton() { // Turn off standard click and double click events, we do that manually SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false); // Set default properties _style = LabelStyle.NormalPanel; _orientation = VisualOrientation.Top; _checkPosition = VisualOrientation.Left; _checked = false; _useMnemonic = true; _autoCheck = true; // Create content storage Values = new LabelValues(NeedPaintDelegate); Values.TextChanged += OnRadioButtonTextChanged; Images = new RadioButtonImages(NeedPaintDelegate); // Create palette redirector _paletteCommonRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalPanel); _paletteRadioButtonImages = new PaletteRedirectRadioButton(Redirector, Images); // Create the palette provider StateCommon = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); StateDisabled = new PaletteContent(StateCommon, NeedPaintDelegate); StateNormal = new PaletteContent(StateCommon, NeedPaintDelegate); OverrideFocus = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); // Override the normal values with the focus, when the control has focus _overrideNormal = new PaletteContentInheritOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride, false); // Our view contains background and border with content inside _drawContent = new ViewDrawContent(_overrideNormal, Values, VisualOrientation.Top) { UseMnemonic = _useMnemonic, // Only draw a focus rectangle when focus cues are needed in the top level form TestForFocusCues = true }; // Create the check box image drawer and place inside element so it is always centered _drawRadioButton = new ViewDrawRadioButton(_paletteRadioButtonImages) { CheckState = _checked }; _layoutCenter = new ViewLayoutCenter { _drawRadioButton }; // Place check box on the left and the label in the remainder _layoutDocker = new ViewLayoutDocker { { _layoutCenter, ViewDockStyle.Left }, { _drawContent, ViewDockStyle.Fill } }; // Need a controller for handling mouse input _controller = new RadioButtonController(_drawRadioButton, _layoutDocker, NeedPaintDelegate); _controller.Click += OnControllerClick; _controller.Enabled = true; _layoutDocker.MouseController = _controller; _layoutDocker.KeyController = _controller; // Change the layout to match the inital right to left setting and orientation UpdateForOrientation(); // Create the view manager instance ViewManager = new ViewManager(this, _layoutDocker); // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }