/// <summary> /// Create the view hierarchy for this view mode. /// </summary> protected override void CreateCheckItemView() { // Create a canvas for containing the selected page and put old root inside it _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back, Navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top); _drawGroup.Add(_oldRoot); // Create the view element that lays out the check/tab buttons ViewLayoutBarForTabs layoutBar = new ViewLayoutBarForTabs(Navigator.Bar.ItemSizing, Navigator.Bar.ItemAlignment, Navigator.Bar.BarMultiline, Navigator.Bar.ItemMinimumSize, Navigator.Bar.ItemMaximumSize, Navigator.Bar.BarMinimumHeight, Navigator.Bar.TabBorderStyle, true); _layoutBar = layoutBar; // Create the scroll spacer that restricts display _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar, PaletteMetricPadding.BarPaddingTabs, PaletteMetricInt.CheckButtonGap, Navigator.Bar.BarOrientation, Navigator.Bar.ItemAlignment, Navigator.Bar.BarAnimation); _layoutBarViewport.Add(_layoutBar); // Create the button bar area docker _layoutBarDocker = new ViewLayoutDocker(); _layoutBarDocker.Add(_layoutBarViewport, ViewDockStyle.Fill); // Add a separators for insetting items _layoutBarSeparatorFirst = new ViewLayoutSeparator(0); _layoutBarSeparatorLast = new ViewLayoutSeparator(0); _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left); _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right); // Create the layout that insets the contents to allow for rounding of the group border _layoutOverlap = new ViewLayoutInsetOverlap(_drawGroup); _layoutOverlap.Add(_layoutBarDocker); // Create the docker used to layout contents of main panel and fill with group _layoutPanelDocker = new ViewLayoutDockerOverlap(_drawGroup, _layoutOverlap, layoutBar); _layoutPanelDocker.Add(_layoutOverlap, ViewDockStyle.Top); _layoutPanelDocker.Add(_drawGroup, ViewDockStyle.Fill); // Create the top level panel and put a layout docker inside it _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back); _drawPanel.Add(_layoutPanelDocker); _newRoot = _drawPanel; // Set the correct tab style UpdateTabStyle(); // Must call the base class to perform common actions base.CreateCheckItemView(); }
/// <summary> /// Construct the view appropriate for this builder. /// </summary> /// <param name="navigator">Reference to navigator instance.</param> /// <param name="manager">Reference to current manager.</param> /// <param name="redirector">Palette redirector.</param> public override void Construct(KryptonNavigator navigator, ViewManager manager, PaletteRedirect redirector) { // Let base class perform common operations base.Construct(navigator, manager, redirector); // Get the current root element _oldRoot = ViewManager.Root; // Create a canvas for the background _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back) { // Put the exisint root into the canvas _oldRoot }; // Update the child panel to have panel appearance Navigator.ChildPanel.PanelBackStyle = Navigator.Panel.PanelBackStyle; // Set the correct palettes based on enabled state and selected page UpdateStatePalettes(); // Canvas becomes the new root ViewManager.Root = _drawPanel; // Need to monitor changes in the enabled state Navigator.EnabledChanged += OnEnabledChanged; }
/// <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; }
/// <summary> /// Create the view hierarchy for this view mode. /// </summary> protected override void CreateCheckItemView() { // Create a canvas for containing the selected page and put old root inside it _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back, Navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top) { _oldRoot }; // Create the view element that lays out the check buttons _layoutBar = new ViewLayoutBar(Navigator.StateCommon.Bar, PaletteMetricInt.CheckButtonGap, Navigator.Bar.ItemSizing, Navigator.Bar.ItemAlignment, Navigator.Bar.BarMultiline, Navigator.Bar.ItemMinimumSize, Navigator.Bar.ItemMaximumSize, Navigator.Bar.BarMinimumHeight, false); // Create the scroll spacer that restricts display _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar, PaletteMetricPadding.BarPaddingOutside, PaletteMetricInt.CheckButtonGap, Navigator.Bar.BarOrientation, Navigator.Bar.ItemAlignment, Navigator.Bar.BarAnimation) { _layoutBar }; // Create the button bar area docker _layoutBarDocker = new ViewLayoutDocker { { _layoutBarViewport, ViewDockStyle.Fill } }; // Add a separators for insetting items _layoutBarSeparatorFirst = new ViewLayoutSeparator(0); _layoutBarSeparatorLast = new ViewLayoutSeparator(0); _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left); _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right); // Create the docker used to layout contents of main panel and fill with group _layoutPanelDocker = new ViewLayoutDocker { { _drawGroup, ViewDockStyle.Fill }, { _layoutBarDocker, ViewDockStyle.Top } }; // Create the top level panel and put a layout docker inside it _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back) { _layoutPanelDocker }; _newRoot = _drawPanel; // Must call the base class to perform common actions base.CreateCheckItemView(); }
/// <summary> /// Update the displayed position to reflect a change in selected tab. /// </summary> /// <param name="tabsArea">Tabs area of the </param> /// <param name="drawMinimizedPanel"></param> public void UpdatePosition(ViewLayoutRibbonTabsArea tabsArea, ViewDrawPanel drawMinimizedPanel) { // Move to the newly calculated position Rectangle popupRect = CalculatePopupRect(tabsArea, drawMinimizedPanel); SetBounds(popupRect.X, popupRect.Y, popupRect.Width, popupRect.Height); }
/// <summary> /// Create the view hierarchy for this view mode. /// </summary> protected override void CreateCheckItemView() { // Create the view element that lays out the check buttons _layoutBar = new ViewLayoutBar(Navigator.StateCommon.Bar, PaletteMetricInt.CheckButtonGap, Navigator.Bar.ItemSizing, Navigator.Bar.ItemAlignment, Navigator.Bar.BarMultiline, Navigator.Bar.ItemMinimumSize, Navigator.Bar.ItemMaximumSize, Navigator.Bar.BarMinimumHeight, false); // Create the scroll spacer that restricts display _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar, PaletteMetricPadding.BarPaddingInside, PaletteMetricInt.CheckButtonGap, Navigator.Header.HeaderPositionBar, Navigator.Bar.ItemAlignment, Navigator.Bar.BarAnimation) { _layoutBar }; // Create the button bar area docker _layoutBarDocker = new ViewLayoutDocker { { _layoutBarViewport, ViewDockStyle.Fill } }; // Place the bar inside a header style area _viewHeadingBar = new ViewDrawDocker(Navigator.StateNormal.HeaderGroup.HeaderBar.Back, Navigator.StateNormal.HeaderGroup.HeaderBar.Border, Navigator.StateNormal.HeaderGroup.HeaderBar, PaletteMetricBool.None, PaletteMetricPadding.HeaderGroupPaddingSecondary, VisualOrientation.Top) { { _layoutBarDocker, ViewDockStyle.Fill } }; // Create the docker used to layout contents of main panel and fill with group _layoutPanelDocker = new ViewLayoutDocker { { new ViewLayoutPageHide(Navigator), ViewDockStyle.Fill }, { _viewHeadingBar, ViewDockStyle.Top } }; // Create the top level panel and put a layout docker inside it _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back) { _layoutPanelDocker }; _newRoot = _drawPanel; // Must call the base class to perform common actions base.CreateCheckItemView(); }
/// <summary> /// Create the view hierarchy for this view mode. /// </summary> protected override void CreateCheckItemView() { // Create the view element that lays out the check buttons _layoutBar = new ViewLayoutBar(Navigator.StateCommon.Bar, PaletteMetricInt.RibbonTabGap, Navigator.Bar.ItemSizing, Navigator.Bar.ItemAlignment, Navigator.Bar.BarMultiline, Navigator.Bar.ItemMinimumSize, Navigator.Bar.ItemMaximumSize, Navigator.Bar.BarMinimumHeight, Navigator.Bar.TabBorderStyle, true); // Create the scroll spacer that restricts display _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar, PaletteMetricPadding.BarPaddingTabs, PaletteMetricInt.RibbonTabGap, Navigator.Bar.BarOrientation, Navigator.Bar.ItemAlignment, Navigator.Bar.BarAnimation); _layoutBarViewport.Add(_layoutBar); // Create the button bar area docker _layoutBarDocker = new ViewLayoutDocker(); _layoutBarDocker.Add(_layoutBarViewport, ViewDockStyle.Fill); // Add a separators for insetting items _layoutBarSeparatorFirst = new ViewLayoutSeparator(0); _layoutBarSeparatorLast = new ViewLayoutSeparator(0); _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left); _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right); // Create the docker used to layout contents of main panel and fill with group _layoutPanelDocker = new ViewLayoutDocker(); _layoutPanelDocker.Add(_layoutBarDocker, ViewDockStyle.Fill); _layoutPanelDocker.Add(new ViewLayoutPageHide(Navigator), ViewDockStyle.Top); // Create the top level panel and put a layout docker inside it _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back); _drawPanel.Add(_layoutPanelDocker); _newRoot = _drawPanel; // Must call the base class to perform common actions base.CreateCheckItemView(); }
/// <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; }
private Rectangle CalculatePopupRect(ViewLayoutRibbonTabsArea tabsArea, ViewDrawPanel drawMinimizedPanel) { Size popupSize; // Get the preferred size of the groups area, we only really want the height using (ViewLayoutContext context = new ViewLayoutContext(_ribbon, Renderer)) popupSize = drawMinimizedPanel.GetPreferredSize(context); // The width should default to being the same width as the ribbon control popupSize.Width = _ribbon.Width; // Get the screen rectangles for the ribbon and the tabs area of the ribbon Rectangle parentRibbonRect = _ribbon.RectangleToScreen(_ribbon.ClientRectangle); Rectangle parentTabsRect = _ribbon.RectangleToScreen(tabsArea.ClientRectangle); // Default popup is placed below the ribbon Rectangle popupRect = new Rectangle(parentRibbonRect.X, parentTabsRect.Bottom - 1, popupSize.Width, popupSize.Height); // Get the view element for the currently selected tab ViewDrawRibbonTab viewTab = tabsArea.LayoutTabs.GetViewForRibbonTab(_ribbon.SelectedTab); //!!!!betauser. can crash if (viewTab == null) { return(new Rectangle(0, 0, 0, 0)); } // Convert the view tab client area to screen coordinates Rectangle viewTabRect = _ribbon.RectangleToScreen(viewTab.ClientRectangle); // Get the screen that the tab is mostly within Screen screen = Screen.FromRectangle(viewTabRect); Rectangle workingArea = screen.WorkingArea; workingArea.Width -= BOTTOMRIGHT_GAP; workingArea.Height -= BOTTOMRIGHT_GAP; // Is the right side of the popup extending over the right edge of the screen... if (popupRect.Right > workingArea.Right) { // Reduce width to bring it back onto the screen popupRect.Width -= (popupRect.Right - workingArea.Right); // Enforce a minimum useful width for the popup if (popupRect.Width < MINIMUM_WIDTH) { popupRect.X -= (MINIMUM_WIDTH - popupRect.Width); popupRect.Width = MINIMUM_WIDTH; } } else { // Is the left side of the popup extending over left edge of screen... if (popupRect.Left < workingArea.Left) { // Reduce left side of popup to start at screen left edge int reduce = (workingArea.Left - popupRect.Left); popupRect.Width -= reduce; popupRect.X += reduce; // Enforce a minimum useful width for the popup if (popupRect.Width < MINIMUM_WIDTH) { popupRect.Width = MINIMUM_WIDTH; } } } // If there is not enough room to place the popup below the tabs area if (popupRect.Bottom > workingArea.Bottom) { // Is there enough room above the parent for the entire popup height? if ((parentTabsRect.Top - popupRect.Height) >= workingArea.Top) { // Place the popup above the parent popupRect.Y = parentTabsRect.Top - popupSize.Height; } else { // Cannot show entire popup above or below, find which has most space int spareAbove = parentTabsRect.Top - workingArea.Top; int spareBelow = workingArea.Bottom - parentTabsRect.Bottom; // Place it in the area with the most space if (spareAbove > spareBelow) { popupRect.Y = workingArea.Top; } else { popupRect.Y = parentTabsRect.Bottom; } } } return(popupRect); }
/// <summary> /// Show the minimized popup relative to the tabs area of the ribbon. /// </summary> /// <param name="tabsArea">Tabs area of the </param> /// <param name="drawMinimizedPanel"></param> public void Show(ViewLayoutRibbonTabsArea tabsArea, ViewDrawPanel drawMinimizedPanel) { // Show at the calculated position Show(CalculatePopupRect(tabsArea, drawMinimizedPanel)); }
/// <summary> /// Create the view hierarchy for this view mode. /// </summary> protected override void CreateCheckItemView() { // Create the two headers and header content _viewContentPrimary = new ViewDrawContent(Navigator.StateNormal.HeaderGroup.HeaderPrimary.Content, Navigator.Header.HeaderValuesPrimary, VisualOrientation.Top); _viewHeadingPrimary = new ViewDrawDocker(Navigator.StateNormal.HeaderGroup.HeaderPrimary.Back, Navigator.StateNormal.HeaderGroup.HeaderPrimary.Border, Navigator.StateNormal.HeaderGroup.HeaderPrimary, PaletteMetricBool.None, PaletteMetricPadding.HeaderGroupPaddingPrimary, VisualOrientation.Top); _viewContentSecondary = new ViewDrawContent(Navigator.StateNormal.HeaderGroup.HeaderSecondary.Content, Navigator.Header.HeaderValuesSecondary, VisualOrientation.Top); _viewHeadingSecondary = new ViewDrawDocker(Navigator.StateNormal.HeaderGroup.HeaderSecondary.Back, Navigator.StateNormal.HeaderGroup.HeaderSecondary.Border, Navigator.StateNormal.HeaderGroup.HeaderSecondary, PaletteMetricBool.None, PaletteMetricPadding.HeaderGroupPaddingSecondary, VisualOrientation.Top); // Place the the content as fillers in the headers _viewHeadingPrimary.Add(_viewContentPrimary, ViewDockStyle.Fill); _viewHeadingSecondary.Add(_viewContentSecondary, ViewDockStyle.Fill); // Create a canvas for containing the selected page and put old root inside it _drawGroup = new ViewDrawCanvas(Navigator.StateNormal.HeaderGroup.Back, Navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top) { ApplyIncludeBorderEdge = true }; _drawGroup.Add(_oldRoot); // Create the view element that lays out the check/tab buttons ViewLayoutBarForTabs layoutBar = new ViewLayoutBarForTabs(Navigator.Bar.ItemSizing, Navigator.Bar.ItemAlignment, Navigator.Bar.BarMultiline, Navigator.Bar.ItemMinimumSize, Navigator.Bar.ItemMaximumSize, Navigator.Bar.BarMinimumHeight, Navigator.Bar.TabBorderStyle, true); _layoutBar = layoutBar; // Create the scroll spacer that restricts display _layoutBarViewport = new ViewLayoutViewport(Navigator.StateCommon.Bar, PaletteMetricPadding.BarPaddingTabs, PaletteMetricInt.CheckButtonGap, Navigator.Bar.BarOrientation, Navigator.Bar.ItemAlignment, Navigator.Bar.BarAnimation) { _layoutBar }; // Create the button bar area docker _layoutBarDocker = new ViewLayoutDocker { { _layoutBarViewport, ViewDockStyle.Fill } }; // Add a separators for insetting items _layoutBarSeparatorFirst = new ViewLayoutSeparator(0); _layoutBarSeparatorLast = new ViewLayoutSeparator(0); _layoutBarDocker.Add(_layoutBarSeparatorFirst, ViewDockStyle.Left); _layoutBarDocker.Add(_layoutBarSeparatorLast, ViewDockStyle.Right); // Create the layout that insets the contents to allow for rounding of the group border _layoutOverlap = new ViewLayoutInsetOverlap(_drawGroup) { _layoutBarDocker }; // Create the docker used to layout contents of main panel and fill with group _layoutPanelDocker = new ViewLayoutDockerOverlap(_drawGroup, _layoutOverlap, layoutBar) { { _layoutOverlap, ViewDockStyle.Top }, { _drawGroup, ViewDockStyle.Fill } }; // Place the headers and page holding area into the group _topGroup = new ViewLayoutDocker { { _viewHeadingSecondary, ViewDockStyle.Bottom }, { _viewHeadingPrimary, ViewDockStyle.Top }, { _layoutPanelDocker, ViewDockStyle.Fill } }; // Prevent adjacent headers from having two borders _topGroup.RemoveChildBorders = true; // Create the top level panel and put a layout docker inside it _drawPanel = new ViewDrawPanel(Navigator.StateNormal.Back) { _topGroup }; _newRoot = _drawPanel; // Set initial visible state of headers _viewHeadingPrimary.Visible = Navigator.Header.HeaderVisiblePrimary; _viewHeadingSecondary.Visible = Navigator.Header.HeaderVisibleSecondary; // Set the correct tab style UpdateTabStyle(); // Must call the base class to perform common actions base.CreateCheckItemView(); }
public KryptonListView() { SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor // Cannot get thi sto work (Code removed)!! | ControlStyles.EnableNotifyMessage , true); base.OwnerDraw = true; // We need to repaint entire control whenever resized SetStyle(ControlStyles.ResizeRedraw, true); // Yes, we want to be drawn double buffered by default DoubleBuffered = true; // Default fields _alwaysActive = true; _style = ButtonStyle.ListItem; Padding = new Padding(1); base.BorderStyle = System.Windows.Forms.BorderStyle.None; // We need to create and cache a device context compatible with the display _screenDC = PI.CreateCompatibleDC(IntPtr.Zero); // Set the palette and renderer to the defaults as specified by the manager Redirector = new PaletteRedirect(null); CacheNewPalette(KryptonManager.CurrentGlobalPalette); KryptonManager.GlobalPaletteChanged += OnGlobalPaletteChanged; NeedPaintDelegate = OnNeedPaint; // Create the palette storage Images = new CheckBoxImages(NeedPaintDelegate); _paletteCheckBoxImages = new PaletteRedirectCheckBox(Redirector, Images); StateCommon = new PaletteListStateRedirect(Redirector, PaletteBackStyle.InputControlStandalone, PaletteBorderStyle.InputControlStandalone, NeedPaintDelegate); OverrideFocus = new PaletteListItemTripleRedirect(Redirector, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, NeedPaintDelegate); StateDisabled = new PaletteListState(StateCommon, NeedPaintDelegate); StateActive = new PaletteDouble(StateCommon, NeedPaintDelegate); StateNormal = new PaletteListState(StateCommon, NeedPaintDelegate); StateTracking = new PaletteListItemTriple(StateCommon.Item, NeedPaintDelegate); StatePressed = new PaletteListItemTriple(StateCommon.Item, NeedPaintDelegate); StateCheckedNormal = new PaletteListItemTriple(StateCommon.Item, NeedPaintDelegate); StateCheckedTracking = new PaletteListItemTriple(StateCommon.Item, NeedPaintDelegate); StateCheckedPressed = new PaletteListItemTriple(StateCommon.Item, NeedPaintDelegate); // Create manager and view for drawing the background ViewDrawPanel = new ViewDrawPanel(StateNormal.Back); // Create the override handling classes _overrideNormal = new PaletteTripleOverride(OverrideFocus.Item, StateNormal.Item, PaletteState.FocusOverride); _overrideTracking = new PaletteTripleOverride(OverrideFocus.Item, StateTracking.Item, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(OverrideFocus.Item, StatePressed.Item, PaletteState.FocusOverride); _overrideCheckedNormal = new PaletteTripleOverride(OverrideFocus.Item, StateCheckedNormal.Item, PaletteState.FocusOverride); _overrideCheckedTracking = new PaletteTripleOverride(OverrideFocus.Item, StateCheckedTracking.Item, PaletteState.FocusOverride); _overrideCheckedPressed = new PaletteTripleOverride(OverrideFocus.Item, StateCheckedPressed.Item, PaletteState.FocusOverride); // Create the check box image drawer and place inside element so it is always centered _drawCheckBox = new ViewDrawCheckBox(_paletteCheckBoxImages); _layoutCheckBox = new ViewLayoutCenter { _drawCheckBox }; _layoutCheckBoxAfter = new ViewLayoutSeparator(3, 0); _layoutCheckBoxStack = new ViewLayoutStack(true) { _layoutCheckBox, _layoutCheckBoxAfter }; // 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) { _layoutImageCenter, _layoutImageAfter }; _layoutImageState = new ViewLayoutSeparator(16, 16); _layoutImageCenterState = new ViewLayoutCenter(_layoutImageState); // Create the draw element for owner drawing individual items _contentValues = new ShortTextValue(); _drawButton = new ViewDrawButton(StateDisabled.Item, _overrideNormal, _overrideTracking, _overridePressed, _overrideCheckedNormal, _overrideCheckedTracking, _overrideCheckedPressed, new PaletteMetricRedirect(Redirector), _contentValues, VisualOrientation.Top, false); // Place check box on the left and the label in the remainder _layoutDockerTile = new ViewLayoutDocker { { _layoutImageStack, ViewDockStyle.Left }, { _layoutImageCenterState, ViewDockStyle.Left }, { _layoutCheckBoxStack, ViewDockStyle.Left }, { _drawButton, ViewDockStyle.Fill } }; _layoutDockerSmall = new ViewLayoutDocker { { _drawButton, ViewDockStyle.Left }, { _layoutImageStack, ViewDockStyle.Left }, { _layoutImageCenterState, ViewDockStyle.Left }, { _layoutCheckBoxStack, ViewDockStyle.Left } }; // Place check box on the left and the text to match the width _layoutDockerCheckLarge = new ViewLayoutDocker { { _layoutImageStack, ViewDockStyle.Left }, { _layoutImageCenterState, ViewDockStyle.Left }, { _layoutCheckBoxStack, ViewDockStyle.Left }, { _drawButton, ViewDockStyle.Bottom } }; // Create the element that fills the remainder space and remembers fill rectangle _layoutFill = new ViewLayoutFill(this) { DisplayPadding = new Padding(1) }; // Create inner view for placing inside the drawing docker _drawDockerInner = new ViewLayoutDocker { { _layoutFill, ViewDockStyle.Fill } }; // Create view for the control border and background _drawDockerOuter = new ViewDrawDocker(StateNormal.Back, StateNormal.Border) { { _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); StateCommon.Item.Content.ShortText.MultiLine = InheritBool.True; StateCommon.Item.Content.ShortText.MultiLineH = PaletteRelativeAlign.Center; StateCommon.Item.Content.ShortText.TextH = PaletteRelativeAlign.Center; }