[ vb 2008 ] ImageList 예제
Imports System
Imports System.Windows.Forms
Public Class Form1
Dim count As Integer = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox1.Image = ImageList1.Images.Item(count)
PictureBox1.Height = ImageList1.ImageSize.Height - 100
PictureBox1.Width = ImageList1.ImageSize.Width - 100
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
count += 1
If count + 1 > ImageList1.Images.Count Then
count = 0
End If
PictureBox1.Image = ImageList1.Images.Item(count)
End Sub
Private Sub PictureBox1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
count += 1
If count + 1 > ImageList1.Images.Count Then
count = 0
End If
PictureBox1.Image = ImageList1.Images.Item(count)
End Sub
Private Sub Button1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Button1.KeyDown
If e.KeyCode = Keys.PageDown Then
count += 1
If count + 1 > ImageList1.Images.Count Then
count = 0
End If
PictureBox1.Image = ImageList1.Images.Item(count)
Else
count -= 1
If count < 0 Then
count = 0
End If
PictureBox1.Image = ImageList1.Images.Item(count)
End If
End Sub
End Class
인터넷 웹 서핑 중에 어느 분이 짠 소스를 수정 하여 보았습니다.