private void DrawMember(Graphics g, Member member, Rectangle record, Style style)
        {
            Font memberFont = GetMemberFont(member, style);

            if (member is Field)
            {
                memberBrush.Color = style.AttributeColor;
            }
            else
            {
                memberBrush.Color = style.OperationColor;
            }

            if (style.UseIcons)
            {
                Image icon = Icons.GetImage(member);
                g.DrawImage(icon, record.X, record.Y, icon.Width, icon.Height);

                Rectangle textBounds = new Rectangle(
                    record.X + IconSpacing, record.Y,
                    record.Width - IconSpacing, record.Height);

                string memberString = GetMemberString(member);
                g.DrawString(memberString, memberFont, memberBrush, textBounds, memberFormat);
            }
            else
            {
                Rectangle accessBounds = new Rectangle(
                    record.X, record.Y, AccessSpacing, record.Height);
                Rectangle textBounds = new Rectangle(
                    record.X + AccessSpacing, record.Y,
                    record.Width - AccessSpacing, record.Height);

                g.DrawString(GetAccessString(member), GetFont(style),
                             memberBrush, accessBounds, accessFormat);
                g.DrawString(GetMemberString(member), memberFont,
                             memberBrush, textBounds, memberFormat);
            }
        }
Exemple #2
0
        private void DrawMember(Graphics g, float height, Member member)
        {
            if (member == null)
            {
                return;
            }

            int  marginSize = Style.CurrentStyle.MarginSize;
            Font memberFont;

            if (member.IsStatic)
            {
                memberFont = StaticFont;
            }
            else if (member is Operation &&
                     ((Operation)member).Modifier == OperationModifier.Abstract)
            {
                memberFont = AbstractFont;
            }
            else
            {
                memberFont = Font;
            }

            if (member is Field)
            {
                memberBrush.Color = Style.CurrentStyle.AttributeColor;
            }
            else
            {
                memberBrush.Color = Style.CurrentStyle.OperationColor;
            }

            if (Style.CurrentStyle.UseIcons)
            {
                float fontHeight   = memberFont.GetHeight(g);
                float iconHeight   = Icons.IconSize.Height;
                float recordHeight = Math.Max(fontHeight, iconHeight);

                if (fontHeight > iconHeight)
                {
                    g.DrawImage(Icons.GetImage(member),
                                new PointF(marginSize, height + (int)((fontHeight - iconHeight) / 2)));
                }
                else
                {
                    g.DrawImage(Icons.GetImage(member), new PointF(marginSize, height));
                }

                g.DrawString(GetMemberString(member), memberFont, memberBrush,
                             new PointF(marginSize + Icons.IconSize.Width + IconSpacing,
                                        height + (float)Math.Ceiling((recordHeight - fontHeight) / 2)));
            }
            else
            {
                SizeF fontSize   = g.MeasureString("+", Font, PointF.Empty, accessFormat);
                float leftMargin = fontSize.Width;

                g.DrawString(GetAccessString(member), Font, memberBrush,
                             new PointF(marginSize + leftMargin / 2, height), accessFormat);

                g.DrawString(GetMemberString(member), memberFont, memberBrush,
                             new PointF(marginSize + leftMargin, height));
            }
        }