-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawRectangle.cs
More file actions
34 lines (29 loc) · 1.08 KB
/
DrawRectangle.cs
File metadata and controls
34 lines (29 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace AutoPickingSys
{
class DrawRectangle
{
public Bitmap DraRect(Bitmap b, int x, int y, int w, int h)
{
Bitmap dstImage = (Bitmap)b.Clone();
//using (Graphics g = Graphics.FromImage(dstImage))
//{
// g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
// g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
// g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
// Pen _penRed = new Pen(Color.Red);
// g.DrawRectangle(_penRed, x, y, w, h);
// g.Dispose();
//}
Graphics g = Graphics.FromImage(dstImage);
Pen _penRed = new Pen(Color.Red);
g.DrawRectangle(_penRed, x, y, w, h);
g.Dispose();
return dstImage;
}
}
}