Public Class Form1 Const min As Integer = 0 Const max As Integer = 9 Const drumSize As Integer = 100 Dim imageList1 As New ImageList() Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load imageList1.ImageSize = New Size(drumSize, drumSize) '画像が無いので自分で描いてるだけ For i As Integer = min To max Dim img As New Bitmap(drumSize, drumSize) Using g As Graphics = Graphics.FromImage(img) 'サイズは適当に収まるように設定 Dim fnt As New Font(Me.Font.FontFamily.Name, drumSize * 0.8) g.DrawString(i.ToString(), fnt, Brushes.Black, 0, 0) End Using Me.imageList1.Images.Add(img) Next 'ドラムを作成して配置、スタート For i As Integer = 0 To 3 - 1 Dim drum As New Drum(500, Me.imageList1) Me.Controls.Add(drum) drum.Location = New Point(i * drum.Width, 0) drum.DrumStart() Next End Sub End Class Class Drum Inherits PictureBox WithEvents timer_ As New Timer() Dim imgList As ImageList Dim index As Integer = 0 - 1 ''' <summary> ''' ドラムを初期化 ''' </summary> ''' <param name="interval">ドラムの回転間隔</param> ''' <param name="imgList">ドラムの図柄リスト</param> Sub New(ByVal interval As Integer, ByVal imgList As ImageList) Me.imgList = imgList timer_.Interval = interval Me.Size = New Size(100, 100) timer_Tick(timer_, EventArgs.Empty) End Sub ''' <summary> ''' ドラムを回す ''' </summary> Public Sub DrumStart() timer_.Start() End Sub ''' <summary> ''' ドラムを止める ''' </summary> ''' <remarks></remarks> Public Sub DrumStop() timer_.Stop() End Sub Private Sub timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer_.Tick If index = imgList.Images.Count - 1 Then index = 0 Else index += 1 End If Me.Image = imgList.Images(index) End Sub End Class