We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,780 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Draw rectangle in an image

I have a picturebox. There i am showing an image. Now i want to draw a rectangle in that picturebox and get the position of the rectangle.
So i can crop an image. this i can do already. Only need the position of the rectangle.

Can anybody help me?

2
Contributors
1
Reply
1 Day
Discussion Span
2 Years Ago
Last Updated
2
Views
ITStrawberry
Newbie Poster
10 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I have a picturebox. There i am showing an image. Now i want to draw a rectangle in that picturebox and get the position of the rectangle.
So i can crop an image. this i can do already. Only need the position of the rectangle.

Can anybody help me?

Hi,
As you have not posted even a small part of the code. It is really hard for me or anyone to understand how exactly you want to draw a rectangle. But as you said its a pictureBox so i assume you are working close to Windows forms.So I have written this code which can help you to manipulate Images. I hope this helps, if not post your code so it is possible to see how you are approaching to solve this problem. :)

System::Drawing::Bitmap^ BM;
     		 System::Drawing::Color C;

		 BM = (System::Drawing::Bitmap^) Image::FromFile("pic.jpg");

		 int i,j;

				 for(j=20;j<=25;j++)
				 {
				      for(i = 30;i<=100;i++)
				      {
					BM->SetPixel(i,j,C.White);
				 
				      }
				 }

				 BM->Save("pic2.jpg");
Software guy
Junior Poster
165 posts since May 2008
Reputation Points: 16
Solved Threads: 19
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0839 seconds using 2.73MB