コード例 #1
0
ファイル: Render.cs プロジェクト: kinghand/KHGraphDB
        public static void DrawEdgeSelected(Graphics g, IEdge e, Font f, PointF pSource, PointF pTarget, int Radius = 5)
        {
            var ps = pSource;
            var pt = pTarget;
            String s = e.AttributesToString();
            SizeF size = g.MeasureString(s, f);
            PointF location = new PointF((pt.X * 2 + 3 * ps.X) / 5 - 4, (pt.Y * 2 + ps.Y * 3) / 5 - 4);
            RectangleF rect = new RectangleF(location, size);
            GraphicsPath roundedRect = GetRoundedRect(rect, Radius);

            g.DrawLine(penHover, ps, pt);
            g.FillEllipse(brushHover, (pt.X + ps.X) / 2 - 2, (pt.Y + ps.Y) / 2 - 2, 4, 4);

            g.FillPath(brushAttrPanel, roundedRect);
            g.DrawPath(penAttrBorder, roundedRect);
            g.DrawString(s, f, brushText, rect);
        }