I'm working on a project , where i need to create user friendly rectangles on top of the image , i'm able to draw rectangles now on top of the image , but i'm not getting about how to calculate required rectangles for a image , Image size may vary , for example if an image size is 675*1200 , i want to draw 48 rectangles on it and if i alter one rectangle , it should alter all the other rectangles .
currently i'm getting multiple rectangles on image and re sizable, but i want those in order and they alter the dimensions at a single time .
int j = pictureBox1.Location.X;
int k = pictureBox1.Location.Y;
int imagewidth = pictureBox1.Image.Size.Width;
int imageheight = pictureBox1.Image.Size.Height;
System.Drawing.Image img = System.Drawing.Image.FromFile(@"C:li.jpg");
MessageBox.Show("Width: " + img.Width + ", Height: " + img.Height);
var size = pictureBox1.ClientSize;
// private bool _once = true; 600*400 = 2400 , X=12,Y=12 .
for ( k = 13; k <= 2400; k++)
{
k = k - 1;
//Userrect class
rect = new UserRect(new Rectangle(j, k, 266, 266));
// Added to list
listRec.Add(rect.rect);
rect.SetPictureBox(this.pictureBox1);
//i = i + 20;
//j = j + 12;
k = k + 266;
}
