views:

364

answers:

1

I'm drawing images on panel controls. Changing zoom factor changes the size of panel control (which should stretch the image accordingly). With zoom factors greater then 1 (ie, 2,4,8) a small part of panel begins to show (testing shows that it is the background color of the panel) and grows along with the zoom factor.

  • Panel control borders are set to none.
  • Panel size is always the power of 2 (ie 64,256...).
  • Original image size is always the power of 2 (ie 64,256...).
  • Destination rectangle of the draw method is set to panel width and height.

Any thoughts?

A: 

Without knowing more about your implementation, it's difficult to explain why you're seeing what you're seeing.

Perhaps this article will help:

http://www.bobpowell.net/zoompicbox.htm

Chris Dunaway
I'm taking a list of panels and placing them in a grid (using tableLayout control). Upon creating a panel an image is assigned to it and drawn over it (using panel size). Whenever there's a change in zoom I change the size of each panel. This should in theory stretch the overlay image accordingly. In practice however a small part (edge) of the panel is visible whenever panels are scaled beyond 1 to 1 ratio.
Goran