Ejemplo n.º 1
0
        //点击等效果到这里修改
        public void RenderComponentBounds(Graphics g)
        {
            bool  LeftJagged = false, RightJagged = false;
            Color ComponentColor = Setting.COMPONENTNORMALCOLOR;

            if (this.Component.RuntimeMessageLevel == GH_RuntimeMessageLevel.Error)
            {
                ComponentColor = Setting.COMPONENTERRORCOLOR;
            }
            if (this.Component.RuntimeMessageLevel == GH_RuntimeMessageLevel.Warning)
            {
                ComponentColor = Setting.COMPONENTWARNINGCOLOR;
            }
            if (this.Component.Attributes.Selected)
            {
                ComponentColor = Setting.COMPONENTSELECTCOLOR;
            }
            if (this.Component.Locked)
            {
                ComponentColor = Setting.COMPONENTLOCKCOLOR;
            }

            RectangleF Bounds = this.Component.Attributes.Bounds;

            if (IsComponent)
            {
                if (this.Component.Params.Output.Count == 0)
                {
                    RightJagged = true;
                }
                if (this.Component.Params.Input.Count == 0)
                {
                    LeftJagged = true;
                }
            }

            float Extend_Width = Setting.EXTEND_WIDTH;

            float      Pos_X = Bounds.X - Extend_Width / 2;
            SizeF      SizeF = new SizeF(Bounds.Width + Extend_Width, Bounds.Height);
            RectangleF RectF = new RectangleF(new PointF(Pos_X, Bounds.Y), SizeF);

            GraphicsPath Path = GH_CapsuleRenderEngine.CreateJaggedRectangle(RectF, 2, 2, 2, 2, LeftJagged, RightJagged);

            g.DrawPath(new Pen(Color.Black), Path);

            SolidBrush Brush = new SolidBrush(ComponentColor);

            g.FillPath(Brush, Path);

            // g.DrawRectangle(new Pen(Color.Red),GH_Convert.ToRectangle(Bounds));
        }