Hi guys,
I have a windows form and on load event I dynamically created a panel
and dynamically create/add pictureboxes to panel and added a panel to
the form with docking with fill. I am basically creating a thumb nails
view for multiple pictures. Two question.
1I have set the panel's autoscroll to true, so I can actually see
and scroll the form if needed. But I want to scroll to work when my
mouse is on any where on the panel or form. Currently, I need to move
my mouse to the scrollbar and drag to scroll. How do I do that?
2How do I prevent the flickering when i scroll up or down? I am
actually using "DoublebufferedPanel" (see below) but still no help.
Public Class DoubleBufferedPanel
Inherits Panel
Public Sub New()
Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.UserPaint, True)
End Sub
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
'Dim g As Graphics = e.Graphics
MyBase.OnPaint(e)
End Sub
End Class