Esempio n. 1
0
        public override void DrawToGraphics(Graphics graphics)
        {
            Brush      pthGrBrush  = Brushes.Black;
            Pen        pen         = Pens.Black;
            RectangleF EllipseFill = new RectangleF(AbsoluteX - 2, AbsoluteY - 2, 24, 24);

            GraphicsPath path = new GraphicsPath();

            path.AddEllipse(EllipseFill);

            Brush TextColor = Brushes.Black;

            switch (this.CurrentState)
            {
            case ItemState.Free:
                pthGrBrush = new SolidBrush(ColorDefinition.GetColorToFillState());
                //pen = new Pen(ColorDefinition.GetColorWhenFree());
                break;

            case ItemState.Hover:
                pthGrBrush = new SolidBrush(ColorDefinition.GetColorWhenHover());
                //pen = new Pen(ColorDefinition.GetColorWhenFree());
                TextColor = Brushes.White;
                break;

            case ItemState.Selected:
                pthGrBrush = new SolidBrush(ColorDefinition.GetColorWhenSelected());
                //pen = new Pen(ColorDefinition.GetColorWhenFree());
                break;
            }

            graphics.FillEllipse(pthGrBrush, EllipseFill);
            graphics.DrawEllipse(pen, EllipseFill);

            if (initialState)
            {
                EllipseFill = new RectangleF(AbsoluteX + 1, AbsoluteY + 1, 18, 18);
                graphics.DrawEllipse(Pens.Black, EllipseFill);
            }

            this.labelItems.labels.Clear();
            this.labelItems.colors.Clear();

            Color color = Color.Black;

            switch (this.CurrentState)
            {
            case ItemState.Hover:
                color = ColorDefinition.GetColorWhenHover();
                break;

            case ItemState.Selected:
                color = ColorDefinition.GetColorWhenSelected();
                break;
            }
            if (this.CurrentState == ItemState.Free)
            {
                color = ColorDefinition.GetColorOfName();
            }
            this.labelItems.labels.Add(Name);
            this.labelItems.colors.Add(color);

            if (!string.IsNullOrEmpty(Name))
            {
                string invariant = GetInvariantPart();
                if (this.CurrentState == ItemState.Free)
                {
                    color = ColorDefinition.GetColorOfInvariant();
                }

                this.labelItems.labels.Add(invariant);
                this.labelItems.colors.Add(color);
            }

            this.labelItems.DrawToGraphics(graphics);


            if (IsUrgent)
            {
                RectangleF rect = new RectangleF(this.AbsoluteX + margin, this.AbsoluteY + margin, 24, 24);
                graphics.DrawString("U", TitleFont, TextColor, rect);
            }
            else if (IsCommitted)
            {
                RectangleF rect = new RectangleF(this.AbsoluteX + margin, this.AbsoluteY + margin, 24, 24);
                graphics.DrawString("C", TitleFont, TextColor, rect);
            }
            else if (IsError)
            {
                RectangleF rect = new RectangleF(this.AbsoluteX + margin, this.AbsoluteY + margin, 24, 24);
                graphics.DrawString("E", TitleFont, TextColor, rect);
            }

            //base.DrawToGraphics(graphics);
            DrawDecorators(graphics);
        }