Exemplo n.º 1
0
        /// <exception cref="ArgumentNullException">
        /// <paramref name="parentNode"/> is null.-or-
        /// <paramref name="operation"/> is null.
        /// </exception>
        protected TreeNode CreateOperationNode(TreeNode parentNode, Operation operation)
        {
            if (parentNode == null)
            {
                throw new ArgumentNullException("parentNode");
            }
            if (operation == null)
            {
                throw new ArgumentNullException("operation");
            }

            TreeNode child      = parentNode.Nodes.Add(operation.GetCaption());
            int      imageIndex = Icons.GetImageIndex(operation);

            child.Tag                = operation;
            child.ImageIndex         = imageIndex;
            child.SelectedImageIndex = imageIndex;
            child.ToolTipText        = operation.ToString();

            return(child);
        }
Exemplo n.º 2
0
        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);
            }
        }