ReadLoadResolutions example for Visual Basic

This example shows how to use the methods and properties for FlashPix files.

Dim TempStr, InfoStr As String       ' For composing message strings
Dim i As Integer ' Loop counter

' Initialize the display
Lead1.AutoScroll = False
Lead1.AutoSetRects = True
Lead1.PaintSizeMode = PAINTSIZEMODE_FIT
Lead1.GetFileInfo "v:\images\image5.fpx", 0, 0

' Update information about the available resolutions.
Lead1.ReadLoadResolutions "v:\images\image5.fpx"

' Display a message box that shows the available sizes.
InfoStr = "Available dimensions:" + Chr(13)

for i = 0 to Lead1.LoadResolutionCount -1 
   TempStr = Str(Lead1.LoadResolutionWidth(i)) + " X " + Str(Lead1.LoadResolutionWidth(i)) + Chr(13)
   InfoStr = InfoStr + TempStr
next i

MsgBox InfoStr

' Set the size to load, the smallest size in this case.
Lead1.SetLoadResolution Lead1.InfoFormat, Lead1.LoadResolutionWidth(0), Lead1.LoadResolutionHeight(0)

' Get the dimensions that we just set and display them.
Lead1.GetLoadResolution(Lead1.InfoFormat)

InfoStr = "Size that will be loaded:" + Chr(13) + Chr(13)
TempStr = Str(Lead1.LoadResolutionWidth(0)) + " X " + Str(Lead1.LoadResolutionWidth(0)) + Chr(13)
InfoStr = InfoStr + TempStr
MsgBox InfoStr

' Load the bitmap, keeping the bits per pixel of the file.
Lead1.Load "v:\images\image5.fpx", 0, 0, 1