This is a little Quick-and-Dirty Solution for you.
Not everything works optimal but I think you could see what basicly could be done ...
Imports System.ComponentModel
Public Class myPB
Inherits Control
Public Sub New()
Me.Size = New Size(640, 160)
Me.BackColor = Color.Gainsboro
SetStyle(ControlStyles.Selectable, True)
End Sub
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
ReadOnly Property Images As List(Of ImageDefinition)
Get
Return my_Images
End Get
End Property
Private my_Images As New List(Of ImageDefinition)
Property ImagesVisible As Integer
Get
Return my_ImagesVisible
End Get
Set(value As Integer)
my_ImagesVisible = value
my_ImageSize = New Size(Me.Width / my_ImagesVisible, Me.Height)
Me.Invalidate()
End Set
End Property
Private my_ImagesVisible As Integer = 3
Private my_ImageSize As Size
Property ActualImage As Integer
Get
Return my_ActualImage
End Get
Set(value As Integer)
my_ActualImage = value
If my_ActualImage < 0 Then my_ActualImage = my_Images.Count - 1
If my_ActualImage > my_Images.Count - 1 Then my_ActualImage = 0
Me.Invalidate()
End Set
End Property
Private my_ActualImage As Integer = 0
Protected Overrides Sub OnResize(e As EventArgs)
my_ImageSize = New Size(Me.Width / ImagesVisible, Me.Height)
MyBase.OnResize(e)
Me.Invalidate()
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Dim gr As Graphics = e.Graphics
If my_Images.Count > 0 Then
Dim inx As Integer
Dim n As Integer = my_ImagesVisible : If n > my_Images.Count Then n = my_Images.Count
Dim myImage As Image
For i As Integer = 0 To n - 1
inx = (i + my_ActualImage) Mod my_Images.Count
myImage = my_Images.Item(inx).xImage
gr.DrawImage(myImage, New Rectangle(i * my_ImageSize.Width, 0, my_ImageSize.Width, my_ImageSize.Height), New Rectangle(0, 0, myImage.Width, myImage.Height), GraphicsUnit.Pixel)
Next
End If
MyBase.OnPaint(e)
End Sub
Protected Overrides Sub OnMouseClick(e As MouseEventArgs)
If e.Button = Windows.Forms.MouseButtons.Left Then ActualImage += 1
If e.Button = Windows.Forms.MouseButtons.Right Then ActualImage -= 1
MyBase.OnMouseClick(e)
End Sub
End Class
Public Class ImageDefinition
Public Property xImage As Image
End Class
My Control in the moment only works with the MouseButtons. With the Keyboard is still unrealized (at the moment) ...
Additional :
to handle the Keyboard you have to add this method to the code :
Protected Overrides Sub OnPreviewKeyDown(e As PreviewKeyDownEventArgs)
If e.KeyCode = Keys.Left Then ActualImage += 1
If e.KeyCode = Keys.Right Then ActualImage -= 1
MyBase.OnPreviewKeyDown(e)
End Sub