I am drawing lines on a background image in a c# panel. The panel is anchored to the form so as the form resizes the panel resizes. The background image is set to be stretched so all you see as you resize the form is the background image.
My initial problem: The lines drawn on the panel (via the OnPaint event) stay where they were originally drawn as the image resizes.
My current solution: Record the location of the line and redraw it on a new bitmap by scaling the X and Y coordinates (works fine).
My new problem: As you continually resize the window and draw lines you can't calculate the scaling factor from any point in time and apply it to all lines since the lines were originall drawn in different size images.
The two options I think I have: After I redraw the line go through my array of lines and update the coordinate information so it now matches the current scale. Or In addition to storing the coordinate information of the line also store the size information of the panel at the time it was drawn so I can always calculate the scale for each line based on when it was drawn and the new panel size.
What I'm hoping for: If you have thoughts on either of the two approaches that would be greatly appreciated....Even better would be to point me in the direction of a far better method to do this (I am fairly new to graphics processing in c#).