Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As _                        
                System.EventArgs) Handles btnOpen.Click
  Dim path As String
  Static InitialSize As Size = PictureBox1.Size ' Zapisz początkowy
                                                ' rozmiar formantu

  PictureBox1.Size = InitialSize        ' Zresetuj rozmiar formantu

  With OpenFileDialog1             ' Inicjalizuj okno dialogowe 
    .Filter = "Bitmap (*.BMP)|*.bmp|Icon (*.ICO)|*.ICO|GIF " & _
                "(*.GIF)|*.GIF|Metafile (*.WMF)|*.WMF|JPEG (*.JPG)|*.JPG"
    .FilterIndex = 5
    .InitialDirectory = "C:\"
    .Title = "Select Image File"
  End With

  If OpenFileDialog1.ShowDialog() = DialogResult.OK Then ' Plik wybrany?
    path = OpenFileDialog1.FileName
    Me.Text = "View a Graphics Image " & path
    CalculateControlSize(path)
  End If

End Sub
