コード例 #1
0
        protected void PaintIndentExpandButton(Graphics g, GroupedPropertyEditor childGroup)
        {
            if (childGroup.headerHeight == 0)
            {
                return;
            }
            if ((childGroup.Hints & HintFlags.HasExpandCheck) == HintFlags.None)
            {
                return;
            }

            Rectangle indentExpandRect = new Rectangle(childGroup.Location.X - this.indent, childGroup.Location.Y, this.indent, childGroup.headerHeight);
            Rectangle expandButtonRect = new Rectangle(
                indentExpandRect.X + indentExpandRect.Width / 2 - ControlRenderer.ExpandNodeSize.Width / 2,
                indentExpandRect.Y + indentExpandRect.Height / 2 - ControlRenderer.ExpandNodeSize.Height / 2 - 1,
                ControlRenderer.ExpandNodeSize.Width,
                ControlRenderer.ExpandNodeSize.Height);
            ExpandNodeState expandState = ExpandNodeState.OpenedDisabled;

            if (childGroup.Enabled && childGroup.CanExpand && (childGroup.Hints & HintFlags.ExpandEnabled) != HintFlags.None)
            {
                if (!childGroup.Expanded)
                {
                    if (childGroup.expandCheckPressed)
                    {
                        expandState = ExpandNodeState.ClosedPressed;
                    }
                    else if (childGroup.expandCheckHovered)
                    {
                        expandState = ExpandNodeState.ClosedHot;
                    }
                    else if (childGroup.Focused)
                    {
                        expandState = ExpandNodeState.ClosedHot;
                    }
                    else
                    {
                        expandState = ExpandNodeState.ClosedNormal;
                    }
                }
                else
                {
                    if (childGroup.expandCheckPressed)
                    {
                        expandState = ExpandNodeState.OpenedPressed;
                    }
                    else if (childGroup.expandCheckHovered)
                    {
                        expandState = ExpandNodeState.OpenedHot;
                    }
                    else if (childGroup.Focused)
                    {
                        expandState = ExpandNodeState.OpenedHot;
                    }
                    else
                    {
                        expandState = ExpandNodeState.OpenedNormal;
                    }
                }
            }
            else
            {
                if (childGroup.Expanded)
                {
                    expandState = ExpandNodeState.OpenedDisabled;
                }
                else
                {
                    expandState = ExpandNodeState.ClosedDisabled;
                }
            }

            ControlRenderer.DrawExpandNode(g, expandButtonRect.Location, expandState);
        }