views:

34

answers:

2

I've got a panel in windows forms (Visual Studio 2008) which has a background image (A book shelf). When scrolling the image flickers and does not redraw so looks awfully - I've tried creating a new object to use double buffering but this has no effect, any suggestions?

Public Class DoubleBufferPanel
Inherits Panel

Public Sub New()

Me.DoubleBuffered = True
SetStyle(ControlStyles.AllPaintingInWmPaint Or _
ControlStyles.DoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
UpdateStyles()

End Sub
End Class
A: 

That seems to happen when the BackgroundImageLayout is set to Zoom. If you set it to Stretch, that might fix the problem. If necessary, you can resize the image to fit the panel at load time and whenever the panel size changes.

xpda
A: 

I have used a docked picturebox, rather than labels I added the text directly to the image.

madlan