Exemplo n.º 1
0
        public virtual Rectangle GetSignRect(Rectangle itemRect, PropertyEnumerator enumSelf)
        {
            if (ParentGrid.HasOneVisibleChild(enumSelf) == false)
            {
                return(Rectangle.Empty);
            }

            Rectangle signRect = itemRect;

            signRect.Y     += signRect.Height / HeightMultiplier / 2 - 4;
            signRect.Height = TreeGlyphWidth;

            signRect.X     = ParentGrid.LeftColumnWidth + 1 + (enumSelf.Depth - 1) * (_grid.GlobalTextMargin + TreeGlyphWidth) + _grid.GlobalTextMargin;
            signRect.Width = TreeGlyphWidth;

            return(signRect);
        }
Exemplo n.º 2
0
        public override Rectangle GetSignRect(Rectangle itemRect, PropertyEnumerator enumSelf)
        {
            if (ParentGrid.HasOneVisibleChild(enumSelf) == false)
            {
                return(Rectangle.Empty);
            }

            Rectangle signRect = itemRect;

            // Default rectangle in the left most column for root categories
            signRect.Y     += itemRect.Height / 2 - (TreeGlyphWidth / 2);
            signRect.Height = TreeGlyphWidth;

            signRect.X     = ParentGrid.LeftColumnWidth + 1 + (enumSelf.Depth - 1) * (ParentGrid.GlobalTextMargin + TreeGlyphWidth) + ParentGrid.GlobalTextMargin;
            signRect.Width = TreeGlyphWidth;

            return(signRect);
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
        }