DisplayPictureInfo

In Form PicForm

  10 Private Sub DisplayPictureInfo(ByVal Filename As String)
  11 ' Display information about a picture file
  12 ' [Filename] Name of picture file
  13 
  14 Dim IPicInfo As IPicInfo ' Object that implements the IPicInfo interface
  15 Dim PicSize As TPicSize  ' Picture size in pixels
  16 Dim MaxColors As Variant ' Maximum number of colors in this picture
  17 
  18 ' Determine file type
  19 Filename = LCase$(Filename)
  20 If Filename Like "*.gif" Then
  21     ' GIF file, get a PicGIF object to handle it
  22     Set IPicInfo = New PicGIF
  23 Else
  24     ' Assume it is a bitmap file, get a PicBMP object to handle it
  25     Set IPicInfo = New PicBMP
  26 End If
  27 
  28 ' Read the picture file
  29 If IPicInfo.ReadFile(Filename) Then
  30     ' Retrieve picture size in pixels
  31     PicSize = IPicInfo.Size
  32     ' Retrieve maximum number of colors in this picture
  33     MaxColors = IPicInfo.MaxColors
  34     
  35     ' Display retrieved information
  36     Me.Filename = "File: " & Filename
  37     Me.Size = "Size: " & PicSize.Width & " x " & PicSize.Height & " pixels"
  38     Me.MaxColors = "Max colors: " & MaxColors
  39     
  40     ' Display the picture as well
  41     Pict.Picture = LoadPicture(Filename)
  42 End If
  43 
  44 End Sub
  45 

Called by

OpenFile_Click
Pict_OLEDragDrop

Calls

> ReadFile in Class IPicInfo
> Size [Get] in Class IPicInfo
> MaxColors [Get] in Class IPicInfo