LoadInfo... example for Access 2.0

Take the following steps to exercise the LoadInfo event and LoadInfo... properties. The example creates a raw FAX file, then loads the file it just created. (Getting format information from an unfamiliar file is beyond the scope of this example.)

1. Start with the project that you created in Loading and Displaying an Image.

2. Add the following form-level variables to the declarations procedure of the general object in your main form:

'Declare variables for demonstrating raw FAX.
Dim MyInfoBits As Integer
Dim MyInfoFlags As Long
Dim MyInfoFormat As Integer
Dim MyInfoHeight As Single
Dim MyInfoOffset As Long
Dim MyInfoWidth As Single
Dim MyInfoXRes As Integer
Dim MyInfoYRes As Integer

3. image\btncmd.gif Add a CommandButton control and code its click procedure as follows:

Sub Command4_Click()
    Me![LEAD1].Object.ScaleMode = 3 'Pixels

    'Make the image look OK as a 1-bit image.
    Me![LEAD1].Object.Size Me![LEAD1].Object.ScaleWidth, Me![LEAD1].Object.ScaleHeight, RESIZE_RESAMPLE
    Me![LEAD1].Object.Halftone HALFTONE_VIEW, 45

    'Set the form-level variables to the values we will use when loading.
    MyInfoBits = 1
    MyInfoFlags = LOADINFO_TOPLEFT
    MyInfoFormat = FILE_FAX_G3_2D
    MyInfoHeight = Me![LEAD1].Object.BitmapHeight
    MyInfoOffset = 0
    MyInfoWidth = Me![LEAD1].Object.BitmapWidth
    MyInfoXRes = Me![LEAD1].Object.BitmapXRes
    MyInfoYRes = Me![LEAD1].Object.BitmapYRes

    'Save the image as raw FAX; then load the saved file.
    'Format information will be supplied in the LoadInfo event.
    Me![LEAD1].Object.Save "c:\lead\images\tmp.tif", FILE_FAX_G3_2D, 1, 1, SAVE_OVERWRITE
    Me![LEAD1].Object.Load "c:\lead\images\tmp.tif", 0, 0, 1

    'Repaint the newly loaded image.
    Me![LEAD1].Object.ForceRepaint

End Sub

4. Code the LEAD1 control's LoadInfo event as follows:

Sub LEAD1_LoadInfo()
    'Use the form-level variables to supply format information.
    Me![LEAD1].Object.LoadInfoBits = MyInfoBits
    Me![LEAD1].Object.LoadInfoFlags = MyInfoFlags
    Me![LEAD1].Object.LoadInfoFormat = MyInfoFormat
    Me![LEAD1].Object.LoadInfoHeight = MyInfoHeight
    Me![LEAD1].Object.LoadInfoOffset = MyInfoOffset
    Me![LEAD1].Object.LoadInfoWidth = MyInfoWidth
    Me![LEAD1].Object.LoadInfoXRes = MyInfoXRes
    Me![LEAD1].Object.LoadInfoYRes = MyInfoYRes
End Sub

5. Run your program to test it.