Exemplo n.º 1
0
        public override void OnPaintShape(Microsoft.VisualStudio.Modeling.Diagrams.DiagramPaintEventArgs e)
        {
            //Determine colors for different table types
            var entity    = this.ModelElement as Entity;
            var textColor = TABLE_COLOR_NORMAL_TEXT;
            var newColor  = TABLE_COLOR_NORMAL_HEADER;

            if (entity.TypedEntity != TypedEntityConstants.None)
            {
                newColor  = TABLE_COLOR_TYPE_TABLE_HEADER;
                textColor = TABLE_COLOR_TYPE_TABLE_TEXT;
            }
            else if (entity.IsAssociative)
            {
                newColor  = TABLE_COLOR_ASS_TABLE_HEADER;
                textColor = TABLE_COLOR_ASS_TEXT;
            }

            var timer = new System.Diagnostics.Stopwatch();

            timer.Start();
            if (this.FillColor != newColor)
            {
                this.SetFillColorValue(newColor);
            }
            if (this.TextColor != textColor)
            {
                this.SetTextColorValue(textColor);
            }

            timer.Stop();
            System.Diagnostics.Debug.WriteLine(timer.ElapsedMilliseconds + "ms");

            base.OnPaintShape(e);
        }
        public override void OnPaintShape(Microsoft.VisualStudio.Modeling.Diagrams.DiagramPaintEventArgs e)
        {
            // Check if we have to override colors.
            if (!IsColorThemeSet)
            {
                SetColorTheme();
            }

            base.OnPaintShape(e);

            if (e.View != null)
            {
                // If the shape is in the EmphasizedShapes list, draw the emphasis shape around the shape.
                var diagram = Diagram as ConfigurationSectionDesignerDiagram;
                if (diagram.EmphasizedShapes.Contains(new DiagramItem(this)))
                {
                    ShapeGeometry.DoPaintEmphasis(e, this);
                }
            }
        }