Option Strict Off
Option Explicit On
Friend Class Form1
	Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        If m_vb6FormDefInstance Is Nothing Then
            If m_InitializingDefInstance Then
                m_vb6FormDefInstance = Me
            Else
                Try
                    If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
                        m_vb6FormDefInstance = Me
                    End If
                Catch
                End Try
            End If
        End If
        InitializeComponent()
    End Sub
    Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
        If Disposing Then
            If Not components Is Nothing Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(Disposing)
    End Sub
    Private components As System.ComponentModel.IContainer
    Public WithEvents Option2 As System.Windows.Forms.RadioButton
    Public WithEvents Option1 As System.Windows.Forms.RadioButton
    Public WithEvents Drive1 As Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
    Public WithEvents Dir1 As Microsoft.VisualBasic.Compatibility.VB6.DirListBox
    Public WithEvents Command2 As System.Windows.Forms.Button
    Public WithEvents Command1 As System.Windows.Forms.Button
    Public WithEvents Command3 As System.Windows.Forms.Button
    Public WithEvents Option3 As System.Windows.Forms.RadioButton
    Friend WithEvents Check1 As System.Windows.Forms.CheckBox
    Friend WithEvents Check2 As System.Windows.Forms.CheckBox
    Friend WithEvents Check4 As System.Windows.Forms.CheckBox
    Friend WithEvents Check3 As System.Windows.Forms.CheckBox
    Friend WithEvents Check5 As System.Windows.Forms.CheckBox
    Friend WithEvents ImageKitThumb1 As AxIMAGEKIT7THUMBLib.AxImageKitThumb
    Public WithEvents Label1 As System.Windows.Forms.Label
    '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()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.Option2 = New System.Windows.Forms.RadioButton
        Me.Option1 = New System.Windows.Forms.RadioButton
        Me.Drive1 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
        Me.Dir1 = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox
        Me.Command2 = New System.Windows.Forms.Button
        Me.Command1 = New System.Windows.Forms.Button
        Me.Command3 = New System.Windows.Forms.Button
        Me.Option3 = New System.Windows.Forms.RadioButton
        Me.Check1 = New System.Windows.Forms.CheckBox
        Me.Check2 = New System.Windows.Forms.CheckBox
        Me.Check4 = New System.Windows.Forms.CheckBox
        Me.Check3 = New System.Windows.Forms.CheckBox
        Me.Check5 = New System.Windows.Forms.CheckBox
        Me.ImageKitThumb1 = New AxIMAGEKIT7THUMBLib.AxImageKitThumb
        Me.Label1 = New System.Windows.Forms.Label
        CType(Me.ImageKitThumb1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Option2
        '
        Me.Option2.BackColor = System.Drawing.SystemColors.Control
        Me.Option2.Cursor = System.Windows.Forms.Cursors.Default
        Me.Option2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Option2.Location = New System.Drawing.Point(196, 408)
        Me.Option2.Name = "Option2"
        Me.Option2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Option2.Size = New System.Drawing.Size(81, 17)
        Me.Option2.TabIndex = 7
        Me.Option2.TabStop = True
        Me.Option2.Text = "Custum"
        '
        'Option1
        '
        Me.Option1.BackColor = System.Drawing.SystemColors.Control
        Me.Option1.Checked = True
        Me.Option1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Option1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Option1.Location = New System.Drawing.Point(24, 408)
        Me.Option1.Name = "Option1"
        Me.Option1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Option1.Size = New System.Drawing.Size(64, 17)
        Me.Option1.TabIndex = 6
        Me.Option1.TabStop = True
        Me.Option1.Text = "Buttons"
        '
        'Drive1
        '
        Me.Drive1.BackColor = System.Drawing.SystemColors.Window
        Me.Drive1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Drive1.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Drive1.Location = New System.Drawing.Point(344, 348)
        Me.Drive1.Name = "Drive1"
        Me.Drive1.Size = New System.Drawing.Size(201, 20)
        Me.Drive1.TabIndex = 5
        '
        'Dir1
        '
        Me.Dir1.BackColor = System.Drawing.SystemColors.Window
        Me.Dir1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Dir1.ForeColor = System.Drawing.SystemColors.WindowText
        Me.Dir1.IntegralHeight = False
        Me.Dir1.Location = New System.Drawing.Point(344, 376)
        Me.Dir1.Name = "Dir1"
        Me.Dir1.Size = New System.Drawing.Size(201, 144)
        Me.Dir1.TabIndex = 4
        '
        'Command2
        '
        Me.Command2.BackColor = System.Drawing.SystemColors.Control
        Me.Command2.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command2.Location = New System.Drawing.Point(192, 360)
        Me.Command2.Name = "Command2"
        Me.Command2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command2.Size = New System.Drawing.Size(81, 33)
        Me.Command2.TabIndex = 1
        Me.Command2.Text = "End"
        '
        'Command1
        '
        Me.Command1.BackColor = System.Drawing.SystemColors.Control
        Me.Command1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command1.Location = New System.Drawing.Point(104, 360)
        Me.Command1.Name = "Command1"
        Me.Command1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command1.Size = New System.Drawing.Size(81, 33)
        Me.Command1.TabIndex = 0
        Me.Command1.Text = "Load Thumbnails"
        '
        'Command3
        '
        Me.Command3.BackColor = System.Drawing.SystemColors.Control
        Me.Command3.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command3.Location = New System.Drawing.Point(16, 360)
        Me.Command3.Name = "Command3"
        Me.Command3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command3.Size = New System.Drawing.Size(81, 33)
        Me.Command3.TabIndex = 2
        Me.Command3.Text = "Stop Loading"
        '
        'Option3
        '
        Me.Option3.BackColor = System.Drawing.SystemColors.Control
        Me.Option3.Cursor = System.Windows.Forms.Cursors.Default
        Me.Option3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Option3.Location = New System.Drawing.Point(104, 408)
        Me.Option3.Name = "Option3"
        Me.Option3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Option3.Size = New System.Drawing.Size(81, 17)
        Me.Option3.TabIndex = 9
        Me.Option3.TabStop = True
        Me.Option3.Text = "Film"
        '
        'Check1
        '
        Me.Check1.Checked = True
        Me.Check1.CheckState = System.Windows.Forms.CheckState.Checked
        Me.Check1.Location = New System.Drawing.Point(32, 468)
        Me.Check1.Name = "Check1"
        Me.Check1.Size = New System.Drawing.Size(108, 16)
        Me.Check1.TabIndex = 10
        Me.Check1.Text = "Drag Source"
        '
        'Check2
        '
        Me.Check2.Checked = True
        Me.Check2.CheckState = System.Windows.Forms.CheckState.Checked
        Me.Check2.Location = New System.Drawing.Point(148, 468)
        Me.Check2.Name = "Check2"
        Me.Check2.Size = New System.Drawing.Size(124, 16)
        Me.Check2.TabIndex = 11
        Me.Check2.Text = "Drag target"
        '
        'Check4
        '
        Me.Check4.Checked = True
        Me.Check4.CheckState = System.Windows.Forms.CheckState.Checked
        Me.Check4.Location = New System.Drawing.Point(148, 492)
        Me.Check4.Name = "Check4"
        Me.Check4.Size = New System.Drawing.Size(124, 16)
        Me.Check4.TabIndex = 13
        Me.Check4.Text = "Move Thumbnail"
        '
        'Check3
        '
        Me.Check3.Location = New System.Drawing.Point(32, 492)
        Me.Check3.Name = "Check3"
        Me.Check3.Size = New System.Drawing.Size(108, 16)
        Me.Check3.TabIndex = 12
        Me.Check3.Text = "OLE Drag"
        '
        'Check5
        '
        Me.Check5.Location = New System.Drawing.Point(32, 516)
        Me.Check5.Name = "Check5"
        Me.Check5.Size = New System.Drawing.Size(160, 16)
        Me.Check5.TabIndex = 14
        Me.Check5.Text = "Change Mouse Cursor"
        '
        'ImageKitThumb1
        '
        Me.ImageKitThumb1.Location = New System.Drawing.Point(16, 16)
        Me.ImageKitThumb1.Name = "ImageKitThumb1"
        Me.ImageKitThumb1.OcxState = CType(resources.GetObject("ImageKitThumb1.OcxState"), System.Windows.Forms.AxHost.State)
        Me.ImageKitThumb1.Size = New System.Drawing.Size(520, 324)
        Me.ImageKitThumb1.TabIndex = 15
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.BackColor = System.Drawing.SystemColors.Control
        Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label1.Font = New System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(128, Byte))
        Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label1.Location = New System.Drawing.Point(28, 440)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label1.Size = New System.Drawing.Size(41, 16)
        Me.Label1.TabIndex = 3
        Me.Label1.Text = "Label1"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
        Me.ClientSize = New System.Drawing.Size(553, 550)
        Me.Controls.Add(Me.ImageKitThumb1)
        Me.Controls.Add(Me.Check5)
        Me.Controls.Add(Me.Check4)
        Me.Controls.Add(Me.Check3)
        Me.Controls.Add(Me.Check2)
        Me.Controls.Add(Me.Check1)
        Me.Controls.Add(Me.Option3)
        Me.Controls.Add(Me.Option2)
        Me.Controls.Add(Me.Option1)
        Me.Controls.Add(Me.Drive1)
        Me.Controls.Add(Me.Dir1)
        Me.Controls.Add(Me.Command2)
        Me.Controls.Add(Me.Command1)
        Me.Controls.Add(Me.Command3)
        Me.Controls.Add(Me.Label1)
        Me.Location = New System.Drawing.Point(4, 23)
        Me.Name = "Form1"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "ImageKit"
        CType(Me.ImageKitThumb1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub
#End Region
#Region "Upgrade Support "
    Private Shared m_vb6FormDefInstance As Form1
    Private Shared m_InitializingDefInstance As Boolean
    Public Shared Property DefInstance() As Form1
        Get
            If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
                m_InitializingDefInstance = True
                m_vb6FormDefInstance = New Form1
                m_InitializingDefInstance = False
            End If
            DefInstance = m_vb6FormDefInstance
        End Get
        Set(ByVal Value As Form1)
            m_vb6FormDefInstance = Value
        End Set
    End Property
#End Region
    Dim CurrentDir As String
    Dim gImageNumber As Integer

    'execute
    Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
        Me.Cursor() = Cursors.WaitCursor

        'update thumbnail file
        If Trim(ImageKitThumb1.ThumbnailFile) <> "" Then
            ImageKitThumb1.UpdateThumbnailFile()
        End If

        Command1.Enabled = False
        Command2.Enabled = False
        Command3.Visible = True
        Label1.Text = ""

        'set the directory for the images that will be displayed as thumbnails
        ImageKitThumb1.FilePath = Dir1.Path

        'set the thumbnail file
        ImageKitThumb1.ThumbnailFile = Dir1.Path & "\" & "thumbnail.dat"

        ImageKitThumb1.GetFiles()
        Me.Cursor() = Cursors.Default
        ImageKitThumb1.Display()

        Command1.Enabled = True
        Command2.Enabled = True
        Command3.Visible = False
        Label1.Text = ""
    End Sub

    Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
        Me.Close()
    End Sub

    'stop
    Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command3.Click
        ImageKitThumb1.Cancel = True
    End Sub

    Private Sub Drive1_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Drive1.SelectedIndexChanged
        Dir1.Path = Drive1.Drive
    End Sub

    Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
        Command3.Visible = False
        Label1.Text = ""
        CurrentDir = CurDir() & "\"
        ImageKitThumb1.ThumbnailFile = ""

        ImageKitThumb1.TextColor = Color.FromArgb(&HFF)
        ImageKitThumb1.TextBackColor = Color.FromArgb(&HC0C0FF)
        ImageKitThumb1.TextTransparent = False

        ImageKitThumb1.SelectTextColor = Color.FromArgb(&HFF0000)
        ImageKitThumb1.SelectTextBackColor = Color.FromArgb(&HFF8080)
        ImageKitThumb1.SelectTextTransparent = False

        ImageKitThumb1.ClearOnLoad = False
        ImageKitThumb1.EnableOLEDrag = False

        gImageNumber = -1
    End Sub

    Private Sub Form1_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
        'update thumbnail file
        If Trim(ImageKitThumb1.ThumbnailFile) <> "" Then
            ImageKitThumb1.UpdateThumbnailFile()
        End If
    End Sub

    'buttons
    Private Sub Option1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Option1.Click
        If Option1.Checked = True Then
            ImageKitThumb1.Style = IMAGEKIT7THUMBLib.ThumbnailStyleConstants.ikButton
            ImageKitThumb1.Button3D = True
            ImageKitThumb1.ForeColorUp = Color.FromArgb(&HE0E0E0)
            ImageKitThumb1.ForeColorDown = Color.FromArgb(&H808080)
            ImageKitThumb1.BackColor = Color.FromArgb(&HFF, &HFF, &HFF)
        End If
    End Sub

    'film
    Private Sub Option3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Option3.Click
        If Option3.Checked = True Then
            ImageKitThumb1.Style = IMAGEKIT7THUMBLib.ThumbnailStyleConstants.ikFilm
            ImageKitThumb1.ForeColorUp = Color.FromArgb(&H0)
            ImageKitThumb1.ForeColorDown = Color.FromArgb(&H808080)
            ImageKitThumb1.BackColor = Color.FromArgb(&HFF, &HFF, &HFF)
        End If
    End Sub

    'custom
    Private Sub Option2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Option2.Click
        If Option2.Checked = True Then
            ImageKitThumb1.Style = IMAGEKIT7THUMBLib.ThumbnailStyleConstants.ikCustom
            ImageKitThumb1.ForeColorUp = Color.FromArgb(&HE0E0E0)
            ImageKitThumb1.ForeColorDown = Color.FromArgb(&H808080)
            ImageKitThumb1.BackColor = Color.FromArgb(&HFF, &HFF, &HFF)
        End If
    End Sub

    'drag source
    Private Sub Check1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Check1.Click
        ImageKitThumb1.EnableDragSource = Check1.Checked
    End Sub

    'drag target
    Private Sub Check2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Check2.Click
        ImageKitThumb1.EnableDragTarget = Check2.Checked
    End Sub

    'OLE drag
    Private Sub Check3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Check3.Click
        ImageKitThumb1.EnableOLEDrag = Check3.Checked
    End Sub

    'move thumbnail
    Private Sub Check4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Check4.Click
        ImageKitThumb1.EnableMove = Check4.Checked
    End Sub

    'change mouse cursor
    Private Sub Check5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Check5.Click
        If Check5.Checked Then
            ImageKitThumb1.MouseCursorType = IMAGEKIT7THUMBLib.CursorTypeConstants.ikCursorCustom
            ImageKitThumb1.MouseCursorFile = CurrentDir + "Cursor1.cur"

            ImageKitThumb1.SelectMouseCursorType = IMAGEKIT7THUMBLib.CursorTypeConstants.ikCursorCustom
            ImageKitThumb1.SelectMouseCursorFile = CurrentDir + "SELECT.CUR"
        Else
            ImageKitThumb1.MouseCursorType = IMAGEKIT7THUMBLib.CursorTypeConstants.ikCursorDefault
            ImageKitThumb1.SelectMouseCursorType = IMAGEKIT7THUMBLib.CursorTypeConstants.ikCursorDefault
        End If
    End Sub

    Private Sub ImageKitThumb1_EndLoadFile(ByVal sender As Object, ByVal e As AxIMAGEKIT7THUMBLib._IImageKitThumbEvents_EndLoadFileEvent) Handles ImageKitThumb1.EndLoadFile
        Label1.Text = "Loaded file: " & CStr(e.imageNumber) & " / " & CStr(e.maxImage)
        System.Windows.Forms.Application.DoEvents()
    End Sub

    Private Sub ImageKitThumb1_KeyDownEvent(ByVal sender As Object, ByVal e As AxIMAGEKIT7THUMBLib._IImageKitThumbEvents_KeyDownEvent) Handles ImageKitThumb1.KeyDownEvent
        If e.keyCode = 46 And gImageNumber >= 0 Then
            ImageKitThumb1.Delete(gImageNumber)
        End If
    End Sub

    Private Sub ImageKitThumb1_MouseMoveOnThumb(ByVal sender As Object, ByVal e As AxIMAGEKIT7THUMBLib._IImageKitThumbEvents_MouseMoveOnThumbEvent) Handles ImageKitThumb1.MouseMoveOnThumb
        Label1.Text = "Move: " & ImageKitThumb1.FileName
    End Sub

    Private Sub ImageKitThumb1_SelectFile(ByVal sender As Object, ByVal e As AxIMAGEKIT7THUMBLib._IImageKitThumbEvents_SelectFileEvent) Handles ImageKitThumb1.SelectFile
        If e.imageNumber = -1 Then
            Exit Sub
        End If
        Label1.Text = "Select:" & ImageKitThumb1.FileName
        gImageNumber = e.imageNumber
    End Sub

End Class