Option Explicit On 
Option Strict On

Public Class frmImage
    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 Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents grpFile As System.Windows.Forms.GroupBox
    Friend WithEvents lblGraphics As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents filGraphics As Microsoft.VisualBasic.Compatibility.VB6.FileListBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
            Friend WithEvents grpImage As System.Windows.Forms.GroupBox
    Friend WithEvents picImage As System.Windows.Forms.PictureBox
        Friend WithEvents filImage As Microsoft.VisualBasic.Compatibility.VB6.FileListBox
    Friend WithEvents lblImage As System.Windows.Forms.Label
    Friend WithEvents drvImage As Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
    Friend WithEvents dirImage As Microsoft.VisualBasic.Compatibility.VB6.DirListBox
  Friend WithEvents rdoStretch As System.Windows.Forms.RadioButton
  Friend WithEvents rdoCenter As System.Windows.Forms.RadioButton
  Friend WithEvents rdoNormal As System.Windows.Forms.RadioButton

    '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.grpImage = New System.Windows.Forms.GroupBox()
    Me.rdoNormal = New System.Windows.Forms.RadioButton()
    Me.rdoCenter = New System.Windows.Forms.RadioButton()
    Me.rdoStretch = New System.Windows.Forms.RadioButton()
    Me.picImage = New System.Windows.Forms.PictureBox()
    Me.Label1 = New System.Windows.Forms.Label()
    Me.Label2 = New System.Windows.Forms.Label()
    Me.Label3 = New System.Windows.Forms.Label()
    Me.filImage = New Microsoft.VisualBasic.Compatibility.VB6.FileListBox()
    Me.dirImage = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox()
    Me.lblImage = New System.Windows.Forms.Label()
    Me.grpFile = New System.Windows.Forms.GroupBox()
    Me.drvImage = New Microsoft.VisualBasic.Compatibility.VB6.DriveListBox()
    Me.grpImage.SuspendLayout()
    Me.grpFile.SuspendLayout()
    Me.SuspendLayout()
    '
    'grpImage
    '
    Me.grpImage.BackColor = System.Drawing.Color.Blue
    Me.grpImage.Controls.AddRange(New System.Windows.Forms.Control() {Me.rdoNormal, Me.rdoCenter, Me.rdoStretch, Me.picImage})
    Me.grpImage.Location = New System.Drawing.Point(328, 8)
    Me.grpImage.Name = "grpImage"
    Me.grpImage.Size = New System.Drawing.Size(240, 312)
    Me.grpImage.TabIndex = 1
    Me.grpImage.TabStop = False
    '
    'rdoNormal
    '
    Me.rdoNormal.ForeColor = System.Drawing.Color.Yellow
    Me.rdoNormal.Location = New System.Drawing.Point(16, 288)
    Me.rdoNormal.Name = "rdoNormal"
    Me.rdoNormal.Size = New System.Drawing.Size(64, 16)
    Me.rdoNormal.TabIndex = 1
    Me.rdoNormal.Text = "Normal"
    '
    'rdoCenter
    '
    Me.rdoCenter.ForeColor = System.Drawing.Color.Yellow
    Me.rdoCenter.Location = New System.Drawing.Point(88, 288)
    Me.rdoCenter.Name = "rdoCenter"
    Me.rdoCenter.Size = New System.Drawing.Size(64, 16)
    Me.rdoCenter.TabIndex = 1
    Me.rdoCenter.Text = "Center"
    '
    'rdoStretch
    '
    Me.rdoStretch.ForeColor = System.Drawing.Color.Yellow
    Me.rdoStretch.Location = New System.Drawing.Point(160, 288)
    Me.rdoStretch.Name = "rdoStretch"
    Me.rdoStretch.Size = New System.Drawing.Size(64, 16)
    Me.rdoStretch.TabIndex = 1
    Me.rdoStretch.Text = "Stretch"
    '
    'picImage
    '
    Me.picImage.BackColor = System.Drawing.Color.White
    Me.picImage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.picImage.Location = New System.Drawing.Point(8, 16)
    Me.picImage.Name = "picImage"
    Me.picImage.Size = New System.Drawing.Size(226, 266)
    Me.picImage.TabIndex = 0
    Me.picImage.TabStop = False
    '
    'Label1
    '
    Me.Label1.ForeColor = System.Drawing.Color.Yellow
    Me.Label1.Location = New System.Drawing.Point(16, 72)
    Me.Label1.Name = "Label1"
    Me.Label1.Size = New System.Drawing.Size(100, 16)
    Me.Label1.TabIndex = 1
    Me.Label1.Text = "Files:"
    '
    'Label2
    '
    Me.Label2.ForeColor = System.Drawing.Color.Yellow
    Me.Label2.Location = New System.Drawing.Point(168, 72)
    Me.Label2.Name = "Label2"
    Me.Label2.Size = New System.Drawing.Size(100, 16)
    Me.Label2.TabIndex = 1
    Me.Label2.Text = "Directories:"
    '
    'Label3
    '
    Me.Label3.ForeColor = System.Drawing.Color.Yellow
    Me.Label3.Location = New System.Drawing.Point(168, 264)
    Me.Label3.Name = "Label3"
    Me.Label3.Size = New System.Drawing.Size(100, 16)
    Me.Label3.TabIndex = 1
    Me.Label3.Text = "Drives:"
    '
    'filImage
    '
    Me.filImage.Location = New System.Drawing.Point(16, 88)
    Me.filImage.Name = "filImage"
    Me.filImage.Pattern = "*.ico;*.bmp;*.jpg;*.gif;*.wmf"
    Me.filImage.Size = New System.Drawing.Size(144, 212)
    Me.filImage.TabIndex = 2
    '
    'dirImage
    '
    Me.dirImage.IntegralHeight = False
    Me.dirImage.Location = New System.Drawing.Point(168, 88)
    Me.dirImage.Name = "dirImage"
    Me.dirImage.Size = New System.Drawing.Size(128, 168)
    Me.dirImage.TabIndex = 4
    '
    'lblImage
    '
    Me.lblImage.BackColor = System.Drawing.Color.Yellow
    Me.lblImage.Location = New System.Drawing.Point(16, 16)
    Me.lblImage.Name = "lblImage"
    Me.lblImage.Size = New System.Drawing.Size(280, 48)
    Me.lblImage.TabIndex = 0
    Me.lblImage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
    '
    'grpFile
    '
    Me.grpFile.BackColor = System.Drawing.Color.Red
    Me.grpFile.Controls.AddRange(New System.Windows.Forms.Control() {Me.dirImage, Me.drvImage, Me.Label3, Me.Label2, Me.filImage, Me.Label1, Me.lblImage})
    Me.grpFile.Location = New System.Drawing.Point(8, 8)
    Me.grpFile.Name = "grpFile"
    Me.grpFile.Size = New System.Drawing.Size(312, 312)
    Me.grpFile.TabIndex = 0
    Me.grpFile.TabStop = False
    '
    'drvImage
    '
    Me.drvImage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
    Me.drvImage.DropDownWidth = 128
    Me.drvImage.Location = New System.Drawing.Point(168, 280)
    Me.drvImage.Name = "drvImage"
    Me.drvImage.Size = New System.Drawing.Size(128, 21)
    Me.drvImage.TabIndex = 3
    '
    'frmImage
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(580, 329)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.grpImage, Me.grpFile})
    Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
    Me.Name = "frmImage"
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
    Me.Text = "Image Viewer"
    Me.grpImage.ResumeLayout(False)
    Me.grpFile.ResumeLayout(False)
    Me.ResumeLayout(False)

  End Sub

#End Region

  Private Sub drvImage_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles drvImage.SelectedValueChanged
    'If drive changes, update directory
    dirImage.Path = drvImage.Drive
  End Sub

  Private Sub dirImage_Change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dirImage.Change
    'If directory changes, update file path
    filImage.Path = dirImage.Path
  End Sub

  Private Sub filImage_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles filImage.SelectedIndexChanged
    'Get complete path to file name and open graphics
    Dim ImageName As String
    If Mid(filImage.Path, Len(filImage.Path), 1) = "\" Then
      ImageName = filImage.Path + filImage.FileName
    Else
      ImageName = filImage.Path + "\" + filImage.FileName
    End If
    lblImage.Text = ImageName
    picImage.Image = Image.FromFile(ImageName)
  End Sub


  Private Sub rdoNormal_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoNormal.CheckedChanged
    picImage.SizeMode = PictureBoxSizeMode.Normal
  End Sub

  Private Sub rdoCenter_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoCenter.CheckedChanged
    picImage.SizeMode = PictureBoxSizeMode.CenterImage
  End Sub

  Private Sub rdoStretch_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoStretch.CheckedChanged
    picImage.SizeMode = PictureBoxSizeMode.StretchImage
  End Sub

  Private Sub frmImage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'initialize stretch mode
    rdoStretch.PerformClick()
  End Sub
End Class
