Image List Demo : Image List « GUI « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » GUI » Image ListScreenshots 
Image List Demo

Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.ComponentModel
Imports System.Drawing.Drawing2D
Imports System.IO

Public Class MainClass
    
    Shared Sub Main()
        Dim form1 As Form = New Form1

        Application.Run(form1)


    End Sub
End Class




Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is NothingThen
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents cmdFillImageList As System.Windows.Forms.Button
    Friend WithEvents cmdDrawImageList As System.Windows.Forms.Button

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Me.cmdDrawImageList = New System.Windows.Forms.Button()
        Me.cmdFillImageList = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'cmdDrawImageList
        '
        Me.cmdDrawImageList.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.cmdDrawImageList.Location = New System.Drawing.Point(176164)
        Me.cmdDrawImageList.Name = "cmdDrawImageList"
        Me.cmdDrawImageList.Size = New System.Drawing.Size(9624)
        Me.cmdDrawImageList.TabIndex = 1
        Me.cmdDrawImageList.Text = "Draw Images"
        '
        'cmdFillImageList
        '
        Me.cmdFillImageList.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.cmdFillImageList.Location = New System.Drawing.Point(40164)
        Me.cmdFillImageList.Name = "cmdFillImageList"
        Me.cmdFillImageList.Size = New System.Drawing.Size(10424)
        Me.cmdFillImageList.TabIndex = 0
        Me.cmdFillImageList.Text = "Fill ImageList"
        '
        'ImageListExample
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(514)
        Me.ClientSize = New System.Drawing.Size(320210)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdDrawImageList, Me.cmdFillImageList})
        Me.Font = New System.Drawing.Font("Tahoma"8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Name = "ImageListExample"
        Me.Text = "ImageList Example"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private IconImages As New System.Windows.Forms.ImageList()

    Private Sub cmdDrawImageList_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles cmdDrawImageList.Click
        Dim As Graphics = Me.CreateGraphics
        Dim As Integer

        For i = To IconImages.Images.Count - 1
            IconImages.Draw(g, 30 + i * 3030, i)
        Next

        g.Dispose()

    End Sub

    Private Sub cmdFillImageList_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles cmdFillImageList.Click
        IconImages.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
        IconImages.ImageSize = New System.Drawing.Size(1616)

        Dim IconFile As String, IconFiles As String()
        IconFiles = Directory.GetFiles("""*.ico")

        For Each IconFile In IconFiles
            Dim NewIcon As New Icon(IconFile)
            IconImages.Images.Add(NewIcon)
        Next

    End Sub
End Class

           
       
Related examples in the same category
w_w_w__._j_a__v__a2_s_.___c___om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.