示例#1
0
 public void Draw(Graphics g, Color color)
 {
     using (Pen pen = new Pen(color, 2))
     {
         // 画框选的矩形
         Rectangle t = new Rectangle(PLT.X, PLT.Y, CaptureWidth, CaptureHeight);
         g.DrawRectangle(pen, t);
         // 画8个点
         using (Brush br = new SolidBrush(color))
         {
             g.FillRectangle(br, CaptureRectangle.Point2FlagPoint(PL));
             g.FillRectangle(br, CaptureRectangle.Point2FlagPoint(PT));
             g.FillRectangle(br, CaptureRectangle.Point2FlagPoint(PR));
             g.FillRectangle(br, CaptureRectangle.Point2FlagPoint(PB));
             g.FillRectangle(br, CaptureRectangle.Point2FlagPoint(PLT));
             g.FillRectangle(br, CaptureRectangle.Point2FlagPoint(PRT));
             g.FillRectangle(br, CaptureRectangle.Point2FlagPoint(PRB));
             g.FillRectangle(br, CaptureRectangle.Point2FlagPoint(PLB));
         }
     }
 }
示例#2
0
        public static void Draw(Graphics g, Brush forceBrush, Brush backBrush, Font font, CaptureRectangle target)
        {
            var info     = $"{target.CaptureWidth} x {target.CaptureHeight}";
            var infoSize = g.MeasureString(info, font);

            g.FillRectangle(backBrush, target.PLT.X, target.PLT.Y - infoSize.Height - Padding * 2 - MarginBottom, infoSize.Width + Padding * 2, infoSize.Height + Padding * 2);
            g.DrawString(info, font, forceBrush, target.PLT.X + Padding, target.PLT.Y - infoSize.Height - MarginBottom - Padding);
        }