[ vb 2008 ] ImageList 예제 본문

[PL]/VB & VB.NET

[ vb 2008 ] ImageList 예제

객과 함께. 2010. 1. 1. 00:52

 

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

인터넷 웹 서핑 중에 어느 분이 짠 소스를 수정 하여 보았습니다.

 

'[PL] > VB & VB.NET' 카테고리의 다른 글

[vb 2008 ] 구구단 프로그램예제  (0) 2010.01.02
[ vb 2008 ] WPF 예제  (0) 2010.01.02
[ vb 2008 ] 사용자 컨트롤 매핑  (0) 2009.12.31
[ vb 2008 ] ListView 예제.  (0) 2009.12.30
[ VB.NET ] OpenFileDialog 예제   (0) 2009.12.29