コード例 #1
0
        public override void Draw(Graphics graphics)
        {
            if (graphics == null)
            {
                throw new ArgumentNullException("graphics");
            }

            Rectangle rect = new Rectangle(this.ClientRectangle.Left, this.ClientRectangle.Top,
                                           this.ClientRectangle.Right - 1,
                                           this.ClientRectangle.Bottom - 1);
//			backgroundShape.FillShape(graphics,
//			                new SolidFillPattern(this.BackColor),
//			                rect);

            Border b = new Border(new BaseLine(this.ForeColor, System.Drawing.Drawing2D.DashStyle.Solid, 1));
//			DrawFrame(graphics,b);
            BaseLine line = new BaseLine(base.ForeColor, DashStyle, Thickness, LineCap.Round, LineCap.Round, DashCap.Round);

            using (Pen pen = line.CreatePen(line.Thickness)){
                shape.CornerRadius = this.CornerRadius;
                GraphicsPath path1 = shape.CreatePath(rect);
                graphics.DrawPath(pen, path1);
            }

//			shape.DrawShape (graphics,
//			                 this.Baseline(),
//			                 rect);
        }
コード例 #2
0
 public void RectangleThrow()
 {
     RectangleShape ls   = new RectangleShape();
     Point          from = new Point(1, 1);
     Point          to   = new Point(10, 10);
     GraphicsPath   p    = ls.CreatePath(from, to);
 }
コード例 #3
0
        public void CheckLastPointFromPath()
        {
            RectangleShape ls   = new RectangleShape();
            Point          from = new Point(1, 1);
            Size           size = new Size(10, 10);
            Rectangle      rect = new Rectangle(from, size);
            GraphicsPath   p    = ls.CreatePath(rect);
            PointF         last = p.GetLastPoint();

            Assert.AreEqual(new Point(from.X, from.Y + size.Height), Point.Truncate(last));
        }
コード例 #4
0
        public void CheckGraphicsPathBounds()
        {
            RectangleShape ls   = new RectangleShape();
            Point          from = new Point(1, 1);
            Size           size = new Size(10, 10);
            Rectangle      rect = new Rectangle(from, size);
            GraphicsPath   p    = ls.CreatePath(rect);
            RectangleF     r    = p.GetBounds();

            Assert.AreEqual(from.X, r.Left);
            Assert.AreEqual(from.Y, r.Top);
            Assert.AreEqual(r.Size.Width + from.X, r.Right);
            Assert.AreEqual(r.Size.Height + from.Y, r.Bottom);
        }