/// <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; }
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); }
/// <summary> /// Initialize a new instance of the PaletteDoubleRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection instance.</param> /// <param name="back">Storage for back values.</param> /// <param name="backInherit">Inheritence for back values.</param> /// <param name="border">Storage for border values.</param> /// <param name="borderInherit">Inheritence for border values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteDoubleRedirect(PaletteRedirect redirect, PaletteBack back, PaletteBackInheritRedirect backInherit, PaletteBorder border, PaletteBorderInheritRedirect borderInherit, NeedPaintHandler needPaint) { Construct(redirect, back, backInherit, border, borderInherit, needPaint); }
private void Construct(PaletteRedirect redirect, PaletteBack back, PaletteBackInheritRedirect backInherit, PaletteBorder border, PaletteBorderInheritRedirect borderInherit, NeedPaintHandler needPaint) { NeedPaint = needPaint; _backInherit = backInherit; _borderInherit = borderInherit; _back = back; _border = border; }
/// <summary> /// Initialize a new instance of the PaletteDoubleRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection instance.</param> /// <param name="backStyle">Initial background style.</param> /// <param name="borderStyle">Initial border style.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteDoubleRedirect(PaletteRedirect redirect, PaletteBackStyle backStyle, PaletteBorderStyle borderStyle, NeedPaintHandler needPaint) { // Store the inherit instances PaletteBackInheritRedirect backInherit = new PaletteBackInheritRedirect(redirect, backStyle); PaletteBorderInheritRedirect borderInherit = new PaletteBorderInheritRedirect(redirect, borderStyle); // Create storage that maps onto the inherit instances PaletteBack back = new PaletteBack(backInherit, needPaint); PaletteBorder border = new PaletteBorder(borderInherit, needPaint); Construct(redirect, back, backInherit, border, borderInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteTripleRedirect class. /// </summary> /// <param name="redirect">Inheritence 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 PaletteTripleRedirect(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 PaletteContent(_contentInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteTreeStateRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection instance.</param> /// <param name="back">Storage for back values.</param> /// <param name="backInherit">Inheritence for back values.</param> /// <param name="border">Storage for border values.</param> /// <param name="borderInherit">Inheritence for border values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteTreeStateRedirect(PaletteRedirect redirect, PaletteBack back, PaletteBackInheritRedirect backInherit, PaletteBorder border, PaletteBorderInheritRedirect borderInherit, NeedPaintHandler needPaint) : base(redirect, back, backInherit, border, borderInherit, needPaint) { Debug.Assert(redirect != null); // Remember the redirect reference _redirect = redirect; // Create the item redirector _nodeRedirect = new PaletteTripleRedirect(redirect, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteTreeStateRedirect class. /// </summary> /// <param name="redirect">Inheritence redirection instance.</param> /// <param name="back">Storage for back values.</param> /// <param name="backInherit">Inheritence for back values.</param> /// <param name="border">Storage for border values.</param> /// <param name="borderInherit">Inheritence for border values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteTreeStateRedirect(PaletteRedirect redirect, PaletteBack back, PaletteBackInheritRedirect backInherit, PaletteBorder border, PaletteBorderInheritRedirect borderInherit, NeedPaintHandler needPaint) : base(redirect, back, backInherit, border, borderInherit, needPaint) { Debug.Assert(redirect != null); // Remember the redirect reference _redirect = redirect; // Create the item redirector _nodeRedirect = new PaletteTripleRedirect(redirect, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteDataGridViewTripleRedirect class. /// </summary> /// <param name="redirect">Inheritence 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 PaletteTabTripleRedirect class. /// </summary> /// <param name="redirect">Inheritence 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 PaletteTabTripleRedirect(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 PaletteTabBorder(_borderInherit, needPaint); _content = new PaletteContent(_contentInherit, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteInputControlTripleRedirect class. /// </summary> /// <param name="redirect">Inheritence 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 PaletteInputControlTripleRedirect(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); _metricRedirect = new PaletteMetricRedirect(redirect); // Create storage that maps onto the inherit instances Back = new PaletteInputControlBackStates(_backInherit, needPaint); Border = new PaletteBorder(_borderInherit, needPaint); Content = new PaletteInputControlContentStates(_contentInherit, needPaint); }
public KryptonTreeView() { // Contains another control and needs marking as such for validation to work SetStyle(ControlStyles.ContainerControl, true); // Cannot select this control, only the child tree view and does not generate a click event SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false); // Default fields _alwaysActive = true; _style = ButtonStyle.ListItem; _itemHeightDefault = true; _plusMinusImages = new TreeViewImages(); _checkBoxImages = new CheckBoxImages(); base.Padding = new Padding(1); // Create the palette storage _redirectImages = new PaletteRedirectTreeView(Redirector, _plusMinusImages, _checkBoxImages); PaletteBackInheritRedirect backInherit = new PaletteBackInheritRedirect(Redirector, PaletteBackStyle.InputControlStandalone); PaletteBorderInheritRedirect borderInherit = new PaletteBorderInheritRedirect(Redirector, PaletteBorderStyle.InputControlStandalone); PaletteBackColor1 commonBack = new PaletteBackColor1(backInherit, NeedPaintDelegate); PaletteBorder commonBorder = new PaletteBorder(borderInherit, NeedPaintDelegate); _stateCommon = new PaletteTreeStateRedirect(Redirector, commonBack, backInherit, commonBorder, borderInherit, NeedPaintDelegate); PaletteBackColor1 disabledBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate); PaletteBorder disabledBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate); _stateDisabled = new PaletteTreeState(_stateCommon, disabledBack, disabledBorder, NeedPaintDelegate); PaletteBackColor1 normalBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate); PaletteBorder normalBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate); _stateNormal = new PaletteTreeState(_stateCommon, normalBack, normalBorder, NeedPaintDelegate); PaletteBackColor1 activeBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate); PaletteBorder activeBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate); _stateActive = new PaletteDouble(_stateCommon, activeBack, activeBorder, NeedPaintDelegate); _stateFocus = new PaletteTreeNodeTripleRedirect(Redirector, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, NeedPaintDelegate); _stateTracking = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate); _statePressed = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate); _stateCheckedNormal = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate); _stateCheckedTracking = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate); _stateCheckedPressed = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate); // Create the override handling classes _overrideNormal = new PaletteTripleOverride(_stateFocus.Node, _stateNormal.Node, PaletteState.FocusOverride); _overrideTracking = new PaletteTripleOverride(_stateFocus.Node, _stateTracking.Node, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(_stateFocus.Node, _statePressed.Node, PaletteState.FocusOverride); _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedNormal.Node, PaletteState.FocusOverride); _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedTracking.Node, PaletteState.FocusOverride); _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedPressed.Node, PaletteState.FocusOverride); _overrideNormalNode = new PaletteNodeOverride(_overrideNormal); // Create the check box image drawer and place inside element so it is always centered _drawCheckBox = new ViewDrawCheckBox(_redirectImages); _layoutCheckBox = new ViewLayoutCenter(); _layoutCheckBox.Add(_drawCheckBox); // Stack used to layout the location of the node image _layoutImage = new ViewLayoutSeparator(0, 0); _layoutImageAfter = new ViewLayoutSeparator(3, 0); _layoutImageCenter = new ViewLayoutCenter(_layoutImage); _layoutImageStack = new ViewLayoutStack(true); _layoutImageStack.Add(_layoutImageCenter); _layoutImageStack.Add(_layoutImageAfter); _layoutImageState = new ViewLayoutSeparator(16, 16); _layoutImageCenterState = new ViewLayoutCenter(_layoutImageState); // Create the draw element for owner drawing individual items _contentValues = new FixedContentValue(); _drawButton = new ViewDrawButton(StateDisabled.Node, _overrideNormalNode, _overrideTracking, _overridePressed, _overrideCheckedNormal, _overrideCheckedTracking, _overrideCheckedPressed, new PaletteMetricRedirect(Redirector), _contentValues, VisualOrientation.Top, false); // Place check box on the left and the label in the remainder _layoutDocker = new ViewLayoutDocker(); _layoutDocker.Add(_layoutImageStack, ViewDockStyle.Left); _layoutDocker.Add(_layoutImageCenterState, ViewDockStyle.Left); _layoutDocker.Add(_layoutCheckBox, ViewDockStyle.Left); _layoutDocker.Add(_drawButton, ViewDockStyle.Fill); // Create the internal tree view used for containing content _treeView = new InternalTreeView(this); _treeView.TrackMouseEnter += new EventHandler(OnTreeViewMouseChange); _treeView.TrackMouseLeave += new EventHandler(OnTreeViewMouseChange); _treeView.GotFocus += new EventHandler(OnTreeViewGotFocus); _treeView.LostFocus += new EventHandler(OnTreeViewLostFocus); _treeView.KeyDown += new KeyEventHandler(OnTreeViewKeyDown); _treeView.KeyUp += new KeyEventHandler(OnTreeViewKeyUp); _treeView.KeyPress += new KeyPressEventHandler(OnTreeViewKeyPress); _treeView.PreviewKeyDown += new PreviewKeyDownEventHandler(OnTreeViewPreviewKeyDown); _treeView.Validating += new CancelEventHandler(OnTreeViewValidating); _treeView.Validated += new EventHandler(OnTreeViewValidated); _treeView.AfterCheck += new TreeViewEventHandler(OnTreeViewAfterCheck); _treeView.AfterCollapse += new TreeViewEventHandler(OnTreeViewAfterCollapse); _treeView.AfterExpand += new TreeViewEventHandler(OnTreeViewAfterExpand); _treeView.AfterLabelEdit += new NodeLabelEditEventHandler(OnTreeViewAfterLabelEdit); _treeView.AfterSelect += new TreeViewEventHandler(OnTreeViewAfterSelect); _treeView.BeforeCheck += new TreeViewCancelEventHandler(OnTreeViewBeforeCheck); _treeView.BeforeCollapse += new TreeViewCancelEventHandler(OnTreeViewBeforeCollapse); _treeView.BeforeExpand += new TreeViewCancelEventHandler(OnTreeViewBeforeExpand); _treeView.BeforeLabelEdit += new NodeLabelEditEventHandler(OnTreeViewBeforeLabelEdit); _treeView.BeforeSelect += new TreeViewCancelEventHandler(OnTreeViewBeforeSelect); _treeView.ItemDrag += new ItemDragEventHandler(OnTreeViewItemDrag); _treeView.NodeMouseClick += new TreeNodeMouseClickEventHandler(OnTreeViewNodeMouseClick); _treeView.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(OnTreeViewNodeMouseDoubleClick); _treeView.NodeMouseHover += new TreeNodeMouseHoverEventHandler(OnTreeViewNodeMouseHover); _treeView.DrawNode += new DrawTreeNodeEventHandler(OnTreeViewDrawNode); _treeView.DrawMode = TreeViewDrawMode.OwnerDrawAll; // Create the element that fills the remainder space and remembers fill rectange _layoutFill = new ViewLayoutFill(_treeView); _layoutFill.DisplayPadding = new Padding(1); // Create inner view for placing inside the drawing docker _drawDockerInner = new ViewLayoutDocker(); _drawDockerInner.Add(_layoutFill, ViewDockStyle.Fill); // Create view for the control border and background _drawDockerOuter = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border); _drawDockerOuter.Add(_drawDockerInner, ViewDockStyle.Fill); // Create the view manager instance ViewManager = new ViewManager(this, _drawDockerOuter); // We need to create and cache a device context compatible with the display _screenDC = PI.CreateCompatibleDC(IntPtr.Zero); // Add tree view to the controls collection ((KryptonReadOnlyControls)Controls).AddInternal(_treeView); }
/// <summary> /// Constructor /// </summary> public KryptonOutlookGrid() { InitializeComponent(); // very important, this indicates that a new default row class is going to be used to fill the grid // in this case our custom OutlookGridRow class base.RowTemplate = new OutlookGridRow(); groupCollection = new OutlookGridGroupCollection(null); internalRows = new List<OutlookGridRow>(); internalColumns = new OutlookGridColumnCollection(); // 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 _paletteBack = new PaletteBackInheritRedirect(_paletteRedirect); _paletteBorder = new PaletteBorderInheritRedirect(_paletteRedirect); //_paletteContent = new PaletteContentInheritRedirect(_paletteRedirect); AllowUserToOrderColumns = false; //we will handle it ourselves _hideColumnOnGrouping = false; formatConditions = new List<ConditionalFormatting>(); using (Graphics g = CreateGraphics()) { factorX = g.DpiX > 96 ? (1f * g.DpiX / 96) : 1f; factorY = g.DpiY > 96 ? (1f * g.DpiY / 96) : 1f; } //Update StaticValues //ColumnHeadersHeight = (int)(ColumnHeadersHeight * factorY); //No need already done in KryptonDataGridView StaticValues._defaultGroupRowHeight = (int)(StaticValues._defaultGroupRowHeight * factorY); StaticValues._2013GroupRowHeight = (int)(StaticValues._2013GroupRowHeight * factorY); StaticValues._defaultOffsetHeight = (int)(StaticValues._defaultOffsetHeight * factorY); StaticValues._2013OffsetHeight = (int)(StaticValues._defaultOffsetHeight * factorY); StaticValues._ImageOffsetwidth = (int)(StaticValues._ImageOffsetwidth * factorX); StaticValues._groupLevelMultiplier = (int)(StaticValues._groupLevelMultiplier * factorX); StaticValues._groupImageSide = (int)(StaticValues._groupImageSide * factorX); }
/// <summary> /// Initialize a new instance of the PaletteNavigatorNormabled class. /// </summary> /// <param name="navigator">Reference to owning navigator.</param> /// <param name="redirectNavigator">Inheritence redirection for navigator level.</param> /// <param name="redirectNavigatorPage">Inheritence redirection for page level.</param> /// <param name="redirectNavigatorHeaderGroup">Inheritence redirection for header groups level.</param> /// <param name="redirectNavigatorHeaderPrimary">Inheritence redirection for primary header.</param> /// <param name="redirectNavigatorHeaderSecondary">Inheritence redirection for secondary header.</param> /// <param name="redirectNavigatorHeaderBar">Inheritence redirection for bar header.</param> /// <param name="redirectNavigatorHeaderOverflow">Inheritence redirection for bar header.</param> /// <param name="redirectNavigatorCheckButton">Inheritence redirection for check button.</param> /// <param name="redirectNavigatorOverflowButton">Inheritence redirection for overflow button.</param> /// <param name="redirectNavigatorMiniButton">Inheritence redirection for check button.</param> /// <param name="redirectNavigatorBar">Inheritence redirection for bar.</param> /// <param name="redirectNavigatorBorderEdge">Inheritence redirection for border edge.</param> /// <param name="redirectNavigatorSeparator">Inheritence redirection for separator.</param> /// <param name="redirectNavigatorTab">Inheritence redirection for tab.</param> /// <param name="redirectNavigatorRibbonTab">Inheritence redirection for ribbon tab.</param> /// <param name="redirectNavigatorRibbonGeneral">Inheritence redirection for ribbon general.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteNavigatorRedirect(KryptonNavigator navigator, PaletteRedirect redirectNavigator, PaletteRedirect redirectNavigatorPage, PaletteRedirect redirectNavigatorHeaderGroup, PaletteRedirect redirectNavigatorHeaderPrimary, PaletteRedirect redirectNavigatorHeaderSecondary, PaletteRedirect redirectNavigatorHeaderBar, PaletteRedirect redirectNavigatorHeaderOverflow, PaletteRedirect redirectNavigatorCheckButton, PaletteRedirect redirectNavigatorOverflowButton, PaletteRedirect redirectNavigatorMiniButton, PaletteRedirect redirectNavigatorBar, PaletteRedirect redirectNavigatorBorderEdge, PaletteRedirect redirectNavigatorSeparator, PaletteRedirect redirectNavigatorTab, PaletteRedirect redirectNavigatorRibbonTab, PaletteRedirect redirectNavigatorRibbonGeneral, NeedPaintHandler needPaint) : base(redirectNavigator, PaletteBackStyle.PanelClient, PaletteBorderStyle.ControlClient, needPaint) { // Create the palette storage _palettePageRedirect = new PalettePageRedirect(redirectNavigatorPage, needPaint); _paletteHeaderGroupRedirect = new PaletteNavigatorHeaderGroupRedirect(redirectNavigatorHeaderGroup, redirectNavigatorHeaderPrimary, redirectNavigatorHeaderSecondary, redirectNavigatorHeaderBar, redirectNavigatorHeaderOverflow, needPaint); _paletteCheckButton = new PaletteTripleRedirect(redirectNavigatorCheckButton, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, needPaint); _paletteOverflowButton = new PaletteTripleRedirect(redirectNavigatorOverflowButton, PaletteBackStyle.ButtonNavigatorOverflow, PaletteBorderStyle.ButtonNavigatorOverflow, PaletteContentStyle.ButtonNavigatorOverflow, needPaint); _paletteMiniButton = new PaletteTripleRedirect(redirectNavigatorMiniButton, PaletteBackStyle.ButtonNavigatorMini, PaletteBorderStyle.ButtonNavigatorMini, PaletteContentStyle.ButtonNavigatorMini, needPaint); _paletteBarRedirect = new PaletteBarRedirect(redirectNavigatorBar, needPaint); _paletteBorderEdgeInheritRedirect = new PaletteBorderInheritRedirect(redirectNavigatorBorderEdge, PaletteBorderStyle.ControlClient); _paletteBorderEdgeRedirect = new PaletteBorderEdgeRedirect(_paletteBorderEdgeInheritRedirect, needPaint); _paletteSeparator = new PaletteSeparatorPaddingRedirect(redirectNavigatorSeparator, PaletteBackStyle.SeparatorHighInternalProfile, PaletteBorderStyle.SeparatorHighInternalProfile, needPaint); _paletteTab = new PaletteTabTripleRedirect(redirectNavigatorTab, PaletteBackStyle.TabHighProfile, PaletteBorderStyle.TabHighProfile, PaletteContentStyle.TabHighProfile, needPaint); _paletteRibbonTab = new PaletteRibbonTabContentRedirect(redirectNavigatorRibbonTab, needPaint); _paletteRibbonGeneral = new PaletteRibbonGeneralNavRedirect(redirectNavigatorRibbonGeneral, needPaint); _paletteMetrics = new PaletteMetrics(navigator, needPaint); }
/// <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 = LangManager.Instance.GetString("DRAGCOLUMNTOGROUP"); using (Graphics g = CreateGraphics()) { factorX = g.DpiX > 96 ? (1f * g.DpiX / 96) : 1f; factorY = g.DpiY > 96 ? (1f * g.DpiY / 96) : 1f; } }
/// <summary> /// Initializes a new instance of the ImageListView class. /// </summary> public ImageListView() { // Renderer parameters controlSuspended = false; rendererSuspendCount = 0; rendererNeedsPaint = true; mColors = ImageListViewColor.Default; SetRenderer(new ImageListViewRenderer()); // Property defaults AutoRotateThumbnails = true; AllowCheckBoxClick = true; AllowColumnClick = true; AllowColumnResize = true; AllowDrag = false; AllowDuplicateFileNames = false; AllowPaneResize = true; mBorderStyle = BorderStyle.Fixed3D; mCacheMode = CacheMode.OnDemand; mCacheLimitAsItemCount = 0; mCacheLimitAsMemory = 20 * 1024 * 1024; mColumns = new ImageListViewColumnHeaderCollection(this); resources = new ResourceManager("Manina.Windows.Forms.ImageListViewResources", typeof(ImageListView).Assembly); mDefaultImage = resources.GetObject("DefaultImage") as Image; mErrorImage = resources.GetObject("ErrorImage") as Image; mRatingImage = resources.GetObject("RatingImage") as Image; mEmptyRatingImage = resources.GetObject("EmptyRatingImage") as Image; GroupHeaderFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold); ColumnHeaderFont = new Font("Microsoft Sans Serif", 8.25f); mIntegralScroll = false; mItems = new ImageListViewItemCollection(this); MultiSelect = true; mPaneWidth = 240; mRetryOnError = true; mSelectedItems = new ImageListViewSelectedItemCollection(this); mCheckedItems = new ImageListViewCheckedItemCollection(this); mSortColumn = 0; mGroupColumn = 0; mSortOrder = SortOrder.None; mGroupOrder = SortOrder.None; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.Selectable | ControlStyles.UserMouse, true); ScrollBars = true; ShellIconFallback = true; ShellIconFromFileContent = true; Size = new Size(120, 100); mShowCheckBoxes = false; mCheckBoxAlignment = ContentAlignment.BottomRight; mCheckBoxPadding = new Size(2, 2); mShowFileIcons = false; mIconAlignment = ContentAlignment.TopRight; mIconPadding = new Size(2, 2); Text = string.Empty; mThumbnailSize = new Size(96, 96); mUseEmbeddedThumbnails = UseEmbeddedThumbnails.Auto; mUseWIC = UseWIC.Auto; mView = View.Thumbnails; mViewOffset = new Point(0, 0); mShowScrollBars = true; // Child controls hScrollBar = new HScrollBar(); vScrollBar = new VScrollBar(); hScrollBar.Visible = false; vScrollBar.Visible = false; hScrollBar.Scroll += hScrollBar_Scroll; vScrollBar.Scroll += vScrollBar_Scroll; Controls.Add(hScrollBar); Controls.Add(vScrollBar); // Groups groups = new ImageListViewGroupCollection(this); showGroups = false; // Lazy refresh timer lazyRefreshTimer = new System.Timers.Timer(); lazyRefreshTimer.Interval = ImageListViewRenderer.LazyRefreshInterval; lazyRefreshTimer.Enabled = false; lazyRefreshTimer.Elapsed += lazyRefreshTimer_Tick; lazyRefreshCallback = new RefreshDelegateInternal(Refresh); // Helpers layoutManager = new ImageListViewLayoutManager(this); navigationManager = new ImageListViewNavigationManager(this); // Cache nabagers defaultAdaptor = new ImageListViewItemAdaptors.FileSystemAdaptor(); thumbnailCache = new ImageListViewCacheThumbnail(this); shellInfoCache = new ImageListViewCacheShellInfo(this); metadataCache = new ImageListViewCacheMetadata(this); disposed = false; // 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); this.Font = _palette.GetContentShortTextFont(PaletteContentStyle.ButtonStandalone, PaletteState.Normal); }