I am using a scrolled window to view an image that is too large to fit on the screen. I do this by binding a function to wx.EVT_ERASE_BACKGROUND of the scrolled window that calls a function with dc = event.GetDC(), PrepareDC, and DrawBitmap. Let’s say I have a 500x300 image. I do a SetVirtualSize((500,300)) for the scrolled window. However, sometimes I am left with white space beyond the extent of the drawn bitmap. I verified that this space is actually beyond the virtual size by querying the mouse position, and I can get beyond the virtual size by around 5-7 pixels. I enclosed a simple program that somewhat recreates this issue. However, with this program, I was only able to get 1 pixel of extra border around the image.
You set the scrolling increment as 5, the letf-top corner will be anchored to 0, 5, 10,15…ect. But the size of the scrolled window is not an integral multiple of 5, that is why you see a strip on the end. You can eliminate this by SetScrollRate(1, 1) or just drawing your backgound bitmap a little bigger.(e.g. 805x605)
I am using a scrolled window to view an image that is too large to fit on the screen. I do this by binding a function to wx.EVT_ERASE_BACKGROUND of the scrolled window that calls a function with dc = event.GetDC(), PrepareDC, and DrawBitmap. Let’s say I have a 500x300 image. I do a SetVirtualSize((500,300)) for the scrolled window. However, sometimes I am left with white space beyond the extent of the drawn bitmap. I verified that this space is actually beyond the virtual size by querying the mouse position, and I can get beyond the virtual size by around 5-7 pixels. I enclosed a simple program that somewhat recreates this issue. However, with this program, I was only able to get 1 pixel of extra border around the image.
On Monday, September 30, 2013 9:09:34 AM UTC-4, Mark Weng wrote:
You set the scrolling increment as 5, the letf-top corner will be anchored to 0, 5, 10,15…ect. But the size of the scrolled window is not an integral multiple of 5, that is why you see a strip on the end. You can eliminate this by SetScrollRate(1, 1) or just drawing your backgound bitmap a little bigger.(e.g. 805x605)
I am using a scrolled window to view an image that is too large to fit on the screen. I do this by binding a function to wx.EVT_ERASE_BACKGROUND of the scrolled window that calls a function with dc = event.GetDC(), PrepareDC, and DrawBitmap. Let’s say I have a 500x300 image. I do a SetVirtualSize((500,300)) for the scrolled window. However, sometimes I am left with white space beyond the extent of the drawn bitmap. I verified that this space is actually beyond the virtual size by querying the mouse position, and I can get beyond the virtual size by around 5-7 pixels. I enclosed a simple program that somewhat recreates this issue. However, with this program, I was only able to get 1 pixel of extra border around the image.