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?

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");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.