Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var recHeight = Convert.ToInt32(img.Height * 0.23);
- var recWidth = Convert.ToInt32(img.Width * 0.33);
- var posH = Convert.ToInt32((img.Height - recHeight) / 2);
- var posW = Convert.ToInt32((img.Width - recWidth) / 2);
- Rectangle rec = new Rectangle(posH, posW, recWidth, recHeight);
- Bitmap bmp = new Bitmap(rec.Width, rec.Height);
- using (Graphics gph = Graphics.FromImage(img))
- {
- Pen pen = new Pen(Color.Red);
- gph.DrawRectangle(pen, rec);
- }
Add Comment
Please, Sign In to add comment