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?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Software guy
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");
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.