public override void Draw(Graphics graphics, Rectangle itemRect, PropertyVisibleDeepEnumerator enumSelf) { Rectangle rect = itemRect; rect.X += ParentGrid.LeftColumnWidth + 1; rect.Width -= ParentGrid.LeftColumnWidth + 1; // Draw a background //------------------ Rectangle labelRect = GetLabelTextRect(itemRect, enumSelf); ParentGrid.DrawManager.DrawSubCategoryLabelBackground(graphics, labelRect.Left, rect, enumSelf); // Draw the vertical separation between the columns and the bottom horizontal line //-------------------------------------------------------------------------------- Rectangle labelColumnRect = GetLabelColumnRect(itemRect, enumSelf); ParentGrid.DrawManager.DrawSeparationLines(graphics, itemRect, labelColumnRect, enumSelf); // Choose the colors of the text regarding the item selection Color textColor; if (Selected) { if (ParentGrid.GridContainsFocus) { textColor = ParentGrid.HighlightedTextColor; } else { textColor = ForeColor; } } else // if not selected { textColor = ForeColor; } // Draw the image if any //---------------------- Win32Calls.SetClippingRect(graphics, labelColumnRect); Rectangle imgRect = GetImageRect(itemRect, enumSelf); if (imgRect != Rectangle.Empty) { ParentGrid.DrawImage(ImageIndex, graphics, imgRect.Left, imgRect.Top); } // Draw the category label //------------------------ ParentGrid.DrawManager.DrawSubCategoryLabelText(graphics, labelRect, textColor, enumSelf); // Draw the +/- sign //------------------ if (ParentGrid.HasOneVisibleChild(enumSelf)) { ParentGrid.DrawManager.DrawPlusMinusSign(graphics, ParentGrid.Grid, itemRect, enumSelf); } // Draw checkbox used to be able to manually disable/enable this category //----------------------------------------------------------------------- if (CanBeDisabledManually) { Rectangle frameRect = GetManuallyDisableRect(itemRect, enumSelf); ParentGrid.DrawManager.DrawCheckBox(graphics, ParentGrid.Grid, frameRect, GetManuallyDisabledVariable(), !ParentGrid.Grid.IsAncestorDisabled(enumSelf)); } Win32Calls.ResetClippingRect(graphics); // Draw value text if any //----------------------- if (ValueText.Length > 0) { Rectangle valueRect = itemRect; int delta = ParentGrid.LeftColumnWidth + 1 + ParentGrid.LabelColumnWidth; valueRect.X += delta; valueRect.Width -= delta; valueRect.Inflate(-ParentGrid.GlobalTextMargin, 0); ParentGrid.DrawManager.DrawCategoryValue(graphics, valueRect, textColor, enumSelf); } }
public virtual void Draw(Graphics graphics, Rectangle itemRect, PropertyVisibleDeepEnumerator enumSelf) { Color textColor; Color valueColor; // Choose the colors of the background and text regarding the item selection if (Selected) { if (!ParentGrid.Enabled && (ParentGrid.DisableMode != PropertyGrid.DisableModes.None) && ParentGrid.DisableModeGrayedOut) { valueColor = _grid.DisabledForeColor; } else { if (Enabled == false) { valueColor = Value.DisabledForeColor; } else { if (Value.ReadOnly) { valueColor = Value.ReadOnlyForeColor; } else { valueColor = Value.ForeColor; } } } if ((ParentGrid.GridContainsFocus) || (InPlaceCtrlInAction != null)) { textColor = ParentGrid.HighlightedTextColor; } else { textColor = ForeColor; } } else // if not selected { if ((!ParentGrid.Enabled && (ParentGrid.DisableMode != PropertyGrid.DisableModes.None)) && ParentGrid.DisableModeGrayedOut) { textColor = _grid.DisabledForeColor; valueColor = _grid.DisabledForeColor; } else { if (Enabled == false) { /* if (Value.ReadOnly && (ParentGrid.ReadOnlyVisual == PropertyGrid.ReadOnlyVisuals.ReadOnlyFeel)) * { * valueColor = Value.ReadOnlyForeColor; * textColor = ReadOnlyForeColor; * } * else*/ { valueColor = Value.DisabledForeColor; textColor = DisabledForeColor; } } else { if (Value.ReadOnly) { valueColor = Value.ReadOnlyForeColor; textColor = ReadOnlyForeColor; } else { textColor = ForeColor; valueColor = Value.ForeColor; } } } } // Draw the label background //-------------------------- Rectangle rect = itemRect; rect.X += ParentGrid.LeftColumnWidth + 1; rect.Width = ParentGrid.LabelColumnWidth; ParentGrid.DrawManager.DrawPropertyLabelBackground(graphics, rect, enumSelf); // Draw the +/- sign if needed //---------------------------- if (ParentGrid.HasOneVisibleChild(enumSelf)) { ParentGrid.DrawManager.DrawPlusMinusSign(graphics, ParentGrid.Grid, itemRect, enumSelf); } // Draw checkbox used to be able to manually disable/enable this property //----------------------------------------------------------------------- if (CanBeDisabledManually) { Rectangle frameRect = GetManuallyDisableRect(itemRect, enumSelf); ParentGrid.DrawManager.DrawCheckBox(graphics, ParentGrid.Grid, frameRect, GetManuallyDisabledVariable(), !ParentGrid.Grid.IsAncestorDisabled(enumSelf)); } // Draw the value background //-------------------------- Rectangle valueRect = GetValueRect(itemRect); ParentGrid.DrawManager.DrawPropertyValueBackground(graphics, valueRect, enumSelf); // Draw the vertical separation between the columns and the bottom horizontal line //-------------------------------------------------------------------------------- Rectangle labelColumnRect = GetLabelColumnRect(itemRect, enumSelf); ParentGrid.DrawManager.DrawSeparationLines(graphics, itemRect, labelColumnRect, enumSelf); // Draw label text //---------------- // Draw icon if any Rectangle imgRect = GetImageRect(itemRect, enumSelf); if (imgRect != Rectangle.Empty) { Win32Calls.SetClippingRect(graphics, labelColumnRect); ParentGrid.DrawImage(ImageIndex, graphics, imgRect.Left, imgRect.Top); Win32Calls.ResetClippingRect(graphics); } Rectangle labelRect = GetLabelTextRect(itemRect, enumSelf); ParentGrid.DrawManager.DrawPropertyLabelText(graphics, labelRect, textColor, enumSelf); // Draw value //----------- // The height must be the same than the one assigned to inplace controls valueRect.Height--; Value.DrawValue(graphics, valueRect, valueColor, enumSelf, null); }