Version Info

Current version:	14.5
Last update:	10/12/2005 12:08 PM


Version History

Current version:	14.5

Last update:	October 12, 2005

Changes from Version 14 to Version 14.5

Changes from Version 13 to Version 14

Changes from Version 12.1 to Version 13

Changes from Version 12 to Version 12.1

Changes from Version 11.5 to Version 12

Changes from Version 10 to Version 11 (11.5)

Changes from Version 9.0 to Version 10

Changes from Version 8.0 to Version 9.0

Changes from Version 7.0 to Version 8.0

Changes from Version 6.2 to Version 7.0

Changes from Version 5.2 to Version 6.2


Changes from Version 14 to Version 14.5

Version 14.5 of the LEADTOOLS OCX has changed from Version 14 as follows:

The following method was added:

ICC Profiles

LoadICCProfile method


Changes from Version 13 to Version 14

Version 14 of the LEADTOOLS OCX has changed from Version 13 as follows:

Changed properties, methods and events:

 GetDIB -takes an extra parameter

 MagGlassExt event was renamed to MagGlass event.

 UpdateMagGlassExt was renamed to UpdateMagGlass event

 Deskew now takes extra parameters.

 The following events were renamed:

Old Name	New Name
Smooth	SmoothEvent
LineRemove	LineRemoveEvent
BorderRemove	BorderRemoveEvent
InvertedText	InvertedTextEvent
DotRemove	DotRemoveEvent
HolePunchRemove	HolePunchRemoveEvent
Changed properties, methods and events:

 GetDIB2 was removed.

 Deskew2 was removed

 All TWAIN properties, methods, and events were removed.  For TWAIN support, use the LEAD RasterTwain COM Object.

 All Common Dialog properties, methods, and events were removed.  For Common Dialog support, use the LEAD Raster Dialog objects.


Changes from Version 12.1 to Version 13

Please note that Version 13 will be the last full upgrade for LEADTOOLS OCX. In future versions, new features will only be added to the LEADTOOLS COM Objects.

Version 13 of the LEADTOOLS OCX has changed from Version 12.1 as follows:

 LEADTOOLS now supports region of interest in J2K files.

  IMPORTANT NOTICE CONCERNING SUPPORT FOR ISIS DRIVERS:

LEADTOOLS TOOLKITS CONTAIN SUPPORT FOR ISIS® DRIVERS USING PIXEL TRANSLATIONS RUNTIME (PIXDFLTN. DLL) VERSION NUMBER 55.1.260.832 OR EARLIER ALLOWING LEADTOOLS TO DIRECTLY INTERFACE WITH THE ISIS DRIVERS.

LEADTOOLS TOOLKITS DO NOT DIRECTLY COMMUNICATE WITH ISIS ® DRIVERS USING PIXEL TRANSLATIONS RUNTIME (PIXDFLTN) VERSION NUMBER 56.*.*.* OR HIGHER.  A LEADTOOLS APPLICATION WHICH OPERATES PROPERLY WITH THE EARLIER VINTAGE ISIS DRIVERS WILL CEASE TO OPERATE PROPERLY IF THE OLDER ISIS DRIVER IS REPLACED WITH A NEWER ISIS DRIVER REQUIRING THE PIXEL TRANSLATIONS RUNTIME DLL VERSION NUMBER 56.*.*.* OR HIGHER.

 Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is now available in Document and Medical toolkits.

 LEADTOOLS now supports the following file formats:

PTOCA (Presentation Text Object Content Architecture)

SCT (Scitex Continuous Tone Format)

PCL (Printer Command Language)

AFP

IOCA (Image Object Content Architecture)

SHP (ESRI Shape Format)

SMP

CMW

 LEADTOOLS now supports a Mixed Raster Content module for support of images that contain mixed image and text components.

 LEADTOOLS now provides more extensive annotation support.

 LEADTOOLS now supports super-compression of 1-bit and 24-bit bitmaps.

 LEADTOOLS now provides the means to get information about annotation files and delete pages from annotation files.

 LEADTOOLS can perform Lossless transformations (rotate, flip and reverse) on JPEG, CMP and JPEG TIFF files. This is superior to loading the image, performing the transformation and the saving the image.

 LEADTOOLS provides support for removing red-eye from images.

 LEADTOOLS supports an anti-aliasing filter.

 LEADTOOLS can perform Gaussian blurring.

 LEADTOOLS lets you swap color channel values across the R, G and B color channels.

 A new method lets you give images an "old-fashioned" look by converting to "colored gray".

 LEADTOOLS can add or average bitmaps within a list.

 LEADTOOLS lets you resize individual regions within a bitmap.

 LEADTOOLS can add motion blur to images.

 New methods and properties let you combine images using a single opacity value, or varying opacity values. Using the varying opacity values creates a feathering appearance.

 LEADTOOLS lets you add borders and frames to bitmaps.

 The LEADTOOLS Image List now lets you redraw individual items within the Image List.

 LEADTOOLS provides support for determining whether a magnifying glass is attached to a window, a control or an object.

 Support for ISIS ASCII tags is now provided.

 LEADTOOLS now supports loading and saving layers in PSD files.

 LEADTOOLS now lets you get or set pixel data for 48 and 64-bit bitmaps.

 The LEADTOOLS picturize capabilities have been extended to picturize an image using a single bitmap or a list of bitmaps.

 LEADTOOLS now lets you alter the shape of certain annotations by holding down the Shift key while drawing. (An Ellipse object will automatically be drawn as a circle; other annotations like notes, buttons, audio clips, etc. will automatically be drawn as squares.)

 LEADTOOLS now lets you associate metafiles with hotspot annotations and freehand hotspot annotations.

 LEADTOOLS now provides the ability move the name of annotation objects.

 LEADTOOLS now lets you create curved regions or add a curved region to an existing region.

 LEADTOOLS now lets you convert standard curves to Bezier curves.

 LEADTOOLS can now resize bitmaps during the load process.

 LEADTOOLS now lets you save bitmaps to files in memory.

Changed properties, methods and events:

The following functions have been changed from the previous version of LEADTOOLS or removed:

AnnLoadMemory method (Main Control) takes 1 new parameter.

AnnLoadArray method (Main Control) takes 1 new parameter.

AnnSave method (Main Control) takes 2 new parameters.

AnnSaveArray method (Main Control) takes 3 new parameters and returns a different value.

AnnSaveMemory method (Main Control) takes 2 new parameters.

AnnDefine method (Main Control) takes a new flag.

Halftone method (Main Control)takes 1 new parameter.

HistogramTable property (Main Control) iIndex parameter is now a long value.

LoadCompressed property (Main Control) data type is now short.

RemapTable property (Main Control) both the property and the parameter are now type long.

The rest of this topic lists the new properties, methods and events in version 13.

Animation

AnimationFrameIndex property

AnimationPause property

Annotations (Document/Medical only)

AnnBoundingRectHeight property (Main Control)

AnnBoundingRectLeft property (Main Control)

AnnBoundingRectTop property (Main Control)

AnnBoundingRectWidth property (Main Control)

AnnBringToFront method (Main Control)

AnnCreateItem method (Main Control)

AnnCut method (Main Control)

AnnDeletePage method (Main Control)

AnnDeletePageArray method (Main Control)

AnnDeletePageMemory method (Main Control)

AnnFileInfo method (Main Control)

AnnFileInfoArray method (Main Control)

AnnFileInfoMemory method (Main Control)

AnnGetAngle method (Main Control)

AnnGetArea method (Main Control)

AnnGetAutoBackColor method (Main Control)

AnnGetBackColor method (Main Control)

AnnGetBitmap method (Main Control)

AnnGetBitmapDpiX method (Main Control)

AnnGetBitmapDpiY method (Main Control)

AnnGetContainer method (Main Control)

AnnGetDistance method (Main Control)

AnnGetFillMode method (Main Control)

AnnGetFillPattern method (Main Control)

AnnGetFontBold method (Main Control)

AnnGetFontItalic method (Main Control)

AnnGetFontName method (Main Control)

AnnGetFontSize method (Main Control)

AnnGetFontStrikeThrough method (Main Control)

AnnGetFontUnderline method (Main Control)

AnnGetForeColor method (Main Control)

AnnGetGaugeLength method (Main Control)

AnnGetLineStyle method (Main Control)

AnnGetLineWidth method (Main Control)

AnnGetMetafile method (Main Control)

AnnGetNameOffsetX method (Main Control)

AnnGetNameOffsetY method (Main Control)

AnnGetNameRestrict method (Main Control)

AnnGetName method (Main Control)

AnnGetNodes method (Main Control)

AnnGetOffsetX method (Main Control)

AnnGetOffsetY method (Main Control)

AnnGetPolyFillMode method (Main Control)

AnnGetPredefinedMetafile method (Main Control)

AnnGetProtractorOptions method (Main Control)

AnnGetRgnHandle method (Main Control)

AnnGetROP2 method (Main Control)

AnnGetScalarX method (Main Control)

AnnGetScalarY method (Main Control)

AnnGetSecondaryBitmap method (Main Control)

AnnGetSelected method (Main Control)

AnnGetShowFlags method (Main Control)

AnnGetText method (Main Control)

AnnGetTopContainer method (Main Control)

AnnGetTransparent method (Main Control)

AnnGetTransparentColor method (Main Control)

AnnGetUnit method (Main Control)

AnnGetWnd method (Main Control)

AnnHitTest method (Main Control)

AnnInfoFormat property (Main Control)

AnnInfoTotalPages property (Main Control)

AnnInfoVersion property (Main Control)

AnnNameBoundingRectHeight property (Main Control)

AnnNameBoundingRectLeft property (Main Control)

AnnNameBoundingRectTop property (Main Control)

AnnNameBoundingRectWidth property (Main Control)

AnnNameRectHeight property (Main Control)

AnnNameRectLeft property (Main Control)

AnnNameRectTop property (Main Control)

AnnNameRectWidth property (Main Control)

AnnRemove method (Main Control)

AnnSaveOffset method (Main Control)

AnnSelectPoint method (Main Control)

AnnSelectRect method (Main Control)

AnnSelectRectHeight property (Main Control)

AnnSelectRectLeft property (Main Control)

AnnSelectRectTop property (Main Control)

AnnSelectRectWidth property (Main Control)

AnnSendToBack method (Main Control)

AnnSetAutoBackColor method (Main Control)

AnnSetBackColor method (Main Control)

AnnSetBitmap method (Main Control)

AnnSetBitmapDpiX method (Main Control)

AnnSetBitmapDpiY method (Main Control)

AnnSetFillMode method (Main Control)

AnnSetFillPattern method (Main Control)

AnnSetFontBold method (Main Control)

AnnSetFontItalic method (Main Control)

AnnSetFontName method (Main Control)

AnnSetFontSize method (Main Control)

AnnSetFontStrikeThrough method (Main Control)

AnnSetFontUnderline method (Main Control)

AnnSetForeColor method (Main Control)

AnnSetGaugeLength method (Main Control)

AnnSetLineStyle method (Main Control)

AnnSetLineWidth method (Main Control)

AnnSetMetafile method (Main Control)

AnnSetNameOffsetX method (Main Control)

AnnSetNameOffsetY method (Main Control)

AnnSetNameRestrict method (Main Control)

AnnSetName method (Main Control)

AnnSetNodes method (Main Control)

AnnSetOffsetX method (Main Control)

AnnSetOffsetY method (Main Control)

AnnSetPoints method (Main Control)

AnnSetPolyFillMode method (Main Control)

AnnSetPredefinedMetafile method (Main Control)

AnnSetProtractorOptions method (Main Control)

AnnSetROP2 method (Main Control)

AnnSetScalarX method (Main Control)

AnnSetScalarY method (Main Control)

AnnSetSecondaryBitmap method (Main Control)

AnnSetShowFlags method (Main Control)

AnnSetText method (Main Control)

AnnSetTransparent method (Main Control)

AnnSetTransparentColor method (Main Control)

AnnSetUnit method (Main Control)

AnnSetWnd method (Main Control)

Bitmaps

BitmapDataPathClosed event (Main Control)

Buffers

EnableSaveBufferEvent property (Main Control)

LoadBuffer method (Main Control)

SaveBuffer event (Main Control)

SaveBuffer method (Main Control)

SaveBufferAddress property (Main Control)

SaveBufferSize property (Main Control)

Image Processing

AddBitmaps method (Main Control)

AddBorder method (Main Control)

AddFrame method (Main Control)

AlphaBlend method (Main Control)

AntiAlias method (Main Control)

BalanceColors method (Main Control)

Combine method (Main Control)

CombineExt method (Main Control)

CombineBitmapWarp method (Main Control)

ConvertSignedToUnsigned method (Main Control)

ConvertToColoredGray method (Main Control)

CreateFadedMask method (Main Control)

EdgeDetector method (Main Control)

FeatherAlphaBlend method (Main Control)

GaussianFilter method (Main Control)

GetFunctionalLookupTable method (Main Control)

GetUserLookupTable method (Main Control)

GrayscaleExt method (Main Control)

LineProfile method (Main Control)

LineProfileBlue property (Main Control)

LineProfileGreen property (Main Control)

LineProfileRed property (Main Control)

LineProfileSize property (Main Control)

MotionBlur method (Main Control)

PicturizeBitmapList method (Main Control)

PicturizeSingle method (Main Control)

RemoveRedeye method (Main Control)

SwapColors method (Main Control)

UnsharpMask method (Main Control)

ImageList

FirstVisibleItem property (ImageList Control)

OwnerDrawItems property (ImageList Control)

OwnerDrawItem event (ImageList Control)

SelectedCount property (ImageList Control)

SelectedItems property (ImageList Control)

ViewSize property (ImageList Control)

ISIS

ISISGetASCIITag method (ISIS® Control)

ISISGetASCIITagChoice method (ISIS® Control)

ISISGetASCIITagChoiceCount method (ISIS® Control)

ISISGetTagChoice method (ISIS® Control)

ISISGetTagChoiceCount method (ISIS® Control)

ISISSetASCIITag method (ISIS® Control)

Magnifying Glass

HasMagGlass property (Main Control)

MagGlassCursor event (Main Control)

MagGlassPaintContrast property (Main Control)

MagGlassPaintGamma property (Main Control)

MagGlassPaintIntensity property (Main Control)

SetMagGlassPos method (Main Control)

ShowMagGlass method (Main Control)

UpdateMagGlassFromHandle method

Mixed Raster Content Module

AutoSegment event (Mixed Raster Content Control)

AutoSegment method (Mixed Raster Content Control)

BackgroundCoder property (Mixed Raster Content Control)

BackgroundQFactor property (Mixed Raster Content Control)

BaseBackColor property (Mixed Raster Content Control)

BaseForeColor property (Mixed Raster Content Control)

Bitmap property (Mixed Raster Content Control)

DeleteSegment method (Mixed Raster Content Control)

EnableMethodErrors property (Mixed Raster Content Control)

EnumSegments event (Mixed Raster Content Control)

EnumSegments method (Mixed Raster Content Control)

EnhanceQuality property (Mixed Raster Content Control)

GetPagesCount method (Mixed Raster Content Control)

IsSupportLocked method (Mixed Raster Content Control)

Load method (Mixed Raster Content Control)

MaskCoder property (Mixed Raster Content Control)

Save method (Mixed Raster Content Control)

SaveT44 method (Mixed Raster Content Control)

SetNewStripe method (Mixed Raster Content Control)

SetStripeSegment method (Mixed Raster Content Control)

StripeMaxHeight property (Mixed Raster Content Control)

UnlockSupport method (Mixed Raster Content Control)

UpdateSegmentData method (Mixed Raster Content Control)

PSD Layers

InfoLayers property (Main Control)

LayerBlendModeKey property (Main Control)

LayerClipping property (Main Control)

LayerLeft property (Main Control) (Main Control)

LayerMaskBitmap property (Main Control)

LayerOpacity property (Main Control)

LayerTop property (Main Control)

LoadLayer method (Main Control)

SaveLayers property (Main Control)

Scrolling

HScrollInfo property (Main Control)

VScrollInfo property (Main Control)

Standard Curves and Bezier Curves

BezierSize property (Main Control)

BezierX property (Main Control)

BezierY property (Main Control)

CurveClose property (Main Control)

CurveSize property (Main Control)

CurveTension property (Main Control)

CurveToBezier method (Main Control)

CurveType property (Main Control)

CurveX property (Main Control)

CurveY property (Main Control)

SetRgnCurve method (Main Control)

UserLUTCurveSize property (Main Control)

UserLUTCurveX property (Main Control)

UserLUTCurveY property (Main Control)

Super Compression

BitmapCompression property (Main Control)

Thumbnail Browser

SkipFile property (Thumbnail Browser Control)

Transforming Files

TransformFile method (Main Control)

TransformMarker event (Main Control)

WriteMarker method (Main Control)

WriteMarkerAction property (Main Control)

Miscellaneous

CenterImage property

ControlWindow property

CreateUserBitmap method

EnableFilePageLoadedEvent property

FilePageLoaded event

GetArrayInfo method

GetBitmapClipSegments method (Main Control)

IsSigned property (Main Control)

LoadResize method (Main Control)

LoadSigned property (Main Control)

PDFSaveLowMemory property

PixelData property (Main Control)

ResizeRgn method (Main Control)

SaveTileHeight property (Main Control)

SaveTileWidth property (Main Control)

SetBitmapDataPointer method


Changes from Version 12 to Version 12.1

Version 12.1 of the LEADTOOLS ActiveX has changed from version 12 as follows:

 LEADTOOLS now supports the J2K and JP2 JPEG 2000 file formats.  (JPEG 2000 Plug In only)

 Please note that the vector file format support previously provided by the LEADTOOLS File Format Plug ins is now provided through the LEADTOOLS Vector View Plug in. Therefore, the L_SUPPORT_VECTOR_DWG, L_SUPPORT_VECTOR_DWF, L_SUPPORT_VECTOR_DXF, L_SUPPORT_VECTOR_MISC and L_SUPPORT_VECTOR_ALL constants are now obsolete. If these constants are currently in your code, they will continue to work in LEADTOOLS 12.1. However, you should consider adding the LEADTOOLS Vector View Plug in or upgrading to the LEADTOOLS Vector Imaging Pro toolkit.

 Vector support can now be unlocked for viewing only. Please note that if vector viewing support is unlocked using L_SUPPORT_VECTOR_VIEW, vector editing methods will return ERROR_VECTOR_LOCKED and some editing related properties will be read only.

 Please note that the MagGlass event and the UpdateMagGlass method are now obsolete. To achieve the same functionality, use the MagGlassExt event and the UpdateMagGlassExt method.

 LEADTOOLS now supports an ImageList event for unselecting an item.

 LEADTOOLS now supports loading and saving multi-page TIFF files using the ImageList control.

 The Thumbnail Browser can now be used to create thumbnails for a single image file.

 LEADTOOLS provides a new Deskew method that lets you specify the background color.

 LEADTOOLS now supports Magnifying Glass features that let you update the bitmap from another source during the procedure.

 LEADTOOLS also provides support for customizing the shape of the Magnifying Glass.

 LEADTOOLS now supports File Transfer mode for acquiring images from TWAIN devices.

 LEADTOOLS also now provides a method for determining whether a TWAIN device is available.

 LEADTOOLS provides new support for changing the hue, saturation and value of images, allowing you to color replace a range of colors.

 New functions let you create a region based on an RGB color range or an HSV color range.

 LEADTOOLS can now convert between V4 and V5 DIBs.

 DICOM now supports Structured IODs.

 LEADTOOLS now supports the loading and saving of RAW uncompressed image data.

 LEADTOOLS can now convert from JPEG compressed DIBs.

 LEADTOOLS can now convert from RLE4 and RLE8 compressed DIBs.

 LEADTOOLS provides more support for grouping and ungrouping annotation objects.

 LEADTOOLS now provides support for changing the background color of Redact, Push pin, Note and Hilite objects created by an automation object.

 LEADTOOLS provides more support for undoing automation operations in automated annotations.

 LEADTOOLS now provides support for loading and saving PDF files.

 LEADTOOLS now provides support for controlling the rasterizing of vector image files.

 LEADTOOLS now provides view perspective when getting file information.

 LEADTOOLS can now allocate memory in tiles for supporting very large images.

 LEADTOOLS now supports 12 and 16-bit grayscale histograms.

 The Vector toolkit now supports faster loading for DWF, DWG, DXF and HPGL files.

 The Vector toolkit now supports more entities for DWG and DXF files.

 Data binding in the Main OCX and the OLE DB OCX has been changed. The image data is stored first, followed by the annotation data. This allows other applications to read data from the database field.

 LEADTOOLS now provides methods for converting between Bitmap coordinates and Client coordinates.

The LEADTOOLS Multimedia toolkits currently include many of the functions documented in the Ltnetocxn.hlp help file and this manual.  This is the final version of the LEADTOOLS Multimedia toolkit that will contain those functions.  In future releases, the functions documented in the Ltnetocxn.hlp help file will only be available in the LEADTOOLS Internet Imaging toolkits.

The rest of this topic lists the new properties, methods and events in version 12.1.

Annotation (Document/Medical only)

AnnAddUndoNode method

AnnAutoDialogFontSize property

AnnAutoResize property

AnnGetGrouping method

AnnSetGrouping method

AnnUndo method

AnnUndoDepth property

AnnUndoEnable property

AnnUserMenu event

Bitmap/Client Coordinate Conversion

BitmapToClient method

ClientToBitmap method

ConvertX property

ConvertY property

DIB

GetDIB2 method

Image Processing

Deskew2 method

GetHistogramGray method

HistogramGrayTable property

HistogramGrayTableSize property

HScrollInfo property

HSV_HfromRGB method

HSV_SfromRGB method

HSV_VfromRGB method

HTable property

MaskTable property

RemapHue method

RGBfromHSV method

STable property

VScrollInfo property

VTable property

ImageList

FirstVisibleItem property

LoadDatabase method

OwnerDrawItems property

OwnerDrawItem event

SaveDatabase method

SelectedCount property

SelectedItems property

SkipFile property

ViewSize property

ISIS Control

ISISGetASCIITag method

ISISGetASCIITagChoice method

ISISGetASCIITagChoiceCount method

ISISGetTagChoice method

ISISGetTagChoiceCount method

ISISSetASCIITag method

Magnifying Glass

EnableMagGlassEvent property

MagGlass event

MagGlassFlags property

UpdateMagGlass method

UpdateMagGlassShape method

HasMagGlass property

PDF File Support

PDFXResolution property

PDFYResolution property

PDFDisplayDepth property

PDFTextAlpha property

PDFSaveUseDPI property

PDFGraphicsAlpha property

PDFUseLibFonts property

Rasterizing Vector Files

RasterizeViewMode property

RasterizeViewportHeight property

RasterizeViewportWidth property

RAW Uncompressed Data Support

FileSizeWritten property

SavePad4 property

SaveOffset method

Region Processing

SetRgnColorHSVRange method

SetRgnColorRGBRange method

Thumbnail Browser

CreateThumbnailFromFile method

TWAIN

EnableTwainFileEvent property

EnableTwainFileFormatEvent property

IsTwainAvailable method

TwainAcquireFile method

TwainFile event

TwainFileFormat event

TwainFileFormatStatus property

JPEG 2000 Plug in Feature

J2KCBS_ErrorResilienceSymbol property

J2KCBS_PredictableTermination property

J2KCBS_ResetContextOnBoundaries property

J2KCBS_SelectiveACBypass property

J2KCBS_TerminationOnEachPass property

J2KCBS_VerticallyCausalContext property

J2KCodBlockHeight property

J2KCodBlockWidth property

J2KCompressionControl property

J2KCompressionRatio property

J2KDecompLevel property

J2KDerivedBaseExponent property

J2KDerivedBaseMantissa property

J2KDerivedQuantization property

J2KGuardBits property

J2KProgressOrder property

J2KROIControl property

J2KROIHeight property

J2KROILeft property

J2KROITop property

J2KROIWidth property

J2KSetDefaults method

J2KTargetFileSize property

J2KUseColorTransform property

J2KUseEPHMarker property

J2KUseROI property

J2KUseSOPMarker property

J2KXOsiz property

J2KXTOsiz property

J2KXTsiz property

J2KYOsiz property

J2KYTOsiz property

J2KYTsiz property

Miscellaneous

InfoViewPerspective property

PrintNewPage method


Changes from Version 11.5 to Version 12

Version 12 of the LEADTOOLS ActiveX has changed from version 11.5 as follows:

The product line in Version 12 has been redesigned. If you are an existing LEADTOOLS customer, please take a moment to familiarize yourself with the new line of products and the new features.

Essentially the changes are as follows:

 LEADTOOLS no longer supports 16-bit development environments.

 LEADTOOLS Imaging is now LEADTOOLS Raster Imaging.

 LEADTOOLS Imaging Pro is now LEADTOOLS Raster Imaging Pro.

 LEADTOOLS Vector Imaging Suite is no longer available.

 LEADTOOLS Vector Imaging Pro Suite is now LEADTOOLS Vector Imaging Pro. It no longer includes LEADTOOLS Imaging Pro, but provides many more vector features, including automation, container and toolbar capabilities.

 LEADTOOLS Document Express is now LEADTOOLS Document Imaging. It no longer includes support for Multimedia and Vector features.

 LEADTOOLS Document Express Suite is now LEADTOOLS Document Imaging Suite. It no longer includes support for Multimedia and Vector features. It now includes a "Clean-up" module for improving 1-bit images.

 LEADTOOLS Medical Express is now LEADTOOLS Medical Imaging. It no longer includes Multimedia and Vector support.

 LEADTOOLS Medical Express Suite is now LEADTOOLS Medical Imaging Suite. It no longer includes Multimedia and Vector support.

 Please note that the Common Dialog Control information has been removed from this help file and placed in a separate help file, Ltdlgocxn.hlp in the LEAD\HELP directory.

 Optional PDF plug-in for PDF file format support (PDF, PS, and EPS) is now available.

 Optional Raster plug-ins for vector file format support (DXF, DWG, DRW, PLT, TIFF with DXF, and INTERGRAPH_VECTOR) are now available.

 New document "Clean-up" features including hole-punch removal, line removal, border removal, invert text, smooth filter, and dot removal.  Additionally, region of interest has been enhanced to allow preview of changes and composite viewing of the modified regions.

 Optimized memory management, which increases the speed of all LEADTOOLS functions.

 Reduced the number of TLS slots (thread local storage) used by LEADTOOLS DLLs. Previous versions of LEADTOOLS used up to 23 TLS slots.  LEADTOOLS v12 now uses up to 2 TLS slots.

 Reduced the memory footprint of the main ActiveX, and simultaneously added functionality. This will reduce memory limitation problems that occur with some environments.

 Added more flavors to most LEADTOOLS 12 file filters.

 Redesigned the CCITT G3/G4 compression/decompression engine, resulting in an additional 80% speed increase over version 11.5.

 Loading (decompressing) and saving (compressing) JPEG files have been hand-optimized for (MMX, PII and PIII). Most files now compress 100% faster and decompress 50% faster.

 TIFF comments have been enhanced.

 Removed the limitation associated with handling TIFF files that contain more than 32767 pages. LEADTOOLS can now manipulate TIFF files with up to 2 billion pages.

 Loading and saving TIFF files with CMP and JBIG compression are now supported.

 Saving vector images as a DXF inside a TIFF file is now supported in LEADTOOLS Vector Imaging Pro.

 Loading and saving SGI files has been added.

 A New feature that allows you to specify the preferred load format when loading files has been added.

 A new Selection Style for the ImageList that lets you mark selected items with a bitmap has been added.

 The Picturize algorithm now supports more options.

 A new magnifying glass tool for zooming in on an image has been added.

 A new magic wand which creates a region from an X, Y location and a color tolerance has been added.

 A new region frame with color feature has been added.

 Regions can now be displayed with a color "highlight" in addition to an animated frame.

 Writing TIFF tags to any page in an existing file is now supported.

Changed Properties, Methods and Events

The following properties, methods and events have changed since version 11.5:

AnnLoad method (data type of a parameter has changed)

DeletePage method (data type of a parameter has changed)

GetFileInfo Method (data type of a parameter has changed and a new parameter has been added)

GetMemoryInfo method (data type of a parameter has changed)

InfoPage property (data type has changed)

InfoTotalPages property (data type has changed)

LoadArray method (data type of a parameter has changed)

LoadMemory method (data type of a parameter has changed)

Load method (data type of a parameter has changed)

ReadComment method (data type of a parameter has changed)

ReadTag method (data type of a parameter has changed)

StartFeedLoad method (data type of a parameter has changed)

TwainMaxPages property (data type has changed)

WriteComment method (data type of a parameter has changed)

WriteTag method (data type of a parameter has changed)

The rest of this section lists the new functions included in version 12:

BorderRemove event

BorderRemove method

DocCleanBitmap property

DocCleanSuccess property

DotRemove event

DotRemove method

GetTagCount method

GetTagData method

GetTagType method

hDocCleanRgn property

HolePunchRemove event

HolePunchRemove method

InfoIFD property

InvertedText event

InvertedText method

LineRemove event

LineRemove method

LoadIFD property

MagGlassMaskCount property

MagGlassMask property

PreferredLoadFormat property

ReadTag method

RgnFrameColor property

SaveIFD property

SetRgnMagicWand method

SetTag method

Smooth event

Smooth method

StartMagGlass method

StopMagGlass method

WriteComment method

WriteTag method


Changes from Version 10 to Version 11
Changes from Version 10 to Version 11 (11.5)

Version 11 of the LEADTOOLS ActiveX has changed from version 10 as follows:

 LEADTOOLS now supports 48-bit and 64-bit bitmaps. 48-bit bitmaps are color bitmaps with 16-bits per each component (R, G and B). 64-bit bitmaps are 48-bit bitmaps with alpha channel information (16-bit alpha value). (11.5) (Medical Express only)

 The Netscape Plug-in now installs by clicking on a self-extracting file and provides more image processing. (11.5)

 New flags for the Rotate method support interpolation while rotating certain images. (11.5)

 New properties support interpolation while painting in both the control window and the pan window.

 DICOM Network Communication for Message Exchange is now supported. (Medical Express Suite only) (11.5)

 LEADTOOLS now supports all possible View Perspective values. (11.5)

 Duplex scanning (scanning both sides of a page) is now supported for those TWAIN scanners that support duplex scanning.

 (Express only) Now supports the following new objects:

ANNOBJECT_CROSSPRODUCT

ANNOBJECT_POINT

ANNOBJECT_PROTRACTOR

ANNOBJECT_VIDEO

ANNOBJECT_PUSHPIN

ANNOBJECT_FREEHANDHOTSPOT

 (Express only) Annotation Automation menu items are fully customizable.

 (Express only) The Main Control has a new AnnToolbar property, which allows customization of the Annotation Toolbar.

 (Express only) New Annotation file format, ANNFMT_ENCODED provides an encoded native format for better security and smaller file sizes.

 LEADTOOLS ActiveX now supports MPEG-2.

 The following new formats are supported:

FILE_CLP (11.5)

FILE_XWD10 (11.5)

FILE_XWD11 (11.5)

FILE_ANI (11.5)

FILE_FLC (11.5)

FILE_DRW (11.5)

FILE_CGM (11.5)

FILE_PCT (Vector) (11.5)

FILE_PLT (11.5)

FILE_INTERGRAPH_VECTOR (11.5)

FILE_PBM_ASCII

FILE_PBM_BINARY

FILE_PGM_ASCII

FILE_PGM_BINARY

FILE_PPM_ASCII

FILE_PPM_BINARY

FILE_CUT

FILE_XPM

FILE_XBM

FILE_IFF_ILBM

FILE_IFF_CAT

FILE_INTERGRAPH_RLE

FILE_DICOM_RLE_GRAY

FILE_DICOM_RLE_COLOR

FILE_DICOM_JPEG_GRAY

FILE_DICOM_JPEG_COLOR

FILE_CALS4

FILE_CALS2

FILE_CALS3

FILE_MPEG2

FILE_DXF – can be read as vector or raster, can be saved as vector.

 In WIN32, the dialogs now allow the WIN95 standard context sensitive help icon "?" to be added to the title bar.

 An ImageList Control has been added to make working with and displaying a list of images simple.

 You can now browse a directory for LEAD supported images and generate thumbnails.

 A Vector ActiveX has been added to support vector images.

Changed or removed Properties, methods or events

The following functions have been changed from the previous version of LEADTOOLS or removed:

 The following have been renamed:

Old Name	New Name

DimensionCount property	LoadResolutionCount property

EnumDimensions method	ReadLoadResolutions method

SetDimension method	SetLoadResolution method

GetDimension method	GetLoadResolution method

DimensionWidth property	LoadResolutionWidth property

DimensionHeight property	LoadResolutionHeight property

 The following methods have been changed:

Rotate method (takes a new parameter)

DlgHelp event (takes a new parameter)

 The UseTransparentColor and TransparentColor properties have been removed.

 The SaveFormatFlags property has been removed.

The rest of this topic lists the new properties, methods and events in version 11.

Duplex Scanning

TwainDuplex property

EnableTwainDuplex property

Annotations (Express only)

AnnToolChecked event

AnnToolDestroy event

AnnMouseDown event

AnnMouseMove event

AnnMouseUp event

AnnMenu event

AnnDestroy method

AnnCreate method

AnnInsert method

AnnDefine method

AnnSetAutoDefaults method

SetMousePos method

AnnSetUser method

AnnSetVisible method

AnnGetVisible method

AnnSetSelected method

AnnGroup method

AnnUngroup method

AnnGetObjectFromTag method

AnnSetAutoMenuItemEnable method

AnnGetAutoMenuItemEnable method

AnnToolbar property

AnnRectLeft property

AnnRectTop property

AnnRectWidth property

AnnRectHeight property

Visible property

Tool property

AutoSetTool property

ButtonCount property

ButtonColumns property

ButtonRows property

hWnd property

Create method

ButtonVisible property

ButtonTool property

ButtonToolCount property

ButtonMenuTool property

ButtonMenuTextID property

ButtonMenuText property

ButtonBitmapDown property

ButtonBitmapUp property

ButtonToolTipTextID property

ButtonToolTipText property

ItemString property

ItemID property

ItemType property

ItemChecked property

ItemEnabled property

DeleteItem method

AddItem method

GetSubMenu method

Working with byte arrays

LoadArray method

SaveArray method

AnnLoadArray method

AnnSaveArray method

DICOM Control

Communication Support (11.5)

Accept method (Refer to Ltdicocxn.hlp)

AddPresentation method (Refer to Ltdicocxn.hlp)

AddTransferSyntax method (Refer to Ltdicocxn.hlp)

AddUserInfo method (Refer to Ltdicocxn.hlp)

Close method (Refer to Ltdicocxn.hlp)

Connect method (Refer to Ltdicocxn.hlp)

CreateAssociate method (Refer to Ltdicocxn.hlp)

DefaultAssociate method (Refer to Ltdicocxn.hlp)

DeletePresentation method (Refer to Ltdicocxn.hlp)

DeleteTransferSyntax method (Refer to Ltdicocxn.hlp)

DeleteUserInfo method (Refer to Ltdicocxn.hlp)

EnableMethodErrors property (Refer to Ltdicocxn.hlp)

FindPresentationAbstract method (Refer to Ltdicocxn.hlp)

FreeAssociate method (Refer to Ltdicocxn.hlp)

GetApplication method (Refer to Ltdicocxn.hlp)

GetAssociate method (Refer to Ltdicocxn.hlp)

GetCalled method (Refer to Ltdicocxn.hlp)

GetCalling method (Refer to Ltdicocxn.hlp)

GetClient method (Refer to Ltdicocxn.hlp)

GetClientCount method (Refer to Ltdicocxn.hlp)

GetExtendedData method (Refer to Ltdicocxn.hlp)

GetExtendedDataLength method (Refer to Ltdicocxn.hlp)

GetHostAddress method (Refer to Ltdicocxn.hlp)

GetHostPort method (Refer to Ltdicocxn.hlp)

GetImplementClass method (Refer to Ltdicocxn.hlp)

GetImplementVersion method (Refer to Ltdicocxn.hlp)

GetInvokedOperationsCount method (Refer to Ltdicocxn.hlp)

GetMaxLength method (Refer to Ltdicocxn.hlp)

GetPeerAddress method (Refer to Ltdicocxn.hlp)

GetPeerPort method (Refer to Ltdicocxn.hlp)

GetPerformedOperationsCount method (Refer to Ltdicocxn.hlp)

GetPresentationAbstract method (Refer to Ltdicocxn.hlp)

GetPresentationCount method (Refer to Ltdicocxn.hlp)

GetPresentationID method (Refer to Ltdicocxn.hlp)

GetPresentationResult method (Refer to Ltdicocxn.hlp)

GetProviderRole method (Refer to Ltdicocxn.hlp)

GetSendQueueSize method (Refer to Ltdicocxn.hlp)

GetServer method (Refer to Ltdicocxn.hlp)

GetTransferCount method (Refer to Ltdicocxn.hlp)

GetTransferSyntax method (Refer to Ltdicocxn.hlp)

GetUserInfoCount method (Refer to Ltdicocxn.hlp)

GetUserInfoData method (Refer to Ltdicocxn.hlp)

GetUserInfoLength method (Refer to Ltdicocxn.hlp)

GetUserInfoType method (Refer to Ltdicocxn.hlp)

GetUserRole method (Refer to Ltdicocxn.hlp)

GetVersion method (Refer to Ltdicocxn.hlp)

hNet property (Refer to Ltdicocxn.hlp)

hPDU property (Refer to Ltdicocxn.hlp)

InfoCommand property (Refer to Ltdicocxn.hlp)

InfoRequest property (Refer to Ltdicocxn.hlp)

IsActivated method (Refer to Ltdicocxn.hlp)

IsAssociated method (Refer to Ltdicocxn.hlp)

IsAsyncOperations method (Refer to Ltdicocxn.hlp)

IsConnected method (Refer to Ltdicocxn.hlp)

IsImplementClass method (Refer to Ltdicocxn.hlp)

IsImplementVersion method (Refer to Ltdicocxn.hlp)

IsMaxLengthEnabled method (Refer to Ltdicocxn.hlp)

IsRequest method (Refer to Ltdicocxn.hlp)

IsRoleSelect method (Refer to Ltdicocxn.hlp)

IsSupportLocked method (Refer to Ltdicocxn.hlp)

Listen method (Refer to Ltdicocxn.hlp)

NetAccept event (Refer to Ltdicocxn.hlp)

NetClose event (Refer to Ltdicocxn.hlp)

NetConnect event (Refer to Ltdicocxn.hlp)

NetReceive event (Refer to Ltdicocxn.hlp)

NetReceiveAbort event (Refer to Ltdicocxn.hlp)

NetReceiveAssociateAccept event (Refer to Ltdicocxn.hlp)

NetReceiveAssociateReject event (Refer to Ltdicocxn.hlp)

NetReceiveAssociateRequest event (Refer to Ltdicocxn.hlp)

NetReceiveCCancelRequest event (Refer to Ltdicocxn.hlp)

NetReceiveCEchoRequest event (Refer to Ltdicocxn.hlp)

NetReceiveCEchoResponse event (Refer to Ltdicocxn.hlp)

NetReceiveCFindRequest event (Refer to Ltdicocxn.hlp)

NetReceiveCFindResponse event (Refer to Ltdicocxn.hlp)

NetReceiveCGetRequest event (Refer to Ltdicocxn.hlp)

NetReceiveCGetResponse event (Refer to Ltdicocxn.hlp)

NetReceiveCMoveRequest event (Refer to Ltdicocxn.hlp)

NetReceiveCMoveResponse event (Refer to Ltdicocxn.hlp)

NetReceiveCStoreRequest event (Refer to Ltdicocxn.hlp)

NetReceiveCStoreResponse event (Refer to Ltdicocxn.hlp)

NetReceiveData event (Refer to Ltdicocxn.hlp)

NetReceiveNActionRequest event (Refer to Ltdicocxn.hlp)

NetReceiveNActionResponse event (Refer to Ltdicocxn.hlp)

NetReceiveNCreateRequest event (Refer to Ltdicocxn.hlp)

NetReceiveNCreateResponse event (Refer to Ltdicocxn.hlp)

NetReceiveNDeleteRequest event (Refer to Ltdicocxn.hlp)

NetReceiveNDeleteResponse event (Refer to Ltdicocxn.hlp)

NetReceiveNGetRequest event (Refer to Ltdicocxn.hlp)

NetReceiveNGetResponse event (Refer to Ltdicocxn.hlp)

NetReceiveNReportRequest event (Refer to Ltdicocxn.hlp)

NetReceiveNReportResponse event (Refer to Ltdicocxn.hlp)

NetReceiveNSetRequest event (Refer to Ltdicocxn.hlp)

NetReceiveNSetResponse event (Refer to Ltdicocxn.hlp)

NetReceiveReleaseRequest event (Refer to Ltdicocxn.hlp)

NetReceiveReleaseResponse event (Refer to Ltdicocxn.hlp)

NetReceiveUnknown event (Refer to Ltdicocxn.hlp)

NetSend event (Refer to Ltdicocxn.hlp)

NetworkTempPath property (Refer to Ltdicocxn.hlp)

RequestAttributeCount property (Refer to Ltdicocxn.hlp)

RequestAttributes property (Refer to Ltdicocxn.hlp)

ResetAssociate method (Refer to Ltdicocxn.hlp)

SendAbort method (Refer to Ltdicocxn.hlp)

SendAssociateAccept method (Refer to Ltdicocxn.hlp)

SendAssociateReject method (Refer to Ltdicocxn.hlp)

SendAssociateRequest method (Refer to Ltdicocxn.hlp)

SendCCancelRequest method (Refer to Ltdicocxn.hlp)

SendCEchoRequest method (Refer to Ltdicocxn.hlp)

SendCEchoResponse method (Refer to Ltdicocxn.hlp)

SendCFindRequest method (Refer to Ltdicocxn.hlp)

SendCFindResponse method (Refer to Ltdicocxn.hlp)

SendCGetRequest method (Refer to Ltdicocxn.hlp)

SendCGetResponse method (Refer to Ltdicocxn.hlp)

SendCMoveRequest method (Refer to Ltdicocxn.hlp)

SendCMoveResponse method (Refer to Ltdicocxn.hlp)

SendCStoreRequest method (Refer to Ltdicocxn.hlp)

SendCStoreResponse method (Refer to Ltdicocxn.hlp)

SendData method (Refer to Ltdicocxn.hlp)

SendNActionRequest method (Refer to Ltdicocxn.hlp)

SendNActionResponse method (Refer to Ltdicocxn.hlp)

SendNCreateRequest method (Refer to Ltdicocxn.hlp)

SendNCreateResponse method (Refer to Ltdicocxn.hlp)

SendNDeleteRequest method (Refer to Ltdicocxn.hlp)

SendNDeleteResponse method (Refer to Ltdicocxn.hlp)

SendNGetRequest method (Refer to Ltdicocxn.hlp)

SendNGetResponse method (Refer to Ltdicocxn.hlp)

SendNReportRequest method (Refer to Ltdicocxn.hlp)

SendNReportResponse method (Refer to Ltdicocxn.hlp)

SendNSetRequest method (Refer to Ltdicocxn.hlp)

SendNSetResponse method (Refer to Ltdicocxn.hlp)

SendReleaseRequest method (Refer to Ltdicocxn.hlp)

SendReleaseResponse method (Refer to Ltdicocxn.hlp)

SetApplication method (Refer to Ltdicocxn.hlp)

SetAsyncOperations method (Refer to Ltdicocxn.hlp)

SetCalled method (Refer to Ltdicocxn.hlp)

SetCalling method (Refer to Ltdicocxn.hlp)

SetCommandSet method (Refer to Ltdicocxn.hlp)

SetExtendedData method (Refer to Ltdicocxn.hlp)

SetImplementClass method (Refer to Ltdicocxn.hlp)

SetImplementVersion method (Refer to Ltdicocxn.hlp)

SetMaxLength method (Refer to Ltdicocxn.hlp)

SetPresentationAbstract method (Refer to Ltdicocxn.hlp)

SetPresentationID method (Refer to Ltdicocxn.hlp)

SetPresentationResult method (Refer to Ltdicocxn.hlp)

SetRequest method (Refer to Ltdicocxn.hlp)

SetRoleSelect method (Refer to Ltdicocxn.hlp)

SetTransferSyntax method (Refer to Ltdicocxn.hlp)

SetUserInfo method (Refer to Ltdicocxn.hlp)

SetVersion method (Refer to Ltdicocxn.hlp)

ShutDown method (Refer to Ltdicocxn.hlp)

StartUp method (Refer to Ltdicocxn.hlp)

UnlockSupport method (Refer to Ltdicocxn.hlp)

File Format Support

IncludeVolatile property (Refer to Ltdicocxn.hlp)

DeleteKey method (Refer to Ltdicocxn.hlp) (11.5)

FindFirstKey method (Refer to Ltdicocxn.hlp) (11.5)

FindLastKey method (Refer to Ltdicocxn.hlp) (11.5)

FindNextKey method (Refer to Ltdicocxn.hlp) (11.5)

FindPrevKey method (Refer to Ltdicocxn.hlp) (11.5)

GetInfoCS method (Refer to Ltdicocxn.hlp) (11.5)

GetKeyValue method (Refer to Ltdicocxn.hlp) (11.5)

hDicomDS property (Refer to Ltdicocxn.hlp) (11.5)

InitCS method (Refer to Ltdicocxn.hlp) (11.5)

InsertDS method (Refer to Ltdicocxn.hlp) (11.5)

InsertKey method (Refer to Ltdicocxn.hlp) (11.5)

MoveChildKey method (Refer to Ltdicocxn.hlp) (11.5)

MoveFirstKey method (Refer to Ltdicocxn.hlp) (11.5)

MoveLastKey method (Refer to Ltdicocxn.hlp) (11.5)

MoveNextKey method (Refer to Ltdicocxn.hlp) (11.5)

MoveParentKey method (Refer to Ltdicocxn.hlp) (11.5)

MovePrevKey method (Refer to Ltdicocxn.hlp) (11.5)

MoveRootKey method (Refer to Ltdicocxn.hlp) (11.5)

SaveExtDS method (Refer to Ltdicocxn.hlp) (11.5)

Multimedia Control

RefBitmapList property (refer to Ltvidocxn.hlp) (11.5)

MPEGAspectratio property (refer to Ltvidocxn.hlp)

MPEGBitRate property (refer to Ltvidocxn.hlp)

MPEGChromaFormat property (refer to Ltvidocxn.hlp)

MPEGConstrained property (refer to Ltvidocxn.hlp)

MPEGFieldPic property (refer to Ltvidocxn.hlp)

MPEGFrameRate property (refer to Ltvidocxn.hlp)

MPEGFramesGOP property (refer to Ltvidocxn.hlp)

MPEGIntraDcPrec property (refer to Ltvidocxn.hlp)

MPEGLevelID property (refer to Ltvidocxn.hlp)

MPEGProfileID property (refer to Ltvidocxn.hlp)

MPEGUserInfo property (refer to Ltvidocxn.hlp)

MPEGVideoFormat property (refer to Ltvidocxn.hlp)

ImageList Control

PaintScaling property (ImageList Control) (11.5)

AllowSelection property (ImageList Control)

Appearance property (ImageList Control)

BackColor property (ImageList Control)

BitonalScaling property (ImageList Control)

BorderColor property (ImageList Control)

BorderStyle property (ImageList Control)

Clear method (ImageList Control)

Click event (ImageList Control)

ColumnCount property (ImageList Control)

Count property (ImageList Control)

CurrentPage property (ImageList Control)

DblClick event (ImageList Control)

DisplayItemText property (ImageList Control)

EnableKeyboard property (ImageList Control)

EnableMethodErrors property (ImageList Control)

EnsureVisible method (ImageList Control)

Font property (ImageList Control)

ForeColor property (ImageList Control)

HitTest method (ImageList Control)

Insert method (ImageList Control)

InsertAt method (ImageList Control)

InsertFromBitmapList method (ImageList Control)

IsSupportLocked method (ImageList Control)

Item property (ImageList Control)

ItemBackgroundColor property (ImageList Control)

ItemHeight property (ImageList Control)

ItemHorizontalSpacing property (ImageList Control)

ItemSelected event (ImageList Control)

ItemVerticalSpacing property (ImageList Control)

ItemWidth property (ImageList Control)

KeyDown event (ImageList Control)

KeyPress event (ImageList Control)

KeyUp event (ImageList Control)

LoadFromFile method (ImageList Control)

MouseDown event (ImageList Control)

MouseIcon property (ImageList Control)

MouseMove event (ImageList Control)

MousePointer property (ImageList Control)

MouseUp event (ImageList Control)

PageCount property (ImageList Control)

PaintDither property (ImageList Control)

Remove method (ImageList Control)

Resize event (ImageList Control)

RowCount property (ImageList Control)

SaveToFile method (ImageList Control)

ScaleHeight property (ImageList Control)

ScaleLeft property (ImageList Control)

ScaleMode property (ImageList Control)

ScaleTop property (ImageList Control)

ScaleWidth property (ImageList Control)

Scroll event (ImageList Control)

ScrollItems method (ImageList Control)

ScrollStyle property (ImageList Control)

SelectAll method (ImageList Control)

SelectionColor property (ImageList Control)

SelectionStyle property (ImageList Control)

Sort method (ImageList Control)

UnlockSupport method (ImageList Control)

Window property (ImageList Control)

Thumbnail Control

BrowseDir method (Thumbnail Browser Control)

ContinueBrowse property (Thumbnail Browser Control)

DitherFlags property (Thumbnail Browser Control)

EnableMethodErrors property (Thumbnail Browser Control)

ExpandMultipage property (Thumbnail Browser Control)

ForceSize property (Thumbnail Browser Control)

IncludeSubDirectories property (Thumbnail Browser Control)

InfoBits property (Thumbnail Browser Control)

InfoCompression property (Thumbnail Browser Control)

InfoFormat property (Thumbnail Browser Control)

InfoHeight property (Thumbnail Browser Control)

InfoPage property (Thumbnail Browser Control)

InfoSizeDisk property (Thumbnail Browser Control)

InfoSizeMem property (Thumbnail Browser Control)

InfoTotalPages property (Thumbnail Browser Control)

InfoWidth property (Thumbnail Browser Control)

InfoXRes property (Thumbnail Browser Control)

InfoYRes property (Thumbnail Browser Control)

IsSupportLocked method (Thumbnail Browser Control)

LoadStamp property (Thumbnail Browser Control)

MaintainAspect property (Thumbnail Browser Control)

MaxSizeDisk property (Thumbnail Browser Control)

MaxSizeMem property (Thumbnail Browser Control)

PaletteFlags property (Thumbnail Browser Control)

Resample property (Thumbnail Browser Control)

Filter property (Thumbnail Browser Control)

StopOnError property (Thumbnail Browser Control)

ThumbnailBackgroundColor property (Thumbnail Browser Control)

ThumbnailBitsPerPixel property (Thumbnail Browser Control)

ThumbnailEvent event (Thumbnail Browser Control)

ThumbnailHeight property (Thumbnail Browser Control)

ThumbnailWidth property (Thumbnail Browser Control)

UnlockSupport method (Thumbnail Browser Control)

Dialogs

SaveFormats property (Refer to Ltdlgocxn.hlp)

SaveFormatCount property (Refer to Ltdlgocxn.hlp)

SubTypeIndex property (Refer to Ltdlgocxn.hlp)

DlgFont property (Refer to Ltdlgocxn.hlp)

GetDlgString method (Refer to Ltdlgocxn.hlp)

SetDlgString method (Refer to Ltdlgocxn.hlp)

GetContourFilter method (Refer to Ltdlgocxn.hlp)

ContourThreshold property (Refer to Ltdlgocxn.hlp)

ContourDeltaDirection property (Refer to Ltdlgocxn.hlp)

ContourMaximumError property (Refer to Ltdlgocxn.hlp)

ContourOption property (Refer to Ltdlgocxn.hlp)

ContourOptionFlags property (Refer to Ltdlgocxn.hlp)

Vector File Format Support

AmbientLight property (Vector Control) (refer to Ltvecocxn.hlp)

Appearance property (Vector Control) (refer to Ltvecocxn.hlp)

ApplyTransformation method (Vector Control) (refer to Ltvecocxn.hlp)

ArraySize method (Vector Control) (refer to Ltvecocxn.hlp)

AutoRepaint property (Vector Control) (refer to Ltvecocxn.hlp)

AutoScroll property (Vector Control) (refer to Ltvecocxn.hlp)

BackColor property (Vector Control) (refer to Ltvecocxn.hlp)

BackErase property (Vector Control) (refer to Ltvecocxn.hlp)

BorderStyle property (Vector Control) (refer to Ltvecocxn.hlp)

CameraDlgPhi property (Vector Control) (refer to Ltvecocxn.hlp)

CameraDlgTheta property (Vector Control) (refer to Ltvecocxn.hlp)

CameraDlgZoom property (Vector Control) (refer to Ltvecocxn.hlp)

CameraPhi property (Vector Control) (refer to Ltvecocxn.hlp)

CameraTheta property (Vector Control) (refer to Ltvecocxn.hlp)

CameraZoom property (Vector Control) (refer to Ltvecocxn.hlp)

Click event (Vector Control) (refer to Ltvecocxn.hlp)

ConvertFromEMFHandle method (Vector Control) (refer to Ltvecocxn.hlp)

ConvertFromEMFPicture method (Vector Control) (refer to Ltvecocxn.hlp)

ConvertFromWMFHandle method (Vector Control) (refer to Ltvecocxn.hlp)

ConvertFromWMFPicture method (Vector Control) (refer to Ltvecocxn.hlp)

ConvertToEMFHandle method (Vector Control) (refer to Ltvecocxn.hlp)

ConvertToWMFHandle method (Vector Control) (refer to Ltvecocxn.hlp)

ConvertToEMFPicture method (Vector Control) (refer to Ltvecocxn.hlp)

ConvertToWMFPicture method (Vector Control) (refer to Ltvecocxn.hlp)

CurrentObject property (Vector Control) (refer to Ltvecocxn.hlp)

DblClick event (Vector Control) (refer to Ltvecocxn.hlp)

DeleteObjects method (Vector Control) (refer to Ltvecocxn.hlp)

Dlg3DOptionsAmbientLight property (Vector Control) (refer to Ltvecocxn.hlp)

Dlg3DOptionsPolygonMode property (Vector Control) (refer to Ltvecocxn.hlp)

Dlg3DOptionsUseLights property (Vector Control) (refer to Ltvecocxn.hlp)

EnableMethodErrors property (Vector Control) (refer to Ltvecocxn.hlp)

EnumObjects method (Vector Control) (refer to Ltvecocxn.hlp)

EnumVertices method (Vector Control) (refer to Ltvecocxn.hlp)

FeedLoad method (Vector Control) (refer to Ltvecocxn.hlp)

ForceRepaint method (Vector Control) (refer to Ltvecocxn.hlp)

Free method (Vector Control) (refer to Ltvecocxn.hlp)

GetObjectParallelogram method (Vector Control) (refer to Ltvecocxn.hlp)

GetObjectRect method (Vector Control) (refer to Ltvecocxn.hlp)

HitTest method (Vector Control) (refer to Ltvecocxn.hlp)

Is3D method (Vector Control) (refer to Ltvecocxn.hlp)

IsAnObjectSelected method (Vector Control) (refer to Ltvecocxn.hlp)

IsSupportLocked method (Vector Control) (refer to Ltvecocxn.hlp)

KeyDown event (Vector Control) (refer to Ltvecocxn.hlp)

KeyPress event (Vector Control) (refer to Ltvecocxn.hlp)

KeyUp event (Vector Control) (refer to Ltvecocxn.hlp)

Load method (Vector Control) (refer to Ltvecocxn.hlp)

LoadArray method (Vector Control) (refer to Ltvecocxn.hlp)

LoadMemory method (Vector Control) (refer to Ltvecocxn.hlp)

LogicalToPhysical method (Vector Control) (refer to Ltvecocxn.hlp)

MouseDown event (Vector Control) (refer to Ltvecocxn.hlp)

MouseIcon property (Vector Control) (refer to Ltvecocxn.hlp)

MouseMove event (Vector Control) (refer to Ltvecocxn.hlp)

MousePointer property (Vector Control) (refer to Ltvecocxn.hlp)

MouseUp event (Vector Control) (refer to Ltvecocxn.hlp)

ObjectParallelogramLeftTopX property (Vector Control) (refer to Ltvecocxn.hlp)

ObjectParallelogramLeftTopY property (Vector Control) (refer to Ltvecocxn.hlp)

ObjectParallelogramLeftTopZ property (Vector Control) (refer to Ltvecocxn.hlp)

ObjectParallelogramRightBottomX property (Vector Control) (refer to Ltvecocxn.hlp)

ObjectParallelogramRightBottomY property (Vector Control) (refer to Ltvecocxn.hlp)

ObjectParallelogramRightBottomZ property (Vector Control) (refer to Ltvecocxn.hlp)

ObjectRectHeight property (Vector Control) (refer to Ltvecocxn.hlp)

ObjectRectLeft property (Vector Control) (refer to Ltvecocxn.hlp)

ObjectRectTop property (Vector Control) (refer to Ltvecocxn.hlp)

ObjectRectWidth property (Vector Control) (refer to Ltvecocxn.hlp)

PanX property (Vector Control) (refer to Ltvecocxn.hlp)

PanY property (Vector Control) (refer to Ltvecocxn.hlp)

PhysicalX property (Vector Control) (refer to Ltvecocxn.hlp)

PhysicalY property (Vector Control) (refer to Ltvecocxn.hlp)

PolygonMode property (Vector Control) (refer to Ltvecocxn.hlp)

Realize method (Vector Control) (refer to Ltvecocxn.hlp)

Reset method (Vector Control) (refer to Ltvecocxn.hlp)

Resize event (Vector Control) (refer to Ltvecocxn.hlp)

RotationDlgX property (Vector Control) (refer to Ltvecocxn.hlp)

RotationDlgY property (Vector Control) (refer to Ltvecocxn.hlp)

RotationDlgZ property (Vector Control) (refer to Ltvecocxn.hlp)

RotationX property (Vector Control) (refer to Ltvecocxn.hlp)

RotationY property (Vector Control) (refer to Ltvecocxn.hlp)

RotationZ property (Vector Control) (refer to Ltvecocxn.hlp)

Save method (Vector Control) (refer to Ltvecocxn.hlp)

SaveArray method (Vector Control) (refer to Ltvecocxn.hlp)

SaveMemory method (Vector Control) (refer to Ltvecocxn.hlp)

ScaleDlgX property (Vector Control) (refer to Ltvecocxn.hlp)

ScaleDlgY property (Vector Control) (refer to Ltvecocxn.hlp)

ScaleDlgZ property (Vector Control) (refer to Ltvecocxn.hlp)

ScaleHeight property (Vector Control) (refer to Ltvecocxn.hlp)

ScaleLeft property (Vector Control) (refer to Ltvecocxn.hlp)

ScaleMode property (Vector Control) (refer to Ltvecocxn.hlp)

ScaleTop property (Vector Control) (refer to Ltvecocxn.hlp)

ScaleWidth property (Vector Control) (refer to Ltvecocxn.hlp)

ScalingX property (Vector Control) (refer to Ltvecocxn.hlp)

ScalingY property (Vector Control) (refer to Ltvecocxn.hlp)

ScalingZ property (Vector Control) (refer to Ltvecocxn.hlp)

SelectAllObjects method (Vector Control) (refer to Ltvecocxn.hlp)

SetRotation method (Vector Control) (refer to Ltvecocxn.hlp)

SetScaling method (Vector Control) (refer to Ltvecocxn.hlp)

SetTranslation method (Vector Control) (refer to Ltvecocxn.hlp)

Show3DOptionsDlg method (Vector Control) (refer to Ltvecocxn.hlp)

ShowCameraDlg method (Vector Control) (refer to Ltvecocxn.hlp)

ShowRotateDlg method (Vector Control) (refer to Ltvecocxn.hlp)

ShowScaleDlg method (Vector Control) (refer to Ltvecocxn.hlp)

ShowTranslateDlg method (Vector Control) (refer to Ltvecocxn.hlp)

StartFeedLoad method (Vector Control) (refer to Ltvecocxn.hlp)

StopEnum property (Vector Control) (refer to Ltvecocxn.hlp)

StopFeedLoad method (Vector Control) (refer to Ltvecocxn.hlp)

TranslateDlgX property (Vector Control) (refer to Ltvecocxn.hlp)

TranslateDlgY property (Vector Control) (refer to Ltvecocxn.hlp)

TranslateDlgZ property (Vector Control) (refer to Ltvecocxn.hlp)

TranslationX property (Vector Control) (refer to Ltvecocxn.hlp)

TranslationY property (Vector Control) (refer to Ltvecocxn.hlp)

TranslationZ property (Vector Control) (refer to Ltvecocxn.hlp)

UnlockSupport method (Vector Control) (refer to Ltvecocxn.hlp)

UseDoubleBuffer property (Vector Control) (refer to Ltvecocxn.hlp)

UseLights property (Vector Control) (refer to Ltvecocxn.hlp)

Vector property (Vector Control) (refer to Ltvecocxn.hlp)

VertexBindMode property (Vector Control) (refer to Ltvecocxn.hlp)

VectorEngine property (Vector Control) (refer to Ltvecocxn.hlp)

VectorObjects event (Vector Control) (refer to Ltvecocxn.hlp)

VectorVertices event (Vector Control) (refer to Ltvecocxn.hlp)

ViewMode property (Vector Control) (refer to Ltvecocxn.hlp)

ViewportHeight property (Vector Control) (refer to Ltvecocxn.hlp)

ViewportLeft property (Vector Control) (refer to Ltvecocxn.hlp)

ViewportTop property (Vector Control) (refer to Ltvecocxn.hlp)

ViewportWidth property (Vector Control) (refer to Ltvecocxn.hlp)

Miscellaneous

EnablePaint property (11.5)

LoadCompressed property (11.5)

PaintScaling property (11.5)

PanWinPaintScaling property (11.5)

RefBitmapList property (11.5)

AutoPan property

PrinterScaleWidth property

PrinterScaleHeight property

SaveLSB property

SavePageNumberTag property

ContourFilter method

WindowLevelFillLUT method

ProgressStatus event(OLE)

EnableProgressEvent property(OLE)


Changes from Version 9.0 to Version 10

The product line in Version 10 has been redesigned. If you are an existing LEADTOOLS customer, please take a moment to familiarize yourself with the new line of products and the new features.

Essentially the changes are as follows:

 VBX Pro, ActiveX32 Pro, ActiveX16 Pro, WIN16 Pro, and WIN32 Pro are gone.

 ActiveX16/32 Pro is now LEADTOOLS Imaging and includes C, C++, and MFC documentation.

 WIN16/32 Pro is now LEADTOOLS Imaging Pro.

 The Video module is no longer available as an add-on. LEAD's Multimedia support is included in the following new products: LEADTOOLS Multimedia, LEADTOOLS Multimedia Pro, LEADTOOLS Document Express, LEADTOOLS Document Express Suite and LEADTOOLS Medical Express.

 The Pro-Express document imaging features, annotations, bitonal display filters, fast rotation, ISIS® support and faster compression and decompression are included in all Express editions.

 The OCR Module is no longer available.  LEAD's OCR support is only in the LEADTOOLS Document Express Suite toolkit.

 LEADTOOLS Medical Express contains all of the features present in the Express editions, plus DICOM, 12 and 16 bit grayscale, and window leveling support.

Version 10 of the LEADTOOLS ActiveX has changed from version 9.0 as follows. (For step-by-step help, refer to Upgrade Instructions.)

 Loading WMF files at the resolution present in the file is now supported.

 Saving WMF files at the current resolution is now supported.

 Loading and saving JBIG is now supported. (Saving is only available in the JBIG Module.)

 J++ code samples are now included.

 Updated the manner in which annotation object selection code tests for the following objects:

Line Annotation Object

Polyline Annotation Object

Freehand Line Annotation Object

Rectangle Annotation Object

Ellipse Annotation Object

Polygon Annotation Object

Pointer Annotation Object

Ruler Annotation Object

For objects that have an interior (ex. Rectangle, Ellipse), if the fill mode is transparent and the fill style is solid, the object will only be selected if the user clicks on the border of the object.  If the fill mode is anything other than transparent, the object can be selected by clicking on its interior.

This will allow the user to select an annotation object that is beneath another object, without having to change the enumeration order.

 Added Grouping and Ungrouping of annotation objects.  This allows the user to treat several annotation objects as a single object.  Objects must then be ungrouped to be treated as individual objects.

 Added the ability to remove menu items from the Annotation Automation menu by setting the menu item text to an empty string using AnnSetAutoText method.

 Minimized flicker effect for annotation object display.

 Users can no longer create objects outside the root container.

 Users can no longer move objects outside the root container.

 Multipass painting for the EFX_EFFECT_PUSH_CLASS is disabled. For a list of available effects, refer to Effects.

 Loading and saving Lossless JPEG is now supported.

 Loading and saving Lossless JTIF is now supported.

 Loading and saving 12-bit Lossy JPEG is now supported.

 Loading and saving 12-bit Lossy JTIF is now supported.

 Saving 12-bit uncompressed TIFF is now supported.

 Loading and saving EMF files is now supported.

 Database access though an OLE DB Provider is now provided.

 Optimized code takes advantage of the MMX processors to load CMP, JPEG, and JTIF files 40% faster.

 LEADTOOLS will now attempt to automatically recognize fax files only if you respond to the LoadInfo event and set the LoadInfoWidth and LoadInfoHeight properties to -1.

 Special Effects have expanded to include a choice of over 2000 paint effects, 36 gradients, 80 shapes, 12 3-D text styles, 64 dissolves, and 43 transition effects, with delays, grain sizes, pattern brushes and a colored wand.

2018 Effects are now supported. For the full list, refer to Effects.

80 Shapes are now supported. For a full list, refer to Shapes.

36 Gradients are now supported. For a full list, refer to Gradients.

 Imaging Common Dialogs have been expanded to include imaging dialogs for Paint Effect, Transition, Gradient, 3D Text and 3D Shape.

 Added File Format Support includes the new Fuji Exif version 2.0, multipage TIFF enhancements (delete, insert, replace, and add with enhanced speed).  LEAD continues to deliver the most comprehensive file format support by expanding the number of flavors and variants supported in the following file formats: PICT, JPEG, GIF, WINFAX, PCX, CALS, AWD, FlashPix, DICOM, EPS, PSD,and PNG.

 New PanWindow properties, methods and events give you the ability to view a small rectangular section of a large image in magnified detail.  By clicking inside the pan window you can move the mouse and pan the image in the main window.  While scrolling the image in the main window, the pan rectangle will move to indicate the current displayed area.

 New properties provide total page information and insert or replace a page in a multipage file.

 You can now delete individual pages in a multipage file.

 Using the new Picturize method, you can replace an image with a new image generated using a picturized algorithm – an image processing feature that allows you to create one picture from thousands of separate images.  Automatically chooses (based on closest color values) and resizes the images and shows the processing progress. Allows for customization of cell sizes. This feature lets user’s create a wide array of exciting new eye-catching images.  The more pictures you have to choose from, the better the resulting image.

 Screen Capture capabilities becomes the 15th imaging technology category found in LEADTOOLS. New properties, methods, and events allow you to capture all or part of the screen into a bitmap. Capture the entire screen, active window, menu under cursor, window under cursor (button, tool bar, icon, or client area), selected object, mouse cursor or wallpaper.  Allows for capture of a selected area of the screen in a wide array of shapes such as rectangle, rounded rectangle, ellipse, polygon or freehand.  Icon, bitmap and cursor resources can be captured from 32-bit Windows EXE and DLL files.  Options include Multi-capture with callback, Hot Keys, and time interval.  Great for presentation and application documentation.

 EnumDimensions method now supports JBIG.

 DimensionCount property now supports JBIG.

 DimensionHeight property now supports JBIG.

 DimensionWidth property now supports JBIG.

 GetDimension method now supports JBIG.

 Pixel property now supports 16-bit grayscale COLORREF values. (Medical Express editions  only)

 Fill method now supports 16-bit grayscale COLORREF values. (Medical Express editions  only)

 Save method now takes a short iModify parameter instead of the BOOL bMultipage parameter.

 RecognizeEvent event (OCR Control) now supports another option for the nStatus parameter. (Refer to the Ltocrn.hlp help file)

 ISISAcquireMulti method now supports a new flag for the uFlags parameter.

 SaveMulti property (Common Dialog Control) is now short, instead of BOOL.

 ISISPage event (ISIS Control) now fills the Bitmap property with the scanned image when doing mulit-page scanning.

 Improved ISIS® support. ISISSetScanOptions method (ISIS Control) allows you to display ISIS settings dialog, without scanning.

 [Medical Express only] Improved TWAIN scanning to support 16-bit grayscale images is now provided.

 Automatic recognition of some Group 3 - 1D and Group 3 - 2D raw fax files is now provided.

 The OCR has been enhanced to include the ability to return the recognized character and its location in the document during the recognition process.

The rest of this topic lists the new properties, methods, and events in version 10.

JBIG Support

SaveResolutionCount property

SaveResolutionHeight property

SaveResolutionWidth property

Imaging Common Dialog Effects:

Delay property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Directory property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Effect property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Font property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ForeColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Get3dShape method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Get3dText method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetDirectory method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetEffect method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetGradient method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetTransition method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GradientSteps property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GradientStyle property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Grain property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

MaxPass property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SampleText property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShadowColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShadowXDepth property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShadowYDepth property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Shape property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeBackgroundBitmap property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeBackStyle property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeBorderColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeBorderStyle property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeBorderWidth property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeFillStyle property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeInnerHiliteColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeInnerShadowColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeInnerStyle property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeInnerWidth property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeOuterHiliteColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeOuterShadowColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeOuterStyle property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShapeOuterWidth property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

TextAlign property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

TextColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

TextForegroundBitmap property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

TextHiliteColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

TextStyle property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

TextUseForegroundImage property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

TextWordWrap property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Transition property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Transparent property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

TransparentColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

WandColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

WandWidth property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

PanWindow:

PanWin event (Main Control)

PanWinBitonalScaling property (Main Control)

PanWinCursor property (Main Control)

PanWinHeight property (Main Control)

PanWinIcon property (Main Control)

PanWinPaintDither property (Main Control)

PanWinPaintPalette property (Main Control)

PanWinPointer property (Main Control)

PanWinRectColor property (Main Control)

PanWinSysMenu property (Main Control)

PanWinTitle property (Main Control)

PanWinWidth property (Main Control)

PanWinX property (Main Control)

PanWinY property (Main Control)

ShowPanWin method (Main Control)

Screen Capture:

CaptureActiveClient method (Refer to Ltscrocxn.hlp)

CaptureActiveWindow method (Refer to Ltscrocxn.hlp)

CaptureArea method (Refer to Ltscrocxn.hlp)

CaptureEXE method (Refer to Ltscrocxn.hlp)

CaptureEXEDlg method (Refer to Ltscrocxn.hlp)

CaptureFullScreen method (Refer to Ltscrocxn.hlp)

CaptureMenuUnderCursor method (Refer to Ltscrocxn.hlp)

CaptureMouseCursor method (Refer to Ltscrocxn.hlp)

CaptureSelectedObject method (Refer to Ltscrocxn.hlp)

CaptureWallPaper method (Refer to Ltscrocxn.hlp)

CaptureWindowUnderCursor method (Refer to Ltscrocxn.hlp)

StopCapture method (Refer to Ltscrocxn.hlp)

CaptureAreaOptionDlg method (Refer to Ltscrocxn.hlp)

CaptureGetResourceCount method (Refer to Ltscrocxn.hlp)

CaptureObjectOptionDlg method (Refer to Ltscrocxn.hlp)

CaptureOptionDlg method (Refer to Ltscrocxn.hlp)

ResetAreaOptions method (Refer to Ltscrocxn.hlp)

ResetObjectOptions method (Refer to Ltscrocxn.hlp)

CaptureInfoHeight property (Refer to Ltscrocxn.hlp)

CaptureInfohWnd property (Refer to Ltscrocxn.hlp)

CaptureInfoLeft property (Refer to Ltscrocxn.hlp)

CaptureInfoTop property (Refer to Ltscrocxn.hlp)

CaptureInfoWidth property (Refer to Ltscrocxn.hlp)

CaptureInfoResIndex property (Refer to Ltscrocxn.hlp)

CaptureInfoResourceId property (Refer to Ltscrocxn.hlp)

CaptureInfoResType property (Refer to Ltscrocxn.hlp)

CaptureInfoExeName property (Refer to Ltscrocxn.hlp)

CaptureHotKey property (Refer to Ltscrocxn.hlp)

CaptureHotKeyModifiers property (Refer to Ltscrocxn.hlp)

CaptureObjectBorderWidth property (Refer to Ltscrocxn.hlp)

CaptureObjectEnableKeyboard property (Refer to Ltscrocxn.hlp)

CaptureObjectInvert property (Refer to Ltscrocxn.hlp)

CaptureObjectSelectCursor property (Refer to Ltscrocxn.hlp)

CaptureObjectSelectCursorIndex property (Refer to Ltscrocxn.hlp)

CaptureCount property (Refer to Ltscrocxn.hlp)

CaptureInterval property (Refer to Ltscrocxn.hlp)

CaptureAreaBitmapWithRegion property (Refer to Ltscrocxn.hlp)

CaptureAreaDrawCursor property (Refer to Ltscrocxn.hlp)

CaptureAreaDrawCursorIndex property (Refer to Ltscrocxn.hlp)

CaptureAreaDrawEllipseHeight property (Refer to Ltscrocxn.hlp)

CaptureAreaDrawEllipseWidth property (Refer to Ltscrocxn.hlp)

CaptureAreaDrawLineColor property (Refer to Ltscrocxn.hlp)

CaptureAreaDrawLineStyle property (Refer to Ltscrocxn.hlp)

CaptureAreaEnableKeyboard property (Refer to Ltscrocxn.hlp)

CaptureAreaFillBackColor property (Refer to Ltscrocxn.hlp)

CaptureAreaFillForeColor property (Refer to Ltscrocxn.hlp)

CaptureAreaFillPattern property (Refer to Ltscrocxn.hlp)

CaptureAreaIncludeCursor property (Refer to Ltscrocxn.hlp)

CaptureAreaInfoHeight property (Refer to Ltscrocxn.hlp)

CaptureAreaInfoLeft property (Refer to Ltscrocxn.hlp)

CaptureAreaInfoTop property (Refer to Ltscrocxn.hlp)

CaptureAreaInfoWidth property (Refer to Ltscrocxn.hlp)

CaptureAreaSensitiveInfoWindow property (Refer to Ltscrocxn.hlp)

CaptureAreaShowAreaSize property (Refer to Ltscrocxn.hlp)

CaptureAreaShowCursorPosition property (Refer to Ltscrocxn.hlp)

CaptureAreaShowDrawCursor property (Refer to Ltscrocxn.hlp)

CaptureAreaShowInfoWindow property (Refer to Ltscrocxn.hlp)

CaptureAreaShowOpaqueText property (Refer to Ltscrocxn.hlp)

CaptureAreaTextBackColor property (Refer to Ltscrocxn.hlp)

CaptureAreaTextForeColor property (Refer to Ltscrocxn.hlp)

CaptureAreaZoomFactor property (Refer to Ltscrocxn.hlp)

Bitmap property (Refer to Ltscrocxn.hlp)

CaptureCancelKey property (Refer to Ltscrocxn.hlp)

CaptureCursor property (Refer to Ltscrocxn.hlp)

CaptureCursorIndex property (Refer to Ltscrocxn.hlp)

CaptureDelay property (Refer to Ltscrocxn.hlp)

CaptureStatusCursor property (Refer to Ltscrocxn.hlp)

CaptureStatusCursorIndex property (Refer to Ltscrocxn.hlp)

EnableMethodErrors property (Refer to Ltscrocxn.hlp)

ScaleMode property (Refer to Ltscrocxn.hlp)

TransparentColor property (Refer to Ltscrocxn.hlp)

CaptureHotKeyPressed event (Refer to Ltscrocxn.hlp)

CaptureImage event (Refer to Ltscrocxn.hlp)

CaptureAreaType property (Refer to Ltscrocxn.hlp)

CaptureAreaUseCrossLinesCursor property (Refer to Ltscrocxn.hlp)

IsCaptureActive method (Refer to Ltscrocxn.hlp)

Miscellaneous :

DeletePage method (Main Control)

InfoTotalPages property (Main Control)

ISISSetScanOptions method (ISIS Control)

OLEDropAutoLoad property

OLEDropFile event

Picturize method (Main Control)

SavePage property (Main Control)

WMFResolution property (Main Control)

AnnEnumerate event (Main Control)

AnnEnumerate method (Main Control)

InfoXRes property (Main Control)

InfoYRes property (Main Control)

OLEDropAutoLoad property (Main Control)

OLEDropFile event (Main Control)

RefBitmap property (Main Control)

WindowLevelBitmap property (Main Control)


Changes from Version 8.0 to Version 9.0

Version 9.0 of the LEADTOOLS ActiveX has changed from version 8.0 as follows. (For step-by-step help, refer to Upgrade Instructions.)

 LTKRN10N.DLL and LTKRN10W.DLL have each been split in two.  The new DLLs are LTKRN10N.DLL and LTDIS10N.DLL, and LTKRN10W.DLL and LTDIS10W.DLL.

 New features let you capture and zoom in on a portion of the screen.

 Now you can have more control over the loading and caching of the file filter DLLs.

 Reusable dialogs for the most common LEADTOOLS imaging functions are now provided.

- FileOpen and FileSave dialogs have been extended to contain LEADTOOLS specific options.

- A Thumbnail Preview option for FileOpen dialog allows the end user to preview images before loading them.

- A Thumbnail Preview option for the image processing dialogs allows the end user to preview the proposed change to the image, before actually affecting the original image.

- An optional Help Button event lets you provide custom help information for each dialog.

- A user interface control for the dialogs is provided through UIFlags property.

- An option to have the Imaging Common Dialog process the image automatically is provided.

 [Express editions] Support for ISIS scanning has been added.

 [Express editions only] New properties, methods and events allow you to hyperlink annotations.  Annotations may be hyperlinked to run a program, access a Web page, or send a user defined message.

 [Express editions only] New annotation properties, methods and events allow you to add security to annotation objects.

 [Express editions only] Support for 12 and 16-bit grayscale images is included.

 [Express editions only] New window leveling allows you to map grayscale intensities by specifying the bit range and/or a user defined color map.  It is valid only for 12 and 16-bit grayscale images.

 [Express editions only] Support for annotations in a TIFF tag is included.

 [Express editions only] The automated mode for annotation lets you move individual points in a polygon or a polyline.

 Support for new LEADTOOLS Modules.

- OCR Module

 AnnLoad method now takes an extra parameter, the page number, to load.

 BitsPerPixel property now supports 12 and 16-bit grayscale images. (Express editions  only)

 ColorRes method now supports 12 and 16-bit grayscale images. (Express editions  only)

 DataLoadBits property now supports 12 and 16 bit grayscale images. (Express editions  only)

 DataSaveBits property now supports 12 and 16 bit grayscale images. (Express editions  only)

 dbLoadBits property now supports 12 and 16 bit grayscale images. (Express editions  only)

 FeedLoad method now supports 12 and 16 bit grayscale images. (Express editions  only)

 FileOpen method now supports 12 and 16 bit grayscale images. (Express editions  only)

 FileSave method now supports 12 and 16 bit grayscale images. (Express editions  only)

 GrayScale method now takes an extra parameter, the BitsPerPixel of the resultant bitmap.

 InfoBits property now supports 12 and 16-bit grayscale images. (Express editions  only)

 Load method now supports 12 and 16-bit grayscale images. (Express editions  only)

 LoadInfoBits property now supports 12 and 16 bit grayscale images. (Express editions  only)

 LoadMemory method now supports 12 and 16 bit grayscale images. (Express editions  only)

 Save method now supports 12 and 16 bit grayscale images. (Express editions  only)

 SaveBitsPerPixel property now supports 12 and 16-bit grayscale images. (Express editions  only)

 SaveMemory method now supports 12 and 16-bit grayscale images. (Express editions  only)

 StartFeedLoad method now supports 12 and 16 bit grayscale images. (Express editions  only)

The rest of this topic lists the new properties, methods, and events in version 9.0.

Imaging Common Dialog:

Angle property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

AngleFlag property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

BackColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

BinaryFilterType property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Bitmap property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

BitsPerPixel property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Change property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Channel property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Depth property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

DialogTitle property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Direction property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

DitherFlags property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

DlgHelp event (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

EnableMethodErrors property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

EndColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

FileDlgFlags property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

FileName property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

FileOpen method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

FileSave method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

FileTitle property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Filter property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

FilterIndex property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

FilterType property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Gamma property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetAngle method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetChange method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetColorRes method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetEmboss method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetFilter method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetGamma method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetNoise method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetRange method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetSize method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

GetWindowLevel method (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

High property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

HighBit property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

HighLevel property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

InitialDir property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

LoadCompressed property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

LoadPasses property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

LoadRotated property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Low property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

LowBit property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

LowLevel property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

MaxFileSize property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

MaxFileTitleSize property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

NewHeight property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

NewWidth property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

PageNumber property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

PaletteFlags property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

PreviewEnabled property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Process property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Range property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveBitsPerPixel property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveFormat property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveFormatFlags property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveInterlaced property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveMulti property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SavePasses property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveProgressive property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveQFactor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveStampBits property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveStampHeight property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveStampWidth property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SaveWithStamp property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ShowHelpButton property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

SpatialFilterType property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

StartColor property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

Thumbnail property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

UIFlags property (Common Dialog Control) (Refer to Ltdlgocxn.hlp)

ISIS support (Express editions):

Bitmap property (ISIS Control)

DriverName property (ISIS Control)

EnableISISEvent property (ISIS Control)

EnableMethodErrors property (ISIS Control)

ISISAcquire method (ISIS Control)

ISISAcquireMulti method (ISIS Control)

ISISGetTag method (ISIS Control)

IsISISAvailable property (ISIS Control)

ISISLoadDriver method (ISIS Control)

ISISPage event (ISIS Control)

ISISSelect method (ISIS Control)

ISISSetTag method (ISIS Control)

ISISUnloadDriver method (ISIS Control)

PagesDiscarded property (ISIS Control)

Annotation hyperlinks (Express editions only):

AnnHyperlinkMenuEnable property (Main Control)

AnnHyperlinkMenu event (Main Control)

AnnSetHyperlinkString method (Main Control)

AnnSetHyperlinkMsg method (Main Control)

AnnHyperlink event (Main Control)

AnnGetHyperlinkType method (Main Control)

AnnGetHyperlinkString method (Main Control)

AnnGetHyperlinkParam method (Main Control)

Annotation security (Express editions only):

AnnLock method (Main Control)

AnnUnlock method (Main Control)

AnnShowLockedIcon property (Main Control)

AnnGetLocked method (Main Control)

AnnLocked event (Main Control)

AnnUnlocked event (Main Control)

Saving annotations (Express editions only):

AnnSaveTag method (Main Control)

Restoring redact objects (Express editions only):

AnnUnrealize method (Main Control)

Window leveling (Express editions only):

GetMinMaxBits method (Main Control)

GetMinMaxVal method (Main Control)

LevelHighBit property (Main Control)

LevelLowBit property (Main Control)

LevelLUT property (Main Control)

LevelLUTLength property (Main Control)

MaxBit property (Main Control)

MaxVal property (Main Control)

MinBit property (Main Control)

MinVal property (Main Control)

WindowLevel method (Main Control)

Loading input/output file filters:

IgnoreFilters method (Main Control)

PreLoadFilters method (Main Control)

Capturing and zooming in on a portion of the screen:

EnableZoomInRect property (Main Control)

ZoomIn method (Main Control)

ZoomInDone event (Main Control)


Changes from Version 7.0 to Version 8.0

Version 8.0 of the LEADTOOLS ActiveX has changed from version 7.0 as follows. (For step-by-step help, refer to Upgrade Instructions.)

 New properties for ActiveX behavior let you load images using OLE drag-and-drop, make the control transparent, and give the control a three-dimensional frame.

 The paint effects capabilities have been enhanced, with control over the speed and granularity of each effect, and with hundreds of new variations, including overlays of text and graphic shapes.

 Drawing tools have been added, so that you no longer need to rely on Windows GDI functions for drawing shapes or adding text to the control or the bitmap.

 New methods let you use an automated rubberband to zoom in on a selection or trim a bitmap, without translating mouse coordinates to bitmap coordinates.

 Region processing is now available in the LEADTOOLS Pro toolkits.

 [Express editions only] You can now achieve faster rotation in 90-degree increments by applying a rotated view perspective to the bitmap.

 You can now control the brightness and contrast of displayed images, without modifying the bitmap data.

 New image processing functions give you more control over erosion or dilation of dark objects.

 Other new image processing functions let you apply artistic effects to give an image the appearance of an oil painting or to simulate the accidental exposure of photographic film to light.

 LEADTOOLS functions now preserve alpha-channel information. You can also get and set the alpha channel in 16- and 32-bit bitmaps.

 TIFF file support now includes reading and writing of 32-bit images, images with PackBit compression, and images with CMYK or YCbCr color space.

 BMP file support now includes reading and writing of RLE-compressed images.

 You can now read and write Windows Icon (ICO) and Cursor (CUR) files.

 You can now read and write EXIF files.

 You can now read and write Microsoft FAX (AWD) files.

 [Express editions only] You can now read and write DICOM files.

 You can now read and write comments in all of the files formats that support comments, including TIFF, GIF, DICOM, and EXIF files.

The following is a list of the new methods, properties, and events.

Control usage and appearance:

OLEDropAllowed property

Transparent property

FrameThickness property

FrameColor property

FrameInnerStyle property

FrameInnerThickness property

FrameInnerHiliteColor property

FrameInnerShadowColor property

FrameOuterStyle property

FrameOuterThickness property

FrameOuterHiliteColor property

FrameOuterShadowColor property

Loading and saving files:

LoadUseViewPerspective property

SaveInterlaced property

Alpha channel support:

BitmapAlpha property

Maintaining bitmap lists:

DeleteBitmapListItems method

Automated display options:

PaintSizeUseDPI property

ZoomToRect method

Painting options:

PaintRgnOnly property

PaintGamma property

PaintIntensity property

PaintContrast property

New rubberband features:

AutoRubberBand property

RubberBand event

Specifying the client area or bitmap as the drawing surface:

DrawPersistence property

Drawing simple objects:

DrawLine method

DrawEllipse method

DrawRectangle method

DrawFillColor property

DrawFillStyle property

DrawMode property

DrawPenColor property

DrawPenStyle property

DrawPenWidth property

Drawing three-dimensional shapes:

DrawShape method

ShapeLeft property

ShapeTop property

ShapeWidth property

ShapeHeight property

ShapeBackgroundStyle property

BackgroundImageLeft property

BackgroundImageTop property

BackgroundImageWidth property

BackgroundImageHeight property

ShapeBorderColor property

ShapeBorderStyle property

ShapeBorderThickness property

ShapeInnerBandHiliteColor property

ShapeInnerBandShadowColor property

ShapeInnerBandStyle property

ShapeInnerBandThickness property

ShapeOuterBandHiliteColor property

ShapeOuterBandShadowColor property

ShapeOuterBandStyle property

ShapeOuterBandThickness property

Drawing three-dimensional text objects:

DrawText method

DrawTextOut method (limited support for related properties)

TextLeft property

TextTop property

TextWidth property

TextHeight property

TextAlign property

Font property

DrawFontColor property

TextStyle property

TextWordWrap property

TextAngle property

TextHiliteColor property

DrawTextHeight method

DrawTextWidth method

Specifying drop shadows:

ShadowColor property

ShadowXDepth property

ShadowYDepth property

Specifying gradient colors or patterns:

GradientStyle property

GradientStartColor property

GradientEndColor property

GradientSteps property

PatternStyle property

PatternBackColor property

PatternForeColor property

Specifying effects and transitions:

TransitionStyle property

TransitionEffect property

Controlling speed and granularity:

EffectDelay property

EffectGrain property

Controlling multiple passes:

PaintMaxPasses property

PaintPass property

PaintNotificationDelay property

PaintNotification event

Using a transparent color:

UseTransparentColor property

TransparentColor property

Using a wand:

WandColor property

WandSize property

New geometric transformations:

AutoTrim method

FastRotate method (Express editions only)

Modifying individual pixels:

Pixel property

New image filters:

MaxFilter method (Express editions only)

MinFilter method (Express editions only)

Oilify method

Solarize method

New annotation features (Express editions only):

AnnDataPath property

AnnLoadMemory method

AnnSaveMemory method

AnnGetPointCount method

AnnGetPointX method

AnnGetPointY method

AnnGetSelectCount method

AnnGetSelectList method

AnnSelect event

AnnAutoRotate property

AnnMove method


Changes from Version 6.2 to Version 7.0

Version 7.0 of the LEADTOOLS ActiveX has changed from version 6.2 as follows:

 You can now load images directly from the Internet into the ActiveX control, which is now a net-aware ActiveX. This means you can support new image formats and image processing on your web pages by adding the LEADTOOLS ActiveX to your HTML code.

 New display properties simplify scaling and positioning of images.

 You can now read and write progressive JPEG and LEAD CMP files.

 You can now read, write, and play back animated GIF files.

 You can now read and play back AVI files, and use them to create animated GIF files.

 Other features of GIF files are now supported, including interlaced files, the full range of color resolutions, and the use of transparent colors.

 When reading and writing TIFF files, you can now use the full range of palette indexes (1-8 bits per pixel).

 To support the new formats, you can now use the full range of palette indexes for bitmaps (1-8 bits per pixel).

 You can now read and write Kodak FlashPix files.

 Compression and decompression of CCITT Group 3 and Group 4, and LEAD 1-bit files is faster in Express editions.

 [Express editions only] Display using the scale-to-gray and favor-black options is faster.

 LEADTOOLS now provides an OLE server application that you can use to store compressed images in OLE client applications such as Microsoft Access, FoxPro, or Word. (This lets you print the stored images in Access reports.)

 LEADTOOLS now provides an Netscape plug-in DLL that makes it easy to use LEAD CMP files with Netscape Navigator or Microsoft Internet Explorer.

The following is a list of the new methods, properties, and events.

For Animation

InfoAnimation property

InfoAnimationHeight property

InfoAnimationWidth property

BitmapList property

BitmapListCount property

InsertBitmapListItem method

BitmapListIndex property

ColorResList method

BitmapDelay property

BitmapDisposalMethod property

BitmapEnableTransparency property

BitmapTransparentColor property

BitmapLeft property

BitmapTop property

AnimationBackColor property

AnimationBitsPerPixel property

AnimationPalette property

AnimationWidth property

AnimationHeight property

AnimationLoop property

AnimationEnable property

AutoAnimate property

AutoAnimationLoop property

Animate event

For Displaying Images

Appearance property

PaintSizeMode property

PaintZoomFactor property

AutoSize property

For Internet Support

BitmapDataPath property

ReadyState property

ReadyStateChange event

For Loading and Saving Files

FilePage event

ProgressivePasses property

For FlashPix File Support

EnumDimensions method

DimensionCount property

DimensionHeight property

DimensionWidth property

SetDimension method

GetDimension method

For Annotation Support

AnnAutoMenuEnable property

AnnAutoDrawEnable property

AnnGetAutoText method

AnnSetAutoText method

AnnChange event

AnnAutomation property

For Counting Colors in a Bitmap

GetColorCount method

For Support of the LEAD OLE Server

GetServerBitmap method

SetServerBitmap method


Changes from Version 5.2 to Version 6.2

Version 6.2 of the LEADTOOLS ActiveX has changed from version 5.2 as follows:

 New methods, properties, and events let you select and manipulate a region within a bitmap.

 New methods, properties, and events let you create and maintain annotations. This feature is available only in Express editions.

 The toolkit has been subdivided into a several need-specific DLLs that let you limit the size of your application by including only the applicable DLLs.

 The toolkit now fully supports the development of multi-threaded applications for Windows NT and Windows 95.

 The toolkit can now read Progressive JPEG, and it can read and write Windows BMP files in all possible color resolutions.

 The LEAD 1-bit format has been improved.

 New methods let you load a bitmap from your own buffer so that it is easier to handle transmitted images, such as those received through the Internet.

 New methods let you create and access memory-resident image files.

 Some other new methods and properties have been added to enhance existing capabilities.

The following is a list of the new methods, properties, and events.

For Region Processing

RgnMarkingMode property

RgnChange event

RgnFrameType property

Floater property

FloaterVisible property

IsPtInFloater method

SetFloaterDstRect method

SetFloaterDstClipRect method

FloaterDstHeight property

FloaterDstLeft property

FloaterDstTop property

FloaterDstWidth property

FloaterDstClipHeight property

FloaterDstClipLeft property

FloaterDstClipTop property

FloaterDstClipWidth property

FloaterHeight property

FloaterWidth property

GetFloaterHandle method

GetRgnHandle method

DeleteRgnHandle method

FreeRgn method

SetRgnHandle method

HasRgn property

IsPtInRgn method

GetRgnArea method

RgnHeight property

RgnLeft property

RgnTop property

RgnWidth property

SetRgnEllipse method

SetRgnRect method

SetRgnRoundRect method

SetRgnColor method

PolygonSize property

PolygonX property

PolygonY property

SetRgnPolygon method

OffsetRgn method

RepaintRect method

For Annotation Support

AnnUserMode property

AnnTool property

AnnClicked event

AnnSetTag method

AnnGetTag method

AnnGetType method

AnnCreate event

AnnDestroy event

AnnDrawn event

AnnFlip method

AnnReverse method

AnnRotate method

AnnRealize method

AnnLoad method

AnnSave method

AnnCopy method

AnnPasteReady property

AnnPaste method

AnnContainer property

For Loading Raw FAX Data

LoadInfo event

LoadInfoBits property

LoadInfoFlags property

LoadInfoFormat property

LoadInfoHeight property

LoadInfoOffset property

LoadInfoWidth property

LoadInfoXRes property

LoadInfoYRes property

For Loading from a Buffer

StartFeedLoad method

FeedLoad method

StopFeedLoad method

For Image Files in Memory

GetMemoryInfo method

LoadMemory method

SaveMemory method

Miscellaneous

UnlockSupport method

IsSupportLocked method

IsGrayscale property

PaintROP3 property


Upgrade Instructions

The following topics provide step-by-step instructions for upgrading your application from an earlier version of the LEADTOOLS ActiveX or VBX to the current version of the ActiveX.

From an earlier LEADTOOLS ActiveX:

C++ 4.0 Application

C++ Builder 3.0 Application

Visual Basic Application

Access 95 or 97 Application

Access 2.0 Application

Delphi 2.0 Application

Delphi 4.0 Application

Visual FoxPro Application

From the LEADTOOLS VBX:

LEADTOOLS Upgrade from VBX to ActiveX


Upgrading a C++ 4.0 Application to Use LEADTOOLS 14

These instructions describe how to upgrade a C++ 4.0 application from LEADTOOLS 12.1 to LEADTOOLS 14. You may also be able to follow these instructions when upgrading from an earlier version.

Note: These instructions have been tested with the LEADTOOLS example programs. Details, such as the names of generated files, could be different in your application.

Upgrading requires the following steps:

1.	Install LEADTOOLS 14.

2.	Regenerate LEADTOOLS support files.

3.	Remove old controls and files.

4.	Ensure that the ClassWizard database exists.

5.	Replace old controls with new ones.

6.	Replace LEADTOOLS files that are included in your project.

7.	If necessary, update the LEADTOOLS license string in your application code.

8.	Rebuild all files.

The remainder of this topic describes the steps in detail.

1.	Install LEADTOOLS 14. Note the following:

By default LEADTOOLS 14 is installed into a different folder than previous versions. If you installed 14 in the same folder as the previous version, the old project (with 12.1 controls) will have some problems if it does not have its own copy of the original L_OCX40.H file.

2.	Regenerate LEADTOOLS support files. You can do this by creating a new temporary project as follows:

a.	Create a new project for the sole purpose of generating the new files. (For step-by-step instructions on creating a simple project, refer to Loading and Displaying an Image.)

b.	Add the Lead Control (14) to your project. The LEADTOOLS support files are generated when you add the control.

c.	Save and close the project. Later, you will copy the new support files to your old project.

3.	Remove old controls and files. Working with the old project, do the following:

a.	Delete the LEADTOOLS support files from your old project folder. In the LEADTOOLS examples, these files are named LEAD.CPP, LEAD.H, PICTURE.CPP, and PICTURE.H.

b.	To remove the old LEAD control from your project's toolbar, edit your project's MAK file to remove references to the CLead and Picture classes that appear at the end of the file. (In the Microsoft Developer Studio, you can do this by opening the MAK file as a text file.) The references to remove are similar to the following ones:

#########################################################################
# Section mfcdemo : {C30E0AD1-B1BA-11CE-ABC6-F5B2E79D9E3F}
#    2:5:Class:CLead
#    2:10:HeaderFile:lead.h
#    2:8:ImplFile:lead.cpp
# End Section
#########################################################################
#########################################################################
# Section OLE Controls
#    {C30E0AD0-B1BA-11CE-ABC6-F5B2E79D9E3F}
# End Section
#########################################################################
#########################################################################
# Section mfcdemo : {C30E0AD0-B1BA-11CE-ABC6-F5B2E79D9E3F}
#    0:9:Picture.h:E:\Lead62\Examples\Ocx\Mfc40\Demo\Picture.h
#    0:6:Lead.h:E:\Lead62\Examples\Ocx\Mfc40\Demo\Lead.h
#    0:11:Picture.cpp:E:\Lead62\Examples\Ocx\Mfc40\Demo\Picture.cpp
#    0:8:Lead.cpp:E:\Lead62\Examples\Ocx\Mfc40\Demo\Lead.cpp
#    2:21:DefaultSinkHeaderFile:lead.h
#    2:16:DefaultSinkClass:CLead
# End Section
#########################################################################
#########################################################################
# Section mfcdemo : {7BF90981-BF32-101A-8BBB-00AA00300CAB}
#    2:5:Class:CPicture
#    2:10:HeaderFile:picture.h
#    2:8:ImplFile:picture.cpp
# End Section
#########################################################################

c.	Save the MAK file; then use the main menu's File > Open Workspace option to open the updated MAK file. (Be sure to open the MAK file, not the MDP file.)

d.	Go to the resource editor for your project. Then find and remove all of the LEAD controls from your windows, making note of the control IDs, positions, and properties. (You only need to note properties that are set to non-default values at design time.)

e.	Remove the LEAD.CPP and PICTURE.CPP files from your project. You can do this in the Developer Studio's FileView window. The LEAD.H file will remain in the list of dependencies, but that is OK.

4.	Ensure that the ClassWizard database exists. To do so, take the following steps:

a.	In the Microsoft Developer Studio, press Ctrl-W to go to the MFC Class Wizard. If a message box prompts you to build the ClassWizard database, continue with step 4b. Otherwise, continue with step 4d.

b.	Click Yes in the message box. A dialog box appears

c.	In the dialog box, click Add All; then click OK. The Class Wizard appears.

d.	Click OK to close the Class Wizard.

5.	Replace old controls with new ones. To do so, take the following steps:

a.	Go to the resource editor.

b.	From the main menu, select Insert > Component. (The Component Gallery appears.)

c.	Click the OLE Controls tab.

d.	Double-click the LEAD Control (14) icon. (The Confirm Classes dialog box appears.)

e.	Ensure that all three classes are checked. Do not change the class names, but if necessary, do change the name of the implementation file to be LEAD.CPP (instead of LEAD1.CPP).

f.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD icon appears in the Controls toolbar.)

g.	Use the new LEAD control tool to recreate the controls that you deleted earlier.

6.	Replace LEADTOOLS files that are included in your project. To do so, take the following steps:

a.	Copy the following files to your project folder from the small project that you created earlier: LEAD.CPP, LEAD.H, PICTURE.CPP, PICTURE.H, FONT.CPP, and FONT.H.

b.	In the Developer Studio's FileView window, look for LEAD1.CPP and PICTURE1.CPP, and delete them if they are listed. (LEAD.CPP, PICTURE.CPP, and FONT.CPP should be listed. You can add them to the project if they are not.)

c.	Correct the location of the L_OCX40.H file in the list of dependencies. To see the current location, you can click on the file name with the right mouse button, and select Properties from the pop-up menu. Your project needs to reference the new L_OCX40.H file, which is in the LEADTOOLS 14 INCLUDE folder. To fix this reference, you can either copy the new file to the current location, or you can search for the #include statement and change the path. (In the LEADTOOLS Mfcdemo project, the #include statement is in the STDAFX.H file.)

7.	If necessary, update the LEADTOOLS license string in your application code. If your application uses the Create function to create an instance of the LEAD control at run time, search for the following license string and change the date to 2003: "LEADTOOLS OCX Copyright (c) 1990-2003 LEAD Technologies, Inc."

8.	Rebuild all files as follows:

On the main menu select Build > Rebuild All.


Upgrading a C++ Builder 3.0  Application to Use LEADTOOLS 14

These instructions describe how to upgrade a C++ Builder 3.0 application from LEADTOOLS 12.1 to LEADTOOLS 14. You can also follow these instructions when upgrading from an earlier version of LEADTOOLS.

Upgrading requires the following steps:

1.	Install LEADTOOLS 14. Note the following:

By default LEADTOOLS 14 is installed into a different folder than previous versions.

2.	Open your project and remove each old LEAD control as follows. (You can use the tab key to make sure that you find all of the controls on a form.)

a.	Before removing a control, note all of the events where procedures are assigned. Later, you will have to reassign them to the new control.

b.	Also, before removing a control, note the control name, and any other properties that you may need to assign to the new control. (You only need to note properties that are set to non-default values at design time.)

c.	Press the Delete key to remove the control.

3.	Close your project.

4.	Remove the old LEAD icon from the toolbar as follows:

a.	On the File menu, select the Open Project option.

b.	Select the CBuilder3\Lib directory, highlight DCLUSR35.bpk and click Open.

c.	Delete the USERES and USEUNIT lines pertaining to LEAD controls.

d.	From the Project menu, select Build DCLUSR35.  When asked to confirm that you are about to compile DCLUSR35, select Yes.

e.	Once compiling has finished, select OK in the Compiling dialog.

f.	In the Information dialog you will see a message indicating the controls that are no longer registered. Click OK.

5.	Install the new LEAD control as follows:

a.	On the main menu, select the Component->Import ActiveX Control option.

b.	Highlight the LEAD Main Control (14).  Change the class name to TLEAD.  Click Install. A Confirm dialog will appear indicating that the LEADLib_TLB.cpp file already exists and asking if you want to replace it.  Click Yes.

c.	In the Install dialog, click OK.

d.	In the Confirm dialog, click Yes.  You will also see another dialog confirming that DCLUSR35 will be compiled.  Click OK.

e.	After compilation has finished, click OK in the Information dialog.

f.	At this point you will be presented with the DCLUSR35.cpp window, with USERES and USEUNIT lines pertaining to the new LEAD control. Save the DCLUSR35 project.

6.	Add each new LEAD control as follows:

a.	Open your project.

b.	Select the LEAD icon and draw the control on the form.

c.	In the Object Inspector, specify the Name and any other non-default properties that you noted earlier.

d.	In the Object Inspector, specify any event procedures that you noted earlier. (You can choose them from the list box.)

7.	Run your application to test it.


Upgrading a Visual Basic Application to Use LEADTOOLS 14

These instructions describe how to upgrade a Visual Basic application from LEADTOOLS 12.1 to LEADTOOLS 14. You can also follow these instructions when upgrading from an earlier version of LEADTOOLS.

Upgrading requires the following steps:

1.	Install LEADTOOLS 14. Note the following:

By default LEADTOOLS 14 is installed into a different folder than previous versions.

2.	Remove old controls. Working with the old project, do the following:

a.	Find and remove all of the LEAD controls from your forms. Before removing a control, note the control Name and any other non-default properties. (You can use the tab key to make sure that you find all of the controls on a form.)

b.	Remove the old LEAD control from your project's toolbar. To do so, select the Tools > Custom Controls option, uncheck the LEAD Control (12.1) control, and click OK. (If a message tells you that the control is in use, there is still a LEAD control on one of your forms.)

3.	Replace old controls with new ones. To do so, take the following steps:

a.	Select the Tools > Custom Controls option, check the LEAD Control (14) control, and click OK. (The LEAD icon appears on your toolbar.)

b.	Use the new LEAD control tool to recreate the controls that you deleted earlier. For each control, set the Name and other properties to be the same as the previous control.

4.	Run your program to test it.


Upgrading an Access 95 or 97 Application to Use LEADTOOLS 14

These instructions describe how to upgrade an Access 95 or 97 application from LEADTOOLS 12.1 to LEADTOOLS 14. You can also follow these instructions when upgrading from an earlier version of LEADTOOLS.

Upgrading requires the following steps:

1.	Install LEADTOOLS 14. Note the following:

By default LEADTOOLS 14 is installed into a different folder than previous versions.

2.	Remove old controls.

Working with the old project, find and remove all of the LEAD controls from your forms. Before removing a control, note the control Name and any other non-default properties. (You can use the tab key to make sure that you find all of the controls on a form.)

3.	Replace old controls with new ones.

For each control, Select the Insert > Custom Control option, select the LEAD Control (14) control, and click OK. Then, set the Name and other properties to be the same as the previous control.

4.	Run your program to test it.


Upgrading an Access 2.0 Application to Use LEADTOOLS 14

These instructions describe how to upgrade an Access 2.0 application from LEADTOOLS 12.1 to LEADTOOLS 14. You can also follow these instructions when upgrading from an earlier version of LEADTOOLS.

Upgrading requires the following steps:

1.	Install LEADTOOLS 14. Note the following:

By default LEADTOOLS 14 is installed into a different directory than previous versions.

2.	Remove old controls.

Working with the old project, find and remove all of the LEAD controls from your forms. Before removing a control, note the control Name and any other non-default properties. (You can use the tab key to make sure that you find all of the controls on a form.)

3.	Replace old controls with new ones.

For each control, Select the Edit > Insert Object option, select the LEAD Control (14) control, and click OK. Then, set the Name and other properties to be the same as the previous control.

4.	Run your program to test it.


Upgrading a Delphi 2.0  Application to Use LEADTOOLS 14

These instructions describe how to upgrade a Delphi 2.0 application from LEADTOOLS 12.1 to LEADTOOLS 14. You can also follow these instructions when upgrading from an earlier version of LEADTOOLS.

Upgrading requires the following steps:

1.	Install LEADTOOLS 14. Note the following:

By default LEADTOOLS 14 is installed into a different folder than previous versions. Nevertheless, in Delphi, only one version of the LEAD control can be used. Therefore, you must complete the remaining steps in these instructions whenever you want to use a different version of the LEADTOOLS ActiveX.

2.	Open your project and remove each old LEAD control as follows. (You can use the tab key to make sure that you find all of the controls on a form.)

a.	Before removing a control, note all of the events where procedures are assigned. Later, you will have to reassign them to the new control.

b.	Also, before removing a control, note the control name, and any other properties that you may need to assign to the new control. (You only need to note properties that are set to non-default values at design time.)

c.	Press the Delete key to remove the control.

3.	Close your project.

4.	Remove the old LEAD icon from the toolbar as follows:

a.	On the main menu, select the Component > Install option.

b.	In the list of Installed units, select LEAD, and click the Remove button.

c.	Click OK and wait for Delphi to remove the LEAD control from the toolbar. (This may take some time, and there is no other indication that anything is happening.)

5.	Install the new LEAD control as follows:

a.	On the main menu, select the Component > Install option.

b.	Click the OCX button.

c.	In the Import OLE Control dialog box, select the LEAD OLE Custom Control (14) module and then click OK. Answer yes when you are prompted to replace the LEAD.PAS file.

d.	Click OK and wait for Delphi to add the LEAD control to the toolbar. (This may take some time, and there is no other indication that anything is happening.)

6.	Replace the imported LEADDEF.PAS file. To do so, take the following steps:

a.	Reopen your project.

b.	On the main menu, select the Project > Remove from Project option, and remove the current LEADDEF.PAS file.

c.	Select the Project > Add to Project option, and add the LEADDEF.PAS file from the LEADTOOLS 14 INCLUDE folder.

7.	Add each new LEAD control as follows:

a.	Select the LEAD icon and draw the control on the form.

b.	In the Object Inspector, specify the Name and any other non-default properties that you noted earlier.

c.	In the Object Inspector, specify any event procedures that you noted earlier. (You can choose them from the list box.)

8.	Run your application to test it.


Upgrading a Delphi 4.0  Application to Use LEADTOOLS 14

These instructions describe how to upgrade a Delphi 4.0 application from LEADTOOLS 12.1 to LEADTOOLS 14. You can also follow these instructions when upgrading from an earlier version of LEADTOOLS.

Upgrading requires the following steps:

1.	Install LEADTOOLS 14. Note the following:

By default LEADTOOLS 14 is installed into a different folder than previous versions.

Nevertheless, in Delphi, only one version of the LEAD control can be used. Therefore, you must complete the remaining steps in these instructions whenever you want to use a different version of the LEADTOOLS ActiveX.

2.	Open your project and remove each old LEAD control as follows. (You can use the tab key to make sure that you find all of the controls on a form.)

a.	Before removing a control, note all of the events where procedures are assigned. Later, you will have to reassign them to the new control.

b.	Also, before removing a control, note the control name, and any other properties that you may need to assign to the new control. (You only need to note properties that are set to non-default values at design time.)

c.	Press the Delete key to remove the control.

3.	Close your project.

4.	Remove the old LEAD icon from the toolbar as follows:

a.	On the File menu, select the Open option.

b.	Select the Delphi4\Lib directory, highlight dclusr40.dpk and click Open.

c.	In the Contains folder, delete the LEAD .dcr and .pas files.

d.	On the DCLUSR40.dpk dialog, click on Compile. The Compiling package dclusr40 dialog appears.  Click Yes in this dialog.

e.	After compiling has finished, click OK in the Information dialog.

f.	Close and Save dclusr40.dpk.

5.	Install the new LEAD control as follows:

a.	On the main menu, select the Component->Import ActiveX Control option.

b.	Highlight the LEAD Main Control (14).  Change the class name to TLEAD.  Click Install. A Confirm dialog will appear indicating that the LEADLib_TLB.pas file already exists and asking if you want to replace it.  Click Yes.

c.	In the Install dialog, click OK.

d.	In the Confirm dialog, click Yes.  You will also see the Compiling package dclusr40 dialog confirming that dclusr40 will be compiled.  Click Yes.

e.	After compilation has finished, click OK in the Information dialog.

f.	At this point you will be presented with the DCLUSR40.pas window, with lines pertaining to the new LEAD control. Save the DCLUSR40 project.

6.	Replace the imported LEADDEF.PAS file. To do so, take the following steps:

a.	Reopen your project.

b.	On the main menu, select the Project > Remove from Project option, and remove the current LEADDEF.PAS file.

c.	Select the Project > Add to Project option, and add the LEADDEF.PAS file from the LEADTOOLS 14 INCLUDE folder.

7.	Add each new LEAD control as follows:

a.	Select the LEAD icon and draw the control on the form.

b.	In the Object Inspector, specify the Name and any other non-default properties that you noted earlier.

c.	In the Object Inspector, specify any event procedures that you noted earlier. (You can choose them from the list box.)

8.	Run your application to test it.


Upgrading a Visual FoxPro Application to Use LEADTOOLS 14

These instructions describe how to upgrade a FoxPro application from LEADTOOLS 12.1 to LEADTOOLS 14. You can also follow these instructions when upgrading from an earlier version of LEADTOOLS.

Upgrading requires the following steps:

1.	Install LEADTOOLS 14. Note the following:

By default LEADTOOLS 14 is installed into a different folder than previous versions.

2.	Remove old controls.

Working with the old project, find and remove all of the LEAD controls from your forms. Before removing a control, note the control Name and any other non-default properties. (You can use the tab key to make sure that you find all of the controls on a form.)

3.	Replace the LEAD control on the toolbar as follows:

a.	Select the Tools > Options option.

b.	On the Options window, click the Controls tab, and display the OLE controls.

c.	Uncheck LEAD Control (12.1) control.

d.	Check LEAD Control (14) control, click the Set As Default button, then click OK.

4.	Replace old controls with new ones. To do so, take the following steps:

a.	Click the View Classes icon, and select OLE Controls.

b.	Use the new LEAD control tool to recreate the controls that you deleted earlier. For each control, set the Name and other properties to be the same as the previous control.

5.	Replace the L_FOX.H included file.

If a copy of the L_FOX.H file is in your project directory, you can overwrite it with a copy of the file from the LEADTOOLS 14 INCLUDE folder. If the file is included with an #INCLUDE statement in a program, you can specify the new path.

6.	Run your program to test it.


LEADTOOLS Upgrade from VBX to ActiveX

When upgrading from the LEADTOOLS VBX to the LEADTOOLS ActiveX, some properties are the same and require no changes. For other properties, either their usage has changed, or they have been replaced by other properties or methods.

This topic describes how to change your code when upgrading from an existing VBX application. Upgrading requires the following steps:

1.	Replace the controls.

2.	Ensure that LVB_ constants are not defined or hard-coded.

3.	Replace changed LVB_ constants.

4.	Remove the LVB_ prefix from remaining constants.

5.	Make the simple property-to-method changes.

6.	Make the rest of the changes.

7.	Note the properties that have not changed.

The remainder of this topic describes the steps in detail. (Everything is in one topic so that you can easily print it or copy it to your text editor.)

1.  Replace all LEAD VBX controls.

For each control, make notes on any important design-time properties, delete the VBX control, and replace it with an ActiveX control. Then, update the Name property and any other important design-time properties (such as data properties) so that they match the former VBX control.

Ensure that the ScaleMode property is initialized to be the same as the parent form, which was the default for the VBX control.

2.  Ensure that LVB_ constants are not defined or hard-coded.

The values of constants have changed; so they should not be defined or hard-coded in your program. In Visual Basic, the definitions no longer need to be included. For other development systems, refer to the ActiveX tutorial to see files that must be included.

There are three exceptions: LVB_KEY_DOCUMENT, LVB_KEY_GIFLZW, and LVB_KEY_TIFLZW. Definitions of these constants should remain in your application if you have implemented GIF, TIFF LZW, or LEADTOOLS Document/Medical capabilities. (You will change the names of the constants in the next step.)

In Visual Basic, you can search for "Global Const LVB_" to find and delete the other definitions.

3.  Replace changed LVB_ constants.

You can change most VBX constants to ActiveX constants by removing the LVB_ prefix. However, the following constants have changed more than that, and you must replace them individually:

VBX Constant	ActiveX Constant

LVB_BITONAL_FAVORBLACK	BITONALSCALING_FAVORBLACK

LVB_BITONAL_NORMAL	BITONALSCALING_NORMAL

LVB_BITONAL_SCALETOGRAY	BITONALSCALING_SCALETOGRAY

LVB_DILATION_DIAG	BFLT_DILATION_DIAG

LVB_DILATION_HORZ	BFLT_DILATION_HORZ

LVB_DILATION_OMNI	BFLT_DILATION_OMNI

LVB_DILATION_VERT	BFLT_DILATION_VERT

LVB_DITHER_BURKES	CRD_BURKESDITHERING

LVB_DITHER_FLOYD	CRD_FLOYDSTEINDITHERING

LVB_DITHER_JARVIS	CRD_JARVISDITHERING

LVB_DITHER_LAST	CRD_ORDEREDDITHERING

LVB_DITHER_NONE	CRD_NODITHERING

LVB_DITHER_ORDERED	CRD_ORDEREDDITHERING

LVB_DITHER_SIERRA	CRD_SIERRADITHERING

LVB_DITHER_STEVENSON	CRD_STEVENSONARCEDITHERING

LVB_DITHER_STUCKI	CRD_STUCKIDITHERING

LVB_EROSION_DIAG	BFLT_EROSION_DIAG

LVB_EROSION_HORZ	BFLT_EROSION_HORZ

LVB_EROSION_OMNI	BFLT_EROSION_OMNI

LVB_EROSION_VERT	BFLT_EROSION_VERT

LVB_FILE_READONLY	Specific file type, such as FILE_PCD

LVB_GRADIENT_E	FLT_GRADIENT_E

LVB_GRADIENT_N	FLT_GRADIENT_N

LVB_GRADIENT_NE	FLT_GRADIENT_NE

LVB_GRADIENT_NW	FLT_GRADIENT_NW

LVB_GRADIENT_S	FLT_GRADIENT_S

LVB_GRADIENT_SE	FLT_GRADIENT_SE

LVB_GRADIENT_SW	FLT_GRADIENT_SW

LVB_GRADIENT_W	FLT_GRADIENT_W

LVB_HT_PRINT	HALFTONE_PRINT

LVB_HT_VIEW	HALFTONE_VIEW

LVB_KEY_DOCUMENT	L_KEY_DOCUMENT

LVB_KEY_GIFLZW	L_KEY_GIFLZW

LVB_KEY_TIFLZW	L_KEY_TIFLZW

LVB_LAPLACE_1	FLT_LAPLACE_1

LVB_LAPLACE_2	FLT_LAPLACE_2

LVB_LAPLACE_3	FLT_LAPLACE_3

LVB_LAPLACE_DIAG	FLT_LAPLACE_DIAG

LVB_LAPLACE_HORZ	FLT_LAPLACE_HORZ

LVB_LAPLACE_VERT	FLT_LAPLACE_VERT

LVB_LINESEG_HORZ	FLT_LINESEG_HORZ

LVB_LINESEG_LTOR	FLT_LINESEG_LTOR

LVB_LINESEG_RTOL	FLT_LINESEG_RTOL

LVB_LINESEG_VERT	FLT_LINESEG_VERT

LVB_ORDER_BGR	CRP_BYTEORDERBGR

LVB_ORDER_RGB	CRP_BYTEORDERRGB

LVB_PALETTE_FIXED	CRP_FIXEDPALETTE

LVB_PALETTE_IDENTITY	CRP_IDENTITYPALETTE

LVB_PALETTE_OPTIMIZED	CRP_OPTIMIZEDPALETTE

LVB_PALETTE_USER	CRP_USERPALETTE

LVB_PREWITT_HORZ	FLT_PREWITT_HORZ

LVB_PREWITT_VERT	FLT_PREWITT_VERT

LVB_PROPSET_EXP	No equivalent. Refer to the IsSupportLocked method.

LVB_PROPSET_PRO	No equivalent. Refer to the IsSupportLocked method.

LVB_RESIZE_INTERPOLATE	RESIZE_RESAMPLE

LVB_SHIFTDIFF_DIAG	FLT_SHIFTDIFF_DIAG

LVB_SHIFTDIFF_HORZ	FLT_SHIFTDIFF_HORZ

LVB_SHIFTDIFF_VERT	FLT_SHIFTDIFF_VERT

LVB_SOBEL_HORZ	FLT_SOBEL_HORZ

LVB_SOBEL_VERT	FLT_SOBEL_VERT

LVB_SUPPORT_DOCUMENT	L_SUPPORT_DOCUMENT

LVB_SUPPORT_GIFLZW	L_SUPPORT_GIFLZW

LVB_SUPPORT_TIFLZW	L_SUPPORT_TIFLZW

LVB_UNDERLAYTYPE_STRETCH	UNDERLAY_STRETCH

LVB_UNDERLAYTYPE_TILE	UNDERLAY_TILE

4.  Remove the LVB_ prefix from remaining constants.

After you have made the changes described above, you can change the remaining VBX constants to ActiveX constants by removing the LVB_ prefix.

5.  Make the simple property-to-method changes.

Many of the VBX action properties have equivalent ActiveX methods where the only difference is that you pass a parameter instead of setting a value.

In one category, after you have updated the constants, you can simply remove the equals (=) sign as shown in the following example:

VBX code:	LeadControl.ColorSeparate = FormatConstant

ActiveX code:	LeadControl.ColorSeparate FormatConstant

The following is a list of the ActiveX methods that you can code in this fashion:

Average method

ColorMerge

ColorSeparate

Contrast method

Fill method

GammaCorrect method

HistoContrast method

Hue method

Intensity method

Median method

Mosaic method

Posterize method

Saturation method

In another category, the VBX property is set to True, but the ActiveX method is called with no parameters as shown in the following example:

VBX code:	LeadControl.Grayscale = True

ActiveX code:	LeadControl.Grayscale

The following is a list of the ActiveX methods that you can code in this fashion:

Deskew method

Despeckle method

Flip method

Grayscale method

Invert method

Reverse method

StretchIntensity method

6.  Make the rest of the changes.

The following are the specific changes that you must make in your remaining code. Notice that some of the VBX properties are changed only when you are using them to take an action, and that the same properties are still valid in read-only situations.

VBX code:	LeadControl.AddNoiseChannel = ChannelConstant
LeadControl.AddNoise = NoiseAmount

ActiveX code:	LeadControl.AddNoise NoiseAmount, ChannelConstant

VBX code:	LeadControl.BitChgOrder = ColorOrderConstant
LeadControl.BitChgPalette = PaletteConstant
LeadControl.BitChgDither = DitherConstant
LeadControl.BitmapBits = DesiredBPP

ActiveX code:	LeadControl.ColorRes DesiredBPP, PaletteConstant, DitherConstant, 0
or LeadControl.ColorRes DesiredBPP, ColorOrderConstant, DitherConstant, 0

VBX code:	LeadControl.BitChgUserPal(index) = ColorValue

ActiveX code:	LeadControl.UserPalette(index) = ColorValue

VBX code:	LeadControl.BitmapDC = True
ReturnValue = GDIFunction(LeadControl.BitmapDC, OtherParameters...)
LeadControl.BitmapDC = False

ActiveX code:	LeadDC = LeadControl.GetBitmapDC
ReturnValue = GDIFunction(LeadDC, OtherParameters...)
LeadControl.ReleaseBitmapDC

VBX code:	PixelHeight = LeadControl.BitmapHeight
PixelWidth = LeadControl.BitmapWidth

ActiveX code:	LeadControl.ScaleMode = 3
PixelHeight = LeadControl.BitmapHeight
PixelWidth = LeadControl.BitmapWidth

VBX code:	LeadControl.BitmapOrder

ActiveX code:	No equivalent. Use the ColorRes method.

VBX code:	TwipsHeight = LeadControl.BitmapScaleHeight
TwipsWidth = LeadControl.BitmapScaleWidth

ActiveX code:	LeadControl.ScaleMode = Form.ScaleMode
TwipsHeight = LeadControl.BitmapHeight
TwipsWidth = LeadControl.BitmapWidth

VBX code:	LeadControl.CaptureTop = TopPixel
LeadControl.CaptureLeft = LeftPixel
LeadControl.CaptureWidth = PixelWidth
LeadControl.CaptureHeight = PixelHeight
LeadControl.Capture = hDC

ActiveX code:	LeadControl.ScaleMode = 3
LeadControl.Capture hDC, LeftPixel, TopPixel, PixelWidth, PixelHeight

VBX code:	LeadControl.ClientDC = True
ReturnValue = GDIFunction(LeadControl.ClientDC, OtherParameters...)
LeadControl.ClientDC = False

ActiveX code:	LeadDC = LeadControl.GetClientDC
ReturnValue = GDIFunction(LeadDC, OtherParameters...)
LeadControl.ReleaseClientDC

VBX code:	LeadControl1.CombineSrcLeft = SourceLeft
LeadControl1.CombineSrcTop = SourceTop
LeadControl1.CombineDstLeft = TargetLeft
LeadControl1.CombineDstTop = TargetTop
LeadControl1.CombineWidth = Width
LeadControl1.CombineHeight = Height
LeadControl1.CombineOp = Operation
LeadControl1.Combine = LeadControl2.Bitmap

ActiveX code:	LeadControl1.Combine TargetLeft, TargetTop, Width, Height, LeadControl2.Bitmap, SourceLeft, SourceTop, Operation

VBX code:	LeadControl.Copy = True

ActiveX code:	LeadControl.Copy COPY_EMPTY + COPY_DIB

VBX code:	LeadControl.CreateBits = DesiredBPP
LeadControl.CreateWidth = BitmapWidth
LeadControl.CreateHeight = BitmapHeight
LeadControl.CreateBitmap = True

ActiveX code:	LeadControl.CreateBitmap BitmapWidth, BitmapHeight, DesiredBPP

VBX code:	LeadControl.CreatePicture = True
VBPicture = LeadControl.Picture

ActiveX code:	VBPicture = LeadControl.GetPicture

VBX code:	LeadControl.CropLeft = LeftValue
LeadControl.CropTop = TopValue
LeadControl.CropWidth = WidthValue
LeadControl.CropHeight = HeightValue
LeadControl.Crop = True

ActiveX code:	LeadControl.SetDstClipRect LeftValue, TopValue, WidthValue, HeightValue

VBX code:	MyDDB = LeadControl.DDB

ActiveX code:	LeadControl.GetDDB MyDDB

VBX code:	LeadControl.DDB = MyDDB

ActiveX code:	MyDC = LeadControl.GetClientDC
MyPalette = LeadControl.GetPalette(MyDC)
LeadControl.SetDDB MyDC, MyDDB, MyPalette

VBX code:	MyDIB = LeadControl.DIB

ActiveX code:	LeadControl.GetDIB MyDIB

VBX code:	LeadControl.DIB = MyDIB

ActiveX code:	LeadControl.SetDIB MyDIB

VBX code:	LeadControl.Effect = EffectConstant

ActiveX code:	LeadControl.PaintEffect = EffectConstant

VBX code:	LeadControl.EnableStatus = BooleanValue

ActiveX code:	LeadControl.EnableProgressEvent = BooleanValue

VBX code:	LeadControl.EnableTwainMulti = True
LeadControl.TwainAcquire = True

ActiveX code:	LeadControl.EnableTwainEvent = True
LeadControl.TwainAcquire hWnd

VBX code:	LeadControl.File = PathName

ActiveX code:	LeadControl.Load PathName, 0, 0, 1

VBX code:	LeadControl.FilePage = PageNumber
LeadControl.File = PathName

ActiveX code:	LeadControl.Load PathName, 0, PageNumber, 1

VBX code:	LeadControl.LoadStamp = True
LeadControl.File = PathName

ActiveX code:	LeadControl.LoadStamp PathName

VBX code:	LeadControl.FltDilation = DilationConstant

ActiveX code:	LeadControl.BinaryFilter DilationConstant

VBX code:	LeadControl.FltEmbossDepth = ShadowDepth
LeadControl.FltEmboss = EmbossConstant

ActiveX code:	LeadControl.Emboss EmbossConstant, ShadowDepth

VBX code:	LeadControl.FltErosion = ErosionConstant

ActiveX code:	LeadControl.BinaryFilter ErosionConstant

VBX code:	LeadControl.FltGradient = GradientConstant

ActiveX code:	LeadControl.SpatialFilter GradientConstant

VBX code:	LeadControl.FltLaplace = LaplacianConstant

ActiveX code:	LeadControl.SpatialFilter LaplacianConstant

VBX code:	LeadControl.FltLineSeg = LineSegmentConstant

ActiveX code:	LeadControl.SpatialFilter LineSegmentConstant

VBX code:	LeadControl.FltPrewitt = PrewittConstant

ActiveX code:	LeadControl.SpatialFilter PrewittConstant

VBX code:	LeadControl.FltShiftDiff = ShiftDiffConstant

ActiveX code:	LeadControl.SpatialFilter ShiftDiffConstant

VBX code:	LeadControl.FltSobel = SobelConstant

ActiveX code:	LeadControl.SpatialFilter SobelConstant

VBX code:	LeadControl.HalftoneAngle = HundredthsOfDegrees
LeadControl.Halftone = TypeConstant

ActiveX code:	LeadControl.Halftone TypeConstant, HundredthsOfDegrees

VBX code:	ReturnValue = GDIFunction(LeadControl.hDC, OtherParameters...)

ActiveX code:	LeadDC = LeadControl.GetClientDC
ReturnValue = GDIFunction(LeadDC, OtherParameters...)
LeadControl.ReleaseClientDC

VBX code:	LeadControl.HistoEq = True

ActiveX code:	LeadControl.HistoEqualize

VBX code:	LeadControl.HistogramChannel = ChannelConstant
LeadControl.HistogramAcquire = True
IntensityValue = LeadControl.Histogram(Index)

ActiveX code:	LeadControl.GetHistogram ChannelConstant
IntensityValue = LeadControl.HistogramTable(Index)

VBX code:	LeadControl.ImageHeight

ActiveX code:	LeadControl.DstHeight

VBX code:	LeadControl.ImageLeft

ActiveX code:	LeadControl.DstLeft

VBX code:	LeadControl.ImageTop

ActiveX code:	LeadControl.DstTop

VBX code:	LeadControl.ImageWidth

ActiveX code:	LeadControl.DstWidth

VBX code:	PixelHeight = LeadControl.InfoHeight
PixelWidth = LeadControl.InfoWidth

ActiveX code:	LeadControl.ScaleMode = 3
PixelHeight = LeadControl.InfoHeight
PixelWidth = LeadControl.InfoWidth

VBX code:	LeadControl.InfoPage = PageNumber
LeadControl.InfoFile = PathName

ActiveX code:	LeadControl.GetFileInfo PathName, PageNumber

VBX code:	FilePath = LeadControl.InfoFile

ActiveX code:	No equivalent. You must maintain your own variable if you want to keep the path that was used to load the image.

VBX code:	BitmapHeight = LeadControl.InfoScaleHeight
BitmapWidth = LeadControl.InfoScaleWidth

ActiveX code:	LeadControl.ScaleMode = Form1.ScaleMode
BitmapHeight = LeadControl.InfoHeight
BitmapWidth = LeadControl.InfoWidth

VBX code:	LeadControl.IntensityDetectLow = LowValue
LeadControl.IntensityDetectHigh = HighValue
LeadControl.IntensityDetect = True

ActiveX code:	LeadControl.IntensityDetect LowValue, HighValue

VBX DDE properties are not supported by the ActiveX. Affected VBX properties are LinkItem, LinkMode, LinkTimeout, and LinkTopic.

VBX code:	If LeadControl.Paste = True Then
   LeadControl.Paste = True
Else
   MsgBox "No image on the clipboard"
End If

ActiveX code:	If LeadControl.Paste(PASTE_ISREADY) = 0 Then
   MsgBox ("Invalid data on the clipboard")
Else
   LeadControl.Paste 0
End If

VBX code:	LeadControl.PaintBwAsGray = BooleanValue

ActiveX code:	LeadControl.BitonalScaling = ScalingConstant

VBX code:	LeadControl.PCDResolution = DesiredResolution
LeadControl.File = PathName

ActiveX code:	LeadControl.PCDRes = DesiredResolution
LeadControl.Load PathName, 0, 0, 1

VBX code:	LeadControl.Picture = VBPicture

ActiveX code:	LeadControl.SetPicture VBPicture

VBX code:	LeadControl.PictureCreate = True
VBPicture = LeadControl.Picture

ActiveX code:	VBPicture =LeadControl.GetPicture

The VBX properties for cropping the print rectangle have no direct equivalents in the ActiveX. The closest match is the SetSrcClipRect method, which requires different logic. Affected VBX properties are PrintCropTop, PrintCropLeft, PrintCropWidth, PrintCropHeight, and PrintCrop.

VBX code:	LeadControl.PrintLeft = LeftPixel
LeadControl.PrintTop = TopPixel
LeadControl.PrintWidth = PixelWidth
LeadControl.PrintHeight = PixelHeight
LeadControl.PrintBitmap = Printer.hDC

ActiveX code:	LeadControl.Render Printer.hDC, LeftPixel, TopPixel, PixelWidth, PixelHeight

VBX code:	If LeadControl.PropertySet = LVB_PROPSET_EXP Then Do Something

ActiveX code:	If LeadControl.IsSupportLocked (L_SUPPORT_DOCUMENT) = False Then Do Something

VBX code:	LeadControl.Repaint = True

ActiveX code:	LeadControl.ForceRepaint

VBX code:	LeadControl.RemapChannel = ChannelConstant
LeadControl.RemapIntensity = True

ActiveX code:	LeadControl.RemapIntensity ChannelConstant

VBX code:	LeadControl.ResizeType = TypeConstant
LeadControl.ResizeWidth = PixelWidth
LeadControl.ResizeHeight = PixelHeight
LeadControl.Resize = True

ActiveX code:	LeadControl.ScaleMode = 3
LeadControl.Size PixelWidth, PixelHeight, TypeConstant

VBX code:	LeadControl.Rotate = Degrees

ActiveX code:	LeadControl.Rotate Degrees * 100, True, RGB(0, 0, 0)

VBX code:	LeadControl.BackColor = RGBValue
LeadControl.RotateFine = HundredthsOfDegrees

ActiveX code:	LeadControl.Rotate HundredthsOfDegrees, True, RGBValue

VBX code:	LeadControl.SaveBits = BPPInDatabase
LeadControl.SaveFormat = FormatInDatabase
LeadControl.SaveQFactor = QFactorInDatabase

ActiveX code:	LeadControl.DataSaveBits = BPPInDatabase
LeadControl.DataSaveFormat = FormatInDatabase
LeadControl.DataSaveQuality = QFactorInDatabase

VBX code:	LeadControl.SaveMulti = False
LeadControl.SaveBits = DesiredBPP
LeadControl.SaveFormat = DesiredFormat
LeadControl.SaveQFactor = DesiredQFactor
LeadControl.SaveFile = PathName

ActiveX code:	LeadControl.Save PathName, DesiredFormat, DesiredBPP, DesiredQFactor, False

VBX code:	LeadControl.SaveMulti = True
LeadControl.SaveFile = PathName

ActiveX code:	LeadControl.Save PathName, DesiredFormat, DesiredBPP, 0, True

VBX code:	LeadControl.SaveStampBits = StampBPP
LeadControl.SaveStampWidth = StampWidth
LeadControl.SaveStampHeight = StampHeight
LeadControl.SaveStamp = True
LeadControl.SaveBits = DesiredBPP
LeadControl.SaveFormat = DesiredFormat
LeadControl.SaveQFactor = DesiredQFactor
LeadControl.SaveFile = PathName

ActiveX code:	LeadControl.SaveWithStamp PathName, DesiredFormat, DesiredBPP, DesiredQFactor, StampWidth, StampHeight, StampBPP

VBX code:	LeadControl.Sharpness = ChangeAmount

ActiveX code:	LeadControl.Sharpen ChangeAmount

VBX code:	LeadControl.BackColor = RGBValue
LeadControl.ShearX = HundredthsOfDegrees

ActiveX code:	LeadControl.Shear HundredthsOfDegrees, True, RGBValue

VBX code:	LeadControl.BackColor = RGBValue
LeadControl.ShearY = HundredthsOfDegrees

ActiveX code:	LeadControl.Shear HundredthsOfDegrees, False, RGBValue

VBX code:	Status event

ActiveX code:	ProgressStatus event

VBX code:	LeadControl.SupportType = SupportConstant
If LeadControl.IsSupportLocked = False Then
    Do something
End If

ActiveX code:	If LeadControl.IsSupportLocked(SupportConstant) Then
    Do something
End If

VBX code:	LeadControl.SupportType = SupportConstant
LeadControl.UnlockSupport = Password

ActiveX code:	If LeadControl.UnlockSupport SupportConstant, Password

VBX code:	LeadControl.TrimLeft = LeftPixel
LeadControl.TrimTop = TopPixel
LeadControl.TrimWidth = PixelWidth
LeadControl.TrimHeight = PixelHeight
LeadControl.Trim = True

ActiveX code:	LeadControl.ScaleMode = 3
LeadControl.Trim LeftPixel, TopPixel, PixelWidth, PixelHeight

VBX code:	TwainImage event

ActiveX code:	TwainPage event

VBX code:	LeadControl.TwainSelect = True
LeadControl.TwainAcquire = True

ActiveX code:	LeadControl.TwainSelect hWnd
LeadControl.TwainAcquire hWnd

VBX code:	LeadControl1.UnderlayType = TypeFlag
LeadControl1.Underlay = LeadControl2.Bitmap

ActiveX code:	LeadControl1.Underlay LeadControl2.Bitmap, TypeFlag

7.  Note the properties that have not changed.

The following properties are used in the ActiveX the same way as they were used in the VBX:

AutoRepaint, AutoScroll, BackErase, Bitmap, BitmapPalette, BitmapXRes, BitmapYRes, BitonalScaling, BorderStyle, ColorPlanes, DataChanged, DataField, DataSource, Enabled, hDC, InfoBits, InfoCompress, InfoFormat, InfoPCDResolution, InfoSizeDisk, InfoSizeMem, MousePointer, PaintDither, PaintPalette, PaintRop3, PaintWhileLoad, RemapTable, TwainFlags.

The following properties are provided by the development system and are not documented for the LEADTOOLS ActiveX. All of them, except the Parent property, are available when the ActiveX is used in Visual Basic.

Align, DragIcon, DragMode, HelpContextID, hWnd, Index, Height, Left, Name, Parent, TabIndex, TabStop, Tag, Top, Visible, Width


Tutorial for Access 2.0 Programmers
Tutorial for Microsoft Access 2.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS ActiveX.

Note:	These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Loading and Displaying an Image

Zooming Out and Zooming In

Dynamically Positioning the Control

Zooming In on a Selection

Outlining, Dragging, and Pasting a Region

Creating and Using Annotations

Writing and Reading Multipage Files

Drawing Simple Lines and Shapes

Cropping a Bitmap

Creating, Viewing, and Merging Color Separations

Updating a Gauge and Detecting a User Interrupt

Miscellaneous Examples


Loading and Displaying an Image (Access 2.0)

Take the following steps to start a project and to add some code that positions, scales, and displays an image on a form:

1.	Start Microsoft Access 2.0.

2.	On the File pull-down menu, use the New Database option to create a new database.

3.	 In the Database window, select the Module tab, and click the New button.

4.	On the File pull-down menu, use the Load Text option to load the L_ACCESS.BAS file from LEAD's INCLUDE directory. (Use the Merge option when loading the file.)

5.	Close the file, and save it as the Global Constants module.

6.	 In the Database window, select the Form tab, and click the New button.

7.	In the New Form window, click the Blank Form Button.

8.	Click and drag the form's detail area to make it large enough to hold an image and some command buttons.

9.	On the Edit pull-down menu, use the Insert Object option to select the Lead Control (12).

10.	Click the OK button. The lead control appears on the form.

11.	Size and position the control as you want it to appear at run time, and change the name of the control to Lead1.

12.	 Add a command button to your form and name it as follows. (Cancel the Command Button Wizard when it appears.)

Name	Caption

LoadLead	Load Image

13.	 Click the Code Window icon on the toolbar.

14.	Select the Load procedure for Form1, and add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

Sub Form_Load ()

  'Set defaults for displaying the image.
  'These are all persistent properties that can be set in the properties box.
  Me![Lead1].Object.BorderStyle = 1
  Me![Lead1].Object.BackColor = RGB(255, 255, 125)
  Me![Lead1].Object.PaintDither = PAINTDITHER_DIFFUSION
  Me![Lead1].Object.PaintPalette = PAINTPALETTE_AUTO
  Me![Lead1].Object.AutoRepaint = True
  Me![Lead1].Object.AutoSize = False
  Me![Lead1].Object.AutoSetRects = True
  Me![Lead1].Object.PaintSizeMode = PAINTSIZEMODE_FIT
  Me![Lead1].Object.ForePalette = True

End Sub

15.	Code the LoadLead button's click procedure as follows:

Sub LoadLead_Click ()
    Me![Lead1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1
End Sub

16.	Close the code window.

17.	 Click the Form View icon on the toolbar to test the form.

Note:  For 256-color mode, you can improve the image quality as explained in Palette Usage in Microsoft Access.


Zooming Out and Zooming In (Access 2.0)

Take the following steps to add code that can reduce and enlarge the displayed size of the image. This demonstrates the scaling properties that are normally used for zooming in and zooming out. It emphasizes the relationship of the displayed rectangle to the LEAD control.

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

2.	 Add two command buttons to your form and name them as follows:

Name	Caption

ZoomIn	Zoom In

ZoomOut	Zoom Out

3.	 Click the Code Window icon on the toolbar.

4.	Code the ZoomIn button's click procedure as follows:

Sub ZoomIn_Click()
  Me![Lead1].Object.AutoSetRects = True
  Me![Lead1].Object.PaintSizeMode = PAINTSIZEMODE_ZOOM
  Me![Lead1].Object.PaintZoomFactor = Me![Lead1].Object.PaintZoomFactor + 10
End Sub

5.	Code the ZoomOut button's click procedure as follows:

Sub ZoomOut_Click()
  Me![Lead1].Object.AutoSetRects = True
  Me![Lead1].Object.PaintSizeMode = PAINTSIZEMODE_ZOOM
  If Me![Lead1].Object.PaintZoomFactor > 10 Then
      Me![Lead1].Object.PaintZoomFactor = Me![Lead1].Object.PaintZoomFactor - 10
  End If
End Sub

6.	Close the code window.

7.	Click the Form View icon on the toolbar to test the form.


Dynamically Positioning the Control (Access 2.0)

Take the following steps to dynamically scale and position the LEAD control when loading an image. This example scales the control to use most of the form's area while preserving the image's aspect ratio.

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

2.	Modify the LeadLoad button's click procedure so that it appears as follows. For a general explanation of how images are positioned and scaled, refer to Displaying an Image.

Sub LoadLead_Click()
  'Declare variables used for preserving aspect ratios.
  Dim HeightFactor As Long
  Dim WidthFactor As Long
  Dim HeightAllowed As Long
  Dim WidthAllowed As Long
  Dim ViewHeight, ViewWidth

  'Turn off automated behavior while we load and manipulate the image.
  Me![Lead1].Object.AutoSetRects = False
  Me![Lead1].Object.AutoRepaint = False
  Me![Lead1].Object.AutoScroll = False
  Me![Lead1].Object.BackErase = False

  'Load the bitmap. This hard-coded path name may be different on your system.
  Me![Lead1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1

  'Set the variables used for preserving the aspect ratio.
  'Allow for a border of 1/8 of the form size.
  'The units of measure do not matter, since we are calculating proportions.
  HeightFactor = Me![Lead1].Object.BitmapHeight
  WidthFactor = Me![Lead1].Object.BitmapWidth
  HeightAllowed = Me.WindowHeight * 3/4
  WidthAllowed = Me.WindowWidth * 3/4

  'Center the LEAD control on the form, preserving the aspect ratio.
  'Check to see if using the maximum width will make the image too tall.
  'Set the dimensions based on the result.
  If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
    Me![Lead1].Left = Me.WindowWidth / 8
    Me![Lead1].Width = WidthAllowed
    Me![Lead1].Height = (Me![Lead1].Width * HeightFactor) / WidthFactor
    Me![Lead1].Top = (Me.WindowHeight - Me![Lead1].Height) / 2
  Else
    Me![Lead1].Top = Me.WindowHeight / 8
    Me![Lead1].Height = HeightAllowed
    Me![Lead1].Width = (Me![Lead1].Height * WidthFactor) / HeightFactor
    Me![Lead1].Left = (Me.WindowWidth - Me![Lead1].Width) / 2
  End If

  'Set the image display size to match the LEAD control
  Me![Lead1].Object.SetDstRect 0, 0, Me![Lead1].Object.ScaleWidth, Me![Lead1].Object.ScaleHeight
  Me![Lead1].Object.SetDstClipRect 0, 0, Me![Lead1].Object.ScaleWidth, Me![Lead1].Object.ScaleHeight

  'Turn on automated behavior while we load and manipulate the image.
  Me![Lead1].Object.AutoSetRects = True
  Me![Lead1].Object.AutoRepaint = True
  Me![Lead1].Object.AutoScroll = True

End Sub

3.	Close the code window.

4.	Click the Form View icon on the toolbar to test the form.


Zooming In on a Selection (Access 2.0)

Take the following steps to add code that lets you select an area with a mouse, and zoom in on the selected area.

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

2.	In the LEAD1 control's MouseDown procedure, add the following code:

Sub Lead1_MouseDown (Button As Integer, Shift As Integer, X As Long, Y As Long)
  'Enable AutoRubberBand
  Me![LEAD1].Object.AutoRubberBand = True
  Me![LEAD1].Object.MousePointer = 2
End Sub

3.	In the LEAD1 control's RubberBand procedure, add the following code:

Sub Lead1_RubberBand ()
  Dim zoomleft As Integer
  Dim zoomtop As Integer
  Dim zoomwidth As Integer
  Dim zoomheight As Integer

  Me![LEAD1].Object.MousePointer = 0

  'Zoom in on the selection.
  zoomleft = Me![LEAD1].Object.RubberBandLeft
  zoomtop = Me![LEAD1].Object.RubberBandTop
  zoomwidth = Me![LEAD1].Object.RubberBandWidth
  zoomheight = Me![LEAD1].Object.RubberBandHeight

  'Zoom in on the rectangle defined by the rubberband
  Me![LEAD1].Object.ZoomToRect zoomleft, zoomtop, zoomwidth, zoomheight
  Me![LEAD1].Object.ForceRepaint
End Sub

4.	Run your program to test it.


Outlining, Dragging, and Pasting a Region (Access 2.0)

Take the following steps to add code that lets you outline an area with a mouse, drag a copy of the selected area, and paste the copy into another part of the bitmap:

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

2.	Add a second LEAD control, name it LEAD2, and set its Visible property to False.

3.	Add the following form-level variables to the declarations procedure of the general object in your main form. In online help, you can use the Edit pull-down menu to copy the block of code.

Dim ReadyToDrag As Integer 'The state after marking the region but before dragging
Dim Dragging As Integer 'The state when the mouse is used for dragging the floater
Dim StartX As Single 'Starting X position in screen twips
Dim StartY As Single 'Starting Y position in screen twips
Dim FloaterX As Single 'Floater X position in screen twips
Dim FloaterY As Single 'Floater Y position in screen twips
Dim ZoomFactorX As Single 'Used for translating positioning information
Dim ZoomFactorY As Single 'Used for translating positioning information

4.	 At the top of your main form, add two command buttons and name them as follows:

Name	Caption

SelRgnBtn	Select Region

PasteFloaterBtn	Paste Floater

5.	Add the following code to the SelRgnBtn control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Sub SelRgnBtn_Click ()

Me![LEAD1].Object.RgnMarkingMode = RGNMARK_FREEHAND
MsgBox "Draw a freehand region"

End Sub

6.	Add the following code to the PasteFloaterBtn control's Click procedure.

Sub PasteFloaterBtn_Click ()

'Declare the variable for the Combine operation.
Dim MyOp As Long

'Declare variables for the client area coordinates.
Dim LCRgnX, LCRgnY , LCRgnWidth, LCRgnHeight

'Declare variables for the bitmap coordinates.
Dim LBRgnX, LBRgnY , LBRgnWidth, LBRgnHeight

'Do nothing if there is no floater.
If Me![LEAD1].Object.Floater = 0 Then Exit Sub

'Get the floater into another bitmap
Me![LEAD2].Object.ScaleMode = Me![LEAD1].Object.ScaleMode
Me![LEAD2].Object.Bitmap = Me![LEAD1].Object.Floater

'Get the floater's client coordinates into local variables.
LCRgnX = Me![LEAD1].Object.FloaterDstLeft
LCRgnY = Me![LEAD1].Object.FloaterDstTop
LCRgnWidth = Me![LEAD1].Object.FloaterDstWidth
LCRgnHeight = Me![LEAD1].Object.FloaterDstHeight

'Delete the floater.
Me![LEAD1].Object.FloaterVisible = False
Me![LEAD1].Object.Floater = 0

'Translate the client coordinates to bitmap coordinates.
LBRgnX = ((LCRgnX - Me![LEAD1].Object.DstLeft) / ZoomFactorX) + Me![LEAD1].Object.SrcLeft
LBRgnY = ((LCRgnY - Me![LEAD1].Object.DstTop) / ZoomFactorY) + Me![LEAD1].Object.SrcTop
LBRgnWidth = LCRgnWidth / ZoomFactorX
LBRgnHeight = LCRgnHeight / ZoomFactorY

'Reposition the region to use it as a mask for the Combine method.
Me![LEAD1].Object.OffsetRgn LBRgnX - Me![LEAD1].Object.RgnLeft, LBRgnY - Me![LEAD1].Object.RgnTop

'Use the Combine method to paste the Lead2 bitmap into the Lead1 bitmap.
MyOp = CB_OP_ADD + CB_DST_0 'Operation flags for a simple paste.
Me![LEAD1].Object.Combine LBRgnX, LBRgnY, LBRgnWidth, LBRgnHeight, Me![LEAD2].Object.Bitmap, 0, 0, MyOp

'Repaint the part of the client area that has changed.
Me![LEAD1].Object.RepaintRect LCRgnX, LCRgnY, LCRgnWidth, LCRgnHeight, False

'Free the region.
Me![LEAD1].Object.FreeRgn

End Sub

7.	In the LEAD1 control's MouseDown procedure, add the following code.

Sub LEAD1_MouseDown (Button As Integer, Shift As Integer, X As Long, Y As Long)

'Declare local variables.
Dim BitmapX, BitmapY
Dim NewX, NewY, NewWidth, NewHeight

'Do nothing if we are drawing a region.
If Me![LEAD1].Object.RgnMarkingMode <> RGNMARK_NONE Then Exit Sub

'Make sure we are using Twips, so that we do not have to translate mouse coordinates.
Me![LEAD1].Object.ScaleMode = 1

' Save the starting position, in case we need it.
StartY = Y
StartX = X

'If we are ready to drag the selection, get a floater.
If ReadyToDrag = True Then
  'Translate the current mouse coordinates.
  'These coordinates account for the zoom factor and offset.
  ZoomFactorX = Me![LEAD1].Object.DstWidth / Me![LEAD1].Object.SrcWidth
  ZoomFactorY = Me![LEAD1].Object.DstHeight / Me![LEAD1].Object.SrcHeight
  BitmapX = (x / ZoomFactorX) - (Me![LEAD1].Object.DstLeft / ZoomFactorX) + Me![LEAD1].Object.SrcLeft
  BitmapY = (y / ZoomFactorY) - (Me![LEAD1].Object.DstTop / ZoomFactorY) + Me![LEAD1].Object.SrcTop

  'Continue to create the floater if the mouse is pointing to the region we marked.
  If Me![LEAD1].Object.IsPtInRgn(BitmapX, BitmapY) Then
     'Hide the region frame.
     Me![LEAD1].Object.RgnFrameType = RGNFRAME_NONE

     'Create the floater bitmap, which will be the part of the main bitmap that is
     'in the region's bounding rectangle.
     Me![LEAD1].Object.Floater = Me![LEAD1].Object.Bitmap

     'Translate the bitmap region coordinates to client area coordinates.
     NewY = ((Me![LEAD1].Object.RgnTop - Me![LEAD1].Object.SrcTop) * ZoomFactorY) + Me![LEAD1].Object.DstTop
     NewX = ((Me![LEAD1].Object.RgnLeft - Me![LEAD1].Object.SrcLeft) * ZoomFactorX) + Me![LEAD1].Object.DstLeft
     NewWidth = Me![LEAD1].Object.RgnWidth * ZoomFactorX
     NewHeight = Me![LEAD1].Object.RgnHeight * ZoomFactorY

     'Set the initial display position of the floater.
     Me![LEAD1].Object.SetFloaterDstRect NewX, NewY, NewWidth, NewHeight

     'Set form-level variables.
     FloaterY = Me![LEAD1].Object.FloaterDstTop
     FloaterX = Me![LEAD1].Object.FloaterDstLeft
     Me![LEAD1].Object.FloaterVisible = True
     Dragging = True
     ReadyToDrag = False
  End If

End If

End Sub

8.	In the LEAD1 control's MouseMove procedure, add the following code.

Sub LEAD1_MouseMove (Button As Integer, Shift As Integer, X As Long, Y As Long)

'Declare variables for repositioning the floater.
Dim NewX, NewY, NewWidth, NewHeight, XDelta, YDelta

'Do nothing if we are drawing a region.
If Me![LEAD1].Object.RgnMarkingMode <> RGNMARK_NONE Then Exit Sub

'Reposition the floater if we are dragging it.
If Dragging = True And Button = 1 And Me![LEAD1].Object.Floater <> 0 Then
    If Me![LEAD1].Object.IsPtInFloater(x, y) Then
        'Update the position variables.
        XDelta = x - StartX
        YDelta = y - StartY
        NewX = FloaterX + XDelta
        NewY = FloaterY + YDelta
        NewWidth = Me![LEAD1].Object.FloaterDstWidth
        NewHeight = Me![LEAD1].Object.FloaterDstHeight

        'Reposition the floater.
        Me![LEAD1].Object.SetFloaterDstRect NewX, NewY, NewWidth, NewHeight

        'Save the form-level position variables.
        FloaterY = NewY
        FloaterX = NewX
        StartY = y
        StartX = x
    End If
End If

End Sub

9.	In the LEAD1 control's MouseUp procedure, add the following code.

Sub LEAD1_MouseUp (Button As Integer, Shift As Integer, X As Long, Y As Long)

' If we were drawing a region, set up for the next operation.
If Me![LEAD1].Object.RgnMarkingMode <> RGNMARK_NONE Then
    Me![LEAD1].Object.RgnMarkingMode = RGNMARK_NONE
    Me![LEAD1].Object.RgnFrameType = RGNFRAME_STATIC
    ReadyToDrag = True
    MsgBox "Now, drag the selection to another place."
End If

End Sub

10.	Run your program to test it.


Creating and Using Annotations (Access 2.0)

Note: This topic is for Document/Medical only.

Take the following steps to add code that demonstrates the creation and deletion, saving and loading, and copying and pasting of annotation objects.

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

2.	Using the control wizard, create a list box with the following entries for selecting annotation tools. (Note that hot spots and buttons are not used, because Access 2.0 does not support annotation events.)

Selection
Line
Rectangle
Ellipse
Polyline
Polygon
Pointer
Freehand
Highlight
Redaction
Text
Note
Stamp
Audio

3.	Name the list box control AnnTool and code its click event as follows:

Sub AnnTool_Click ()

Select Case AnnTool.Value
Case "Selection"
    Me![LEAD1].Object.AnnTool = ANNTOOL_SELECT
Case "Line"
    Me![LEAD1].Object.AnnTool = ANNTOOL_LINE
Case "Rectangle"
    Me![LEAD1].Object.AnnTool = ANNTOOL_RECT
Case "Ellipse"
    Me![LEAD1].Object.AnnTool = ANNTOOL_ELLIPSE
Case "Polyline"
    Me![LEAD1].Object.AnnTool = ANNTOOL_POLYLINE
Case "Polygon"
    Me![LEAD1].Object.AnnTool = ANNTOOL_POLYGON
Case "Pointer"
    Me![LEAD1].Object.AnnTool = ANNTOOL_POINTER
Case "Freehand"
    Me![LEAD1].Object.AnnTool = ANNTOOL_FREEHAND
Case "Highlight"
    Me![LEAD1].Object.AnnTool = ANNTOOL_HILITE
Case "Redaction"
    Me![LEAD1].Object.AnnTool = ANNTOOL_REDACT
Case "Text"
    Me![LEAD1].Object.AnnTool = ANNTOOL_TEXT
Case "Note"
    Me![LEAD1].Object.AnnTool = ANNTOOL_NOTE
Case "Stamp"
    Me![LEAD1].Object.AnnTool = ANNTOOL_STAMP
Case "Audio"
    Me![LEAD1].Object.AnnTool = ANNTOOL_AUDIO
Case Else
    MsgBox "Invalid Selection"
End Select

End Sub

4.	 At the top of your main form, add four command buttons and name them as follows:

Name	Caption

AnnToggle	Start

IOToggle	Save

ClipboardToggle	Copy

Realize	Realize

5.	Code the AnnToggle control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Sub AnnToggle_Click ()

'Use the button to toggle between design mode and run mode
If AnnToggle.Caption = "Start" Then
    Me![LEAD1].Object.AnnUserMode = ANNUSERMODE_DESIGN
    'Make run mode the next thing.
    AnnToggle.Caption = "Run Mode"
ElseIf AnnToggle.Caption = "Design Mode" Then
    Me![LEAD1].Object.AnnUserMode = ANNUSERMODE_DESIGN
    'Make run mode the next thing.
    AnnToggle.Caption = "Run Mode"
Else 'The button takes us to run mode
    Me![LEAD1].Object.AnnUserMode = ANNUSERMODE_RUN
    'Make design mode the next thing.
    AnnToggle.Caption = "Design Mode"
End If

End Sub

6.	Code the IOToggle control's Click procedure as follows:

Sub IOToggle_Click ()

'Declare local variable
Dim nRet As Integer

'Disable errors so that we can trap our own.
Me![LEAD1].Object.EnableMethodErrors = False

'Use the button to toggle between saving and loading annotations
If IOToggle.Caption = "Save" Then
  'Do nothing if there are no annotations.
  If Me![LEAD1].Object.AnnContainer = 0 Then Exit Sub
  'Save the selected annotations.
  nRet = Me![LEAD1].Object.AnnSave("c:\lead\images\tmp.ann", ANNFMT_NATIVE, True)
  If nRet = 0 Then
    'Make loading the next thing.
    IOToggle.Caption = "Load"
    MsgBox "Use the right mouse button to delete any annotations, then click Load"
  Else
    MsgBox "Error code: " + Str(nRet)
  End If
Else 'We are loading annotations
  'Make sure we are in design mode
  Me![LEAD1].Object.AnnUserMode = ANNUSERMODE_DESIGN
  'Load the annotations.
  nRet = Me![LEAD1].Object.AnnLoad("c:\lead\images\tmp.ann", 1)
  If nRet = 0 Then
    IOToggle.Caption = "Save"
  Else
    MsgBox "No annotations to load"
  End If
End If

End Sub

7.	Code the ClipboardToggle control's Click procedure as follows. (Note that Copy, Cut, and Paste are available as automated popup menu options. This code is for tailoring your application.)

Sub ClipboardToggle_Click ()

'Declare local variable
Dim nRet As Integer

'Disable errors so that we can trap our own.
Me![LEAD1].Object.EnableMethodErrors = False

'Use the button to toggle between copying and pasting annotations
If ClipboardToggle.Caption = "Copy" Then
  'Do nothing if there are no annotations.
  If Me![LEAD1].Object.AnnContainer = 0 Then Exit Sub
  'Copy the selected annotations to the clipboard.
  nRet = Me![LEAD1].Object.AnnCopy(ANNFMT_NATIVE, True, True)
  If nRet = 0 Then
    'Make pasting the next thing.
    ClipboardToggle.Caption = "Paste"
    MsgBox "Use the right mouse button to delete any annotations, then click Paste"
   Else
    MsgBox "Error code: " + Str(nRet)
  End If
Else 'We are pasting annotations
  'Make sure we are in design mode
  Me![LEAD1].Object.AnnUserMode = ANNUSERMODE_DESIGN
  'Paste the annotations
  If Me![LEAD1].Object.AnnPasteReady Then
    Me![LEAD1].Object.AnnPaste
    ClipboardToggle.Caption = "Copy"
  Else
    MsgBox "No annotations to paste"
  End If
End If

End Sub

8.	Code the Realize control's Click procedure (which renders the annotation objects to the bitmap) as follows:

Sub Realize_Click ()

Me![LEAD1].Object.AnnRealize False
Me![LEAD1].Object.ForceRepaint
MsgBox "Annotations are now rendered to the bitmap"

End Sub

9.	Run your program to test it.


Writing and Reading Multipage Files (Access 2.0)

Take the following steps to create a multipage file, then load and display the images from the file. Only TIFF (MPT) and PCX (DCX) formats support multipage files.

1.	Start Microsoft Access 2.0.

2.	On the File pull-down menu, use the New Database option to create a new database.

3.	 In the Database window, select the Module tab, and click the New button.

4.	On the File pull-down menu, use the Load Text option to load the L_ACCESS.BAS file from the INCLUDE directory. (Use the Merge option when loading the file.)

5,	Close the file, and save it as the Global Constants module.

6.	 In the Database window, select the Form tab, and click the New button.

7.	In the New Form window, click the Blank Form Button.

8.	Click and drag the form's detail area to make it 5 1/2 inches deep (large enough to fill the screen when you maximize it.)

9.	Add two Lead controls to the form. To add each control, on the Edit pull-down menu, use the Insert Object option to select the Lead Control, then click the OK button.

10.	In the properties box, change the name of the first control to LEAD1, and the second one to LEAD2.

11.	In the property box for the form, select the On Activate event, select the code builder, and add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

This code loads two bitmaps, saves them both into a single multipage TIFF file, loads them again from the TIFF file, and displays them side-by-side.

Sub Form_Activate ()
  DoCmd Maximize
  Me.ScrollBars = None
  Me.Painting = True

  'Disable automatic repainting of the image.
  Me![LEAD1].Object.AutoRepaint = False
  Me![LEAD2].Object.AutoRepaint = False

  'Turn off scroll bars to make sure we use the full client area.
  Me![LEAD1].Object.AutoScroll = False
  Me![LEAD2].Object.AutoScroll = False

  'Hide the controls until we are ready to look at them.
  Me![LEAD1].Visible = False
  Me![LEAD2].Visible = False

  'Display the form and set the mouse pointer to an hourglass.
  DoCmd Hourglass True

  'Load the bitmaps. These hard-coded path names may be different on your system.
  Me![LEAD1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1
  Me![LEAD2].Object.Load "c:\lead\images\image2.cmp", 0, 0, 1

  'Save the bitmaps to a single multipage TIFF file
  Me![LEAD1].Object.Save "c:\lead\images\combined.mpt", FILE_TIF, 24, 0, SAVE_OVERWRITE
  Me![LEAD2].Object.Save "c:\lead\images\combined.mpt", FILE_TIF, 24, 0, SAVE_APPEND

  'Get information about the images so that we can size the controls.
  Me![LEAD1].Object.GetFileInfo "c:\lead\images\combined.mpt", 1, 0
  Me![LEAD2].Object.GetFileInfo "c:\lead\images\combined.mpt", 2, 0

  'Clear the bitmaps from memory
  Me![LEAD1].Object.Bitmap = 0
  Me![LEAD2].Object.Bitmap = 0

  'Make the controls visible so that we can size and position them.
  'They will not really appear until we load an image and paint it.
  Me![LEAD1].Visible = True
  Me![LEAD2].Visible = True

  'Set the variables used for preserving the aspect ratio.
  HeightFactor1 = Me![LEAD1].Object.InfoHeight
  WidthFactor1 = Me![LEAD1].Object.InfoWidth
  HeightFactor2 = Me![LEAD2].Object.InfoHeight
  WidthFactor2 = Me![LEAD2].Object.InfoWidth
  HeightAllowed = Me.WindowHeight * .8
  WidthAllowed = Me.WindowWidth * .45

  'Center each LEAD control on half of the form, preserving the aspect ratio.
  'Check to see if using the maximum width will make the image too tall.
  'Set the dimensions based on the result.
  If (WidthAllowed * HeightFactor1) / WidthFactor1 < HeightAllowed Then
    Me![LEAD1].Left =  (Me.WindowWidth / 4) - (WidthAllowed / 2)
    Me![LEAD1].Width = WidthAllowed
    Me![LEAD1].Height = (Me![LEAD1].Width * HeightFactor1) / WidthFactor1
    Me![LEAD1].TOP = (Me.WindowHeight - Me![LEAD1].Height) / 2
  Else
    Me![LEAD1].TOP = (Me.WindowHeight - HeightAllowed) / 2
    Me![LEAD1].Height = HeightAllowed
    Me![LEAD1].Width = (Me![LEAD1].Height * WidthFactor1) / HeightFactor1
    Me![LEAD1].Left = (Me.WindowWidth / 4) - (Me![LEAD1].Width / 2)
  End If

  If (WidthAllowed * HeightFactor2) / WidthFactor2 < HeightAllowed Then
    Me![LEAD2].Left = (Me.WindowWidth * 3/4) - (WidthAllowed / 2)
    Me![LEAD2].Width = WidthAllowed
    Me![LEAD2].Height = (Me![LEAD2].Width * HeightFactor2) / WidthFactor2
    Me![LEAD2].TOP = (Me.WindowHeight - Me![LEAD2].Height) / 2
  Else
    Me![LEAD2].TOP = (Me.WindowHeight - HeightAllowed) / 2
    Me![LEAD2].Height = HeightAllowed
    Me![LEAD2].Width = (Me![LEAD2].Height * WidthFactor2) / HeightFactor2
    Me![LEAD2].Left = (Me.WindowWidth * 3/4) - (Me![LEAD2].Width / 2)
  End If

  'Load the bitmaps from the multipage TIFF file
  Me![LEAD1].Object.Load "c:\lead\images\combined.mpt", 24, 1, 1
  Me![LEAD2].Object.Load "c:\lead\images\combined.mpt", 24, 2, 1

  'Set the image display sizes to match the LEAD controls
  ImageHeight1 = Me![LEAD1].Object.ScaleHeight
  ImageWidth1 = Me![LEAD1].Object.ScaleWidth
  Me![LEAD1].Object.SetDstRect 0, 0, ImageWidth1, ImageHeight1
  Me![LEAD1].Object.SetDstClipRect 0, 0, ImageWidth1, ImageHeight1

  ImageHeight2 = Me![LEAD2].Object.ScaleHeight
  ImageWidth2 = Me![LEAD2].Object.ScaleWidth
  Me![LEAD2].Object.SetDstRect ImageLeft2, ImageTop2, ImageWidth2, ImageHeight2
  Me![LEAD2].Object.SetDstClipRect ImageLeft2, ImageTop2, ImageWidth2, ImageHeight2

  'Display the images
  Me![LEAD1].Object.ForceRepaint
  Me![LEAD2].Object.ForceRepaint

  'Set the mouse pointer back to the default
  DoCmd Hourglass False

End Sub

12.	Run your program to test it.

Note:  For 256-color mode, you can improve the image quality as explained in Palette Usage in Microsoft Access.


Drawing Simple Lines and Shapes (Access 2.0)

Take the following steps to add code that lets you draw a line, rectangle, and ellipse on the bitmap.

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:

Dim DrawObject As Integer 'The object we are drawing
Dim StartX As Single 'Starting X position
Dim StartY As Single 'Starting Y position
Dim EndX As Single 'Ending X position
Dim EndY As Single 'Ending Y position

3.	Code the LEAD control's MouseDown event as follows. This code selects a different drawing object each time the event occurs.

Sub Lead1_MouseDown (Button As Integer, Shift As Integer, X As Long, Y As Long)
   'Use the same scale mode as the mouse.
   Me![LEAD1].Object.ScaleMode = 1

   'Save the starting position.
   StartX = X
   StartY = Y
   EndX = X
   EndY = Y

   'Cycle through the types of drawing objects.
   Select Case DrawObject
   Case 0
     DrawObject = 1 'Line
   Case 1
     DrawObject = 2 'Rectangle
   Case 2
     DrawObject = 0 'Ellipse
   Case Else
     DrawObject = 0
   End Select
End Sub

4.	Code the LEAD control's MouseMove event as follows. This code uses DRAWMODE_INVERT for the DrawMode, which means that pixel colors are inverted. Thus, the drawing methods can erase the previous object and draw a new one.

Sub LEAD1_MouseMove (Button As Integer, Shift As Integer, X As Long, Y As Long)
   'Declare local variables.
   Dim OldEndX, OldEndY
   Dim OldDrawX, OldDrawY, OldWidth, OldHeight
   Dim DrawX, DrawY, NewWidth, NewHeight

   If Button = 1 Then
      'Set the drawing styles.
      Me![LEAD1].Object.DrawPenStyle = DRAWPENSTYLE_SOLID
      Me![LEAD1].Object.DrawMode = DRAWMODE_INVERT
      Me![LEAD1].Object.DrawFillStyle = DRAWFILLSTYLE_TRANSPARENT
      Me![LEAD1].Object.DrawPersistence = False 'On the window, not the bitmap

     'Save the previous ending mouse position.
     OldEndX = EndX
     OldEndY = EndY
     'Get the current mouse position.
     EndX = X
     EndY = Y
     'Calculate the origin of the current object.
     If EndX > StartX Then
        DrawX = StartX
     Else
        DrawX = EndX
     End If
     If EndY > StartY Then
        DrawY = StartY
     Else
        DrawY = EndY
     End If
     'Calculate the origin of the previous object.
     If OldEndX > StartX Then
        OldDrawX = StartX
     Else
        OldDrawX = OldEndX
     End If
     If OldEndY > StartY Then
        OldDrawY = StartY
     Else
        OldDrawY = OldEndY
     End If

     'Calculate the height and width of the current object.
     NewHeight = Abs(StartY - EndY)
     NewWidth = Abs(StartX - EndX)
     'Calculate the height and width of the previous object.
     OldHeight = Abs(StartY - OldEndY)
     OldWidth = Abs(StartX - OldEndX)
     'Erase the old object and draw the new one.
     Select Case DrawObject
     Case 0 'Ellipse
        Me![LEAD1].Object.DrawEllipse OldDrawX, OldDrawY, OldWidth, OldHeight
        Me![LEAD1].Object.DrawEllipse DrawX, DrawY, NewWidth, NewHeight
     Case 1 'Line
        Me![LEAD1].Object.DrawLine StartX, StartY, OldEndX, OldEndY
        Me![LEAD1].Object.DrawLine StartX, StartY, EndX, EndY
     Case 2 'Rectangle
        Me![LEAD1].Object.DrawRectangle OldDrawX, OldDrawY, OldWidth, OldHeight
        Me![LEAD1].Object.DrawRectangle DrawX, DrawY, NewWidth, NewHeight
     End Select
   End If
End Sub

5.	Code the LEAD control's MouseUp event as follows. This code sets the drawing style and draws the object on the bitmap.

Sub LEAD1_MouseUp (Button As Integer, Shift As Integer, X As Long, Y As Long)
   'Declare local variables.
   Dim DrawX, DrawY, NewWidth, NewHeight

   'Set the drawing style.
   Me![LEAD1].Object.DrawPenStyle = DRAWPENSTYLE_SOLID
   Me![LEAD1].Object.DrawPenWidth = 2
   Me![LEAD1].Object.DrawPenColor = RGB(255, 0, 0) 'Red
   Me![LEAD1].Object.DrawMode = DRAWMODE_COPY_PEN
   Me![LEAD1].Object.DrawFillColor = RGB(0, 255, 0) 'Green
   Me![LEAD1].Object.DrawFillStyle = DRAWFILLSTYLE_HORIZONTAL_LINE
   Me![LEAD1].Object.DrawPersistence = True 'On the bitmap

   'Get the current mouse position
   EndX = X
   EndY = Y
   'Determine the origin of the object.
   If EndX > StartX Then
      DrawX = StartX
   Else
      DrawX = EndX
   End If
   If EndY > StartY Then
      DrawY = StartY
   Else
      DrawY = EndY
   End If
   'Determine the height and width of the object.
   NewHeight = Abs(StartY - EndY)
   NewWidth = Abs(StartX - EndX)
   'Draw the object
   Select Case DrawObject
   Case 0 'Ellipse
      Me![LEAD1].Object.DrawEllipse DrawX, DrawY, NewWidth, NewHeight
   Case 1 'Line
      Me![LEAD1].Object.DrawLine StartX, StartY, EndX, EndY
   Case 2 'Rectangle
      Me![LEAD1].Object.DrawRectangle DrawX, DrawY, NewWidth, NewHeight
   End Select
End Sub

6.	Run your program to test it.


Cropping a Displayed Image and Copying It to a Bitmap (Access 2.0)
Cropping a Bitmap (Access 2.0)

Take the following steps to add code that lets you select an area with a mouse, crop the display to show only that area, and crop the bitmap to match the selected area.

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:

Dim Cropping 'The state when the mouse is used for cropping
Dim StartX As Integer 'Starting X position in screen pixels
Dim StartY As Integer 'Starting Y position in screen pixels
Dim EndX As Integer 'Ending X position in screen pixels
Dim EndY As Integer 'Ending Y position in screen pixels

3.	 Select the CommandButton control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

4.	In the Properties box, change the CommandButton control's Caption property to Select Rectangle.

5.	Add the following code to the CommandButton control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Sub Button4_Click()

  'Set the scale mode to twips
   Me![LEAD1].Object.ScaleMode = 1

  'Initialize cropping so that you can do it more than once
  If Cropping = True Then
    'Set the clipping area to match the image.
    DstLeft = Me![LEAD1].Object.DstLeft
    DstTop = Me![LEAD1].Object.DstTop
    DstWidth = Me![LEAD1].Object.DstWidth
    DstHeight = Me![LEAD1].Object.DstHeight
    Me![LEAD1].Object.SetDstClipRect DstLeft, DstTop, DstWidth, DstHeight

    'Display the image
    Me![LEAD1].Object.ForceRepaint
  End If

  'Set a global variable to let other events know that you are cropping
  Cropping = True

  'Set the pointer to a crosshair
  Me![LEAD1].Object.MousePointer = 2

End Sub

6.	In the LEAD1 control's MouseDown procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

Sub Lead1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

  'Save the starting position
  StartX = X
  StartY = Y

  'Make the rubberband invisible until the mouse moves
  Me![LEAD1].Object.RubberBandVisible = False

End Sub

7.	In the LEAD1 control's MouseMove procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

Sub Lead1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Cropping = True And Button = 1 Then

  'Translate the current mouse position
  EndX = X
  EndY = Y

  'Determine the origin of the rubberband rectangle,
  'regardless of which way the mouse moves.
  If EndX > StartX Then
    rbX = StartX
  Else
    rbX = EndX
  End If
  If EndY > StartY Then
    rbY = StartY
  Else
    rbY = EndY
  End If

  'Determine the height and width of the rubberband rectangle
  rbHeight = Abs(StartY - EndY)
  rbWidth = Abs(StartX - EndX)

  'Set the rubberband rectangle.
  Me![LEAD1].Object.SetRubberBandRect rbX, rbY, rbWidth, rbHeight

    'Alternatively, you could use the following properties to set the
    'rubberband rectangle.
    ' Me![LEAD1].Object.RubberBandHeight = rbHeight
    ' Me![LEAD1].Object.RubberBandLeft = rbX
    ' Me![LEAD1].Object.RubberBandTop = rbY
    ' Me![LEAD1].Object.RubberBandWidth = rbWidth

  'Make the rubberband visible.
  Me![LEAD1].Object.RubberBandVisible = True
End If

End Sub

8.	In the LEAD1 control's MouseUp procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

Sub Lead1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Cropping = True Then

  'Translate the current mouse position
  EndX = X
  EndY = Y

  'Get the origin of the clipping rectangle.
  'Allow for different mouse drag directions
  If StartX < EndX Then
    CropLeft = StartX
  Else
     CropLeft = EndX
  End If
  If StartY < EndY Then
    CropTop = StartY
  Else
     CropTop = EndY
  End If

  'Get the height and width of the cropped area
  CropWidth = Abs(EndX - StartX)
  CropHeight = Abs(EndY - StartY)

  'Crop and repaint the image
  Me![LEAD1].Object.SetDstClipRect CropLeft, CropTop, CropWidth, CropHeight
  Me![LEAD1].Object.ForceRepaint
  Me![LEAD1].Object.RubberBandVisible = False
  Me![LEAD1].Object.MousePointer = 0 'Default
End If

End Sub

9.	 Select the Command Button control; then add another control to your main form. Put the control at the top of the form to keep it away from the image.

10.	In the Properties box, change the CommandButton control's Caption property to Trim. This command button will be used to trim the bitmap in memory and redisplay the bitmap.

11.	Add the following code to the CommandButton control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Sub Command5_Click()

  DoCmd Hourglass True

  'Use the clipping rectangle's percentage offsets in the image rectangle
  'to determine the trimmed rectangle in the bitmap.
  'Using percentages allows for the possibility that the image is zoomed.
  XFactor = Me![LEAD1].Object.BitmapWidth / Me![LEAD1].Object.DstWidth
  YFactor = Me![LEAD1].Object.BitmapHeight / Me![LEAD1].Object.DstHeight
  NewTop = (Me![LEAD1].Object.DstClipTop - Me![LEAD1].Object.DstTop) * YFactor
  NewLeft = (Me![LEAD1].Object.DstClipLeft - Me![LEAD1].Object.DstLeft) * XFactor
  NewWidth = Me![LEAD1].Object.DstClipWidth * XFactor
  NewHeight = Me![LEAD1].Object.DstClipHeight * YFactor

  'Make sure display rectangles are automatically adjusted.
  Me![LEAD1].Object.AutoSetRects = True

  'Trim the bitmap.
  Me![LEAD1].Object.Trim NewLeft, NewTop, NewWidth, NewHeight

  'Size and redisplay the control, using the new bitmap size.
  'Set the variables used for preserving the aspect ratio.
  'Allow for a border of 1/8 of the form size.
  'The units of measure do not matter, since we are calculating proportions.
  HeightFactor = Me![LEAD1].Object.BitmapHeight
  WidthFactor = Me![LEAD1].Object.BitmapWidth
  HeightAllowed = Me.WindowHeight - (Me.WindowHeight / 4)
  WidthAllowed = Me.WindowWidth - (Me.WindowWidth / 4)

  'Center the LEAD control on the form, preserving the aspect ratio.
  'Check to see if using the maximum width will make the image too tall.
  'Set the dimensions based on the result.
  If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
    Me![LEAD1].Left = Me.WindowWidth / 8
    Me![LEAD1].Width = WidthAllowed
    Me![LEAD1].Height = (Me![LEAD1].Width * HeightFactor) / WidthFactor
    Me![LEAD1].TOP = (Me.WindowHeight - Me![LEAD1].Height) / 2
  Else
    Me![LEAD1].TOP = Me.WindowHeight / 8
    Me![LEAD1].Height = HeightAllowed
    Me![LEAD1].Width = (Me![LEAD1].Height * WidthFactor) / HeightFactor
    Me![LEAD1].Left = (Me.WindowWidth - Me![LEAD1].Width) / 2
  End If

  'Turn off scroll bars to make sure we use the full client area.
  Me![LEAD1].Object.AutoScroll = False

  'Set the image display size to match the LEAD control
  Me![LEAD1].Object.SetDstRect 0, 0, Me![LEAD1].Object.ScaleWidth, Me![LEAD1].Object.ScaleHeight
  Me![LEAD1].Object.SetDstClipRect 0, 0, Me![LEAD1].Object.ScaleWidth, Me![LEAD1].Object.ScaleHeight

  'Display the image
  Me![LEAD1].Object.ForceRepaint
  DoCmd Hourglass False

End Sub

12.	Run your program to test it.


Creating, Viewing, and Merging Color Separations (Access 2.0)

Take the following steps to add code that creates CMYK color separations, displays each of the color planes, merges the planes, and displays the result. The code increases the contrast of the K plane to demonstrate how you can manipulate the color separations.

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

2.	 Select the Command Button control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

3.	In the Properties box, change the Command Button control's Name property to Do Separations.

4.	Add the following code to the Command Button control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Sub Command6_Click ()

' Count the button clicks and take the next step with each click
Static ClickCount As Integer
DoCmd Hourglass True

'Turn off the automatic display rectangles
Me![LEAD1].Object.AutoSetRects = False

Select Case ClickCount
Case 0
  Me![LEAD1].Object.ColorSeparate COLORSEP_CMYK

  'Just for fun, add contrast to the K plane
  Me![LEAD1].Object.Bitmap = Me![LEAD1].Object.ColorPlanes(3) 'Copy the K plane
  Me![LEAD1].Object.Contrast 300 'Increase the contrast
  Me![LEAD1].Object.ColorPlanes(3) = Me![LEAD1].Object.Bitmap 'Update the K plane

  Msg = "Separated. Keep clicking to see separations, then merge"
  MsgBox Msg
Case 1
  Me![LEAD1].Object.Bitmap = Me![LEAD1].Object.ColorPlanes(0) 'Cyan
  Me![LEAD1].Object.ForceRepaint
Case 2
  Me![LEAD1].Object.Bitmap = Me![LEAD1].Object.ColorPlanes(1) ' Magenta
  Me![LEAD1].Object.ForceRepaint
Case 3
  Me![LEAD1].Object.Bitmap = Me![LEAD1].Object.ColorPlanes(2) ' Yellow
  Me![LEAD1].Object.ForceRepaint
Case 4
  Me![LEAD1].Object.Bitmap = Me![LEAD1].Object.ColorPlanes(3) ' K
  Me![LEAD1].Object.ForceRepaint
Case 5
  Me![LEAD1].Object.ColorMerge COLORSEP_CMYK
  Me![LEAD1].Object.ForceRepaint
  Me![LEAD1].Object.ColorPlanes(0) = 0
  Me![LEAD1].Object.ColorPlanes(1) = 0
  Me![LEAD1].Object.ColorPlanes(2) = 0
  Me![LEAD1].Object.ColorPlanes(3) = 0
  Msg = "Merged, with more contrast in the K plane"
  MsgBox Msg
Case Else
  ClickCount = -1
  Msg = "Cycle is finished"
  MsgBox Msg
End Select

ClickCount = ClickCount + 1
DoCmd Hourglass False

End Sub

5.	Run your program to test it. Notice that you can click the button several times to create the separations, view each of them, and merge them to recreate the original bitmap.


Updating a Gauge and Detecting a User Interrupt (Access 2.0)

Take the following steps to update a gauge during processing and detect a user interrupt:

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

2.	 Select the Command Button control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

3.	In the Properties box, change the Command Button control's Name property to Do Median.

4.	 Select the Command Button control; then add another control to your main form. Put the control at the top of the form to keep it away from the image.

5.	In the Properties box, change the Command Button control's Name property to Quit.

6.	Build a gauge consisting of a horizontal line [image] (Line1) inside a rectangle [image] (Box1). Put the gauge at the top of the form next to the Quit button.

7.	Add the following code to the general declarations:

Dim fEscape As Integer 'Use to indicate the user interrupt
Dim fInProc As Integer 'Use to avoid closing the form during processing

8.	Add the following code to the first Command Button control's Click procedure:

Sub Button16_Click ()
  'Enable the ProgressStatus event
  Me![LEAD1].Object.EnableProgressEvent = True

  'Initialize the indicators
  fEscape = False 'The user does not want to quit
  fInProc = True 'Processing is taking place

  'Perform a relatively slow median filter
  Me![LEAD1].Object.Median 4

  'Clean up
  fInProc = False 'Processing is no longer taking place
  Me![LEAD1].Object.ForceRepaint
End Sub

9.	Add the following code to the Lead1 control's ProgressStatus procedure:

Sub LEAD1_ProgressStatus (iPercent As Integer)
  DoEvents 'Detect Windows events
  If Not fEscape Then ' Look for the Click on the Quit button
    Me![Line1].Width = Me![Box1].Width * iPercent / 100 'Udpate the gauge
  Else
    Me![LEAD1].Object.EnableProgressEvent = False 'Cancel the task
  End If
End Sub

10.	Add the following code to the second Command Button control's Click procedure:

Sub Button17_Click ()
  fEscape = True 'The user wants to quit
  Me![Line1].Width = 0 'Set the gauge back to the beginning
End Sub

11.	Add the following code to the Form Unload procedure:

Sub Form_Unload (Cancel As Integer)
  If fInProc Then 'If processing is taking place
  Cancel = 1 'Do not let the user close the form
  End If
End Sub

12.	Run your program to test it.


Miscellaneous Examples (Access 2.0)

You can test any of the following examples by adding a command button to one of the previous lessons in the tutorial, and pasting the sample code in the Click procedure.

In most cases, you can add the button after the first lesson Loading and Displaying an Image. In cases where you need to zoom in or zoom out, you must first finish Zooming Out and Zooming In.

AboutBox example for Access 2.0

AddNoise example for Access 2.0

Animate Event Example for Access 2.0

AnimationEnable Example for Access 2.0

AnnAutoDrawEnable Example for Access 2.0

AnnAutomation Property Example for Access 2.0

AnnAutoMenuEnable Example for Access 2.0

AnnAutoRotate example for Access 2.0

AnnGetHyperlinkParam example for Access 2.0

AnnGetHyperlinkString example for Access 2.0

AnnGetHyperlinkType example for Access 2.0

AnnGetLocked example for Access 2.0

AnnGetSelectCount example for Access 2.0

AnnHyperlink example for Access 2.0

AnnHyperlinkMenu example for Access 2.0

AnnHyperlinkMenuEnable example for Access 2.0

AnnLock example for Access 2.0

AnnLocked example for Access 2.0

AnnMove example for Access 2.0

AnnRotate example for Access 2.0

AnnSaveTag example for Access 2.0

AnnSetAutoText Example for Access 2.0

AnnSetHyperlinkMsg example for Access 2.0

AnnSetHyperlinkString example for Access 2.0

AnnShowLockedIcon example for Access 2.0

AnnUnlock example for Access 2.0

AnnUnlocked example for Access 2.0

AnnUnrealize example for Access 2.0

AutoAnimate Example for Access 2.0

AutoSize Example for Access 2.0

AutoTrim example for Access 2.0

Average example for Access 2.0

BackColor example for Access 2.0

BackErase example for Access 2.0

BinaryFilter example for Access 2.0

BitmapAlpha example for Access 2.0

BitmapXres and BitmapYres example for Access 2.0

BitonalScaling example for Access 2.0

BorderStyle example for Access 2.0

Capture example for Access 2.0

Change example for Access 2.0

ColorRes example for Access 2.0

ColorResList Example for Access 2.0

Combine example for Access 2.0

Comment example for Access 2.0

Contrast example for Access 2.0

CreateBitmap, Size, and Combine example for Access 2.0

DblClick example for Access 2.0

DDB example for Access 2.0

DeleteBitmapListItems example for Access 2.0

Deskew example for Access 2.0

Despeckle example for Access 2.0

DIB example for Access 2.0

DrawShape example for Access 2.0

Dst... example for Access 2.0

Emboss example for Access 2.0

EnableMethodErrors example for Access 2.0

EnableZoomInRect example for Access 2.0

FastRotate example for Access 2.0

FilePage Event Example for Access 2.0

Fill example for Access 2.0

Flip example for Access 2.0

FloaterDstClip... example for Access 2.0

Font example for Access 2.0

Frame... example for Access 2.0

GammaCorrect example for Access 2.0

GetBitmapDC example for Access 2.0

GetColorCount Example for Access 2.0

GetFileInfo example for Access 2.0

GetFloaterHandle example for Access 2.0

GetHistogram example for Access 2.0

GetMinMaxBits example for Access 2.0

GetMinMaxVal example for Access 2.0

GetRgnHandle example for Access 2.0

Grayscale example for Access 2.0

Halftone example for Access 2.0

HistoContrast example for Access 2.0

HistoEqualize example for Access 2.0

Hue example for Access 2.0

IgnoreFilters example for Access 2.0

InsertBitmapListItem Example for Access 2.0

Intensity example for Access 2.0

IntensityDetect example for Access 2.0

Invert example for Access 2.0

KeyPress example for Access 2.0

LevelHighBit example for Access 2.0

LevelLowBit example for Access 2.0

LevelLUT example for Access 2.0

LevelLUTLength example for Access 2.0

LoadInfo... example for Access 2.0

LoadUseViewPerspective example for Access 2.0

MaxFilter example for Access 2.0

Median example for Access 2.0

MinFilter example for Access 2.0

Mosaic example for Access 2.0

Oilify example for Access 2.0

OLEDropAllowed example for Access 2.0

Paint event example for Access 2.0

PaintContrast example for Access 2.0

PaintDither example for Access 2.0

PaintEffect example for Access 2.0

PaintGamma example for Access 2.0

PaintIntensity example for Access 2.0

PaintMaxPasses example for Access 2.0

PaintPalette example for Access 2.0

PaintROP3 example for Access 2.0

PaintSizeMode Example for Access 2.0

PaintSizeUseDPI example for Access 2.0

PaintWhileLoad example for Access 2.0

PaintZoomFactor Example for Access 2.0

PatternStyle example for Access 2.0

Pixel example for Access 2.0

Posterize example for Access 2.0

PreLoadFilters Example for Access 2.0

ProgressivePasses Example for Access 2.0

Render example for Access 2.0

Resize event example for Access 2.0

RgnChange example for Access 2.0

Rotate example for Access 2.0

Saturation example for Access 2.0

Save example for Access 2.0

SaveInterlaced example for Access 2.0

SaveWithStamp example for Access 2.0

Scroll event example for Access 2.0

SetRgn... example for Access 2.0

SetSrcClipRect example for Access 2.0

SetSrcRect example for Access 2.0

ShadowColor example for Access 2.0

Sharpen example for Access 2.0

Shear example for Access 2.0

Solarize example for Access 2.0

SpatialFilter example for Access 2.0

Src... example for Access 2.0

StretchIntensity example for Access 2.0

TransitionEffect example for Access 2.0

TransparentColor example for Access 2.0

Trim example for Access 2.0

Underlay example for Access 2.0

UserPalette and BitmapPalette example for Access 2.0

Version... example for Access 2.0

WindowLevel example for Access 2.0

ZoomIn example for Access 2.0

ZoomIn example for Access 2.0


AboutBox example for Access 2.0

This example displays the LEADTOOLS ActiveX information.

Me![LEAD1].Object.AboutBox


AddNoise example for Access 2.0

This example adds red noise and redisplays the bitmap.

Me![LEAD1].Object.AddNoise 500, CHANNEL_RED
Me![LEAD1].Object.ForceRepaint


Animate Event Example for Access 2.0

This example shows how the Animate event can be used to toggle the use of a button to start and stop the animation.

Sub Lead1_Animate (bEnable As Integer)
  If bEnable = True Then
    Button1.Caption = "Stop Animation"
  Else
    Button1.Caption = "Start Animation"
  End If
End Sub

Sub Button1_Click()
   If Me![LEAD1].Object.AnimationEnable = True Then
     Me![LEAD1].Object.AnimationEnable = False
   Else
     Me![LEAD1].Object.AnimationEnable = True
   End If
End Sub


AnimationEnable Example for Access 2.0

This example loads and plays an animated file. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

' Load all pages of an AVI file.
Me![LEAD1].Object.Load "c:\windows\system\wndsurf1.avi", 0, 1, -1

' Set properties for a scaled animation.
Me![LEAD1].Object.AutoRepaint = True
Me![LEAD1].Object.AutoSetRects = False

' Set the image display size to match the LEAD control.
Me![LEAD1].Object.SetDstRect 0, 0, Me![LEAD1].Object.ScaleWidth, Me![LEAD1].Object.ScaleHeight
Me![LEAD1].Object.SetDstClipRect 0, 0, Me![LEAD1].Object.ScaleWidth, Me![LEAD1].Object.ScaleHeight

' Allow a continuous loop.
Me![LEAD1].Object.AnimationLoop = True

' Start the animation.
Me![LEAD1].Object.AnimationEnable = True


AnnAutoDrawEnable Example for Access 2.0

Note: This topic is for Document/Medical only.

This example toggles the AnnAutoDrawEnable property.

If (Me![LEAD1].Object.AnnAutoDrawEnable = True) Then
   Me![LEAD1].Object.AnnAutoDrawEnable = False
Else
   Me![LEAD1].Object.AnnAutoDrawEnable = True
End If


AnnAutomation Property Example for Access 2.0

Note: This topic is for Document/Medical only.

This example shows how you can use the AnnAutomation property to access the automation object through DLL functions.

Dim IsBold As Integer ' Is the object's text bold
Dim hAnnObject As Long

hAnnObject = Me![LEAD1].Object.AnnAutomation

' Set the default font to bold, unless it already is
myReturn = L_AnnGetFontBold(hAnnObject, IsBold)

If IsBold <> 0 Then
    MsgBox "Already bold", 0, "Notice"
Else
    myReturn = L_AnnSetFontBold(hAnnObject, True, 0)
End If


AnnAutoMenuEnable Example for Access 2.0

Note: This topic is for Document/Medical only.

This example toggles the AnnAutoMenuEnable property.

If (Me![LEAD1].Object.AnnAutoMenuEnable = True) Then
   Me![LEAD1].Object.AnnAutoMenuEnable = False
Else
   Me![LEAD1].Object.AnnAutoMenuEnable = True
End If


AnnAutoRotate example for Access 2.0

Note: This topic is for Document/Medical only.

This example enables automatic rotation of annotations, then rotates the bitmap 2222 hundredths of degrees to demonstrate the automation:

Me![LEAD1].Object.AnnAutoRotate = True
Me![LEAD1].Object.Rotate 2222, ROTATE_RESIZE, RGB(0, 0, 255)


AnnGetSelectCount example for Access 2.0

Note: This topic is for Document/Medical only.

This example gets the number of selected annotation objects.

'Declare A local variable.
Dim SelectCount As Integer

'Get the number of selected objects and display a message box.
SelectCount = Me![LEAD1].Object.AnnGetSelectCount()
MsgBox Str$(SelectCount) + " objects selected"


AnnHyperlinkMenuEnable example for Access 2.0

Note: This topic is for Document/Medical only.

This example toggles the AnnHyperlinkMenuEnable property .

    'turn off the AnnHyperLinkMenu menu item

    Me![LEAD1].Object.AnnHyperlinkMenuEnable = False


AnnLock example for Access 2.0

Note: This topic is for Document/Medical only.

This message applies to :AnnLock method, AnnUnlock method, AnnGetLocked method, AnnLocked event, AnnUnlocked event, AnnSetHyperlinkString method, AnnGetHyperlinkString method, AnnSetHyperlinkMsg method, AnnHyperlinkMenu event, AnnHyperlink event, AnnGetHyperlinkType method and AnnGetHyperlinkParam method.

No OLE_HANDLE Support for Access 2.0

Access 2.0 does not handle recognize the OLE_HANDLE data type. To take advantage of these events and methods that use that data type, you must upgrade to Access 95 or 97.


AnnMove example for Access 2.0

Note: This topic is for Document/Medical only.

This example moves one or more selected annotation objects.

'Declare local variables.
Dim DeltaX, DeltaY

'Use twips.
Me![LEAD1].Object.ScaleMode = 1

'Specify arbitrary delta values.
DeltaX = +2000
DeltaY = -2000

'Move the selected annotations.
Me![LEAD1].Object.AnnMove DeltaX, DeltaY, True


AnnRotate example for Access 2.0

Note: This topic is for Document/Medical only.

This example uses the AnnFlip, AnnReverse, and AnnRotate methods. To code this example, add a command button named Test to the example you created in Loading and Displaying an Image. For best results when you run the example, draw two objects in opposite corners, and use the right mouse button to select all annotation objects. The command button then lets you cycle through the AnnFlip, AnnReverse, and AnnRotate methods.

Sub Test_Click()
Dim MyCaption As String
MyCaption = Test.Caption
Select Case MyCaption
Case "Flip"
    'Flip using the center of the bitmap as the axis.
    Me![LEAD1].Object.AnnFlip True, Me![LEAD1].Object.BitmapHeight / 2, True
    Test.Caption = "Reverse"
Case "Reverse"
    'Reverse using the center of the bitmap as the axis.
    Me![LEAD1].Object.AnnReverse True, Me![LEAD1].Object.BitmapWidth / 2, True
    Test.Caption = "Rotate"
Case "Rotate"
    'Rotate 90 degrees using the center of the bitmap as the axis.
    Me![LEAD1].Object.AnnRotate True, Me![LEAD1].Object.BitmapWidth / 2, Me![LEAD1].Object.BitmapHeight / 2, 90, True
    Test.Caption = "Flip"
Case Else
    Test.Caption = "Flip"
    Me![LEAD1].Object.AnnUserMode = ANNUSERMODE_DESIGN
    Me![LEAD1].Object.AnnTool = ANNTOOL_REDACT
    MsgBox "Draw two objects, use the right mouse button to select all, then click the command button"
End Select

End Sub


AnnSaveTag Example for Access 2.0

Note: This topic is for Document/Medical only.

The following example saves selected objects as a Wang compatible TIFF tag.

'Save only selected objects in Wang TIFF tag
    Me![LEAD1].Object.AnnSaveTag True, True

    Me![LEAD1].Object.Save "d:\temp\testwang.tif", FILE_CCITT_GROUP4, 1, 2, SAVE_OVERWRITE


AnnSetAutoText Example for Access 2.0

This example modifies the text string that is used for the undo option on the annotation pop-up menu.

Dim TestText As String
TestText = Me![LEAD1].Object.AnnGetAutoText (ANNAUTOTEXT_MENU_UNDO)
TestText = TestText + " - New"
Me![LEAD1].Object.AnnSetAutoText ANNAUTOTEXT_MENU_UNDO, TestText


AnnShowLockedIcon Example for Access 2.0

Note: This topic is for Document/Medical only.

This example toggles the AnnShowLockedIcon property.

'Toggle AnnShowLockedIcon
    If Me![LEAD1].Object.AnnShowLockedIcon = True Then
        Me![LEAD1].Object.AnnShowLockedIcon = False

    Else
        Me![LEAD1].Object.AnnShowLockedIcon = True
    End If


AnnUnrealize Example for Access 2.0

Note: This topic is for Document/Medical only.

The following example calls the AnnUnrealize method.

    'Unrealize all redact objects in the container

    Me![LEAD1].Object.AnnUnrealize Me![LEAD1].Object.AnnContainer, False


AutoAnimate Example for Access 2.0

This example gets information about an animated file, uses the information to position the LEAD control, and plays the animation as it loads the file.

' Force continued looping after the file loads.
Me![LEAD1].Object.AutoAnimationLoop = AUTOANIMATIONLOOP_INFINITE

' Set other properties for animation.
Me![LEAD1].Object.AutoSetRects = True
Me![LEAD1].Object.AutoRepaint = True

' Get information about the file we will load.
Me![LEAD1].Object.GetFileInfo "c:\windows\system\wndsurf1.avi", 0, 0

' Exit if this is not an animated file.
If Me![LEAD1].Object.InfoAnimation = False Then
   MsgBox "Not an animated file", 0, "Error"
Else
  Me![LEAD1].Object.AutoAnimate = True

' Load the animated file.
  Me![LEAD1].Object.Load "c:\windows\system\wndsurf1.avi", 0, 0, -1
End If


AutoSize Example for Access 2.0

This example shows how the AutoSize property works when loading and when rotating an image. Note that in Access 2.0, this changes the display rectangles but does not resize the control.

Me![LEAD1].Object.AutoSize = True
Me![LEAD1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1
MsgBox "Control is sized to fit the loaded bitmap"
Me![LEAD1].Object.Rotate 4500, ROTATE_RESIZE, RGB(0, 0, 0)
MsgBox "Control is sized to fit the rotated bitmap"


AutoTrim example for Access 2.0

This example trims the bitmap with threshold of 10.

Me![LEAD1].Object.AutoTrim 10
Me![LEAD1].Object.ForceRepaint


Average example for Access 2.0

This example applies an average filter with a 3x3 neighborhood and redisplays the bitmap.

Me![LEAD1].Object.Average 3
Me![LEAD1].Object.ForceRepaint


BackColor example for Access 2.0

This example sets the background color to red. You can zoom out to see the background color.

Me![LEAD1].Object.BackColor = RGB(255,0,0)


BackErase example for Access 2.0

This example turns off repainting of the background, then zooms out to show the effect when repainting.

Me![Lead1].Object.BackErase = False
Me![Lead1].Object.AutoRepaint = False
Me![Lead1].Object.AutoScroll = False

'Calculate the values to zoom out by 10 percent and center the image.
Me![Lead1].Object.DstWidth = Me![Lead1].Object.DstWidth * 0.9
Me![Lead1].Object.DstHeight = Me![Lead1].Object.DstHeight * 0.9
Me![Lead1].Object.DstTop = (Me![Lead1].Object.ScaleHeight - Me![Lead1].Object.DstHeight) / 2
Me![Lead1].Object.DstLeft = (Me![Lead1].Object.ScaleWidth - Me![Lead1].Object.DstWidth) / 2

'Set the clipping area to the same as the destination rectangle
Me![Lead1].Object.DstClipWidth = Me![Lead1].Object.DstWidth
Me![Lead1].Object.DstClipHeight = Me![Lead1].Object.DstHeight
Me![Lead1].Object.DstClipTop = Me![Lead1].Object.DstTop
Me![Lead1].Object.DstClipLeft = Me![Lead1].Object.DstLeft

'Redisplay the image
Me![Lead1].Object.ForceRepaint


BinaryFilter example for Access 2.0

This example does omni-directional erosion of black objects and repaints the image.

DoCmd Hourglass True
Me![LEAD1].Object.BinaryFilter BFLT_EROSION_OMNI
Me![LEAD1].Object.ForceRepaint
DoCmd Hourglass False


BitmapAlpha example for Access 2.0

This example shows how to use the BitmapAlpha property to save a region in a file's alpha channel. It also shows how to use the region as a mask for transparency.

Dim rgntop As Single
Dim rgnleft As Single
Dim rgnwidth As Single
Dim rgnheight As Single
Dim hRGN As Long

Me![LEAD1].Object.ScaleMode = 3
Me![LEAD1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1
Me![LEAD1].Object.AutoRepaint = False

'Get an alpha channel bitmap, and fill it with white
Me![LEAD2].Object.Bitmap = Me![LEAD1].Object.BitmapAlpha
Me![LEAD2].Object.Fill RGB(255, 255, 255)

rgntop = 0
rgnleft = 0
rgnwidth = Me![LEAD1].Object.BitmapWidth
rgnheight = Me![LEAD1].Object.BitmapHeight

'Create an elliptical region in the AlphaBitmap
Me![LEAD2].Object.SetRgnEllipse rgntop, rgnleft, rgnwidth, rgnheight, L_RGN_SET

'Fill the region with black
Me![LEAD2].Object.Fill RGB(0, 0, 0)

'Free the region
Me![LEAD2].Object.FreeRgn

'Update the alpha channel in the main bitmap
Me![LEAD1].Object.BitmapAlpha = Me![LEAD2].Object.Bitmap

'Save the bitmap as 32-bit TGA
Me![LEAD1].Object.Save "test.tga", FILE_TGA, 32, 0, SAVE_OVERWRITE

'Free the bitmaps
Me![LEAD1].Object.Bitmap = 0
Me![LEAD2].Object.Bitmap = 0

'Load the bitmap we just saved and get the alpha channel
Me![LEAD1].Object.Load "test.tga", 0, 0, 1
Me![LEAD2].Object.Bitmap = Me![LEAD1].Object.BitmapAlpha

'Create a region in the AlphaBitmap that includes all of the black pixels
Me![LEAD2].Object.SetRgnColor RGB(0, 0, 0), L_RGN_SET

'Get the region from the AlphaBitmap and set it into the main bitmap
hRGN = Me![LEAD2].Object.GetRgnHandle
Me![LEAD1].Object.SetRgnHandle hRGN, 0, 0, L_RGN_SET

Me![LEAD1].Object.PaintRgnOnly = True
Me![LEAD1].Object.ForceRepaint


BitmapXres and BitmapYres example for Access 2.0

This example sets the bitmap's resolution to 300 x 600 DPI.

Me![LEAD1].Object.BitmapXres = 300
Me![LEAD1].Object.BitmapYres = 600


BitonalScaling example for Access 2.0

This example sets the display to use scale-to-gray and repaints the image. This affects only 1-bit images.

If Me![LEAD1].Object.IsSupportLocked(L_SUPPORT_DOCUMENT) Then
   MsgBox "No scale to gray - You need to unlock Document/Medical capabilities"
Else
   Me![LEAD1].Object.BitonalScaling = BITONALSCALING_SCALETOGRAY
   Me![LEAD1].Object.ForceRepaint
End If


BorderStyle example for Access 2.0

This example toggles the border style and repaints the image.

If Me![LEAD1].Object.BorderStyle = 1 Then
   Me![LEAD1].Object.BorderStyle = 0
Else
   Me![LEAD1].Object.BorderStyle = 1
End If
Me![LEAD1].Object.ForceRepaint


Capture example for Access 2.0

This example captures the current screen and displays the captured image with scroll bars.

'Turn on the automatic display rectangles.
Me![LEAD1].Object.AutoSetRects = True

'Set the scale mode to twips temporarily
OldMode = Me![LEAD1].Object.ScaleMode
Me![LEAD1].Object.ScaleMode = 1

CaptureLeft = 0
CaptureTop = 0
CaptureWidth = Me.WindowWidth
CaptureHeight = Me.WindowHeight
Me![LEAD1].Object.Capture 0, CaptureLeft, CaptureTop, CaptureWidth, CaptureHeight
Me![LEAD1].Object.AutoScroll = True
Me![LEAD1].Object.ForceRepaint

'Set the scale mode to the previous mode
Me![LEAD1].Object.ScaleMode = OldMode


Change example for Access 2.0

Typically, you would use this event to flag changed image data and prompt the user to save the changes before closing a window or exiting an application.  That use of the event cannot be tested properly without writing a complete application; so this example just shows you a simple test of the event.

Sub Lead1_Change ()
    MsgBox "Image data changed"
End Sub


ColorRes example for Access 2.0

This example checks to see if the bitmap is 8 bits per pixel and converts it if it is not.

If Me![LEAD1].Object.BitmapBits <> 8 Then
    DoCmd Hourglass True
    Me![LEAD1].Object.ColorRes 8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0
    DoCmd Hourglass False
    Me![LEAD1].Object.ForceRepaint
End If


ColorResList Example for Access 2.0

This example changes the hue of bitmaps in a list, then plays the list as an animation. When changing the hue, it preserves the transparent color.

Dim i As Integer  ' Loop counter
Dim uCount As Integer ' Number of bitmaps in the list
Dim TransparentColor As Long ' Color used for transparency

' Save the current transparent color.
TransparentColor = Me![LEAD1].Object.BitmapTransparentColor

' Avoid repaints while we modify the bitmaps.
Me![LEAD1].Object.AutoRepaint = False

' Change the hue of each bitmap in the list,
' and restore the transparent color as the last color in the palette.
uCount = Me![LEAD1].Object.BitmapListCount
For i = 0 To uCount - 1
   Me![LEAD1].Object.BitmapListIndex = i
   Me![LEAD1].Object.Hue i * 10
   Me![LEAD1].Object.BitmapPalette(255) = TransparentColor
Next i

' Get an optimized palette for the whole list.
Me![LEAD1].Object.ColorResList 8, CRP_OPTIMIZEDPALETTE, CRD_NODITHERING, 0

' Update the palette that is used for playback.
For i = 0 To 255
   Me![LEAD1].Object.AnimationPalette(i) = Me![LEAD1].Object.BitmapPalette(i)
Next i

' Start the animation.
Me![LEAD1].Object.AutoRepaint = True
Me![LEAD1].Object.AnimationEnable = True


Combine example for Access 2.0

This example copies the Lead1 bitmap to Lead2, trims and filters the copied image, and combines the filtered image with the original Lead1 bitmap image. Trimming Lead2 lets you see the difference between filtered and nonfiltered regions.

DoCmd Hourglass True
Me![LEAD2].Object.Bitmap = Me![LEAD1].Object.Bitmap

TrimLeft = (Me![LEAD2].Object.BitmapWidth * 0.2)
TrimTop = (Me![LEAD2].Object.BitmapHeight * 0.2)
TrimWidth = (Me![LEAD2].Object.BitmapWidth * 0.6)
TrimHeight = (Me![LEAD2].Object.BitmapHeight * 0.6)
Me![LEAD2].Object.Trim TrimLeft, TrimTop, TrimWidth, TrimHeight

Me![LEAD2].Object.SpatialFilter (FLT_LINESEG_LTOR)

DstLeft = TrimLeft
DstTop = TrimTop
DstWidth = TrimWidth
DstHeight = TrimHeight
SrcObj = Me![LEAD2].Object.Bitmap
SrcLeft = 0
SrcTop = 0
Me![LEAD1].Object.Combine DstLeft, DstTop, DstWidth, DstHeight, SrcObj, SrcLeft, SrcTop, CB_OP_ADD

Me![LEAD1].Object.ForceRepaint
DoCmd Hourglass False


Comment example for Access 2.0

This example does the following:

1.	Loads an image from a TIFF file.

2.	Updates and modifies one of the comments.

3.	Modifies and saves the file.

4.	Reads the comment that was saved, and displays it in a message box.

Note: Access 2.0 produces an untrappable error if you try to read a comment that does not exist in a file. This problem does not occur with later versions of Access.

Dim MyCommentText As String     'For the comment string that we add
Dim NewCommentText As String    'For the CMNT_SZDESC comment that we read
Dim TmpVariant As Variant       'For holding the current CMNT_SZDESC comment
Dim FilePath As String          'File to be updated

'Specify the file that we will update.
FilePath = "c:\lead\images\testcmt.tif"

'Clear the current CMNT_SZDESC comment.
Me![Lead1].Object.Comment(CMNT_SZDESC) = Empty

'Load and modify the image.
Me![Lead1].Object.Load FilePath, 0, 0, 1
Me![Lead1].Object.Reverse

'Update the CMNT_SZDESC comment.
TmpVariant = Me![Lead1].Object.ReadComment(FilePath, 0, CMNT_SZDESC)
MyCommentText = Chr(13) + "This image has been reversed."
Me![Lead1].Object.Comment(CMNT_SZDESC) = TmpVariant + MyCommentText

'Save the file.
Me![Lead1].Object.Save FilePath, FILE_TIF, Me![Lead1].Object.BitmapBits, 0, SAVE_OVERWRITE

'Read the comment that we saved.
NewCommentText = Me![Lead1].Object.ReadComment(FilePath, 0, CMNT_SZDESC)

'Display the message
MsgBox NewCommentText

'Clear the comment from memory
Me![Lead1].Object.Comment(CMNT_SZDESC) = Empty


Contrast example for Access 2.0

This example increases the contrast and repaints the image.

Me![LEAD1].Object.Contrast 50
Me![LEAD1].Object.ForceRepaint


CreateBitmap, Size, and Combine example for Access 2.0

This example creates a bitmap for Lead2 (same size and BPS as Lead1) and fills it with green. It resizes the Lead1 bitmap, then uses a loop to do multiple combines with the Lead2 bitmap. It then copies the Lead2 bitmap to Lead1 and redisplays Lead1.

DoCmd Hourglass True

' Create the Lead2 bitmap. (The control must already be on the form).
MyWidth = Me![LEAD1].Object.BitmapWidth
MyHeight = Me![LEAD1].Object.BitmapHeight
MyBPS = Me![LEAD1].Object.BitmapBits
Me![LEAD2].Object.CreateBitmap MyWidth, MyHeight, MyBPS
Me![LEAD2].Object.Fill RGB(0, 255, 0) ' fill with green

' Resize the Lead1 bitmap
ImageWidth = CInt(MyWidth * 0.3)
ImageHeight = CInt(MyHeight * 0.3)
Me![LEAD1].Object.Size ImageWidth, ImageHeight, RESIZE_RESAMPLE

' Initialize the variables used for multiple combines.
TestWidth = MyWidth ' Used for horizontal positioning
TestHeight = MyHeight ' Used for vertical positioning

VFactor = Int(MyHeight / ImageHeight) + 1 ' Number spaces between images
VSpacing = CInt((MyHeight Mod ImageHeight) / VFactor) ' Pixels between images

HFactor = Int(MyWidth / ImageWidth) + 1 ' Number spaces between images
HSpacing = CInt((MyWidth Mod ImageWidth) / HFactor) ' Pixels between images

DstT = VSpacing ' Top coordinate of the destination rectangle
SrcL = 0 ' Left coordinate of the source rectangle
SrcT = 0 ' Top coordinate of the source rectangle
SrcObj = Me![LEAD1].Object.Bitmap
DstW = ImageWidth  ' Width of the destination rectangle
DstH = ImageHeight ' Height of the destination rectangle
MyOp = CB_OP_ADD + CB_DST_0 ' Operation flags used when combining images

' Do the loop that does the multiple combines
While TestHeight > ImageHeight ' Vertical loop
    DstT = MyHeight - TestHeight + VSpacing
    TestHeight = TestHeight - ImageHeight - VSpacing
    While TestWidth > ImageWidth 'Horizontal loop
        DstL = MyWidth - TestWidth + HSpacing
        TestWidth = TestWidth - ImageWidth - HSpacing
        Me![LEAD2].Object.Combine DstL, DstT, DstW, DstH, SrcObj, SrcL, SrcT, MyOp
    Wend
    TestWidth = MyWidth
Wend

' Copy the Lead2 bitmap to Lead1
Me![LEAD1].Object.Bitmap = Me![LEAD2].Object.Bitmap

'Get the pixel dimensions of the LEAD control's client area.
ViewWidth  = Me![LEAD1].Object.ScaleWidth
ViewHeight = Me![LEAD1].Object.ScaleHeight

'Set the image display size to match the LEAD control
Me![LEAD1].Object.SetDstRect 0, 0, ViewWidth, ViewHeight
Me![LEAD1].Object.SetDstClipRect 0, 0, ViewWidth, ViewHeight
Me![LEAD1].Object.ForceRepaint ' Repaint the image
DoCmd Hourglass False


DblClick example for Access 2.0

This example demonstrates the DblClick event.

Sub Lead1_DblClick ()
    Me![LEAD1].Object.Flip ' Flip the image
    Me![LEAD1].Object.ForceRepaint ' Repaint the image
End Sub


DDB example for Access 2.0

This example copies the Lead1 bitmap to the clipboard as a DDB. It pastes the DDB into Lead2 and reverses the image. It then gets a DDB from Lead2, sets the same DDB to Lead1, and repaints. Note that both Lead1 and Lead2 must be visible for this example to work.

DoCmd Hourglass True
MyFlags = COPY_EMPTY + COPY_DDB + COPY_PALETTE
Me![LEAD1].Object.Copy MyFlags
Me![LEAD2].Object.Paste 0
Me![LEAD2].Object.Reverse
MyDC = Me![LEAD2].Object.GetClientDC
MyDDB = Me![LEAD2].Object.GetDDB(MyDC)
MyPalette = Me![LEAD2].Object.GetPalette(MyDC)
Me![LEAD1].Object.SetDDB MyDC, MyDDB, MyPalette
Me![LEAD1].Object.ForceRepaint
Me![LEAD2].Object.ReleaseClientDC
DoCmd Hourglass False


DeleteBitmapListItems example for Access 2.0

This example deletes the first five bitmaps from the control's bitmap list. Then, it plays the animation to show that the bitmaps are missing.

'Delete the first five bitmaps.
Me![LEAD1].Object.DeleteBitmapListItems 0, 5

'Play the animation without looping.
Me![LEAD1].Object.AnimationLoop = False
Me![LEAD1].Object.AnimationEnable = True


Deskew example for Access 2.0

This example automatically straightens the bitmap and repaints the image. The image to be straightened should be mainly text.

Me![LEAD1].Object.Deskew
Me![LEAD1].Object.ForceRepaint


Despeckle example for Access 2.0

This example automatically removes specks from the bitmap and repaints the image. Use this on a 1-bit bitmap such as a scanned document.

Me![LEAD1].Object.Despeckle
Me![LEAD1].Object.ForceRepaint


DIB example for Access 2.0

This example copies the Lead1 bitmap to the clipboard as a DIB. It pastes the DIB into Lead2 and reverses the image. It then gets a DIB from Lead2, sets the same DIB to Lead1, and repaints.

DoCmd Hourglass True
MyFlags = COPY_EMPTY + COPY_DIB + COPY_PALETTE
Me![LEAD1].Object.Copy MyFlags
Me![LEAD2].Object.Paste 0
Me![LEAD2].Object.Reverse
MyDib = Me![LEAD2].Object.GetDIB
Me![LEAD1].Object.SetDIB MyDib
Me![LEAD1].Object.ForceRepaint
DoCmd Hourglass False


DrawShape example for Access 2.0

This example demonstrates most of the three-dimensional shape properties as it draws a rectangle on the current bitmap. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

Me![LEAD1].Object.AutoRepaint = False

'Load an image for the main control.
Me![LEAD1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1

'Shape background
Me![LEAD1].Object.ShapeBackgroundStyle = EFX_BACKSTYLE_TRANSPARENT

'Shape location
Me![LEAD1].Object.ShapeTop = 50
Me![LEAD1].Object.ShapeLeft = 50
Me![LEAD1].Object.ShapeWidth = Me![LEAD1].Object.DstWidth - 50
Me![LEAD1].Object.ShapeHeight = Me![LEAD1].Object.DstHeight - 50

'Shape border
Me![LEAD1].Object.ShapeBorderColor = RGB(255, 0, 0)
Me![LEAD1].Object.ShapeBorderStyle = EFX_BORDERSTYLE_SOLID
Me![LEAD1].Object.ShapeBorderThickness = 10

Me![LEAD1].Object.ShapeInnerBandHiliteColor = RGB(255, 255, 255)
Me![LEAD1].Object.ShapeInnerBandShadowColor = 0
Me![LEAD1].Object.ShapeInnerBandStyle = EFX_INNERSTYLE_RAISED
Me![LEAD1].Object.ShapeInnerBandThickness = 2

Me![LEAD1].Object.ShapeOuterBandHiliteColor = RGB(0, 255, 0)
Me![LEAD1].Object.ShapeOuterBandShadowColor = RGB(128, 128, 128)
Me![LEAD1].Object.ShapeOuterBandStyle = EFX_OUTERSTYLE_RAISED
Me![LEAD1].Object.ShapeOuterBandThickness = 2

'Make the shape a permanent part of the bitmap.
Me![LEAD1].Object.DrawPersistence = True

Me![LEAD1].Object.PatternStyle = EFX_PATTERN_TRANSPARENT

'Draw the shape.
Me![LEAD1].Object.DrawShape EFX_SHAPE_RECTANGLE, 0

'Repaint.
Me![LEAD1].Object.ForceRepaint


Dst... example for Access 2.0

This example uses the destination rectangle properties to zoom in on an image.

' Set variables for the client area of the control.
ClHeight = Me![LEAD1].Object.ScaleHeight
ClWidth = Me![LEAD1]. Object.ScaleWidth

'Calculate the values to zoom in by 10 percent and center the image.
Me![LEAD1].Object.DstWidth = Me![LEAD1].Object.DstWidth * 1.1
Me![LEAD1].Object.DstHeight = Me![LEAD1].Object.DstHeight * 1.1
Me![LEAD1].Object.DstTop = (ClHeight - Me![LEAD1].Object.DstHeight) / 2
Me![LEAD1].Object.DstLeft = (ClWidth - Me![LEAD1].Object.DstWidth) / 2

'Set the clipping area to the same as the destination rectangle
Me![LEAD1].Object.DstClipWidth = Me![LEAD1].Object.DstWidth
Me![LEAD1].Object.DstClipHeight = Me![LEAD1].Object.DstHeight
Me![LEAD1].Object.DstClipTop = Me![LEAD1].Object.DstTop
Me![LEAD1].Object.DstClipLeft = Me![LEAD1].Object.DstLeft

'Redisplay the image
Me![LEAD1].Object.ForceRepaint


Emboss example for Access 2.0

This example applies an emboss effect and repaints the image.

Me![LEAD1].Object.Emboss EMBOSS_NE, 500
Me![LEAD1].Object.ForceRepaint


EnableMethodErrors example for Access 2.0

This example disables method errors temporarily so that it can give the user guidance about a particular error (an out-of-range shear angle in this case).

ShearAngle = 9000 ' This would be the user's input * 100
Me![LEAD1].Object.EnableMethodErrors = False

nRet = Me![LEAD1].Object.Shear(ShearAngle, TRUE, RGB(0,0,255))
If nRet = 20013 Then
   cMsg = "The angle cannot be more than 45 degrees"
   answer = MsgBox(cMsg, 0, "Error")
Else
   Me![LEAD1].Object.ForceRepaint
EndIf

Me![LEAD1].Object.EnableMethodErrors = True


EnableZoomInRect example for Access 2.0

Note: This topic is for Document/Medical only.

This example toggles the EnableZoomInRect property.:

           ' Toggle the ZoomInRect setting
           If Me![LEAD1].Object.EnableZoomInRect = True Then
               Me![LEAD1].Object.EnableZoomInRect = False
           Else
               Me![LEAD1].Object.EnableZoomInRect = True


FastRotate example for Access 2.0

Note: This topic is for Document/Medical only.

This example uses fast rotation to rotate an image 90 degrees:

Me![LEAD1].Object.FastRotate 90


FilePage Event Example for Access 2.0

This example shows how the FilePage event can be used to size and position a lead control when an image is loaded.

Sub Lead1_FilePage ()
   Dim HeightFactor, WidthFactor  ' Factors for aspect ratio
   Dim HeightAllowed, WidthAllowed  ' Maximum width and height

   ' Set the variables used for preserving the aspect ratio.
   'Allow for a border of 1/8 of the form size.
   'The units of measure do not matter, since we are calculating proportions.
   HeightFactor = Me![LEAD1].Object.InfoHeight
   WidthFactor = Me![LEAD1].Object.InfoWidth
   HeightAllowed = Me.WindowHeight * 3 / 4
   WidthAllowed = Me.WindowWidth * 3 / 4

   'Center the LEAD control on the form, preserving the aspect ratio.
   'Check to see if using the maximum width will make the image too tall.
   'Set the dimensions based on the result.
   If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
     Me![LEAD1].Left = Me.WindowWidth / 8
     Me![LEAD1].Width = WidthAllowed
     Me![LEAD1].Height = (Me![LEAD1].Width * HeightFactor) / WidthFactor
     Me![LEAD1].Top = (Me.WindowHeight - Me![LEAD1].Height) / 2
   Else
     Me![LEAD1].Top = Me.WindowHeight / 8
     Me![LEAD1].Height = HeightAllowed
     Me![LEAD1].Width = (Me![LEAD1].Height * WidthFactor) / HeightFactor
     Me![LEAD1].Left = (Me.WindowWidth - Me![LEAD1].Width) / 2
   End If

   ' Set the image display size to match the LEAD control.
   Me![LEAD1].Object.AutoScroll = False
   Me![LEAD1].Object.AutoRepaint = True
   Me![LEAD1].Object.AutoSetRects = True
   Me![LEAD1].Object. PaintSizeMode = PAINTSIZEMODE_FIT

End Sub


Fill example for Access 2.0

This example fills the bitmap with blue and repaints the image.

Me![LEAD1].Object.Fill RGB(0, 0, 255)
Me![LEAD1].Object.ForceRepaint


Flip example for Access 2.0

This example flips the bitmap and repaints the image.

Me![LEAD1].Object.Flip
Me![LEAD1].Object.ForceRepaint


FloaterDstClip... example for Access 2.0

The following code adjusts the destination clipping rectangle of the floater. You can test it by adding it to a new command button for the lesson described in Outlining, Dragging, and Pasting a Region. By default, the destination clipping rectangle for the floater is the full client area. This code gets the current values and uses them to reduce the size of the clipping rectangle.

'Declare local variables.
Dim AdjustX, AdjustY, NewLeft, NewTop, NewWidth, NewHeight

'Set variables to use for adjustment increments.
AdjustX = Me![LEAD1].Object.ScaleWidth / 20
AdjustY = Me![LEAD1].Object.ScaleHeight / 20

'Determine new values, based on adjustments of current values.
NewLeft = Me![LEAD1].Object.FloaterDstClipLeft + AdjustX
NewTop = Me![LEAD1].Object.FloaterDstClipTop + AdjustY
NewWidth = Me![LEAD1].Object.FloaterDstClipWidth - (2 * NewLeft)
NewHeight = Me![LEAD1].Object.FloaterDstClipHeight - (2 * NewTop)

'Set the clipping rectangle to the new values.
Me![LEAD1].Object.SetFloaterDstClipRect NewLeft, NewTop, NewWidth, NewHeight


Font example for Access 2.0

This example, in a MouseUp event, determines the size of a rectangle for a string in the specified font. It then draws the rectangle and draws the text on top of the rectangle.

Sub Lead1_MouseUp (Button As Integer, Shift As Integer, x As Long, y As Long)
   Dim TestText As String
   Dim gTextWidth As Single
   Dim gTextHeight As Single

   'Specify the text, font, and styles
   TestText = "This is my text."
   Me![LEAD1].Object.Font.Name = "Times New Roman"
   Me![LEAD1].Object.Font.Size = 16
   Me![LEAD1].Object.DrawFontColor = RGB(0, 0, 255) 'Blue

   'Use the same scalemode as the mouse.
   Me![LEAD1].Object.ScaleMode = 1

   'Get the width and height of the text to be drawn.
   gTextWidth = Me![LEAD1].Object.DrawTextWidth(TestText)
   gTextHeight = Me![LEAD1].Object.DrawTextHeight(TestText)

   'Set the properties for drawing a rectangle behind the text.
   Me![LEAD1].Object.DrawPenStyle = DRAWPENSTYLE_SOLID
   Me![LEAD1].Object.DrawMode = DRAWMODE_COPY_PEN
   Me![LEAD1].Object.DrawFillColor = RGB(0, 255, 0) 'Green

   'Draw on the screen, not on the bitmap.
   Me![LEAD1].Object.DrawPersistence = False

   'Draw the rectangle, then draw the text.
   Me![LEAD1].Object.DrawRectangle x, y, gTextWidth, gTextHeight
   Me![LEAD2].Object.DrawTextOut x, y, TestText
End Sub


Frame... example for Access 2.0

This example sets the control's frame properties. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

Me![LEAD1].Object.AutoRepaint = False
Me![LEAD1].Object.FrameThickness = 2
Me![LEAD1].Object.FrameColor = RGB(0, 0, 0)
Me![LEAD1].Object.FrameInnerStyle = EFX_INNERSTYLE_INSET
Me![LEAD1].Object.FrameOuterStyle = EFX_OUTERSTYLE_INSET
Me![LEAD1].Object.FrameInnerHiliteColor = RGB(255, 255, 0)   'Yellow
Me![LEAD1].Object.FrameInnerShadowColor = RGB(128, 128, 128) 'Dark Gray
Me![LEAD1].Object.FrameOuterHiliteColor = RGB(255, 0, 0)    'Red
Me![LEAD1].Object.FrameOuterShadowColor = RGB(192, 192, 192) 'Light Gray
Me![LEAD1].Object.FrameInnerThickness = 3
Me![LEAD1].Object.FrameOuterThickness = 3
Me![LEAD1].Object.ForceRepaint


GammaCorrect example for Access 2.0

This example applies a 2.2 gamma correction and repaints the image.

Me![LEAD1].Object.GammaCorrect 220
Me![LEAD1].Object.ForceRepaint


GetBitmapDC example for Access 2.0

Take the following steps to demonstrate how GDI functions can be used to print text on the bitmap and on the control. The text printed on the bitmap is a permanent part of the bitmap and becomes permanent if the bitmap is saved; whereas the text on the control is superficial and does not affect the bitmap.

Note: For an easier way of drawing text, refer to the Font 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. In online help, you can use the Edit pull-down menu to copy the block of code. (Refer to the Access 2.0 documentation for instructions on using API functions.)

Declare Function SetBkMode Lib "GDI" (ByVal hDC As Integer, ByVal nBkMode As Integer) As Integer
Declare Function SelectObject Lib "GDI" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
Declare Function TextOut Lib "GDI" (ByVal hDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal lpString As String, ByVal nCount As Integer) As Integer
Declare Function GetStockObject Lib "GDI" (ByVal nIndex As Integer) As Integer
Const SYSTEM_FONT = 13
Const TRANSPARENT = 1

3.	 Select the Command Button control; then add a control to your form. Put the control at the top of the form to keep it away from the image.

4.	In the Properties box, change the Command Button control's Name property to PrintText and change the Caption property to Print Text.

5.	Use the right mouse button to click the command button, select Build Event, and select Code Builder.

6.	Add the following code to the click event. In online help, you can use the Edit pull-down menu to copy the block of code.

Notice that the code prints in two different places: the bitmap and the control. You can see the difference when you run the program.

Sub Command1_Click ()
    'Ensure that the Lead control is visible
    Me![LEAD1].Visible = True

    'First, print text on the bitmap.

    'Create a device context for the bitmap that the GDI functions can access
    LeadDC = Me![LEAD1].Object.GetBitmapDC

    'Get the system font and select it. The old font is saved.
    'Using other fonts is more complex. Refer to the Windows API documentation.
    hfnt = GetStockObject(SYSTEM_FONT)
    hOldFont = SelectObject(LeadDC, hfnt)

    'Make the background transparent, so that the text will overlay the image
    MyReturn = SetBkMode(LeadDC, TRANSPARENT)
    'Assign the string value
    mystring$ = "Text on the bitmap"
    'Print the text on the bitmap. This is a permanent change in the bitmap
    MyReturn = TextOut(LeadDC, 20, 40, mystring$, Len(mystring$) )

    'Restore the previous font
    MyReturn = SelectObject(LeadDC, hOldFont)

    'Remove the lock from the device control
    Me![LEAD1].Object.ReleaseBitmapDC

    'Repaint the part of the image that has changed
    Me![LEAD1].Object.BackErase = False
    Me![LEAD1].Object.ForceRepaint

    'Allow full repainting again
    Me![LEAD1].Object.BackErase = True

    'Next, print text on the control.

    'Create a device context for the control that the GDI functions can access
    LeadClientDC = Me![LEAD1].Object.GetClientDC

    'Get the system font and select it. The old font is saved.
    'Using other fonts is more complex. Refer to the Windows API documentation.
    hfnt = GetStockObject(SYSTEM_FONT)
    hOldFont = SelectObject(LeadDC, hfnt)

    'Make the background transparent, so that the text will overlay the image
    MyReturn = SetBkMode(LeadClientDC, TRANSPARENT)
    'Assign the string value
    mystring$ = "Text on the LEAD control"
    'Print the text on the control. This overlay does not affect the bitmap.
    MyReturn = TextOut(LeadClientDC, 20, 80, mystring$, Len(mystring$))

    'Restore the previous font
    MyReturn = SelectObject(LeadClientDC, hOldFont)
    'Remove the lock from the device control
    Me![LEAD1].Object.ReleaseClientDC

End Sub

7.	Run your program to test it. Notice that the text printed on the bitmap is scaled as part of the bitmap. If you zoom in, it becomes larger, and if you zoom out, it becomes smaller. The text printed on the control is the normal size for the system font and is not affected by zooming.


GetColorCount Example for Access 2.0

This example displays a message box showing the number of unique colors in the control's current bitmap.

' Declare local variables.
Dim szMessage As String ' Buffer for the MessageBox string
Dim NumberOfColors As Long ' Number of colors in the bitmap

' Get the number of colors in the bitmap.
NumberOfColors = Me![LEAD1].Object.GetColorCount

' Display the result in a message.
szMessage = "The bitmap has " + CStr(NumberOfColors) + " colors"
MsgBox szMessage, 0, "Notice"


GetFileInfo example for Access 2.0

This example gets information about the specified file.

' Initialize variables
fname = "c:\lead\images\image1.cmp"
pg =0

' Update the variables
Me![LEAD1].Object.GetFileInfo fname, pg, 0

' Read the updated properties
fmt = Me![LEAD1].Object.InfoFormat
nwidth = Me![LEAD1].Object.InfoWidth
nheight = Me![LEAD1].Object.InfoHeight
bps = Me![LEAD1].Object.InfoBits
xres = Me![LEAD1].Object.BitmapXRes
yres = Me![LEAD1].Object.BitmapYRes
pg = Me![LEAD1].Object.InfoPage
sizd = Me![LEAD1].Object.InfoSizeDisk
sizm = Me![LEAD1].Object.InfoSizeMem
cmp = Me![LEAD1].Object.InfoCompress

' Translate the meaning of the format constant
Select Case fmt
   Case FILE_PCX
      cFmt = "ZSoft PCX"
   Case FILE_GIF
      cFmt = "CompuServe GIF"
   Case FILE_TGA
      cFmt = "TARGA"
   Case FILE_PNG
      cFmt = "Portable Network Graphics"
   Case FILE_PSD
      cFmt = "Adobe Photoshop 3.0"
   Case FILE_BMP
      cFmt = "Windows BMP"
   Case FILE_OS2
      cFmt = "OS/2 BMP version 1.x"
   Case FILE_OS2_2
      cFmt = "OS/2 BMP version 2.x"
   Case FILE_WMF
      cFmt = "Windows Meta File"
   Case FILE_EPS
      cFmt = "Encapsulated PostScript"
   Case FILE_TIF
      cFmt = "Tagged Image File Format (TIFF, TIFLZW, or CCITT file)"
   Case FILE_TIF_JPEG
      cFmt = "Tagged Image File with JPEG compression"
   Case FILE_FAX_G3_1D
      cFmt = "Raw FAX, compressed using CCITT group 3, 1 dimension"
   Case FILE_FAX_G3_2D
      cFmt = "Raw FAX, compressed using CCITT group 3, 2 dimensions"
   Case FILE_FAX_G4
      cFmt = "Raw FAX, compressed using CCITT group 4"
   Case FILE_WFX_G3_1D
      cFmt = "WinFax, compressed using CCITT group 3, 1 dimension"
   Case FILE_WFX_G4
      cFmt = "WinFax, compressed using CCITT group 4"
   Case FILE_ICA_G3_1D
      cFmt = "IOCA, compressed using CCITT group 3, 1 dimension"
   Case FILE_ICA_G3_2D
      cFmt = "IOCA, compressed using CCITT group 3, 2 dimensions"
   Case FILE_ICA_G4
      cFmt = "IOCA, compressed using CCITT group 4"
   Case FILE_CMP
      cFmt = "LEAD proprietary compression format"
   Case FILE_CMP_NOLOSS
      cFmt = "LEAD lossless compression format"
   Case FILE_JPEG
      cFmt = "JPEG File Interchange Format"
   Case FILE_WPG
      cFmt = "WordPerfect"
   Case FILE_RAS
      cFmt = "Sun Raster"
   Case FILE_CALS
      cFmt = "CALS Raster"
   Case FILE_MAC
      cFmt = "MacPaint"
   Case FILE_PCT
      cFmt = "Macintosh Pict"
   Case FILE_MSP
      cFmt = "Microsoft Paint"
   Case FILE_IMG
      cFmt = "GEM Image"
   Case FILE_PCD
      cFmt = "Kodak PhotoCD"
   Case FILE_EPSTIFF
      cFmt = "Encapsulated PostScript with an embedded TIFF file"
   Case Else
      cFmt = "Unknown format"
End Select

' Create the message string
cMsg = fname + CHR(13) + "Page = " + STR(pg) + CHR(13)+ "Format = " + cFmt + CHR(13)
cMsg = cMsg + "Width = " + STR(nwidth) + CHR(13) + "Height = " + STR(nheight) + CHR(13)
cMsg = cMsg + "Size on disk = " + STR(sizd) + CHR(13) + "Size in memory = " + STR(sizm) + CHR(13)
cMsg = cMsg + "Bits per pixel = " + STR(bps) + CHR(13)
cMsg = cMsg + "X resolution = " + STR(xres) + CHR(13) + "Y resolution = " + STR(yres)

' Display the message box
answer = MsgBox(cMsg, 0, "File Info")


GetFloaterHandle example for Access 2.0

The following is an alternative way of coding the PasteFloaterBtn button's click procedure in  Outlining, Dragging, and Pasting a Region. This alternative uses the GetFloaterHandle and SetRgnHandle methods to specify the mask for the paste. It also shows how to use the HasRgn, FloaterWidth, and FloaterHeight properties.

Sub PasteFloaterBtn_Click ()

'Declare the variable for the Combine operation.
Dim MyOp As Long

'Declare the variable for the saved region.
Dim SavedRgn As Long

'Declare the variables for the client area coordinates.
Dim LCRgnX, LCRgnY , LCRgnWidth, LCRgnHeight

'Declare the variables for the bitmap coordinates.
Dim LBRgnX, LBRgnY , LBRgnWidth, LBRgnHeight

'Exit this routine if there is no region.
If Me![LEAD1].Object.HasRgn = False Then Exit Sub

'Save the region that is in the floater.
SavedRgn = Me![LEAD1].Object.GetFloaterHandle

'Get the floater into another bitmap
Me![LEAD2].Object.ScaleMode = Me![LEAD1].Object.ScaleMode
Me![LEAD2].Object.Bitmap = Me![LEAD1].Object.Floater

'Get the floater's client coordinates into local variables.
LCRgnX = Me![LEAD1].Object.FloaterDstLeft
LCRgnY = Me![LEAD1].Object.FloaterDstTop
LCRgnWidth = Me![LEAD1].Object.FloaterDstWidth
LCRgnHeight = Me![LEAD1].Object.FloaterDstHeight

'Translate the client coordinates to bitmap coordinates.
LBRgnX = ((LCRgnX - Me![LEAD1].Object.DstLeft) / ZoomFactorX) + Me![LEAD1].Object.SrcLeft
LBRgnY = ((LCRgnY - Me![LEAD1].Object.DstTop) / ZoomFactorY) + Me![LEAD1].Object.SrcTop
LBRgnWidth = Me![LEAD1].Object.FloaterWidth
LBRgnHeight = Me![LEAD1].Object.FloaterHeight

'Delete the floater.
Me![LEAD1].Object.FloaterVisible = False
Me![LEAD1].Object.Floater = 0

'Set the saved region to use as a mask for the Combine method.
Me![LEAD1].Object.SetRgnHandle SavedRgn, LBRgnX, LBRgnY, L_RGN_SET

'Use the Combine method to paste the Lead2 bitmap into the Lead1 bitmap.
MyOp = CB_OP_ADD + CB_DST_0 'Operation flags for a simple paste.
Me![LEAD1].Object.Combine LBRgnX, LBRgnY, LBRgnWidth, LBRgnHeight, Me![LEAD2].Object.Bitmap, 0, 0, MyOp

'Repaint the part of the client area that has changed.
Me![LEAD1].Object.RepaintRect LCRgnX, LCRgnY, LCRgnWidth, LCRgnHeight, False

'Free the region.
Me![LEAD1].Object.FreeRgn

'Delete the region handle.
Me![LEAD1].Object.DeleteRgnHandle SavedRgn

End Sub


GetHistogram example for Access 2.0

The following code does a CMYK separation and uses a histogram to find the brightest and darkest intensities in the K plane of the bitmap. It then remaps the intensities to use the full range and merges the color planes to recreate the bitmap:

Sub Command1_Click ()

    DoCmd Hourglass True

    'Do a CMYK color separation and copy the K plane to the bitmap
    Lead1.Object.ColorSeparate COLORSEP_CMYK
    Lead1.Object.Bitmap = 0 'Free the bitmap
    Lead1.Object.Bitmap = Lead1.Object.ColorPlanes(3) 'Copy the K plane

    'Load the histogram
    Lead1.Object.GetHistogram CHANNEL_MASTER

    'Find the brightest and darkest intensities in the image
    MyIndex = 0
    Brightest = 0
    Darkest = -1
    While (MyIndex < 256)
        If Lead1.Object.HistogramTable(MyIndex) > 0 Then
            Brightest = MyIndex
            If (Darkest = -1) Then
                Darkest = MyIndex
            End If
        End If
        MyIndex = MyIndex + 1
    Wend

    'Remap the intensities to use the full range
    MyIndex = Darkest
    CurrentRange = Brightest - Darkest
    If CurrentRange > 0 Then
        While (MyIndex <= Brightest)
            Offset = MyIndex - Darkest
            Lead1.Object.RemapTable(MyIndex) = (255 * Offset) / CurrentRange
            MyIndex = MyIndex + 1
        Wend
        Lead1.Object.RemapIntensity CHANNEL_MASTER
    End If

    'Merge the color planes and free them from memory
    Lead1.Object.ColorPlanes(3) = Lead1.Object.Bitmap 'Update the K plane
    Lead1.Object.ColorMerge COLORSEP_CMYK
    Lead1.Object.ColorPlanes(0) = 0
    Lead1.Object.ColorPlanes(1) = 0
    Lead1.Object.ColorPlanes(2) = 0
    Lead1.Object.ColorPlanes(3) = 0

    'Set the image display size to match the LEAD control
    Lead1.Object.SetDstRect 0, 0, Lead1.Object.ScaleWidth, Lead1.Object.ScaleHeight
    Lead1.Object.SetDstClipRect 0, 0, Lead1.Object.ScaleWidth, Lead1.Object.ScaleHeight

    Lead1.Object.ForceRepaint
    DoCmd Hourglass False

End Sub


GetMinMaxBits example for Access 2.0

The following example retrieves the values for MinBit and MaxBit using GetMinMaxBits and writes the results.

    Me![LEAD1].Object.GetMinMaxBits

    MsgBox "MinBit" & Str(Me![LEAD1].Object.MinBit)

    MsgBox "MaxBit" & Str(Me![LEAD1].Object.MaxBit)


GetMinMaxVal example for Access 2.0

The following example retrieves the values for MinVal and MaxVal using GetMinMaxVal and writes the results.

    'must call GetMinMaxVal first

    Me![LEAD1].Object.GetMinMaxVal

    MsgBox "MinVal" & Str(Me![LEAD1].Object.MinVal)

    MsgBox "MaxVal" & Str(Me![LEAD1].Object.MaxVal)


GetRgnHandle example for Access 2.0

The following code creates a region, saves its handle and adds the saved region beside the current region.

'Declare local variables.
Dim OffsetX, OffsetY
Dim SavedRegion As Long

'Initialize the variables that we will manipulate to simulate mouse coordinates.
OffsetX = Me![LEAD1].Object.BitmapWidth / 8
OffsetY = Me![LEAD1].Object.BitmapHeight / 6

'Create an elliptical region.
Me![LEAD1].Object.SetRgnEllipse OffsetX, OffsetY, OffsetX, OffsetY, L_RGN_SET

'Save a copy of the region.
SavedRegion = Me![LEAD1].Object.GetRgnHandle

'Add the saved region to the bitmap, offsetting it so that we can see it.
Me![LEAD1].Object.SetRgnHandle SavedRegion, OffsetX, OffsetY, L_RGN_OR

'Delete the saved region.
Me![LEAD1].Object.DeleteRgnHandle SavedRegion

'Fill the bitmap region with blue.
Me![LEAD1].Object.Fill RGB(0, 0, 255)

'Free the bitmap region.
Me![LEAD1].Object.FreeRgn

'Repaint the image so that we can see how the image was updated.
Me![LEAD1].Object.ForceRepaint


Grayscale example for Access 2.0

This example converts the bitmap to grayscale and repaints the image.

Me![LEAD1].Object.Grayscale
Me![LEAD1].Object.ForceRepaint


Halftone example for Access 2.0

This example halftones the bitmap with a horizontal pattern and repaints the image.

Me![LEAD1].Object.Halftone HALFTONE_PRINT, 0
Me![LEAD1].Object.ForceRepaint


HistoContrast example for Access 2.0

This example applies a histogram contrast to the bitmap and repaints it.

Me![LEAD1].Object.HistoContrast 300
Me![LEAD1].Object.ForceRepaint


HistoEqualize example for Access 2.0

This example equalizes the bitmap's histogram and repaints the image.

Me![LEAD1].Object.HistoEqualize
Me![LEAD1].Object.ForceRepaint


Hue example for Access 2.0

This example rotates the hue 180 degrees and repaints the image.

Me![LEAD1].Object.Hue 180
Me![LEAD1].Object.ForceRepaint


IgnoreFilters Example for Access 2.0

This example shows how to ignore filters so that they are not loaded.

    'First, make sure PreLoaded Filters does not
    'contain CMP, and that 0 filters can be cached
    Me![LEAD1].Object.PreLoadFilters 3, 0, "BMP,FAX,TIF"

    'now, ignore cmp filter (never load cmp files)
    Me![LEAD1].Object.IgnoreFilters "CMP"


InsertBitmapListItem Example for Access 2.0

This example loads an ordinary file and uses it to create and play an animation. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

Dim nMax As Double ' Maximum width or height for bitmaps in the list
Dim BitmapWidth As Double ' Width of the bitmap
Dim BitmapHeight As Double ' Height of the bitmap
Dim I As Long  ' Loop Counter

nMax = 160
Me![LEAD2].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1
BitmapWidth = Me![LEAD2].Object.BitmapWidth
BitmapHeight = Me![LEAD2].Object.BitmapHeight

' Reduce memory requirements, if necessary. Only small bitmaps play smoothly.
If (BitmapWidth > nMax) Then
   Me![LEAD2].Object.Size nMax, (BitmapHeight * nMax) / BitmapWidth, RESIZE_RESAMPLE
ElseIf (BitmapHeight > nMax) Then
   Me![LEAD2].Object.Size (BitmapWidth * nMax) / BitmapHeight, nMax, RESIZE_RESAMPLE
End If

' Dither to an optimized palette, leaving the last color blank to use
' for transparency.
Me![LEAD2].Object.ColorRes 8, CRP_IDENTITYPALETTE, CRD_FLOYDSTEINDITHERING, 255

' Set an arbitrary transparent color in the last position of the bitmap palette.
Me![LEAD2].Object.BitmapPalette(255) = RGB(212, 222, 202)

' Set the playback values that will apply to all bitmaps in the list.
Me![LEAD2].Object.BitmapDelay = 10
Me![LEAD2].Object.BitmapTop = 0
Me![LEAD2].Object.BitmapLeft = 0
Me![LEAD2].Object.BitmapEnableTransparency = True
Me![LEAD2].Object.BitmapTransparentColor = 16777216 + 255 ' Specified by palette index
Me![LEAD2].Object.BitmapDisposalMethod = ANIMATIONDISPOSAL_RESTOREBACKGROUND

' Free the LEAD1 control's current bitmap list.
Me![LEAD1].Object.BitmapList = 0

' Populate the bitmap list in the LEAD1 control.
For I = 0 To 36
   Me![LEAD1].Object.InsertBitmapListItem I, Me![LEAD2].Object.Bitmap
   ' Rotate, using the transparent color as the fill color.
   Me![LEAD1].Object.BitmapListIndex = I
   Me![LEAD1].Object.Rotate 1000 * I, 0, 16777216 + 255
Next I

' Set the animation playback properties
Me![LEAD1].Object.AnimationBackColor = RGB(0, 0, 255)
Me![LEAD1].Object.AnimationBitsPerPixel = 8
Me![LEAD1].Object.AnimationHeight = Me![LEAD1].Object.ScaleHeight
Me![LEAD1].Object.AnimationWidth = Me![LEAD1].Object.ScaleWidth
Me![LEAD1].Object.AnimationLoop = False
For I = 0 To 255
   Me![LEAD1].Object.AnimationPalette(I) = Me![LEAD1].Object.BitmapPalette(I)
Next I

' Set properties for a scaled animation.
Me![LEAD1].Object.AutoRepaint = True
Me![LEAD1].Object.AutoSetRects = False

' Set the image display size to match the LEAD control.
Me![LEAD1].Object.SetDstRect 0, 0, Me![LEAD1].Object.ScaleWidth, Me![LEAD1].Object.ScaleHeight
Me![LEAD1].Object.SetDstClipRect 0, 0, Me![LEAD1].Object.ScaleWidth, Me![LEAD1].Object.ScaleHeight

' Start the animation.
Me![LEAD1].Object.AnimationEnable = True

' Free the LEAD2 control's bitmap.
Me![LEAD2].Object.BitmapList = 0


Intensity example for Access 2.0

This example lightens the bitmap and repaints the image.

Me![LEAD1].Object.Intensity 150
Me![LEAD1].Object.ForceRepaint


IntensityDetect example for Access 2.0

This example filters the bitmap to get the lightest intensities and repaints the image.

Me![LEAD1].Object.IntensityDetect 200, 255
Me![LEAD1].Object.ForceRepaint


Invert example for Access 2.0

This example inverts the bitmap's colors and repaints the image.

Me![LEAD1].Object.Invert
Me![LEAD1].Object.ForceRepaint


KeyPress example for Access 2.0

This example demonstrates the KeyPress event.

Sub LEAD1_KeyPress (KeyAscii As Integer)

    'This example uses the KeyPress event to implement a custom scale mode.
    'There is no particular reason to put this code in this event, except that
    'we needed examples of both the event and the scale mode.

    If KeyAscii = 67 Then 'Uppercase C
        'This example sets an custom scale mode and uses it to crop the
        'display. Keep in mind that the actual height and width do not change.
        'Only the unit of measure changes.

        'Change the scale so that origin is moved one-third right and one-third down
        Me![LEAD1].Object.ScaleLeft = -1
        Me![LEAD1].Object.ScaleTop = -1
        Me![LEAD1].Object.ScaleWidth = 3
        Me![LEAD1].Object.ScaleHeight = 3

        'Crop the display so that it takes up the middle third of the height and width
        Me![LEAD1].Object.DstClipLeft = 0
        Me![LEAD1].Object.DstClipTop = 0
        Me![LEAD1].Object.DstClipWidth = 1
        Me![LEAD1].Object.DstClipHeight = 1

        Me![LEAD1].Object.ForceRepaint
    End If

End Sub


LevelLowBit example for Access 2.0

This is also the example for LevelHighBit.

This example sets LevelLowBit and LevelHighBit to display the image using only the eight least significant bits.

    'use least significant 8 bits

    Me![LEAD1].Object.LevelLowBit = 0

    Me![LEAD1].Object.LevelHighBit = 7


LevelLUT example for Access 2.0

This is also the example for MinVal property and MaxVal property.

The following example sets LevelLowBit and LevelHighBit to use all bits, gets the minimum and maximum bits and intensity values for the image, and then sets the LUT so that pixels with values in the minimum range are mapped to the color RED, while pixels with values in the maximum range are mapped to BLUE.

    Me![LEAD1].Object.AutoRepaint = False
    'use all bits
    Me![LEAD1].Object.LevelLowBit = 0
    Me![LEAD1].Object.LevelHighBit = Me![LEAD1].Object.BitmapBits - 1

    Me![LEAD1].Object.GetMinMaxBits
    Me![LEAD1].Object.GetMinMaxVal
    max = Me![LEAD1].Object.MaxVal
    min = Me![LEAD1].Object.MinVal

    'set LUT so that min range maps to RED and max range maps to BLUE
    For i = min To min + 100
     Me![LEAD1].Object.LevelLUT(i) = RGB(255, 0, 0)
    Next
    For i = max - 100 To max
     Me![LEAD1].Object.LevelLUT(i) = RGB(0, 0, 255)
    Next
    Me![LEAD1].Object.AutoRepaint = True


LevelLUTLength example for Access 2.0

This example writes out the number of entries in the LUT.

    Me![LEAD1].Object.Grayscale 12    'Grayscale image to 12-bit

    MsgBox Str(Me![LEAD1].Object.LevelLUTLength)


LoadInfo example for Access 2.0
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.	 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.


LoadUseViewPerspective example for Access 2.0

Note: This topic is for Document/Medical only.

This example times the loading of a bitmap with and without changing the internal view perspective.

'Declare local variables
Dim StartTime, DeltaTime

'Do not include paints when measuring time.
Me![LEAD1].Object.AutoRepaint = False

'Time the load using the bitmap's view perspective.
Me![LEAD1].Object.LoadUseViewPerspective = True
StartTime = Now
Me![LEAD1].Object.Load "d:\lead\images\rotated.tif", 0, 0, 1
DeltaTime = DateDiff("s", StartTime, Now)
MsgBox Str$(DeltaTime) + " seconds loaded as is"

'Time the load that converts the bitmap's view perspective.
Me![LEAD1].Object.LoadUseViewPerspective = False
StartTime = Now
Me![LEAD1].Object.Load "d:\lead\images\rotated.tif", 0, 0, 1
DeltaTime = DateDiff("s", StartTime, Now)
MsgBox Str$(DeltaTime) + " seconds converted on load"


MaxFilter example for Access 2.0

Note: This topic is for Document/Medical only.

This example erodes dark objects and repaints the image.

Me![LEAD1].Object.MaxFilter 3
Me![LEAD1].Object.ForceRePaint


Median example for Access 2.0

This example applies a median filter with a 3x3 neighborhood and redisplays the bitmap.

Me![LEAD1].Object.Median 3
Me![LEAD1].Object.ForceRepaint


MinFilter example for Access 2.0

Note: This topic is for Document/Medical only.

This example dilates dark objects and repaints the image.

Me![LEAD1].Object.MinFilter 3
Me![LEAD1].Object.ForceRePaint


Mosaic example for Access 2.0

This example applies a mosaic effect with 8x8 tiles and redisplays the bitmap.

Me![LEAD1].Object.Mosaic 8
Me![LEAD1].Object.ForceRepaint


Oilify example for Access 2.0

This example applies an oil-painting effect and repaints the image.

Me![LEAD1].Object.Oilify 10
Me![LEAD1].Object.ForceRepaint


OLEDropAllowed example for Access 2.0

This example toggles the OLEDropAllowed property.

If Me![LEAD1].Object.OLEDropAllowed = False Then
    Me![LEAD1].Object.OLEDropAllowed = True
Else
    Me![LEAD1].Object.OLEDropAllowed = False
End If


Paint event, Enabled property, and hWnd property example for Access 2.0
Paint event example for Access 2.0

This example uses some Windows API functions to demonstrate the following:

 Paint event

 Click event

 Enabled property

 hWnd property

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

2.	 In the Database window, select the Module tab, and click the New button.

3.	Add the following type definitions and API declarations:

Type RECT
    left As Integer
    top As Integer
    right As Integer
    bottom As Integer
End Type
Global MyRect As RECT

Type POINTAPI
    x As Integer
    y As Integer
End Type
Global MyPoint As POINTAPI

Declare Sub InvalidateRect Lib "User" (ByVal hWnd As Integer, lpRect As RECT, ByVal bErase As Integer)
Declare Function LineTo Lib "GDI" (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer) As Integer
Declare Function MoveToEx Lib "GDI" (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer, lpPoint As POINTAPI) As Integer

4,	Close the file, and save it as the Declarations module.

5.	Return to Form1, add a command button to the top of your main form, and in the properties box, change both its name and caption to Toggle.

6.	Add a text box to the top of your form, and in the properties box, change its name to Directions, and change its default value to the following:

"Use the Toggle button to turn on or turn off Click-Splat"

7.	Add the following code to the Toggle button's Click procedure. This code uses the Enabled property to toggle the LEAD control's ability to respond to click events.

If Me![LEAD1].Object.Enabled = False Then
  Me![LEAD1].Object.Enabled = True
  Directions.Value = "Click on the image for a splat"
  Toggle.Caption = "Disable"
Else
  Me![LEAD1].Object.Enabled = False
  Directions.Value = "Click does nothing"
  Toggle.Caption = "Enable"
End If

8.	Add the following code to the LEAD1 Click procedure. When the Enabled property is true, this code uses a Windows API call to generate a paint event.

' Use pixels for API calls
SavedMode = Me![LEAD1].Object.ScaleMode
Me![LEAD1].Object.ScaleMode = 3 'Pixels

' Use InvalidateRect to generate a paint message
MyWindow = Me![LEAD1].Object.hWnd
MyRect.Left = 0
MyRect.Top = 0
MyRect.bottom = Me![LEAD1].Object.ScaleHeight
MyRect.right = Me![LEAD1].Object.ScaleWidth
InvalidateRect MyWindow, MyRect, True

' Set the ScaleMode back to the default
Me![LEAD1].Object.ScaleMode = SavedMode

9.	Add the following code to the LEAD1 Paint procedure. It uses Windows GDI functions to draw random lines on the control whenever there is a paint event.

' Create a device context for the control that the GDI functions can access
LeadClientDC = Me![LEAD1].Object.GetClientDC

' Draw random lines on the control. This is an overlay that does not affect the bitmap.
xStart = Rnd * Me![LEAD1].Object.ScaleWidth
yStart = Rnd * Me![LEAD1].Object.ScaleHeight
MyPoint.x = 0
MyPoint.y = 0
MyReturn = MoveToEx(LeadClientDC, xStart, yStart, MyPoint)
For i = 1 To 50
    xDelta = (Rnd * 80) - 40  ' -40 to 40
    yDelta = (Rnd * 80) - 40  ' -40 to 40
    xEnd = xStart + xDelta
    yEnd = yStart + yDelta
    MyReturn = LineTo(LeadClientDC, xEnd, yEnd)
    MyReturn = MoveToEx(LeadClientDC, xStart, yStart, MyPoint)
Next i

' Remove the lock from the device control
Me![LEAD1].Object.ReleaseClientDC

10.	Run your program to test it.


PaintContrast example for Access 2.0

This example increases the contrast for painting images.

Me![LEAD1].Object.PaintContrast = Me![LEAD1].Object.PaintContrast + 100
Me![LEAD1].Object.ForceRepaint


PaintDither example for Access 2.0

This example turns on error diffusion and redisplays the bitmap.

Me![LEAD1].Object.PaintDither = PAINTDITHER_DIFFUSION
Me![LEAD1].Object.ForceRepaint


PaintEffect example for Access 2.0

The following modules use the KeyDown and KeyUp events to repaint the image with effects.

Sub Lead1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 116 Then 'Code for F5
   Me![LEAD1].Object.AutoRepaint = False
   Me![LEAD1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1
   Me![LEAD1].Object.EffectGrain = 20
   Me![LEAD1].Object.EffectDelay = 50
   Me![LEAD1].Object.WandSize = 5
   Me![LEAD1].Object.WandColor = RGB(255, 255, 0) 'Yellow Wand
   Me![LEAD1].Object.PaintEffect = EFX_EFFECT_WIPE_L_TO_R
   Me![LEAD1].Object.ForceRepaint
End If
End Sub

Sub Lead1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 116 Then 'Code for F5
   Me![LEAD1].Object.PaintEffect = EFX_EFFECT_WIPE_R_TO_L
   Me![LEAD1].Object.ForceRepaint
   Me![LEAD1].Object.PaintEffect = EFX_EFFECT_NONE
End If
End Sub


PaintGamma example for Access 2.0

This example increases the gamma correction for painting images.

Me![LEAD1].Object.PaintGamma = Me![LEAD1].Object.PaintGamma + 100
Me![LEAD1].Object.ForceRepaint


PaintIntensity example for Access 2.0

This example increases the intensity for painting images.

Me![LEAD1].Object.PaintIntensity = Me![LEAD1].Object.PaintIntensity + 100
Me![LEAD1].Object.ForceRepaint


PaintMaxPasses example for Access 2.0

This example includes two procedures. First, a button click starts a multi-pass paint effect; then LEAD's PaintNotification event changes the direction of the effect on each pass.

Sub Start_Click ()
   Me![LEAD1].Object.AutoRepaint = False
   'Set the Effect
   Me![LEAD1].Object.PaintEffect = EFX_EFFECT_WIPE_L_TO_R
   Me![LEAD1].Object.PaintMaxPasses = 5      '5 total passes
   Me![LEAD1].Object.PaintPass = 1         'Start with pass number 1
   'Load the image
   Me![LEAD1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1
   Me![LEAD1].Object.ForceRePaint          'Start painting
End Sub

Sub Lead1_PaintNotification (uPass As Integer, uType As Integer)
   'if the first pass is complete
   If ((uType = EFX_NOTIFY_IMAGE) And (uPass > 0)) Then
     'Toggle the effect from left_to_right to right_to_left
     If Me![LEAD1].Object.PaintEffect = EFX_EFFECT_WIPE_L_TO_R Then
       Me![LEAD1].Object.PaintEffect = EFX_EFFECT_WIPE_R_TO_L
     Else
       Me![LEAD1].Object.PaintEffect = EFX_EFFECT_WIPE_L_TO_R
     End If
   End If
End Sub


PaintPalette example for Access 2.0

This example sets the paint palette to the palette of each Lead control. It then loads two images and dithers them to 8 bits per pixel with optimized palettes, and displays them side by side.  In 8-bit display mode, you can see the palette problems that result when you do not use a fixed palette.

Me![LEAD1].Object.PaintPalette = PAINTPALETTE_AUTO
Me![LEAD2].Object.PaintPalette = PAINTPALETTE_AUTO

'Disable automatic repainting of the image.
Me![LEAD1].Object.AutoRepaint = False
Me![LEAD2].Object.AutoRepaint = False

'Turn off scroll bars to make sure we use the full client area.
Me![LEAD1].Object.AutoScroll = False
Me![LEAD2].Object.AutoScroll = False

'Clear the bitmaps from memory
Me![LEAD1].Object.Bitmap = 0
Me![LEAD2].Object.Bitmap = 0

DoCmd Hourglass True
'Load the bitmaps. These hard-coded path names may be different on your system.
Me![LEAD1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1
Me![LEAD2].Object.Load "c:\lead\images\image2.cmp", 0, 0, 1

'Change the bitmaps to 8 BPS with optimized palettes
Me![LEAD1].Object.ColorRes 8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0
Me![LEAD2].Object.ColorRes 8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0

'Make the controls visible so that we can size and position them.
'They will not really appear until we load an image and paint it.
Me![LEAD1].Visible = True
Me![LEAD2].Visible = True

'Set the variables used for preserving the aspect ratio.
HeightFactor1 = Me![LEAD1].Object.BitmapHeight
WidthFactor1 = Me![LEAD1].Object.BitmapWidth
HeightFactor2 = Me![LEAD2].Object.BitmapHeight
WidthFactor2 = Me![LEAD2].Object.BitmapWidth
HeightAllowed = Me.WindowHeight * .8
WidthAllowed = Me.WindowWidth * .45

'Center each LEAD control on half of the form, preserving the aspect ratio.
'Check to see if using the maximum width will make the image too tall.
'Set the dimensions based on the result.
If (WidthAllowed * HeightFactor1) / WidthFactor1 < HeightAllowed Then
  Me![LEAD1].Left =  (Me.WindowWidth / 4) - (WidthAllowed / 2)
  Me![LEAD1].Width = WidthAllowed
  Me![LEAD1].Height = (Me![LEAD1].Width * HeightFactor1) / WidthFactor1
  Me![LEAD1].TOP = (Me.WindowHeight - Me![LEAD1].Height) / 2
Else
  Me![LEAD1].TOP = (Me.WindowHeight - HeightAllowed) / 2
  Me![LEAD1].Height = HeightAllowed
  Me![LEAD1].Width = (Me![LEAD1].Height * WidthFactor1) / HeightFactor1
  Me![LEAD1].Left = (Me.WindowWidth / 4) - (Me![LEAD1].Width / 2)
End If

If (WidthAllowed * HeightFactor2) / WidthFactor2 < HeightAllowed Then
  Me![LEAD2].Left = (Me.WindowWidth * 3/4) - (WidthAllowed / 2)
  Me![LEAD2].Width = WidthAllowed
  Me![LEAD2].Height = (Me![LEAD2].Width * HeightFactor2) / WidthFactor2
  Me![LEAD2].TOP = (Me.WindowHeight - Me![LEAD2].Height) / 2
Else
  Me![LEAD2].TOP = (Me.WindowHeight - HeightAllowed) / 2
  Me![LEAD2].Height = HeightAllowed
  Me![LEAD2].Width = (Me![LEAD2].Height * WidthFactor2) / HeightFactor2
  Me![LEAD2].Left = (Me.WindowWidth * 3/4) - (Me![LEAD2].Width / 2)
End If

'Set the image display sizes to match the LEAD controls
ImageHeight1 = Me![LEAD1].Object.ScaleHeight
ImageWidth1 = Me![LEAD1].Object.ScaleWidth
Me![LEAD1].Object.SetDstRect 0, 0, ImageWidth1, ImageHeight1
Me![LEAD1].Object.SetDstClipRect 0, 0, ImageWidth1, ImageHeight1

'Set the image display sizes to match the LEAD controls
ImageHeight2 = Me![LEAD2].Object.ScaleHeight
ImageWidth2 = Me![LEAD2].Object.ScaleWidth
Me![LEAD2].Object.SetDstRect ImageLeft2, ImageTop2, ImageWidth2, ImageHeight2
Me![LEAD2].Object.SetDstClipRect ImageLeft2, ImageTop2, ImageWidth2, ImageHeight2

'Display the images
Me![LEAD1].Object.ForceRepaint
Me![LEAD2].Object.ForceRepaint
DoCmd Hourglass False


PaintROP3 example for Access 2.0

This example demonstrates the PaintROP3 property.

' Define Windows constant
Const SRCINVERT = 6684742

' Paint an inverted image
Me![LEAD1].Object.PaintROP3 = SRCINVERT
Me![LEAD1].Object.ForceRepaint


PaintSizeMode Example for Access 2.0

This example shows how to set the PaintSizeMode property so that the control uses only a vertical scroll bar.

Me![LEAD1].Object.AutoScroll = True
Me![LEAD1].Object.AutoSetRects = True
Me![LEAD1].Object.PaintSizeMode = PAINTSIZEMODE_FITSIDES
Me![LEAD1].Object.ForceRepaint


PaintSizeUseDPI example for Access 2.0

This example toggles the PaintSizeUseDPI property.

If Me![LEAD1].Object.PaintSizeUseDPI = False Then
    Me![LEAD1].Object.PaintSizeUseDPI = True
Else
    Me![LEAD1].Object.PaintSizeUseDPI = False
End If


PaintWhileLoad example for Access 2.0

This example causes the LEAD control to paint the image as it loads.

Me![LEAD1].Object.PaintWhileLoad = TRUE

'Get information about the image so that we can size the control.
Me![LEAD1].Object.GetFileInfo "c:\lead\images\image2.cmp", 0, 0

'Set the variables used for preserving the aspect ratio.
'Allow for a border of 1/8 of the form size.
'The units of measure do not matter, since we are calculating proportions.
HeightFactor = Me![LEAD1].Object.InfoHeight
WidthFactor = Me![LEAD1].Object.InfoWidth
HeightAllowed = Me.WindowHeight * 3/4
WidthAllowed = Me.WindowWidth * 3/4

'Center the LEAD control on the form, preserving the aspect ratio.
'Check to see if using the maximum width will make the image too tall.
'Set the dimensions based on the result.
If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
    Me![LEAD1].Left = Me.WindowWidth / 8
    Me![LEAD1].Width = WidthAllowed
    Me![LEAD1].Height = (Me![LEAD1].Width * HeightFactor) / WidthFactor
    Me![LEAD1].TOP = (Me.WindowHeight - Me![LEAD1].Height) / 2
Else
    Me![LEAD1].TOP = Me.WindowHeight / 8
    Me![LEAD1].Height = HeightAllowed
    Me![LEAD1].Width = (Me![LEAD1].Height * WidthFactor) / HeightFactor
    Me![LEAD1].Left = (Me.WindowWidth - Me![LEAD1].Width) / 2
  End If

'Set the image display sizes to match the LEAD controls
ImageHeight = Me![LEAD1].Object.ScaleHeight
ImageWidth = Me![LEAD1].Object.ScaleWidth
BitmapHeight = Me![LEAD1].Object.InfoHeight
BitmapWidth = Me![LEAD1].Object.InfoWidth
Me![LEAD1].Object.SetSrcRect 0, 0, BitmapWidth, BitmapHeight
Me![LEAD1].Object.SetSrcClipRect 0, 0, BitmapWidth, BitmapHeight
Me![LEAD1].Object.SetDstRect 0, 0, ImageWidth, ImageHeight
Me![LEAD1].Object.SetDstClipRect 0, 0, ImageWidth, ImageHeight

'Turn off the automatic adjustment of display rectangles
Me![LEAD1].Object.AutoSetRects = False

'Load the file
Me![LEAD1].Object.Load "c:\lead\images\image2.cmp", 0, 0, 1

'Turn on the automatic adjustment of display rectangles for future use
Me![LEAD1].Object.AutoSetRects = True


PaintZoomFactor Example for Access 2.0

This example shows how to set the PaintZoomFactor property so that image is scaled 200 percent for display.

Me![LEAD1].Object.AutoScroll = False
Me![LEAD1].Object.AutoSetRects = True
Me![LEAD1].Object.PaintSizeMode = PAINTSIZEMODE_ZOOM
Me![LEAD1].Object.PaintZoomFactor = 200
Me![LEAD1].Object.ForceRepaint


PatternStyle example for Access 2.0

This example paints a transition with a diagonal cross pattern.

Me![LEAD1].Object.AutoRepaint = False
Me![LEAD1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1
Me![LEAD1].Object.TransitionEffect = EFX_EFFECT_WIPE_RECTANGLE_OUT
Me![LEAD1].Object.TransitionStyle = EFX_TRANSITION_PATTERN
Me![LEAD1].Object.PatternStyle = EFX_PATTERN_DIAG_CROSS
Me![LEAD1].Object.PatternBackColor = RGB(255, 0, 0)
Me![LEAD1].Object.PatternForeColor = RGB(0, 0, 255)
Me![LEAD1].Object.ForceRepaint


Pixel example for Access 2.0

This example, using the MouseDown event, gets the value of the current pixel and sets all values in the line to that value. The example shows how to convert mouse coordinates to bitmap pixel coordinates, regardless of how the image is zoomed or scrolled.

Sub Lead1_MouseDown (Button As Integer, Shift As Integer, x As Long, y As Long)
   Dim xycolor As Long
   Dim xfraction As Single
   Dim yfraction As Single
   Dim xPixel As Long
   Dim yPixel As Long

   ''In Access, you get TWIPS; so set the scalemode accordingly.
   Me![LEAD1].Object.ScaleMode = 1
   Me![LEAD1].Object.AutoRepaint = False

   'Translate mouse coordinates to fractions of the destination width and height.
   xfraction = (x - Me![LEAD1].Object.DstLeft) / Me![LEAD1].Object.DstWidth
   yfraction = (y - Me![LEAD1].Object.DstTop) / Me![LEAD1].Object.DstHeight

   'Set the scalemode to pixels and convert fractions to bitmap pixel coordinates.
   Me![LEAD1].Object.ScaleMode = 3
   xPixel = (Me![LEAD1].Object.SrcWidth * xfraction) + Me![LEAD1].Object.SrcLeft
   yPixel = (Me![LEAD1].Object.SrcHeight * yfraction) + Me![LEAD1].Object.SrcTop

   'Make the whole line the same color as the pixel.
   xycolor = Me![LEAD1].Object.Pixel(xPixel, yPixel)
   For xPixel = 0 To Me![LEAD1].Object.BitmapWidth
    Me![LEAD1].Object.Pixel(xPixel, yPixel) = xycolor
   Next
   Me![LEAD1].Object.ForceRepaint
End Sub


Posterize example for Access 2.0

This example applies a six-color poster effect and redisplays the image.

Me![LEAD1].Object.Posterize 6
Me![LEAD1].Object.ForceRepaint


PreLoadFilters Example for Access 2.0

This example shows how to preload filters.

'preload the BMP, PCX, FAX, and TIFF filters,

    'and allow 1 filter to be cached, while always

    'keeping 3 loaded.

    Me![LEAD1].Object.PreLoadFilters 3, 1, "BMP,PCX,FAX,TIF"


ProgressivePasses Example for Access 2.0

This example shows how to save and load a progressive file.

' Save the current image as a progressive CMP file.
Me![LEAD1].Object.ProgressivePasses = 8
Me![LEAD1].Object.Save "c:\lead\images\tmp.cmp", FILE_CMP, 24, QFACTOR_PQ2, SAVE_OVERWRITE

' Set properties to show progressive paints when we load.
Me![LEAD1].Object.PaintWhileLoad = True
Me![LEAD1].Object.AutoSetRects = False

' Load the file we just saved.
Me![LEAD1].Object.ProgressivePasses = PROGRESSIVEPASSES_WHEN_MEANINGFUL
Me![LEAD1].Object.Load "c:\lead\images\tmp.cmp", 0, 0, 1

' Restore the default behavior.
Me![LEAD1].Object.ProgressivePasses = 0


Render example for Access 2.0

This example demonstrates the Render method.

' Set the variables used for preserving the aspect ratio.
HeightFactor = Me![LEAD1].Object.BitmapHeight
WidthFactor = Me![LEAD1].Object.BitmapWidth

' Allow a maximum of 6x6 inches on a 300dpi printer
HeightAllowed = 1800
WidthAllowed = 1800

' Print the LEAD control, preserving the aspect ratio.
' Check to see if using the maximum width will make the image too tall.
' Set the dimensions based on the result.
If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
    ControlWidth = WidthAllowed
    ControlHeight = (ControlWidth * HeightFactor) / WidthFactor
Else
    ControlHeight = HeightAllowed
    ControlWidth = (ControlHeight * WidthFactor) / HeightFactor
End If

MyPrinter = Me![LEAD1].Object.PrintStart
Me![LEAD1].Object.Render MyPrinter, 0, 0, ControlWidth, ControlHeight
Me![LEAD1].Object.PrintEnd MyPrinter


Resize event example for Access 2.0

This example demonstrates the Resize event. Before using this example you must add a text box to your form. Then, you can exercise this example by coding a command button that changes the width and height of the Lead1 control.

Sub LEAD1_Resize ()
    Text1.Value = "Control size: " + CStr(Me![LEAD1].Width) + " x " + CStr(Me![LEAD1].Height)
End Sub


RgnChange example for Access 2.0

The following code for the RgnChange event updates a text box using the GetRgnArea method. You can test it by adding a text box for the lesson described in Outlining, Dragging, and Pasting a Region.

Sub LEAD1_RgnChange ()
    'Declare a local variable.
    Dim MyText As String
    MyText = "Number of pixels in region: "
    MyText = MyText + CStr(ME![LEAD1].OBJECT.GetRgnArea)
    Text1.SetFocus
    Text1.Text = MyText
End Sub


Rotate example for Access 2.0

This example rotates the bitmap 45 degrees and redisplays the image. It resizes the bitmap to accommodate the rotation and uses blue as the fill color.

Me![LEAD1].Object.Rotate 4500, ROTATE_RESIZE, RGB(0,0,255)
Me![LEAD1].Object.AutoSetRects = True 'Make sure the display rectangles are adjusted
Me![LEAD1].Object.ForceRepaint


Saturation example for Access 2.0

This example increases the saturation of colors in the bitmap and redisplays the image.

Me![LEAD1].Object.Saturation 1000
Me![LEAD1].Object.ForceRepaint


Save example for Access 2.0

This example determines whether a bitmap is grayscale, saves it appropriately, loads the saved file, and redisplays the bitmap.

DoCmd Hourglass True
If Me![LEAD1].Object.IsGrayscale = 0 Then 'GRAY_NO
    Me![LEAD1].Object.Save "c:\lead\images\tmp.cmp", FILE_CMP, 24, QFACTOR_PQ2, SAVE_OVERWRITE
Else ' save as grayscale
    Me![LEAD1].Object.Save "c:\lead\images\tmp.cmp", FILE_CMP, 8, QFACTOR_PQ2, SAVE_OVERWRITE
End If
Me![LEAD1].Object.Load "c:\lead\images\tmp.cmp", 0, 0, 1
Me![LEAD1].Object.ForceRepaint
DoCmd Hourglass False


SaveInterlaced example for Access 2.0

This example saves the current image as an interlaced GIF file, then loads the saved image with a paint-while-load effect that shows the interlaced behavior.

'Save the current image as an interlaced GIF file.
Me![LEAD1].Object.SaveInterlaced = True
Me![LEAD1].Object.Save "d:\temp\tmp.gif", FILE_GIF, 8, 1, SAVE_OVERWRITE

'Clear the bitmap so that we can see the paint-while-load effect.
Me![LEAD1].Object.Bitmap = 0

'Paint the image while loading, showing that it is interlaced.
Me![LEAD1].Object.PaintWhileLoad = True
Me![LEAD1].Object.Load "d:\temp\tmp.gif", 0, 0, 1


SaveWithStamp example for Access 2.0

This example saves the image in a JPEG file that includes a thumbnail (stamp) image. It then loads the thumbnail from the new file.

SavedMode = Me![LEAD1].Object.ScaleMode
Me![LEAD1].Object.ScaleMode = 3 ' Use pixels for sizing the thumbnail
Me![LEAD1].Object.SaveWithStamp "c:\lead\images\stamp.jpg", FILE_JPEG, 24, 30, 150, 100, 24
Me![LEAD1].Object.ScaleMode = SavedMode
Me![LEAD1].Object.LoadStamp "c:\lead\images\stamp.jpg"
Me![LEAD1].Object.ForceRepaint


Scroll event example for Access 2.0

This example demonstrates the Scroll event.

Sub LEAD1_Scroll ()
  ' Add a TextBox control to your form and use it for this test
  cText = "Image origin: " + CStr(Me![LEAD1].Object.DstLeft) + ", " + CStr(Me![LEAD1].Object.DstTop)
  Text1.Value = cText
End Sub


SetRgn... example for Access 2.0

This example demonstrates the SetRgnEllipse, SetRgnRect, SetRgnRoundRect, and SetRgnPolygon methods by simulating client area coordinates. Normally, you would get the coordinates interactively from mouse events and would use Windows GDI functions to outline the shape of each region before it is created.

To create the polygonal region, this example uses the PolygonSize, PolygonX, and PolygonY properties.

Also, to demonstrate the SetRgnColor method, it uses the Fill method to fill the region with a solid color, then uses the fill color to create a new region.

'Declare local variables.
Dim ZoomFactorX As Single 'Used for translating positioning information
Dim ZoomFactorY As Single 'Used for translating positioning information
Dim OffsetX, OffsetY, CurrentX, CurrentY  'To simulate mouse coordinates
Dim SimLeft, SimTop, SimWidth, SimHeight  'To simulate mouse coordinates
Dim LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, eW, eH  'For bitmap coordinates
Dim i As Integer 'Loop counter
Static xPoint(0 To 7) As Integer 'Array for polygon points
Static yPoint(0 To 7) As Integer 'Array for polygon points

'Initialize the variables that we will manipulate to simulate mouse coordinates.
OffsetX = Me![LEAD1].Object.ScaleWidth / 15
OffsetY = Me![LEAD1].Object.ScaleHeight / 15
CurrentX = OffsetX
CurrentY = OffsetY

'Set the zoom factors.
ZoomFactorX = Me![LEAD1].Object.DstWidth / Me![LEAD1].Object.SrcWidth
ZoomFactorY = Me![LEAD1].Object.DstHeight / Me![LEAD1].Object.SrcHeight

'Start by simulating the drawing of a rectangle.
SimLeft = CurrentX
SimTop = CurrentY
SimWidth = OffsetX * 2
SimHeight = OffsetY * 2

'Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (Me![LEAD1].Object.DstLeft / ZoomFactorX) + Me![LEAD1].Object.SrcLeft
LBRgnTop = (SimTop / ZoomFactorY) - (Me![LEAD1].Object.DstTop / ZoomFactorY) + Me![LEAD1].Object.SrcTop
LBRgnWidth = SimWidth / ZoomFactorX
LBRgnHeight = SimHeight / ZoomFactorY

'Create the rectangular region, outline it, and display a message so that we can see what happened.
Me![LEAD1].Object.SetRgnRect LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, L_RGN_SET
Me![LEAD1].Object.RgnFrameType = RGNFRAME_STATIC
MsgBox "Here is the rectangular region"

'Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + OffsetX
CurrentY = CurrentY + OffsetY

'Next, simulate the drawing of an ellipse.
SimLeft = CurrentX
SimTop = CurrentY
SimWidth = OffsetX * 3
SimHeight = OffsetY * 2

'Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (Me![LEAD1].Object.DstLeft / ZoomFactorX) + Me![LEAD1].Object.SrcLeft
LBRgnTop = (SimTop / ZoomFactorY) - (Me![LEAD1].Object.DstTop / ZoomFactorY) + Me![LEAD1].Object.SrcTop
LBRgnWidth = SimWidth / ZoomFactorX
LBRgnHeight = SimHeight / ZoomFactorY

'Add the elliptical region, using a Boolean OR,
'and display a message so that we can see what happened.
Me![LEAD1].Object.SetRgnEllipse LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, L_RGN_OR
Me![LEAD1].Object.RgnFrameType = RGNFRAME_STATIC
MsgBox "Here is the added ellipse, with a Boolean OR"

'Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + OffsetX
CurrentY = CurrentY + OffsetY

'Next, simulate the drawing of a rounded rectangle.
SimLeft = CurrentX
SimTop = CurrentY
SimWidth = OffsetX * 3
SimHeight = OffsetY * 2

'Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (Me![LEAD1].Object.DstLeft / ZoomFactorX) + Me![LEAD1].Object.SrcLeft
LBRgnTop = (SimTop / ZoomFactorY) - (Me![LEAD1].Object.DstTop / ZoomFactorY) + Me![LEAD1].Object.SrcTop
LBRgnWidth = SimWidth / ZoomFactorX
LBRgnHeight = SimHeight / ZoomFactorY

'Define an ellipse to use for the corners.
eW = LBRgnWidth / 4
eH = LBRgnHeight / 4

'Add the rounded rectangular region, using a Boolean exclusive OR,
'and display a message so that we can see what happened.
Me![LEAD1].Object.SetRgnRoundRect LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, eW, eH, L_RGN_XOR
MsgBox "Here is the rounded rectangle, with a Boolean XOR"

'Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + (2 * OffsetX)
CurrentY = CurrentY + (2 * OffsetY)

'Set up some arrays to use as client area grid values.
'OffsetX and OffsetY set the grid sizes.

xPoint(0) = 0
xPoint(1) = -1
xPoint(2) = 2
xPoint(3) = 1
xPoint(4) = 1
xPoint(5) = 2
xPoint(6) = -1
xPoint(7) = -2

yPoint(0) = 0
yPoint(1) = -1
yPoint(2) = -1
yPoint(3) = 1
yPoint(4) = -1
yPoint(5) = 1
yPoint(6) = 1
yPoint(7) = 1

'Initialize the polygon size using an arbitrary number.
'This number will be increased dynamically.
Me![LEAD1].Object.PolygonSize = 5

'Fill in the array for the polygon. This simulates a user's mouse clicks.
For i = 0 To 7
    CurrentX = CurrentX + (xPoint(i) * OffsetX)
    CurrentY = CurrentY + (yPoint(i) * OffsetY)
    Me![LEAD1].Object.PolygonX(i) = (CurrentX / ZoomFactorX) - (Me![LEAD1].Object.DstLeft / ZoomFactorX) + Me![LEAD1].Object.SrcLeft
    Me![LEAD1].Object.PolygonY(i) = (CurrentY / ZoomFactorY) - (Me![LEAD1].Object.DstTop / ZoomFactorY) + Me![LEAD1].Object.SrcTop
    If i + 1 = Me![LEAD1].Object.PolygonSize Then
        Me![LEAD1].Object.PolygonSize = Me![LEAD1].Object.PolygonSize + 5
    End If
Next

'Adjust the polygon size to the actual number of points.
Me![LEAD1].Object.PolygonSize = i

'Add the polygonal region, using a Boolean OR,
'and display a message so that we can see what happened.
Me![LEAD1].Object.SetRgnPolygon L_POLY_WINDING, L_RGN_OR
MsgBox "Here is the added polygon, with a Boolean OR"

'Fill the resulting polygon with red, and display a message.
Me![LEAD1].Object.Fill RGB(255, 0, 0)
Me![LEAD1].Object.RgnFrameType = RGNFRAME_NONE
Me![LEAD1].Object.ForceRepaint
MsgBox "Using SetRgnColor and L_RGN_SETNOT, all else will become blue."

'Clean up memory
Me![LEAD1].Object.FreeRgn

'Do the final region.
Me![LEAD1].Object.SetRgnColor RGB(255, 0, 0), L_RGN_SETNOT
Me![LEAD1].Object.Fill RGB(0, 0, 255)
Me![LEAD1].Object.ForceRepaint

'Clean up memory
Me![LEAD1].Object.FreeRgn
Me![LEAD1].Object.PolygonSize = 0


SetSrcClipRect example for Access 2.0

This example crops the image by reducing the source clipping area and repaints the image.

OldLeft = Me![LEAD1].Object.SrcClipLeft
OldTop = Me![LEAD1].Object.SrcClipTop
OldWidth = Me![LEAD1].Object.SrcClipWidth
OldHeight = Me![LEAD1].Object.SrcClipHeight
NewLeft = OldLeft + (OldWidth * .1)
NewTop = OldTop + (OldHeight * .1)
NewWidth = OldWidth * .8
NewHeight = OldHeight * .8
If (NewWidth > 1) AND (NewHeight >1) Then
   Me![LEAD1].Object.SetSrcClipRect NewLeft, NewTop, NewWidth, NewHeight
End If
Me![LEAD1].Object.ForceRepaint


SetSrcRect example for Access 2.0

This example zooms in on the image by reducing the source rectangle and repaints the image.

OldLeft = Me![LEAD1].Object.SrcLeft
OldTop = Me![LEAD1].Object.SrcTop
OldWidth = Me![LEAD1].Object.SrcWidth
OldHeight = Me![LEAD1].Object.SrcHeight
NewLeft = OldLeft + OldWidth * .1
NewTop = OldTop + OldHeight * .1
NewWidth = OldWidth * .8
NewHeight = OldHeight * .8
If (NewWidth > 1) AND (NewHeight >1) Then
   Me![LEAD1].Object.SetSrcRect NewLeft, NewTop, NewWidth, NewHeight
End If
Me![LEAD1].Object.ForceRepaint


ShadowColor example for Access 2.0

This example shows how to draw a shape with a drop shadow.

Me![LEAD1].Object.AutoRepaint = False

'Load an image for the main control
Me![LEAD1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1

'Shape background
Me![LEAD1].Object.ShapeBackgroundStyle = EFX_BACKSTYLE_TRANSPARENT

'Shape location
Me![LEAD1].Object.ShapeTop = 50
Me![LEAD1].Object.ShapeLeft = 50
Me![LEAD1].Object.ShapeWidth = Me![LEAD1].Object.DstWidth - 50
Me![LEAD1].Object.ShapeHeight = Me![LEAD1].Object.DstHeight - 50

'Shape border
Me![LEAD1].Object.ShapeBorderColor = RGB(255, 0, 0)
Me![LEAD1].Object.ShapeBorderStyle = EFX_BORDERSTYLE_SOLID
Me![LEAD1].Object.ShapeBorderThickness = 10

Me![LEAD1].Object.ShapeOuterBandHiliteColor = RGB(0, 255, 0)
Me![LEAD1].Object.ShapeOuterBandShadowColor = RGB(128, 128, 128)
Me![LEAD1].Object.ShapeOuterBandStyle = EFX_OUTERSTYLE_RAISED
Me![LEAD1].Object.ShapeOuterBandThickness = 2

'Make the shape a permanent part of the bitmap
Me![LEAD1].Object.DrawPersistence = True

Me![LEAD1].Object.PatternStyle = EFX_PATTERN_TRANSPARENT

'Shadow settings
Me![LEAD1].Object.ShadowXDepth = 10
Me![LEAD1].Object.ShadowYDepth = 10
Me![LEAD1].Object.ShadowColor = RGB(0, 0, 0)

'Draw the shape
Me![LEAD1].Object.DrawShape EFX_SHAPE_RECTANGLE, Me![LEAD2].Object.Bitmap

'Repaint
Me![LEAD1].Object.ForceRepaint


Sharpen example for Access 2.0

This example increases the sharpness of the bitmap and redisplays the image.

Me![LEAD1].Object.Sharpen 100
Me![LEAD1].Object.ForceRepaint


Shear example for Access 2.0

This example shears the bitmap 5 degrees horizontally and redisplays the image. It uses blue as the fill color.

Me![LEAD1].Object.Shear 500, TRUE, RGB(0,0,255)
Me![LEAD1].Object.ForceRepaint


Solarize example for Access 2.0

This example applies a solarize effect and repaints the image.

Me![LEAD1].Object.Solarize 100
Me![LEAD1].Object.ForceRePaint


SpatialFilter example for Access 2.0

This example applies Laplacian line detection and redisplays the image.

Me![LEAD1].Object.SpatialFilter FLT_LAPLACE_1
Me![LEAD1].Object.ForceRepaint


Src... example for Access 2.0

This example uses the source rectangle properties to zoom in on the image.

'Calculate the values to zoom in by 10 percent and center the image.
If (Me![LEAD1].Object.SrcWidth > 1) And (Me![LEAD1].Object.SrcHeight > 1) Then
  Me![LEAD1].Object.SrcWidth = Me![LEAD1].Object.SrcWidth * 0.9
  Me![LEAD1].Object.SrcHeight = Me![LEAD1].Object.SrcHeight * 0.9
  Me![LEAD1].Object.SrcTop = (Me![LEAD1].Object.BitmapHeight - Me![LEAD1].Object.SrcHeight) / 2
  Me![LEAD1].Object.SrcLeft = (Me![LEAD1].Object.BitmapWidth - Me![LEAD1].Object.SrcWidth) / 2
End If

'Set the clipping area to the same as the destination rectangle
Me![LEAD1].Object.SrcClipWidth = Me![LEAD1].Object.SrcWidth
Me![LEAD1].Object.SrcClipHeight = Me![LEAD1].Object.SrcHeight
Me![LEAD1].Object.SrcClipTop = Me![LEAD1].Object.SrcTop
Me![LEAD1].Object.SrcClipLeft = Me![LEAD1].Object.SrcLeft

'Redisplay the image
Me![LEAD1].Object.ForceRepaint


StretchIntensity example for Access 2.0

This example stretches the intensity and redisplays the image.

Me![LEAD1].Object.StretchIntensity
Me![LEAD1].Object.ForceRepaint


TransitionEffect example for Access 2.0

This example paints a transition with a 255-step grayscale gradient.

Me![LEAD1].Object.AutoRepaint = False
Me![LEAD1].Object.Load "c:\lead\images\image1.cmp", 0, 0, 1
Me![LEAD1].Object.TransitionEffect = EFX_EFFECT_WIPE_RECTANGLE_OUT
Me![LEAD1].Object.TransitionStyle = EFX_TRANSITION_GRADIENT
Me![LEAD1].Object.GradientStyle = EFX_GRADIENT_ANGLE_TO_LT
Me![LEAD1].Object.GradientEndColor = RGB(0, 0, 0)
Me![LEAD1].Object.GradientStartColor = RGB(255, 255, 255)
Me![LEAD1].Object.GradientSteps = 255
Me![LEAD1].Object.ForceRepaint


TransparentColor example for Access 2.0

This example sets white as a transparent color; then loads a test image and paints it.

Me![LEAD1].Object.AutoRepaint = False

'Enable transparency
Me![LEAD1].Object.BitmapEnableTransparency = True

'Make black the transparent color
Me![LEAD1].Object.BitmapTransparentColor = RGB(0, 0, 0)
Me![LEAD1].Object.Load "d:\temp\ctest.bmp", 0, 0, 1
Me![LEAD1].Object.ForceRepaint


Trim example for Access 2.0

This example trims one-tenth from the bitmap and repaints the image.

NewLeft = Me![LEAD1].Object.BitmapWidth * .1
NewTop = Me![LEAD1].Object.BitmapHeight * .1
NewWidth = Me![LEAD1].Object.BitmapWidth * .8
NewHeight = Me![LEAD1].Object.BitmapHeight * .8
Me![LEAD1].Object.Trim NewLeft, NewTop, NewWidth, NewHeight

' Set variables for the position and size of the display rectangle.
ViewWidth = Me![LEAD1].Object.ScaleWidth
ViewHeight = Me![LEAD1].Object.ScaleHeight

' Set the image display size to match the LEAD control
Me![LEAD1].Object.SetDstRect 0, 0, ViewWidth, ViewHeight
Me![LEAD1].Object.SetDstClipRect 0, 0, ViewWidth, ViewHeight
Me![LEAD1].Object.ForceRepaint


Underlay example for Access 2.0

This example loads a bitmap into Lead2 and uses it as a tiled underlay for Lead1.

Me![LEAD2].Visible = False
Me![LEAD2].Object.Load "c:\lead\images\ulay1.bmp", 0, 0, 1
Me![LEAD1].Object.Underlay Lead2.Object.Bitmap, UNDERLAY_TILE
Me![LEAD1].Object.ForceRepaint


UserPalette and BitmapPalette example for Access 2.0

This example demonstrates the UserPalette and BitmapPalette properties.

'Specify a blue and white user palette
Lead1.Object.UserPalette(0) = RGB(0, 0, 255)
Lead1.Object.UserPalette(1) = RGB(255, 255, 255)

'Implement the user palette
Lead1.Object.ColorRes 1, CRP_USERPALETTE, CRD_ORDEREDDITHERING, 2

'Display the blue and white image
Lead1.Object.ForceRepaint
MsgBox "This is the user palette. Click OK to change the bitmap palette."

'Change the bitmap palette to red and white
Lead1.Object.BitmapPalette(0) = RGB(255, 0, 0)
Lead1.Object.BitmapPalette(1) = RGB(255, 255, 255)

'Display the red and white image
Lead1.Object.ForceRepaint


Version... example for Access 2.0

This example puts the version information into a string and displays the string in a message box.

If Me![LEAD1].Object.VersionLevel = VERSIONLEVEL_EXP Then
    LevelStr = "Document/Medical "
Else
    LevelStr = "Professional Edition"
End If

cMsg = Me![LEAD1].Object.VersionProduct + Chr(13) + LevelStr + Chr(13)
cMsg = cMsg + "Version: " + CStr(Me![LEAD1].Object.VersionMajor) + "."
cMsg = cMsg + CStr(Me![LEAD1].Object.VersionMinor) + Chr(13)
cMsg = cMsg + "Date produced: " + Me![LEAD1].Object.VersionDate + Chr(13)
cMsg = cMsg + "Time produced: " + Me![LEAD1].Object.VersionTime + Chr(13)
' Display the message box
MsgBox cMsg, 0, "Version Info"


WindowLevel example for Access 2.0

This example converts a bitmap to 12-bit grayscale and then performs window leveling on the four most significant bits of the image.

    Me![LEAD1].Object.Grayscale 12    'Grayscale image to 12-bit

    Me![LEAD1].Object.LevelLowBit = 8 ' use 4 most significant bits

    Me![LEAD1].Object.LevelHighBit = 11

    Me![LEAD1].Object.WindowLevel


ZoomIn example for Access 2.0

This example calls ZoomIn() method to zoom in on a captured image.

Me![LEAD1].Object.ZoomIn


ZoomInDone example for Access 2.0

This example triggers the ZoomInDone event and displays a message that the ZoomIn image has been captured.

           Sub Lead1_ZoomInDone (x As Long, y As Long)
              MsgBox "ZoomIn Captured: " & Str(x) & "," & Str(y)
           End Sub


Installation Directory

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation.

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

The following is a list of the subdirectories in the root directory:

BIN	Executable files for the demonstration programs.

HELP	Online help files.

IMAGES	Sample images and databases containing images.

EXAMPLES\DLL	One subdirectory for each example API program.

EXAMPLES\OCX	One subdirectory for each example ActiveX program.

EXAMPLES\CLASSLIB	One subdirectory for each example Class Library program.

EXAMPLES\RES	Resource files for the example programs.

INCLUDE	Header files, BAS files, and the ActiveX's MFC interface files for versions of Visual C++ earlier than 4.0.

INCLUDE\CLASSLIB	Header files for the Class Library

LIB	Library files.

REDIST	Redistributable files. These are copies of the LEADTOOLS files and other files that you may need to distribute with your application. For exact information about required files, refer to Files To Be Included With Your Application.

REDIST\NONAGLTKRN	This directory contains the LTKRN DLL that must be distributed with your application.


Flags for the Combine Method

The following are the flags that define treatment of the source rectangle:

Value	Meaning

CB_SRC_NOP	No change.

CB_SRC_NOT	Invert the color, resulting in its complement.

CB_SRC_0	Change all bits to 0.

CB_SRC_1	Change all bits to 1.

The following are the flags that define treatment of the destination rectangle:

Value	Meaning

CB_DST_NOP	No change.

CB_DST_NOT	Invert the color, resulting in its complement.

CB_DST_0	Change all bits to 0.

CB_DST_1	Change all bits to 1.

The following are the flags that define the operation to use when combining the data:

Value	Meaning

CB_OP_AND	Combine each set of bytes using a bitwise AND (&).

CB_OP_OR	Combine each set of bytes using a bitwise OR ( | ).

CB_OP_XOR	Combine each set of bytes using a bitwise exclusive OR (^).

CB_OP_ADD	Add the byte values, allowing a maximum of 255.

CB_OP_SUBSRC	Subtract the source from the destination, allowing a minimum of 0.

CB_OP_SUBDST	Subtract the destination from the source, allowing a minimum of 0.

CB_OP_MUL	Multiply the byte values, allowing a maximum of 255. The result is calculated as follows: result = (source * dest) / 255.

CB_OP_DIVSRC	Divide the destination by the source. If source > 0, then the result is calculated as follows: result = min( (dest / source) * 255, 255 ). Otherwise, if source = 0, then result = 255.

CB_OP_DIVDST	Divide the source by the destination. If dest > 0, then the result is calculated as follows: result = min( (source / dest) * 255, 255 ). Otherwise, if dest = 0, then result = 255.

CB_OP_AVG 	Use the average of the two values.

CB_OP_MIN  	Use the lesser of the two values.

CB_OP_MAX 	Use the greater of the two values.

The following are the flags that define treatment of the resulting image rectangle:

Value	Meaning

CB_RES_NOP	No change.

CB_RES_NOT	Invert the color, resulting in its complement.

CB_RES_0	Change all bits to 0.

CB_RES_1	Change all bits to 1.


Flags for the CombineExt Method

Flags for the CombineExt method

Note:	Arithmetic calculations in this table assume 24-bit image data.

The following are the flags that define treatment of the source rectangle:

Value	Meaning

CB_SRC_NOP	[0x00000000] No change.

CB_SRC_NOT	[0x00000001] Invert the color, resulting in its complement.

CB_SRC_0	[0x00000002] Change all bits to 0.

CB_SRC_1	[0x00000003] Change all bits to 1.

The following are the flags that define treatment of the destination rectangle:

Value	Meaning

CB_DST_NOP	[0x00000000] No change.

CB_DST_NOT	[0x00000010] Invert the color, resulting in its complement.

CB_DST_0	[0x00000020] Change all bits to 0.

CB_DST_1	[0x00000030] Change all bits to 1.

The following are the flags that define the operation to use when combining the data:

Value	Meaning

CB_OP_AND	[0x00000000] Combine each set of bytes using a bitwise AND (&).

CB_OP_OR	[0x00000100] Combine each set of bytes using a bitwise OR ( | ).

CB_OP_XOR	[0x00000200] Combine each set of bytes using a bitwise exclusive OR (^).

CB_OP_ADD	[0x00000300] Add the byte values, allowing a maximum of 255.

CB_OP_SUBSRC	[0x00000400] Subtract the source from the destination, allowing a minimum of 0.

CB_OP_SUBDST	[0x00000500] Subtract the destination from the source, allowing a minimum of 0.

CB_OP_MUL	[0x00000600] Multiply the byte values, allowing a maximum of 255. The result is calculated as follows: result = (source * dest) / 255.

CB_OP_DIVSRC	[0x00000700] Divide the destination by the source. If source > 0, then the result is calculated as follows: result = min( (dest / source) * 255, 255 ). Otherwise, if source = 0, then result = 255.

CB_OP_DIVDST	[0x00000800] Divide the source by the destination. If dest > 0, then the result is calculated as follows: result = min( (source / dest) * 255, 255 ). Otherwise, if dest = 0, then result = 255.

CB_OP_AVG	[0x00000900] Use the average of the two values.

CB_OP_MIN	[0x00000A00] Use the lesser of the two values.

CB_OP_MAX	[0x00000B00] Use the greater of the two values.

The following are the flags that define treatment of the resulting image rectangle:

Value	Meaning

CB_RES_NOP	[0x00000000] No change.

CB_RES_NOT	[0x00001000] Invert the color, resulting in its complement.

CB_RES_0	[0x00002000] Change all bits to 0.

CB_RES_1	[0x00003000] Change all bits to 1.

The following are the flags that define the channel of the source image rectangle:

Value	Meaning

CB_SRC_MASTER	[0x00000000] perform operation on all Channels.

CB_SRC_RED	[0x00010000] perform operation on Red Channel.

CB_SRC_GREEN	[0x00020000] perform operation on Green Channel.

CB_SRC_BLUE	[0x00030000] perform operation on Blue Channel.

The following are the flags that define the channel of the destination image rectangle:

Value	Meaning

CB_DST_MASTER	[0x00000000] perform operation on all Channels.

CB_DST_RED	[0x00100000] perform operation on Red Channel.

CB_DST_GREEN	[0x00200000] perform operation on Green Channel.

CB_DST_BLUE	[0x00300000] perform operation on Blue Channel.

The following are the flags that define the channel of the resulting image rectangle:

Value	Meaning

CB_RES_MASTER	[0x00000000] perform operation on all Channels.

CB_RES_RED	[0x00100000] perform operation on Red Channel.

CB_RES_GREEN	[0x00200000] perform operation on Green Channel.

CB_RES_BLUE	[0x00300000] perform operation on Blue Channel.


Formats of Output Files

The following are valid values to specify the format of an output file. For more general descriptions of file formats, refer to Summary of All Supported Image File Formats.

JPEG and LEAD Compressed

FILE_CMP	LEAD Proprietary Compression Format. Bits per pixel: 8 for grayscale, 24 for color.

FILE_JPEG	JPEG File Interchange Format with YUV 4:4:4 color space and Lossless. Bits per pixel: 8, 12, and 16 for grayscale, 24 for color.

FILE_JPEG_422	JPEG File Interchange Format with YUV 4:2:2 color space. Bits per pixel: 8 for grayscale, 24 for color.

FILE_JPEG_411	JPEG File Interchange Format with YUV 4:1:1 color space. Bits per pixel: 8 for grayscale, 24 for color.

FILE_TIF_JPEG	Tagged Image File with JPEG compression and YUV 4:4:4 color space and Lossless. Bits per pixel: 8, 12, and 16 for grayscale, 24 for color.

FILE_TIF_JPEG_422	Tagged Image File with JPEG compression and YUV 4:2:2 color space. Bits per pixel: 8 for grayscale, 24 for color.

FILE_TIF_JPEG_411	Tagged Image File with JPEG compression and YUV 4:1:1 color space. Bits per pixel: 8 for grayscale, 24 for color.

FILE_JP2	JPEG 2000 Format.  This file format contains image data and extra information about the contents and organization of the file.  Bits per pixel: 8 for grayscale, 24 for color.

FILE_J2K	JPEG 2000 Format.  This file format contains only a stream of image data.  Bits per pixel: 8, 12, and 16 for grayscale, 24 for color.  (12 and 16-bit grayscale support available in Document/Medical Imaging toolkits only) J2K support required for this format.

FILE_CMW	LEAD Wavelet CMP Format. Bits per pixel: 8, 12, and 16 for grayscale, 24 for color. CMW support required for this format.

FILE_JPEG_LAB	JPEG File Interchange Format with CieLAB 4:4:4 color space and Lossless.

FILE_JPEG_LAB_422	JPEG File Interchange Format with CieLAB 4:2:2 color space.

FILE_JPEG_LAB_411	JPEG File Interchange Format with CieLAB 4:1:1 color space.

GIF and TIFF with LZW Compression

FILE_GIF	CompuServe GIF. Bits per pixel: 1, 2, 3, 4, 5, 6, 7, 8.

FILE_TIFLZW	Tagged Image File with LZW Compression and RGB color space. Bits per pixel: 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32, 48, 64. (Supports multi-page)

FILE_TIFLZW_CMYK	Tagged Image File with LZW Compression and CMYK color space. Bits per pixel: 24, 32. (Supports multi-page)

FILE_TIFLZW_YCC	Tagged Image File with LZW Compression and YCbCr color space. Bits per pixel: 24. (Supports multi-page)

TIFF Without LZW Compression

FILE_TIF	Tagged Image File Format, with no compresssion and with RGB color space. Bits per pixel: 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32, 48, 64. (12 and 16-bit grayscale Document/Medical Imaging editions only) (Supports multi-page)

FILE_TIF_CMYK	Tagged Image File, with no compresssion and with CMYK color space. Bits per pixel: 24, 32. (Supports multi-page)

FILE_TIF_YCC	Tagged Image File, with no compresssion and with YCbCr color space. Bits per pixel: 24. (Supports multi-page)

FILE_TIF_PACKBITS	Tagged Image File with PackBits Compression and RGB color space. Bits per pixel: 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32. (Supports multi-page)

FILE_TIF_PACKBITS_CMYK	Tagged Image File with PackBits Compression and CMYK color space. Bits per pixel: 24, 32. (Supports multi-page)

FILE_TIF_PACKBITS_YCC	Tagged Image File with PackBits Compression and YCbCr color space. Bits per pixel: 24. (Supports multi-page)

FILE_TIF_CMP	Tagged Image File with CMP Compression. Bits per pixel: 8 grayscale and 24 color. (Supports multi-page)

FILE_TIF_JBIG	Tagged Image File with JBIG Compression. Bits per pixel: 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32. (Supports multi-page)

FILE_TIF_DXF	Tagged Image File with a vector image saved as a DXF. Bits per pixel: 8.

FILE_TIF_J2K	Tagged Image File with JPEG 2000 Compression. This file format contains only a stream of image data. Bits per pixel: 8, 12, and 16 for grayscale, 24 for color.  (12 and 16-bit grayscale support available in Document/Medical Imaging editions only) (Supports multi-page) J2K support required for this format.

FILE_TIF_LMC	Tagged Image File with LMC compression. (Supports multi-page). LMC support is required for this format.

FILE_TIF_CMW	Tagged Image File with Wavelet CMP Compression. Bits per pixel: 8, 12, and 16 for grayscale, 24 for color. (Supports multi-page) CMW support required for this format.

BMP Formats

FILE_BMP	Windows BMP, with no compression. Bits per pixel: 1, 4, 8, 16, 24, 32.

FILE_BMP_RLE	Windows BMP, with RLE compression. Bits per pixel: 4, 8.

FILE_OS2	OS/2 BMP version 1.x. Bits per pixel: 1, 4, 8, 24.

FILE_OS2_2	OS/2 BMP version 2.x. Bits per pixel: 1, 4, 8, 24.

Icons and Cursors

FILE_WIN_ICO	Windows icon file. Supports multi-page. Bits per pixel: 1, 4, 8, 24.

FILE_WIN_CUR	Windows cursor file. . Supports multi-page. Bits per pixel: 1, 4, 8, 24.

FILE_ANI	Windows Animated Cursor. Bits per pixel: 1, 4, 8, 24.

Kodak Formats

FILE_FPX	FlashPix, with no compression. Bits per pixel: 8 for grayscale, 24 for color.

FILE_FPX_SINGLE_COLOR	FlashPix, compressed with the single color method. Bits per pixel: 8 for grayscale, 24 for color.

FILE_FPX_JPEG	FlashPix, compressed with JPEG, using the default Q factor. Bits per pixel: 8 for grayscale, 24 for color.

FILE_FPX_JPEG_QFACTOR	FlashPix, compressed with JPEG, using a specified Q factor. Bits per pixel: 8 for grayscale, 24 for color.

Vector Formats

FILE_DXF	AutoCad. Bits per pixel: 8.    (For information on file format support, see Drawing Interchange Format (DXF))

FILE_DXF_R12	This is the same as FILE_DXF.

FILE_DXF_R13	AutoCad (Release 13). Bits per pixel: 8. (For information on file format support, see Drawing Interchange Format (DXF)).

FILE_TIF_DXF	Tagged Image File with a vector image saved as a DXF. Bits per pixel: 8.  (For information on file format support, see Drawing Interchange Format (DXF))

FILE_DRW	DRaWing – Micrografx Designer. Bits per pixel: 24    (For information on file format support, see DRaWing (DRW))

FILE_CGM	Computer Graphics Metafile. Bits per pixel: 24    (For information on file format support, see Computer Graphics Metafile (CGM))

FILE_PCT	Macintosh QuickDraw. Bits per pixel: 24.    (For information on file format support, see Macintosh Pict Format (PCT))

FILE_PLT	HPGL – Hewlett-Packard. Bits per pixel: 4.    (For information on file format support, see PLT (PLT))

FILE_WMF	Windows Meta File. Bits per pixel: 8, 24. (For information on file format support, see Windows Metafile Formats (WMF/EMF))

FILE_EMF	Windows Enhanced Meta File. Bits per pixel:8, 24. (For information on file format support, see Windows Metafile Formats (WMF/EMF))

FILE_DWF	DWF-AutoCAD.  For more information on file format support, see DWF Format(DWF).

FILE_GERBER	Gerber. Bits per pixel: 24. (For more information on the file format support, see Gerber Format (GBR).

FILE_WBMP	Wireless Bitmap file. Type 0. Bits per pixel: 1.

FILE_PCL	Printer Command Language – Hewlett-Packard.

FILE_SHP	ESRI Shape – Environmental System Research Institute. (For information on file format support, see ESRI Shape Format (SHP) ). Bits per pixel: 24.

FILE_SVG	Scalable Vector Graphics Format (SVG). Bits per pixel: 24. (For more information on the file format support, see Scalable Vector Graphics Format (SVG).

FILE_SVG_EMBED_IMAGES	Scalable Vector Graphics Format (SVG). Bits per pixel: 24. When saving SVG files using FILE_SVG_EMBED_IMAGES, the images are embedded inside the SVG file. The file in this case becomes larger, but is more portable. It can be moved itself, without worrying about also moving external images. (For more information on the file format support, see Scalable Vector Graphics Format (SVG)).

Exif Formats

FILE_EXIF	Exif file containing a TIFF image, with no compresssion and with RGB color space. Bits per pixel: 24.

FILE_EXIF_YCC	Exif file containing a TIFF image, with no compresssion and with YCbCr color space. Bits per pixel: 24.

FILE_EXIF_JPEG	Exif file containing a JPEG compressed image. Bits per pixel: 24 (color only).

FILE_EXIF_JPEG_411	Exif 2.0 file containing a JPEG compressed image. Bits per pixel: 24 (color only).

DICOM Formats

FILE_DICOM_GRAY	DICOM grayscale. Bits per pixel: 8, 16.

FILE_DICOM_COLOR	DICOM color (RGB). Bits per pixel: 8, 24.

FILE_DICOM_RLE_GRAY	DICOM grayscale – RLE compressed. Bits per pixel: 8, 16.

FILE_DICOM_RLE_COLOR	DICOM color – RLE compressed. Bits per pixel: 8, 24.

FILE_DICOM_JPEG_GRAY	DICOM gray – JPEG compressed. Bits per pixel: 8, 16.

FILE_DICOM_JPEG_COLOR	DICOM color – JPEG compressed. Bits per pixel: 8, 24.

Other Color Formats

FILE_PCX	ZSoft PCX. Bits per pixel: 1, 4, 8, 24.

FILE_WMF	Windows Meta File. Bits per pixel: 8, 24.

FILE_EMF	Windows Enhanced Meta File. Bits per pixel:8, 24.

FILE_XPM	XPicmap File. Bits per pixel: 8, 16, 24, 32.

FILE_IFF_ILBM	Interchange File - RLE compressed. Bits per pixel: 1 - 8, 24.

FILE_IFF_ILBM_UNCOMPRESSED	Interchange File - Uncompressed. Bits per pixel: 1 - 8, 24.

FILE_IFF_CAT	Interchange File - multiple images per file-RLE Compressed. (Supports multi-page.) Bits per pixel: 1 - 8, 24.

FILE_IFF_CAT_UNCOMPRESSED	Interchange File - multiple images per file-Uncompressed. Bits per pixel: 1 - 8, 24.

FILE_PGM_ASCII	Portable Greymap - ASCII File. Bits per pixel: 8 (greyscale).

FILE_PGM_BINARY	Portable Greymap - Binary File. Bits per pixel: 8 (greyscale).

FILE_PPM_ASCII	Portable Pixelmap - ASCII File. Bits per pixel: 24 (True color).

FILE_PPM_BINARY	Portable Pixelmap - Binary File. Bits per pixel: 24 (True color).

FILE_CUT	Dr. Halo. Bits per pixel: 8.

FILE_PSD	Adobe Photoshop 3.0. Bits per pixel: 1, 8, 24.

FILE_PNG	Portable Network Graphics. Bits per pixel: 1, 4, 8, 24, 32.

FILE_TGA	TARGA. Bits per pixel: 8, 16, 24, 32.

FILE_TGA_RLE	TARGA with RLE compression. Bits per pixel: 8, 16, 24, 32.

FILE_EPS	Encapsulated PostScript. Bits per pixel: 8 grayscale (raster).

FILE_RAS	Sun Raster. Bits per pixel: 1, 4, 8, 24, 32.

FILE_WPG	Word Perfect. Bits per pixel: 1, 4, 8 (raster).

FILE_PCT	MacPict. Bits per pixel: 1, 4, 8, 24.

FILE_AVI	Windows AVI. Bits per pixel: 24.

FILE_JBIG	JBIG. Bits per pixel: 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32.

FILE_CLP	Microsoft Windows Clipboard. Bits per pixel:1, 4, 8, 24.

FILE_XWD10	X Window Dump – version 10. Bits per pixel: 1, 4, 8.

FILE_XWD11	X Window Dump – version 11. Bits per pixel: 1, 4, 8, 16, 24, 32.

FILE_FLC	Flic Animation. Bits per pixel: 8.

FILE_SGI	Silicon Graphics Image. Bits per pixel: 8, 24, 32.

FILE_SGI_RLE	Silicon Graphics Image. Bits per pixel: 8, 24, 32.

FILE_RAW	Raw uncompressed data.

FILE_SCT	Scitex Continuous Tone format. Bits per pixel: 24.

PDF Formats

FILE_RAS_PDF	Raster PDF uncompressed. Bits per pixel:1,2,4,8, 24.

FILE_RAS_PDF_G3_1D	Raster PDF compressed using CCITT group 3, 1 dimension. Bits per pixel: 1.

FILE_RAS_PDF_G3_2D	Raster PDF compressed using CCITT group 3, 2 dimension. Bits per pixel: 1.

FILE_RAS_PDF_G4	Raster PDF compressed using CCITT group 4. Bits per pixel: 1.

FILE_RAS_PDF_LZW	Raster PDF with LZW compression and RGB color space. Bits per pixel: 1, 2, 4, 8, and 24.

FILE_RAS_PDF_JPEG	Raster PDF with JPEG compression and YUV 4:4:4 color space Lossless. Bits per pixel: 8 for grayscale, 24 for color.

FILE_RAS_PDF_JPEG_422	Raster PDF with JPEG compression and YUV 4:2:2 color space. Bits per pixel: 8 for grayscale, 24 for color.

FILE_RAS_PDF_JPEG_411	Raster PDF with JPEG compression and YUV 4:1:1 color space. Bits per pixel: 8 for grayscale, 24 for color.

1-Bit FAX Formats

FILE_LEAD1BIT	LEAD Proprietary 1-bit Compression Format.

FILE_CCITT	TIFF, compressed using CCITT. (Supports multi-page)

FILE_CCITT_GROUP3_1DIM	TIFF, compressed using CCITT, group 3, 1 dimension. (Supports multi-page)

FILE_CCITT_GROUP3_2DIM	TIFF, compressed using CCITT, group 3, 2 dimensions. (Supports multi-page)

FILE_CCITT_GROUP4	TIFF, compressed using CCITT, group 4. (Supports multi-page)

FILE_FAX_G3_1D	Raw FAX, compressed using CCITT group 3, 1 dimension.

FILE_FAX_G3_2D	Raw FAX, compressed using CCITT group 3, 2 dimensions.

FILE_FAX_G4	Raw FAX, compressed using CCITT group 4.

FILE_WFX_G3_1D	Winfax, compressed using CCITT group 3, 1 dimension.

FILE_WFX_G4	Winfax, compressed using CCITT group 4.

FILE_ICA_G3_1D	IOCA, compressed using CCITT group 3, 1 dimension, with the MO:DCA wrapper.

FILE_ICA_G3_2D	IOCA, compressed using CCITT group 3, 2 dimensions, with the MO:DCA wrapper.

FILE_ICA_G4	IOCA, compressed using CCITT group 4, with the MO:DCA wrapper.

FILE_RAWICA_G3_1D	IOCA, compressed using CCITT  group 3, 1 dimension, without the MO:DCA wrapper.

FILE_RAWICA_G3_2D	IOCA, compressed using CCITT  group 3, 2 dimensions, without the MO:DCA wrapper.

FILE_RAWICA_G4	IOCA, compressed using CCITT group 4, without the MO:DCA wrapper.

FILE_CALS	CALS Raster file.

FILE_CALS2	CALS CCITT G4 compressed.

FILE_CALS3	CALS Fax Group 4 compressed.

FILE_CALS4	CALS CCITT G4 Tiled.

FILE_AWD	Microsoft FAX format.

FILE_ICA_IBM_MMR	IOCA, compressed using IBM MMR, with the MO:DCA wrapper.

FILE_ICA_UNCOMPRESSED	IOCA, uncompressed, with the MO:DCA wrapper.

FILE_RAWICA_IBM_MMR	IOCA, compressed using IBM MMR, without the MO:DCA wrapper.

FILE_RAWICA_UNCOMPRESSED	IOCA, uncompressed, without the MO:DCA wrapper.

Other 1-Bit Formats

FILE_MAC	MacPaint.

FILE_MSP	Microsoft Paint.

FILE_PBM_ASCII	Portable Bitmap - ASCII File.

FILE_PBM_BINARY	Portable Bitmap - Binary File.

FILE_IMG	GEM Image.

FILE_INTERGRAPH_RLE	ITG Intergraph RLE compressed file

FILE_LMC	LMC File. LMC support is required for this format.

FILE_SMP	Xionics format.

FILE_SMP_G3_1D	Xionics format, compressed using CCITT Group 3 1D.

FILE_SMP_G3_2D	Xionics format, compressed using CCITT Group 3 2D.

FILE_SMP_G4	Xionics format, compressed using CCITT Group 4.


Formats of Input Files

The following are possible values for the format parameter of the GetFileInfo method. For more general descriptions of file formats, refer to Summary of All Supported Image File Formats.

JPEG and LEAD Compressed

FILE_CMP	LEAD Proprietary Compression Format.

FILE_JPEG	JPEG File Interchange Format with YUV 4:4:4 color space and Lossless.

FILE_JPEG_422	JPEG File Interchange Format with YUV 4:2:2 color space.

FILE_JPEG_411	JPEG File Interchange Format with YUV 4:1:1 color space.

FILE_TIF_JPEG	Tagged Image File with JPEG compression and YUV 4:4:4 color space and Lossless.

FILE_TIF_JPEG_422	Tagged Image File with JPEG compression and YUV 4:2:2 color space.

FILE_TIF_JPEG_411	Tagged Image File with JPEG compression and YUV 4:1:1 color space.

FILE_JP2	JPEG 2000 Format.  This file format contains image data and extra information about the contents and organization of the file.

FILE_J2K	JPEG 2000 Format.  This file format contains only a stream of image data. J2K support required for this format.

FILE_CMW	LEAD Wavelet CMP Format. CMW support required for this format.

FILE_JPEG_LAB	JPEG File Interchange Format with CieLAB 4:4:4 color space and Lossless.

FILE_JPEG_LAB_422	JPEG File Interchange Format with CieLAB 4:2:2 color space.

FILE_JPEG_LAB_411	JPEG File Interchange Format with CieLAB 4:1:1 color space.

GIF and TIFF with LZW Compression

FILE_GIF	CompuServe GIF.

FILE_TIFLZW	Tagged Image File with LZW Compression and RGB color space. (Supports multi-page)

FILE_TIFLZW_CMYK	Tagged Image File with LZW Compression and CMYK color space. (Supports multi-page)

FILE_TIFLZW_YCC	Tagged Image File with LZW Compression and YCbCr color space. (Supports multi-page)

TIFF Without LZW Compression

FILE_TIF	Tagged Image File Format, with no compresssion and with RGB color space and 8-bit grayscale. (Supports multi-page)

FILE_TIF_CMYK	Tagged Image File, with no compresssion and with CMYK color space. (Supports multi-page)

FILE_TIF_YCC	Tagged Image File, with no compresssion and with YCbCr color space. (Supports multi-page)

FILE_TIF_PACKBITS	Tagged Image File with PackBits Compression and RGB color space. (Supports multi-page)

FILE_TIF_PACKBITS_CMYK	Tagged Image File with PackBits Compression and CMYK color space. (Supports multi-page)

FILE_TIF_PACKBITS_YCC	Tagged Image File with PackBits Compression and YCbCr color space. (Supports multi-page)

FILE_TIF_CMP	Tagged Image File with CMP Compression. (Supports multi-page)

FILE_TIF_JBIG	Tagged Image File with JBIG Compression. (Supports multi-page)

FILE_TIF_DXF	Tagged Image File with a vector image saved as a DXF.  (For information on file format support, see Drawing Interchange Format (DXF))

FILE_TIF_J2K	Tagged Image File with JPEG 2000 Compression. This file format contains only a stream of image data. (Supports multi-page) J2K support required for this format.

FILE_TIF_LMC	Tagged Image File with LMC compression. (Supports multi-page) LMC support is required for this format.

FILE_TIF_CMW	Tagged Image File with Wavelet CMP Compression. (Supports multi-page) CMWsupport required for this format.

BMP Formats

FILE_BMP	Windows BMP, with no compression.

FILE_BMP_RLE	Windows BMP, with RLE compression.

FILE_OS2	OS/2 BMP version 1.x.

FILE_OS2_2	OS/2 BMP version 2.x.

FILE_WBMP	Wireless Bitmap file. Type 0.

Icons and Cursors

FILE_WIN_ICO	Windows icon file. Including multi-page.

FILE_WIN_CUR	Windows cursor file. Including multi-page.

FILE_ANI	Windows Animated Cursor

Kodak Formats

FILE_PCD	Kodak PhotoCD.

FILE_FPX	FlashPix, with no compression.

FILE_FPX_SINGLE_COLOR	FlashPix, compressed with the single color method.

FILE_FPX_JPEG	FlashPix, compressed with JPEG, using the default Q factor.

FILE_FPX_JPEG_QFACTOR	FlashPix, compressed with JPEG, using a specified Q factor.

Vector Formats

FILE_DXF	AutoCad.  (For information on file format support, see Drawing Interchange Format (DXF))

FILE_DXF_R12	This is the same as FILE_DXF.

FILE_DXF_R13	AutoCad (Release 13). (For information on file format support, see Drawing Interchange Format (DXF)).

FILE_TIF_DXF	Tagged Image File with a vector image saved as a DXF.

FILE_DRW	DRaWing – Micrografx Designer    (For information on file format support, see DraWing (DRW))

FILE_CGM	Computer Graphics Metafile    (For information on file format support, see Computer Graphics Metafile (CGM))

FILE_PCT	Macintosh QuickDraw    (For information on file format support, see Macintosh Pict Format (PCT))

FILE_PLT	HPGL – Hewlett-Packard    (For information on file format support, see PLT (PLT))

FILE_INTERGRAPH_VECTOR	Intergraph MicroStation and Interactive Graphics Design. (For information on file format support, see DGN(DGN))

FILE_DWF	DWF – AutoCAD.  (For information on file format support, see DWF Format (DWF) ).

FILE_DWG	DWG - AutoCAD.  (For information on file format support, see DWG Format (DWG) ).

FILE_WMF	Windows Meta File. (For information on file format support, see Windows Metafile Formats (WMF/EMF))

FILE_EMF	Windows Enhanced Meta File. (For information on file format support, see Windows Metafile Formats (WMF/EMF))

FILE_GERBER	Gerber File. (For more information on the file format support, see Gerber Format (GBR).

FILE_SHP	ESRI Shape – Environmental System Research Institute.

FILE_PCL	Printer Command Language – Hewlett-Packard.

FILE_SVG	Scalable Vector Graphics Format (SVG). (For more information on the file format support, see Scalable Vector Graphics Format (SVG).

FILE_CMX	Corel Presentation Exchange Format (CMX). (For more information on the file format support, see Corel Presentation Exchange Format (CMX).

FILE_VWPG	Vector Word Perfect Graphics. For more information, refer to Word Perfect Graphics Format.

Exif Formats

FILE_EXIF	Exif file containing a TIFF image, with no compresssion and with RGB color space.

FILE_EXIF_YCC	Exif file containing a TIFF image, with no compresssion and with YCbCr color space.

FILE_EXIF_JPEG	Exif file containing a JPEG compressed image and YUV 4:2:2 color space.

FILE_EXIF_JPEG_411	Exif file containing a JPEG compressed image and YUV 4:1:1 color space.

DICOM Formats

FILE_DICOM_GRAY	DICOM grayscale.

FILE_DICOM_COLOR	DICOM color (RGB).

FILE_DICOM_RLE_GRAY	DICOM grayscale – RLE compressed.

FILE_DICOM_RLE_COLOR	DICOM color – RLE compressed.

FILE_DICOM_JPEG_GRAY	DICOM gray – JPEG compressed.

FILE_DICOM_JPEG_COLOR	DICOM color – JPEG compressed.

Other Color Formats

FILE_AVI	Windows AVI (video) file.

FILE_PCX	ZSoft PCX.

FILE_WMF	Windows Meta File.

FILE_EMF	Windows Enhanced Meta File.

FILE_XPM	XPicmap File.

FILE_IFF_ILBM	Interchange File - RLE Compressed.

FILE_IFF_ILBM_UNCOMPRESSED	Interchange File - Uncompressed.

FILE_IFF_CAT	Interchange File - multiple images per file-RLE Compressed. Supports multi-page.

FILE_IFF_CAT_UNCOMPRESSED	Interchange File - multiple images per file-Uncompressed.

FILE_PGM_ASCII	Portable Greymap - ASCII File.

FILE_PGM_BINARY	Portable Greymap - Binary File.

FILE_PPM_ASCII	Portable Pixelmap - ASCII File.

FILE_PPM_BINARY	Portable Pixelmap - Binary File.

FILE_CUT	Dr. Halo.

FILE_PSD	Adobe Photoshop 3.0.

FILE_PNG	Portable Network Graphics.

FILE_TGA	TARGA.

FILE_TGA_RLE	TARGA with RLE compression.

FILE_EPS	Encapsulated PostScript.

FILE_EPSTIFF	Encapsulated PostScript with an embedded TIFF file.

FILE_EPSWMF	Encapsulated PostScript with an embedded WMF file.

FILE_RAS	Sun Raster.

FILE_WPG	Word Perfect.

FILE_PCT	MacPict.

FILE_JBIG	JBIG

FILE_MPEG1	MPEG Type 1

FILE_MPEG2	MPEG Type 2

FILE_CLP	Microsoft Windows Clipboard

FILE_XWD10	X Window Dump – version 10

FILE_XWD11	X Window Dump – version 11

FILE_FLC	Flic Animation

FILE_FLI	Flic Animation

FILE_SGI	Silicon Graphics Image - Uncompressed.

FILE_SGI_RLE	Silicon Graphics Image - RLE Compressed.

FILE_RAW	Raw uncompressed data.

FILE_AFP	IBM. This format is part of IBM's document imaging system.

FILE_SCT	Scitex Continuous Tone format.

FILE_PTOCA	Presentation Text Object Content Architecture format.

PDF Formats

FILE_RAS_PDF	Raster PDF uncompressed.

FILE_RAS_PDF_LZW	Raster PDF with LZW compression and RGB color space.

FILE_POSTSCRIPT	PostScript Document

FILE_EPS	Encapsulated PostScript

FILE_EPSPOSTSCRIPT	Encapsulated PostScript

1-Bit FAX Formats

FILE_LEAD1BIT	LEAD Proprietary 1-bit Compression Format.

FILE_CCITT	TIFF, compressed using CCITT. (Supports multi-page)

FILE_CCITT_GROUP3_1DIM	TIFF, compressed using CCITT, group 3, 1 dimension. (Supports multi-page)

FILE_CCITT_GROUP3_2DIM	TIFF, compressed using CCITT, group 3, 2 dimensions. (Supports multi-page)

FILE_CCITT_GROUP4	TIFF, compressed using CCITT, group 4. (Supports multi-page)

FILE_FAX_G3_1D	Raw FAX, compressed using CCITT group 3, 1 dimension.

FILE_FAX_G3_2D	Raw FAX, compressed using CCITT group 3, 2 dimensions.

FILE_FAX_G4	Raw FAX, compressed using CCITT group 4.

FILE_WFX_G3_1D	Winfax, compressed using CCITT group 3, 1 dimension.

FILE_WFX_G4	Winfax, compressed using CCITT group 4.

FILE_ICA_G3_1D	IOCA, compressed using CCITT group 3, 1 dimension, with the MO:DCA wrapper.

FILE_ICA_G3_2D	IOCA, compressed using CCITT group 3, 2 dimensions, with the MO:DCA wrapper.

FILE_ICA_G4	IOCA, compressed using CCITT group 4, with the MO:DCA wrapper.

FILE_RAWICA_G3_1D	IOCA, compressed using CCITT  group 3, 1 dimension, without the MO:DCA wrapper.

FILE_RAWICA_G3_2D	IOCA, compressed using CCITT  group 3, 2 dimensions, without the MO:DCA wrapper.

FILE_RAWICA_G4	IOCA, compressed using CCITT group 4, without the MO:DCA wrapper.

FILE_CALS	CALS Raster file.

FILE_CALS2	CALS CCITT G4 compressed.

FILE_CALS3	CALS Fax Group 4 compressed.

FILE_CALS4	CALS CCITT G4 Tiled.

FILE_AWD	Microsoft FAX format.

FILE_LASERDATA	(Read only) 1-bit tiled fax images.

FILE_ICA_IBM_MMR	IOCA, compressed using IBM MMR, with the MO:DCA wrapper.

FILE_ICA_UNCOMPRESSED	IOCA, uncompressed, with the MO:DCA wrapper.

FILE_RAWICA_IBM_MMR	IOCA, compressed using IBM MMR, without the MO:DCA wrapper.

FILE_RAWICA_UNCOMPRESSED	IOCA, uncompressed, without the MO:DCA wrapper.

Other 1-Bit Formats

FILE_MAC	MacPaint.

FILE_PBM_ASCII	Portable Bitmap - ASCII File.

FILE_PBM_BINARY	Portable Bitmap - Binary File.

FILE_XBM	XBitmap File.

FILE_MSP	Microsoft Paint.

FILE_IMG	GEM Image.

FILE_INTERGRAPH_RLE	ITG, Intergraph RLE compressed file

FILE_LMC	LMC File. LMC support is required for this format.

FILE_WBMP	Wireless Bitmap file. Type 0.

FILE_SMP	Xionics format.

FILE_SMP_G3_1D	Xionics format, compressed using CCITT Group 3 1D.

FILE_SMP_G3_2D	Xionics format, compressed using CCITT Group 3 2D.

FILE_SMP_G4	Xionics format, compressed using CCITT Group 4.


ISIS Tags

These ISIS Scanner Driver Tags are used to retrieve and set information concerning the scanner and scanning options.  They are set using the ISISSetTag method and retrieved using the ISISGetTag method.  Possible tags are given below.  Not all tags are supported by all drivers and not all values are supported by all drivers. For more information on using ISIS, refer to Using ISIS to Scan Images.

Value	Meaning

TAG_XRESOLUTION	[0x011A] Gets or sets the horizontal resolution in PixelsPerInch.

TAG_YRESOLUTION	[0x011B] Gets or sets the vertical resolution in PixelsPerInch.

TAG_FEEDER	[0x0503] [Read Only] Gets information about the scanner's flatbed and/or feeder.  Values may be:

TAG_FEEDER_FEED [0x00000001L] Scanner has feeder.
TAG_FEEDER_FLAT [0x00000002L] Scanner has flatbed.
TAG_FEEDER_TELLFLAT [0x00020000L] Can detect page on flatbed.
TAG_FEEDER_TELLFEED [0x00010000L] Can detect page in feeder.
TAG_FEEDER_TELLSCAN [0x00040000L] Can only detect by committing.
TAG_FEEDER_CENTERFEED [0x00080000L] Can center page in feeder.
TAG_FEEDER_CENTERFLAT [0x00100000L] Can detect if page is centered in flatbed.

TAG_XPOSITION	[0x011E] Gets or sets distance from left edge of page to start of image in pixels.

TAG_YPOSITION	[0x011F] Gets or sets distance from top edge of page to start of image in pixels.

TAG_IMAGELENGTH	[0x0101] Gets or sets the number of rows (height) of the image in pixels.

TAG_IMAGEWIDTH	[0x0100] Gets or sets the number of columns (width) of the image in pixels.

TAG_SAMPLESPERPIXEL	[0x0115] Samples per pixel of the scanned image.

TAG_BITSPERSAMPLE	[0x0102] Bits per pixel of the scanned image.

TAG_PHOTOMETRICINTERPRETATION	[0x0106] Indicates whether the image should be interpreted as grayscale or color.  Possible values are:
TAG_PHOTOMETRIC_WHITE0 [0x0000] binary - 0 represents white
TAG_PHOTOMETRIC_WHITE1 [0x0001] binary - 1 represents white
TAG_PHOTOMETRIC_RGB [0x0002] RGB
TAG_PHOTOMETRIC_PALETTE [0x0003] PALLETTE
TAG_PHOTOMETRIC_BGR [0x0120] BGR

Settings for TAG_SAMPLESPERPIXEL, TAG_BITSPERSAMPLE and TAG_PHOTOMETRICINTERPRETATION, and the corresponding color format are given below.

TAG_SCANORIENTATION	[0x0113] [Read Only] Orientation of the page in the scanner's feeder.  Values can be:
TAG_SCANORIENTATION_PORT [0x0001] portrait.
TAG_SCANORIENTATION_LAND [0x0002] landscape.
TAG_SCANORIENTATION_180 [0x0003] upside-down portrait.
TAG_SCANORIENTATION_270 [0x0004] upside-down landscape.
TAG_SCANORIENTATION_PORTM [0x0005] portrait mirrored.
TAG_SCANORIENTATION_LANDM [0x0006] landscape mirrored.
TAG_SCANORIENTATION_180M [0x0007] upside-down portrait mirrored.
TAG_SCANORIENTATION_270M [0x0008] upside-down landscape mirrored.

TAG_SCANTYPE	[0x0514] Specifies the scanning source.  Possible values are:
TAG_SCANTYPE_AUTOMATIC [0x0000] default - scan from ADF if pages are detected, otherwise scan from flatbed
TAG_SCANTYPE_TRANSPARENCY [0x0001] scan from the transparency unit
TAG_SCANTYPE_FLATBED [0x0002] scan from the flatbed
TAG_SCANTYPE_FEEDER [0x0003] scan only the front side of the page from the feeder
TAG_SCANTYPE_FRONTONLY [0x0003] scan only the front side of the page from the feeder
TAG_SCANTYPE_DUPLEX [0x0004] scan in duplex mode from the feeder
TAG_SCANTYPE_FRONTBACK [0x0004] scan in duplex mode from the feeder
TAG_SCANTYPE_BACKFRONT [0x0005] scan in duplex and return back side of the page first from the feeder
TAG_SCANTYPE_BACKONLY [0x0006] scan only the back side of the page from the feeder

TAG_SCANAHEAD	[0x050d] State of the ScanAhead feature of the scanner.  Possible values are:
TAG_SCANAHEAD_NO [0x0000] ScanAhead not enabled.
TAG_SCANAHEAD_YES [0x0001] ScanAhead enabled.

TAG_SCANAHEAD_MAXPAGES	[0x057c] Gets or sets the number of pages to buffer.

TAG_MAXPAGES	[0x0504] [Read Only] Gets the number of pages the ADF can hold.

TAG_COMPRESSION	[0x0103] Gets or sets the type of compression to use, if the scanner supports
compression.  Possible values are:
TAG_COMPRESSION_NONE [0x0001] No compression
TAG_COMPRESSION_MG3 [0x0002] CCITT compression
TAG_COMPRESSION_G3 [0x0003] CCITT G3 1-DIM
TAG_COMPRESSION_G4 [0x0004] Standard G4
TAG_COMPRESSION_LZW [0x0005] LZW compression
TAG_COMPRESSION_JPEG [0x0006] JPEG compression, not supported by LEAD.
TAG_COMPRESSION_32771 [0x8003] Packbits compression
TAG_COMPRESSION_PACK [0x8005] Packbits compression, not supported by LEAD.
TAG_COMPRESSION_JBIG [0x8765] JBIG compression.
TAG_COMPRESSION_PCX [0xC350] PCX compression, not supported by LEAD.
TAG_COMPRESSION_4BYTE [0xC351] No compression, not supported by LEAD.
TAG_COMPRESSION_GIF [0xC355] GIF compression, not supported by LEAD.
TAG_COMPRESSION_BMP [0xC356] BMP compression, not supported by LEAD.

TAG_CONTRAST	[0x0501] Gets or sets the contrast value if scanner supports it.  Possible values
are:
TAG_CONTRAST_AUTO [0x0000] AutoContrast or no support
> 0 Specific Contrast setting

TAG_BRIGHTNESS	[0x0502] Gets or set the brightness value.  Possible values are:
TAG_BRIGHTNESS_AUTO [0xFFFFFFFD] AutoBrightness control
TAG_BRIGHTNESS_DARKEN [0xFFFFFFFE] Lighten page relative to TAG_BRIGHTNESS_NORM
TAG_BRIGHTNESS_NORM [0xFFFFFFFF] Selects "normal" brightness
TAG_BRIGHTNESS_LIGHTEN [0x00000000] Darken page relative to TAG_BRIGHTNESS_NORM.
Some scanners also support values 1 - 127.

TAG_GAMMA	[0x050f] Gets or sets the Gamma Curve Adjustment value. Possible values are:
TAG_GAMMA_AUTO [0x0000] AutoGammaCorrection
TAG_GAMMA_DOWNLOAD1 [0x0001] 1st gamma correction table
TAG_GAMMA_DOWNLOAD2 [0x0002] 2nd gamma correction table
TAG_GAMMA_DOWNLOAD3 [0x0003] 3rd gamma correction table
TAG_GAMMA_DOWNLOAD4 [0x0004] 4th gamma correction table
TAG_GAMMA_DOWNLOAD5 [0x0005] 5th gamma correction table
TAG_GAMMA_DOWNLOAD6 [0x0006] 6th gamma correction table


ISIS ASCII Tags

These ISIS Scanner Driver Tags are used to retrieve and set information concerning the scanner and scanning options. They are set using the ISISSetASCIITag method and retrieved using the ISISGetASCIITag method. Possible tags are given below. Not all tags are supported by all drivers and not all values are supported by all drivers. For more information on using ISIS, refer to Using ISIS to Scan Images.

Value	Meaning

TAG_PAGESIZE	[0x050e] Gets or sets the page size to scan.


List of Spatial Filters

The following is a list of the predefined spatial filters that can be applied using the SpatialFilter method:

Value	Meaning
FLT_EMBOSS_N FLT_EMBOSS_NE  FLT_EMBOSS_E  FLT_EMBOSS_SE FLT_EMBOSS_S FLT_EMBOSS_SW  FLT_EMBOSS_W  FLT_EMBOSS_NW	Creates an image with an embossed appearance. (This is used for artistic effect, but is listed here because it is one of the predefined filters.) Choose the appropriate value for the direction of the effect.
FLT_GRADIENT_N FLT_GRADIENT_NE FLT_GRADIENT_E FLT_GRADIENT_SE FLT_GRADIENT_S FLT_GRADIENT_SW FLT_GRADIENT_W FLT_GRADIENT_NW	Detects edges using a Gradient directional filter. All pixels not on the detected edges are changed to black. Choose the appropriate value for the direction of the effect.
FLT_LAPLACE_1 FLT_LAPLACE_2 FLT_LAPLACE_3 FLT_LAPLACE_DIAG FLT_LAPLACE_HORZ FLT_LAPLACE_VERT	Applies Laplacian line detection. There are three omnidirectional filters and three bi-directional ones. All pixels not on the detected lines are changed to black.
FLT_SOBEL_HORZ FLT_SOBEL_VERT	Applies Sobel edge detection. All pixels not on the detected edges are changed to black. (The usage is the same as Prewitt, but the algorithm is different.) Choose the appropriate value for horizontal or vertical detection.
FLT_PREWITT_HORZ FLT_PREWITT_VERT	Applies Prewitt edge detection. All pixels not on the detected edges are changed to black. (The usage is the same as Sobel, but the algorithm is different.) Choose the appropriate value for horizontal or vertical detection.
FLT_SHIFTDIFF_DIAG FLT_SHIFTDIFF_HORZ FLT_SHIFTDIFF_VERT	Applies shift-and-difference edge detection. All pixels not on the detected edges are changed to black. Choose the appropriate value for diagonal, horizontal, or vertical detection.
FLT_LINESEG_HORZ FLT_LINESEG_VERT FLT_LINESEG_LTOR FLT_LINESEG_RTOL	Applies line segment line detection. You can use this filter to find line discontinuities in an image. All pixels not on the detected line segments are changed to black. Choose the appropriate value for horizontal, vertical, left-to-right diagonal, or right-to-left diagonal detection.


Syntax

This is the internal syntax of the property, method, or event. The external syntax depends on the development system you are using. Refer to the code example for your system, or for general information, refer to the following:

Visual Basic Syntax

Visual C++ 4.0 Syntax

Visual FoxPro Syntax

Access Syntax


Visual Basic Syntax

The syntax for the LEAD control's properties, methods, and events is the same as for other controls in Visual Basic.

Whenever you declare a variable as a data type, you need to know how the ActiveX data type is expressed in Visual Basic. Refer to the following table for the appropriate data type:

ActiveX Data Type	Visual Basic Data Type

boolean	Integer

BSTR	String

IPictureDisp	Picture

long	Long

OLE_HANDLE	Long on a 32-bit system

OLE_COLOR	Long color value (such as the RGB return value)

OLE_XPOS_PIXELS	Long

OLE_YPOS_PIXELS	Long

short	Integer

float	Single


Visual C++ 4.0 Syntax

In Version 4.0 of Visual C++, the MicroSoft Foundation Class (MFC) library provides an ActiveX interface. This topic describes how to use the interface with the LEADTOOLS ActiveX.

To add a LEAD control to your application, refer to the example in Loading and Displaying an Image.

Alternatively, to create an instance of the LEAD control at run time, use the Create function, which has the following prototype:

BOOL Create(	LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT&rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL);

Provide parameters as follows:

lpszWindowName	Use "", because the control window does not need a name.

dwStyle	Use 0 for the default style.

&rect	Use the CRect function. For example: CRect(0,0,50,50).

pParentWnd	Use this to refer to the current window.

nID	Use 0 for the default ID.

pPersist	Use NULL.

bStorage	Use FALSE.

bstrLicKey	Use the LEADTOOLS license string, which is always the first line in the LTOCX14.LIC file. For example: "LEADTOOLS OCX Copyright (c) 2003 LEAD Technologies, Inc." If you do not specify this string correctly, the ActiveX will not work when you distribute your application.

For example, the following code comes from the EXAMPLES\OCX\MFC40\DEMO\MAINDEMO.CPP file:

static const WCHAR BASED_CODE _szLicString[] =
   L"LEADTOOLS OCX Copyright (c) 2001 LEAD Technologies, Inc.";
     o
     o
     o
m_pLead = new CLead;
// pass the license string to the CLead::Create function.
// The CLead::Create expects a BSTR parameter and SysAllocString converts the
// WCHAR[] to a BSTR
BSTR lpLic = SysAllocString(_szLicString);
m_pLead->Create("", 0,CRect(0,0,50,50),this,0,NULL,FALSE,lpLic);
m_pLead->ShowWindow(SW_HIDE);
SysFreeString(lpLic);

When getting or setting a property value, you must use a function that is created by adding a prefix to the property name.

To set a property value, the syntax is as follows:

m_controlname.Setpropertyname(value);

For example:

m_Lead1.SetRubberBandVisible(FALSE);

To get a property value, the syntax is as follows:

value = m_controlname.Getpropertyname();

For example:

HeightFactor = m_Lead1.GetBitmapHeight();

To set a property array value, the syntax is as follows:

m_controlname.Setpropertyname(index, value);

For example:

m_Lead1.SetRemapTable(MyIndex, (255 * Offset) / CurrentRange);

To get a property array value, the syntax is as follows:

value = m_controlname.Getpropertyname(index);

For example:

m_Lead1.SetBitmap(m_Lead1.GetColorPlanes(3)); // Copy the K plane


Visual FoxPro Syntax

The syntax for the LEAD control's properties, methods, and events is the same as for other controls in Visual FoxPro.

In FoxPro there is no need to declare variables as data types for use with the LEADTOOLS ActiveX.

To use the constants that are defined for the LEADTOOLS ActiveX, you must import the L_FOX.H file as explained in Loading and Displaying an Image.

You must use the FoxPro syntax for the TRUE, FALSE, and NULL constants (.T., .F., and .NULL.).


Access Syntax

The syntax for the LEAD control's properties, methods, and events is the same as for other OLE controls in MicroSoft Access.

In Access 2.0, to use the constants that are defined for the LEADTOOLS ActiveX, you must import the L_ACCESS.BAS file as explained in Loading and Displaying an Image (Access 2.0).

In Access, whenever you declare a variable as a data type, you need to know how the ActiveX data type is expressed in Access Basic. Refer to the following table for the appropriate data type:

ActiveX Data Type	Access Data Type

boolean	Integer

BSTR	String

long	Long

OLE_HANDLE	Long on a 32-bit system

OLE_COLOR	Long color value (such as the RGB return value)

OLE_XPOS_PIXELS	Long

OLE_YPOS_PIXELS	Long

short	Integer

float	Single


Visual Basic Constants for Key Codes

Do the following to find the Visual Basic key codes:

1.	On the View pull-down menu, select Object Browser....

2.	Select VB - Visual Basic objects and procedures.

3.	Select VBKeyCodeConstants.

4.	Select one of the listed constants.

A description of the constant appears at the bottom of the form.


Visual C++ Key Codes

The following are the Visual C++ key codes:

VK_A through VK_Z are the same as their ASCII equivalents: 'A' thru 'Z'.
VK_0 through VK_9 are the same as their ASCII equivalents: '0' thru '9'.
VK_LBUTTON
VK_RBUTTON
VK_CANCEL
VK_MBUTTON
VK_BACK
VK_TAB
VK_CLEAR
VK_RETURN
VK_SHIFT
VK_CONTROL
VK_MENU
VK_PAUSE
VK_CAPITAL
VK_ESCAPE
VK_SPACE
VK_PRIOR
VK_NEXT
VK_END
VK_HOME
VK_LEFT
VK_UP
VK_RIGHT
VK_DOWN
VK_SELECT
VK_PRINT
VK_EXECUTE
VK_SNAPSHOT
VK_INSERT
VK_DELETE
VK_HELP

VK_NUMPAD0
VK_NUMPAD1
VK_NUMPAD2
VK_NUMPAD3
VK_NUMPAD4
VK_NUMPAD5
VK_NUMPAD6
VK_NUMPAD7
VK_NUMPAD8
VK_NUMPAD9
VK_MULTIPLY
VK_ADD
VK_SEPARATOR
VK_SUBTRACT
VK_DECIMAL
VK_DIVIDE
VK_F1
VK_F2
VK_F3
VK_F4
VK_F5
VK_F6
VK_F7
VK_F8
VK_F9
VK_F10
VK_F11
VK_F12
VK_F13
VK_F14
VK_F15
VK_F16
VK_F17
VK_F18
VK_F19
VK_F20
VK_F21
VK_F22
VK_F23
VK_F24
VK_NUMLOCK
VK_SCROLL


Visual FoxPro Key Codes

The simplest way to find a key code in Visual FoxPro is to test for it when you are designing the application.  For example, you could use the following test:

*** OLE Control Event ***
LPARAMETERS keycode, shift
cMsg = STR(keycode)
return = MESSAGEBOX(cMsg, 0, "test")


Access Key Codes

The simplest way to find a key code in Microsoft Access is to test for it when you are designing the application.  For example, you could use the following test:

Sub LEAD1_KeyDown (keycode As Integer, Shift As Integer)
    cMsg = CStr(keycode)
    MsgBox cMsg
End Sub


Using ODBC

The LEADTOOLS ActiveX supports database access using Open Database Connectivity (ODBC). Before using any application (including LEADTOOLS examples) to access any database, you must first specify the ODBC data source as follows.

Note:	The LEADTOOLS ActiveX requires ODBC drivers that can properly handle long binary fields. Examples have been tested and will work with version 3.0 of the Microsoft ODBC Desktop Driver Pack. (This driver pack ships with Access 95 and works on 32-bit systems.) You can download drivers from the CompuServe forum, or the Worldwide Web home page. The CompuServe forum is at GO LEADTECH. The web page is ftp://ftp.leadtools.com/pub/utils/ODBC32.zip. The file to download is ODBC32.ZIP.

1.	Open the ODBC administrator and click the Add button.

2.	Select the appropriate driver and click the OK button. (Use the Microsoft FoxPro driver for FoxPro, and use the Microsoft Access driver for Visual Basic, Visual C++, or Access 95.)

3.	Enter a data source name and a description.

4.	Click the Select directory button and select the directory containing the database you want to access.

5.	Step out of the ODBC administrator by clicking the OK button on two forms then clicking the Close button.


Using OLE DB and ADO

The LEADTOOLS OLE DB ActiveX supports database access though an OLE DB Provider.  OLE DB allows users to have uniform access to data regardless of the database format.  An OLE DB Provider is a COM object that exposes interfaces to consumers wanting to access data in a particular format.  For example, there are OLE DB Providers for JET, SQL Server, Oracle, ODB drivers, Excel, and many other data sources.  The LEADTOOLS OLE DB Control is a consumer for the data exposed by OLE DB Providers.  Using the Microsoft ADO Data Control, you can connect to any of several OLE DB Providers.  You specify the provider to which you wish to connect in the ADO Control's ConnectionString property.  The ADO Control provides a user interface for selecting the OLE DB Provider, as well as setting other connection parameters.  For more information, consult the Microsoft ADO Data Control documentation, or consult the "Using OLE DB Providers with ADO" section of the "Microsoft Data Access SDK" documentation.

Note: During testing, the OLE DB Provider for JET 3.51 was found to not perform properly when attempting to save images > 64K. For this reason, saving > 64K has been disabled in the ActiveX when the provider is MSJTOR35.DLL, and the DataSaved event will be fired with an error code.

Note: During testing we found that the ADO Data control will cache all records if you leave the MaxRecords property set to the default value of 0. If you leave this property at 0, all records will be retrieved from the database. for large databases, this may cause your application to slow down while the records are retrieved. Therefore, we recommend that you set the MaxRecords property to a value other than 0.


Flags for Setting a Region

By default, a bitmap does not have a region. You create a bitmap region by calling one or more of the SetRgn... methods. Each time you call one of these methods, you specify how the new region is to be added to the existing bitmap region (if there is one). The following is a list of the options:

L_RGN_AND	The resulting region includes only the intersection of the existing region and the new one. The following example shows the result, where the rectangles represent the existing region, the ellipse represents the new one, and the shaded area represents the resulting region.

L_RGN_SET	The resulting region includes only the new region. The existing region, if any, is discarded. The following example shows the result, where the ellipse is the new region and the shaded area is the resulting region.

L_RGN_SETNOT	The resulting region includes everything in the bitmap, except the new region. The existing region, if any, is discarded. The following example shows the result, where the ellipse is the new region and the shaded area is the resulting region.

L_RGN_ANDNOTBITMAP	The resulting region includes the intersection of the area outside the existing region and the area inside the new region. The following example shows the result, where the rectangle is the existing region, the ellipse is the new one, and the shaded area is the resulting region.

L_RGN_ANDNOTRGN	The resulting region includes the intersection of the area inside the existing region and the area outside the new region. The following example shows the result, where the rectangle is the existing region, the ellipse is the new one, and the shaded area is the resulting region.

L_RGN_OR	The resulting region includes the area inside the existing region and the area inside the new region. The following example shows the result, where the rectangle is the existing region, the ellipse is the new one, and the shaded area is the resulting region.

L_RGN_XOR	The resulting region includes the area inside the existing region and the area inside the new region, except for any areas where the two intersect. The following example shows the result, where the rectangle is the existing region, the ellipse is the new one, and the shaded area is the resulting region.


MousePointer Limitation in Visual FoxPro

The MousePointer property does not work with Visual FoxPro.


No PCD Access

Visual FoxPro, Access 2.0, and Access 95 have been unable to load PCD files during testing.


Visual Basic Only

LEADTOOLS methods that reference picture objects were developed for Visual Basic. Picture objects in other development systems have not worked in tests and do not appear to be compatible.


Limited Support

This ActiveX element is supported only on the development systems with listed examples.


Visual Basic Data Binding Only

LEADTOOLS methods and properties for data binding were developed for use with the Visual Basic data control.


Only for Access and FoxPro Printing

The PrintStart and PrintEnd methods were added to the toolkit to overcome printing limitations in Access and FoxPro. Although you can use them in Visual Basic and Visual C++, there is no reason to do so. For printing examples in Visual Basic and Visual C++, refer to the Render method.


Only for Access Painting

The ForePalette property was added to the toolkit to overcome problems in using the background palette with Access 2.0. Although you can use this property with other development systems, there is no reason to do so.


Problems With the Windows API During Testing

The following examples are unavailable for Access 2.0, Access 95, and Visual FoxPro because of problems using them with the Windows API during testing:

StartFeedLoad
FeedLoad
StopFeedLoad


LEAD Bitmap in Memory

The LEAD bitmap in memory is not scaled. Therefore, when translating coordinates and measurements from the LEAD control's client area, you must account for the scaling (zooming) and the offsets (scrolling) of the image in the client area.

For a description of how to translate the coordinates, refer to the code example for the particular method, property, or event.

For an illustration of the relationship between a LEAD bitmap in memory and the LEAD control's client area, refer to Concepts and Definitions.


LEAD Control's Client Area

The LEAD control's client area is where the scaled image of the LEAD bitmap is displayed. Sometimes you must translate coordinates and measurements from the client area to the bitmap, which is not scaled.

For a description of how to translate the coordinates, refer to the code example for the particular method, property, or event.

For an illustration of the relationship between a LEAD bitmap in memory and the LEAD control's client area, refer to Concepts and Definitions.


No OLE_HANDLE Support for Access 2.0

Access 2.0 does not handle recognize the OLE_HANDLE data type. To take advantage of these events and methods that use that data type, you must upgrade to Access 95 or 97.


WIN32 Internet Explorer Required

Asynchronous loading of a bitmap across the Internet requires Internet Explorer files that are available only for WIN32 applications.


Variant Problem in FoxPro

FoxPro was unable to get or set data from the VARIANT data type during testing.


Memory handle problems in Access 2.0

Access 2.0 was unable to save files in memory or load files from memory during testing.


No Three-Dimensional Text in Access 2.0

Access 2.0 cannot use the three-dimensional text properties, because of a reserved-word failure when setting the TextWidth and TextHeight properties.


Method is for Access 2.0

For development systems other than Access 2.0, use the DrawText method.


Transparent Controls Unreliable in Access 2.0

Use of transparent controls was unreliable during testing with Access 2.0.


Document/Medical Support and Licensing Requirements

Document/Medical Licensing and Royalty Agreements:

Congratulations!  You have licensed one of the LEADTOOLS Document/Medical software products, the most comprehensive imaging toolkits on the market, enabling you to create powerful imaging applications. The license terms for LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite require runtime licensing based on the number of copies of your application that you deploy (i.e., distribute or install and use internally).

By paying the initial box price for the applicable LEADTOOLS product, you have obtained a development license, which entitles you to develop your application and test it. Once completed, if you wish to distribute the application or deploy it internally on multiple machines, you are required to enter into a duplication and distribution agreement with LEAD. You have the ability to choose from several licensing options depending on your volume needs.

The product you are installing is a fully functional working version and includes support for all features in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. (Depending on which product you have licensed, some of the features may ultimately not be available to you.  See the on-line help file for a product feature comparison.)  Until you sign and return the correct licensing agreement, your application will display a "nag" message.  Once LEAD receives the executed contract, we will provide you a password that will permit you to terminate the "nag" message for the product that you have licensed. In addition to providing the password, you must also use the no nag version of the LTKRN14N.DLL, found in the REDIST\NONAGLTKRN directory. This is also the version you must redistribute.

Duplication and Distribution Agreements

	Click this button to start the LEADTOOLS Licensing help file.


Summary of All Supported Image File Formats

Color and Grayscale

AFP Format (AFP)

BMP Formats

Computer Graphics Metafile (CGM)

Corel Presentation Exchange Format (CMX)

DGN (DGN)

DICOM Format (DIC)

Dr. Halo (CUT)

DRaWing (DRW)

Drawing Interchange Format (DXF)

DWF Format (DWF)

DWG Format (DWG)

Encapsulated PostScript (EPS)

ESRI Shape Format (SHP)

Exif Formats (TIFF and JPG)

Flic Animation (FLC)

GIF and TIFF with LZW Compression

Icons and Cursors (ICO and CUR)

Interchange File Formats (IFF)

JBIG Format (JBG)

JPEG and LEAD Compressed (JPG and CMP)

Kodak Formats (PCD and FPX)

Macintosh Pict Format (PCT)

Microsoft Windows Clipboard (CLP)

PCX Formats (PCX and DCX)

PhotoShop 3.0 Format (PSD)

PLT (PLT)

Portable Bitmap Utilities (PBM)

Portable Document Format (PDF)

Portable Network Graphics Format (PNG)

PostScript Document Format (PS)

Printer Command Language Format (PCL)

PTOCA Format (PTOCA)

Scalable Vector Graphics Format (SVG)

Scitex Continuous Tone Format (SCT)

Silicon Graphics Image Format (SGI)

SUN Raster Format (RAS)

TIFF Without LZW Compression

Truevision TARGA Format (TGA)

XPicMap (XPM)

X WindowDump (XWD)

Windows Animated Cursor (ANI)

Windows AVI Format (AVI)

Windows Metafile Formats (WMF and EMF)

WordPerfect Format (WPG)

Gerber Format (GBR)

Wireless Bitmap Format (WBMP)

Bitonal (1-Bit)

TIFF CCITT and Other FAX Formats

LEAD 1-Bit Format (CMP)

LMC Format (LMC)

XBitMap Format (XBM)

Intergraph Format (ITG)

Image Object Content Architecture Format (IOCA/MODCA)

Miscellaneous 1-Bit Formats (MAC, IMG, and MSP)

SMP Format (SMP)


File Formats: Scitex Continuous Tone Format (SCT)
Scitex Continuous Tone Format (SCT)

The Scitex Continuous Tone file format was developed by Scitex and is used for high-end image processing. The SCT/CT files are used primarily to store CMY and CMYK color space for the image. For saving the SCT file format, LEAD saves it as CMY instead of CMYK. This maintains the image quality, since the conversion from RGB to CMYK will result in some loss of data.

The default extensions used by this format are: SCT and CT.

This file format does not support progressive loads and saves, multi-page files, stamps, or Lossless JPEG compression.

File constants associated with this file format are:

FILE_SCT

For SCT/CT files, you can read the following bits per pixel: 24.

For SCT/CT files, you can write the following bits per pixel: 24.


File Formats: Printer Command Language (PCL)
Printer Command Language Format (PCL)

The Printer Command Language vector format was developed by Hewlett-Packard, specifically to provide a means of communication between computers and printers. The PCL files contain the commands and the HP printers parse and decode those commands. This format also includes HPGL. For more information about HPGL, refer to PLT.

This file format is not supported in the non-vector toolkits. Read support and write support for this format are provided in the LEADTOOLS Vector toolkits and are unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

LEAD supports version 3.0 and 5.0 of this file format.

The default extensions used by this format are: PRN, PRT and PCL.

This format is used by Visual PCL, PCLTOOLS, redtitan EscapE and AutoVue.

This file format does not support layers or grouping, but it does support embedded raster objects.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Supported
Circle	Supported	Supported
Lines	Supported	Supported
Pie	Supported	Supported
Point	Supported	Supported
PolyBezier	Supported	Not Supported
PolyDraw	Supported	Not Supported
Polygons	Supported	Not Supported
Polyline	Supported	Not Supported
Raster	Supported	Supported
Rectangle	Supported	Supported
Text	Supported	Supported
PCL filter supports many features such as:

Support for Macros.

Enhanced performance of the filter.

Support for HPGL mode in PCL

Raster fonts

RTL Raster data

Viewing PJL with POSTSCRIPT data (requires the PDF filter)

Support for user-defined and pre-defined patterns

Support for Unicode symbols

Detecting non-standard PCL/HPGL files that lack a correct header

File constants associated with this file format are:

FILE_PCL

FILE_PLT

Required DLL: LFPCL14N.DLL. This format also requires LVKRN14N.DLL.

For PCL files, you can read the following bits per pixel: 24.

For PCL files, you can write the following bits per pixel: 24.


File Formats: AFP (AFP)
AFP Format (AFP)

The AFP format is part of IBM's document imaging system. It is a raster format, created to add enhanced formatting and indexing capabilities to documents for print applications in finance, retail, insurance and other industries. LEAD provides support for the user to open MODCA/PTOCA or AFP/PTOCA documents.

The default extension used by this format is: AFP.

This format is used by the IBM plug in.

This file format does not support stamps or Lossless JPEG compression, but it does support multi-page files.

File constants associated with this file format are:

FILE_AFP

For AFP files, you can read the following bits per pixel: 24.

Currently, LEAD does not save AFP files, but these files can be saved to IOCA.


File Formats: Image Object Content Architecture (IOCA/MODCA)
Image Object Content Architecture Format (IOCA/MODCA)

The Image Object Content Architecture format was developed by IBM. This architecture provides a consistent way to represent images, including conventions and directions for processing and interchanging image information. LEADTOOLS supports single and multi-page files in a MO:DCA wrapper with embedded 1-bit CCITT, Group 3 or Group 4 images, IBM MMR and uncompressed IOCA. LEAD also supports IOCA files without the MO:DCA wrapper LEAD loads and saves all these formats.

The default extension used by this format is: ICA.

This file format does not support stamps or Lossless JPEG compression, but it does support multi-page files. For this file format, LEAD supports CCITT, G3(1D, 2D), CCIT G4, and IBM MMR compression. LEAD does not support ABIC, RL4, and Color Compression used by OS/2.

LEAD supports loading and saving multi-page files in this format.

File constants associated with this file format are:

FILE_ICA_G3_1D
FILE_ICA_G3_2D
FILE_ICA_G4
FILE_ICA_IBM_MMR
FILE_ICA_UNCOMPRESSED
FILE_RAWICA_G3_1D
FILE_RAWICA_G3_2D
FILE_RAWICA_G4
FILE_RAWICA_IBM_MMR
FILE_RAWICA_UNCOMPRESSED

For IOCA files, you can read the following bits per pixel: 1.

For IOCA files, you can write the following bits per pixel: 1.


File Formats: ESRI Shape (SHP)
ESRI Shape Format (SHP)

The ESRI Shape format is a vector format created by the Environmental System Research Institute. The SHP file can support point, multi-point, polygon, polyline and multi-patches. This file format has a much faster drawing speed and more editing capabilities than other data sources. It is supported by the ARC Explorer 2.0 and ARCView.

This file format contains three files:

Main file: *.shp

Index file: *.shx

DBase file: *.dbf

This file format is not supported in the non-vector toolkits. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

The default extension used by this format is: SHP.

This file format does not support layers, grouping objects or embedded raster objects.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
PolyDraw	Supported	Not Supported
Polyline	Supported	Supported
Vertex	Supported	Not Supported
File constants associated with this file format are:

FILE_SHP

Required DLL: LFSHP14N.DLL. This format also requires LVKRN14N.DLL.

For SHP files, you can read and write the following bits per pixel: 24.


File Formats: PTOCA (PTOCA)
PTOCA Format (PTOCA)

The Presentation Text Object Content Architecture (PTOCA) is the data object used in document processing environments fro representing text, which has been prepared for presentation. Each file contains one or more pages of text and is always included as part of a document in a MODCA file. Each page may reference a PTOCA Overlay, which is merged with the text as a background.

There is no default extension.

This format originated at IBM.

This file format does not support QFactor, progressive loads and saves, stamps or Lossless JPEG compression, but it does support multi-page files.

File constants associated with this file format are:

FILE_PTK

For PTK files, you can read the following bits per pixel: 24.

LEAD does not save PTK files.


File Formats: SMP (SMP)
SMP Format (SMP)

The SMP file contains a 1-bit raster bitmap. It may be uncompressed, compressed using CCITT Group 3 or compressed using CCITT Group 4.

The default extension is .SMP.

This format was created by Xionics and is used in PixEdit for Techsoft.

This file format does not support QFactor, progressive loads and saves, multi-page files, stamps or Lossless JPEG compression.

File constants associated with this file format are:

FILE_SMP

FILE_SMP_G3_1D

FILE_SMP_G3_2D

FILE_SMP_G4

For SMP files, you can read the following bits per pixel: 1.

LEAD does not save SMP files.


File Formats: JPEG and LEAD Compressed (JPG, J2K, JP2, CMP, CMW)
JPEG and LEAD Compressed (JPG, J2K, JP2, CMP, CMW)

LEADTOOLS reads and writes the following LEAD and JPEG compressed formats:

 LEAD. This is the LEAD CMP compressed format for grayscale and color images. This format results in smaller files and better image quality than industry-standard formats. In addition, LEAD also supports CMW files, which use Wavelet CMP compression in 8, 12, and 16-bit grayscale and 24-bit color.

 Progressive LEAD. This is a LEAD format that is useful for transmitting images, because the first part of the file contains the full dimensions of the image. Therefore, in a paint-while-load routine, you can display the whole image, then progressively clarify it as the rest of the file loads. In this format you can read and write 8 or 24 bits per pixel, where 8 is for grayscale and 24 is for color.

 Lossy JFIF. This is the JPEG File Interchange Format. LEADTOOLS supports YUV 4:4:4, 4:2:2, and 4:1:1 color spacing, and YUV 4:0:0 for grayscale.

 Lossless JFIF. This is the JPEG File Interchange Format. LEADTOOLS supports 8, 12, and 16-bit grayscale and 24-bit color spacing. Please note that not all applications support Lossless JPEG. Before saving a file using Lossless JPEG, make sure your reader supports it.

Both JPEG 4:4:4 and Lossless JPEG will be recognized when getting file information.

12 and 16-bit grayscale images are only supported in the Document/Medical Imaging editions.

 Progressive JPEG. This is a JFIF format that is useful for transmitting images, because the first part of the file contains the full dimensions of the image. Therefore, in a paint-while-load routine, you can display the whole image, then progressively clarify it as the rest of the file loads. LEADTOOLS supports YUV 4:4:4, 4:2:2, and 4:1:1 color spacing, and YUV 4:0:0 for grayscale.

 Lossy JTIF. This is the JPEG Tagged Interchange Format. LEADTOOLS supports YUV 4:4:4, 4:2:2, and 4:1:1 color spacing, and YUV 4:0:0 for grayscale.

 Lossless JTIF. This is the JPEG Tagged Interchange Format. LEADTOOLS supports 8, 12, and 16-bit grayscale and 24-bit color spacing. Please note that not all applications support Lossless JPEG. Before saving a file using Lossless JPEG, make sure your reader supports it.

Both TIFF JPEG 4:4:4 and Lossless JPEG will be recognized when getting file information.

12 and 16-bit grayscale images are only supported in the Document/Medical Imaging editions.

 J2K – Lossy or Lossless. This is a JPEG 2000 Format. LEADTOOLS supports 8, 12, and 16-bit grayscale and 24-bit color spacing. The J2K format contains only a stream of image data. Support for this format is only available in the LEADTOOLS JPEG 2000 Plug in.  (12 and 16-bit grayscale support is only in Document/Medical Imaging toolkits)

 JP2 – Lossy or Lossless. This is a JPEG 2000 Format. LEADTOOLS supports 8-bit grayscale and 24-bit color spacing. The JP2 format contains a stream of image data, plus extra data about the organization and contents of the file.  Support for this format is only available in the LEADTOOLS JPEG 2000 Plug in.

 TIF J2K – Lossy or Lossless. This is a Tagged Image File with JPEG 2000 Compression. This file format contains only a stream of image data. LEADTOOLS supports 8, 12, and 16-bit grayscale and 24-bit color spacing. Support for this format is only available in the LEADTOOLS JPEG 2000 Plug in.  (12 and 16-bit grayscale support is only in Document/Medical Imaging toolkits)

For general information, refer to Compression Using LEAD and JPEG Formats.

For more information about the LEADTOOLS JPEG 2000 Plug in, refer to Implementing JPEG 2000 Plug in Features.


File Formats: GIF and TIFF with LZW Compression
GIF and TIFF with LZW Compression

LEADTOOLS reads and writes the following LZW-compressed formats.

 GIF. This is the Graphics Interchange Format created by CompuServe for storing and exchanging color raster images.

LEAD supports loading and saving multi-page files in this format.

The file constants associated with this file format are:

FILE_GIF

Required DLL: LFGIF14N.DLL.

You can read and write the following bits per pixel: 1, 2, 3, 4, 5, 6, 7, 8.

 Animated GIF. This is a multipage GIF format that can be played as an animation by displaying the images sequentially. LEADTOOLS lets you create and play the animations.

LEAD supports loading and saving multi-page files in this format.

The file constants associated with this file format are:

FILE_GIF

Required DLL: LFGIF14N.DLL.

You can read and write the following bits per pixel: 1, 2, 3, 4, 5, 6, 7, 8.

 TIFF LZW. These files use the Tagged Image File Format with LZW compression. LEADTOOLS can read and write TIFF files that use RGB, CMYK, or YCbCr color space.

LEAD supports loading and saving multi-page files in this format.

The file constants associated with this file format are:

FILE_TIFLZW

FILE_TIFLZW_CMYK

FILE_TIFLZW_YCC

Required DLL: LFTIF14N.DLL. This also requires LFFAX14N.DLL.

For loading or saving CMYK files or LAB color space files, you will also need LTCLR14N.DLL.

You can read the following bits per pixel, without regard for the color space: 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32, 48, 64. (48- and 64-bit support is only in Document/Medical Imaging editions)

You can write the following bits per pixel, with RGB color space: 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32, 48, 64. (48- and 64-bit support is only in Document/Medical Imaging editions)

You can write the following bits per pixel, with CMYK color space: 24, 32.

You can write the following bits per pixel, with YCbCr color space: 24.

You can write 16- bit grayscale. (Document/Medical only)


File Formats: TIFF Without LZW Compression
TIFF Without LZW Compression

LEADTOOLS reads and writes several TIFF formats that are not LZW compressed.

TIFF is a tag-based file format designed to promote universal interchanges of digital image data. Because TIFF files do not have a single way to store image data, there are many versions of TIFF. LEADTOOLS supports the most common TIFF formats. The usual file extension is TIFF for single-image files, and MPT for multipage files (which can contain many images).

LEADTOOLS also supports the ability to save a vector image as a DXF within a TIFF.

LEAD supports loading and saving multi-page files in this format.

The file constants associated with this file format are:

FILE_TIF

FILE_TIF_CMYK

FILE_TIF_YCC

FILE_TIF_PACKBITS

FILE_TIF_PACKBITS_CMYK

FILE_TIF_PACKBITS_YCC

FILE_TIF_CMP

FILE_TIF_JBIG

FILE_TIF_DXF

FILE_TIF_J2K

FILE_TIF_CMW

Required DLL: LFTIF14N.DLL. This also requires LFFAX14N.DLL.

For loading or saving CMYK files or LAB color space files, you will also need LTCLR14N.DLL.

For saving TIFF with CMP, JBIG, DXF, J2K or CMW compression, you will need other file filters (LFCMP14N.DLL, LFJBG14N.DLL, LFDXF14N.DLL, LFJ2K14N.DLL or LFCMW14N.DLL respectively).

LEADTOOLS can read and write TIFF files that use RGB, CMYK, or YCbCr color space. LEADTOOLS can also read and write files with PackBits compression.

LEADTOOLS can also read and write files with Lossless JPEG compression for 8, 12, and 16-bit grayscale and 24-bit color spacing.

LEADTOOLS can also read and write files with CMP Compression for 8-bit grayscale and 24-bit color.

LEADTOOLS can also read and write files with JBIG Compression for the following bits per pixel: 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32.

You can read the following bits per pixel, without regard for the color space: 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32, 48, 64. (48- and 64-bit support is only in Document/Medical Imaging editions)

You can write the following bits per pixel, with RGB color space: 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32, 48, 64. (48- and 64-bit support is only in Document/Medical Imaging editions)

You can write the following bits per pixel, with CMYK color space: 24, 32.

You can write the following bits per pixel, with YCbCr color space: 24.

You can read and write 12- bit grayscale. (Document/Medical Imaging editions only)

You can write 16- bit grayscale. (Document/Medical Imaging editions only)


File Formats: BMP Formats
BMP Formats

LEADTOOLS reads and writes the following BMP formats:

 Windows Bitmap (BMP). This is a file format created by Microsoft. Some BMP images are compressed with an RLE-type compression.

You can read and write the following bits per pixel, without RLE compression: 1, 4, 8, 16, 24, 32.

You can read and write the following bits per pixel, with RLE compression: 4, 8.

 OS/2 Bitmap (OS/2 BMP). These are files created on an OS/2 operating system. LEADTOOLS supports both 1.x and 2.x formats.

You can read and write the following bits per pixel, without RLE compression: 1, 4, 8, 24.

You can read (but not write) the following bits per pixel, with RLE compression: 4, 8.


File Formats: Icons and Cursors
Icons and Cursors (ICO and CUR)

LEADTOOLS reads and writes Windows Icon and Cursor files. LEADTOOLS is not designed as an icon editor, but this file support lets you create a bitmap from an icon or cursor, or create an icon or cursor from a bitmap. The library (DLL) to support these formats is the same as for BMP files.

LEADTOOLS supports these file formats as follows:

 Windows Icon (ICO). This is a multipage file format for storing one or more Windows icons. The background color when you read these images is always black. The size when you write these images can be no larger than 255-by-255 pixels. (Neither the width nor height can be greater than 255.)

You can read and write 1, 4, 8, 16, 24, and 32-bit, single-page or multi-page files.

 Windows Cursor (CUR). This is a file format for storing Windows cursors (mouse pointers). LEADTOOLS does not load or save transparency information in these files. The size when you write these images should be exactly 32-by-32 pixels.

You can read and write 1, 4, 8, and 24-bit, single-page or multi-page files.

Windows Icon

LEAD supports loading and saving multi-page files in this format.

The file constants associated with this file format are:

FILE_WIN_ICO

Required DLL: LFBMP14N.DLL.

Windows Cursor

LEAD supports loading and saving multi-page files in this format.

The file constants associated with this file format are:

FILE_WIN_CUR

Required DLL: LFBMP14N.DLL.


File Formats: PCX Formats (PCX and DCX)
PCX Formats (PCX and DCX)

LEADTOOLS reads and writes the following PCX formats:

 PCX. This is a file format created by ZSoft. This format compresses its image data with the RLE type compression.

 DCX. This is a multipage PCX format that enables a file to contain more than one image. It is handled the same as a regular PCX file, except for the multipage feature.

For PCX and DCX files, you can read and write the following bits per pixel: 1, 4, 8, 24.

PCX

LEAD supports loading and saving multi-page files in this format.

File constants associated with this file format are:

FILE_PCX

Required DLL: LFPCX14N.DLL.


File Formats: Kodak Formats (PCD and FPX)
Kodak Formats (PCD and FPX)

LEADTOOLS supports the following Kodak formats:

 PhotoCD (PCD). This is a common high-resolution format for images on CD-ROM. An image file can contain one or more physical resolutions, with fixed dimensions. You can choose which resolution to load, and thus control the size of the resulting bitmap.

You can read the following bits per pixel: 8, 24.

You cannot write PhotoCD files. They are read-only.

 FlashPix (FPX). The FlashPix file format was developed through the combined efforts of Eastman Kodak Company, Microsoft Corporation, Hewlett-Packard Company, and Live Picture Inc. It combines the best features of existing formats with object orientation to make the use of digital color images easier.

The format of a FlashPix file is based on compound object storage, which allows storage of various kinds of data. A FlashPix file may consist of several "pages" where each "page" has storage for a source image, non-image data in the form of comments, transform data, and a stamp or thumbnail. Each image is stored as an entire multi-resolution hierarchy where each resolution in the hierarchy differs from the next highest resolution by a factor of 2 in the x dimension and in the y dimension. Non-image data are treated as comments in FlashPix file format. Comments are used to store information pertaining to the image, not actual pixel data. This information may include image title, image subject, camera manufacturer, scan software version number, and so forth. In addition to the image itself, FlashPix files store transform information. This data indicates transformations which may be performed on the source image. By storing the transforms, the source image may be stored in its original state and transformed, using the stored transforms, at your discretion. A stamp, or thumbnail, provides a small bitmap representation of a FlashPix image. If a FlashPix file has been created using a single resolution image, the thumbnail is optional.

You can read and write the following bits per pixel: 8, 24.


File Formats: DICOM Format (DIC)
DICOM Format (DIC)

Note: This format is supported only in the Medical Imaging.

DICOM (DIC) files are commonly used in medical images. LEADTOOLS reads a broad range of DICOM formats, converting them to LEAD-supported bits-per-pixel as necessary. LEADTOOLS writes DICOM files in the LEAD-supported bits-per-pixel.

You can read DICOM files as follows:

 Grayscale files in the 1- to 16-bit range are loaded as they are in the original file.

 Palettized color files in the 1- to 16-bit range are converted to 8-bit palettized or 24-bit unpalettized. By default, they are converted to 24-bit only if the palette contains more than 256 colors.

 Unpalettized color files (RGB, ARGB, or CMYK) with 1 to 16 bits per plane are converted to 24-bit RGB.

You can write DICOM files as 8, 12, or 16-bit grayscale, 8-bit palettized color, or 24-bit RGB color (8 bits per plane).


File Formats: Exif Formats (TIFF and JPG)
Exif Formats (TIFF and JPG)

Exif is a standard for image files created with digital cameras and other input devices. The standard is set by the Japan Electronic Industry Development Association, and formally it is called the Digital Still Camera Image File Format Standard.

Exif files contain either uncompressed TIFF images or compressed JPEG images. In addition, these files can contain many comment fields of various types. You can use the ReadComment method to read comments in an existing file. Before writing a file, you can use the Comment property to create an array of comments to be saved in the file. LEADTOOLS reads and writes the following Exif formats:

 TIFF. This is a tag-based file format designed to promote universal interchanges of digital image data. You can save any image size.

You can read and write 24 bits per pixel.

 JPG. This is the JPEG format with YUV 4:2:2 sampling. The FILE_EXIF_JPEG_411 uses 4:1:1 subsampling (called 4:2:0 sampling in other places). You can save any image size.

You can read and write 24 bits per pixel. (Grayscale is not supported.) For more information, refer to Compression Using LEAD and JPEG Formats.


File Formats: Windows Metafile Format (WMF)
Windows Metafile Formats (WMF and EMF)

The Windows Metafile (WMF and EMF) formats are vector formats that may or may not also contain a raster image.

EMF/WMF Vector files can be read and written as raster images in the non-vector toolkits. Vector read/write support for these formats is provided in the LEADTOOLS Vector toolkits and is unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Supported
Background color and mode	Supported	Supported
Chord	Supported	Supported
Circle	Supported	Supported
Color	Supported	Supported
Ellipse	Supported	Supported
HPolyBezier	Supported	Supported
Lines	Supported	Supported
Pie	Supported	Supported
PolyBezier	Supported	Supported
PolyDraw	Supported	Supported
Polygons	Supported	Supported
Polyline	Supported	Supported
Raster	Supported	Supported
Rectangle	Supported	Supported
Round Rectangle	Restricted Support	Restricted Support
Spline	Supported	Supported
Text	Supported	Supported
Text(Color and Font Type)	Supported	Supported
Vertex	Supported	Supported
EMR_STROKEPATH, and EMR_SELECTCLIPPATH.

File constants associated with this file format are:

FILE_EMF

FILE_WMF

Required DLL: LFWMF14N.DLL. This format also requires LVKRN14N.DLL.

For WMF and EMF files, you can read and write the following bits per pixel: 8, 24.

Note:	When working with LEADTOOLS annotations (rather than image files), you can save the annotations as WMF or EMF files containing vector graphics that can be used in other applications.


File Formats: Drawing Interchange Format (DXF)
Drawing Interchange Format (DXF)

DXF (Drawing Interchange Format) was first introduced by AutoDesk AutoCAD, and is one of the most widely used CAD/CAM/CAE applications in the world. DXF is very popular and is supported by most 3D formats on PC platforms.

A DXF file is an ASCII file containing 2D and 3D components representing a drawing. Those components are known as Entities. The DXF file can represent almost any CAD drawing using those entities, and can connect a group of entities together (such as windows, doors, etc.) and use them later in the file. The DXF file has seen many changes through the years, from version 2.6 to the latest release version 14. However, the latest release of AutoCAD still manages to open files created with any of the earlier versions.

LEADTOOLS supports all current variations of the DXF format (versions 2.6, 9, 10, 11, 12, 13, 14).

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Supported
Attdef	Supported	Not Supported
Attrib	Supported	Not Supported
Circle	Supported	Supported
Clone	Supported	Supported
Ellipse	Supported	Supported
Elliptical Arc	Supported	Not Supported
Insert	Supported	Not Supported
Leader	Supported	Not Supported
Lines	Supported	Supported
MText	Supported	Supported
Polygons	Supported	Supported
PolyLine	Supported	Supported
Raster	Supported	Not Supported
Solid	Supported	Not Supported
Spline	Supported	Not Supported
Text	Supported	Supported
Tolerance	Supported	Not Supported
Vertex	Supported	Supported
WPolyLine	Supported	Not Supported
3DFace	Supported	Not Supported
You can load any of the DXF files as either vector images or raster images. Users can load a DXF file, and save it to any of file formats supported by LEADTOOLS.

This file format is not supported in the non-vector toolkits. Read support and write support for this format are provided in the LEADTOOLS Vector toolkits and are unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

LEADTOOLS also supports the ability to save a vector image as a DXF within a TIFF.

The file constants associated with this file format are:

FILE_DXF

FILE_DXF_R12 (This is the same as FILE_DXF).

FILE_DXF_R13

FILE_TIF_DXF

Required DLLs:	LFDXF  LVKRN  LFACS (This is required to allow DXF filters to load ACIS data embedded in this format.) For a listing of the exact DLLs needed, based on the toolkit version, refer to Files To Be Included With Your Application.
For DXF files, you can read and write (Vector toolkits only) the following bits per pixel: 8.


File Formats: XPicMap Format (XPM)
XPicMap Format (XPM)

XPM files are used to store X Window PixMap information to disk. They are capable of storing black-and-white, grayscale, and color images. XPM stores image data in the form of ASCII text formatted as a standard C character string array.

For XPM files, you can read and write the following bits per pixel: 1, 8, 24.


File Formats: Interchange File Format (IFF)
Interchange File Format (IFF)

IFF (Amiga Interchange) is a general-purpose data storage format (raster), developed by Electronic Arts, Inc. and Commodore-Amiga, Inc., that can associate and store multiple types of data. It is used by ACD FotoCanvas Lite 2.0 and XnView applications.

IFF reads and writes RLE, and non-compressed images.

The file constants associated with this file format are:

FILE_IFF_ILBM

FILE_IFF_CAT

FILE_IFF_ILBM_UNCOMPRESSED

FILE_IFF_CAT_UNCOMPRESSED

Required DLL: LFIFF14N.DLL

For IFF files, you can read and write IFF ILBM and IFF CAT for the following bits per pixel: 1 - 8, 24. (IFF ILBM and IFF CAT can be RLE compressed or uncompressed. IFF CAT also supports multi-page files.)


File Formats: Portable Bitmap Utilities (PBM)
Portable Bitmap Utilities (PBM)

The Portable Bitmap Utilities consists of Portable Greymap Utilities (PGM), Portable Pixmap Utilities (PPM), and Portable Anymap Utilities (PNG). Their source is the UNIX environment.

For PBM files, you can read and write the following bits per pixel: 1.

For PGM files, you can read and write the following bits per pixel: 8 (Grayscale).

For PPM files, you can read and write the following bits per pixel: 24.


File Formats: Dr. Halo (CUT)
Dr Halo (CUT)

Dr. Halo files are device-independent images. The image is stored in one file (.CUT) and the palette is stored in a separate file (PAL). If the image has no corresponding .PAL file, it is considered a grayscale image.

For CUT files, you can read and write the following bits per pixel: 8.


File Formats: Microsoft Windows Clipboard (CLP)
Microsoft Windows Clipboard (CLP)

CLP stands for Microsoft Windows Clipboard. This file format is used to store the contents of the clipboard to disk. The clipboard is an area of memory shared by the Windows operating system, and it is a simple mechanism for exchanging data between applications.

The file constants associated with this file format are:

FILE_CLP

Required DLL: LFCLP14N.DLL.

For CLP uncompressed files, you can read and write the following bits per pixel: 1, 4, 8, 24.

For CLP RLE compressed files you can read the following bits per pixel: 4 and 8.

For CLP RLE compressed files you can write the following bits per pixel: 8.


File Formats: X Window Dump (XWD)
X Window Dump (XWD)

XWD stands for X Window dump. This file format is used to store and restore screen window images. Two versions of this file exist, the X10 window dump and the X11 window dump. These versions differ slightly in the format of the data (i.e. headers and bits per pixel).

The version X10 XWD file cannot have more than 8bpp image data.

For the version X10 XWD files, you can read and write the following bits per pixel: 1, 4, 8.

For the version X11 XWD files, you can read and write the following bits per pixel: 1, 4, 8, 16. 24, 32.


File Formats: Flic Animation (FLC)
Flic Animation (FLC)

The Flic file is an animation file created by Auto-desk. This file supports image data but not audio data.

The frames of this file can be of 8bpp image data. The maximum number of frames is 4000.

This file has two versions. The FLI file types support 320 X 200 images with a maximum of 64 colors per image. The FLC file types support up to 64k X 64k images with 256 colors per image.

LEAD supports loading and saving multi-page files in this format.

The file constants associated with this file format are:

FILE_FLC

FILE_FLI

Required DLL: LFFLC14N.DLL.

For FLI files, you can read the following bits per pixel: 8.

For FLC files, you can read and write the following bits per pixel: 8.


File Formats: Windows Animated Cursor (ANI)
Windows Animated Cursor (ANI)

ANI is an animated cursor (animated mouse pointer). This file format is used for reading and storing Windows Animated Cursors. The LEADTOOLS filter does not support transparency information within these files.

Multipage ANI files will have an icon on each page.

LEAD supports loading and saving multi-page files in this format.

The file constants associated with this file format are:

FILE_ANI

Required DLL: LFANI14N.DLL.

For ANI files, you can read and write the following bits per pixel: 1, 4, 8, 24.


File Formats: DRaWing (DRW)
DRaWing (DRW)

DRW()DRaWing) is a native format used in the popular Micrografx Designer CAD/CAM/CAE application for the Windows operating system.

This file format is not supported in the non-vector toolkits. Read support and write support for this format are provided in the LEADTOOLS Vector toolkits and are unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

LEADTOOLS supports versions 1, 2, 3, 4 and 5 of the DRW file format.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Not Supported
Lines	Supported	Supported
Pie	Supported	Not Supported
Point	Supported	Supported
PolyDraw	Supported	Supported
Polygons	Supported	Supported
Polyline	Supported	Supported
Raster	Supported	Not Supported
Text	Supported	Supported
The file constants associated with this file format are:

FILE_DRW

Required DLL: LFDRW14N.DLL. This format also requires LVKRN14N.DLL.

DRW files, you can read and write (Vector toolkits only) the following bits per pixel: 24.


File Formats: Computer Graphics Metafile (CGM)
Computer Graphics Metafile (CGM)

Computer Graphics Metafile is a format used for the exchange of vector and bitmap data. This file format is supported by Autovue and Corel. LEADTOOLS supports versions 1, 2, 3 and 4 of CGM, as well as the Binary data-encoding format of CGM.

This file format is not supported in the non-vector toolkits. Read support and write support for this format are provided in the LEADTOOLS Vector toolkits and are unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Circle	Supported	Not Supported
Circular Arc Center	Supported	Not Supported
Ellipse	Supported	Supported
Elliptical Arc	Supported	Not Supported
Font	Supported	Supported
Lines	Supported	Supported
PolyBezier	Supported	Not Supported
Polygons	Supported	Supported
Polyline	Supported	Supported
Rectangle	Supported	Supported
Text	Supported	Supported
The default extension used by this file format is: CGM.

This file format does not support layers.

The file constants associated with this file format are:

FILE_CGM

Required DLL: LFCGM14N.DLL. This format also requires LVKRN14N.DLL.

For CGM files, you can read and write (Vector toolkits only) the following bits per pixel: 24.


File Formats: PLT (PLT)
PLT (PLT)

PLT (also HPGL) is the standard language for printing line drawings created by Hewlett-Packard. HPGL is supported by many CAD programs, charting programs and word processors.

LEADTOOLS supports HPGL and HPGL/2.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Supported
Circle	Supported	Supported
Lines	Supported	Supported
Pie	Supported	Supported
PolyDraw	Supported	Not Supported
Polygons	Supported	Not Supported
Polyline	Supported	Not Supported
Rectangle	Supported	Supported
Text	Supported	Not Supported
This file format is not supported in the non-vector toolkits. Read support and write support for this format are provided in the LEADTOOLS Vector toolkits and are unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

The file constants associated with this file format are:

FILE_PLT

Required DLL: LFPLT14N.DLL. This format also requires LVKRN14N.DLL.

For HPGL files, you can read the following bits per pixel: 4.

For HPGL/2 files, you can read and write (Vector toolkits only) the following bits per pixel: 4.


File Formats: DWF (DWF)
DWF Format (DWF)

DWF is a binary file format used by AutoDesk AutoCAD for storing DWG files on the World Wide Web. DWF is a 2D, vector-based description of drawings and illustrations.

LEADTOOLS supports DWF versions .4, .5, .55 and .6.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Not Supported
Attdef	Supported	Not Supported
Attrib	Supported	Not Supported
BoundaryPolydraw	Supported	Not Supported
Circle	Supported	Supported
Dimension	Supported	Not Supported
Ellipse	Supported	Supported
Hatch	Supported	Not Supported
Insert	Supported	Not Supported
Leader	Supported	Not Supported
Lines	Supported	Supported
Mline	Supported	Not Supported
Mtext	Supported	Not Supported
Polygons	Supported	Not Supported
Polyline	Supported	Supported
PureLine	Supported	Not Supported
PurePolygon	Supported	Not Supported
PurePolyline	Supported	Not Supported
Segment	Supported	Not Supported
Spline	Supported	Not Supported
Text	Supported	Supported
Vertex	Supported	Not Supported
Wpolyline	Supported	Not Supported
3DFace	Supported	Not Supported
3DSolid	Supported	Not Supported
LEADTOOLS also supports text and embedded raster objects.

This file format is not supported in the non-vector toolkits. Read and write support for this format is provided in the LEADTOOLS Vector toolkits and is unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection.

The file constants associated with this file format are:

FILE_DWF

Required DLL: LFDWF14N.DLL. This format also requires LVKRN14N.DLL.

For DWF files, you can read the following bits per pixel: 24.

For DWF files, you can write the following bits per pixel: 8.


File Formats: DWG Format (DWG)
DWG Format (DWG)

DWG is a binary file format used by AutoDesk AutoCAD. It can contain 2D or 3D objects and offers compression and a CRC check for internal data.

LEADTOOLS supports DWG 13, 14 and 15 files.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Not Supported
Attdef	Supported	Not Supported
Attrib	Supported	Not Supported
BoundaryPolydraw	Supported	Not Supported
Circle	Supported	Not Supported
Dimension	Supported	Not Supported
Ellipse	Supported	Not Supported
Hatch	Supported	Not Supported
Insert	Supported	Not Supported
Leader	Supported	Not Supported
Lines	Supported	Not Supported
Mline	Supported	Not Supported
Mtext	Supported	Not Supported
Polygons	Supported	Not Supported
Polyline	Supported	Not Supported
PureLine	Supported	Not Supported
PurePolygon	Supported	Not Supported
PurePolyline	Supported	Not Supported
Segment	Supported	Not Supported
Spline	Supported	Not Supported
Text	Supported	Not Supported
Vertex	Supported	Not Supported
Wpolyline	Supported	Not Supported
3DFace	Supported	Not Supported
3DSolid	Supported	Not Supported
This file format is not supported in the non-vector toolkits. Read support for this format is provided in the LEADTOOLS Vector toolkits and is unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

The default extension used by this format is: DWG.

LEAD supports the object types listed above, as well as, layers and the grouping of objects. Embedded raster objects are not supported.

File constants associated with this file format are:

FILE_DWG

Required DLLs:	LFDWG  LVKRN  LFACS (This is required to allow DWG filters to load ACIS data embedded in this format.) For a listing of the exact DLLs needed, based on the toolkit version, refer to Files To Be Included With Your Application.
For DWG files, you can read the following bits per pixel: 24.


File Formats: DGN (DGN)
DGN (DGN)

DGN (also RDL) is a file format common to Intergraph's MicroStation and Interactive Graphics Design System (IGDS) CAD applications running on Intergraph workstations and PCs.

This file format is not supported in the non-vector toolkits. Read support for this format is provided in the LEADTOOLS Vector toolkits and is unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

LEADTOOLS supports DGN versions 1, 2 and 3.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Not Supported
Ellipse	Supported	Not Supported
Lines	Supported	Not Supported
Polygons	Supported	Supported
Polyline	Supported	Supported
Raster	Supported	Supported
Text	Supported	Not Supported
The file constants associated with this file format are:

FILE_INTERGRAPH_VECTOR

Required DLL: LFDGN14N.DLL. This format also requires LVKRN14N.DLL.

For DGN files, you can read the following bits per pixel: 24.


File Formats: JBIG Format (JBG)
JBIG Format (JBG)

JBIG (JBG) is an industry standard lossless compressed file format for bi-tonal (black and white), grayscale and color images.  LEAD’s JBIG support is comprehensive and handles the various flavors and bits per pixel as defined by the specification including progressive, where you can store and send multiple representations of images at different resolutions without any extra storage overhead.  In order to achieve highest compression ratios available by the JBIG format, LEAD also takes full advantage of all the functional blocks of this robust standard including the Adaptive Arithmetic Encoder, the Adaptive Template Block, the Typical Prediction Block, the Resolution Reduction Block, and the Deterministic Prediction Block.  Saving images in a JBIG format results in smaller image files sizes when compared to other industry standard compressed formats such as CCITT G3 or G4.

For JBIG files, you can read and write the following bits per pixel: 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32.


File Formats: PhotoShop 3.0 Format (PSD)
PhotoShop 3.0 Format (PSD)

Photoshop 3.0 (PSD) is the format produced by the Adobe Photoshop graphics editor.

LEAD supports RLE Compression for this file format.

The file constants associated with this file format are:

FILE_PSD

Required DLL: LFPSD14N.DLL.

For PSD files, you can read the following modes with the following bits per pixel:

Mode	Bits Per Channel	LEAD Bits Per Pixel
Bitmap	0	1
Grayscale	8	8
Grayscale	16	16
CMYK	8	24
CMYK	16	24
Indexed Color	8	8
RGB with 3 & 4 Channels	8	24/32
RGB	16	64
Duotone	8	8 Grayscale
LAB	8	24
LAB	16	24

For PSD files, you can write the following bits per pixel: 1, 8, and 24.

You can also read and write layers to this file with the following bits per pixel: 8 (GrayScale), 24, and 32.


File Formats: Portable Document Format (PDF)
Portable Document Format (PDF)

Portable Document Format (PDF). PDF was developed by the Adobe Corporation to allow the exchange and viewing of electronic documents easily and reliably, independent of the environment in which they were created. This format lets you compress large documents to a size small enough to download very quickly. It is also becoming a powerful format for reproducing documents over the web.

LEAD supports versions 1.2, 1.3, and 1.4 of this format. LEAD also supports loading and saving multi-page files in this format.

This filter can also save large images by setting the ESO_PDF_SAVE_LOW_MEMORY_USAGE flag. It can also load files that are stored in memory (memory files). In addition, this filter can load JBIG2 compressed PDF files. It can both load and save PDF files that are JPEG, LZW, CCITT G1 1D, CCITT G3 2D, or CCITT G4 compressed, or are uncompressed.

Support for this format is available in the Barcode PDF modules and the PDF Plug in. For more information on the available products, refer to Topic Selection. Support for this file format can be unlocked using one of the following support constants: L_KEY_PDF, L_KEY_PDF_SAVE, L_KEY_OCR_PDF_OUTPUT, L_KEY_BARCODES_PDF_READ, or L_KEY_BARCODES_PDF_WRITE.

The PDF Filter loads AI (Adobe Illustrator) files from version 7 to version 10, which only have PDF data.

The file constants associated with this file format are:

FILE_RAS_PDF

FILE_RAS_PDF_G3_1D

FILE_RAS_PDF_G3_2D

FILE_RAS_PDF_G4

FILE_RAS_PDF_LZW

FILE_RAS_PDF_JPEG

FILE_RAS_PDF_JPEG_422

FILE_RAS_PDF_JPEG_411

Required DLL: LFPDF14N.DLL. This DLL requires PDFDLL32.DLL

For a PDF file, you can read the following bits per pixel, using various DPI options: 1, 2, 4, 8, 24.

For a PDF file, you can write the following bits per pixel: 1, 2, 4, 8, 24.


File Formats: Portable Network Graphics Format (PNG)
Portable Network Graphics Format (PNG)

PNG (Portable Network Graphics) is a replacement for the GIF format. It is a full-featured (non-LZW) compressed format intended for widespread use without legal restraints.

You can read the following bits per pixel: 1, 4, 8, 16, 24, 32.

You can write the following bits per pixel: 1, 4, 8, 24.

LEADTOOLS supports reading (but not writing) interlaced PNG files. To implement interlaced display in the paint-while-load feature, set the ProgressivePasses property to paint the image in more than one pass.


File Formats: Truevision TARGA Format (TGA)
Truevision TARGA Format (TGA)

Truevision TGA (TARGA) is a file format created by Truevision Inc. LEADTOOLS supports all uncompressed and RLE compressed TGA file formats.

For TGA files, you can read and write the following bits per pixel in either uncompressed or RLE compressed form: 8, 16, 24, 32.


File Formats: Encapsulated PostSript (EPS)
Encapsulated PostScript (EPS)

PostScript Raster (Encapsulated PostScript). These files are used primarily on PostScript printers. These printers usually offer more variety of fonts and higher resolution than standard laser printers. EPS files will work on any PostScript compatible printer and any end-user application that supports placement of EPS files in its work space.

The image that you read from an EPS file can be a PostScript image, a PostScript raster image, an embedded TIFF image, or an embedded WMF image. The image that you write to an EPS file is always a PostScript raster image.

The file constants associated with this file format are:

FILE_EPSPOSTSCRIPT

FILE_EPSTIFF

FILE_EPSWMF

FILE_EPS

Required DLLs: LFEPS14N.DLL. This format also requires one or more of the following, for loading, depending on the content of the file: LFTIFF14N.DLL, LFWMF14N.DLL, LFPDF14N.DLL (This DLL also requires PDFDLL32.DLL.).

For a PostScript image, you can read the following bits per pixel, using various DPI options: 1, 2, 4, 8, 24.

For a PostScript raster image, you can read the following bits per pixel: 1, 8, 24.

For an embedded TIFF image, you can read the following bits per pixel: 1, 4, 8, 16, 24, 32.

For an embedded WMF file, you can read the following bits per pixel: 24.

You can write only an 8-bit PostScript raster image, which is grayscale.


File Formats: PostSript Document (PS)
PostScript Document Format (PS)

PostScript (PostScript). PostScript is a simple interpretive page description language, also known as PDL, that is used to describe the appearance of text, graphical shapes and sampled images on printed or displayed pages. The page description and graphical capabilities of this language include arbitrary shapes, painting operators, fully integrated text and graphics, and sampled images derived from natural sources. Most advanced laser printers use PostScript in order to render electronic information on a printed page.

The file constants associated with this file format are:

FILE_POSTSCRIPT

Required DLLs: LFPDF14N.DLL This DLL also requires PDFDLL32.DLL.

For a PostScript image, you can read the following bits per pixel, using various DPI options: 1, 2, 4, 8, 24.

For a PS file, you can read the following bits per pixel, using various DPI options: 1, 2, 4, 8, 24.

You can write only an 8-bit PostScript raster image, using the LEAD EPS filter.


File Formats: SUN Raster Format (RAS)
SUN Raster Format (RAS)

SUN Raster (RAS) is a format native to Sun UNIX platforms.

The file constants associated with this file format are:

FILE_RAS

Required DLL: LFRAS14N.DLL.

For RAS files, you can read and write the following bits per pixel: 1, 4, 8, 24, 32.

And you can read and write RAS files with RLE Compression for the following bits per pixel: 1, 4, 8, 24, and 32.


File Formats: WordPerfect Graphics Format (WPG and VWPG)
WordPerfect Graphics Format (WPG and VWPG)

The WordPerfect (WPG) format can contain vectored or raster images. LEADTOOLS handles both the raster images and the vector images.

Raster Images

For WPG files, you can read and write the following bits per pixel: 1, 4, 8.

Vector Images

VWPG (Vector Word Perfect Graphics) is a vector format created by COREL. There are two versions (version1 and version2) of the VWPG file format. Each has its own format and specifications. LEAD supports only version2 of this format. This file format is supported by COREL DRAW 8.0.

The default extension used by this format is: WPG.

This file format does support layers and embedded raster objects, but not grouping.

LEAD can load the following objects: Poly Curve, Rect, Vertical Line, Horizontal Line, Poly Line, Text, and Image.

LEAD can save the following objects: Line, Polyline, Rect, Polygon, Ellipse, Circle, Arc, Elliptical arc, Pie, Chord, Text, Polydraw, Polybezier, and Image.

File constants associated with this file format are:

FILE_VWPG

Required DLL: LFVPG14N.DLL. This format also requires LVKRN14N.DLL.

For VWPG files, you can read and write the following bits per pixel: 24.


File Formats: Macintosh Pict Format (PCT)
Macintosh Pict Format (PCT)

Macintosh Pict (PCT) files are produced using Macintosh QuickDraw, and are used in desktop publishing and imaging applications.

PCT Vector files can be read and written as raster images in the non-vector toolkits. LEADTOOLS supports multiple page files when reading and writing PCT images as raster images. Vector read/write support for this format is provided in the LEADTOOLS Vector toolkits and is unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Supported
Background	Supported	Supported
Ellipse	Supported	Not Supported
Foreground	Supported	Supported
Lines	Supported	Supported
Point	Supported	Supported
Polygons	Supported	Not Supported
Rectangle	Supported	Not Supported
Text	Supported	Supported
For PCT files, you can read and write the following bits per pixel: 1, 4, 8, 16, 24.

For PCT (Vector) files, you can read and write (Vector toolkits only) the following bits per pixel: 24.


File Formats: Windows AVI Format (AVI)
Windows AVI Format (AVI)

Windows AVI (AVI) is a file format created by Microsoft and used for multimedia files.  These files store both audio and video data.

For AVI files, you can read the following bits per pixel: 24.

You can write 24-bit AVI files.


File Formats: Silicon Graphics Image Format (SGI)
Silicon Graphics Image Format (SGI)

The SGI file formats was developed at Silicon Graphics, and is used for black and white, gray-scale and color images. LEADTOOLS supports both uncompressed SGI and RLE compressed SGI.

For SGI files, you can read and write the following bits per pixel: 8, 24, 32.


File Formats: TIFF CCITT and Other FAX Formats
TIFF CCITT and Other FAX Formats

LEADTOOLS supports reading and writing of the following 1-bit formats that are commonly used in FAX transmissions:

TIFF

 TIFF CCITT. These are compressed TIFF files that are commonly used for FAX transmission and document imaging.

 TIFF CCITT Group 3. These are TIFF CCITT files in a format that is more advanced and more compressed than TIFF CCITT. LEADTOOLS supports both 1-dimension and 2-dimension variations of this format.

 TIFF CCITT Group 4. These are TIFF CCITT files in a format that is more advanced and more compressed than TIFF CCITT Group 3.

LEAD supports loading and saving multi-page files in this format.

The file constants associated with this file format are:

FILE_CCITT

FILE_CCITT_GROUP3_1DIM

FILE_CCITT_GROUP3_2DIM

FILE_CCITT_GROUP4

Required DLL: LFTIF14N.DLL. This also requires LFFAX14N.DLL.

CALS

 CALS Raster.(Type 1, 2, 3 and 4) These are CCITT Group 4 CALS raster files. CALS is a United States government standard.

The file constants associated with this file format are:

FILE_CALS.

FILE_CALS2

FILE_CALS3

FILE_CALS4

Required DLL: LFCAL14N.DLL. This also requires LFFAX14N.DLL.

IOCA

 IOCA (ICA). This is the Image Object Content Architecture developed by IBM. LEADTOOLS supports these files in an MO:DCA wrapper with embedded 1-bit CCITT Group 3 or Group 4 images. LEADTOOLS also supports IOCA files without an MO:DCA wrapper.

The file constants associated with this file format are:

FILE_ICA_G3_1D

FILE_ICA_G3_2D

FILE_ICA_G4

FILE_ICA_IBM_MMR

FILE_ICA_UNCOMPRESSED

FILE_RAWICA_G3_1D

FILE_RAWICA_G3_2D

FILE_RAWICA_G4

FILE_RAWICA_IBM_MMR

FILE_RAWICA_UNCOMPRESSED

Required DLL: LFICA14N.DLL. This also requires LFFAX14N.DLL.

WinFax

 WinFax Group 3. This is a FAX format created by Delrina for Group 3 support.

 WinFax Group 4. This is a FAX format created by Delrina for Group 4 support.

The file constants associated with this file format are:

FILE_WFX_G3_1D

FILE_WFX_G4

Required DLL: LFWFX14N.DLL. This also requires LFFAX14N.DLL.

Raw FAX

 FAX Group 3. This is a raw FAX format (without a header) for Group 3 support. LEADTOOLS supports both 1-dimension and 2-dimension variations of this format.

 FAX Group 4. This is a raw FAX format (without a header) for Group 4 support.

The file constants associated with this file format are:

FILE_FAX_G3_1D

FILE_FAX_G3_1D_NOEOL

FILE_FAX_G3_2D

FILE_FAX_G4

Required DLL: LFFAX14N.DLL.

Microsoft Fax

 AWD. This is a Microsoft FAX format.

The file constants associated with this file format are:

FILE_AWD

Required DLL: LFAWD14N.DLL, AWVIEW32.DLL, AWDENC32.DLL, AWDCXC32.DLL, AWCODC32.DLL, and AWRESX32.DLL.


File Formats: LEAD 1-Bit Format (CMP)
LEAD 1-Bit Format (CMP)

LEAD 1BIT is a proprietary 1-bit LEAD compressed format that has better compression and performance than CCITT G4, but not as good as LMC.

You can read and write files in this format.


File Formats: LEADTOOLS Vector Dump Format (VEC)
LEADTOOLS Vector Dump Format (VEC)

This is an internal vector format, used by the LEADTOOLS® Vector toolkit. The main advantage of using this format is the speed of writing and the capability of maintaining all the details of the vector data. It can be used to save the status of the vector toolkit, which can provide undo and redo capabilities.

Two versions of this format exist, version 12 and version 13. LEADTOOLS will maintain compatibility between different versions.

This format supports layers, grouping of objects and embedded raster objects.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Supported
Chord	Supported	Supported
Circle	Supported	Supported
Clone	Supported	Supported
Ellipse	Supported	Supported
Elliptical Arc	Supported	Supported
HPolyBezier	Supported	Supported
Lines	Supported	Supported
Pie	Supported	Supported
PolyDraw	Supported	Supported
Polygons	Supported	Supported
Polyline	Supported	Supported
Raster	Supported	Supported
Rectangle	Supported	Supported
Spline	Supported	Supported
Text	Supported	Supported
Vertex	Supported	Supported
The default extension used by this format is: VEC.

File constants associated with this file format are:

FILE_VECTOR_DUMP

Required DLLs: LFVEC14N.DLL. This format also requires LVKRN14N.DLL.

For VEC files, you can read and write the following bits per pixel: 24.


File Formats: LMC Format (LMC)
LMC (LMC)

LMC is the best 1 bit lossless compression provided by LEAD. It gives better results than JBIG, or CCITT G4, and it gives better compression for computer or electronic generated documents than for scanned documents. You can read and write files in this format.

This format is available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.

The default extension used by this format is: LMC.

File constants associated with this file format are:

FILE_LMC

FILE_TIF_LMC

Required DLL: LFLMC14S.DLL.

For LMC files, you can read and write the following bits per pixel: 1.


File Formats: XBitMap (XBM)
XBitMap (XBM)

XBM is a monochrome bitmap format in which data is stored as a C language data array. It is primarily used for the storage of cursor and icon bitmaps, for use in the X graphical user interface.

For XBM files, you can read and write the following bits per pixel: 1.


File Formats: Intergraph (ITG)
Intergraph Format (ITG)

Intergraph is a monochrome bitmap format developed by Intergraph. LEADTOOLS supports the RLE and CIT versions of this file format.

The default extensions used by this format are: ITG and CIT.

This file format does not support stamps or Lossless JPEG compression. For this file format, LEAD supports CCITT G4 and RLE compression.

Currently LEAD writes only the ITG format.

File constants associated with this file format are:

FILE_INTERGRAPH_RLE

For ITG and CIT files, you can read the following bits per pixel: 1.

For ITG files, you can write the following bits per pixel: 1.


File Formats: Miscellaneous 1-Bit Formats (MAC, IMG, and MSP)
Miscellaneous 1-Bit Formats (MAC, IMG, and MSP)

LEADTOOLS supports reading and writing of the following 1-bit formats:

 MacPaint (MAC). These Macintosh Paint files are commonly used for monochrome clip art.

 GEM Image (IMG). These files are native to the Graphical Environment Manager developed by Digital Research.

 Microsoft Paint (MSP). These files from early versions of Windows are used for black-and-white drawings and clip art.


File Formats: Gerber Format (GBR)
Gerber Format (GBR)

The Gerber file format is a vector – based format used by GerbTools, ViewMate and CamTastic as a simple way of transferring printed circuit board information to a wide variety of devices. The Extended Gerber Format (RS-274X) handles information for defining shapes and sizes of lines and other features. This format supports Polygons, Circles, Ovals, Outlines, Arcs, Lines, Rectangles, Moire and Thermal.

This file format is not supported in the non-vector toolkits. Read and write support for this format is provided in the LEADTOOLS Vector toolkits and is unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection.

The default extension used by this format is: GBR.

This file format does support layers.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Arc	Supported	Supported
Chord	Supported	Supported
Circle	Supported	Supported
Lines	Supported	Supported
Polygons	Supported	Supported
Rectangle	Supported	Not Supported
File constants associated with this file format are:

FILE_GERBER

Required DLL: LFGBR14N.DLL. This format also requires LVKRN14N.DLL.

For Gerber files, you can read the following bits per pixel: 24.

For Gerber files, you can write the following bits per pixel: 24.


File Formats: Wireless Bitmap Format (WBMP)
Wireless Bitmap Format (WBMP)

The Wireless Bitmap file format is a 1-bit format used to send graphical information to a variety of handsets. It is terminal independent and describes only graphical information.

For Wireless Bitmap files, you can read the following bits per pixel: 1.

For Wireless Bitmap files, you can write the following bits per pixel: 1.


File Formats: Rich Text Format (RTF)
Rich Text Format (RTF)

The Rich Text Format (RTF) specification is a method of encoding formatted text and graphics for easy transfer between applications. Currently, users depend on special translation software to move word-processing documents between different MS-DOS®, Windows, OS/2, Macintosh, and Power Macintosh applications. This raster format was developed by Microsoft and is used by WordPad.

RTF uses the ANSI, PC-8, Macintosh, or IBM PC character set to control the representation and formatting of a document, both on the screen and in print. With the RTF Specification, documents created under different operating systems and with different software applications can be transferred between those operating systems and applications. LEADTOOLS can load versions 1, 2, and 3.

For information on known problems with the RTF filter on Windows 98 machines, refer to Using the RTF Filter in Windows 98.

The default extension used by this format is: RTF.

File constants associated with this file format are:

FILE_RTF_RASTER

Required DLLs: LFRTF14N.DLL.

For RTF files, you can read the following bits per pixel: 24.


File Formats: Scalable Vector Graphics (SVG)
Scalable Vector Graphics Format (SVG)

The Scalable Vector Graphics file format is an Internet standard vector format for describing two-dimensional graphics in XML. SVG supports vector graphic shapes, images, and text.

This file format is not supported in the non-vector toolkits. Read support and write support for this format are provided in the LEADTOOLS Vector toolkits and are unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

The default extension used by this format is: SVG.

This file format is supported by Adobe SVG Viewer, CorelDraw! 10.0, JASC WebDraw and Apache Batik SVG browser.

This file format does not support layers, but it will save embedded raster objects.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Rectangle	Supported	Supported
Circle	Supported	Supported
Ellipse	Supported	Supported
Lines	Supported	Supported
Polyline	Supported	Supported
Polygons	Supported	Supported
PolyDraw	Supported	Supported
Raster	Supported	Supported
Vertex	Not Supported	Supported
PolyBezier	Not Supported	Supported
Spline	Not Supported	Supported
HPolyBezier	Not Supported	Supported
Text	Supported	Supported
Filling,Stroking, and Marker	Supported	Supported
Gradients and Patterns	Not Supported	Not Supported
Color	Supported	Supported
Clipping, Masking, and Compositing	Not Supported	Not Supported
Filter Effects	Not Supported	Not Supported
Interactivity	Not Supported	Not Supported
Linking	Not Supported	Not Supported
Animation	Not Supported	Not Supported
Fonts	Supported	Supported

When saving SVG files, the images are stored externally and a reference to the image(s) is added to the file.

File constants associated with this file format are:

FILE_SVG

FILE_SVG_EMBED_IMAGES

Required DLL: LFSVG14N.DLL. This format also requires LVKRN14N.DLL.

For SVG files, you can read the following bits per pixel: 24.

For SVG files, you can write the following bits per pixel: 24.


File Formats: Corel Presentation Exchange (CMX)
Corel Presentation Exchange Format (CMX)

The Corel Presentation Exchange file format is the presentation format of the CorelSuite applications. It is a recording of the display primitives of an application to a display interface. The CMX format supports Intel and Motorola binary formats.

CMX adopts the Resource Interchange File Format (RIFF). The entire CMX file is enclosed within either the RIFF or RIFX form, depending on the platform.

This file format is not supported in the non-vector toolkits. Read support and write support for this format are provided in the LEADTOOLS Vector toolkits and are unlocked when the Vector features are unlocked. For more information on available LEADTOOLS products, refer to Topic Selection or contact LEAD.

The default extension used by this format is: CMX.

This file format is supported by CorelDraw.

LEAD supports versions 5, 6, 7, and 8 of this format.

This file format does support layers. LEAD does not support RImage.

The following table indicates which objects LEAD can load and which objects it can save:

Object:	Load:	Save:
Ellipse	Supported	Not Supported
PolyDraw	Supported	Not Supported
Raster	Supported	Not Supported
Rectangle	Supported	Not Supported
Text	Supported	Not Supported
File constants associated with this file format are:

FILE_CMX

Required DLL: LFCMX14N.DLL. This format also requires LVKRN14N.DLL.

For CMX files, you can read the following bits per pixel: 24.


Files To Be Included With Your Application

Note: You may not copy or redistribute any of the following files without obtaining the proper license.  In some cases, the license is included with your initial purchase of LEADTOOLS.  In other cases, you must obtain a license from a third party or enter into a royalty agreement with LEAD to obtain the proper license.  For these special licensing situations, see the notes below accompanying the specific file.

Note: You may not provide software development capabilities in your application. In particular, this means that you must not distribute the LTOCX14.LIC license file.

The following table summarizes the files you must include on your distribution diskettes to support the LEADTOOLS functions on a WIN32 system. (\REDIST subdirectory contains copies of these files.)

If your application uses ODBC, the target system must have the appropriate drivers, which are described in Using ODBC. If necessary, you can include the required ODBC drivers with your application.

Please note that LTKRN, LTDIS, LTEFX, LTIMG and LTFIL are required for ALL OCX applications.

Redistributables:	Explanation:	If you are using a standard release, the files to use are:	If you are using an evaluation release, the files to use are:
LTANN	Annotation support. (Document/Medical only)	DLL: LTANN14N.DLL	DLL: LTANN14E.DLL
LTCLR	LEADTOOLS Color Conversion. This DLL is also required for loading JPEG CMYK images and for loading and saving JPEG LAB images.	DLL: LTCLR14N.DLL	DLL: LTCLR14E.DLL
LTDIC	(Medical Imaging editions  only) DICOM file support. All 32-bit Dicom support is provided in the LTDIC DLL.	DLL: LTDIC14N.DLL	DLL: LTDIC14E.DLL
LTDIS	Display support. Required for all applications.	DLL: LTDIS14N.DLL	DLL: LTDIS14E.DLL
LTEFX	Paint effects support. Required for all applications.	DLL: LTEFX14N.DLL	DLL: LTEFX14E.DLL
LTFIL	File read and write support. Required for all applications.	DLL: LTFIL14N.DLL	DLL: LTFIL14E.DLL
LTIMG	Image processing support. Also requires LTEFX.	DLL: LTIMG14N.DLL	DLL: LTIMG14E.DLL
LTISI	ISIS support. (Document/Medical only)  Note: Please note that you must get the ISIS driver from the scanner manufacturer or from Pixel Translations.  The .chn or .chw file must be in your path for ISIS scanning to work. Your installation procedure must register the ActiveX.	DLL: LTISI14N.DLL OCX: LTISI14N.OCX	DLL: LTISI14E.DLL OCX: LTISI14E.OCX
LTKRN	LEADTOOLS kernel. Required for all applications. For information about the "nag" message and the "no-nag" LTKRN DLL, refer to LEADTOOLS Nag Message.	DLL: LTKRN14N.DLL	DLL: LTKRN14E.DLL
LTLST	ImageList Control. Also requires LTKRN, LTFIL and LTDIS. Your installation procedure must register the ActiveX.	DLL: LTLST14N.DLL OCX: LTLST14N.OCX	DLL: LTLST14E.DLL OCX: LTLST14E.OCX
LTNET	Internet support. LTNET is the LEADTOOLS Internet Support DLL. Also requires LTKRN, LTFIL and the LEAD file format DLLs.  Additional required files are installed by ws2setup.exe (Winsock 2.0). Your installation procedure must register the ActiveX.	DLL: LTNET14N.DLL OCX: LTNET14N.OCX	DLL: LTNET14E.DLL OCX: LTNET14E.OCX
LTOCX	ActiveX support. Required for all applications. Your installation procedure must register the ActiveX.	OCX: LTOCX14N.OCX	OCX: LTOCX14E.OCX
LTODB	OLE DB (ADO) Data Binding Support LEAD OLE DB Control LTKRN and LTFIL are also required. Your installation procedure must register the ActiveX.	OCX: LTODB14N.OCX	OCX: LTODB14E.OCX
LTSCR	Screen Capture. LEAD Screen Capture Control and Screen Capture Support DLL. Also requires LTKRN, LTFIL and the LEAD file format DLLs.  All other necessary files come with the 32-bit Windows Systems. Your installation procedure must register the ActiveX.	DLL: LTSCR14N.DLL OCX: LTSCR14N.OCX	DLL: LTSCR14E.DLL OCX: LTSCR14E.OCX
LTSGM	T44 support. LEAD MRC Control	DLL: LTSGM14N.DLL	DLL: LTSGM14E.DLL
LTTMB	Thumbnail Browser Control. Also requires LTKRN, LTFIL, LTDIS, and LTIMG. Your installation procedure must register the ActiveX.	DLL: LTTMB14N.DLL OCX: LTTMB14N.OCX	DLL: LTTMB14E.DLL OCX: LTTMB14E.OCX
LTTWN	TWAIN support.	DLL: LTTWN14N.DLL	DLL: LTTWN14E.DLL
LTVEC	Vector Control Vector Support DLL. Also requires LVKRN. Your installation procedure must register the ActiveX.	DLL: LTVEC14N.DLL OCX: LTVEC14N.OCX	DLL: LTVEC14E.DLL OCX: LTVEC14E.OCX
LVKRN	LVKRN is the Vector Kernal DLL. Required for all vector functionality.	DLL: LVKRN14N.DLL	DLL: LVKRN14E.DLL
MSVCRT.DLL MFC42.DLL OLE32.DLL OLEAUT32.DLL OLEPRO32.DLL	Windows files required in all applications for OLE support. The LEADTOOLS installation updates these files in your Windows System folder. Do not use earlier versions of these files. (You may encounter a problem with the Visual Basic 4.0 Setup Toolkit as noted in Limitations with Visual Basic.) Your application may require additional Windows files. (For example the LEADTOOLS example programs require additional files as noted in System Files Updated.) Refer to your development system's documentation for information about creating and distributing OLE 2.0 applications.	The same files are used for all versions.	The same files are used for all versions.
File Format Redistributables:	Explanation:	If you are using a standard release, the files to use are:	If you are using a evaluation release, the files to use are:
LFAFP	AFP file format support.	DLL: LFAFP14N.DLL	DLL: LFAFP14E.DLL
LFANI	Windows Animated Cursor	DLL: LFANI14N.DLL	DLL: LFANI14E.DLL
LFAVI	Windows AVI file support (read only).	DLL: LFAVI14N.DLL	DLL: LFAVI14E.DLL
LFAWD	Windows FAX (AWD) file support. AWVIEW32.DLL and AWDENC32.DLL are Microsoft DLLs for reading and writing this format.	DLL: LFAWD14N.DLL AWVIEW32.DLL AWDENC32.DLL AWDCXC32.DLL AWCODC32.DLL AWRESX32.DLL	DLL: LFAWD14E.DLL AWVIEW32.DLL AWDENC32.DLL AWDCXC32.DLL AWCODC32.DLL AWRESX32.DLL
LFBMP	Windows and OS/2 BMP file support, and Windows icon and cursor file support.	DLL: LFBMP14N.DLL	DLL: LFBMP14E.DLL
LFCAL	CALS raster file support, which also requires LFFAX.	DLL: LFCAL14N.DLL	DLL: LFCAL14E.DLL
LFCGM	Computer Graphics Metafile.  This format also requires LVKRN.	DLL: LFCGM14N.DLL	DLL: LFCGM14E.DLL
LFCLP	Microsoft Windows Clipboard.	DLL: LFCLP14N.DLL	DLL: LFCLP14E.DLL
LFCMP	JPEG and LEAD CMP file support.	DLL: LFCMP14N.DLL	DLL: LFCMP14E.DLL
LFCMW	Wavelet CMP support.	DLL: LFCMW14N.DLL	DLL: LFCMW14E.DLL
LFCUT	Dr. Halo file filter	DLL: LFCUT14N.DLL	DLL: LFCUT14E.DLL
LFDGN	Intergraph MicroStation and Interactive Graphics Design System.  This format also requires LVKRN.	DLL: LFDGN14N.DLL	DLL: LFDGN14E.DLL
LFDRW	DRaWing.  This format also requires LVKRN.	DLL: LFDRW14N.DLL	DLL: LFDRW14E.DLL
LFDWF	AutoCAD DWF file filter. This format also requires LVKRN.	DLL: LFDWF14N.DLL	DLL: LFDWF14E.DLL
LFDWG	AutoCAD DWG file filter. This format also requires LVKRN.	DLL: LFDWG14N.DLL	DLL: LFDWG14E.DLL
LFDXF	AutoCAD DXF file filter.  This format also requires LVKRN.	DLL: LFDXF14N.DLL	DLL: LFDXF14E.DLL
LFEPS	Encapsulated PostScript file support, which also requires LFTIF for embedded TIFF support.	DLL: LFEPS14N.DLL	DLL: LFEPS14E.DLL
LFFAX	Raw FAX file support.	DLL: LFFAX14N.DLL	DLL: LFFAX14E.DLL
LFFLC	Flic Animation	DLL: LFFLC14N.DLL	DLL: LFFLC14E.DLL
LFFPX7.DLL LFKODAK.DLL LFFPX	Standard Kodak FlashPix support. All of these libraries are required for FlashPix support.	DLL: LFFPX14N.DLL LFFPX7.DLL LFKODAK.DLL	DLL: LFFPX14E.DLL LFFPX7.DLL LFKODAK.DLL
LFGBR	Gerber file support.	DLL: LFGBR14N.DLL	DLL: LFGBR14E.DLL
LFGIF	GIF file support. Note: Acquire patent license from the Unisys Corp.	DLL: LFGIF14N.DLL	DLL: LFGIF14E.DLL
LFICA	IOCA file support, which also requires LFFAX.	DLL: LFICA14N.DLL	DLL: LFICA14E.DLL
LFIFF	Interchange file filter.	DLL: LFIFF14N.DLL	DLL: LFIFF14E.DLL
LFIMG	GEM Image file support.	DLL: LFIMG14N.DLL	DLL: LFIMG14E.DLL
LFITG	Intergraph RLE filter	DLL: LFITG14N.DLL	DLL: LFITG14E.DLL
LFJ2K	JPEG 2000 Support.	DLL: LFJ2K14N.DLL	DLL: LFJ2K14E.DLL
LFJBG	JBIG file support.	DLL: LFJBG14N.DLL	DLL: LFJBG14E.DLL
LFLMA	File read support for old LEAD 1-bit files (files using LEAD's proprietary 1-bit format that were created with versions earlier than 6.0).	DLL: LFLMA14N.DLL	DLL: LFLMA14E.DLL
LFLMB	New LEAD 1-Bit file support.	DLL: LFLMB14N.DLL	DLL: LFLMB14E.DLL
LFMAC	MacPaint file support.	DLL: LFMAC14N.DLL	DLL: LFMAC14E.DLL
LFMPG	MPEG video support.	DLL: LFMPG14N.DLL	DLL: LFMPG14E.DLL
LFMSP	Microsoft Paint file support.	DLL: LFMSP14N.DLL	DLL: LFMSP14E.DLL
LFPCD	Kodak PhotoCD file support, which also requires PCDLIB32.DLL (for 32-bit).	DLL: LFPCD14N.DLL	DLL: LFPCD14E.DLL
LFPCL	Printer Command Language Format support; Hewlett-Packard Graphics Language for plotters.  This format also requires LVKRN.	DLL: LFPCL14N.DLL	DLL: LFPCL14E.DLL
LFPCT	MacPict file support; Macintosh QuickDraw vector files.  This format also requires LVKRN.	DLL: LFPCT14N.DLL	DLL: LFPCT14E.DLL
LFPCX	Zsoft PCX file support.	DLL: LFPCX14N.DLL	DLL: LFPCX14E.DLL
LFPDF	Portable Document Format support. The LFPDF DLL requires PDFDLL32.DLL.	DLL: LTPDF14N.DLL	DLL: LTPDF14E.DLL
LFPNG	Portable Network Graphics file support.	DLL: LFPNG14N.DLL	DLL: LFPNG14E.DLL
LFPNM	Portable Bitmap Utilities filters. (PBM, PGM, PPM)	DLL: LFPNM14N.DLL	DLL: LFPNM14E.DLL
LFPSD	Adobe Photoshop 3.0 file support.	DLL: LFPSD14N.DLL	DLL: LFPSD14E.DLL
LFRAS	Sun Raster file support.	DLL: LFRAS14N.DLL	DLL: LFRAS14E.DLL
LFRAW	Raw uncompressed file support.	DLL: LFRAW14N.DLL	DLL: LFRAW14E.DLL
LFRTF	RTF file support. For information on known problems with the RTF filter on Windows 98 machines, refer to Using the RTF Filter in Windows 98.	DLL: LFRTF14N.DLL	DLL: LFRTF14E.DLL
LFSCT	Scitex Continuous Tone Format support.	DLL: LFSCT14N.DLL	DLL: LFSCT14E.DLL
LFSGI	Silicon Graphics Format support.	DLL: LFSGI14N.DLL	DLL: LFSGI14E.DLL
LFSHP	ESRI Shape Format support.	DLL: LFSHP14N.DLL	DLL: LFSHP14E.DLL
LFSMP	SMP Format support.	DLL: LFSMP14N.DLL	DLL: LFSMP14E.DLL
LFTGA	TARGA file support.	DLL: LFTGA14N.DLL	DLL: LFTGA14E.DLL
LFTIF	Tagged Image File Format support (including TIFF, TIFLZW, and CCITT). This format also requires LFFAX. If you are loading or saving TIF files that use CMYK or LAB color space, you will also need LTCLR.	DLL: LFTIF14N.DLL	DLL: LFTIF14E.DLL
LFWFX	WinFax file support, which also requires LFFAX.	DLL: LFWFX14N.DLL	DLL: LFWFX14E.DLL
LFWMF	Windows Metafile support.	DLL: LFWMF14N.DLL	DLL: LFWMF14E.DLL
LFWMP	Wireless Bitmap file support.	DLL: LFWMP14N.DLL	DLL: LFWMP14E.DLL
LFWPG	WordPerfect file support.	DLL: LFWPG14N.DLL	DLL: LFWPG14E.DLL
LFXBM	X BitMap file filter	DLL: LFXBM14N.DLL	DLL: LFXBM14E.DLL
LFXPM	X PixMap file filter	DLL: LFXPM14N.DLL	DLL: LFXPM14E.DLL
LFXWD	X Window Dump	DLL: LFXWD14N.DLL	DLL: LFXWD14E.DLL
PCDLIB32.DLL PCDLIB.DLL	Kodak PhotoCD support, which also requires LFPCD.	The same files are used for all versions.	The same files are used for all versions.
PDFDLL32.DLL	PDF support. This is required for reading and writing PDF files in any LEADTOOLS toolkit. It is required if you are using LFPDF14?.DLL. For reading PDF files you must follow the instructions outlined in the "Distributing an application built using the PDF Module" section of Implementing PDF Plug in Features.	The same files are used for all versions.	The same files are used for all versions.


Annotation Automation Strings

Note: This topic is for Document/Medical only.

This is a list of the available Annotation Automation Dialog Strings. These strings are used in association with the AnnSetAutoText method, AnnGetAutoText method, ButtonMenuTextID property, and ButtonToolTipTextID property.

Annotation Automation Audio Dialog Strings

Annotation Automation Capture Dialog Strings

Annotation Automation Fill Dialog Strings

Annotation Automation Line Dialog Strings

Annotation Automation Lock/Unlock Dialog Strings

Annotation Automation Menu Strings

Annotation Automation Miscellaneous Dialog Strings

Annotation Automation Name Dialog Strings

Annotation Automation Nodes Dialog Strings

Annotation Automation Play Video Dialog Strings

Annotation Automation Point Dialog Strings

Annotation Automation Protractor Dialog Strings

Annotation Automation Push Pin Dialog Strings

Annotation Automation ROP2 Dialog Strings

Annotation Automation Ruler Dialog Strings

Annotation Automation Stamp Dialog Strings

Annotation Automation Stamp Metafile Dialog Strings

Annotation Automation Text Dialog Strings

Annotation Automation ToolTip Dialog Strings

Annotation Automation Transparent Color Dialog Strings

Annotation Automation Video Dialog Strings


Annotation Automation Menu Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_MENU_UNDO	"&Undo"

ANNAUTOTEXT_MENU_CUT	"Cu&t"

ANNAUTOTEXT_MENU_COPY	"&Copy"

ANNAUTOTEXT_MENU_PASTE	"&Paste"

ANNAUTOTEXT_MENU_DELETE	"&Delete"

ANNAUTOTEXT_MENU_SELECTALL	"Select &All"

ANNAUTOTEXT_MENU_BRINGTOFRONT	"Bring to &Front"

ANNAUTOTEXT_MENU_SENDTOBACK	"Send to &Back"

ANNAUTOTEXT_MENU_DEFAULTPROPERTIES	"Default Pr&operties"

ANNAUTOTEXT_MENU_SELECTEDPROPERTIES	"Selected Pr&operties"

ANNAUTOTEXT_MENU_CONTAINERPROPERTIES	"Container Pr&operties"

ANNAUTOTEXT_MENU_POINTERPROPERTIES	"Pointer Pr&operties"

ANNAUTOTEXT_MENU_AUDIOPROPERTIES	"Audio Pr&operties"

ANNAUTOTEXT_MENU_BUTTONPROPERTIES	"Button Pr&operties"

ANNAUTOTEXT_MENU_ELLIPSEPROPERTIES	"Ellipse Pr&operties"

ANNAUTOTEXT_MENU_FREEHANDPROPERTIES	"Freehand Pr&operties"

ANNAUTOTEXT_MENU_HILITEPROPERTIES	"Hilite Pr&operties"

ANNAUTOTEXT_MENU_HOTSPOTPROPERTIES	"Hotspot Pr&operties"

ANNAUTOTEXT_MENU_LINEPROPERTIES	"Line Pr&operties"

ANNAUTOTEXT_MENU_NOTEPROPERTIES	"Note Pr&operties"

ANNAUTOTEXT_MENU_POLYGONPROPERTIES	"Polygon Pr&operties"

ANNAUTOTEXT_MENU_POLYLINEPROPERTIES	"Polyline Pr&operties"

ANNAUTOTEXT_MENU_RECTANGLEPROPERTIES	"Rectangle Pr&operties"

ANNAUTOTEXT_MENU_REDACTPROPERTIES	"Redact Pr&operties"

ANNAUTOTEXT_MENU_STAMPPROPERTIES	"Stamp Pr&operties"

ANNAUTOTEXT_MENU_TEXTPROPERTIES	"Text Pr&operties"

ANNAUTOTEXT_MENU_AUTOMATIONPROPERTIES	"Automation Pr&operties"

ANNAUTOTEXT_MENU_RULERPROPERTIES	"Ruler Pr&operties"

ANNAUTOTEXT_MENU_CROSSPRODUCTPROPERTIES	"Cross-Product Pr&operties"

ANNAUTOTEXT_MENU_POINTPROPERTIES	"Point Pr&operties"

ANNAUTOTEXT_MENU_PROTRACTORPROPERTIES	"Protractor Pr&operties"

ANNAUTOTEXT_MENU_VIDEOPROPERTIES	"Video Pr&operties"

ANNAUTOTEXT_MENU_PUSHPINPROPERTIES	"PushPin Pr&operties"

ANNAUTOTEXT_MENU_FREEHANDHOSPOTPROPERTIES	"Freehand Hotspot Pr&operties"

ANNAUTOTEXT_MENU_LINE	"&Line..."

ANNAUTOTEXT_MENU_FILL	"&Fill..."

ANNAUTOTEXT_MENU_FOREGROUNDCOLOR	"F&oreground Color..."

ANNAUTOTEXT_MENU_BACKGROUNDCOLOR	"&Background Color..."

ANNAUTOTEXT_MENU_FONT	"Fo&nt..."

ANNAUTOTEXT_MENU_BITMAP	"&Bitmap..."

ANNAUTOTEXT_MENU_TEXT	"&Text..."

ANNAUTOTEXT_MENU_FILE	"F&ile..."

ANNAUTOTEXT_MENU_ROP2	"ROP&2..."

ANNAUTOTEXT_MENU_TRANSPARENT	"Tr&ansparent"

ANNAUTOTEXT_MENU_LOCK	"&Lock..."

ANNAUTOTEXT_MENU_UNLOCK	"&Unlock..."

ANNAUTOTEXT_MENU_LOCKALL	"&Lock All..."

ANNAUTOTEXT_MENU_UNLOCKALL	"&Unlock All..."

ANNAUTOTEXT_MENU_HYPERLINK	"&Hyperlink..."

ANNAUTOTEXT_MENU_NOTEBACKGROUNDCOLOR	"No&te Background Color..."

ANNAUTOTEXT_MENU_REDACTBACKGROUNDCOLOR	"&Hilite Background Color..."

ANNAUTOTEXT_MENU_HILITEBACKGROUNDCOLOR	"&Redact Background Color..."

ANNAUTOTEXT_MENU_RULER	"&Ruler... "

ANNAUTOTEXT_MENU_RULERPROPERTIES	"Ruler Pr&operties"

ANNAUTOTEXT_MENU_BUTTONFONT	"B&utton Font"

ANNAUTOTEXT_MENU_GROUP	"&Group"

ANNAUTOTEXT_MENU_UNGROUP	"U&ngroup"

ANNAUTOTEXT_MENU_NODES	"No&des..."

ANNAUTOTEXT_MENU_SHOWRULER	"&Show Rulers"

ANNAUTOTEXT_MENU_PROTRACTOR	"&Protractor …"

ANNAUTOTEXT_MENU_NAME	"Name…"

ANNAUTOTEXT_MENU_STAMP_APPROVED	"Approved"

ANNAUTOTEXT_MENU_STAMP_ASSIGNED	"Assigned"

ANNAUTOTEXT_MENU_STAMP_CHECKED	"Checked"

ANNAUTOTEXT_MENU_STAMP_CLATPRV	"Client Attorney Privilege"

ANNAUTOTEXT_MENU_STAMP_COPY	"Copy"

ANNAUTOTEXT_MENU_STAMP_DRAFT	"Draft"

ANNAUTOTEXT_MENU_STAMP_EXTENDED	"Extended"

ANNAUTOTEXT_MENU_STAMP_FAX	"Fax"

ANNAUTOTEXT_MENU_STAMP_FAXED	"Faxed"

ANNAUTOTEXT_MENU_STAMP_IMPORTANT	"Important"

ANNAUTOTEXT_MENU_STAMP_INVOICE	"Invoice"

ANNAUTOTEXT_MENU_STAMP_NOTICE	"Notice"

ANNAUTOTEXT_MENU_STAMP_OFFICIAL	"Official"

ANNAUTOTEXT_MENU_STAMP_ONFILE	"On File"

ANNAUTOTEXT_MENU_STAMP_PAID	"Paid"

ANNAUTOTEXT_MENU_STAMP_PASSED	"Passed"

ANNAUTOTEXT_MENU_STAMP_PENDING	"Pending"

ANNAUTOTEXT_MENU_STAMP_PROCESSED	"Processed"

ANNAUTOTEXT_MENU_STAMP_RECEIVED	"Received"

ANNAUTOTEXT_MENU_STAMP_REJECTED	"Rejected"

ANNAUTOTEXT_MENU_STAMP_RELEASE	"Release"

ANNAUTOTEXT_MENU_STAMP_SENT	"Sent"

ANNAUTOTEXT_MENU_STAMP_SHIPPED	"Shipped"

ANNAUTOTEXT_MENU_STAMP_TOPSECRET	"Top Secret"

ANNAUTOTEXT_MENU_STAMP_URGENT	"Urgent"

ANNAUTOTEXT_MENU_STAMP_VOID	"Void"

ANNAUTOTEXT_MENU_METAFILE	"&Metafile"

ANNAUTOTEXT_MENU_SECONDARYFILE 	"&Secondary Bitmap"

ANNAUTOTEXT_MENU_TRANSPARENTCOLOR 	"&Transparent Color"

ANNAUTOTEXT_MENU_DELETENODE	"D&elete Node"

ANNAUTOTEXT_MENU_ADDNODE	"Add &node"

ANNAUTOTEXT_MENU_CAPTURE	"Capture…"


Annotation Automation Line Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_LINE_CAPTION	"Line"

ANNAUTOTEXT_LINE_WIDTH	"&Width (points)"

ANNAUTOTEXT_LINE_STYLE	"&Style"

ANNAUTOTEXT_LINE_OK	"OK"

ANNAUTOTEXT_LINE_CANCEL	"Cancel"

ANNAUTOTEXT_LINE_SOLID	"Solid"

ANNAUTOTEXT_LINE_DASH	"Dash"

ANNAUTOTEXT_LINE_DOT	"Dot"

ANNAUTOTEXT_LINE_DASHDOT	"Dash-Dot"

ANNAUTOTEXT_LINE_DASHDOTDOT	"Dash-Dot-Dot"

ANNAUTOTEXT_LINE_NULL	"Null"


Annotation Automation Fill Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_FILL_CAPTION	"Fill"

ANNAUTOTEXT_FILL_MODE	"&Mode"

ANNAUTOTEXT_FILL_PATTERNS	"&Patterns"

ANNAUTOTEXT_FILL_POLYGON	"Pol&ygon"

ANNAUTOTEXT_FILL_OK	"OK"

ANNAUTOTEXT_FILL_CANCEL	"Cancel"

ANNAUTOTEXT_FILL_TRANSPARENT	"Transparent"

ANNAUTOTEXT_FILL_TRANSLUCENT	"Translucent"

ANNAUTOTEXT_FILL_OPAQUE	"Opaque"

ANNAUTOTEXT_FILL_SOLID	"Solid"

ANNAUTOTEXT_FILL_BACKWARDDIAGONAL	"Backward Diagonal"

ANNAUTOTEXT_FILL_CROSS	"Cross"

ANNAUTOTEXT_FILL_DIAGONALCROSS	"Diagonal Cross"

ANNAUTOTEXT_FILL_FORWARDDIAGONAL	"Forward Diagonal"

ANNAUTOTEXT_FILL_HORIZONTAL	"Horizontal"

ANNAUTOTEXT_FILL_VERTICAL	"Vertical"

ANNAUTOTEXT_FILL_WINDING	"Winding"

ANNAUTOTEXT_FILL_ALTERNATE	"Alternate"


Annotation Automation Text Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_TEXT_CAPTION	"Text"

ANNAUTOTEXT_TEXT_OK	"OK"

ANNAUTOTEXT_TEXT_CANCEL	"Cancel"


Annotation Automation Audio Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_AUDIOFILE_CAPTION	"Audio File"

ANNAUTOTEXT_AUDIOFILE_FILTER	"Wave Files (*.wav)|*.wav|All Files (*.*)|*.*|"


Annotation Automation Stamp Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_STAMPFILE_CAPTION	"Stamp File"

ANNAUTOTEXT_STAMPFILE_FILTER	"All Files (*.*)|*.*|"


Annotation Automation Lock/Unlock Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_LOCK_CAPTION	"Password"

ANNAUTOTEXT_LOCK_TEXT	"&Password"

ANNAUTOTEXT_LOCK_OK	"OK"

ANNAUTOTEXT_LOCK_CANCEL 	"Cancel"

ANNAUTOTEXT_UNLOCK_CAPTION	"Password"

ANNAUTOTEXT_UNLOCK_TEXT	"&Password"

ANNAUTOTEXT_UNLOCK_OK	"OK"

ANNAUTOTEXT_UNLOCK_CANCEL	"Cancel"


Annotation Automation Miscellaneous Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_ITEM_DEFAULTTEXT	""

ANNAUTOTEXT_ITEM_DEFAULTNAME	""

ANNAUTOTEXT_DIALOG_FONT	""


Annotation Automation ROP2 Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_ROP2_CAPTION	"ROP2"

ANNAUTOTEXT_ROP2_TEXT	"ROP2"

ANNAUTOTEXT_ROP2_OK	"OK"

ANNAUTOTEXT_ROP2_CANCEL 	"Cancel"

ANNAUTOTEXT_ROP2_COPY	"Copy (normal)"

ANNAUTOTEXT_ROP2_AND	"And (highlight)"

ANNAUTOTEXT_ROP2_XOR	"XOR (invert)"


Annotation Automation Ruler Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_RULER_CAPTION	"Ruler"

ANNAUTOTEXT_RULER_UNITS	"&Measurement units",

ANNAUTOTEXT_RULER_ABBREV	"&Unit abbreviation",

ANNAUTOTEXT_RULER_PRECISION	"Precision",

ANNAUTOTEXT_RULER_LENGTH	"&Gauge length",

ANNAUTOTEXT_RULER_OK	"OK"

ANNAUTOTEXT_RULER_CANCEL,	"Cancel"

ANNAUTOTEXT_RULER_INCHES	"inches",

ANNAUTOTEXT_RULER_FEET	"feet",

ANNAUTOTEXT_RULER_YARDS	"yards",

ANNAUTOTEXT_RULER_MICROMETERS	"micrometers",

ANNAUTOTEXT_RULER_MILIMETERS	"milimeters",

ANNAUTOTEXT_RULER_CENTIMETERS	"centimeters",

ANNAUTOTEXT_RULER_METERS	"meters",

ANNAUTOTEXT_RULER_TWIPS	"twips",

ANNAUTOTEXT_RULER_POINTS	"points",

ANNAUTOTEXT_RULER_PIXELS	"pixels",

ANNAUTOTEXT_RULER_SHOWLENGTH	"&Show Length"

ANNAUTOTEXT_RULER_SHOWGAUGE	"S&how Gauge"


Annotation Automation Point Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_POINTFILE_CAPTION	"Point File"

ANNAUTOTEXT_POINTFILE_FILTER	"All Files (*.*)|*.*|"


Annotation Automation Video Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_VIDEOFILE_CAPTION	"Video File"

ANNAUTOTEXT_VIDEOFILE_FILTER	"AVI Files (*.avi)|*.avi|Wave Files (*.wav)|*.wav|All Files (*.*)|*.*|"


Annotation Automation Pushpin Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_PUSHPINFILE_CAPTION	"Pushpin File"

ANNAUTOTEXT_PUSHPINFILE_FILTER	"All Files (*.*)|*.*|"

ANNAUTOTEXT_PUSHPINSECONDARYFILE_CAPTION	"Pushpin Secondary File"

ANNAUTOTEXT_PUSHPINSECONDARYFILE_FILTER	"All Files (*.*)|*.*|"


Annotation Automation Nodes Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_NODES_CAPTION	"Nodes"

ANNAUTOTEXT_NODES_DISPLAYNODES	"&Display Nodes"

ANNAUTOTEXT_NODES_GAP	"&Gap between nodes:"

ANNAUTOTEXT_NODES_OK	"OK"

ANNAUTOTEXT_NODES_CANCEL	"Cancel"

ANNAUTOTEXT_NODES_APPLY	"Apply"


Annotation Automation Protractor Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_PROTRACTOR_CAPTION	"Protractor"

ANNAUTOTEXT_PROTRACTOR_ACUTE	"&Acute"

ANNAUTOTEXT_PROTRACTOR_UNITS	"&Measurement Units"

ANNAUTOTEXT_PROTRACTOR_ABBREV	"&Unit Abbreviation"

ANNAUTOTEXT_PROTRACTOR_PRECISION	"&Precision"

ANNAUTOTEXT_PROTRACTOR_ARCRADIUS	"Arc &radius"

ANNAUTOTEXT_PROTRACTOR_OK	"OK"

ANNAUTOTEXT_PROTRACTOR_CANCEL	"Cancel"

ANNAUTOTEXT_PROTRACTOR_APPLY	"Apply"

ANNAUTOTEXT_PROTRACTOR_DEGREES	"Degrees"

ANNAUTOTEXT_PROTRACTOR_RADIANS	"Radians"


Annotation Automation Name Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_NAME_CAPTION	"Name"

ANNAUTOTEXT_NAME_SHOW	"&Show Name"

ANNAUTOTEXT_NAME_OFFSET	"Name &Offset"

ANNAUTOTEXT_NAME_OFFSET_X	"X"

ANNAUTOTEXT_NAME_OFFSET_Y	"Y"

ANNAUTOTEXT_NAME_RESTRICT	"Name &Restrict"

ANNAUTOTEXT_NAME_OK	"OK"

ANNAUTOTEXT_NAME_CANCEL	"Cancel"

ANNAUTOTEXT_NAME_APPLY	"Apply"


Annotation Automation Play Video Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_PLAYVIDEO_CAPTION	"Play video"

ANNAUTOTEXT_PLAYVIDEO_BALANCE	"Balance"

ANNAUTOTEXT_PLAYVIDEO_VOLUME	"Volume"

ANNAUTOTEXT_PLAYVIDEO_SPEED	"Speed"

ANNAUTOTEXT_PLAYVIDEO_TIP_PLAY	"Play"

ANNAUTOTEXT_PLAYVIDEO_TIP_PAUSE	"Pause"

ANNAUTOTEXT_PLAYVIDEO_TIP_STOP	"Stop"

ANNAUTOTEXT_PLAYVIDEO_TIP_REWIND	"Rewind"

ANNAUTOTEXT_PLAYVIDEO_TIP_FORWARD	"Forward"

ANNAUTOTEXT_PLAYVIDEO_TIP_PREVMARK	"Go to start of selection"

ANNAUTOTEXT_PLAYVIDEO_TIP_NEXTMARK	"Go to end of selection"

ANNAUTOTEXT_PLAYVIDEO_TIP_NEXTFRAME	"Next Frame"

ANNAUTOTEXT_PLAYVIDEO_TIP_PREVFRAME	"Previous Frame"

ANNAUTOTEXT_PLAYVIDEO_TIP_STARTSEL	"Set start of selection"

ANNAUTOTEXT_PLAYVIDEO_TIP_ENDSEL	"Set end of selection"


Annotation Automation Stamp Metafile Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_STAMPMETAFILE_CAPTION	"Stamp Metafile"

ANNAUTOTEXT_STAMPMETAFILE_FILTER	"All metafiles (*.wmf;*.emf)|*.wmf;*.emf|WMF files (*.wmf)|*.wmf|EMF files (*.emf)|*.emf|All Files (*.*)|*.*|"


Annotation Automation ToolTip Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_TOOLTIP_SELECT	"Select"

ANNAUTOTEXT_TOOLTIP_LINE	"Line"

ANNAUTOTEXT_TOOLTIP_RECT	"Rect"

ANNAUTOTEXT_TOOLTIP_ELLIPSE	"Ellipse"

ANNAUTOTEXT_TOOLTIP_POLYLINE	"Polyline"

ANNAUTOTEXT_TOOLTIP_POLYGON	"Polygon"

ANNAUTOTEXT_TOOLTIP_POINTER	"Pointer"

ANNAUTOTEXT_TOOLTIP_FREEHAND	"Freehand"

ANNAUTOTEXT_TOOLTIP_HILITE	"Hilite"

ANNAUTOTEXT_TOOLTIP_REDACT	"Redact"

ANNAUTOTEXT_TOOLTIP_TEXT	"Text"

ANNAUTOTEXT_TOOLTIP_NOTE	"Note"

ANNAUTOTEXT_TOOLTIP_STAMP	"Stamp"

ANNAUTOTEXT_TOOLTIP_RUBBERSTAMP	"Rubber Stamp"

ANNAUTOTEXT_TOOLTIP_HOTSPOT	"Hotspot"

ANNAUTOTEXT_TOOLTIP_FREEHANDHOTSPOT	"Freehand Hotspot"

ANNAUTOTEXT_TOOLTIP_AUDIO	"Audio"

ANNAUTOTEXT_TOOLTIP_BUTTON	"Button"

ANNAUTOTEXT_TOOLTIP_RULER	"Ruler"

ANNAUTOTEXT_TOOLTIP_CROSSPRODUCT	"Crossproduct"

ANNAUTOTEXT_TOOLTIP_POINT	"Point"

ANNAUTOTEXT_TOOLTIP_PROTRACTOR	"Protractor"

ANNAUTOTEXT_TOOLTIP_VIDEO	"Video"

ANNAUTOTEXT_TOOLTIP_PUSHPIN	"Pushpin"


Annotation Automation Transparent Color Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_TRANSPARENTCOLOR_CAPTION	"Pick transparent color"

ANNAUTOTEXT_TRANSPARENTCOLOR_COLORARRAYFRAME	"Bitmap colors"

ANNAUTOTEXT_TRANSPARENTCOLOR_CURRENTCOLORFRAME	"Current color"

ANNAUTOTEXT_TRANSPARENTCOLOR_COLOR	"Color:"

ANNAUTOTEXT_TRANSPARENTCOLOR_RED	"Red:"

ANNAUTOTEXT_TRANSPARENTCOLOR_GREEN	"Green:"

ANNAUTOTEXT_TRANSPARENTCOLOR_BLUE	"Blue:"

ANNAUTOTEXT_TRANSPARENTCOLOR_OK	"OK"

ANNAUTOTEXT_TRANSPARENTCOLOR_CANCEL	"Cancel"


Annotation Automation Capture Dialog Strings

The following are constants and their default values. You can get the current value using the AnnGetAutoText method. You can modify the string using the AnnSetAutoText method.

Constant	Default String

ANNAUTOTEXT_CAPTUREFILE_CAPTION	"Choose a File Name"

ANNAUTOTEXT_CAPTUREFILE_FILTER	"AVI Files (*.AVI)\0*.avi\0All Files (*.*)\0*.*\0\0"

ANNAUTOTEXT_CAPTUREWINDOW_CAPTION	"Capture Window"

ANNAUTOTEXT_CAPTURE_CAPTION	"Capture Dialog"

ANNAUTOTEXT_CAPTURE_CAPTUREDRIVERS	"Capture Drivers"

ANNAUTOTEXT_CAPTURE_VIDEODIALOGS	"Capture Driver Dialogs"

ANNAUTOTEXT_CAPTURE_VIDEOFORMAT	"Video Format"

ANNAUTOTEXT_CAPTURE_VIDEODISPLAY	"Video Display"

ANNAUTOTEXT_CAPTURE_VIDEOSOURCE	"Video Source"

ANNAUTOTEXT_CAPTURE_VIDEOCOMPRESSION	"Video Compression"

ANNAUTOTEXT_CAPTURE_DISPLAYMODE	"Display Mode"

ANNAUTOTEXT_CAPTURE_NONE	"None"

ANNAUTOTEXT_CAPTURE_NONEOVERLAY	"Overlay"

ANNAUTOTEXT_CAPTURE_PREVIEW	"Preview"

ANNAUTOTEXT_CAPTURE_PREVIEWFRAMESPERSEC	"Frames Per Sec"

ANNAUTOTEXT_CAPTURE_OPTIONS	"Capture Options"

ANNAUTOTEXT_CAPTURE_TIMELIMIT	"Time Limit (sec)"

ANNAUTOTEXT_CAPTURE_CAPTUREFRAMESPERSEC	"Frames Per Sec"

ANNAUTOTEXT_CAPTURE_STARTCAPTURE	"Start Capture"

ANNAUTOTEXT_CAPTURE_ENDCAPTURE	"End Capture"

ANNAUTOTEXT_CAPTURE_FRAMESCAPTURED	"Frames Captured"

ANNAUTOTEXT_CAPTURE_AUDIOOPTIONS	"Audio Options"

ANNAUTOTEXT_CAPTURE_CAPTUREAUDIO	"Capture Audio"

ANNAUTOTEXT_CAPTURE_SYNCAUDIO	"Sync Audio to Video"

ANNAUTOTEXT_CAPTURE_CAPTUREFILE	"Capture File"

ANNAUTOTEXT_CAPTURE_BROWSE	"Browse..."

ANNAUTOTEXT_CAPTURE_FILESIZE	"File Size (bytes)"

ANNAUTOTEXT_CAPTURE_OK	"OK"

ANNAUTOTEXT_CAPTURE_CANCEL	"Cancel"

ANNAUTOTEXT_CAPTURE_WAV_1M08	"11.025 kHz, Mono,    8-bit"

ANNAUTOTEXT_CAPTURE_WAV_1S08	"11.025 kHz, Stereo,  8-bit"

ANNAUTOTEXT_CAPTURE_WAV_1M16	"11.025 kHz, Mono,   16-bit"

ANNAUTOTEXT_CAPTURE_WAV_1S16	"11.025 kHz, Stereo, 16-bit"

ANNAUTOTEXT_CAPTURE_WAV_2M08	"22.050 kHz, Mono,    8-bit"

ANNAUTOTEXT_CAPTURE_WAV_2S08	"22.050 kHz, Stereo,  8-bit"

ANNAUTOTEXT_CAPTURE_WAV_2M16	"22.050 kHz, Mono,   16-bit"

ANNAUTOTEXT_CAPTURE_WAV_2S16	"22.050 kHz, Stereo, 16-bit"

ANNAUTOTEXT_CAPTURE_WAV_4M08	"44.100 kHz, Mono,    8-bit"

ANNAUTOTEXT_CAPTURE_WAV_4S08	"44.100 kHz, Stereo,  8-bit"

ANNAUTOTEXT_CAPTURE_WAV_4M16	"44.100 kHz, Mono,   16-bit"

ANNAUTOTEXT_CAPTURE_WAV_4S16	"44.100 kHz, Stereo, 16-bit"

ANNAUTOTEXT_CAPTURE_DEFAULTNAME	"c:\\capture.avi"

ANNAUTOTEXT_CAPTURE_NODRIVERS	"No Capture Drivers Available"


Annotation Toolbar Buttons

The following are constants for the available Annotation Toolbar Buttons.

Value	Meaning

ANNTOOL_SELECT	[0] Selection Pointer Tool

ANNTOOL_LINE	[1] Line Tool

ANNTOOL_RECT	[2] Rectangle Tool

ANNTOOL_ELLIPSE	[3] Ellipse Tool

ANNTOOL_POLYLINE	[4] Polyline Tool

ANNTOOL_POLYGON	[5] Polygon Tool

ANNTOOL_POINTER	[6] Pointer Tool

ANNTOOL_FREEHAND	[7] Freehand Line Tool

ANNTOOL_HILITE	[8] Highlight Tool

ANNTOOL_REDACT	[9] Redaction Tool

ANNTOOL_TEXT	[10] Text Tool

ANNTOOL_NOTE	[11] Note Tool

ANNTOOL_STAMP	[12] Stamp Tool

ANNTOOL_BUTTON	[13] Button Tool

ANNTOOL_HOTSPOT	[14] Hot spot Tool

ANNTOOL_AUDIO	[15] Audio Clip Tool

ANNTOOL_RULER	[16] Ruler Tool

ANNTOOL_CROSSPRODUCT	[17] Cross product Tool

ANNTOOL_POINT	[18] Point Tool

ANNTOOL_PROTRACTOR	[19] Protractor Tool

ANNTOOL_VIDEO	[20] Video Tool

ANNTOOL_PUSHPIN	[21] PushPin Tool

ANNTOOL_FREEHANDHOTSPOT	[22] Freehand Hot Spot Tool

ANNTOOL_STAMP_APPROVED	[23] Approved Stamp

ANNTOOL_STAMP_ASSIGNED	[24] Assigned Stamp

ANNTOOL_STAMP_CHECKED	[25] Checked Stamp

ANNTOOL_STAMP_CLATPRV	[26] Client Attorney Privilege

ANNTOOL_STAMP_COPY	[27] Copy Stamp

ANNTOOL_STAMP_DRAFT	[28] Draft Stamp

ANNTOOL_STAMP_EXTENDED	[29] Extended Stamp

ANNTOOL_STAMP_FAX	[30] Fax Stamp

ANNTOOL_STAMP_FAXED	[31] Faxed Stamp

ANNTOOL_STAMP_IMPORTANT	[32] Important Stamp

ANNTOOL_STAMP_INVOICE	[33] Invoice Stamp

ANNTOOL_STAMP_NOTICE	[34] Notice Stamp

ANNTOOL_STAMP_OFFICIAL	[35] Official Stamp

ANNTOOL_STAMP_ONFILE	[36] On File Stamp

ANNTOOL_STAMP_PAID	[37] Paid Stamp

ANNTOOL_STAMP_PASSED	[38] Passed Stamp

ANNTOOL_STAMP_PENDING	[39] Pending Stamp

ANNTOOL_STAMP_PROCESSED	[40] Processed Stamp

ANNTOOL_STAMP_RECEIVED	[41] Received Stamp

ANNTOOL_STAMP_REJECTED	[42] Rejected Stamp

ANNTOOL_STAMP_RELEASE	[43] Release Stamp

ANNTOOL_STAMP_SENT	[44] Sent Stamp

ANNTOOL_STAMP_SHIPPED	[45] Shipped Stamp

ANNTOOL_STAMP_TOPSECRET	[46] Top Secret Stamp

ANNTOOL_STAMP_URGENT	[47] Urgent Stamp

ANNTOOL_STAMP_VOID	[48] Void Stamp

ANNTOOL_USER	[0x0100] First user defined tool

ANNTOOL_USERLAST	[0x0200] Last allowed user defined tools


Types of Annotations

Note: This topic is for Document/Medical only.

LEADTOOLS supports the following types of annotation objects:

Constant	Meaning

ANNOBJECT_CONTAINER	[0] Container Annotation Object

ANNOBJECT_TEXT	[15] Text Annotation Object

ANNOBJECT_NOTE	[9] Note Annotation Object

ANNOBJECT_LINE	[8] Line Annotation Object

ANNOBJECT_POLYLINE	[11] Polyline Annotation Object

ANNOBJECT_FREEHAND	[5] Freehand Line Annotation Object

ANNOBJECT_RECT	[12] Rectangle Annotation Object

ANNOBJECT_ELLIPSE	[4] Ellipse Annotation Object

ANNOBJECT_POLYGON	[10] Polygon Annotation Object

ANNOBJECT_POINTER	[1] Pointer Annotation Object

ANNOBJECT_BUTTON	[3] Button Annotation Object

ANNOBJECT_STAMP	[14] Stamp Annotation Object

ANNOBJECT_HILITE	[6] Highlight Annotation Object

ANNOBJECT_REDACT	[13] Redaction Annotation Object

ANNOBJECT_AUDIO	[2] Audio Clip Annotation Object

ANNOBJECT_HOTSPOT	[7] Hot Spot Annotation Object

ANNOBJECT_AUTOMATION	[16] Annotation Automation Object

ANNOBJECT_RULER	[17] Ruler Annotation Object

ANNOBJECT_CROSSPRODUCT	[18] Cross Product Annotation Object

ANNOBJECT_POINT	[19] Point Annotation Object

ANNOBJECT_PROTRACTOR	[20] Protractor Annotation Object

ANNOBJECT_VIDEO	[21] Video Annotation Object

ANNOBJECT_PUSHPIN	[22] PushPin Annotation Object

ANNOBJECT_FREEHANDHOTSPOT	[23] Freehand Hotspot Annotation Object

ANNOBJECT_ALL	[-1] All annotation object types


Using Palette Indexes As Color Values

Methods and properties that take an OLE_COLOR data type can also reference a particular index in the current bitmap's palette. This can be useful in cases where a color is used for transparency and the palette may contain the same color in more than one palette position.

When specifying a palette index as a color value, use the following formula:

16777216 + index

When evaluating a palette index, you can use the following logic:

if value >= 16777216 then
    index = value - 16777216


Converting 16-bit Grayscale Values

If you want to use a 16-bit grayscale value in a non LEADTOOLS procedure, you need to convert the value as follows:

COLORREF color;
unsigned char gray;

color = Pixel(x,y);
if (color & COLORREF_GRAY16)
{ /*non standard colorref value, convert it to a windows COLORREF
      get an 8 bit gray value corresponding to the 16 bit gray value */
    gray = (color & 0xFFFF) >> 8;
/* use the standard windows RGB macro to get a windows COLORREF */
    color = RGB(gray, gray, gray);
}

Please note that this is pseudocode and will have to be modified to suit the compiler you are using.


System Files Updated

The LEADTOOLS installation procedure adds the DLL files and all of the required driver files to your WINDOWS\SYSTEM directory. For a list of these files, refer to Files To Be Included With Your Application.

In addition, the installation procedure, as noted in the remainder of this topic, updates Windows system files that are required by the LEADTOOLS example programs.

The LEADTOOLS WIN32 installation procedure adds the following Windows files to your WINDOWS\SYSTEM directory. If your system has an earlier version of any of these files, the installation procedure overwrites it with the newer version.

COMDLG32.OCX
CTL3D32.DLL
MFC40.DLL
MFC42.DLL
MSVCRT20.DLL
MSVCRT40.DLL
MSVCRT.DLL
OC30.DLL
OLE32.DLL
OLEAUT32.DLL
OLEPRO32.DLL
STDOLE2.TLB
VB40032.DLL
VEN2232.OLB


Effects

The following values may be used for the PaintEffect property.

Value	Meaning

No effect class

EFX_EFFECT_NONE	No effect

EFX_EFFECT_NO_PICTURE	No picture (no background)

EFX_EFFECT_MAX	Number of effects in this class.

Linear wipe class

EFX_EFFECT_WIPE_L_TO_R	Wipe left to right

EFX_EFFECT_WIPE_R_TO_L	Wipe right to left

EFX_EFFECT_WIPE_T_TO_B	Wipe top to bottom

EFX_EFFECT_WIPE_B_TO_T	Wipe bottom to top

EFX_EFFECT_WIPE_LT_TO_RB	Wipe left-top to right-bottom

EFX_EFFECT_WIPE_LB_TO_RT	Wipe left-bottom to right-top

EFX_EFFECT_WIPE_RT_TO_LB	Wipe right-top to left-bottom

EFX_EFFECT_WIPE_RB_TO_LT	Wipe right-bottom to left-top

EFX_EFFECT_WIPE_INTERH_L_TO_R_THEN_L_TO_R	Wipe horizontal interlace left to right twice

EFX_EFFECT_WIPE_INTERV_T_TO_B_THEN_T_TO_B	Wipe vertical interlace top to bottom twice

EFX_EFFECT_WIPE_INTERH_L_TO_R_THEN_R_TO_L	Wipe horizontal interlace left to right then back

EFX_EFFECT_WIPE_INTERV_T_TO_B_THEN_B_TO_T	Wipe vertical interlace top to bottom then back

EFX_EFFECT_WIPE_INTERV_L_TO_R_THEN_L_TO_R	Wipe vertical interlace left to right twice

EFX_EFFECT_WIPE_INTERV_R_TO_L_THEN_R_TO_L	Wipe vertical interlace right to left twice

EFX_EFFECT_WIPE_INTERH_T_TO_B_THEN_T_TO_B	Wipe horizontal interlace top to bottom twice

EFX_EFFECT_WIPE_INTERH_B_TO_T_THEN_B_TO_T	Wipe horizontal interlace bottom to top twice

EFX_EFFECT_WIPE_INTERV_L_TO_R_THEN_R_TO_L	Wipe vertical interlace left to right then back

EFX_EFFECT_WIPE_INTERV_R_TO_L_THEN_L_TO_R	Wipe vertical interlace right to left then back

EFX_EFFECT_WIPE_INTERH_T_TO_B_THEN_B_TO_T	Wipe horizontal interlace top to bottom then back

EFX_EFFECT_WIPE_INTERH_B_TO_T_THEN_T_TO_B	Wipe horizontal interlace bottom to top then back

EFX_EFFECT_WIPE_INTERH_L_TO_R_AND_R_TO_L	Wipe horizontal interlace left to right and right to left

EFX_EFFECT_WIPE_INTERV_T_TO_B_AND_B_TO_T	Wipe vertical interlace top to bottom and bottom to top

EFX_EFFECT_WIPE_INTERV_L_AND_R_TO_C	Wipe vertical interlace left and right to center

EFX_EFFECT_WIPE_INTERV_C_TO_L_AND_R	Wipe vertical interlace center to left and right

EFX_EFFECT_WIPE_INTERH_T_AND_B_TO_C	Wipe horizontal interlace top and bottom to center

EFX_EFFECT_WIPE_INTERH_C_TO_T_AND_B	Wipe horizontal interlace center to top and bottom

EFX_EFFECT_WIPE_INTERV_L_AND_R_TO_C_THEN_C_TO_L_AND_R	Wipe vertical interlace left and right to center then back

EFX_EFFECT_WIPE_INTERV_C_TO_L_AND_R_THEN_L_AND_R_TO_C	Wipe vertical interlace center to left and right then back

EFX_EFFECT_WIPE_INTERH_T_AND_B_TO_C_THEN_C_TO_T_AND_B	Wipe horizontal interlace top and bottom to center then back

EFX_EFFECT_WIPE_INTERH_C_TO_T_AND_B_THEN_T_AND_B_TO_C	Wipe horizontal interlace center to top and bottom then back

EFX_EFFECT_WIPE2_LT_AND_RB_TO_C	Wipe2 left-top and right-bottom to center

EFX_EFFECT_WIPE2_LB_AND_RT_TO_C	Wipe2 left-bottom and right-top to center

EFX_EFFECT_WIPE2_C_TO_LT_AND_RB	Wipe2 center to left-top and right-bottom

EFX_EFFECT_WIPE2_C_TO_LB_AND_RT	Wipe2 center to left-bottom and right-top

EFX_EFFECT_WIPE2_LB_AND_RB_TO_T	Wipe2 left-bottom and right-bottom to top

EFX_EFFECT_WIPE2_LT_AND_RT_TO_B	Wipe2 left-top and right-top to bottom

EFX_EFFECT_WIPE2_RT_AND_RB_TO_L	Wipe2 right-top and right-bottom to left

EFX_EFFECT_WIPE2_LT_AND_LB_TO_R	Wipe2 left-top and left-bottom to right

EFX_EFFECT_WIPE2_L_T_TO_B_AND_R_B_TO_T	Wipe2 left top to bottom and right bottom to top

EFX_EFFECT_WIPE2_T_L_TO_R_AND_B_R_TO_L	Wipe2 top left to right and bottom right to left

EFX_EFFECT_WIPE4_CORNERS_OUT	Wipe4 corners out

EFX_EFFECT_WIPE4_C_TO_L_AND_R_THEN_T_AND_B	Wipe4 center to left and right then top and bottom

EFX_EFFECT_WIPE4_T_AND_B_THEN_L_AND_R_TO_C	Wipe4 top and bottom then left and right to center

EFX_EFFECT_WIPE4_L_L_L_L	Wipe4 left left left left

EFX_EFFECT_WIPE4_L_L_L_R	Wipe4 left left left right

EFX_EFFECT_WIPE4_L_L_L_T	Wipe4 left left left top

EFX_EFFECT_WIPE4_L_L_L_B	Wipe4 left left left bottom

EFX_EFFECT_WIPE4_L_L_R_L	Wipe4 left left right left

EFX_EFFECT_WIPE4_L_L_R_R	Wipe4 left left right right

EFX_EFFECT_WIPE4_L_L_R_T	Wipe4 left left right top

EFX_EFFECT_WIPE4_L_L_R_B	Wipe4 left left right bottom

EFX_EFFECT_WIPE4_L_L_T_L	Wipe4 left left top left

EFX_EFFECT_WIPE4_L_L_T_R	Wipe4 left left top right

EFX_EFFECT_WIPE4_L_L_T_T	Wipe4 left left top top

EFX_EFFECT_WIPE4_L_L_T_B	Wipe4 left left top bottom

EFX_EFFECT_WIPE4_L_L_B_L	Wipe4 left left bottom left

EFX_EFFECT_WIPE4_L_L_B_R	Wipe4 left left bottom right

EFX_EFFECT_WIPE4_L_L_B_T	Wipe4 left left bottom top

EFX_EFFECT_WIPE4_L_L_B_B	Wipe4 left left bottom bottom

EFX_EFFECT_WIPE4_L_R_L_L	Wipe4 left right left left

EFX_EFFECT_WIPE4_L_R_L_R	Wipe4 left right left right

EFX_EFFECT_WIPE4_L_R_L_T	Wipe4 left right left top

EFX_EFFECT_WIPE4_L_R_L_B	Wipe4 left right left bottom

EFX_EFFECT_WIPE4_L_R_R_L	Wipe4 left right right left

EFX_EFFECT_WIPE4_L_R_R_R	Wipe4 left right right right

EFX_EFFECT_WIPE4_L_R_R_T	Wipe4 left right right top

EFX_EFFECT_WIPE4_L_R_R_B	Wipe4 left right right bottom

EFX_EFFECT_WIPE4_L_R_T_L	Wipe4 left right top left

EFX_EFFECT_WIPE4_L_R_T_R	Wipe4 left right top right

EFX_EFFECT_WIPE4_L_R_T_T	Wipe4 left right top top

EFX_EFFECT_WIPE4_L_R_T_B	Wipe4 left right top bottom

EFX_EFFECT_WIPE4_L_R_B_L	Wipe4 left right bottom left

EFX_EFFECT_WIPE4_L_R_B_R	Wipe4 left right bottom right

EFX_EFFECT_WIPE4_L_R_B_T	Wipe4 left right bottom top

EFX_EFFECT_WIPE4_L_R_B_B	Wipe4 left right bottom bottom

EFX_EFFECT_WIPE4_L_T_L_L	Wipe4 left top left left

EFX_EFFECT_WIPE4_L_T_L_R	Wipe4 left top left right

EFX_EFFECT_WIPE4_L_T_L_T	Wipe4 left top left top

EFX_EFFECT_WIPE4_L_T_L_B	Wipe4 left top left bottom

EFX_EFFECT_WIPE4_L_T_R_L	Wipe4 left top right left

EFX_EFFECT_WIPE4_L_T_R_R	Wipe4 left top right right

EFX_EFFECT_WIPE4_L_T_R_T	Wipe4 left top right top

EFX_EFFECT_WIPE4_L_T_R_B	Wipe4 left top right bottom

EFX_EFFECT_WIPE4_L_T_T_L	Wipe4 left top top left

EFX_EFFECT_WIPE4_L_T_T_R	Wipe4 left top top right

EFX_EFFECT_WIPE4_L_T_T_T	Wipe4 left top top top

EFX_EFFECT_WIPE4_L_T_T_B	Wipe4 left top top bottom

EFX_EFFECT_WIPE4_L_T_B_L	Wipe4 left top bottom left

EFX_EFFECT_WIPE4_L_T_B_R	Wipe4 left top bottom right

EFX_EFFECT_WIPE4_L_T_B_T	Wipe4 left top bottom top

EFX_EFFECT_WIPE4_L_T_B_B	Wipe4 left top bottom bottom

EFX_EFFECT_WIPE4_L_B_L_L	Wipe4 left bottom left left

EFX_EFFECT_WIPE4_L_B_L_R	Wipe4 left bottom left right

EFX_EFFECT_WIPE4_L_B_L_T	Wipe4 left bottom left top

EFX_EFFECT_WIPE4_L_B_L_B	Wipe4 left bottom left bottom

EFX_EFFECT_WIPE4_L_B_R_L	Wipe4 left bottom right left

EFX_EFFECT_WIPE4_L_B_R_R	Wipe4 left bottom right right

EFX_EFFECT_WIPE4_L_B_R_T	Wipe4 left bottom right top

EFX_EFFECT_WIPE4_L_B_R_B	Wipe4 left bottom right bottom

EFX_EFFECT_WIPE4_L_B_T_L	Wipe4 left bottom top left

EFX_EFFECT_WIPE4_L_B_T_R	Wipe4 left bottom top right

EFX_EFFECT_WIPE4_L_B_T_T	Wipe4 left bottom top top

EFX_EFFECT_WIPE4_L_B_T_B	Wipe4 left bottom top bottom

EFX_EFFECT_WIPE4_L_B_B_L	Wipe4 left bottom bottom left

EFX_EFFECT_WIPE4_L_B_B_R	Wipe4 left bottom bottom right

EFX_EFFECT_WIPE4_L_B_B_T	Wipe4 left bottom bottom top

EFX_EFFECT_WIPE4_L_B_B_B	Wipe4 left bottom bottom bottom

EFX_EFFECT_WIPE4_R_L_L_L	Wipe4 right left left left

EFX_EFFECT_WIPE4_R_L_L_R	Wipe4 right left left right

EFX_EFFECT_WIPE4_R_L_L_T	Wipe4 right left left top

EFX_EFFECT_WIPE4_R_L_L_B	Wipe4 right left left bottom

EFX_EFFECT_WIPE4_R_L_R_L	Wipe4 right left right left

EFX_EFFECT_WIPE4_R_L_R_R	Wipe4 right left right right

EFX_EFFECT_WIPE4_R_L_R_T	Wipe4 right left right top

EFX_EFFECT_WIPE4_R_L_R_B	Wipe4 right left right bottom

EFX_EFFECT_WIPE4_R_L_T_L	Wipe4 right left top left

EFX_EFFECT_WIPE4_R_L_T_R	Wipe4 right left top right

EFX_EFFECT_WIPE4_R_L_T_T	Wipe4 right left top top

EFX_EFFECT_WIPE4_R_L_T_B	Wipe4 right left top bottom

EFX_EFFECT_WIPE4_R_L_B_L	Wipe4 right left bottom left

EFX_EFFECT_WIPE4_R_L_B_R	Wipe4 right left bottom right

EFX_EFFECT_WIPE4_R_L_B_T	Wipe4 right left bottom top

EFX_EFFECT_WIPE4_R_L_B_B	Wipe4 right left bottom bottom

EFX_EFFECT_WIPE4_R_R_L_L	Wipe4 right right left left

EFX_EFFECT_WIPE4_R_R_L_R	Wipe4 right right left right

EFX_EFFECT_WIPE4_R_R_L_T	Wipe4 right right left top

EFX_EFFECT_WIPE4_R_R_L_B	Wipe4 right right left bottom

EFX_EFFECT_WIPE4_R_R_R_L	Wipe4 right right right left

EFX_EFFECT_WIPE4_R_R_R_R	Wipe4 right right right right

EFX_EFFECT_WIPE4_R_R_R_T	Wipe4 right right right top

EFX_EFFECT_WIPE4_R_R_R_B	Wipe4 right right right bottom

EFX_EFFECT_WIPE4_R_R_T_L	Wipe4 right right top left

EFX_EFFECT_WIPE4_R_R_T_R	Wipe4 right right top right

EFX_EFFECT_WIPE4_R_R_T_T	Wipe4 right right top top

EFX_EFFECT_WIPE4_R_R_T_B	Wipe4 right right top bottom

EFX_EFFECT_WIPE4_R_R_B_L	Wipe4 right right bottom left

EFX_EFFECT_WIPE4_R_R_B_R	Wipe4 right right bottom right

EFX_EFFECT_WIPE4_R_R_B_T	Wipe4 right right bottom top

EFX_EFFECT_WIPE4_R_R_B_B	Wipe4 right right bottom bottom

EFX_EFFECT_WIPE4_R_T_L_L	Wipe4 right top left left

EFX_EFFECT_WIPE4_R_T_L_R	Wipe4 right top left right

EFX_EFFECT_WIPE4_R_T_L_T	Wipe4 right top left top

EFX_EFFECT_WIPE4_R_T_L_B	Wipe4 right top left bottom

EFX_EFFECT_WIPE4_R_T_R_L	Wipe4 right top right left

EFX_EFFECT_WIPE4_R_T_R_R	Wipe4 right top right right

EFX_EFFECT_WIPE4_R_T_R_T	Wipe4 right top right top

EFX_EFFECT_WIPE4_R_T_R_B	Wipe4 right top right bottom

EFX_EFFECT_WIPE4_R_T_T_L	Wipe4 right top top left

EFX_EFFECT_WIPE4_R_T_T_R	Wipe4 right top top right

EFX_EFFECT_WIPE4_R_T_T_T	Wipe4 right top top top

EFX_EFFECT_WIPE4_R_T_T_B	Wipe4 right top top bottom

EFX_EFFECT_WIPE4_R_T_B_L	Wipe4 right top bottom left

EFX_EFFECT_WIPE4_R_T_B_R	Wipe4 right top bottom right

EFX_EFFECT_WIPE4_R_T_B_T	Wipe4 right top bottom top

EFX_EFFECT_WIPE4_R_T_B_B	Wipe4 right top bottom bottom

EFX_EFFECT_WIPE4_R_B_L_L	Wipe4 right bottom left left

EFX_EFFECT_WIPE4_R_B_L_R	Wipe4 right bottom left right

EFX_EFFECT_WIPE4_R_B_L_T	Wipe4 right bottom left top

EFX_EFFECT_WIPE4_R_B_L_B	Wipe4 right bottom left bottom

EFX_EFFECT_WIPE4_R_B_R_L	Wipe4 right bottom right left

EFX_EFFECT_WIPE4_R_B_R_R	Wipe4 right bottom right right

EFX_EFFECT_WIPE4_R_B_R_T	Wipe4 right bottom right top

EFX_EFFECT_WIPE4_R_B_R_B	Wipe4 right bottom right bottom

EFX_EFFECT_WIPE4_R_B_T_L	Wipe4 right bottom top left

EFX_EFFECT_WIPE4_R_B_T_R	Wipe4 right bottom top right

EFX_EFFECT_WIPE4_R_B_T_T	Wipe4 right bottom top top

EFX_EFFECT_WIPE4_R_B_T_B	Wipe4 right bottom top bottom

EFX_EFFECT_WIPE4_R_B_B_L	Wipe4 right bottom bottom left

EFX_EFFECT_WIPE4_R_B_B_R	Wipe4 right bottom bottom right

EFX_EFFECT_WIPE4_R_B_B_T	Wipe4 right bottom bottom top

EFX_EFFECT_WIPE4_R_B_B_B	Wipe4 right bottom bottom bottom

EFX_EFFECT_WIPE4_T_L_L_L	Wipe4 top left left left

EFX_EFFECT_WIPE4_T_L_L_R	Wipe4 top left left right

EFX_EFFECT_WIPE4_T_L_L_T	Wipe4 top left left top

EFX_EFFECT_WIPE4_T_L_L_B	Wipe4 top left left bottom

EFX_EFFECT_WIPE4_T_L_R_L	Wipe4 top left right left

EFX_EFFECT_WIPE4_T_L_R_R	Wipe4 top left right right

EFX_EFFECT_WIPE4_T_L_R_T	Wipe4 top left right top

EFX_EFFECT_WIPE4_T_L_R_B	Wipe4 top left right bottom

EFX_EFFECT_WIPE4_T_L_T_L	Wipe4 top left top left

EFX_EFFECT_WIPE4_T_L_T_R	Wipe4 top left top right

EFX_EFFECT_WIPE4_T_L_T_T	Wipe4 top left top top

EFX_EFFECT_WIPE4_T_L_T_B	Wipe4 top left top bottom

EFX_EFFECT_WIPE4_T_L_B_L	Wipe4 top left bottom left

EFX_EFFECT_WIPE4_T_L_B_R	Wipe4 top left bottom right

EFX_EFFECT_WIPE4_T_L_B_T	Wipe4 top left bottom top

EFX_EFFECT_WIPE4_T_L_B_B	Wipe4 top left bottom bottom

EFX_EFFECT_WIPE4_T_R_L_L	Wipe4 top right left left

EFX_EFFECT_WIPE4_T_R_L_R	Wipe4 top right left right

EFX_EFFECT_WIPE4_T_R_L_T	Wipe4 top right left top

EFX_EFFECT_WIPE4_T_R_L_B	Wipe4 top right left bottom

EFX_EFFECT_WIPE4_T_R_R_L	Wipe4 top right right left

EFX_EFFECT_WIPE4_T_R_R_R	Wipe4 top right right right

EFX_EFFECT_WIPE4_T_R_R_T	Wipe4 top right right top

EFX_EFFECT_WIPE4_T_R_R_B	Wipe4 top right right bottom

EFX_EFFECT_WIPE4_T_R_T_L	Wipe4 top right top left

EFX_EFFECT_WIPE4_T_R_T_R	Wipe4 top right top right

EFX_EFFECT_WIPE4_T_R_T_T	Wipe4 top right top top

EFX_EFFECT_WIPE4_T_R_T_B	Wipe4 top right top bottom

EFX_EFFECT_WIPE4_T_R_B_L	Wipe4 top right bottom left

EFX_EFFECT_WIPE4_T_R_B_R	Wipe4 top right bottom right

EFX_EFFECT_WIPE4_T_R_B_T	Wipe4 top right bottom top

EFX_EFFECT_WIPE4_T_R_B_B	Wipe4 top right bottom bottom

EFX_EFFECT_WIPE4_T_T_L_L	Wipe4 top top left left

EFX_EFFECT_WIPE4_T_T_L_R	Wipe4 top top left right

EFX_EFFECT_WIPE4_T_T_L_T	Wipe4 top top left top

EFX_EFFECT_WIPE4_T_T_L_B	Wipe4 top top left bottom

EFX_EFFECT_WIPE4_T_T_R_L	Wipe4 top top right left

EFX_EFFECT_WIPE4_T_T_R_R	Wipe4 top top right right

EFX_EFFECT_WIPE4_T_T_R_T	Wipe4 top top right top

EFX_EFFECT_WIPE4_T_T_R_B	Wipe4 top top right bottom

EFX_EFFECT_WIPE4_T_T_T_L	Wipe4 top top top left

EFX_EFFECT_WIPE4_T_T_T_R	Wipe4 top top top right

EFX_EFFECT_WIPE4_T_T_T_T	Wipe4 top top top top

EFX_EFFECT_WIPE4_T_T_T_B	Wipe4 top top top bottom

EFX_EFFECT_WIPE4_T_T_B_L	Wipe4 top top bottom left

EFX_EFFECT_WIPE4_T_T_B_R	Wipe4 top top bottom right

EFX_EFFECT_WIPE4_T_T_B_T	Wipe4 top top bottom top

EFX_EFFECT_WIPE4_T_T_B_B	Wipe4 top top bottom bottom

EFX_EFFECT_WIPE4_T_B_L_L	Wipe4 top bottom left left

EFX_EFFECT_WIPE4_T_B_L_R	Wipe4 top bottom left right

EFX_EFFECT_WIPE4_T_B_L_T	Wipe4 top bottom left top

EFX_EFFECT_WIPE4_T_B_L_B	Wipe4 top bottom left bottom

EFX_EFFECT_WIPE4_T_B_R_L	Wipe4 top bottom right left

EFX_EFFECT_WIPE4_T_B_R_R	Wipe4 top bottom right right

EFX_EFFECT_WIPE4_T_B_R_T	Wipe4 top bottom right top

EFX_EFFECT_WIPE4_T_B_R_B	Wipe4 top bottom right bottom

EFX_EFFECT_WIPE4_T_B_T_L	Wipe4 top bottom top left

EFX_EFFECT_WIPE4_T_B_T_R	Wipe4 top bottom top right

EFX_EFFECT_WIPE4_T_B_T_T	Wipe4 top bottom top top

EFX_EFFECT_WIPE4_T_B_T_B	Wipe4 top bottom top bottom

EFX_EFFECT_WIPE4_T_B_B_L	Wipe4 top bottom bottom left

EFX_EFFECT_WIPE4_T_B_B_R	Wipe4 top bottom bottom right

EFX_EFFECT_WIPE4_T_B_B_T	Wipe4 top bottom bottom top

EFX_EFFECT_WIPE4_T_B_B_B	Wipe4 top bottom bottom bottom

EFX_EFFECT_WIPE4_B_L_L_L	Wipe4 bottom left left left

EFX_EFFECT_WIPE4_B_L_L_R	Wipe4 bottom left left right

EFX_EFFECT_WIPE4_B_L_L_T	Wipe4 bottom left left top

EFX_EFFECT_WIPE4_B_L_L_B	Wipe4 bottom left left bottom

EFX_EFFECT_WIPE4_B_L_R_L	Wipe4 bottom left right left

EFX_EFFECT_WIPE4_B_L_R_R	Wipe4 bottom left right right

EFX_EFFECT_WIPE4_B_L_R_T	Wipe4 bottom left right top

EFX_EFFECT_WIPE4_B_L_R_B	Wipe4 bottom left right bottom

EFX_EFFECT_WIPE4_B_L_T_L	Wipe4 bottom left top left

EFX_EFFECT_WIPE4_B_L_T_R	Wipe4 bottom left top right

EFX_EFFECT_WIPE4_B_L_T_T	Wipe4 bottom left top top

EFX_EFFECT_WIPE4_B_L_T_B	Wipe4 bottom left top bottom

EFX_EFFECT_WIPE4_B_L_B_L	Wipe4 bottom left bottom left

EFX_EFFECT_WIPE4_B_L_B_R	Wipe4 bottom left bottom right

EFX_EFFECT_WIPE4_B_L_B_T	Wipe4 bottom left bottom top

EFX_EFFECT_WIPE4_B_L_B_B	Wipe4 bottom left bottom bottom

EFX_EFFECT_WIPE4_B_R_L_L	Wipe4 bottom right left left

EFX_EFFECT_WIPE4_B_R_L_R	Wipe4 bottom right left right

EFX_EFFECT_WIPE4_B_R_L_T	Wipe4 bottom right left top

EFX_EFFECT_WIPE4_B_R_L_B	Wipe4 bottom right left bottom

EFX_EFFECT_WIPE4_B_R_R_L	Wipe4 bottom right right left

EFX_EFFECT_WIPE4_B_R_R_R	Wipe4 bottom right right right

EFX_EFFECT_WIPE4_B_R_R_T	Wipe4 bottom right right top

EFX_EFFECT_WIPE4_B_R_R_B	Wipe4 bottom right right bottom

EFX_EFFECT_WIPE4_B_R_T_L	Wipe4 bottom right top left

EFX_EFFECT_WIPE4_B_R_T_R	Wipe4 bottom right top right

EFX_EFFECT_WIPE4_B_R_T_T	Wipe4 bottom right top top

EFX_EFFECT_WIPE4_B_R_T_B	Wipe4 bottom right top bottom

EFX_EFFECT_WIPE4_B_R_B_L	Wipe4 bottom right bottom left

EFX_EFFECT_WIPE4_B_R_B_R	Wipe4 bottom right bottom right

EFX_EFFECT_WIPE4_B_R_B_T	Wipe4 bottom right bottom top

EFX_EFFECT_WIPE4_B_R_B_B	Wipe4 bottom right bottom bottom

EFX_EFFECT_WIPE4_B_T_L_L	Wipe4 bottom top left left

EFX_EFFECT_WIPE4_B_T_L_R	Wipe4 bottom top left right

EFX_EFFECT_WIPE4_B_T_L_T	Wipe4 bottom top left top

EFX_EFFECT_WIPE4_B_T_L_B	Wipe4 bottom top left bottom

EFX_EFFECT_WIPE4_B_T_R_L	Wipe4 bottom top right left

EFX_EFFECT_WIPE4_B_T_R_R	Wipe4 bottom top right right

EFX_EFFECT_WIPE4_B_T_R_T	Wipe4 bottom top right top

EFX_EFFECT_WIPE4_B_T_R_B	Wipe4 bottom top right bottom

EFX_EFFECT_WIPE4_B_T_T_L	Wipe4 bottom top top left

EFX_EFFECT_WIPE4_B_T_T_R	Wipe4 bottom top top right

EFX_EFFECT_WIPE4_B_T_T_T	Wipe4 bottom top top top

EFX_EFFECT_WIPE4_B_T_T_B	Wipe4 bottom top top bottom

EFX_EFFECT_WIPE4_B_T_B_L	Wipe4 bottom top bottom left

EFX_EFFECT_WIPE4_B_T_B_R	Wipe4 bottom top bottom right

EFX_EFFECT_WIPE4_B_T_B_T	Wipe4 bottom top bottom top

EFX_EFFECT_WIPE4_B_T_B_B	Wipe4 bottom top bottom bottom

EFX_EFFECT_WIPE4_B_B_L_L	Wipe4 bottom bottom left left

EFX_EFFECT_WIPE4_B_B_L_R	Wipe4 bottom bottom left right

EFX_EFFECT_WIPE4_B_B_L_T	Wipe4 bottom bottom left top

EFX_EFFECT_WIPE4_B_B_L_B	Wipe4 bottom bottom left bottom

EFX_EFFECT_WIPE4_B_B_R_L	Wipe4 bottom bottom right left

EFX_EFFECT_WIPE4_B_B_R_R	Wipe4 bottom bottom right right

EFX_EFFECT_WIPE4_B_B_R_T	Wipe4 bottom bottom right top

EFX_EFFECT_WIPE4_B_B_R_B	Wipe4 bottom bottom right bottom

EFX_EFFECT_WIPE4_B_B_T_L	Wipe4 bottom bottom top left

EFX_EFFECT_WIPE4_B_B_T_R	Wipe4 bottom bottom top right

EFX_EFFECT_WIPE4_B_B_T_T	Wipe4 bottom bottom top top

EFX_EFFECT_WIPE4_B_B_T_B	Wipe4 bottom bottom top bottom

EFX_EFFECT_WIPE4_B_B_B_L	Wipe4 bottom bottom bottom left

EFX_EFFECT_WIPE4_B_B_B_R	Wipe4 bottom bottom bottom right

EFX_EFFECT_WIPE4_B_B_B_T	Wipe4 bottom bottom bottom top

EFX_EFFECT_WIPE4_B_B_B_B	Wipe4 bottom bottom bottom bottom

EFX_EFFECT_WIPE4_LT_LT_LT_LT	Wipe4 left-top left-top left-top left-top

EFX_EFFECT_WIPE4_LT_LT_LT_LB	Wipe4 left-top left-top left-top left-bottom

EFX_EFFECT_WIPE4_LT_LT_LT_RT	Wipe4 left-top left-top left-top right-top

EFX_EFFECT_WIPE4_LT_LT_LT_RB	Wipe4 left-top left-top left-top right-bottom

EFX_EFFECT_WIPE4_LT_LT_LB_LT	Wipe4 left-top left-top left-bottom left-top

EFX_EFFECT_WIPE4_LT_LT_LB_LB	Wipe4 left-top left-top left-bottom left-bottom

EFX_EFFECT_WIPE4_LT_LT_LB_RT	Wipe4 left-top left-top left-bottom right-top

EFX_EFFECT_WIPE4_LT_LT_LB_RB	Wipe4 left-top left-top left-bottom right-bottom

EFX_EFFECT_WIPE4_LT_LT_RT_LT	Wipe4 left-top left-top right-top left-top

EFX_EFFECT_WIPE4_LT_LT_RT_LB	Wipe4 left-top left-top right-top left-bottom

EFX_EFFECT_WIPE4_LT_LT_RT_RT	Wipe4 left-top left-top right-top right-top

EFX_EFFECT_WIPE4_LT_LT_RT_RB	Wipe4 left-top left-top right-top right-bottom

EFX_EFFECT_WIPE4_LT_LT_RB_LT	Wipe4 left-top left-top right-bottom left-top

EFX_EFFECT_WIPE4_LT_LT_RB_LB	Wipe4 left-top left-top right-bottom left-bottom

EFX_EFFECT_WIPE4_LT_LT_RB_RT	Wipe4 left-top left-top right-bottom right-top

EFX_EFFECT_WIPE4_LT_LT_RB_RB	Wipe4 left-top left-top right-bottom right-bottom

EFX_EFFECT_WIPE4_LT_LB_LT_LT	Wipe4 left-top left-bottom left-top left-top

EFX_EFFECT_WIPE4_LT_LB_LT_LB	Wipe4 left-top left-bottom left-top left-bottom

EFX_EFFECT_WIPE4_LT_LB_LT_RT	Wipe4 left-top left-bottom left-top right-top

EFX_EFFECT_WIPE4_LT_LB_LT_RB	Wipe4 left-top left-bottom left-top right-bottom

EFX_EFFECT_WIPE4_LT_LB_LB_LT	Wipe4 left-top left-bottom left-bottom left-top

EFX_EFFECT_WIPE4_LT_LB_LB_LB	Wipe4 left-top left-bottom left-bottom left-bottom

EFX_EFFECT_WIPE4_LT_LB_LB_RT	Wipe4 left-top left-bottom left-bottom right-top

EFX_EFFECT_WIPE4_LT_LB_LB_RB	Wipe4 left-top left-bottom left-bottom right-bottom

EFX_EFFECT_WIPE4_LT_LB_RT_LT	Wipe4 left-top left-bottom right-top left-top

EFX_EFFECT_WIPE4_LT_LB_RT_LB	Wipe4 left-top left-bottom right-top left-bottom

EFX_EFFECT_WIPE4_LT_LB_RT_RT	Wipe4 left-top left-bottom right-top right-top

EFX_EFFECT_WIPE4_LT_LB_RT_RB	Wipe4 left-top left-bottom right-top right-bottom

EFX_EFFECT_WIPE4_LT_LB_RB_LT	Wipe4 left-top left-bottom right-bottom left-top

EFX_EFFECT_WIPE4_LT_LB_RB_LB	Wipe4 left-top left-bottom right-bottom left-bottom

EFX_EFFECT_WIPE4_LT_LB_RB_RT	Wipe4 left-top left-bottom right-bottom right-top

EFX_EFFECT_WIPE4_LT_LB_RB_RB	Wipe4 left-top left-bottom right-bottom right-bottom

EFX_EFFECT_WIPE4_LT_RT_LT_LT	Wipe4 left-top right-top left-top left-top

EFX_EFFECT_WIPE4_LT_RT_LT_LB	Wipe4 left-top right-top left-top left-bottom

EFX_EFFECT_WIPE4_LT_RT_LT_RT	Wipe4 left-top right-top left-top right-top

EFX_EFFECT_WIPE4_LT_RT_LT_RB	Wipe4 left-top right-top left-top right-bottom

EFX_EFFECT_WIPE4_LT_RT_LB_LT	Wipe4 left-top right-top left-bottom left-top

EFX_EFFECT_WIPE4_LT_RT_LB_LB	Wipe4 left-top right-top left-bottom left-bottom

EFX_EFFECT_WIPE4_LT_RT_LB_RT	Wipe4 left-top right-top left-bottom right-top

EFX_EFFECT_WIPE4_LT_RT_LB_RB	Wipe4 left-top right-top left-bottom right-bottom

EFX_EFFECT_WIPE4_LT_RT_RT_LT	Wipe4 left-top right-top right-top left-top

EFX_EFFECT_WIPE4_LT_RT_RT_LB	Wipe4 left-top right-top right-top left-bottom

EFX_EFFECT_WIPE4_LT_RT_RT_RT	Wipe4 left-top right-top right-top right-top

EFX_EFFECT_WIPE4_LT_RT_RT_RB	Wipe4 left-top right-top right-top right-bottom

EFX_EFFECT_WIPE4_LT_RT_RB_LT	Wipe4 left-top right-top right-bottom left-top

EFX_EFFECT_WIPE4_LT_RT_RB_LB	Wipe4 left-top right-top right-bottom left-bottom

EFX_EFFECT_WIPE4_LT_RT_RB_RT	Wipe4 left-top right-top right-bottom right-top

EFX_EFFECT_WIPE4_LT_RT_RB_RB	Wipe4 left-top right-top right-bottom right-bottom

EFX_EFFECT_WIPE4_LT_RB_LT_LT	Wipe4 left-top right-bottom left-top left-top

EFX_EFFECT_WIPE4_LT_RB_LT_LB	Wipe4 left-top right-bottom left-top left-bottom

EFX_EFFECT_WIPE4_LT_RB_LT_RT	Wipe4 left-top right-bottom left-top right-top

EFX_EFFECT_WIPE4_LT_RB_LT_RB	Wipe4 left-top right-bottom left-top right-bottom

EFX_EFFECT_WIPE4_LT_RB_LB_LT	Wipe4 left-top right-bottom left-bottom left-top

EFX_EFFECT_WIPE4_LT_RB_LB_LB	Wipe4 left-top right-bottom left-bottom left-bottom

EFX_EFFECT_WIPE4_LT_RB_LB_RT	Wipe4 left-top right-bottom left-bottom right-top

EFX_EFFECT_WIPE4_LT_RB_LB_RB	Wipe4 left-top right-bottom left-bottom right-bottom

EFX_EFFECT_WIPE4_LT_RB_RT_LT	Wipe4 left-top right-bottom right-top left-top

EFX_EFFECT_WIPE4_LT_RB_RT_LB	Wipe4 left-top right-bottom right-top left-bottom

EFX_EFFECT_WIPE4_LT_RB_RT_RT	Wipe4 left-top right-bottom right-top right-top

EFX_EFFECT_WIPE4_LT_RB_RT_RB	Wipe4 left-top right-bottom right-top right-bottom

EFX_EFFECT_WIPE4_LT_RB_RB_LT	Wipe4 left-top right-bottom right-bottom left-top

EFX_EFFECT_WIPE4_LT_RB_RB_LB	Wipe4 left-top right-bottom right-bottom left-bottom

EFX_EFFECT_WIPE4_LT_RB_RB_RT	Wipe4 left-top right-bottom right-bottom right-top

EFX_EFFECT_WIPE4_LT_RB_RB_RB	Wipe4 left-top right-bottom right-bottom right-bottom

EFX_EFFECT_WIPE4_LB_LT_LT_LT	Wipe4 left-bottom left-top left-top left-top

EFX_EFFECT_WIPE4_LB_LT_LT_LB	Wipe4 left-bottom left-top left-top left-bottom

EFX_EFFECT_WIPE4_LB_LT_LT_RT	Wipe4 left-bottom left-top left-top right-top

EFX_EFFECT_WIPE4_LB_LT_LT_RB	Wipe4 left-bottom left-top left-top right-bottom

EFX_EFFECT_WIPE4_LB_LT_LB_LT	Wipe4 left-bottom left-top left-bottom left-top

EFX_EFFECT_WIPE4_LB_LT_LB_LB	Wipe4 left-bottom left-top left-bottom left-bottom

EFX_EFFECT_WIPE4_LB_LT_LB_RT	Wipe4 left-bottom left-top left-bottom right-top

EFX_EFFECT_WIPE4_LB_LT_LB_RB	Wipe4 left-bottom left-top left-bottom right-bottom

EFX_EFFECT_WIPE4_LB_LT_RT_LT	Wipe4 left-bottom left-top right-top left-top

EFX_EFFECT_WIPE4_LB_LT_RT_LB	Wipe4 left-bottom left-top right-top left-bottom

EFX_EFFECT_WIPE4_LB_LT_RT_RT	Wipe4 left-bottom left-top right-top right-top

EFX_EFFECT_WIPE4_LB_LT_RT_RB	Wipe4 left-bottom left-top right-top right-bottom

EFX_EFFECT_WIPE4_LB_LT_RB_LT	Wipe4 left-bottom left-top right-bottom left-top

EFX_EFFECT_WIPE4_LB_LT_RB_LB	Wipe4 left-bottom left-top right-bottom left-bottom

EFX_EFFECT_WIPE4_LB_LT_RB_RT	Wipe4 left-bottom left-top right-bottom right-top

EFX_EFFECT_WIPE4_LB_LT_RB_RB	Wipe4 left-bottom left-top right-bottom right-bottom

EFX_EFFECT_WIPE4_LB_LB_LT_LT	Wipe4 left-bottom left-bottom left-top left-top

EFX_EFFECT_WIPE4_LB_LB_LT_LB	Wipe4 left-bottom left-bottom left-top left-bottom

EFX_EFFECT_WIPE4_LB_LB_LT_RT	Wipe4 left-bottom left-bottom left-top right-top

EFX_EFFECT_WIPE4_LB_LB_LT_RB	Wipe4 left-bottom left-bottom left-top right-bottom

EFX_EFFECT_WIPE4_LB_LB_LB_LT	Wipe4 left-bottom left-bottom left-bottom left-top

EFX_EFFECT_WIPE4_LB_LB_LB_LB	Wipe4 left-bottom left-bottom left-bottom left-bottom

EFX_EFFECT_WIPE4_LB_LB_LB_RT	Wipe4 left-bottom left-bottom left-bottom right-top

EFX_EFFECT_WIPE4_LB_LB_LB_RB	Wipe4 left-bottom left-bottom left-bottom right-bottom

EFX_EFFECT_WIPE4_LB_LB_RT_LT	Wipe4 left-bottom left-bottom right-top left-top

EFX_EFFECT_WIPE4_LB_LB_RT_LB	Wipe4 left-bottom left-bottom right-top left-bottom

EFX_EFFECT_WIPE4_LB_LB_RT_RT	Wipe4 left-bottom left-bottom right-top right-top

EFX_EFFECT_WIPE4_LB_LB_RT_RB	Wipe4 left-bottom left-bottom right-top right-bottom

EFX_EFFECT_WIPE4_LB_LB_RB_LT	Wipe4 left-bottom left-bottom right-bottom left-top

EFX_EFFECT_WIPE4_LB_LB_RB_LB	Wipe4 left-bottom left-bottom right-bottom left-bottom

EFX_EFFECT_WIPE4_LB_LB_RB_RT	Wipe4 left-bottom left-bottom right-bottom right-top

EFX_EFFECT_WIPE4_LB_LB_RB_RB	Wipe4 left-bottom left-bottom right-bottom right-bottom

EFX_EFFECT_WIPE4_LB_RT_LT_LT	Wipe4 left-bottom right-top left-top left-top

EFX_EFFECT_WIPE4_LB_RT_LT_LB	Wipe4 left-bottom right-top left-top left-bottom

EFX_EFFECT_WIPE4_LB_RT_LT_RT	Wipe4 left-bottom right-top left-top right-top

EFX_EFFECT_WIPE4_LB_RT_LT_RB	Wipe4 left-bottom right-top left-top right-bottom

EFX_EFFECT_WIPE4_LB_RT_LB_LT	Wipe4 left-bottom right-top left-bottom left-top

EFX_EFFECT_WIPE4_LB_RT_LB_LB	Wipe4 left-bottom right-top left-bottom left-bottom

EFX_EFFECT_WIPE4_LB_RT_LB_RT	Wipe4 left-bottom right-top left-bottom right-top

EFX_EFFECT_WIPE4_LB_RT_LB_RB	Wipe4 left-bottom right-top left-bottom right-bottom

EFX_EFFECT_WIPE4_LB_RT_RT_LT	Wipe4 left-bottom right-top right-top left-top

EFX_EFFECT_WIPE4_LB_RT_RT_LB	Wipe4 left-bottom right-top right-top left-bottom

EFX_EFFECT_WIPE4_LB_RT_RT_RT	Wipe4 left-bottom right-top right-top right-top

EFX_EFFECT_WIPE4_LB_RT_RT_RB	Wipe4 left-bottom right-top right-top right-bottom

EFX_EFFECT_WIPE4_LB_RT_RB_LT	Wipe4 left-bottom right-top right-bottom left-top

EFX_EFFECT_WIPE4_LB_RT_RB_LB	Wipe4 left-bottom right-top right-bottom left-bottom

EFX_EFFECT_WIPE4_LB_RT_RB_RT	Wipe4 left-bottom right-top right-bottom right-top

EFX_EFFECT_WIPE4_LB_RT_RB_RB	Wipe4 left-bottom right-top right-bottom right-bottom

EFX_EFFECT_WIPE4_LB_RB_LT_LT	Wipe4 left-bottom right-bottom left-top left-top

EFX_EFFECT_WIPE4_LB_RB_LT_LB	Wipe4 left-bottom right-bottom left-top left-bottom

EFX_EFFECT_WIPE4_LB_RB_LT_RT	Wipe4 left-bottom right-bottom left-top right-top

EFX_EFFECT_WIPE4_LB_RB_LT_RB	Wipe4 left-bottom right-bottom left-top right-bottom

EFX_EFFECT_WIPE4_LB_RB_LB_LT	Wipe4 left-bottom right-bottom left-bottom left-top

EFX_EFFECT_WIPE4_LB_RB_LB_LB	Wipe4 left-bottom right-bottom left-bottom left-bottom

EFX_EFFECT_WIPE4_LB_RB_LB_RT	Wipe4 left-bottom right-bottom left-bottom right-top

EFX_EFFECT_WIPE4_LB_RB_LB_RB	Wipe4 left-bottom right-bottom left-bottom right-bottom

EFX_EFFECT_WIPE4_LB_RB_RT_LT	Wipe4 left-bottom right-bottom right-top left-top

EFX_EFFECT_WIPE4_LB_RB_RT_LB	Wipe4 left-bottom right-bottom right-top left-bottom

EFX_EFFECT_WIPE4_LB_RB_RT_RT	Wipe4 left-bottom right-bottom right-top right-top

EFX_EFFECT_WIPE4_LB_RB_RT_RB	Wipe4 left-bottom right-bottom right-top right-bottom

EFX_EFFECT_WIPE4_LB_RB_RB_LT	Wipe4 left-bottom right-bottom right-bottom left-top

EFX_EFFECT_WIPE4_LB_RB_RB_LB	Wipe4 left-bottom right-bottom right-bottom left-bottom

EFX_EFFECT_WIPE4_LB_RB_RB_RT	Wipe4 left-bottom right-bottom right-bottom right-top

EFX_EFFECT_WIPE4_LB_RB_RB_RB	Wipe4 left-bottom right-bottom right-bottom right-bottom

EFX_EFFECT_WIPE4_RT_LT_LT_LT	Wipe4 right-top left-top left-top left-top

EFX_EFFECT_WIPE4_RT_LT_LT_LB	Wipe4 right-top left-top left-top left-bottom

EFX_EFFECT_WIPE4_RT_LT_LT_RT	Wipe4 right-top left-top left-top right-top

EFX_EFFECT_WIPE4_RT_LT_LT_RB	Wipe4 right-top left-top left-top right-bottom

EFX_EFFECT_WIPE4_RT_LT_LB_LT	Wipe4 right-top left-top left-bottom left-top

EFX_EFFECT_WIPE4_RT_LT_LB_LB	Wipe4 right-top left-top left-bottom left-bottom

EFX_EFFECT_WIPE4_RT_LT_LB_RT	Wipe4 right-top left-top left-bottom right-top

EFX_EFFECT_WIPE4_RT_LT_LB_RB	Wipe4 right-top left-top left-bottom right-bottom

EFX_EFFECT_WIPE4_RT_LT_RT_LT	Wipe4 right-top left-top right-top left-top

EFX_EFFECT_WIPE4_RT_LT_RT_LB	Wipe4 right-top left-top right-top left-bottom

EFX_EFFECT_WIPE4_RT_LT_RT_RT	Wipe4 right-top left-top right-top right-top

EFX_EFFECT_WIPE4_RT_LT_RT_RB	Wipe4 right-top left-top right-top right-bottom

EFX_EFFECT_WIPE4_RT_LT_RB_LT	Wipe4 right-top left-top right-bottom left-top

EFX_EFFECT_WIPE4_RT_LT_RB_LB	Wipe4 right-top left-top right-bottom left-bottom

EFX_EFFECT_WIPE4_RT_LT_RB_RT	Wipe4 right-top left-top right-bottom right-top

EFX_EFFECT_WIPE4_RT_LT_RB_RB	Wipe4 right-top left-top right-bottom right-bottom

EFX_EFFECT_WIPE4_RT_LB_LT_LT	Wipe4 right-top left-bottom left-top left-top

EFX_EFFECT_WIPE4_RT_LB_LT_LB	Wipe4 right-top left-bottom left-top left-bottom

EFX_EFFECT_WIPE4_RT_LB_LT_RT	Wipe4 right-top left-bottom left-top right-top

EFX_EFFECT_WIPE4_RT_LB_LT_RB	Wipe4 right-top left-bottom left-top right-bottom

EFX_EFFECT_WIPE4_RT_LB_LB_LT	Wipe4 right-top left-bottom left-bottom left-top

EFX_EFFECT_WIPE4_RT_LB_LB_LB	Wipe4 right-top left-bottom left-bottom left-bottom

EFX_EFFECT_WIPE4_RT_LB_LB_RT	Wipe4 right-top left-bottom left-bottom right-top

EFX_EFFECT_WIPE4_RT_LB_LB_RB	Wipe4 right-top left-bottom left-bottom right-bottom

EFX_EFFECT_WIPE4_RT_LB_RT_LT	Wipe4 right-top left-bottom right-top left-top

EFX_EFFECT_WIPE4_RT_LB_RT_LB	Wipe4 right-top left-bottom right-top left-bottom

EFX_EFFECT_WIPE4_RT_LB_RT_RT	Wipe4 right-top left-bottom right-top right-top

EFX_EFFECT_WIPE4_RT_LB_RT_RB	Wipe4 right-top left-bottom right-top right-bottom

EFX_EFFECT_WIPE4_RT_LB_RB_LT	Wipe4 right-top left-bottom right-bottom left-top

EFX_EFFECT_WIPE4_RT_LB_RB_LB	Wipe4 right-top left-bottom right-bottom left-bottom

EFX_EFFECT_WIPE4_RT_LB_RB_RT	Wipe4 right-top left-bottom right-bottom right-top

EFX_EFFECT_WIPE4_RT_LB_RB_RB	Wipe4 right-top left-bottom right-bottom right-bottom

EFX_EFFECT_WIPE4_RT_RT_LT_LT	Wipe4 right-top right-top left-top left-top

EFX_EFFECT_WIPE4_RT_RT_LT_LB	Wipe4 right-top right-top left-top left-bottom

EFX_EFFECT_WIPE4_RT_RT_LT_RT	Wipe4 right-top right-top left-top right-top

EFX_EFFECT_WIPE4_RT_RT_LT_RB	Wipe4 right-top right-top left-top right-bottom

EFX_EFFECT_WIPE4_RT_RT_LB_LT	Wipe4 right-top right-top left-bottom left-top

EFX_EFFECT_WIPE4_RT_RT_LB_LB	Wipe4 right-top right-top left-bottom left-bottom

EFX_EFFECT_WIPE4_RT_RT_LB_RT	Wipe4 right-top right-top left-bottom right-top

EFX_EFFECT_WIPE4_RT_RT_LB_RB	Wipe4 right-top right-top left-bottom right-bottom

EFX_EFFECT_WIPE4_RT_RT_RT_LT	Wipe4 right-top right-top right-top left-top

EFX_EFFECT_WIPE4_RT_RT_RT_LB	Wipe4 right-top right-top right-top left-bottom

EFX_EFFECT_WIPE4_RT_RT_RT_RT	Wipe4 right-top right-top right-top right-top

EFX_EFFECT_WIPE4_RT_RT_RT_RB	Wipe4 right-top right-top right-top right-bottom

EFX_EFFECT_WIPE4_RT_RT_RB_LT	Wipe4 right-top right-top right-bottom left-top

EFX_EFFECT_WIPE4_RT_RT_RB_LB	Wipe4 right-top right-top right-bottom left-bottom

EFX_EFFECT_WIPE4_RT_RT_RB_RT	Wipe4 right-top right-top right-bottom right-top

EFX_EFFECT_WIPE4_RT_RT_RB_RB	Wipe4 right-top right-top right-bottom right-bottom

EFX_EFFECT_WIPE4_RT_RB_LT_LT	Wipe4 right-top right-bottom left-top left-top

EFX_EFFECT_WIPE4_RT_RB_LT_LB	Wipe4 right-top right-bottom left-top left-bottom

EFX_EFFECT_WIPE4_RT_RB_LT_RT	Wipe4 right-top right-bottom left-top right-top

EFX_EFFECT_WIPE4_RT_RB_LT_RB	Wipe4 right-top right-bottom left-top right-bottom

EFX_EFFECT_WIPE4_RT_RB_LB_LT	Wipe4 right-top right-bottom left-bottom left-top

EFX_EFFECT_WIPE4_RT_RB_LB_LB	Wipe4 right-top right-bottom left-bottom left-bottom

EFX_EFFECT_WIPE4_RT_RB_LB_RT	Wipe4 right-top right-bottom left-bottom right-top

EFX_EFFECT_WIPE4_RT_RB_LB_RB	Wipe4 right-top right-bottom left-bottom right-bottom

EFX_EFFECT_WIPE4_RT_RB_RT_LT	Wipe4 right-top right-bottom right-top left-top

EFX_EFFECT_WIPE4_RT_RB_RT_LB	Wipe4 right-top right-bottom right-top left-bottom

EFX_EFFECT_WIPE4_RT_RB_RT_RT	Wipe4 right-top right-bottom right-top right-top

EFX_EFFECT_WIPE4_RT_RB_RT_RB	Wipe4 right-top right-bottom right-top right-bottom

EFX_EFFECT_WIPE4_RT_RB_RB_LT	Wipe4 right-top right-bottom right-bottom left-top

EFX_EFFECT_WIPE4_RT_RB_RB_LB	Wipe4 right-top right-bottom right-bottom left-bottom

EFX_EFFECT_WIPE4_RT_RB_RB_RT	Wipe4 right-top right-bottom right-bottom right-top

EFX_EFFECT_WIPE4_RT_RB_RB_RB	Wipe4 right-top right-bottom right-bottom right-bottom

EFX_EFFECT_WIPE4_RB_LT_LT_LT	Wipe4 right-bottom left-top left-top left-top

EFX_EFFECT_WIPE4_RB_LT_LT_LB	Wipe4 right-bottom left-top left-top left-bottom

EFX_EFFECT_WIPE4_RB_LT_LT_RT	Wipe4 right-bottom left-top left-top right-top

EFX_EFFECT_WIPE4_RB_LT_LT_RB	Wipe4 right-bottom left-top left-top right-bottom

EFX_EFFECT_WIPE4_RB_LT_LB_LT	Wipe4 right-bottom left-top left-bottom left-top

EFX_EFFECT_WIPE4_RB_LT_LB_LB	Wipe4 right-bottom left-top left-bottom left-bottom

EFX_EFFECT_WIPE4_RB_LT_LB_RT	Wipe4 right-bottom left-top left-bottom right-top

EFX_EFFECT_WIPE4_RB_LT_LB_RB	Wipe4 right-bottom left-top left-bottom right-bottom

EFX_EFFECT_WIPE4_RB_LT_RT_LT	Wipe4 right-bottom left-top right-top left-top

EFX_EFFECT_WIPE4_RB_LT_RT_LB	Wipe4 right-bottom left-top right-top left-bottom

EFX_EFFECT_WIPE4_RB_LT_RT_RT	Wipe4 right-bottom left-top right-top right-top

EFX_EFFECT_WIPE4_RB_LT_RT_RB	Wipe4 right-bottom left-top right-top right-bottom

EFX_EFFECT_WIPE4_RB_LT_RB_LT	Wipe4 right-bottom left-top right-bottom left-top

EFX_EFFECT_WIPE4_RB_LT_RB_LB	Wipe4 right-bottom left-top right-bottom left-bottom

EFX_EFFECT_WIPE4_RB_LT_RB_RT	Wipe4 right-bottom left-top right-bottom right-top

EFX_EFFECT_WIPE4_RB_LT_RB_RB	Wipe4 right-bottom left-top right-bottom right-bottom

EFX_EFFECT_WIPE4_RB_LB_LT_LT	Wipe4 right-bottom left-bottom left-top left-top

EFX_EFFECT_WIPE4_RB_LB_LT_LB	Wipe4 right-bottom left-bottom left-top left-bottom

EFX_EFFECT_WIPE4_RB_LB_LT_RT	Wipe4 right-bottom left-bottom left-top right-top

EFX_EFFECT_WIPE4_RB_LB_LT_RB	Wipe4 right-bottom left-bottom left-top right-bottom

EFX_EFFECT_WIPE4_RB_LB_LB_LT	Wipe4 right-bottom left-bottom left-bottom left-top

EFX_EFFECT_WIPE4_RB_LB_LB_LB	Wipe4 right-bottom left-bottom left-bottom left-bottom

EFX_EFFECT_WIPE4_RB_LB_LB_RT	Wipe4 right-bottom left-bottom left-bottom right-top

EFX_EFFECT_WIPE4_RB_LB_LB_RB	Wipe4 right-bottom left-bottom left-bottom right-bottom

EFX_EFFECT_WIPE4_RB_LB_RT_LT	Wipe4 right-bottom left-bottom right-top left-top

EFX_EFFECT_WIPE4_RB_LB_RT_LB	Wipe4 right-bottom left-bottom right-top left-bottom

EFX_EFFECT_WIPE4_RB_LB_RT_RT	Wipe4 right-bottom left-bottom right-top right-top

EFX_EFFECT_WIPE4_RB_LB_RT_RB	Wipe4 right-bottom left-bottom right-top right-bottom

EFX_EFFECT_WIPE4_RB_LB_RB_LT	Wipe4 right-bottom left-bottom right-bottom left-top

EFX_EFFECT_WIPE4_RB_LB_RB_LB	Wipe4 right-bottom left-bottom right-bottom left-bottom

EFX_EFFECT_WIPE4_RB_LB_RB_RT	Wipe4 right-bottom left-bottom right-bottom right-top

EFX_EFFECT_WIPE4_RB_LB_RB_RB	Wipe4 right-bottom left-bottom right-bottom right-bottom

EFX_EFFECT_WIPE4_RB_RT_LT_LT	Wipe4 right-bottom right-top left-top left-top

EFX_EFFECT_WIPE4_RB_RT_LT_LB	Wipe4 right-bottom right-top left-top left-bottom

EFX_EFFECT_WIPE4_RB_RT_LT_RT	Wipe4 right-bottom right-top left-top right-top

EFX_EFFECT_WIPE4_RB_RT_LT_RB	Wipe4 right-bottom right-top left-top right-bottom

EFX_EFFECT_WIPE4_RB_RT_LB_LT	Wipe4 right-bottom right-top left-bottom left-top

EFX_EFFECT_WIPE4_RB_RT_LB_LB	Wipe4 right-bottom right-top left-bottom left-bottom

EFX_EFFECT_WIPE4_RB_RT_LB_RT	Wipe4 right-bottom right-top left-bottom right-top

EFX_EFFECT_WIPE4_RB_RT_LB_RB	Wipe4 right-bottom right-top left-bottom right-bottom

EFX_EFFECT_WIPE4_RB_RT_RT_LT	Wipe4 right-bottom right-top right-top left-top

EFX_EFFECT_WIPE4_RB_RT_RT_LB	Wipe4 right-bottom right-top right-top left-bottom

EFX_EFFECT_WIPE4_RB_RT_RT_RT	Wipe4 right-bottom right-top right-top right-top

EFX_EFFECT_WIPE4_RB_RT_RT_RB	Wipe4 right-bottom right-top right-top right-bottom

EFX_EFFECT_WIPE4_RB_RT_RB_LT	Wipe4 right-bottom right-top right-bottom left-top

EFX_EFFECT_WIPE4_RB_RT_RB_LB	Wipe4 right-bottom right-top right-bottom left-bottom

EFX_EFFECT_WIPE4_RB_RT_RB_RT	Wipe4 right-bottom right-top right-bottom right-top

EFX_EFFECT_WIPE4_RB_RT_RB_RB	Wipe4 right-bottom right-top right-bottom right-bottom

EFX_EFFECT_WIPE4_RB_RB_LT_LT	Wipe4 right-bottom right-bottom left-top left-top

EFX_EFFECT_WIPE4_RB_RB_LT_LB	Wipe4 right-bottom right-bottom left-top left-bottom

EFX_EFFECT_WIPE4_RB_RB_LT_RT	Wipe4 right-bottom right-bottom left-top right-top

EFX_EFFECT_WIPE4_RB_RB_LT_RB	Wipe4 right-bottom right-bottom left-top right-bottom

EFX_EFFECT_WIPE4_RB_RB_LB_LT	Wipe4 right-bottom right-bottom left-bottom left-top

EFX_EFFECT_WIPE4_RB_RB_LB_LB	Wipe4 right-bottom right-bottom left-bottom left-bottom

EFX_EFFECT_WIPE4_RB_RB_LB_RT	Wipe4 right-bottom right-bottom left-bottom right-top

EFX_EFFECT_WIPE4_RB_RB_LB_RB	Wipe4 right-bottom right-bottom left-bottom right-bottom

EFX_EFFECT_WIPE4_RB_RB_RT_LT	Wipe4 right-bottom right-bottom right-top left-top

EFX_EFFECT_WIPE4_RB_RB_RT_LB	Wipe4 right-bottom right-bottom right-top left-bottom

EFX_EFFECT_WIPE4_RB_RB_RT_RT	Wipe4 right-bottom right-bottom right-top right-top

EFX_EFFECT_WIPE4_RB_RB_RT_RB	Wipe4 right-bottom right-bottom right-top right-bottom

EFX_EFFECT_WIPE4_RB_RB_RB_LT	Wipe4 right-bottom right-bottom right-bottom left-top

EFX_EFFECT_WIPE4_RB_RB_RB_LB	Wipe4 right-bottom right-bottom right-bottom left-bottom

EFX_EFFECT_WIPE4_RB_RB_RB_RT	Wipe4 right-bottom right-bottom right-bottom right-top

EFX_EFFECT_WIPE4_RB_RB_RB_RB	Wipe4 right-bottom right-bottom right-bottom right-bottom

EFX_EFFECT_WIPE_MAX	Number of effects in this class.

Rectangular wipe class

EFX_EFFECT_WIPE_RECTANGLE_IN	Wipe rectangle in

EFX_EFFECT_WIPE_RECTANGLE_OUT	Wipe rectangle out

EFX_EFFECT_WIPE_RECTANGLE_INTER_IN_THEN_IN	Wipe rectangle interlace in then in

EFX_EFFECT_WIPE_RECTANGLE_INTER_OUT_THEN_OUT

Wipe rectangle interlace out then out

EFX_EFFECT_WIPE_RECTANGLE_INTER_IN_THEN_OUT

Wipe rectangle interlace in then out

EFX_EFFECT_WIPE_RECTANGLE_INTER_OUT_THEN_IN	Wipe rectangle interlace out then in

EFX_EFFECT_WIPE_RECTANGLE_MAX	Number of effects in this class.

Circular wipe class

EFX_EFFECT_WIPE_CIRCLE_C_CW_FROM_L	Wipe circle center CW from left

EFX_EFFECT_WIPE_CIRCLE_C_CCW_FROM_L	Wipe circle center CCW from left

EFX_EFFECT_WIPE_CIRCLE_C_CW_FROM_R	Wipe circle center CW from right

EFX_EFFECT_WIPE_CIRCLE_C_CCW_FROM_R	Wipe circle center CCW from right

EFX_EFFECT_WIPE_CIRCLE_C_CW_FROM_T	Wipe circle center CW from top

EFX_EFFECT_WIPE_CIRCLE_C_CCW_FROM_T	Wipe circle center CCW from top

EFX_EFFECT_WIPE_CIRCLE_C_CW_FROM_B	Wipe circle center CW from bottom

EFX_EFFECT_WIPE_CIRCLE_C_CCW_FROM_B	Wipe circle center CCW from bottom

EFX_EFFECT_WIPE_CIRCLE_L_CCW_FROM_B	Wipe circle left CCW from bottom

EFX_EFFECT_WIPE_CIRCLE_L_CW_FROM_T	Wipe circle left CW from top

EFX_EFFECT_WIPE_CIRCLE_R_CW_FROM_B	Wipe circle right CW from bottom

EFX_EFFECT_WIPE_CIRCLE_R_CCW_FROM_T	Wipe circle right CCW from top

EFX_EFFECT_WIPE_CIRCLE_T_CCW_FROM_L	Wipe circle top CCW from left

EFX_EFFECT_WIPE_CIRCLE_T_CW_FROM_R	Wipe circle top CW from right

EFX_EFFECT_WIPE_CIRCLE_B_CW_FROM_L	Wipe circle bottom CW from left

EFX_EFFECT_WIPE_CIRCLE_B_CCW_FROM_R	Wipe circle bottom CCW from right

EFX_EFFECT_WIPE_CIRCLE2_C_CW_FROM_L_AND_FROM_R	Wipe circle2 center CW from left and from right

EFX_EFFECT_WIPE_CIRCLE2_C_CCW_FROM_L_AND_FROM_R	Wipe circle2 center CCW from left and from right

EFX_EFFECT_WIPE_CIRCLE2_C_CW_FROM_T_AND_FROM_B	Wipe circle2 center CW from top and from bottom

EFX_EFFECT_WIPE_CIRCLE2_C_CCW_FROM_T_AND_FROM_B	Wipe circle2 center CCW from top and from bottom

EFX_EFFECT_WIPE_CIRCLE2_L_CW_FROM_T_AND_CCW_FROM_B	Wipe circle2 left CW from top and CCW from bottom

EFX_EFFECT_WIPE_CIRCLE2_L_CCW_TO_T_AND_CW_TO_B	Wipe circle2 left CCW to top and CW to bottom

EFX_EFFECT_WIPE_CIRCLE2_R_CCW_FROM_T_AND_CW_FROM_B	Wipe circle2 right CCW from top and CW from bottom

EFX_EFFECT_WIPE_CIRCLE2_R_CW_TO_T_AND_CCW_TO_B	Wipe circle2 right CW to top and CCW to bottom

EFX_EFFECT_WIPE_CIRCLE2_T_CCW_FROM_L_AND_CW_FROM_R	Wipe circle2 top CCW from left and CW from right

EFX_EFFECT_WIPE_CIRCLE2_T_CW_TO_L_AND_CCW_TO_R	Wipe circle2 top CW to left and CCW to right

EFX_EFFECT_WIPE_CIRCLE2_B_CW_FROM_L_AND_CCW_FROM_R	Wipe circle2 bottom CW from left and CCW from right

EFX_EFFECT_WIPE_CIRCLE2_B_CCW_TO_L_AND_CW_TO_R	Wipe circle2 bottom CCW to left and CW to right

EFX_EFFECT_WIPE_CIRCLE4_C_CW_CCW_CCW_CW	Wipe circle4 center CW CCW CCW CW

EFX_EFFECT_WIPE_CIRCLE4_C_CCW_CW_CW_CCW	Wipe circle4 center CCW CW CW CCW

EFX_EFFECT_WIPE_CIRCLE_MAX	Number of effects in this class.

Push class

EFX_EFFECT_PUSH_R_TO_L	Push right to left

EFX_EFFECT_PUSH_L_TO_R	Push left to right

EFX_EFFECT_PUSH_B_TO_T	Push bottom to top

EFX_EFFECT_PUSH_T_TO_B	Push top to bottom

EFX_EFFECT_PUSH2_T_R_TO_L_AND_B_L_TO_R	Push2 top right to left and bottom left to right

EFX_EFFECT_PUSH2_T_L_TO_R_AND_B_R_TO_L	Push2 top left to right and bottom right to left

EFX_EFFECT_PUSH2_L_B_TO_T_AND_R_T_TO_B	Push2 left bottom to top and right top to bottom

EFX_EFFECT_PUSH2_L_T_TO_B_AND_R_B_TO_T	Push2 left top to bottom and right bottom to top

EFX_EFFECT_PUSH4_L_L_L_L	Push4 left left left left

EFX_EFFECT_PUSH4_L_L_L_R	Push4 left left left right

EFX_EFFECT_PUSH4_L_L_L_T	Push4 left left left top

EFX_EFFECT_PUSH4_L_L_L_B	Push4 left left left bottom

EFX_EFFECT_PUSH4_L_L_R_L	Push4 left left right left

EFX_EFFECT_PUSH4_L_L_R_R	Push4 left left right right

EFX_EFFECT_PUSH4_L_L_R_T	Push4 left left right top

EFX_EFFECT_PUSH4_L_L_R_B	Push4 left left right bottom

EFX_EFFECT_PUSH4_L_L_T_L	Push4 left left top left

EFX_EFFECT_PUSH4_L_L_T_R	Push4 left left top right

EFX_EFFECT_PUSH4_L_L_T_T	Push4 left left top top

EFX_EFFECT_PUSH4_L_L_T_B	Push4 left left top bottom

EFX_EFFECT_PUSH4_L_L_B_L	Push4 left left bottom left

EFX_EFFECT_PUSH4_L_L_B_R	Push4 left left bottom right

EFX_EFFECT_PUSH4_L_L_B_T	Push4 left left bottom top

EFX_EFFECT_PUSH4_L_L_B_B	Push4 left left bottom bottom

EFX_EFFECT_PUSH4_L_R_L_L	Push4 left right left left

EFX_EFFECT_PUSH4_L_R_L_R	Push4 left right left right

EFX_EFFECT_PUSH4_L_R_L_T	Push4 left right left top

EFX_EFFECT_PUSH4_L_R_L_B	Push4 left right left bottom

EFX_EFFECT_PUSH4_L_R_R_L	Push4 left right right left

EFX_EFFECT_PUSH4_L_R_R_R	Push4 left right right right

EFX_EFFECT_PUSH4_L_R_R_T	Push4 left right right top

EFX_EFFECT_PUSH4_L_R_R_B	Push4 left right right bottom

EFX_EFFECT_PUSH4_L_R_T_L	Push4 left right top left

EFX_EFFECT_PUSH4_L_R_T_R	Push4 left right top right

EFX_EFFECT_PUSH4_L_R_T_T	Push4 left right top top

EFX_EFFECT_PUSH4_L_R_T_B	Push4 left right top bottom

EFX_EFFECT_PUSH4_L_R_B_L	Push4 left right bottom left

EFX_EFFECT_PUSH4_L_R_B_R	Push4 left right bottom right

EFX_EFFECT_PUSH4_L_R_B_T	Push4 left right bottom top

EFX_EFFECT_PUSH4_L_R_B_B	Push4 left right bottom bottom

EFX_EFFECT_PUSH4_L_T_L_L	Push4 left top left left

EFX_EFFECT_PUSH4_L_T_L_R	Push4 left top left right

EFX_EFFECT_PUSH4_L_T_L_T	Push4 left top left top

EFX_EFFECT_PUSH4_L_T_L_B	Push4 left top left bottom

EFX_EFFECT_PUSH4_L_T_R_L	Push4 left top right left

EFX_EFFECT_PUSH4_L_T_R_R	Push4 left top right right

EFX_EFFECT_PUSH4_L_T_R_T	Push4 left top right top

EFX_EFFECT_PUSH4_L_T_R_B	Push4 left top right bottom

EFX_EFFECT_PUSH4_L_T_T_L	Push4 left top top left

EFX_EFFECT_PUSH4_L_T_T_R	Push4 left top top right

EFX_EFFECT_PUSH4_L_T_T_T	Push4 left top top top

EFX_EFFECT_PUSH4_L_T_T_B	Push4 left top top bottom

EFX_EFFECT_PUSH4_L_T_B_L	Push4 left top bottom left

EFX_EFFECT_PUSH4_L_T_B_R	Push4 left top bottom right

EFX_EFFECT_PUSH4_L_T_B_T	Push4 left top bottom top

EFX_EFFECT_PUSH4_L_T_B_B	Push4 left top bottom bottom

EFX_EFFECT_PUSH4_L_B_L_L	Push4 left bottom left left

EFX_EFFECT_PUSH4_L_B_L_R	Push4 left bottom left right

EFX_EFFECT_PUSH4_L_B_L_T	Push4 left bottom left top

EFX_EFFECT_PUSH4_L_B_L_B	Push4 left bottom left bottom

EFX_EFFECT_PUSH4_L_B_R_L	Push4 left bottom right left

EFX_EFFECT_PUSH4_L_B_R_R	Push4 left bottom right right

EFX_EFFECT_PUSH4_L_B_R_T	Push4 left bottom right top

EFX_EFFECT_PUSH4_L_B_R_B	Push4 left bottom right bottom

EFX_EFFECT_PUSH4_L_B_T_L	Push4 left bottom top left

EFX_EFFECT_PUSH4_L_B_T_R	Push4 left bottom top right

EFX_EFFECT_PUSH4_L_B_T_T	Push4 left bottom top top

EFX_EFFECT_PUSH4_L_B_T_B	Push4 left bottom top bottom

EFX_EFFECT_PUSH4_L_B_B_L	Push4 left bottom bottom left

EFX_EFFECT_PUSH4_L_B_B_R	Push4 left bottom bottom right

EFX_EFFECT_PUSH4_L_B_B_T	Push4 left bottom bottom top

EFX_EFFECT_PUSH4_L_B_B_B	Push4 left bottom bottom bottom

EFX_EFFECT_PUSH4_R_L_L_L	Push4 right left left left

EFX_EFFECT_PUSH4_R_L_L_R	Push4 right left left right

EFX_EFFECT_PUSH4_R_L_L_T	Push4 right left left top

EFX_EFFECT_PUSH4_R_L_L_B	Push4 right left left bottom

EFX_EFFECT_PUSH4_R_L_R_L	Push4 right left right left

EFX_EFFECT_PUSH4_R_L_R_R	Push4 right left right right

EFX_EFFECT_PUSH4_R_L_R_T	Push4 right left right top

EFX_EFFECT_PUSH4_R_L_R_B	Push4 right left right bottom

EFX_EFFECT_PUSH4_R_L_T_L	Push4 right left top left

EFX_EFFECT_PUSH4_R_L_T_R	Push4 right left top right

EFX_EFFECT_PUSH4_R_L_T_T	Push4 right left top top

EFX_EFFECT_PUSH4_R_L_T_B	Push4 right left top bottom

EFX_EFFECT_PUSH4_R_L_B_L	Push4 right left bottom left

EFX_EFFECT_PUSH4_R_L_B_R	Push4 right left bottom right

EFX_EFFECT_PUSH4_R_L_B_T	Push4 right left bottom top

EFX_EFFECT_PUSH4_R_L_B_B	Push4 right left bottom bottom

EFX_EFFECT_PUSH4_R_R_L_L	Push4 right right left left

EFX_EFFECT_PUSH4_R_R_L_R	Push4 right right left right

EFX_EFFECT_PUSH4_R_R_L_T	Push4 right right left top

EFX_EFFECT_PUSH4_R_R_L_B	Push4 right right left bottom

EFX_EFFECT_PUSH4_R_R_R_L	Push4 right right right left

EFX_EFFECT_PUSH4_R_R_R_R	Push4 right right right right

EFX_EFFECT_PUSH4_R_R_R_T	Push4 right right right top

EFX_EFFECT_PUSH4_R_R_R_B	Push4 right right right bottom

EFX_EFFECT_PUSH4_R_R_T_L	Push4 right right top left

EFX_EFFECT_PUSH4_R_R_T_R	Push4 right right top right

EFX_EFFECT_PUSH4_R_R_T_T	Push4 right right top top

EFX_EFFECT_PUSH4_R_R_T_B	Push4 right right top bottom

EFX_EFFECT_PUSH4_R_R_B_L	Push4 right right bottom left

EFX_EFFECT_PUSH4_R_R_B_R	Push4 right right bottom right

EFX_EFFECT_PUSH4_R_R_B_T	Push4 right right bottom top

EFX_EFFECT_PUSH4_R_R_B_B	Push4 right right bottom bottom

EFX_EFFECT_PUSH4_R_T_L_L	Push4 right top left left

EFX_EFFECT_PUSH4_R_T_L_R	Push4 right top left right

EFX_EFFECT_PUSH4_R_T_L_T	Push4 right top left top

EFX_EFFECT_PUSH4_R_T_L_B	Push4 right top left bottom

EFX_EFFECT_PUSH4_R_T_R_L	Push4 right top right left

EFX_EFFECT_PUSH4_R_T_R_R	Push4 right top right right

EFX_EFFECT_PUSH4_R_T_R_T	Push4 right top right top

EFX_EFFECT_PUSH4_R_T_R_B	Push4 right top right bottom

EFX_EFFECT_PUSH4_R_T_T_L	Push4 right top top left

EFX_EFFECT_PUSH4_R_T_T_R	Push4 right top top right

EFX_EFFECT_PUSH4_R_T_T_T	Push4 right top top top

EFX_EFFECT_PUSH4_R_T_T_B	Push4 right top top bottom

EFX_EFFECT_PUSH4_R_T_B_L	Push4 right top bottom left

EFX_EFFECT_PUSH4_R_T_B_R	Push4 right top bottom right

EFX_EFFECT_PUSH4_R_T_B_T	Push4 right top bottom top

EFX_EFFECT_PUSH4_R_T_B_B	Push4 right top bottom bottom

EFX_EFFECT_PUSH4_R_B_L_L	Push4 right bottom left left

EFX_EFFECT_PUSH4_R_B_L_R	Push4 right bottom left right

EFX_EFFECT_PUSH4_R_B_L_T	Push4 right bottom left top

EFX_EFFECT_PUSH4_R_B_L_B	Push4 right bottom left bottom

EFX_EFFECT_PUSH4_R_B_R_L	Push4 right bottom right left

EFX_EFFECT_PUSH4_R_B_R_R	Push4 right bottom right right

EFX_EFFECT_PUSH4_R_B_R_T	Push4 right bottom right top

EFX_EFFECT_PUSH4_R_B_R_B	Push4 right bottom right bottom

EFX_EFFECT_PUSH4_R_B_T_L	Push4 right bottom top left

EFX_EFFECT_PUSH4_R_B_T_R	Push4 right bottom top right

EFX_EFFECT_PUSH4_R_B_T_T	Push4 right bottom top top

EFX_EFFECT_PUSH4_R_B_T_B	Push4 right bottom top bottom

EFX_EFFECT_PUSH4_R_B_B_L	Push4 right bottom bottom left

EFX_EFFECT_PUSH4_R_B_B_R	Push4 right bottom bottom right

EFX_EFFECT_PUSH4_R_B_B_T	Push4 right bottom bottom top

EFX_EFFECT_PUSH4_R_B_B_B	Push4 right bottom bottom bottom

EFX_EFFECT_PUSH4_T_L_L_L	Push4 top left left left

EFX_EFFECT_PUSH4_T_L_L_R	Push4 top left left right

EFX_EFFECT_PUSH4_T_L_L_T	Push4 top left left top

EFX_EFFECT_PUSH4_T_L_L_B	Push4 top left left bottom

EFX_EFFECT_PUSH4_T_L_R_L	Push4 top left right left

EFX_EFFECT_PUSH4_T_L_R_R	Push4 top left right right

EFX_EFFECT_PUSH4_T_L_R_T	Push4 top left right top

EFX_EFFECT_PUSH4_T_L_R_B	Push4 top left right bottom

EFX_EFFECT_PUSH4_T_L_T_L	Push4 top left top left

EFX_EFFECT_PUSH4_T_L_T_R	Push4 top left top right

EFX_EFFECT_PUSH4_T_L_T_T	Push4 top left top top

EFX_EFFECT_PUSH4_T_L_T_B	Push4 top left top bottom

EFX_EFFECT_PUSH4_T_L_B_L	Push4 top left bottom left

EFX_EFFECT_PUSH4_T_L_B_R	Push4 top left bottom right

EFX_EFFECT_PUSH4_T_L_B_T	Push4 top left bottom top

EFX_EFFECT_PUSH4_T_L_B_B	Push4 top left bottom bottom

EFX_EFFECT_PUSH4_T_R_L_L	Push4 top right left left

EFX_EFFECT_PUSH4_T_R_L_R	Push4 top right left right

EFX_EFFECT_PUSH4_T_R_L_T	Push4 top right left top

EFX_EFFECT_PUSH4_T_R_L_B	Push4 top right left bottom

EFX_EFFECT_PUSH4_T_R_R_L	Push4 top right right left

EFX_EFFECT_PUSH4_T_R_R_R	Push4 top right right right

EFX_EFFECT_PUSH4_T_R_R_T	Push4 top right right top

EFX_EFFECT_PUSH4_T_R_R_B	Push4 top right right bottom

EFX_EFFECT_PUSH4_T_R_T_L	Push4 top right top left

EFX_EFFECT_PUSH4_T_R_T_R	Push4 top right top right

EFX_EFFECT_PUSH4_T_R_T_T	Push4 top right top top

EFX_EFFECT_PUSH4_T_R_T_B	Push4 top right top bottom

EFX_EFFECT_PUSH4_T_R_B_L	Push4 top right bottom left

EFX_EFFECT_PUSH4_T_R_B_R	Push4 top right bottom right

EFX_EFFECT_PUSH4_T_R_B_T	Push4 top right bottom top

EFX_EFFECT_PUSH4_T_R_B_B	Push4 top right bottom bottom

EFX_EFFECT_PUSH4_T_T_L_L	Push4 top top left left

EFX_EFFECT_PUSH4_T_T_L_R	Push4 top top left right

EFX_EFFECT_PUSH4_T_T_L_T	Push4 top top left top

EFX_EFFECT_PUSH4_T_T_L_B	Push4 top top left bottom

EFX_EFFECT_PUSH4_T_T_R_L	Push4 top top right left

EFX_EFFECT_PUSH4_T_T_R_R	Push4 top top right right

EFX_EFFECT_PUSH4_T_T_R_T	Push4 top top right top

EFX_EFFECT_PUSH4_T_T_R_B	Push4 top top right bottom

EFX_EFFECT_PUSH4_T_T_T_L	Push4 top top top left

EFX_EFFECT_PUSH4_T_T_T_R	Push4 top top top right

EFX_EFFECT_PUSH4_T_T_T_T	Push4 top top top top

EFX_EFFECT_PUSH4_T_T_T_B	Push4 top top top bottom

EFX_EFFECT_PUSH4_T_T_B_L	Push4 top top bottom left

EFX_EFFECT_PUSH4_T_T_B_R	Push4 top top bottom right

EFX_EFFECT_PUSH4_T_T_B_T	Push4 top top bottom top

EFX_EFFECT_PUSH4_T_T_B_B	Push4 top top bottom bottom

EFX_EFFECT_PUSH4_T_B_L_L	Push4 top bottom left left

EFX_EFFECT_PUSH4_T_B_L_R	Push4 top bottom left right

EFX_EFFECT_PUSH4_T_B_L_T	Push4 top bottom left top

EFX_EFFECT_PUSH4_T_B_L_B	Push4 top bottom left bottom

EFX_EFFECT_PUSH4_T_B_R_L	Push4 top bottom right left

EFX_EFFECT_PUSH4_T_B_R_R	Push4 top bottom right right

EFX_EFFECT_PUSH4_T_B_R_T	Push4 top bottom right top

EFX_EFFECT_PUSH4_T_B_R_B	Push4 top bottom right bottom

EFX_EFFECT_PUSH4_T_B_T_L	Push4 top bottom top left

EFX_EFFECT_PUSH4_T_B_T_R	Push4 top bottom top right

EFX_EFFECT_PUSH4_T_B_T_T	Push4 top bottom top top

EFX_EFFECT_PUSH4_T_B_T_B	Push4 top bottom top bottom

EFX_EFFECT_PUSH4_T_B_B_L	Push4 top bottom bottom left

EFX_EFFECT_PUSH4_T_B_B_R	Push4 top bottom bottom right

EFX_EFFECT_PUSH4_T_B_B_T	Push4 top bottom bottom top

EFX_EFFECT_PUSH4_T_B_B_B	Push4 top bottom bottom bottom

EFX_EFFECT_PUSH4_B_L_L_L	Push4 bottom left left left

EFX_EFFECT_PUSH4_B_L_L_R	Push4 bottom left left right

EFX_EFFECT_PUSH4_B_L_L_T	Push4 bottom left left top

EFX_EFFECT_PUSH4_B_L_L_B	Push4 bottom left left bottom

EFX_EFFECT_PUSH4_B_L_R_L	Push4 bottom left right left

EFX_EFFECT_PUSH4_B_L_R_R	Push4 bottom left right right

EFX_EFFECT_PUSH4_B_L_R_T	Push4 bottom left right top

EFX_EFFECT_PUSH4_B_L_R_B	Push4 bottom left right bottom

EFX_EFFECT_PUSH4_B_L_T_L	Push4 bottom left top left

EFX_EFFECT_PUSH4_B_L_T_R	Push4 bottom left top right

EFX_EFFECT_PUSH4_B_L_T_T	Push4 bottom left top top

EFX_EFFECT_PUSH4_B_L_T_B	Push4 bottom left top bottom

EFX_EFFECT_PUSH4_B_L_B_L	Push4 bottom left bottom left

EFX_EFFECT_PUSH4_B_L_B_R	Push4 bottom left bottom right

EFX_EFFECT_PUSH4_B_L_B_T	Push4 bottom left bottom top

EFX_EFFECT_PUSH4_B_L_B_B	Push4 bottom left bottom bottom

EFX_EFFECT_PUSH4_B_R_L_L	Push4 bottom right left left

EFX_EFFECT_PUSH4_B_R_L_R	Push4 bottom right left right

EFX_EFFECT_PUSH4_B_R_L_T	Push4 bottom right left top

EFX_EFFECT_PUSH4_B_R_L_B	Push4 bottom right left bottom

EFX_EFFECT_PUSH4_B_R_R_L	Push4 bottom right right left

EFX_EFFECT_PUSH4_B_R_R_R	Push4 bottom right right right

EFX_EFFECT_PUSH4_B_R_R_T	Push4 bottom right right top

EFX_EFFECT_PUSH4_B_R_R_B	Push4 bottom right right bottom

EFX_EFFECT_PUSH4_B_R_T_L	Push4 bottom right top left

EFX_EFFECT_PUSH4_B_R_T_R	Push4 bottom right top right

EFX_EFFECT_PUSH4_B_R_T_T	Push4 bottom right top top

EFX_EFFECT_PUSH4_B_R_T_B	Push4 bottom right top bottom

EFX_EFFECT_PUSH4_B_R_B_L	Push4 bottom right bottom left

EFX_EFFECT_PUSH4_B_R_B_R	Push4 bottom right bottom right

EFX_EFFECT_PUSH4_B_R_B_T	Push4 bottom right bottom top

EFX_EFFECT_PUSH4_B_R_B_B	Push4 bottom right bottom bottom

EFX_EFFECT_PUSH4_B_T_L_L	Push4 bottom top left left

EFX_EFFECT_PUSH4_B_T_L_R	Push4 bottom top left right

EFX_EFFECT_PUSH4_B_T_L_T	Push4 bottom top left top

EFX_EFFECT_PUSH4_B_T_L_B	Push4 bottom top left bottom

EFX_EFFECT_PUSH4_B_T_R_L	Push4 bottom top right left

EFX_EFFECT_PUSH4_B_T_R_R	Push4 bottom top right right

EFX_EFFECT_PUSH4_B_T_R_T	Push4 bottom top right top

EFX_EFFECT_PUSH4_B_T_R_B	Push4 bottom top right bottom

EFX_EFFECT_PUSH4_B_T_T_L	Push4 bottom top top left

EFX_EFFECT_PUSH4_B_T_T_R	Push4 bottom top top right

EFX_EFFECT_PUSH4_B_T_T_T	Push4 bottom top top top

EFX_EFFECT_PUSH4_B_T_T_B	Push4 bottom top top bottom

EFX_EFFECT_PUSH4_B_T_B_L	Push4 bottom top bottom left

EFX_EFFECT_PUSH4_B_T_B_R	Push4 bottom top bottom right

EFX_EFFECT_PUSH4_B_T_B_T	Push4 bottom top bottom top

EFX_EFFECT_PUSH4_B_T_B_B	Push4 bottom top bottom bottom

EFX_EFFECT_PUSH4_B_B_L_L	Push4 bottom bottom left left

EFX_EFFECT_PUSH4_B_B_L_R	Push4 bottom bottom left right

EFX_EFFECT_PUSH4_B_B_L_T	Push4 bottom bottom left top

EFX_EFFECT_PUSH4_B_B_L_B	Push4 bottom bottom left bottom

EFX_EFFECT_PUSH4_B_B_R_L	Push4 bottom bottom right left

EFX_EFFECT_PUSH4_B_B_R_R	Push4 bottom bottom right right

EFX_EFFECT_PUSH4_B_B_R_T	Push4 bottom bottom right top

EFX_EFFECT_PUSH4_B_B_R_B	Push4 bottom bottom right bottom

EFX_EFFECT_PUSH4_B_B_T_L	Push4 bottom bottom top left

EFX_EFFECT_PUSH4_B_B_T_R	Push4 bottom bottom top right

EFX_EFFECT_PUSH4_B_B_T_T	Push4 bottom bottom top top

EFX_EFFECT_PUSH4_B_B_T_B	Push4 bottom bottom top bottom

EFX_EFFECT_PUSH4_B_B_B_L	Push4 bottom bottom bottom left

EFX_EFFECT_PUSH4_B_B_B_R	Push4 bottom bottom bottom right

EFX_EFFECT_PUSH4_B_B_B_T	Push4 bottom bottom bottom top

EFX_EFFECT_PUSH4_B_B_B_B	Push4 bottom bottom bottom bottom

EFX_EFFECT_PUSH_MAX	Number of effects in this class.

Slide class

EFX_EFFECT_SLIDE_R_TO_L	Slide right to left

EFX_EFFECT_SLIDE_L_TO_R	Slide left to right

EFX_EFFECT_SLIDE_B_TO_T	Slide bottom to top

EFX_EFFECT_SLIDE_T_TO_B	Slide top to bottom

EFX_EFFECT_SLIDE_LT_TO_RB	Slide left-top to right-bottom

EFX_EFFECT_SLIDE_RT_TO_LB	Slide right-top to left-bottom

EFX_EFFECT_SLIDE_LB_TO_RT	Slide left-bottom to right-top

EFX_EFFECT_SLIDE_RB_TO_LT	Slide right-bottom to left-top

EFX_EFFECT_SLIDE_INTERH_L_TO_R_AND_R_TO_L	Slide horizontal interlace left to right and right to left

EFX_EFFECT_SLIDE_INTERV_T_TO_B_AND_B_TO_T	Slide vertical interlace top to bottom and bottom to top

EFX_EFFECT_SLIDE2_T_R_TO_L_AND_B_L_TO_R	Slide2 top right to left and bottom left to right

EFX_EFFECT_SLIDE2_T_L_TO_R_AND_B_R_TO_L	Slide2 top left to right and bottom right to left

EFX_EFFECT_SLIDE2_L_B_TO_T_AND_R_T_TO_B	Slide2 left bottom to top and right top to bottom

EFX_EFFECT_SLIDE2_L_T_TO_B_AND_R_B_TO_T	Slide2 left top to bottom and right bottom to top

EFX_EFFECT_SLIDE4_L_L_L_L	Slide4 left left left left

EFX_EFFECT_SLIDE4_L_L_L_R	Slide4 left left left right

EFX_EFFECT_SLIDE4_L_L_L_T	Slide4 left left left top

EFX_EFFECT_SLIDE4_L_L_L_B	Slide4 left left left bottom

EFX_EFFECT_SLIDE4_L_L_R_L	Slide4 left left right left

EFX_EFFECT_SLIDE4_L_L_R_R	Slide4 left left right right

EFX_EFFECT_SLIDE4_L_L_R_T	Slide4 left left right top

EFX_EFFECT_SLIDE4_L_L_R_B	Slide4 left left right bottom

EFX_EFFECT_SLIDE4_L_L_T_L	Slide4 left left top left

EFX_EFFECT_SLIDE4_L_L_T_R	Slide4 left left top right

EFX_EFFECT_SLIDE4_L_L_T_T	Slide4 left left top top

EFX_EFFECT_SLIDE4_L_L_T_B	Slide4 left left top bottom

EFX_EFFECT_SLIDE4_L_L_B_L	Slide4 left left bottom left

EFX_EFFECT_SLIDE4_L_L_B_R	Slide4 left left bottom right

EFX_EFFECT_SLIDE4_L_L_B_T	Slide4 left left bottom top

EFX_EFFECT_SLIDE4_L_L_B_B	Slide4 left left bottom bottom

EFX_EFFECT_SLIDE4_L_R_L_L	Slide4 left right left left

EFX_EFFECT_SLIDE4_L_R_L_R	Slide4 left right left right

EFX_EFFECT_SLIDE4_L_R_L_T	Slide4 left right left top

EFX_EFFECT_SLIDE4_L_R_L_B	Slide4 left right left bottom

EFX_EFFECT_SLIDE4_L_R_R_L	Slide4 left right right left

EFX_EFFECT_SLIDE4_L_R_R_R	Slide4 left right right right

EFX_EFFECT_SLIDE4_L_R_R_T	Slide4 left right right top

EFX_EFFECT_SLIDE4_L_R_R_B	Slide4 left right right bottom

EFX_EFFECT_SLIDE4_L_R_T_L	Slide4 left right top left

EFX_EFFECT_SLIDE4_L_R_T_R	Slide4 left right top right

EFX_EFFECT_SLIDE4_L_R_T_T	Slide4 left right top top

EFX_EFFECT_SLIDE4_L_R_T_B	Slide4 left right top bottom

EFX_EFFECT_SLIDE4_L_R_B_L	Slide4 left right bottom left

EFX_EFFECT_SLIDE4_L_R_B_R	Slide4 left right bottom right

EFX_EFFECT_SLIDE4_L_R_B_T	Slide4 left right bottom top

EFX_EFFECT_SLIDE4_L_R_B_B	Slide4 left right bottom bottom

EFX_EFFECT_SLIDE4_L_T_L_L	Slide4 left top left left

EFX_EFFECT_SLIDE4_L_T_L_R	Slide4 left top left right

EFX_EFFECT_SLIDE4_L_T_L_T	Slide4 left top left top

EFX_EFFECT_SLIDE4_L_T_L_B	Slide4 left top left bottom

EFX_EFFECT_SLIDE4_L_T_R_L	Slide4 left top right left

EFX_EFFECT_SLIDE4_L_T_R_R	Slide4 left top right right

EFX_EFFECT_SLIDE4_L_T_R_T	Slide4 left top right top

EFX_EFFECT_SLIDE4_L_T_R_B	Slide4 left top right bottom

EFX_EFFECT_SLIDE4_L_T_T_L	Slide4 left top top left

EFX_EFFECT_SLIDE4_L_T_T_R	Slide4 left top top right

EFX_EFFECT_SLIDE4_L_T_T_T	Slide4 left top top top

EFX_EFFECT_SLIDE4_L_T_T_B	Slide4 left top top bottom

EFX_EFFECT_SLIDE4_L_T_B_L	Slide4 left top bottom left

EFX_EFFECT_SLIDE4_L_T_B_R	Slide4 left top bottom right

EFX_EFFECT_SLIDE4_L_T_B_T	Slide4 left top bottom top

EFX_EFFECT_SLIDE4_L_T_B_B	Slide4 left top bottom bottom

EFX_EFFECT_SLIDE4_L_B_L_L	Slide4 left bottom left left

EFX_EFFECT_SLIDE4_L_B_L_R	Slide4 left bottom left right

EFX_EFFECT_SLIDE4_L_B_L_T	Slide4 left bottom left top

EFX_EFFECT_SLIDE4_L_B_L_B	Slide4 left bottom left bottom

EFX_EFFECT_SLIDE4_L_B_R_L	Slide4 left bottom right left

EFX_EFFECT_SLIDE4_L_B_R_R	Slide4 left bottom right right

EFX_EFFECT_SLIDE4_L_B_R_T	Slide4 left bottom right top

EFX_EFFECT_SLIDE4_L_B_R_B	Slide4 left bottom right bottom

EFX_EFFECT_SLIDE4_L_B_T_L	Slide4 left bottom top left

EFX_EFFECT_SLIDE4_L_B_T_R	Slide4 left bottom top right

EFX_EFFECT_SLIDE4_L_B_T_T	Slide4 left bottom top top

EFX_EFFECT_SLIDE4_L_B_T_B	Slide4 left bottom top bottom

EFX_EFFECT_SLIDE4_L_B_B_L	Slide4 left bottom bottom left

EFX_EFFECT_SLIDE4_L_B_B_R	Slide4 left bottom bottom right

EFX_EFFECT_SLIDE4_L_B_B_T	Slide4 left bottom bottom top

EFX_EFFECT_SLIDE4_L_B_B_B	Slide4 left bottom bottom bottom

EFX_EFFECT_SLIDE4_R_L_L_L	Slide4 right left left left

EFX_EFFECT_SLIDE4_R_L_L_R	Slide4 right left left right

EFX_EFFECT_SLIDE4_R_L_L_T	Slide4 right left left top

EFX_EFFECT_SLIDE4_R_L_L_B	Slide4 right left left bottom

EFX_EFFECT_SLIDE4_R_L_R_L	Slide4 right left right left

EFX_EFFECT_SLIDE4_R_L_R_R	Slide4 right left right right

EFX_EFFECT_SLIDE4_R_L_R_T	Slide4 right left right top

EFX_EFFECT_SLIDE4_R_L_R_B	Slide4 right left right bottom

EFX_EFFECT_SLIDE4_R_L_T_L	Slide4 right left top left

EFX_EFFECT_SLIDE4_R_L_T_R	Slide4 right left top right

EFX_EFFECT_SLIDE4_R_L_T_T	Slide4 right left top top

EFX_EFFECT_SLIDE4_R_L_T_B	Slide4 right left top bottom

EFX_EFFECT_SLIDE4_R_L_B_L	Slide4 right left bottom left

EFX_EFFECT_SLIDE4_R_L_B_R	Slide4 right left bottom right

EFX_EFFECT_SLIDE4_R_L_B_T	Slide4 right left bottom top

EFX_EFFECT_SLIDE4_R_L_B_B	Slide4 right left bottom bottom

EFX_EFFECT_SLIDE4_R_R_L_L	Slide4 right right left left

EFX_EFFECT_SLIDE4_R_R_L_R	Slide4 right right left right

EFX_EFFECT_SLIDE4_R_R_L_T	Slide4 right right left top

EFX_EFFECT_SLIDE4_R_R_L_B	Slide4 right right left bottom

EFX_EFFECT_SLIDE4_R_R_R_L	Slide4 right right right left

EFX_EFFECT_SLIDE4_R_R_R_R	Slide4 right right right right

EFX_EFFECT_SLIDE4_R_R_R_T	Slide4 right right right top

EFX_EFFECT_SLIDE4_R_R_R_B	Slide4 right right right bottom

EFX_EFFECT_SLIDE4_R_R_T_L	Slide4 right right top left

EFX_EFFECT_SLIDE4_R_R_T_R	Slide4 right right top right

EFX_EFFECT_SLIDE4_R_R_T_T	Slide4 right right top top

EFX_EFFECT_SLIDE4_R_R_T_B	Slide4 right right top bottom

EFX_EFFECT_SLIDE4_R_R_B_L	Slide4 right right bottom left

EFX_EFFECT_SLIDE4_R_R_B_R	Slide4 right right bottom right

EFX_EFFECT_SLIDE4_R_R_B_T	Slide4 right right bottom top

EFX_EFFECT_SLIDE4_R_R_B_B	Slide4 right right bottom bottom

EFX_EFFECT_SLIDE4_R_T_L_L	Slide4 right top left left

EFX_EFFECT_SLIDE4_R_T_L_R	Slide4 right top left right

EFX_EFFECT_SLIDE4_R_T_L_T	Slide4 right top left top

EFX_EFFECT_SLIDE4_R_T_L_B	Slide4 right top left bottom

EFX_EFFECT_SLIDE4_R_T_R_L	Slide4 right top right left

EFX_EFFECT_SLIDE4_R_T_R_R	Slide4 right top right right

EFX_EFFECT_SLIDE4_R_T_R_T	Slide4 right top right top

EFX_EFFECT_SLIDE4_R_T_R_B	Slide4 right top right bottom

EFX_EFFECT_SLIDE4_R_T_T_L	Slide4 right top top left

EFX_EFFECT_SLIDE4_R_T_T_R	Slide4 right top top right

EFX_EFFECT_SLIDE4_R_T_T_T	Slide4 right top top top

EFX_EFFECT_SLIDE4_R_T_T_B	Slide4 right top top bottom

EFX_EFFECT_SLIDE4_R_T_B_L	Slide4 right top bottom left

EFX_EFFECT_SLIDE4_R_T_B_R	Slide4 right top bottom right

EFX_EFFECT_SLIDE4_R_T_B_T	Slide4 right top bottom top

EFX_EFFECT_SLIDE4_R_T_B_B	Slide4 right top bottom bottom

EFX_EFFECT_SLIDE4_R_B_L_L	Slide4 right bottom left left

EFX_EFFECT_SLIDE4_R_B_L_R	Slide4 right bottom left right

EFX_EFFECT_SLIDE4_R_B_L_T	Slide4 right bottom left top

EFX_EFFECT_SLIDE4_R_B_L_B	Slide4 right bottom left bottom

EFX_EFFECT_SLIDE4_R_B_R_L	Slide4 right bottom right left

EFX_EFFECT_SLIDE4_R_B_R_R	Slide4 right bottom right right

EFX_EFFECT_SLIDE4_R_B_R_T	Slide4 right bottom right top

EFX_EFFECT_SLIDE4_R_B_R_B	Slide4 right bottom right bottom

EFX_EFFECT_SLIDE4_R_B_T_L	Slide4 right bottom top left

EFX_EFFECT_SLIDE4_R_B_T_R	Slide4 right bottom top right

EFX_EFFECT_SLIDE4_R_B_T_T	Slide4 right bottom top top

EFX_EFFECT_SLIDE4_R_B_T_B	Slide4 right bottom top bottom

EFX_EFFECT_SLIDE4_R_B_B_L	Slide4 right bottom bottom left

EFX_EFFECT_SLIDE4_R_B_B_R	Slide4 right bottom bottom right

EFX_EFFECT_SLIDE4_R_B_B_T	Slide4 right bottom bottom top

EFX_EFFECT_SLIDE4_R_B_B_B	Slide4 right bottom bottom bottom

EFX_EFFECT_SLIDE4_T_L_L_L	Slide4 top left left left

EFX_EFFECT_SLIDE4_T_L_L_R	Slide4 top left left right

EFX_EFFECT_SLIDE4_T_L_L_T	Slide4 top left left top

EFX_EFFECT_SLIDE4_T_L_L_B	Slide4 top left left bottom

EFX_EFFECT_SLIDE4_T_L_R_L	Slide4 top left right left

EFX_EFFECT_SLIDE4_T_L_R_R	Slide4 top left right right

EFX_EFFECT_SLIDE4_T_L_R_T	Slide4 top left right top

EFX_EFFECT_SLIDE4_T_L_R_B	Slide4 top left right bottom

EFX_EFFECT_SLIDE4_T_L_T_L	Slide4 top left top left

EFX_EFFECT_SLIDE4_T_L_T_R	Slide4 top left top right

EFX_EFFECT_SLIDE4_T_L_T_T	Slide4 top left top top

EFX_EFFECT_SLIDE4_T_L_T_B	Slide4 top left top bottom

EFX_EFFECT_SLIDE4_T_L_B_L	Slide4 top left bottom left

EFX_EFFECT_SLIDE4_T_L_B_R	Slide4 top left bottom right

EFX_EFFECT_SLIDE4_T_L_B_T	Slide4 top left bottom top

EFX_EFFECT_SLIDE4_T_L_B_B	Slide4 top left bottom bottom

EFX_EFFECT_SLIDE4_T_R_L_L	Slide4 top right left left

EFX_EFFECT_SLIDE4_T_R_L_R	Slide4 top right left right

EFX_EFFECT_SLIDE4_T_R_L_T	Slide4 top right left top

EFX_EFFECT_SLIDE4_T_R_L_B	Slide4 top right left bottom

EFX_EFFECT_SLIDE4_T_R_R_L	Slide4 top right right left

EFX_EFFECT_SLIDE4_T_R_R_R	Slide4 top right right right

EFX_EFFECT_SLIDE4_T_R_R_T	Slide4 top right right top

EFX_EFFECT_SLIDE4_T_R_R_B	Slide4 top right right bottom

EFX_EFFECT_SLIDE4_T_R_T_L	Slide4 top right top left

EFX_EFFECT_SLIDE4_T_R_T_R	Slide4 top right top right

EFX_EFFECT_SLIDE4_T_R_T_T	Slide4 top right top top

EFX_EFFECT_SLIDE4_T_R_T_B	Slide4 top right top bottom

EFX_EFFECT_SLIDE4_T_R_B_L	Slide4 top right bottom left

EFX_EFFECT_SLIDE4_T_R_B_R	Slide4 top right bottom right

EFX_EFFECT_SLIDE4_T_R_B_T	Slide4 top right bottom top

EFX_EFFECT_SLIDE4_T_R_B_B	Slide4 top right bottom bottom

EFX_EFFECT_SLIDE4_T_T_L_L	Slide4 top top left left

EFX_EFFECT_SLIDE4_T_T_L_R	Slide4 top top left right

EFX_EFFECT_SLIDE4_T_T_L_T	Slide4 top top left top

EFX_EFFECT_SLIDE4_T_T_L_B	Slide4 top top left bottom

EFX_EFFECT_SLIDE4_T_T_R_L	Slide4 top top right left

EFX_EFFECT_SLIDE4_T_T_R_R	Slide4 top top right right

EFX_EFFECT_SLIDE4_T_T_R_T	Slide4 top top right top

EFX_EFFECT_SLIDE4_T_T_R_B	Slide4 top top right bottom

EFX_EFFECT_SLIDE4_T_T_T_L	Slide4 top top top left

EFX_EFFECT_SLIDE4_T_T_T_R	Slide4 top top top right

EFX_EFFECT_SLIDE4_T_T_T_T	Slide4 top top top top

EFX_EFFECT_SLIDE4_T_T_T_B	Slide4 top top top bottom

EFX_EFFECT_SLIDE4_T_T_B_L	Slide4 top top bottom left

EFX_EFFECT_SLIDE4_T_T_B_R	Slide4 top top bottom right

EFX_EFFECT_SLIDE4_T_T_B_T	Slide4 top top bottom top

EFX_EFFECT_SLIDE4_T_T_B_B	Slide4 top top bottom bottom

EFX_EFFECT_SLIDE4_T_B_L_L	Slide4 top bottom left left

EFX_EFFECT_SLIDE4_T_B_L_R	Slide4 top bottom left right

EFX_EFFECT_SLIDE4_T_B_L_T	Slide4 top bottom left top

EFX_EFFECT_SLIDE4_T_B_L_B	Slide4 top bottom left bottom

EFX_EFFECT_SLIDE4_T_B_R_L	Slide4 top bottom right left

EFX_EFFECT_SLIDE4_T_B_R_R	Slide4 top bottom right right

EFX_EFFECT_SLIDE4_T_B_R_T	Slide4 top bottom right top

EFX_EFFECT_SLIDE4_T_B_R_B	Slide4 top bottom right bottom

EFX_EFFECT_SLIDE4_T_B_T_L	Slide4 top bottom top left

EFX_EFFECT_SLIDE4_T_B_T_R	Slide4 top bottom top right

EFX_EFFECT_SLIDE4_T_B_T_T	Slide4 top bottom top top

EFX_EFFECT_SLIDE4_T_B_T_B	Slide4 top bottom top bottom

EFX_EFFECT_SLIDE4_T_B_B_L	Slide4 top bottom bottom left

EFX_EFFECT_SLIDE4_T_B_B_R	Slide4 top bottom bottom right

EFX_EFFECT_SLIDE4_T_B_B_T	Slide4 top bottom bottom top

EFX_EFFECT_SLIDE4_T_B_B_B	Slide4 top bottom bottom bottom

EFX_EFFECT_SLIDE4_B_L_L_L	Slide4 bottom left left left

EFX_EFFECT_SLIDE4_B_L_L_R	Slide4 bottom left left right

EFX_EFFECT_SLIDE4_B_L_L_T	Slide4 bottom left left top

EFX_EFFECT_SLIDE4_B_L_L_B	Slide4 bottom left left bottom

EFX_EFFECT_SLIDE4_B_L_R_L	Slide4 bottom left right left

EFX_EFFECT_SLIDE4_B_L_R_R	Slide4 bottom left right right

EFX_EFFECT_SLIDE4_B_L_R_T	Slide4 bottom left right top

EFX_EFFECT_SLIDE4_B_L_R_B	Slide4 bottom left right bottom

EFX_EFFECT_SLIDE4_B_L_T_L	Slide4 bottom left top left

EFX_EFFECT_SLIDE4_B_L_T_R	Slide4 bottom left top right

EFX_EFFECT_SLIDE4_B_L_T_T	Slide4 bottom left top top

EFX_EFFECT_SLIDE4_B_L_T_B	Slide4 bottom left top bottom

EFX_EFFECT_SLIDE4_B_L_B_L	Slide4 bottom left bottom left

EFX_EFFECT_SLIDE4_B_L_B_R	Slide4 bottom left bottom right

EFX_EFFECT_SLIDE4_B_L_B_T	Slide4 bottom left bottom top

EFX_EFFECT_SLIDE4_B_L_B_B	Slide4 bottom left bottom bottom

EFX_EFFECT_SLIDE4_B_R_L_L	Slide4 bottom right left left

EFX_EFFECT_SLIDE4_B_R_L_R	Slide4 bottom right left right

EFX_EFFECT_SLIDE4_B_R_L_T	Slide4 bottom right left top

EFX_EFFECT_SLIDE4_B_R_L_B	Slide4 bottom right left bottom

EFX_EFFECT_SLIDE4_B_R_R_L	Slide4 bottom right right left

EFX_EFFECT_SLIDE4_B_R_R_R	Slide4 bottom right right right

EFX_EFFECT_SLIDE4_B_R_R_T	Slide4 bottom right right top

EFX_EFFECT_SLIDE4_B_R_R_B	Slide4 bottom right right bottom

EFX_EFFECT_SLIDE4_B_R_T_L	Slide4 bottom right top left

EFX_EFFECT_SLIDE4_B_R_T_R	Slide4 bottom right top right

EFX_EFFECT_SLIDE4_B_R_T_T	Slide4 bottom right top top

EFX_EFFECT_SLIDE4_B_R_T_B	Slide4 bottom right top bottom

EFX_EFFECT_SLIDE4_B_R_B_L	Slide4 bottom right bottom left

EFX_EFFECT_SLIDE4_B_R_B_R	Slide4 bottom right bottom right

EFX_EFFECT_SLIDE4_B_R_B_T	Slide4 bottom right bottom top

EFX_EFFECT_SLIDE4_B_R_B_B	Slide4 bottom right bottom bottom

EFX_EFFECT_SLIDE4_B_T_L_L	Slide4 bottom top left left

EFX_EFFECT_SLIDE4_B_T_L_R	Slide4 bottom top left right

EFX_EFFECT_SLIDE4_B_T_L_T	Slide4 bottom top left top

EFX_EFFECT_SLIDE4_B_T_L_B	Slide4 bottom top left bottom

EFX_EFFECT_SLIDE4_B_T_R_L	Slide4 bottom top right left

EFX_EFFECT_SLIDE4_B_T_R_R	Slide4 bottom top right right

EFX_EFFECT_SLIDE4_B_T_R_T	Slide4 bottom top right top

EFX_EFFECT_SLIDE4_B_T_R_B	Slide4 bottom top right bottom

EFX_EFFECT_SLIDE4_B_T_T_L	Slide4 bottom top top left

EFX_EFFECT_SLIDE4_B_T_T_R	Slide4 bottom top top right

EFX_EFFECT_SLIDE4_B_T_T_T	Slide4 bottom top top top

EFX_EFFECT_SLIDE4_B_T_T_B	Slide4 bottom top top bottom

EFX_EFFECT_SLIDE4_B_T_B_L	Slide4 bottom top bottom left

EFX_EFFECT_SLIDE4_B_T_B_R	Slide4 bottom top bottom right

EFX_EFFECT_SLIDE4_B_T_B_T	Slide4 bottom top bottom top

EFX_EFFECT_SLIDE4_B_T_B_B	Slide4 bottom top bottom bottom

EFX_EFFECT_SLIDE4_B_B_L_L	Slide4 bottom bottom left left

EFX_EFFECT_SLIDE4_B_B_L_R	Slide4 bottom bottom left right

EFX_EFFECT_SLIDE4_B_B_L_T	Slide4 bottom bottom left top

EFX_EFFECT_SLIDE4_B_B_L_B	Slide4 bottom bottom left bottom

EFX_EFFECT_SLIDE4_B_B_R_L	Slide4 bottom bottom right left

EFX_EFFECT_SLIDE4_B_B_R_R	Slide4 bottom bottom right right

EFX_EFFECT_SLIDE4_B_B_R_T	Slide4 bottom bottom right top

EFX_EFFECT_SLIDE4_B_B_R_B	Slide4 bottom bottom right bottom

EFX_EFFECT_SLIDE4_B_B_T_L	Slide4 bottom bottom top left

EFX_EFFECT_SLIDE4_B_B_T_R	Slide4 bottom bottom top right

EFX_EFFECT_SLIDE4_B_B_T_T	Slide4 bottom bottom top top

EFX_EFFECT_SLIDE4_B_B_T_B	Slide4 bottom bottom top bottom

EFX_EFFECT_SLIDE4_B_B_B_L	Slide4 bottom bottom bottom left

EFX_EFFECT_SLIDE4_B_B_B_R	Slide4 bottom bottom bottom right

EFX_EFFECT_SLIDE4_B_B_B_T	Slide4 bottom bottom bottom top

EFX_EFFECT_SLIDE4_B_B_B_B	Slide4 bottom bottom bottom bottom

EFX_EFFECT_SLIDE4_LT_LT_LT_LT	Slide4 left-top left-top left-top left-top

EFX_EFFECT_SLIDE4_LT_LT_LT_LB	Slide4 left-top left-top left-top left-bottom

EFX_EFFECT_SLIDE4_LT_LT_LT_RT	Slide4 left-top left-top left-top right-top

EFX_EFFECT_SLIDE4_LT_LT_LT_RB	Slide4 left-top left-top left-top right-bottom

EFX_EFFECT_SLIDE4_LT_LT_LB_LT	Slide4 left-top left-top left-bottom left-top

EFX_EFFECT_SLIDE4_LT_LT_LB_LB	Slide4 left-top left-top left-bottom left-bottom

EFX_EFFECT_SLIDE4_LT_LT_LB_RT	Slide4 left-top left-top left-bottom right-top

EFX_EFFECT_SLIDE4_LT_LT_LB_RB	Slide4 left-top left-top left-bottom right-bottom

EFX_EFFECT_SLIDE4_LT_LT_RT_LT	Slide4 left-top left-top right-top left-top

EFX_EFFECT_SLIDE4_LT_LT_RT_LB	Slide4 left-top left-top right-top left-bottom

EFX_EFFECT_SLIDE4_LT_LT_RT_RT	Slide4 left-top left-top right-top right-top

EFX_EFFECT_SLIDE4_LT_LT_RT_RB	Slide4 left-top left-top right-top right-bottom

EFX_EFFECT_SLIDE4_LT_LT_RB_LT	Slide4 left-top left-top right-bottom left-top

EFX_EFFECT_SLIDE4_LT_LT_RB_LB	Slide4 left-top left-top right-bottom left-bottom

EFX_EFFECT_SLIDE4_LT_LT_RB_RT	Slide4 left-top left-top right-bottom right-top

EFX_EFFECT_SLIDE4_LT_LT_RB_RB	Slide4 left-top left-top right-bottom right-bottom

EFX_EFFECT_SLIDE4_LT_LB_LT_LT	Slide4 left-top left-bottom left-top left-top

EFX_EFFECT_SLIDE4_LT_LB_LT_LB	Slide4 left-top left-bottom left-top left-bottom

EFX_EFFECT_SLIDE4_LT_LB_LT_RT	Slide4 left-top left-bottom left-top right-top

EFX_EFFECT_SLIDE4_LT_LB_LT_RB	Slide4 left-top left-bottom left-top right-bottom

EFX_EFFECT_SLIDE4_LT_LB_LB_LT	Slide4 left-top left-bottom left-bottom left-top

EFX_EFFECT_SLIDE4_LT_LB_LB_LB	Slide4 left-top left-bottom left-bottom left-bottom

EFX_EFFECT_SLIDE4_LT_LB_LB_RT	Slide4 left-top left-bottom left-bottom right-top

EFX_EFFECT_SLIDE4_LT_LB_LB_RB	Slide4 left-top left-bottom left-bottom right-bottom

EFX_EFFECT_SLIDE4_LT_LB_RT_LT	Slide4 left-top left-bottom right-top left-top

EFX_EFFECT_SLIDE4_LT_LB_RT_LB	Slide4 left-top left-bottom right-top left-bottom

EFX_EFFECT_SLIDE4_LT_LB_RT_RT	Slide4 left-top left-bottom right-top right-top

EFX_EFFECT_SLIDE4_LT_LB_RT_RB	Slide4 left-top left-bottom right-top right-bottom

EFX_EFFECT_SLIDE4_LT_LB_RB_LT	Slide4 left-top left-bottom right-bottom left-top

EFX_EFFECT_SLIDE4_LT_LB_RB_LB	Slide4 left-top left-bottom right-bottom left-bottom

EFX_EFFECT_SLIDE4_LT_LB_RB_RT	Slide4 left-top left-bottom right-bottom right-top

EFX_EFFECT_SLIDE4_LT_LB_RB_RB	Slide4 left-top left-bottom right-bottom right-bottom

EFX_EFFECT_SLIDE4_LT_RT_LT_LT	Slide4 left-top right-top left-top left-top

EFX_EFFECT_SLIDE4_LT_RT_LT_LB	Slide4 left-top right-top left-top left-bottom

EFX_EFFECT_SLIDE4_LT_RT_LT_RT	Slide4 left-top right-top left-top right-top

EFX_EFFECT_SLIDE4_LT_RT_LT_RB	Slide4 left-top right-top left-top right-bottom

EFX_EFFECT_SLIDE4_LT_RT_LB_LT	Slide4 left-top right-top left-bottom left-top

EFX_EFFECT_SLIDE4_LT_RT_LB_LB	Slide4 left-top right-top left-bottom left-bottom

EFX_EFFECT_SLIDE4_LT_RT_LB_RT	Slide4 left-top right-top left-bottom right-top

EFX_EFFECT_SLIDE4_LT_RT_LB_RB	Slide4 left-top right-top left-bottom right-bottom

EFX_EFFECT_SLIDE4_LT_RT_RT_LT	Slide4 left-top right-top right-top left-top

EFX_EFFECT_SLIDE4_LT_RT_RT_LB	Slide4 left-top right-top right-top left-bottom

EFX_EFFECT_SLIDE4_LT_RT_RT_RT	Slide4 left-top right-top right-top right-top

EFX_EFFECT_SLIDE4_LT_RT_RT_RB	Slide4 left-top right-top right-top right-bottom

EFX_EFFECT_SLIDE4_LT_RT_RB_LT	Slide4 left-top right-top right-bottom left-top

EFX_EFFECT_SLIDE4_LT_RT_RB_LB	Slide4 left-top right-top right-bottom left-bottom

EFX_EFFECT_SLIDE4_LT_RT_RB_RT	Slide4 left-top right-top right-bottom right-top

EFX_EFFECT_SLIDE4_LT_RT_RB_RB	Slide4 left-top right-top right-bottom right-bottom

EFX_EFFECT_SLIDE4_LT_RB_LT_LT	Slide4 left-top right-bottom left-top left-top

EFX_EFFECT_SLIDE4_LT_RB_LT_LB	Slide4 left-top right-bottom left-top left-bottom

EFX_EFFECT_SLIDE4_LT_RB_LT_RT	Slide4 left-top right-bottom left-top right-top

EFX_EFFECT_SLIDE4_LT_RB_LT_RB	Slide4 left-top right-bottom left-top right-bottom

EFX_EFFECT_SLIDE4_LT_RB_LB_LT	Slide4 left-top right-bottom left-bottom left-top

EFX_EFFECT_SLIDE4_LT_RB_LB_LB	Slide4 left-top right-bottom left-bottom left-bottom

EFX_EFFECT_SLIDE4_LT_RB_LB_RT	Slide4 left-top right-bottom left-bottom right-top

EFX_EFFECT_SLIDE4_LT_RB_LB_RB	Slide4 left-top right-bottom left-bottom right-bottom

EFX_EFFECT_SLIDE4_LT_RB_RT_LT	Slide4 left-top right-bottom right-top left-top

EFX_EFFECT_SLIDE4_LT_RB_RT_LB	Slide4 left-top right-bottom right-top left-bottom

EFX_EFFECT_SLIDE4_LT_RB_RT_RT	Slide4 left-top right-bottom right-top right-top

EFX_EFFECT_SLIDE4_LT_RB_RT_RB	Slide4 left-top right-bottom right-top right-bottom

EFX_EFFECT_SLIDE4_LT_RB_RB_LT	Slide4 left-top right-bottom right-bottom left-top

EFX_EFFECT_SLIDE4_LT_RB_RB_LB	Slide4 left-top right-bottom right-bottom left-bottom

EFX_EFFECT_SLIDE4_LT_RB_RB_RT	Slide4 left-top right-bottom right-bottom right-top

EFX_EFFECT_SLIDE4_LT_RB_RB_RB	Slide4 left-top right-bottom right-bottom right-bottom

EFX_EFFECT_SLIDE4_LB_LT_LT_LT	Slide4 left-bottom left-top left-top left-top

EFX_EFFECT_SLIDE4_LB_LT_LT_LB	Slide4 left-bottom left-top left-top left-bottom

EFX_EFFECT_SLIDE4_LB_LT_LT_RT	Slide4 left-bottom left-top left-top right-top

EFX_EFFECT_SLIDE4_LB_LT_LT_RB	Slide4 left-bottom left-top left-top right-bottom

EFX_EFFECT_SLIDE4_LB_LT_LB_LT	Slide4 left-bottom left-top left-bottom left-top

EFX_EFFECT_SLIDE4_LB_LT_LB_LB	Slide4 left-bottom left-top left-bottom left-bottom

EFX_EFFECT_SLIDE4_LB_LT_LB_RT	Slide4 left-bottom left-top left-bottom right-top

EFX_EFFECT_SLIDE4_LB_LT_LB_RB	Slide4 left-bottom left-top left-bottom right-bottom

EFX_EFFECT_SLIDE4_LB_LT_RT_LT	Slide4 left-bottom left-top right-top left-top

EFX_EFFECT_SLIDE4_LB_LT_RT_LB	Slide4 left-bottom left-top right-top left-bottom

EFX_EFFECT_SLIDE4_LB_LT_RT_RT	Slide4 left-bottom left-top right-top right-top

EFX_EFFECT_SLIDE4_LB_LT_RT_RB	Slide4 left-bottom left-top right-top right-bottom

EFX_EFFECT_SLIDE4_LB_LT_RB_LT	Slide4 left-bottom left-top right-bottom left-top

EFX_EFFECT_SLIDE4_LB_LT_RB_LB	Slide4 left-bottom left-top right-bottom left-bottom

EFX_EFFECT_SLIDE4_LB_LT_RB_RT	Slide4 left-bottom left-top right-bottom right-top

EFX_EFFECT_SLIDE4_LB_LT_RB_RB	Slide4 left-bottom left-top right-bottom right-bottom

EFX_EFFECT_SLIDE4_LB_LB_LT_LT	Slide4 left-bottom left-bottom left-top left-top

EFX_EFFECT_SLIDE4_LB_LB_LT_LB	Slide4 left-bottom left-bottom left-top left-bottom

EFX_EFFECT_SLIDE4_LB_LB_LT_RT	Slide4 left-bottom left-bottom left-top right-top

EFX_EFFECT_SLIDE4_LB_LB_LT_RB	Slide4 left-bottom left-bottom left-top right-bottom

EFX_EFFECT_SLIDE4_LB_LB_LB_LT	Slide4 left-bottom left-bottom left-bottom left-top

EFX_EFFECT_SLIDE4_LB_LB_LB_LB	Slide4 left-bottom left-bottom left-bottom left-bottom

EFX_EFFECT_SLIDE4_LB_LB_LB_RT	Slide4 left-bottom left-bottom left-bottom right-top

EFX_EFFECT_SLIDE4_LB_LB_LB_RB	Slide4 left-bottom left-bottom left-bottom right-bottom

EFX_EFFECT_SLIDE4_LB_LB_RT_LT	Slide4 left-bottom left-bottom right-top left-top

EFX_EFFECT_SLIDE4_LB_LB_RT_LB	Slide4 left-bottom left-bottom right-top left-bottom

EFX_EFFECT_SLIDE4_LB_LB_RT_RT	Slide4 left-bottom left-bottom right-top right-top

EFX_EFFECT_SLIDE4_LB_LB_RT_RB	Slide4 left-bottom left-bottom right-top right-bottom

EFX_EFFECT_SLIDE4_LB_LB_RB_LT	Slide4 left-bottom left-bottom right-bottom left-top

EFX_EFFECT_SLIDE4_LB_LB_RB_LB	Slide4 left-bottom left-bottom right-bottom left-bottom

EFX_EFFECT_SLIDE4_LB_LB_RB_RT	Slide4 left-bottom left-bottom right-bottom right-top

EFX_EFFECT_SLIDE4_LB_LB_RB_RB	Slide4 left-bottom left-bottom right-bottom right-bottom

EFX_EFFECT_SLIDE4_LB_RT_LT_LT	Slide4 left-bottom right-top left-top left-top

EFX_EFFECT_SLIDE4_LB_RT_LT_LB	Slide4 left-bottom right-top left-top left-bottom

EFX_EFFECT_SLIDE4_LB_RT_LT_RT	Slide4 left-bottom right-top left-top right-top

EFX_EFFECT_SLIDE4_LB_RT_LT_RB	Slide4 left-bottom right-top left-top right-bottom

EFX_EFFECT_SLIDE4_LB_RT_LB_LT	Slide4 left-bottom right-top left-bottom left-top

EFX_EFFECT_SLIDE4_LB_RT_LB_LB	Slide4 left-bottom right-top left-bottom left-bottom

EFX_EFFECT_SLIDE4_LB_RT_LB_RT	Slide4 left-bottom right-top left-bottom right-top

EFX_EFFECT_SLIDE4_LB_RT_LB_RB	Slide4 left-bottom right-top left-bottom right-bottom

EFX_EFFECT_SLIDE4_LB_RT_RT_LT	Slide4 left-bottom right-top right-top left-top

EFX_EFFECT_SLIDE4_LB_RT_RT_LB	Slide4 left-bottom right-top right-top left-bottom

EFX_EFFECT_SLIDE4_LB_RT_RT_RT	Slide4 left-bottom right-top right-top right-top

EFX_EFFECT_SLIDE4_LB_RT_RT_RB	Slide4 left-bottom right-top right-top right-bottom

EFX_EFFECT_SLIDE4_LB_RT_RB_LT	Slide4 left-bottom right-top right-bottom left-top

EFX_EFFECT_SLIDE4_LB_RT_RB_LB	Slide4 left-bottom right-top right-bottom left-bottom

EFX_EFFECT_SLIDE4_LB_RT_RB_RT	Slide4 left-bottom right-top right-bottom right-top

EFX_EFFECT_SLIDE4_LB_RT_RB_RB	Slide4 left-bottom right-top right-bottom right-bottom

EFX_EFFECT_SLIDE4_LB_RB_LT_LT	Slide4 left-bottom right-bottom left-top left-top

EFX_EFFECT_SLIDE4_LB_RB_LT_LB	Slide4 left-bottom right-bottom left-top left-bottom

EFX_EFFECT_SLIDE4_LB_RB_LT_RT	Slide4 left-bottom right-bottom left-top right-top

EFX_EFFECT_SLIDE4_LB_RB_LT_RB	Slide4 left-bottom right-bottom left-top right-bottom

EFX_EFFECT_SLIDE4_LB_RB_LB_LT	Slide4 left-bottom right-bottom left-bottom left-top

EFX_EFFECT_SLIDE4_LB_RB_LB_LB	Slide4 left-bottom right-bottom left-bottom left-bottom

EFX_EFFECT_SLIDE4_LB_RB_LB_RT	Slide4 left-bottom right-bottom left-bottom right-top

EFX_EFFECT_SLIDE4_LB_RB_LB_RB	Slide4 left-bottom right-bottom left-bottom right-bottom

EFX_EFFECT_SLIDE4_LB_RB_RT_LT	Slide4 left-bottom right-bottom right-top left-top

EFX_EFFECT_SLIDE4_LB_RB_RT_LB	Slide4 left-bottom right-bottom right-top left-bottom

EFX_EFFECT_SLIDE4_LB_RB_RT_RT	Slide4 left-bottom right-bottom right-top right-top

EFX_EFFECT_SLIDE4_LB_RB_RT_RB	Slide4 left-bottom right-bottom right-top right-bottom

EFX_EFFECT_SLIDE4_LB_RB_RB_LT	Slide4 left-bottom right-bottom right-bottom left-top

EFX_EFFECT_SLIDE4_LB_RB_RB_LB	Slide4 left-bottom right-bottom right-bottom left-bottom

EFX_EFFECT_SLIDE4_LB_RB_RB_RT	Slide4 left-bottom right-bottom right-bottom right-top

EFX_EFFECT_SLIDE4_LB_RB_RB_RB	Slide4 left-bottom right-bottom right-bottom right-bottom

EFX_EFFECT_SLIDE4_RT_LT_LT_LT	Slide4 right-top left-top left-top left-top

EFX_EFFECT_SLIDE4_RT_LT_LT_LB	Slide4 right-top left-top left-top left-bottom

EFX_EFFECT_SLIDE4_RT_LT_LT_RT	Slide4 right-top left-top left-top right-top

EFX_EFFECT_SLIDE4_RT_LT_LT_RB	Slide4 right-top left-top left-top right-bottom

EFX_EFFECT_SLIDE4_RT_LT_LB_LT	Slide4 right-top left-top left-bottom left-top

EFX_EFFECT_SLIDE4_RT_LT_LB_LB	Slide4 right-top left-top left-bottom left-bottom

EFX_EFFECT_SLIDE4_RT_LT_LB_RT	Slide4 right-top left-top left-bottom right-top

EFX_EFFECT_SLIDE4_RT_LT_LB_RB	Slide4 right-top left-top left-bottom right-bottom

EFX_EFFECT_SLIDE4_RT_LT_RT_LT	Slide4 right-top left-top right-top left-top

EFX_EFFECT_SLIDE4_RT_LT_RT_LB	Slide4 right-top left-top right-top left-bottom

EFX_EFFECT_SLIDE4_RT_LT_RT_RT	Slide4 right-top left-top right-top right-top

EFX_EFFECT_SLIDE4_RT_LT_RT_RB	Slide4 right-top left-top right-top right-bottom

EFX_EFFECT_SLIDE4_RT_LT_RB_LT	Slide4 right-top left-top right-bottom left-top

EFX_EFFECT_SLIDE4_RT_LT_RB_LB	Slide4 right-top left-top right-bottom left-bottom

EFX_EFFECT_SLIDE4_RT_LT_RB_RT	Slide4 right-top left-top right-bottom right-top

EFX_EFFECT_SLIDE4_RT_LT_RB_RB	Slide4 right-top left-top right-bottom right-bottom

EFX_EFFECT_SLIDE4_RT_LB_LT_LT	Slide4 right-top left-bottom left-top left-top

EFX_EFFECT_SLIDE4_RT_LB_LT_LB	Slide4 right-top left-bottom left-top left-bottom

EFX_EFFECT_SLIDE4_RT_LB_LT_RT	Slide4 right-top left-bottom left-top right-top

EFX_EFFECT_SLIDE4_RT_LB_LT_RB	Slide4 right-top left-bottom left-top right-bottom

EFX_EFFECT_SLIDE4_RT_LB_LB_LT	Slide4 right-top left-bottom left-bottom left-top

EFX_EFFECT_SLIDE4_RT_LB_LB_LB	Slide4 right-top left-bottom left-bottom left-bottom

EFX_EFFECT_SLIDE4_RT_LB_LB_RT	Slide4 right-top left-bottom left-bottom right-top

EFX_EFFECT_SLIDE4_RT_LB_LB_RB	Slide4 right-top left-bottom left-bottom right-bottom

EFX_EFFECT_SLIDE4_RT_LB_RT_LT	Slide4 right-top left-bottom right-top left-top

EFX_EFFECT_SLIDE4_RT_LB_RT_LB	Slide4 right-top left-bottom right-top left-bottom

EFX_EFFECT_SLIDE4_RT_LB_RT_RT	Slide4 right-top left-bottom right-top right-top

EFX_EFFECT_SLIDE4_RT_LB_RT_RB	Slide4 right-top left-bottom right-top right-bottom

EFX_EFFECT_SLIDE4_RT_LB_RB_LT	Slide4 right-top left-bottom right-bottom left-top

EFX_EFFECT_SLIDE4_RT_LB_RB_LB	Slide4 right-top left-bottom right-bottom left-bottom

EFX_EFFECT_SLIDE4_RT_LB_RB_RT	Slide4 right-top left-bottom right-bottom right-top

EFX_EFFECT_SLIDE4_RT_LB_RB_RB	Slide4 right-top left-bottom right-bottom right-bottom

EFX_EFFECT_SLIDE4_RT_RT_LT_LT	Slide4 right-top right-top left-top left-top

EFX_EFFECT_SLIDE4_RT_RT_LT_LB	Slide4 right-top right-top left-top left-bottom

EFX_EFFECT_SLIDE4_RT_RT_LT_RT	Slide4 right-top right-top left-top right-top

EFX_EFFECT_SLIDE4_RT_RT_LT_RB	Slide4 right-top right-top left-top right-bottom

EFX_EFFECT_SLIDE4_RT_RT_LB_LT	Slide4 right-top right-top left-bottom left-top

EFX_EFFECT_SLIDE4_RT_RT_LB_LB	Slide4 right-top right-top left-bottom left-bottom

EFX_EFFECT_SLIDE4_RT_RT_LB_RT	Slide4 right-top right-top left-bottom right-top

EFX_EFFECT_SLIDE4_RT_RT_LB_RB	Slide4 right-top right-top left-bottom right-bottom

EFX_EFFECT_SLIDE4_RT_RT_RT_LT	Slide4 right-top right-top right-top left-top

EFX_EFFECT_SLIDE4_RT_RT_RT_LB	Slide4 right-top right-top right-top left-bottom

EFX_EFFECT_SLIDE4_RT_RT_RT_RT	Slide4 right-top right-top right-top right-top

EFX_EFFECT_SLIDE4_RT_RT_RT_RB	Slide4 right-top right-top right-top right-bottom

EFX_EFFECT_SLIDE4_RT_RT_RB_LT	Slide4 right-top right-top right-bottom left-top

EFX_EFFECT_SLIDE4_RT_RT_RB_LB	Slide4 right-top right-top right-bottom left-bottom

EFX_EFFECT_SLIDE4_RT_RT_RB_RT	Slide4 right-top right-top right-bottom right-top

EFX_EFFECT_SLIDE4_RT_RT_RB_RB	Slide4 right-top right-top right-bottom right-bottom

EFX_EFFECT_SLIDE4_RT_RB_LT_LT	Slide4 right-top right-bottom left-top left-top

EFX_EFFECT_SLIDE4_RT_RB_LT_LB	Slide4 right-top right-bottom left-top left-bottom

EFX_EFFECT_SLIDE4_RT_RB_LT_RT	Slide4 right-top right-bottom left-top right-top

EFX_EFFECT_SLIDE4_RT_RB_LT_RB	Slide4 right-top right-bottom left-top right-bottom

EFX_EFFECT_SLIDE4_RT_RB_LB_LT	Slide4 right-top right-bottom left-bottom left-top

EFX_EFFECT_SLIDE4_RT_RB_LB_LB	Slide4 right-top right-bottom left-bottom left-bottom

EFX_EFFECT_SLIDE4_RT_RB_LB_RT	Slide4 right-top right-bottom left-bottom right-top

EFX_EFFECT_SLIDE4_RT_RB_LB_RB	Slide4 right-top right-bottom left-bottom right-bottom

EFX_EFFECT_SLIDE4_RT_RB_RT_LT	Slide4 right-top right-bottom right-top left-top

EFX_EFFECT_SLIDE4_RT_RB_RT_LB	Slide4 right-top right-bottom right-top left-bottom

EFX_EFFECT_SLIDE4_RT_RB_RT_RT	Slide4 right-top right-bottom right-top right-top

EFX_EFFECT_SLIDE4_RT_RB_RT_RB	Slide4 right-top right-bottom right-top right-bottom

EFX_EFFECT_SLIDE4_RT_RB_RB_LT	Slide4 right-top right-bottom right-bottom left-top

EFX_EFFECT_SLIDE4_RT_RB_RB_LB	Slide4 right-top right-bottom right-bottom left-bottom

EFX_EFFECT_SLIDE4_RT_RB_RB_RT	Slide4 right-top right-bottom right-bottom right-top

EFX_EFFECT_SLIDE4_RT_RB_RB_RB	Slide4 right-top right-bottom right-bottom right-bottom

EFX_EFFECT_SLIDE4_RB_LT_LT_LT	Slide4 right-bottom left-top left-top left-top

EFX_EFFECT_SLIDE4_RB_LT_LT_LB	Slide4 right-bottom left-top left-top left-bottom

EFX_EFFECT_SLIDE4_RB_LT_LT_RT	Slide4 right-bottom left-top left-top right-top

EFX_EFFECT_SLIDE4_RB_LT_LT_RB	Slide4 right-bottom left-top left-top right-bottom

EFX_EFFECT_SLIDE4_RB_LT_LB_LT	Slide4 right-bottom left-top left-bottom left-top

EFX_EFFECT_SLIDE4_RB_LT_LB_LB	Slide4 right-bottom left-top left-bottom left-bottom

EFX_EFFECT_SLIDE4_RB_LT_LB_RT	Slide4 right-bottom left-top left-bottom right-top

EFX_EFFECT_SLIDE4_RB_LT_LB_RB	Slide4 right-bottom left-top left-bottom right-bottom

EFX_EFFECT_SLIDE4_RB_LT_RT_LT	Slide4 right-bottom left-top right-top left-top

EFX_EFFECT_SLIDE4_RB_LT_RT_LB	Slide4 right-bottom left-top right-top left-bottom

EFX_EFFECT_SLIDE4_RB_LT_RT_RT	Slide4 right-bottom left-top right-top right-top

EFX_EFFECT_SLIDE4_RB_LT_RT_RB	Slide4 right-bottom left-top right-top right-bottom

EFX_EFFECT_SLIDE4_RB_LT_RB_LT	Slide4 right-bottom left-top right-bottom left-top

EFX_EFFECT_SLIDE4_RB_LT_RB_LB	Slide4 right-bottom left-top right-bottom left-bottom

EFX_EFFECT_SLIDE4_RB_LT_RB_RT	Slide4 right-bottom left-top right-bottom right-top

EFX_EFFECT_SLIDE4_RB_LT_RB_RB	Slide4 right-bottom left-top right-bottom right-bottom

EFX_EFFECT_SLIDE4_RB_LB_LT_LT	Slide4 right-bottom left-bottom left-top left-top

EFX_EFFECT_SLIDE4_RB_LB_LT_LB	Slide4 right-bottom left-bottom left-top left-bottom

EFX_EFFECT_SLIDE4_RB_LB_LT_RT	Slide4 right-bottom left-bottom left-top right-top

EFX_EFFECT_SLIDE4_RB_LB_LT_RB	Slide4 right-bottom left-bottom left-top right-bottom

EFX_EFFECT_SLIDE4_RB_LB_LB_LT	Slide4 right-bottom left-bottom left-bottom left-top

EFX_EFFECT_SLIDE4_RB_LB_LB_LB	Slide4 right-bottom left-bottom left-bottom left-bottom

EFX_EFFECT_SLIDE4_RB_LB_LB_RT	Slide4 right-bottom left-bottom left-bottom right-top

EFX_EFFECT_SLIDE4_RB_LB_LB_RB	Slide4 right-bottom left-bottom left-bottom right-bottom

EFX_EFFECT_SLIDE4_RB_LB_RT_LT	Slide4 right-bottom left-bottom right-top left-top

EFX_EFFECT_SLIDE4_RB_LB_RT_LB	Slide4 right-bottom left-bottom right-top left-bottom

EFX_EFFECT_SLIDE4_RB_LB_RT_RT	Slide4 right-bottom left-bottom right-top right-top

EFX_EFFECT_SLIDE4_RB_LB_RT_RB	Slide4 right-bottom left-bottom right-top right-bottom

EFX_EFFECT_SLIDE4_RB_LB_RB_LT	Slide4 right-bottom left-bottom right-bottom left-top

EFX_EFFECT_SLIDE4_RB_LB_RB_LB	Slide4 right-bottom left-bottom right-bottom left-bottom

EFX_EFFECT_SLIDE4_RB_LB_RB_RT	Slide4 right-bottom left-bottom right-bottom right-top

EFX_EFFECT_SLIDE4_RB_LB_RB_RB	Slide4 right-bottom left-bottom right-bottom right-bottom

EFX_EFFECT_SLIDE4_RB_RT_LT_LT	Slide4 right-bottom right-top left-top left-top

EFX_EFFECT_SLIDE4_RB_RT_LT_LB	Slide4 right-bottom right-top left-top left-bottom

EFX_EFFECT_SLIDE4_RB_RT_LT_RT	Slide4 right-bottom right-top left-top right-top

EFX_EFFECT_SLIDE4_RB_RT_LT_RB	Slide4 right-bottom right-top left-top right-bottom

EFX_EFFECT_SLIDE4_RB_RT_LB_LT	Slide4 right-bottom right-top left-bottom left-top

EFX_EFFECT_SLIDE4_RB_RT_LB_LB	Slide4 right-bottom right-top left-bottom left-bottom

EFX_EFFECT_SLIDE4_RB_RT_LB_RT	Slide4 right-bottom right-top left-bottom right-top

EFX_EFFECT_SLIDE4_RB_RT_LB_RB	Slide4 right-bottom right-top left-bottom right-bottom

EFX_EFFECT_SLIDE4_RB_RT_RT_LT	Slide4 right-bottom right-top right-top left-top

EFX_EFFECT_SLIDE4_RB_RT_RT_LB	Slide4 right-bottom right-top right-top left-bottom

EFX_EFFECT_SLIDE4_RB_RT_RT_RT	Slide4 right-bottom right-top right-top right-top

EFX_EFFECT_SLIDE4_RB_RT_RT_RB	Slide4 right-bottom right-top right-top right-bottom

EFX_EFFECT_SLIDE4_RB_RT_RB_LT	Slide4 right-bottom right-top right-bottom left-top

EFX_EFFECT_SLIDE4_RB_RT_RB_LB	Slide4 right-bottom right-top right-bottom left-bottom

EFX_EFFECT_SLIDE4_RB_RT_RB_RT	Slide4 right-bottom right-top right-bottom right-top

EFX_EFFECT_SLIDE4_RB_RT_RB_RB	Slide4 right-bottom right-top right-bottom right-bottom

EFX_EFFECT_SLIDE4_RB_RB_LT_LT	Slide4 right-bottom right-bottom left-top left-top

EFX_EFFECT_SLIDE4_RB_RB_LT_LB	Slide4 right-bottom right-bottom left-top left-bottom

EFX_EFFECT_SLIDE4_RB_RB_LT_RT	Slide4 right-bottom right-bottom left-top right-top

EFX_EFFECT_SLIDE4_RB_RB_LT_RB	Slide4 right-bottom right-bottom left-top right-bottom

EFX_EFFECT_SLIDE4_RB_RB_LB_LT	Slide4 right-bottom right-bottom left-bottom left-top

EFX_EFFECT_SLIDE4_RB_RB_LB_LB	Slide4 right-bottom right-bottom left-bottom left-bottom

EFX_EFFECT_SLIDE4_RB_RB_LB_RT	Slide4 right-bottom right-bottom left-bottom right-top

EFX_EFFECT_SLIDE4_RB_RB_LB_RB	Slide4 right-bottom right-bottom left-bottom right-bottom

EFX_EFFECT_SLIDE4_RB_RB_RT_LT	Slide4 right-bottom right-bottom right-top left-top

EFX_EFFECT_SLIDE4_RB_RB_RT_LB	Slide4 right-bottom right-bottom right-top left-bottom

EFX_EFFECT_SLIDE4_RB_RB_RT_RT	Slide4 right-bottom right-bottom right-top right-top

EFX_EFFECT_SLIDE4_RB_RB_RT_RB	Slide4 right-bottom right-bottom right-top right-bottom

EFX_EFFECT_SLIDE4_RB_RB_RB_LT	Slide4 right-bottom right-bottom right-bottom left-top

EFX_EFFECT_SLIDE4_RB_RB_RB_LB	Slide4 right-bottom right-bottom right-bottom left-bottom

EFX_EFFECT_SLIDE4_RB_RB_RB_RT	Slide4 right-bottom right-bottom right-bottom right-top

EFX_EFFECT_SLIDE4_RB_RB_RB_RB	Slide4 right-bottom right-bottom right-bottom right-bottom

EFX_EFFECT_SLIDE_MAX	Number of effects in this class.

Roll class

EFX_EFFECT_ROLL_L_TO_R	Roll left to right

EFX_EFFECT_ROLL_R_TO_L	Roll right to left

EFX_EFFECT_ROLL_T_TO_B	Roll top to bottom

EFX_EFFECT_ROLL_B_TO_T	Roll bottom to top

EFX_EFFECT_ROLL2_T_R_TO_L_AND_B_L_TO_R	Roll2 top right to left and bottom left to right

EFX_EFFECT_ROLL2_T_L_TO_R_AND_B_R_TO_L	Roll2 top left to right and bottom right to left

EFX_EFFECT_ROLL2_L_B_TO_T_AND_R_T_TO_B	Roll2 left bottom to top and right top to bottom

EFX_EFFECT_ROLL2_L_T_TO_B_AND_R_B_TO_T	Roll2 left top to bottom and right bottom to top

EFX_EFFECT_ROLL4_L_L_L_L	Roll4 left left left left

EFX_EFFECT_ROLL4_L_L_L_R	Roll4 left left left right

EFX_EFFECT_ROLL4_L_L_L_T	Roll4 left left left top

EFX_EFFECT_ROLL4_L_L_L_B	Roll4 left left left bottom

EFX_EFFECT_ROLL4_L_L_R_L	Roll4 left left right left

EFX_EFFECT_ROLL4_L_L_R_R	Roll4 left left right right

EFX_EFFECT_ROLL4_L_L_R_T	Roll4 left left right top

EFX_EFFECT_ROLL4_L_L_R_B	Roll4 left left right bottom

EFX_EFFECT_ROLL4_L_L_T_L	Roll4 left left top left

EFX_EFFECT_ROLL4_L_L_T_R	Roll4 left left top right

EFX_EFFECT_ROLL4_L_L_T_T	Roll4 left left top top

EFX_EFFECT_ROLL4_L_L_T_B	Roll4 left left top bottom

EFX_EFFECT_ROLL4_L_L_B_L	Roll4 left left bottom left

EFX_EFFECT_ROLL4_L_L_B_R	Roll4 left left bottom right

EFX_EFFECT_ROLL4_L_L_B_T	Roll4 left left bottom top

EFX_EFFECT_ROLL4_L_L_B_B	Roll4 left left bottom bottom

EFX_EFFECT_ROLL4_L_R_L_L	Roll4 left right left left

EFX_EFFECT_ROLL4_L_R_L_R	Roll4 left right left right

EFX_EFFECT_ROLL4_L_R_L_T	Roll4 left right left top

EFX_EFFECT_ROLL4_L_R_L_B	Roll4 left right left bottom

EFX_EFFECT_ROLL4_L_R_R_L	Roll4 left right right left

EFX_EFFECT_ROLL4_L_R_R_R	Roll4 left right right right

EFX_EFFECT_ROLL4_L_R_R_T	Roll4 left right right top

EFX_EFFECT_ROLL4_L_R_R_B	Roll4 left right right bottom

EFX_EFFECT_ROLL4_L_R_T_L	Roll4 left right top left

EFX_EFFECT_ROLL4_L_R_T_R	Roll4 left right top right

EFX_EFFECT_ROLL4_L_R_T_T	Roll4 left right top top

EFX_EFFECT_ROLL4_L_R_T_B	Roll4 left right top bottom

EFX_EFFECT_ROLL4_L_R_B_L	Roll4 left right bottom left

EFX_EFFECT_ROLL4_L_R_B_R	Roll4 left right bottom right

EFX_EFFECT_ROLL4_L_R_B_T	Roll4 left right bottom top

EFX_EFFECT_ROLL4_L_R_B_B	Roll4 left right bottom bottom

EFX_EFFECT_ROLL4_L_T_L_L	Roll4 left top left left

EFX_EFFECT_ROLL4_L_T_L_R	Roll4 left top left right

EFX_EFFECT_ROLL4_L_T_L_T	Roll4 left top left top

EFX_EFFECT_ROLL4_L_T_L_B	Roll4 left top left bottom

EFX_EFFECT_ROLL4_L_T_R_L	Roll4 left top right left

EFX_EFFECT_ROLL4_L_T_R_R	Roll4 left top right right

EFX_EFFECT_ROLL4_L_T_R_T	Roll4 left top right top

EFX_EFFECT_ROLL4_L_T_R_B	Roll4 left top right bottom

EFX_EFFECT_ROLL4_L_T_T_L	Roll4 left top top left

EFX_EFFECT_ROLL4_L_T_T_R	Roll4 left top top right

EFX_EFFECT_ROLL4_L_T_T_T	Roll4 left top top top

EFX_EFFECT_ROLL4_L_T_T_B	Roll4 left top top bottom

EFX_EFFECT_ROLL4_L_T_B_L	Roll4 left top bottom left

EFX_EFFECT_ROLL4_L_T_B_R	Roll4 left top bottom right

EFX_EFFECT_ROLL4_L_T_B_T	Roll4 left top bottom top

EFX_EFFECT_ROLL4_L_T_B_B	Roll4 left top bottom bottom

EFX_EFFECT_ROLL4_L_B_L_L	Roll4 left bottom left left

EFX_EFFECT_ROLL4_L_B_L_R	Roll4 left bottom left right

EFX_EFFECT_ROLL4_L_B_L_T	Roll4 left bottom left top

EFX_EFFECT_ROLL4_L_B_L_B	Roll4 left bottom left bottom

EFX_EFFECT_ROLL4_L_B_R_L	Roll4 left bottom right left

EFX_EFFECT_ROLL4_L_B_R_R	Roll4 left bottom right right

EFX_EFFECT_ROLL4_L_B_R_T	Roll4 left bottom right top

EFX_EFFECT_ROLL4_L_B_R_B	Roll4 left bottom right bottom

EFX_EFFECT_ROLL4_L_B_T_L	Roll4 left bottom top left

EFX_EFFECT_ROLL4_L_B_T_R	Roll4 left bottom top right

EFX_EFFECT_ROLL4_L_B_T_T	Roll4 left bottom top top

EFX_EFFECT_ROLL4_L_B_T_B	Roll4 left bottom top bottom

EFX_EFFECT_ROLL4_L_B_B_L	Roll4 left bottom bottom left

EFX_EFFECT_ROLL4_L_B_B_R	Roll4 left bottom bottom right

EFX_EFFECT_ROLL4_L_B_B_T	Roll4 left bottom bottom top

EFX_EFFECT_ROLL4_L_B_B_B	Roll4 left bottom bottom bottom

EFX_EFFECT_ROLL4_R_L_L_L	Roll4 right left left left

EFX_EFFECT_ROLL4_R_L_L_R	Roll4 right left left right

EFX_EFFECT_ROLL4_R_L_L_T	Roll4 right left left top

EFX_EFFECT_ROLL4_R_L_L_B	Roll4 right left left bottom

EFX_EFFECT_ROLL4_R_L_R_L	Roll4 right left right left

EFX_EFFECT_ROLL4_R_L_R_R	Roll4 right left right right

EFX_EFFECT_ROLL4_R_L_R_T	Roll4 right left right top

EFX_EFFECT_ROLL4_R_L_R_B	Roll4 right left right bottom

EFX_EFFECT_ROLL4_R_L_T_L	Roll4 right left top left

EFX_EFFECT_ROLL4_R_L_T_R	Roll4 right left top right

EFX_EFFECT_ROLL4_R_L_T_T	Roll4 right left top top

EFX_EFFECT_ROLL4_R_L_T_B	Roll4 right left top bottom

EFX_EFFECT_ROLL4_R_L_B_L	Roll4 right left bottom left

EFX_EFFECT_ROLL4_R_L_B_R	Roll4 right left bottom right

EFX_EFFECT_ROLL4_R_L_B_T	Roll4 right left bottom top

EFX_EFFECT_ROLL4_R_L_B_B	Roll4 right left bottom bottom

EFX_EFFECT_ROLL4_R_R_L_L	Roll4 right right left left

EFX_EFFECT_ROLL4_R_R_L_R	Roll4 right right left right

EFX_EFFECT_ROLL4_R_R_L_T	Roll4 right right left top

EFX_EFFECT_ROLL4_R_R_L_B	Roll4 right right left bottom

EFX_EFFECT_ROLL4_R_R_R_L	Roll4 right right right left

EFX_EFFECT_ROLL4_R_R_R_R	Roll4 right right right right

EFX_EFFECT_ROLL4_R_R_R_T	Roll4 right right right top

EFX_EFFECT_ROLL4_R_R_R_B	Roll4 right right right bottom

EFX_EFFECT_ROLL4_R_R_T_L	Roll4 right right top left

EFX_EFFECT_ROLL4_R_R_T_R	Roll4 right right top right

EFX_EFFECT_ROLL4_R_R_T_T	Roll4 right right top top

EFX_EFFECT_ROLL4_R_R_T_B	Roll4 right right top bottom

EFX_EFFECT_ROLL4_R_R_B_L	Roll4 right right bottom left

EFX_EFFECT_ROLL4_R_R_B_R	Roll4 right right bottom right

EFX_EFFECT_ROLL4_R_R_B_T	Roll4 right right bottom top

EFX_EFFECT_ROLL4_R_R_B_B	Roll4 right right bottom bottom

EFX_EFFECT_ROLL4_R_T_L_L	Roll4 right top left left

EFX_EFFECT_ROLL4_R_T_L_R	Roll4 right top left right

EFX_EFFECT_ROLL4_R_T_L_T	Roll4 right top left top

EFX_EFFECT_ROLL4_R_T_L_B	Roll4 right top left bottom

EFX_EFFECT_ROLL4_R_T_R_L	Roll4 right top right left

EFX_EFFECT_ROLL4_R_T_R_R	Roll4 right top right right

EFX_EFFECT_ROLL4_R_T_R_T	Roll4 right top right top

EFX_EFFECT_ROLL4_R_T_R_B	Roll4 right top right bottom

EFX_EFFECT_ROLL4_R_T_T_L	Roll4 right top top left

EFX_EFFECT_ROLL4_R_T_T_R	Roll4 right top top right

EFX_EFFECT_ROLL4_R_T_T_T	Roll4 right top top top

EFX_EFFECT_ROLL4_R_T_T_B	Roll4 right top top bottom

EFX_EFFECT_ROLL4_R_T_B_L	Roll4 right top bottom left

EFX_EFFECT_ROLL4_R_T_B_R	Roll4 right top bottom right

EFX_EFFECT_ROLL4_R_T_B_T	Roll4 right top bottom top

EFX_EFFECT_ROLL4_R_T_B_B	Roll4 right top bottom bottom

EFX_EFFECT_ROLL4_R_B_L_L	Roll4 right bottom left left

EFX_EFFECT_ROLL4_R_B_L_R	Roll4 right bottom left right

EFX_EFFECT_ROLL4_R_B_L_T	Roll4 right bottom left top

EFX_EFFECT_ROLL4_R_B_L_B	Roll4 right bottom left bottom

EFX_EFFECT_ROLL4_R_B_R_L	Roll4 right bottom right left

EFX_EFFECT_ROLL4_R_B_R_R	Roll4 right bottom right right

EFX_EFFECT_ROLL4_R_B_R_T	Roll4 right bottom right top

EFX_EFFECT_ROLL4_R_B_R_B	Roll4 right bottom right bottom

EFX_EFFECT_ROLL4_R_B_T_L	Roll4 right bottom top left

EFX_EFFECT_ROLL4_R_B_T_R	Roll4 right bottom top right

EFX_EFFECT_ROLL4_R_B_T_T	Roll4 right bottom top top

EFX_EFFECT_ROLL4_R_B_T_B	Roll4 right bottom top bottom

EFX_EFFECT_ROLL4_R_B_B_L	Roll4 right bottom bottom left

EFX_EFFECT_ROLL4_R_B_B_R	Roll4 right bottom bottom right

EFX_EFFECT_ROLL4_R_B_B_T	Roll4 right bottom bottom top

EFX_EFFECT_ROLL4_R_B_B_B	Roll4 right bottom bottom bottom

EFX_EFFECT_ROLL4_T_L_L_L	Roll4 top left left left

EFX_EFFECT_ROLL4_T_L_L_R	Roll4 top left left right

EFX_EFFECT_ROLL4_T_L_L_T	Roll4 top left left top

EFX_EFFECT_ROLL4_T_L_L_B	Roll4 top left left bottom

EFX_EFFECT_ROLL4_T_L_R_L	Roll4 top left right left

EFX_EFFECT_ROLL4_T_L_R_R	Roll4 top left right right

EFX_EFFECT_ROLL4_T_L_R_T	Roll4 top left right top

EFX_EFFECT_ROLL4_T_L_R_B	Roll4 top left right bottom

EFX_EFFECT_ROLL4_T_L_T_L	Roll4 top left top left

EFX_EFFECT_ROLL4_T_L_T_R	Roll4 top left top right

EFX_EFFECT_ROLL4_T_L_T_T	Roll4 top left top top

EFX_EFFECT_ROLL4_T_L_T_B	Roll4 top left top bottom

EFX_EFFECT_ROLL4_T_L_B_L	Roll4 top left bottom left

EFX_EFFECT_ROLL4_T_L_B_R	Roll4 top left bottom right

EFX_EFFECT_ROLL4_T_L_B_T	Roll4 top left bottom top

EFX_EFFECT_ROLL4_T_L_B_B	Roll4 top left bottom bottom

EFX_EFFECT_ROLL4_T_R_L_L	Roll4 top right left left

EFX_EFFECT_ROLL4_T_R_L_R	Roll4 top right left right

EFX_EFFECT_ROLL4_T_R_L_T	Roll4 top right left top

EFX_EFFECT_ROLL4_T_R_L_B	Roll4 top right left bottom

EFX_EFFECT_ROLL4_T_R_R_L	Roll4 top right right left

EFX_EFFECT_ROLL4_T_R_R_R	Roll4 top right right right

EFX_EFFECT_ROLL4_T_R_R_T	Roll4 top right right top

EFX_EFFECT_ROLL4_T_R_R_B	Roll4 top right right bottom

EFX_EFFECT_ROLL4_T_R_T_L	Roll4 top right top left

EFX_EFFECT_ROLL4_T_R_T_R	Roll4 top right top right

EFX_EFFECT_ROLL4_T_R_T_T	Roll4 top right top top

EFX_EFFECT_ROLL4_T_R_T_B	Roll4 top right top bottom

EFX_EFFECT_ROLL4_T_R_B_L	Roll4 top right bottom left

EFX_EFFECT_ROLL4_T_R_B_R	Roll4 top right bottom right

EFX_EFFECT_ROLL4_T_R_B_T	Roll4 top right bottom top

EFX_EFFECT_ROLL4_T_R_B_B	Roll4 top right bottom bottom

EFX_EFFECT_ROLL4_T_T_L_L	Roll4 top top left left

EFX_EFFECT_ROLL4_T_T_L_R	Roll4 top top left right

EFX_EFFECT_ROLL4_T_T_L_T	Roll4 top top left top

EFX_EFFECT_ROLL4_T_T_L_B	Roll4 top top left bottom

EFX_EFFECT_ROLL4_T_T_R_L	Roll4 top top right left

EFX_EFFECT_ROLL4_T_T_R_R	Roll4 top top right right

EFX_EFFECT_ROLL4_T_T_R_T	Roll4 top top right top

EFX_EFFECT_ROLL4_T_T_R_B	Roll4 top top right bottom

EFX_EFFECT_ROLL4_T_T_T_L	Roll4 top top top left

EFX_EFFECT_ROLL4_T_T_T_R	Roll4 top top top right

EFX_EFFECT_ROLL4_T_T_T_T	Roll4 top top top top

EFX_EFFECT_ROLL4_T_T_T_B	Roll4 top top top bottom

EFX_EFFECT_ROLL4_T_T_B_L	Roll4 top top bottom left

EFX_EFFECT_ROLL4_T_T_B_R	Roll4 top top bottom right

EFX_EFFECT_ROLL4_T_T_B_T	Roll4 top top bottom top

EFX_EFFECT_ROLL4_T_T_B_B	Roll4 top top bottom bottom

EFX_EFFECT_ROLL4_T_B_L_L	Roll4 top bottom left left

EFX_EFFECT_ROLL4_T_B_L_R	Roll4 top bottom left right

EFX_EFFECT_ROLL4_T_B_L_T	Roll4 top bottom left top

EFX_EFFECT_ROLL4_T_B_L_B	Roll4 top bottom left bottom

EFX_EFFECT_ROLL4_T_B_R_L	Roll4 top bottom right left

EFX_EFFECT_ROLL4_T_B_R_R	Roll4 top bottom right right

EFX_EFFECT_ROLL4_T_B_R_T	Roll4 top bottom right top

EFX_EFFECT_ROLL4_T_B_R_B	Roll4 top bottom right bottom

EFX_EFFECT_ROLL4_T_B_T_L	Roll4 top bottom top left

EFX_EFFECT_ROLL4_T_B_T_R	Roll4 top bottom top right

EFX_EFFECT_ROLL4_T_B_T_T	Roll4 top bottom top top

EFX_EFFECT_ROLL4_T_B_T_B	Roll4 top bottom top bottom

EFX_EFFECT_ROLL4_T_B_B_L	Roll4 top bottom bottom left

EFX_EFFECT_ROLL4_T_B_B_R	Roll4 top bottom bottom right

EFX_EFFECT_ROLL4_T_B_B_T	Roll4 top bottom bottom top

EFX_EFFECT_ROLL4_T_B_B_B	Roll4 top bottom bottom bottom

EFX_EFFECT_ROLL4_B_L_L_L	Roll4 bottom left left left

EFX_EFFECT_ROLL4_B_L_L_R	Roll4 bottom left left right

EFX_EFFECT_ROLL4_B_L_L_T	Roll4 bottom left left top

EFX_EFFECT_ROLL4_B_L_L_B	Roll4 bottom left left bottom

EFX_EFFECT_ROLL4_B_L_R_L	Roll4 bottom left right left

EFX_EFFECT_ROLL4_B_L_R_R	Roll4 bottom left right right

EFX_EFFECT_ROLL4_B_L_R_T	Roll4 bottom left right top

EFX_EFFECT_ROLL4_B_L_R_B	Roll4 bottom left right bottom

EFX_EFFECT_ROLL4_B_L_T_L	Roll4 bottom left top left

EFX_EFFECT_ROLL4_B_L_T_R	Roll4 bottom left top right

EFX_EFFECT_ROLL4_B_L_T_T	Roll4 bottom left top top

EFX_EFFECT_ROLL4_B_L_T_B	Roll4 bottom left top bottom

EFX_EFFECT_ROLL4_B_L_B_L	Roll4 bottom left bottom left

EFX_EFFECT_ROLL4_B_L_B_R	Roll4 bottom left bottom right

EFX_EFFECT_ROLL4_B_L_B_T	Roll4 bottom left bottom top

EFX_EFFECT_ROLL4_B_L_B_B	Roll4 bottom left bottom bottom

EFX_EFFECT_ROLL4_B_R_L_L	Roll4 bottom right left left

EFX_EFFECT_ROLL4_B_R_L_R	Roll4 bottom right left right

EFX_EFFECT_ROLL4_B_R_L_T	Roll4 bottom right left top

EFX_EFFECT_ROLL4_B_R_L_B	Roll4 bottom right left bottom

EFX_EFFECT_ROLL4_B_R_R_L	Roll4 bottom right right left

EFX_EFFECT_ROLL4_B_R_R_R	Roll4 bottom right right right

EFX_EFFECT_ROLL4_B_R_R_T	Roll4 bottom right right top

EFX_EFFECT_ROLL4_B_R_R_B	Roll4 bottom right right bottom

EFX_EFFECT_ROLL4_B_R_T_L	Roll4 bottom right top left

EFX_EFFECT_ROLL4_B_R_T_R	Roll4 bottom right top right

EFX_EFFECT_ROLL4_B_R_T_T	Roll4 bottom right top top

EFX_EFFECT_ROLL4_B_R_T_B	Roll4 bottom right top bottom

EFX_EFFECT_ROLL4_B_R_B_L	Roll4 bottom right bottom left

EFX_EFFECT_ROLL4_B_R_B_R	Roll4 bottom right bottom right

EFX_EFFECT_ROLL4_B_R_B_T	Roll4 bottom right bottom top

EFX_EFFECT_ROLL4_B_R_B_B	Roll4 bottom right bottom bottom

EFX_EFFECT_ROLL4_B_T_L_L	Roll4 bottom top left left

EFX_EFFECT_ROLL4_B_T_L_R	Roll4 bottom top left right

EFX_EFFECT_ROLL4_B_T_L_T	Roll4 bottom top left top

EFX_EFFECT_ROLL4_B_T_L_B	Roll4 bottom top left bottom

EFX_EFFECT_ROLL4_B_T_R_L	Roll4 bottom top right left

EFX_EFFECT_ROLL4_B_T_R_R	Roll4 bottom top right right

EFX_EFFECT_ROLL4_B_T_R_T	Roll4 bottom top right top

EFX_EFFECT_ROLL4_B_T_R_B	Roll4 bottom top right bottom

EFX_EFFECT_ROLL4_B_T_T_L	Roll4 bottom top top left

EFX_EFFECT_ROLL4_B_T_T_R	Roll4 bottom top top right

EFX_EFFECT_ROLL4_B_T_T_T	Roll4 bottom top top top

EFX_EFFECT_ROLL4_B_T_T_B	Roll4 bottom top top bottom

EFX_EFFECT_ROLL4_B_T_B_L	Roll4 bottom top bottom left

EFX_EFFECT_ROLL4_B_T_B_R	Roll4 bottom top bottom right

EFX_EFFECT_ROLL4_B_T_B_T	Roll4 bottom top bottom top

EFX_EFFECT_ROLL4_B_T_B_B	Roll4 bottom top bottom bottom

EFX_EFFECT_ROLL4_B_B_L_L	Roll4 bottom bottom left left

EFX_EFFECT_ROLL4_B_B_L_R	Roll4 bottom bottom left right

EFX_EFFECT_ROLL4_B_B_L_T	Roll4 bottom bottom left top

EFX_EFFECT_ROLL4_B_B_L_B	Roll4 bottom bottom left bottom

EFX_EFFECT_ROLL4_B_B_R_L	Roll4 bottom bottom right left

EFX_EFFECT_ROLL4_B_B_R_R	Roll4 bottom bottom right right

EFX_EFFECT_ROLL4_B_B_R_T	Roll4 bottom bottom right top

EFX_EFFECT_ROLL4_B_B_R_B	Roll4 bottom bottom right bottom

EFX_EFFECT_ROLL4_B_B_T_L	Roll4 bottom bottom top left

EFX_EFFECT_ROLL4_B_B_T_R	Roll4 bottom bottom top right

EFX_EFFECT_ROLL4_B_B_T_T	Roll4 bottom bottom top top

EFX_EFFECT_ROLL4_B_B_T_B	Roll4 bottom bottom top bottom

EFX_EFFECT_ROLL4_B_B_B_L	Roll4 bottom bottom bottom left

EFX_EFFECT_ROLL4_B_B_B_R	Roll4 bottom bottom bottom right

EFX_EFFECT_ROLL4_B_B_B_T	Roll4 bottom bottom bottom top

EFX_EFFECT_ROLL4_B_B_B_B	Roll4 bottom bottom bottom bottom

EFX_EFFECT_ROLL_MAX	Number of effects in this class.

Rotate class

EFX_EFFECT_ROTATE_L_TO_R	Rotate left to right

EFX_EFFECT_ROTATE_R_TO_L	Rotate right to left

EFX_EFFECT_ROTATE_T_TO_B	Rotate top to bottom

EFX_EFFECT_ROTATE_B_TO_T	Rotate bottom to top

EFX_EFFECT_ROTATE4_L_L_L_L	Rotate4 left left left left

EFX_EFFECT_ROTATE4_L_L_L_R	Rotate4 left left left right

EFX_EFFECT_ROTATE4_L_L_L_T	Rotate4 left left left top

EFX_EFFECT_ROTATE4_L_L_L_B	Rotate4 left left left bottom

EFX_EFFECT_ROTATE4_L_L_R_L	Rotate4 left left right left

EFX_EFFECT_ROTATE4_L_L_R_R	Rotate4 left left right right

EFX_EFFECT_ROTATE4_L_L_R_T	Rotate4 left left right top

EFX_EFFECT_ROTATE4_L_L_R_B	Rotate4 left left right bottom

EFX_EFFECT_ROTATE4_L_L_T_L	Rotate4 left left top left

EFX_EFFECT_ROTATE4_L_L_T_R	Rotate4 left left top right

EFX_EFFECT_ROTATE4_L_L_T_T	Rotate4 left left top top

EFX_EFFECT_ROTATE4_L_L_T_B	Rotate4 left left top bottom

EFX_EFFECT_ROTATE4_L_L_B_L	Rotate4 left left bottom left

EFX_EFFECT_ROTATE4_L_L_B_R	Rotate4 left left bottom right

EFX_EFFECT_ROTATE4_L_L_B_T	Rotate4 left left bottom top

EFX_EFFECT_ROTATE4_L_L_B_B	Rotate4 left left bottom bottom

EFX_EFFECT_ROTATE4_L_R_L_L	Rotate4 left right left left

EFX_EFFECT_ROTATE4_L_R_L_R	Rotate4 left right left right

EFX_EFFECT_ROTATE4_L_R_L_T	Rotate4 left right left top

EFX_EFFECT_ROTATE4_L_R_L_B	Rotate4 left right left bottom

EFX_EFFECT_ROTATE4_L_R_R_L	Rotate4 left right right left

EFX_EFFECT_ROTATE4_L_R_R_R	Rotate4 left right right right

EFX_EFFECT_ROTATE4_L_R_R_T	Rotate4 left right right top

EFX_EFFECT_ROTATE4_L_R_R_B	Rotate4 left right right bottom

EFX_EFFECT_ROTATE4_L_R_T_L	Rotate4 left right top left

EFX_EFFECT_ROTATE4_L_R_T_R	Rotate4 left right top right

EFX_EFFECT_ROTATE4_L_R_T_T	Rotate4 left right top top

EFX_EFFECT_ROTATE4_L_R_T_B	Rotate4 left right top bottom

EFX_EFFECT_ROTATE4_L_R_B_L	Rotate4 left right bottom left

EFX_EFFECT_ROTATE4_L_R_B_R	Rotate4 left right bottom right

EFX_EFFECT_ROTATE4_L_R_B_T	Rotate4 left right bottom top

EFX_EFFECT_ROTATE4_L_R_B_B	Rotate4 left right bottom bottom

EFX_EFFECT_ROTATE4_L_T_L_L	Rotate4 left top left left

EFX_EFFECT_ROTATE4_L_T_L_R	Rotate4 left top left right

EFX_EFFECT_ROTATE4_L_T_L_T	Rotate4 left top left top

EFX_EFFECT_ROTATE4_L_T_L_B	Rotate4 left top left bottom

EFX_EFFECT_ROTATE4_L_T_R_L	Rotate4 left top right left

EFX_EFFECT_ROTATE4_L_T_R_R	Rotate4 left top right right

EFX_EFFECT_ROTATE4_L_T_R_T	Rotate4 left top right top

EFX_EFFECT_ROTATE4_L_T_R_B	Rotate4 left top right bottom

EFX_EFFECT_ROTATE4_L_T_T_L	Rotate4 left top top left

EFX_EFFECT_ROTATE4_L_T_T_R	Rotate4 left top top right

EFX_EFFECT_ROTATE4_L_T_T_T	Rotate4 left top top top

EFX_EFFECT_ROTATE4_L_T_T_B	Rotate4 left top top bottom

EFX_EFFECT_ROTATE4_L_T_B_L	Rotate4 left top bottom left

EFX_EFFECT_ROTATE4_L_T_B_R	Rotate4 left top bottom right

EFX_EFFECT_ROTATE4_L_T_B_T	Rotate4 left top bottom top

EFX_EFFECT_ROTATE4_L_T_B_B	Rotate4 left top bottom bottom

EFX_EFFECT_ROTATE4_L_B_L_L	Rotate4 left bottom left left

EFX_EFFECT_ROTATE4_L_B_L_R	Rotate4 left bottom left right

EFX_EFFECT_ROTATE4_L_B_L_T	Rotate4 left bottom left top

EFX_EFFECT_ROTATE4_L_B_L_B	Rotate4 left bottom left bottom

EFX_EFFECT_ROTATE4_L_B_R_L	Rotate4 left bottom right left

EFX_EFFECT_ROTATE4_L_B_R_R	Rotate4 left bottom right right

EFX_EFFECT_ROTATE4_L_B_R_T	Rotate4 left bottom right top

EFX_EFFECT_ROTATE4_L_B_R_B	Rotate4 left bottom right bottom

EFX_EFFECT_ROTATE4_L_B_T_L	Rotate4 left bottom top left

EFX_EFFECT_ROTATE4_L_B_T_R	Rotate4 left bottom top right

EFX_EFFECT_ROTATE4_L_B_T_T	Rotate4 left bottom top top

EFX_EFFECT_ROTATE4_L_B_T_B	Rotate4 left bottom top bottom

EFX_EFFECT_ROTATE4_L_B_B_L	Rotate4 left bottom bottom left

EFX_EFFECT_ROTATE4_L_B_B_R	Rotate4 left bottom bottom right

EFX_EFFECT_ROTATE4_L_B_B_T	Rotate4 left bottom bottom top

EFX_EFFECT_ROTATE4_L_B_B_B	Rotate4 left bottom bottom bottom

EFX_EFFECT_ROTATE4_R_L_L_L	Rotate4 right left left left

EFX_EFFECT_ROTATE4_R_L_L_R	Rotate4 right left left right

EFX_EFFECT_ROTATE4_R_L_L_T	Rotate4 right left left top

EFX_EFFECT_ROTATE4_R_L_L_B	Rotate4 right left left bottom

EFX_EFFECT_ROTATE4_R_L_R_L	Rotate4 right left right left

EFX_EFFECT_ROTATE4_R_L_R_R	Rotate4 right left right right

EFX_EFFECT_ROTATE4_R_L_R_T	Rotate4 right left right top

EFX_EFFECT_ROTATE4_R_L_R_B	Rotate4 right left right bottom

EFX_EFFECT_ROTATE4_R_L_T_L	Rotate4 right left top left

EFX_EFFECT_ROTATE4_R_L_T_R	Rotate4 right left top right

EFX_EFFECT_ROTATE4_R_L_T_T	Rotate4 right left top top

EFX_EFFECT_ROTATE4_R_L_T_B	Rotate4 right left top bottom

EFX_EFFECT_ROTATE4_R_L_B_L	Rotate4 right left bottom left

EFX_EFFECT_ROTATE4_R_L_B_R	Rotate4 right left bottom right

EFX_EFFECT_ROTATE4_R_L_B_T	Rotate4 right left bottom top

EFX_EFFECT_ROTATE4_R_L_B_B	Rotate4 right left bottom bottom

EFX_EFFECT_ROTATE4_R_R_L_L	Rotate4 right right left left

EFX_EFFECT_ROTATE4_R_R_L_R	Rotate4 right right left right

EFX_EFFECT_ROTATE4_R_R_L_T	Rotate4 right right left top

EFX_EFFECT_ROTATE4_R_R_L_B	Rotate4 right right left bottom

EFX_EFFECT_ROTATE4_R_R_R_L	Rotate4 right right right left

EFX_EFFECT_ROTATE4_R_R_R_R	Rotate4 right right right right

EFX_EFFECT_ROTATE4_R_R_R_T	Rotate4 right right right top

EFX_EFFECT_ROTATE4_R_R_R_B	Rotate4 right right right bottom

EFX_EFFECT_ROTATE4_R_R_T_L	Rotate4 right right top left

EFX_EFFECT_ROTATE4_R_R_T_R	Rotate4 right right top right

EFX_EFFECT_ROTATE4_R_R_T_T	Rotate4 right right top top

EFX_EFFECT_ROTATE4_R_R_T_B	Rotate4 right right top bottom

EFX_EFFECT_ROTATE4_R_R_B_L	Rotate4 right right bottom left

EFX_EFFECT_ROTATE4_R_R_B_R	Rotate4 right right bottom right

EFX_EFFECT_ROTATE4_R_R_B_T	Rotate4 right right bottom top

EFX_EFFECT_ROTATE4_R_R_B_B	Rotate4 right right bottom bottom

EFX_EFFECT_ROTATE4_R_T_L_L	Rotate4 right top left left

EFX_EFFECT_ROTATE4_R_T_L_R	Rotate4 right top left right

EFX_EFFECT_ROTATE4_R_T_L_T	Rotate4 right top left top

EFX_EFFECT_ROTATE4_R_T_L_B	Rotate4 right top left bottom

EFX_EFFECT_ROTATE4_R_T_R_L	Rotate4 right top right left

EFX_EFFECT_ROTATE4_R_T_R_R	Rotate4 right top right right

EFX_EFFECT_ROTATE4_R_T_R_T	Rotate4 right top right top

EFX_EFFECT_ROTATE4_R_T_R_B	Rotate4 right top right bottom

EFX_EFFECT_ROTATE4_R_T_T_L	Rotate4 right top top left

EFX_EFFECT_ROTATE4_R_T_T_R	Rotate4 right top top right

EFX_EFFECT_ROTATE4_R_T_T_T	Rotate4 right top top top

EFX_EFFECT_ROTATE4_R_T_T_B	Rotate4 right top top bottom

EFX_EFFECT_ROTATE4_R_T_B_L	Rotate4 right top bottom left

EFX_EFFECT_ROTATE4_R_T_B_R	Rotate4 right top bottom right

EFX_EFFECT_ROTATE4_R_T_B_T	Rotate4 right top bottom top

EFX_EFFECT_ROTATE4_R_T_B_B	Rotate4 right top bottom bottom

EFX_EFFECT_ROTATE4_R_B_L_L	Rotate4 right bottom left left

EFX_EFFECT_ROTATE4_R_B_L_R	Rotate4 right bottom left right

EFX_EFFECT_ROTATE4_R_B_L_T	Rotate4 right bottom left top

EFX_EFFECT_ROTATE4_R_B_L_B	Rotate4 right bottom left bottom

EFX_EFFECT_ROTATE4_R_B_R_L	Rotate4 right bottom right left

EFX_EFFECT_ROTATE4_R_B_R_R	Rotate4 right bottom right right

EFX_EFFECT_ROTATE4_R_B_R_T	Rotate4 right bottom right top

EFX_EFFECT_ROTATE4_R_B_R_B	Rotate4 right bottom right bottom

EFX_EFFECT_ROTATE4_R_B_T_L	Rotate4 right bottom top left

EFX_EFFECT_ROTATE4_R_B_T_R	Rotate4 right bottom top right

EFX_EFFECT_ROTATE4_R_B_T_T	Rotate4 right bottom top top

EFX_EFFECT_ROTATE4_R_B_T_B	Rotate4 right bottom top bottom

EFX_EFFECT_ROTATE4_R_B_B_L	Rotate4 right bottom bottom left

EFX_EFFECT_ROTATE4_R_B_B_R	Rotate4 right bottom bottom right

EFX_EFFECT_ROTATE4_R_B_B_T	Rotate4 right bottom bottom top

EFX_EFFECT_ROTATE4_R_B_B_B	Rotate4 right bottom bottom bottom

EFX_EFFECT_ROTATE4_T_L_L_L	Rotate4 top left left left

EFX_EFFECT_ROTATE4_T_L_L_R	Rotate4 top left left right

EFX_EFFECT_ROTATE4_T_L_L_T	Rotate4 top left left top

EFX_EFFECT_ROTATE4_T_L_L_B	Rotate4 top left left bottom

EFX_EFFECT_ROTATE4_T_L_R_L	Rotate4 top left right left

EFX_EFFECT_ROTATE4_T_L_R_R	Rotate4 top left right right

EFX_EFFECT_ROTATE4_T_L_R_T	Rotate4 top left right top

EFX_EFFECT_ROTATE4_T_L_R_B	Rotate4 top left right bottom

EFX_EFFECT_ROTATE4_T_L_T_L	Rotate4 top left top left

EFX_EFFECT_ROTATE4_T_L_T_R	Rotate4 top left top right

EFX_EFFECT_ROTATE4_T_L_T_T	Rotate4 top left top top

EFX_EFFECT_ROTATE4_T_L_T_B	Rotate4 top left top bottom

EFX_EFFECT_ROTATE4_T_L_B_L	Rotate4 top left bottom left

EFX_EFFECT_ROTATE4_T_L_B_R	Rotate4 top left bottom right

EFX_EFFECT_ROTATE4_T_L_B_T	Rotate4 top left bottom top

EFX_EFFECT_ROTATE4_T_L_B_B	Rotate4 top left bottom bottom

EFX_EFFECT_ROTATE4_T_R_L_L	Rotate4 top right left left

EFX_EFFECT_ROTATE4_T_R_L_R	Rotate4 top right left right

EFX_EFFECT_ROTATE4_T_R_L_T	Rotate4 top right left top

EFX_EFFECT_ROTATE4_T_R_L_B	Rotate4 top right left bottom

EFX_EFFECT_ROTATE4_T_R_R_L	Rotate4 top right right left

EFX_EFFECT_ROTATE4_T_R_R_R	Rotate4 top right right right

EFX_EFFECT_ROTATE4_T_R_R_T	Rotate4 top right right top

EFX_EFFECT_ROTATE4_T_R_R_B	Rotate4 top right right bottom

EFX_EFFECT_ROTATE4_T_R_T_L	Rotate4 top right top left

EFX_EFFECT_ROTATE4_T_R_T_R	Rotate4 top right top right

EFX_EFFECT_ROTATE4_T_R_T_T	Rotate4 top right top top

EFX_EFFECT_ROTATE4_T_R_T_B	Rotate4 top right top bottom

EFX_EFFECT_ROTATE4_T_R_B_L	Rotate4 top right bottom left

EFX_EFFECT_ROTATE4_T_R_B_R	Rotate4 top right bottom right

EFX_EFFECT_ROTATE4_T_R_B_T	Rotate4 top right bottom top

EFX_EFFECT_ROTATE4_T_R_B_B	Rotate4 top right bottom bottom

EFX_EFFECT_ROTATE4_T_T_L_L	Rotate4 top top left left

EFX_EFFECT_ROTATE4_T_T_L_R	Rotate4 top top left right

EFX_EFFECT_ROTATE4_T_T_L_T	Rotate4 top top left top

EFX_EFFECT_ROTATE4_T_T_L_B	Rotate4 top top left bottom

EFX_EFFECT_ROTATE4_T_T_R_L	Rotate4 top top right left

EFX_EFFECT_ROTATE4_T_T_R_R	Rotate4 top top right right

EFX_EFFECT_ROTATE4_T_T_R_T	Rotate4 top top right top

EFX_EFFECT_ROTATE4_T_T_R_B	Rotate4 top top right bottom

EFX_EFFECT_ROTATE4_T_T_T_L	Rotate4 top top top left

EFX_EFFECT_ROTATE4_T_T_T_R	Rotate4 top top top right

EFX_EFFECT_ROTATE4_T_T_T_T	Rotate4 top top top top

EFX_EFFECT_ROTATE4_T_T_T_B	Rotate4 top top top bottom

EFX_EFFECT_ROTATE4_T_T_B_L	Rotate4 top top bottom left

EFX_EFFECT_ROTATE4_T_T_B_R	Rotate4 top top bottom right

EFX_EFFECT_ROTATE4_T_T_B_T	Rotate4 top top bottom top

EFX_EFFECT_ROTATE4_T_T_B_B	Rotate4 top top bottom bottom

EFX_EFFECT_ROTATE4_T_B_L_L	Rotate4 top bottom left left

EFX_EFFECT_ROTATE4_T_B_L_R	Rotate4 top bottom left right

EFX_EFFECT_ROTATE4_T_B_L_T	Rotate4 top bottom left top

EFX_EFFECT_ROTATE4_T_B_L_B	Rotate4 top bottom left bottom

EFX_EFFECT_ROTATE4_T_B_R_L	Rotate4 top bottom right left

EFX_EFFECT_ROTATE4_T_B_R_R	Rotate4 top bottom right right

EFX_EFFECT_ROTATE4_T_B_R_T	Rotate4 top bottom right top

EFX_EFFECT_ROTATE4_T_B_R_B	Rotate4 top bottom right bottom

EFX_EFFECT_ROTATE4_T_B_T_L	Rotate4 top bottom top left

EFX_EFFECT_ROTATE4_T_B_T_R	Rotate4 top bottom top right

EFX_EFFECT_ROTATE4_T_B_T_T	Rotate4 top bottom top top

EFX_EFFECT_ROTATE4_T_B_T_B	Rotate4 top bottom top bottom

EFX_EFFECT_ROTATE4_T_B_B_L	Rotate4 top bottom bottom left

EFX_EFFECT_ROTATE4_T_B_B_R	Rotate4 top bottom bottom right

EFX_EFFECT_ROTATE4_T_B_B_T	Rotate4 top bottom bottom top

EFX_EFFECT_ROTATE4_T_B_B_B	Rotate4 top bottom bottom bottom

EFX_EFFECT_ROTATE4_B_L_L_L	Rotate4 bottom left left left

EFX_EFFECT_ROTATE4_B_L_L_R	Rotate4 bottom left left right

EFX_EFFECT_ROTATE4_B_L_L_T	Rotate4 bottom left left top

EFX_EFFECT_ROTATE4_B_L_L_B	Rotate4 bottom left left bottom

EFX_EFFECT_ROTATE4_B_L_R_L	Rotate4 bottom left right left

EFX_EFFECT_ROTATE4_B_L_R_R	Rotate4 bottom left right right

EFX_EFFECT_ROTATE4_B_L_R_T	Rotate4 bottom left right top

EFX_EFFECT_ROTATE4_B_L_R_B	Rotate4 bottom left right bottom

EFX_EFFECT_ROTATE4_B_L_T_L	Rotate4 bottom left top left

EFX_EFFECT_ROTATE4_B_L_T_R	Rotate4 bottom left top right

EFX_EFFECT_ROTATE4_B_L_T_T	Rotate4 bottom left top top

EFX_EFFECT_ROTATE4_B_L_T_B	Rotate4 bottom left top bottom

EFX_EFFECT_ROTATE4_B_L_B_L	Rotate4 bottom left bottom left

EFX_EFFECT_ROTATE4_B_L_B_R	Rotate4 bottom left bottom right

EFX_EFFECT_ROTATE4_B_L_B_T	Rotate4 bottom left bottom top

EFX_EFFECT_ROTATE4_B_L_B_B	Rotate4 bottom left bottom bottom

EFX_EFFECT_ROTATE4_B_R_L_L	Rotate4 bottom right left left

EFX_EFFECT_ROTATE4_B_R_L_R	Rotate4 bottom right left right

EFX_EFFECT_ROTATE4_B_R_L_T	Rotate4 bottom right left top

EFX_EFFECT_ROTATE4_B_R_L_B	Rotate4 bottom right left bottom

EFX_EFFECT_ROTATE4_B_R_R_L	Rotate4 bottom right right left

EFX_EFFECT_ROTATE4_B_R_R_R	Rotate4 bottom right right right

EFX_EFFECT_ROTATE4_B_R_R_T	Rotate4 bottom right right top

EFX_EFFECT_ROTATE4_B_R_R_B	Rotate4 bottom right right bottom

EFX_EFFECT_ROTATE4_B_R_T_L	Rotate4 bottom right top left

EFX_EFFECT_ROTATE4_B_R_T_R	Rotate4 bottom right top right

EFX_EFFECT_ROTATE4_B_R_T_T	Rotate4 bottom right top top

EFX_EFFECT_ROTATE4_B_R_T_B	Rotate4 bottom right top bottom

EFX_EFFECT_ROTATE4_B_R_B_L	Rotate4 bottom right bottom left

EFX_EFFECT_ROTATE4_B_R_B_R	Rotate4 bottom right bottom right

EFX_EFFECT_ROTATE4_B_R_B_T	Rotate4 bottom right bottom top

EFX_EFFECT_ROTATE4_B_R_B_B	Rotate4 bottom right bottom bottom

EFX_EFFECT_ROTATE4_B_T_L_L	Rotate4 bottom top left left

EFX_EFFECT_ROTATE4_B_T_L_R	Rotate4 bottom top left right

EFX_EFFECT_ROTATE4_B_T_L_T	Rotate4 bottom top left top

EFX_EFFECT_ROTATE4_B_T_L_B	Rotate4 bottom top left bottom

EFX_EFFECT_ROTATE4_B_T_R_L	Rotate4 bottom top right left

EFX_EFFECT_ROTATE4_B_T_R_R	Rotate4 bottom top right right

EFX_EFFECT_ROTATE4_B_T_R_T	Rotate4 bottom top right top

EFX_EFFECT_ROTATE4_B_T_R_B	Rotate4 bottom top right bottom

EFX_EFFECT_ROTATE4_B_T_T_L	Rotate4 bottom top top left

EFX_EFFECT_ROTATE4_B_T_T_R	Rotate4 bottom top top right

EFX_EFFECT_ROTATE4_B_T_T_T	Rotate4 bottom top top top

EFX_EFFECT_ROTATE4_B_T_T_B	Rotate4 bottom top top bottom

EFX_EFFECT_ROTATE4_B_T_B_L	Rotate4 bottom top bottom left

EFX_EFFECT_ROTATE4_B_T_B_R	Rotate4 bottom top bottom right

EFX_EFFECT_ROTATE4_B_T_B_T	Rotate4 bottom top bottom top

EFX_EFFECT_ROTATE4_B_T_B_B	Rotate4 bottom top bottom bottom

EFX_EFFECT_ROTATE4_B_B_L_L	Rotate4 bottom bottom left left

EFX_EFFECT_ROTATE4_B_B_L_R	Rotate4 bottom bottom left right

EFX_EFFECT_ROTATE4_B_B_L_T	Rotate4 bottom bottom left top

EFX_EFFECT_ROTATE4_B_B_L_B	Rotate4 bottom bottom left bottom

EFX_EFFECT_ROTATE4_B_B_R_L	Rotate4 bottom bottom right left

EFX_EFFECT_ROTATE4_B_B_R_R	Rotate4 bottom bottom right right

EFX_EFFECT_ROTATE4_B_B_R_T	Rotate4 bottom bottom right top

EFX_EFFECT_ROTATE4_B_B_R_B	Rotate4 bottom bottom right bottom

EFX_EFFECT_ROTATE4_B_B_T_L	Rotate4 bottom bottom top left

EFX_EFFECT_ROTATE4_B_B_T_R	Rotate4 bottom bottom top right

EFX_EFFECT_ROTATE4_B_B_T_T	Rotate4 bottom bottom top top

EFX_EFFECT_ROTATE4_B_B_T_B	Rotate4 bottom bottom top bottom

EFX_EFFECT_ROTATE4_B_B_B_L	Rotate4 bottom bottom bottom left

EFX_EFFECT_ROTATE4_B_B_B_R	Rotate4 bottom bottom bottom right

EFX_EFFECT_ROTATE4_B_B_B_T	Rotate4 bottom bottom bottom top

EFX_EFFECT_ROTATE4_B_B_B_B	Rotate4 bottom bottom bottom bottom

EFX_EFFECT_ROTATE_MAX	Number of effects in this class.

Zoom class

EFX_EFFECT_ZOOM_TO_C	Zoom to center

EFX_EFFECT_ZOOM_FROM_C	Zoom from center

EFX_EFFECT_ZOOM_MAX	Number of effects in this class.

Drip class

EFX_EFFECT_DRIP_T_TO_B	Drip top to bottom

EFX_EFFECT_DRIP_B_TO_T	Drip bottom to top

EFX_EFFECT_DRIP_L_TO_R	Drip left to right

EFX_EFFECT_DRIP_R_TO_L	Drip right to left

EFX_EFFECT_DRIP_MAX	Number of effects in this class.

Blind class

EFX_EFFECT_BLIND_T_TO_B	Blind top to bottom

EFX_EFFECT_BLIND_L_TO_R	Blind left to right

EFX_EFFECT_BLIND_GROWING_L_TO_R	Blind growing left to right

EFX_EFFECT_BLIND_GROWING_R_TO_L	Blind growing right to left

EFX_EFFECT_BLIND_GROWING_T_TO_B	Blind growing top to bottom

EFX_EFFECT_BLIND_GROWING_B_TO_T	Blind growing bottom to top

EFX_EFFECT_BLIND2_T_TO_B_AND_L_TO_R	Blind2 top to bottom and left to right

EFX_EFFECT_BLIND_MAX	Number of effects in this class.

Random class

EFX_EFFECT_RANDOM_BARS_R_TO_L	Random bars right to left

EFX_EFFECT_RANDOM_BARS_L_TO_R	Random bars left to right

EFX_EFFECT_RANDOM_BARS_B_TO_T	Random bars bottom to top

EFX_EFFECT_RANDOM_BARS_T_TO_B	Random bars top to bottom

EFX_EFFECT_RANDOM_LINES	Random lines

EFX_EFFECT_RANDOM_BLOCKS	Random blocks

EFX_EFFECT_RANDOM_BLOCKS_R_TO_L	Random blocks right to left

EFX_EFFECT_RANDOM_BLOCKS_L_TO_R	Random blocks left to right

EFX_EFFECT_RANDOM_BLOCKS_B_TO_T	Random blocks bottom to top

EFX_EFFECT_RANDOM_BLOCKS_T_TO_B	Random blocks top to bottom

EFX_EFFECT_RANDOM_MAX	Number of effects in this class.

Checkerboard class

EFX_EFFECT_CHECKERBOARD_T_TO_B_THEN_T_TO_B	Checkerboard top to bottom then top to bottom

EFX_EFFECT_CHECKERBOARD_B_TO_T_THEN_B_TO_T	Checkerboard bottom to top then bottom to top

EFX_EFFECT_CHECKERBOARD_L_TO_R_THEN_L_TO_R	Checkerboard left to right then left to right

EFX_EFFECT_CHECKERBOARD_R_TO_L_THEN_R_TO_L	Checkerboard right to left then right to left

EFX_EFFECT_CHECKERBOARD_T_TO_B_THEN_B_TO_T	Checkerboard top to bottom then bottom to top

EFX_EFFECT_CHECKERBOARD_B_TO_T_THEN_T_TO_B	Checkerboard bottom to top then top to bottom

EFX_EFFECT_CHECKERBOARD_L_TO_R_THEN_R_TO_L	Checkerboard left to right then right to left

EFX_EFFECT_CHECKERBOARD_R_TO_L_THEN_L_TO_R	Checkerboard right to left then left to right

EFX_EFFECT_CHECKERBOARD_MAX	Number of effects in this class.

Blocks class

EFX_EFFECT_BLOCKS_T_TO_B	Blocks top to bottom

EFX_EFFECT_BLOCKS_B_TO_T	Blocks bottom to top

EFX_EFFECT_BLOCKS_L_TO_R	Blocks left to right

EFX_EFFECT_BLOCKS_R_TO_L	Blocks right to left

EFX_EFFECT_BLOCKS_SWIRL_CW_TO_C	Blocks swirl CW to center

EFX_EFFECT_BLOCKS_SWIRL_CW_FROM_C	Blocks swirl CW from center

EFX_EFFECT_BLOCKS_SWIRL_CCW_TO_C	Blocks swirl CCW to center

EFX_EFFECT_BLOCKS_SWIRL_CCW_FROM_C	Blocks swirl CCW from center

EFX_EFFECT_BLOCKS_MAX	Number of effects in this class.

Circle class

EFX_EFFECT_CIRCLE_C_IN	Circle center in

EFX_EFFECT_CIRCLE_C_OUT	Circle center out

EFX_EFFECT_CIRCLE_L_IN	Circle left in

EFX_EFFECT_CIRCLE_L_OUT	Circle left out

EFX_EFFECT_CIRCLE_R_IN	Circle right in

EFX_EFFECT_CIRCLE_R_OUT	Circle right out

EFX_EFFECT_CIRCLE_T_IN	Circle top in

EFX_EFFECT_CIRCLE_T_OUT	Circle top out

EFX_EFFECT_CIRCLE_B_IN	Circle bottom in

EFX_EFFECT_CIRCLE_B_OUT	Circle bottom out

EFX_EFFECT_CIRCLE_C_INTER_IN_THEN_IN	Circle center interlace in then in

EFX_EFFECT_CIRCLE_C_INTER_OUT_THEN_OUT	Circle center interlace out then out

EFX_EFFECT_CIRCLE_C_INTER_IN_THEN_OUT	Circle center interlace in then out

EFX_EFFECT_CIRCLE_C_INTER_OUT_THEN_IN	Circle center interlace out then in

EFX_EFFECT_CIRCLE_L_INTER_IN_THEN_IN	Circle left interlace in then in

EFX_EFFECT_CIRCLE_L_INTER_OUT_THEN_OUT	Circle left interlace out then out

EFX_EFFECT_CIRCLE_L_INTER_IN_THEN_OUT	Circle left interlace in then out

EFX_EFFECT_CIRCLE_L_INTER_OUT_THEN_IN	Circle left interlace out then in

EFX_EFFECT_CIRCLE_R_INTER_IN_THEN_IN	Circle right interlace in then in

EFX_EFFECT_CIRCLE_R_INTER_OUT_THEN_OUT	Circle right interlace out then out

EFX_EFFECT_CIRCLE_R_INTER_IN_THEN_OUT	Circle right interlace in then out

EFX_EFFECT_CIRCLE_R_INTER_OUT_THEN_IN	Circle right interlace out then in

EFX_EFFECT_CIRCLE_T_INTER_IN_THEN_IN	Circle top interlace in then in

EFX_EFFECT_CIRCLE_T_INTER_OUT_THEN_OUT	Circle top interlace out then out

EFX_EFFECT_CIRCLE_T_INTER_IN_THEN_OUT	Circle top interlace in then out

EFX_EFFECT_CIRCLE_T_INTER_OUT_THEN_IN	Circle top interlace out then in

EFX_EFFECT_CIRCLE_B_INTER_IN_THEN_IN	Circle bottom interlace in then in

EFX_EFFECT_CIRCLE_B_INTER_OUT_THEN_OUT	Circle bottom interlace out then out

EFX_EFFECT_CIRCLE_B_INTER_IN_THEN_OUT	Circle bottom interlace in then out

EFX_EFFECT_CIRCLE_B_INTER_OUT_THEN_IN	Circle bottom interlace out then in

EFX_EFFECT_CIRCLE_L_R_INTER	Circle left right interlace

EFX_EFFECT_CIRCLE_T_B_INTER	Circle top bottom interlace

EFX_EFFECT_CIRCLE2_L_R_OUT	Circle2 left right out

EFX_EFFECT_CIRCLE2_L_R_IN	Circle2 left right in

EFX_EFFECT_CIRCLE2_T_B_OUT	Circle2 top bottom out

EFX_EFFECT_CIRCLE2_T_B_IN	Circle2 top bottom in

EFX_EFFECT_CIRCLE_MAX	Number of effects in this class.

Ellipse class

EFX_EFFECT_ELLIPSE_C_IN	Ellipse center in

EFX_EFFECT_ELLIPSE_C_OUT	Ellipse center out

EFX_EFFECT_ELLIPSE_L_IN	Ellipse left in

EFX_EFFECT_ELLIPSE_L_OUT	Ellipse left out

EFX_EFFECT_ELLIPSE_R_IN	Ellipse right in

EFX_EFFECT_ELLIPSE_R_OUT	Ellipse right out

EFX_EFFECT_ELLIPSE_T_IN	Ellipse top in

EFX_EFFECT_ELLIPSE_T_OUT	Ellipse top out

EFX_EFFECT_ELLIPSE_B_IN	Ellipse bottom in

EFX_EFFECT_ELLIPSE_B_OUT	Ellipse bottom out

EFX_EFFECT_ELLIPSE_C_INTER_IN_THEN_IN	Ellipse center interlace in then in

EFX_EFFECT_ELLIPSE_C_INTER_OUT_THEN_OUT	Ellipse center interlace out then out

EFX_EFFECT_ELLIPSE_C_INTER_IN_THEN_OUT	Ellipse center interlace in then out

EFX_EFFECT_ELLIPSE_C_INTER_OUT_THEN_IN	Ellipse center interlace out then in

EFX_EFFECT_ELLIPSE_L_INTER_IN_THEN_IN	Ellipse left interlace in then in

EFX_EFFECT_ELLIPSE_L_INTER_OUT_THEN_OUT	Ellipse left interlace out then out

EFX_EFFECT_ELLIPSE_L_INTER_IN_THEN_OUT	Ellipse left interlace in then out

EFX_EFFECT_ELLIPSE_L_INTER_OUT_THEN_IN	Ellipse left interlace out then in

EFX_EFFECT_ELLIPSE_R_INTER_IN_THEN_IN	Ellipse right interlace in then in

EFX_EFFECT_ELLIPSE_R_INTER_OUT_THEN_OUT	Ellipse right interlace out then out

EFX_EFFECT_ELLIPSE_R_INTER_IN_THEN_OUT	Ellipse right interlace in then out

EFX_EFFECT_ELLIPSE_R_INTER_OUT_THEN_IN	Ellipse right interlace out then in

EFX_EFFECT_ELLIPSE_T_INTER_IN_THEN_IN	Ellipse top interlace in then in

EFX_EFFECT_ELLIPSE_T_INTER_OUT_THEN_OUT	Ellipse top interlace out then out

EFX_EFFECT_ELLIPSE_T_INTER_IN_THEN_OUT	Ellipse top interlace in then out

EFX_EFFECT_ELLIPSE_T_INTER_OUT_THEN_IN	Ellipse top interlace out then in

EFX_EFFECT_ELLIPSE_B_INTER_IN_THEN_IN	Ellipse bottom interlace in then in

EFX_EFFECT_ELLIPSE_B_INTER_OUT_THEN_OUT	Ellipse bottom interlace out then out

EFX_EFFECT_ELLIPSE_B_INTER_IN_THEN_OUT	Ellipse bottom interlace in then out

EFX_EFFECT_ELLIPSE_B_INTER_OUT_THEN_IN	Ellipse bottom interlace out then in

EFX_EFFECT_ELLIPSE_L_R_INTER	Ellipse left right interlace

EFX_EFFECT_ELLIPSE_T_B_INTER	Ellipse top bottom interlace

EFX_EFFECT_ELLIPSE2_L_R_OUT	Ellipse2 left right out

EFX_EFFECT_ELLIPSE2_L_R_IN	Ellipse2 left right in

EFX_EFFECT_ELLIPSE2_T_B_OUT	Ellipse2 top bottom out

EFX_EFFECT_ELLIPSE2_T_B_IN	Ellipse2 top bottom in

EFX_EFFECT_ELLIPSE_MAX	Number of effects in this class.


Shapes

The following values may be used for the DrawShape method.

Value	Meaning

Rectangle class

EFX_SHAPE_RECTANGLE	Rectangle

EFX_SHAPE_RECTANGLE_ROUNDED	Rounded rectangle

EFX_SHAPE_RECTANGLE_MAX	Number of shapes in this class.

Square class

EFX_SHAPE_SQUARE	Square

EFX_SHAPE_SQUARE_ROUNDED	Rounded square

EFX_SHAPE_SQUARE_MAX	Number of shapes in this class.

Parallelogram class

EFX_SHAPE_PARALLELOGRAM_L	Parallelogram left

EFX_SHAPE_PARALLELOGRAM_R	Parallelogram right

EFX_SHAPE_PARALLELOGRAM_T	Parallelogram top

EFX_SHAPE_PARALLELOGRAM_B	Parallelogram bottom

EFX_SHAPE_PARALLELOGRAM_MAX	Number of shapes in this class.

Trapezoid class

EFX_SHAPE_TRAPEZOID_L	Trapezoid left

EFX_SHAPE_TRAPEZOID_R	Trapezoid right

EFX_SHAPE_TRAPEZOID_T	Trapezoid top

EFX_SHAPE_TRAPEZOID_B	Trapezoid bottom

EFX_SHAPE_TRAPEZOID_MAX	Number of shapes in this class.

Circle class

EFX_SHAPE_CIRCLE	Circle

EFX_SHAPE_CIRCLE_90_LT	Circle 90° left-top

EFX_SHAPE_CIRCLE_90_LB	Circle 90° left-bottom

EFX_SHAPE_CIRCLE_90_RT	Circle 90° right-top

EFX_SHAPE_CIRCLE_90_RB	Circle 90° right-bottom

EFX_SHAPE_CIRCLE_180_L	Circle 180° left

EFX_SHAPE_CIRCLE_180_R	Circle 180° right

EFX_SHAPE_CIRCLE_180_T	Circle 180° top

EFX_SHAPE_CIRCLE_180_B	Circle 180° bottom

EFX_SHAPE_CIRCLE_270_LT	Circle 270° left-top

EFX_SHAPE_CIRCLE_270_LB	Circle 270° left-bottom

EFX_SHAPE_CIRCLE_270_RT	Circle 270° right-top

EFX_SHAPE_CIRCLE_270_RB	Circle 270° right-bottom

EFX_SHAPE_CIRCLE_MAX	Number of shapes in this class.

Ellipse class

EFX_SHAPE_ELLIPSE	Ellipse

EFX_SHAPE_ELLIPSE_90_LT	Ellipse 90° left-top

EFX_SHAPE_ELLIPSE_90_LB	Ellipse 90° left-bottom

EFX_SHAPE_ELLIPSE_90_RT	Ellipse 90° right-top

EFX_SHAPE_ELLIPSE_90_RB	Ellipse 90° right-bottom

EFX_SHAPE_ELLIPSE_180_L	Ellipse 180° left

EFX_SHAPE_ELLIPSE_180_R	Ellipse 180° right

EFX_SHAPE_ELLIPSE_180_T	Ellipse 180° top

EFX_SHAPE_ELLIPSE_180_B	Ellipse 180° bottom

EFX_SHAPE_ELLIPSE_270_LT	Ellipse 270° left-top

EFX_SHAPE_ELLIPSE_270_LB	Ellipse 270° left-bottom

EFX_SHAPE_ELLIPSE_270_RT	Ellipse 270° right-top

EFX_SHAPE_ELLIPSE_270_RB	Ellipse 270° right-bottom

EFX_SHAPE_ELLIPSE_MAX	Number of shapes in this class.

Triangle class

EFX_SHAPE_TRIANGLE_EQUILATERAL_L	Equilateral triangle left

EFX_SHAPE_TRIANGLE_EQUILATERAL_R	Equilateral triangle right

EFX_SHAPE_TRIANGLE_EQUILATERAL_T	Equilateral triangle top

EFX_SHAPE_TRIANGLE_EQUILATERAL_B	Equilateral triangle bottom

EFX_SHAPE_TRIANGLE_ISOSCELES_L	Isosceles triangle left

EFX_SHAPE_TRIANGLE_ISOSCELES_R	Isosceles triangle right

EFX_SHAPE_TRIANGLE_ISOSCELES_T	Isosceles triangle top

EFX_SHAPE_TRIANGLE_ISOSCELES_B	Isosceles triangle bottom

EFX_SHAPE_TRIANGLE_RIGHT_LT	Right triangle left-top

EFX_SHAPE_TRIANGLE_RIGHT_LB	Right triangle left-bottom

EFX_SHAPE_TRIANGLE_RIGHT_RT	Right triangle right-top

EFX_SHAPE_TRIANGLE_RIGHT_RB	Right triangle right-bottom

EFX_SHAPE_TRIANGLE_MAX	Number of shapes in this class.

Other polygons class

EFX_SHAPE_OCTAGON	Octagon

EFX_SHAPE_DIAMOND	Diamond

EFX_SHAPE_PENTAGON	Pentagon

EFX_SHAPE_HEXAGON	Hexagon

EFX_SHAPE_LINE	Line

EFX_SHAPE_REGION	Region

EFX_SHAPE_OTHER_MAX	Number of shapes in this class.

Star class

EFX_SHAPE_STAR4	Star 4 points

EFX_SHAPE_STAR5	Star 5 points

EFX_SHAPE_STAR8	Star 8 points

EFX_SHAPE_STAR16	Star 16 points

EFX_SHAPE_STAR24	Star 24 points

EFX_SHAPE_STAR32	Star 36 points

EFX_SHAPE_STAR_MAX	Number of shapes in this class.

Cross class

EFX_SHAPE_CROSS_SMALL	Cross small

EFX_SHAPE_CROSS_MEDIUM	Cross medium

EFX_SHAPE_CROSS_LARGE	Cross large

EFX_SHAPE_CROSS_MAX	Number of shapes in this class.

Arrow class

EFX_SHAPE_ARROW_L	Arrow left

EFX_SHAPE_ARROW_R	Arrow right

EFX_SHAPE_ARROW_T	Arrow top

EFX_SHAPE_ARROW_B	Arrow bottom

EFX_SHAPE_ARROW2_L_AND_R	Arrow2 left and right

EFX_SHAPE_ARROW2_T_AND_B	Arrow2 top and bottom

EFX_SHAPE_ARROW2_L_AND_T	Arrow2 left and top

EFX_SHAPE_ARROW2_L_AND_B	Arrow2 left and bottom

EFX_SHAPE_ARROW2_R_AND_T	Arrow2 right and top

EFX_SHAPE_ARROW2_R_AND_B	Arrow2 right and bottom

EFX_SHAPE_ARROW3_L_AND_T_AND_R	Arrow3 left and top and right

EFX_SHAPE_ARROW3_T_AND_R_AND_B	Arrow3 top and right and bottom

EFX_SHAPE_ARROW3_L_AND_B_AND_R	Arrow3 left and bottom and right

EFX_SHAPE_ARROW3_L_AND_T_AND_B	Arrow3 left and top and bottom

EFX_SHAPE_ARROW4_L_AND_T_AND_R_AND_B	Arrow4 left and top and right and bottom

EFX_SHAPE_ARROW_MAX	Number of shapes in this class.


Gradients

The following values may be used for the GradientStyle property.

Value	Meaning

Linear gradient class

EFX_GRADIENT_LINE_L_TO_R	Line left to right

EFX_GRADIENT_LINE_R_TO_L	Line right to left

EFX_GRADIENT_LINE_T_TO_B	Line top to bottom

EFX_GRADIENT_LINE_B_TO_T	Line bottom to top

EFX_GRADIENT_LINE_LT_TO_RB	Line left-top to right-bottom

EFX_GRADIENT_LINE_LB_TO_RT	Line left-bottom to right-top

EFX_GRADIENT_LINE_RT_TO_LB	Line right-top to left-bottom

EFX_GRADIENT_LINE_RB_TO_LT	Line right-bottom to left-top

EFX_GRADIENT_LINE2_L_AND_R_TO_C	Line2 left and right to center

EFX_GRADIENT_LINE2_C_TO_L_AND_R	Line2 center to left and right

EFX_GRADIENT_LINE2_T_AND_B_TO_C	Line2 top and bottom to center

EFX_GRADIENT_LINE2_C_TO_T_AND_B	Line2 center to top and bottom

EFX_GRADIENT_LINE2_LT_AND_RB_TO_C	Line2 left-top and right-bottom to center

EFX_GRADIENT_LINE2_C_TO_LT_AND_RB	Line2 center to left-top and right-bottom

EFX_GRADIENT_LINE2_RT_AND_LB_TO_C	Line2 right-top and left-bottom to center

EFX_GRADIENT_LINE2_C_TO_RT_AND_LB	Line2 center to right-top and left-bottom

EFX_GRADIENT_LINE_MAX	Number of gradients in this class.

Angular gradient class

EFX_GRADIENT_ANGLE_TO_LT	Angle to left-top

EFX_GRADIENT_ANGLE_TO_LB	Angle to left-bottom

EFX_GRADIENT_ANGLE_TO_RT	Angle to right-top

EFX_GRADIENT_ANGLE_TO_RB	Angle to right-bottom

EFX_GRADIENT_ANGLE_FROM_LT	Angle from left-top

EFX_GRADIENT_ANGLE_FROM_LB	Angle from left-bottom

EFX_GRADIENT_ANGLE_FROM_RT	Angle from right-top

EFX_GRADIENT_ANGLE_FROM_RB	Angle from right-bottom

EFX_GRADIENT_ANGLE_MAX	Number of gradients in this class.

Rectangular gradient class

EFX_GRADIENT_RECTANGLE_TO_C	Rectangle to center

EFX_GRADIENT_RECTANGLE_FROM_C	Rectangle from center

EFX_GRADIENT_RECTANGLE_MAX	Number of gradients in this class.

Elliptical gradient class

EFX_GRADIENT_ELLIPSE_TO_C	Ellipse to center

EFX_GRADIENT_ELLIPSE_FROM_C	Ellipse from center

EFX_GRADIENT_ELLIPSE_MAX	Number of gradients in this class.

Conical gradient class

EFX_GRADIENT_CONE_FROM_L	Cone from left

EFX_GRADIENT_CONE_FROM_R	Cone from right

EFX_GRADIENT_CONE_FROM_T	Cone from top

EFX_GRADIENT_CONE_FROM_B	Cone from bottom

EFX_GRADIENT_CONE_FROM_LT	Cone from left-top

EFX_GRADIENT_CONE_FROM_LB	Cone from left-bottom

EFX_GRADIENT_CONE_FROM_RT	Cone from right-top

EFX_GRADIENT_CONE_FROM_RB	Cone from right-bottom

EFX_GRADIENT_CONE_MAX	Number of gradients in this class.


BackStyle

The following values may be used for the ShapeBackStyle property (Common Dialog) and the ShapeBackgroundStyle property (Main Control).

Value	Meaning

EFX_BACKSTYLE_TRANSPARENT	Transparent

EFX_BACKSTYLE_OPAQUE	Opaque

EFX_BACKSTYLE_TRANSLUCENT	Translucent

EFX_BACKSTYLE_TILED_IMAGE	Tiled image

EFX_BACKSTYLE_TRANSLUCENT_TILED_IMAGE	Translucent tiled image

EFX_BACKSTYLE_GRADIENT	Gradient color

EFX_BACKSTYLE_TRANSLUCENT_GRADIENT	Translucent gradient color

EFX_BACKSTYLE_MAX	The last background style (for use in a loop counter)


BorderStyles

The following values may be used for the ShapeBorderStyle property (Common Dialog) and the ShapeBorderStyle property (Main Control).

Value	Meaning

EFX_BORDERSTYLE_TRANSPARENT	Transparent

EFX_BORDERSTYLE_SOLID	Solid line

EFX_BORDERSTYLE_DASH	Dash line (valid only for 1-pixel lines)

EFX_BORDERSTYLE_DOT	Dot line (valid only for 1-pixel lines)

EFX_BORDERSTYLE_DASHDOT	Dash dot line (valid only for 1-pixel lines)

EFX_BORDERSTYLE_DASHDOTDOT	Dash dot dot line (valid only for 1-pixel lines)

EFX_BORDERSTYLE_MAX	Dash dot dot line (valid only for 1-pixel lines)


PatternStyles

The following values may be used for the ShapeFillStyle property (Common Dialog).

Value	Meaning

EFX_PATTERN_SOLID	Solid filling

EFX_PATTERN_TRANSPARENT	Transparent filling (not valid for transitions)

EFX_PATTERN_HORZ_LINE	Horizontal lines (==)

EFX_PATTERN_VERT_LINE	Vertical lines (||)

EFX_PATTERN_DOWNWARD_DIAG	Downward diagonal lines (//)

EFX_PATTERN_UPWARD_DIAG	Upward diagonal lines (\\)

EFX_PATTERN_CROSS	Cross line (++)

EFX_PATTERN_DIAG_CROSS	Diagonal cross lines (XX)

EFX_PATTERN_MAX	The last pattern (for use in a loop counter).


ShapeInnerStyles

The following values may be used for the ShapeInnerStyle property (Common Dialog) and the ShapeInnerBandStyle property (Main Control).

Value	Meaning

EFX_SHAPE_INNERSTYLE_NONE	No inner band

EFX_SHAPE_INNERSTYLE_INSET	Inner band inset

EFX_SHAPE_INNERSTYLE_RAISED	Inner band raised


ShapeOuterStyles

The following values may be used for the ShapeOuterStyle property (Common Dialog) and the ShapeOuterBandStyle property (Main Control).

Value	Meaning

EFX_SHAPE_OUTERSTYLE_NONE	No outer band

EFX_SHAPE_OUTERSTYLE_INSET	Outer band inset

EFX_SHAPE_OUTERSTYLE_RAISED	Outer band raised


TextAlign Effects

The following values may be used for the TextAlign property (Common Dialog) and the TextAlign property (Main Control).

Value	Meaning

EFX_TEXTALIGN_LEFT_TOP	Left, top

EFX_TEXTALIGN_LEFT_VCENTER	Left, vertical center

EFX_TEXTALIGN_LEFT_BOTTOM	Left, bottom

EFX_TEXTALIGN_HCENTER_TOP	Top, horizontal center

EFX_TEXTALIGN_HCENTER_VCENTER	Vertical and horizontal center

EFX_TEXTALIGN_HCENTER_BOTTOM	Bottom, horizontal center

EFX_TEXTALIGN_RIGHT_TOP	Right, top

EFX_TEXTALIGN_RIGHT_VCENTER	Right, vertical center

EFX_TEXTALIGN_RIGHT_BOTTOM	Right, bottom

EFX_TEXTALIGN_MAX	Right, bottom


TextStyle Effects

The following values may be used for the TextStyle property (Common Dialog) and the TextStyle property (Main Control).

Value	Meaning

EFX_TEXTSTYLE_NORMAL	No three-dimensional effect

EFX_TEXTSTYLE_INSETLIGHT	Inset light text

EFX_TEXTSTYLE_INSETEXTRALIGHT	Inset extra light text

EFX_TEXTSTYLE_INSETHEAVY	Inset heavy text

EFX_TEXTSTYLE_INSETEXTRAHEAVY	Inset extra heavy text

EFX_TEXTSTYLE_RAISEDLIGHT	Raised light text

EFX_TEXTSTYLE_RAISEDEXTRALIGHT	Raised extra light text

EFX_TEXTSTYLE_RAISEDHEAVY	Raised heavy text

EXF_TEXTSTYLE_RAISEDEXTRAHEAVY	Raised extra heavy text

EFX_TEXTSTYLE_DROPSHADOW	Drop shadow text

EFX_TEXTSTYLE_BLOCKSHADOW	Block shadow text

EFX_TEXTSTYLE_OUTLINEBLOCK	Outline block text


Example Programs

Note:	You can run some of the example programs on your system by clicking the appropriate buttons in online help. An error message will appear if you try to run an example program that is not on your system, or if you try to run a Delphi example without Delphi on your system.

The executable files for these examples were compiled with Document/Medical capabilities of the toolkit. To get Document/Medical capabilities, you must buy a LEADTOOLS Document/Medical toolkit. Otherwise, if you recompile the examples, the resulting executable files will not have the Document/Medical capabilities.

Internet

 EXAMPLES\OCX\INTERNET contains sample HTML files that use Java and VB Script to demonstrate the net-aware capabilities of the ActiveX.

Visual Basic

 EXAMPLES\OCX\VB\DEMO32 contains a sample application that demonstrates most of the ActiveX capabilities in Visual Basic 5.0. To run the 32-bit sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.

 EXAMPLES\OCX\VB\ANNOT32 contains a sample application that demonstrates the annotation capabilities. To run the 32-bit sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.

 EXAMPLES\OCX\VB\BIND32 contains a sample database application implemented using data binding. For WIN32 systems, this example references the IMAGES\LEADPIC.MDB database. To run the 32-bit sample application, you can run the EXE file in LEAD's BIN directory, specifying the correct database as a command-line argument.
Click here [image] to run the WIN32 version of this example.

 EXAMPLES\OCX\VB\ANNB32 contains a sample annotation application implemented using data binding. To run the 32-bit sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.

 EXAMPLES\OCX\VB\DB32 contains sample project code for an ODBC database example in Visual Basic 5.0. To use the DB demo, you must first do the following:

1.	Specify an ODBC data source named LEADACCESS that references the IMAGES\LEADPIC.MDB database. For instructions on specifying an ODBC data source, refer to Using ODBC.

2.	Open the project in Visual Basic and modify the Dpeople data control's DatabaseName property to reference the IMAGES\LEADPIC.MDB database.

 EXAMPLES\OCX\VB\OLEDB contains sample project code for an OLEDB database example in Visual Basic 6.0. To use the OLEDB demo, you must first do the following:

1.	Specify an ODBC data source named LEADACCESS that references the IMAGES\LEADPIC.MDB database. For instructions on specifying an ODBC data source, refer to Using ODBC.

2.	Open the project in Visual Basic and modify the Dpeople data control's ConnectString property to reference the LEADACCESS DSN.

 EXAMPLES\OCX\VB\DRAW32 uses the LEADTOOLS ActiveX to load an image, to demonstrate graphics functions, and to save the modified image. To run the 32-bit sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.

 EXAMPLES\OCX\VB\FX32 demonstrates the LEADTOOLS special effects, including paint effects, transitions, three-dimensional text, and three-dimensional shapes. To run the 32-bit sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.

 EXAMPLES\OCX\VB\MAG32 uses two LEAD controls. The first control displays the unmagnified image. The second control, when enabled, can be dragged across the first one to magnify the covered portion of the image. To run the 32-bit sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.

Visual C++ 4.0

 EXAMPLES\OCX\MFC40\DEMO contains sample project code for Visual C++ 4.0. You can open the project in Visual C++; then compile and run it.
Click here [image] to run the WIN32 version of this example.

 EXAMPLES\OCX\MFC40\ANNOTATE demonstrates the LEADTOOLS annotation capabilities. To run the sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.

 EXAMPLES\OCX\MFC40\DB contains sample project code for a database example in Visual C++ 4.0. To use the DB demo, you must first do the following:

1.	Specify an ODBC data source named LEADACCESS that references the IMAGES\LEADPIC.MDB database. For instructions on specifying an ODBC data source, refer to Using ODBC.

2.	Open the project in Visual C++ and modify the GetDefaultDBName function to reference the IMAGES\LEADPIC.MDB database.

 EXAMPLES\OCX\MFC60\OLEDB contains sample project code for an OLEDB database example in MFC 6.0. To use the OLEDB demo, you must first do the following:

1.	Specify an ODBC data source named LEADACCESS that references the IMAGES\LEADPIC.MDB database. For instructions on specifying an ODBC data source, refer to Using ODBC.

2.	Open the project in MSVC and modify the ADODC1 data control's ConnectString property to reference the LEADACCESS DSN.

 EXAMPLES\OCX\MFC40\DRAW uses the LEADTOOLS ActiveX to load an image, to demonstrate graphics functions, and to save the modified image. To run the sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.

 EXAMPLES\OCX\MFC40\FXDEMO demonstrates the LEADTOOLS special effects, including paint effects, transitions, three-dimensional text, and three-dimensional shapes. To run the sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.

 EXAMPLES\OCX\MFC40\MAGNIFY uses two LEAD controls. The first control displays the unmagnified image. The second control, when enabled, can be dragged across the first one to magnify the covered portion of the image. To run the sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.

Visual FoxPro

 EXAMPLES\OCX\FOX contains sample project code for Visual FoxPro 3.0. To run the sample application from FoxPro, use the Program > Do option, and select the \EXAMPLES\OCX\FOX\DEMO.APP application.

To implement the database capabilities in the DEMO.APP application, specify the current (\FOX) directory as an ODBC data source as described in Using ODBC. Then when you run the application, use the File > Open Database option to open the ODBC data source.

Access 95 and 97

Note:  These are Access 95 examples, which you can convert to Access 97. In the database example, the maximize button is disabled because of problems with the SetMenuItem method in Access 97.

 EXAMPLES\OCX\ACCESS7\DEMO contains sample project code for Microsoft Access 95. To run the sample application from Access, open the sample database, then open the MAIN form. To avoid ODBC setup issues, this demo does not add images to a database.

 EXAMPLES\OCX\ACCESS7\DB contains sample project code for a database example in Access 95. To use the DB demo, you must do the following:

1.	Specify an ODBC data source named LEADACCESS that references the IMAGES\LEADPIC.MDB database. For instructions on specifying an ODBC data source, refer to Using ODBC.

2.	Open the project in Access 95 and modify Query1 to reference the IMAGES\LEADPIC.MDB database.

3.	Run the sample application from Access by opening the MAIN form.


LEADTOOLS API Integration Functions

The LEADTOOLS ActiveX is sold either as a stand-alone product or as an addition to the LEADTOOLS API for C programmers. The API not only provides the ActiveX, but also lets you access structures and functions in the LEADTOOLS DLLs.

L_OCXADD.BAS, which is distributed with the LEADTOOLS API, contains the LEAD structure definitions and function prototypes for the LEAD DLLs in Visual Basic format. In addition to the normal DLL functions, the LEADTOOLS ActiveX Add-On provides the following functions for reading and writing the LEAD control's bitmap:

32-bit	Declare Function L_GetControlBitmap Lib "LTOCX14N.OCX" (Ctrl As Object, hBitmap As LEADBitmapHandle) As Long

This function copies the image in the LEAD control to a LEAD BitmapHandle. The LEAD BitmapHandle can be released after this copy if it is not required. The function returns TRUE or ERROR CODE.

32-bit	Declare Function L_SetControlBitmap Lib "LTOCX14N.OCX" (Ctrl As Object, hBitmap As LEADBitmapHandle) As Long

This function sets the LEAD control with the image referenced by the LEAD BitmapHandle. The LEAD BitmapHandle can be freed after this copy if it is not required. The function returns TRUE or ERROR CODE.


Specifying Only the Destination Rectangles

The following illustrates how you can scale the displayed image by accepting the default source rectangle and specifying only the destination rectangles. (To paint the whole image, you must set the clipping rectangle to the same values as the destination rectangle.)


Specifying Both the Source and Destination Rectangles

The following illustrates how you can specify a part of the bitmap as the source rectangle. Then, the source rectangle (rather than the whole bitmap) is scaled and displayed.


Specifying the Source Clipping Rectangle

The following illustrates how you can specify a source clipping rectangle to limit the part of the source rectangle that gets painted. Usually, you do not need to specify a source clipping rectangle. However, this feature can be useful in sophisticated applications that treat the bitmap as both a display surface and a display source.


Specifying the Destination Clipping Rectangle

The following illustrates how you can specify a destination clipping rectangle to limit the part of the destination rectangle that gets painted. (Keep in mind that if you want the whole destination rectangle to paint, you must update the clipping area to match it.)


Types of File Comments

Some file formats can contain comments, and some cannot, and each file format has its own set of comment types. For applicable comment types, refer to the following:

DICOM File Comments

Exif File Comments

GIF File Comments

IPTC Comments

JPEG, J2K and LEAD File Comments

PNG File Comments

TIFF File Comments


TIFF File Comments

When reading or updating TIFF comments, you must specify the comment type using the following constants.

For a loop counter:

Value	Meaning

CMNT_LAST	Last defined number for comments. To get all comments, you can use the comment type constant as a loop counter. The first constant is 0 and the last is CMNT_LAST.

For TIFF files: Each comment field can contain a character string. The maximum field size is 32K, except for the date-time field, which is always 20.

Please note that LEADTOOLS also supports IPTC Comments, which can be saved inside TIFF files. For more information, refer to IPTC Comments.

Value	Meaning

CMNT_SZARTIST	Person who created the image.

CMNT_SZCOPYRIGHT	Copyright notice.

CMNT_SZDATETIME	Date and time (YYYY:MM:DD HH:MM:SS). The field length is 20, counting the NULL terminator.

CMNT_SZDESC	Description of the image.

CMNT_SZHOSTCOMP	Computer and operating system in use.

CMNT_SZMAKE	Manufacturer of the equipment used to create the image.

CMNT_SZMODEL	Model name and number of the equipment.

CMNT_SZNAMEOFDOC	Name of the document from which the image was scanned.

CMNT_SZNAMEOFPAGE	Page name from which the image was scanned.

CMNT_SZSOFTWARE	Name and version of the software package used to create the image.


GIF File Comments

When reading or updating GIF comments, you can specify only one type of comment.

Value	Meaning

CMNT_SZDESC	Description of the image. This a variable-length character string. The maximum length is 32K.


IPTC Comments

The IPTC-NAA comments are standardized by the International Press Telecommunications Council in collaboration with Newspaper Association of America. More information about these comments can be found on IPTC’s web site  (http://www.iptc.org). Many comments have to follow a particular format, so refer to the IPTC documentation to make sure you are writing valid comments.

LEADTOOLS will verify that the size of the comment is within the limits specified by the standard. Comments with invalid length will NOT be written in the file. LEADTOOLS will NOT verify the contents of the data (it will not verify that the numerical comments contain only digits, etc.).

Some of these comments are repeatable (ie you can have more than one comment of this type). To write two or more values for a repeatable comment, concatenate the comments using the IPTC_SEPARATOR as the separator. IPTC_SEPARATOR has an Ascii code of 1 and cannot appear in any comment, so there is not a possibility of confusion about this character is the separator or part of the comment. Do not confuse this with the character ‘1’, whose Ascii code is 49!

When reading a repeatable comment with more than one value, LEADTOOLS will concatenate all the values and use the IPTC_SEPARATOR to separate the values. Therefore, when a comment that might be repeatable is retrieved, it is best to search for the separator.

CMNT_IPTC_KEYWORDS is the best example of a comment that is repeatable. If the file has three keywords (keyword1, keyword2 and keyword3), they will be returned as the following string:

"keyword1\001keyword2\001keyword3".

Every IPTC comment is identified by x:y, where x is the Record number and y is the DataSet number. For example, CMNT_IPTC_KEYWORDS is identified as 2:15. We will list the corresponding "x:y" identifier for every comment supported in LEADTOOLS, together with the length limits.

All the date comments use the format YYYYMMDD, so July 4, 2001 is "20010704".

All the time comments use the format HHMMSS±HHMM, following the ISO 8601 standard. The part after ± is the reference to the Universal Time Format. For example, 3PM Eastern USA time is "150000-0500".

Please note that the IPTC_SEPARATOR is not a comment, it is only a define used for the separator!

IPTC_SEPARATOR                                ‘\001’ A separator used for repeatable comments.

IPTC comments can be saved inside TIFF and JPEG files.

Value	Meaning

CMNT_IPTC_FIRST	[181] The first IPTC comment To get all IPTC comments, use the comment type constant as a loop counter. The first constant is CMNT_IPTC_FIRST and the last is CMNT_IPTC_ LAST.

CMNT_IPTC_LAST	[226] The last IPTC comment

CMNT_IPTC_VERSION	[181] 2:0, the version of IPTC comments (read-only). Non-repeatable, (min=2 bytes, max=2). This is the only comment that is binary. The first byte is the lower version number (usually 0) and the second byte is the high version number (the current version is 4 - binary 4, not ascii ‘4’). LEADTOOLS writes 4 here.

CMNT_IPTC_OBJECTTYPEREFERENCE	[182] 2:3, Object type reference. Non repeatable. Length = 3..67.

CMNT_IPTC_OBJECTATTRIBUTEREFERENCE	[183] 2:4, Object Attribute Reference. Repeatable. Length = 4..68.

CMNT_IPTC_OBJECTNAME	[184] 2:5, Object name. Non repeatable. Length = 1..64.

CMNT_IPTC_EDITSTATUS	[185] 2:7, Edit status. Non repeatable. Length = 1..64.

CMNT_IPTC_EDITORIALUPDATE	[186] 2:8, Editorial update. Non repeatable. Length = 2..2.

CMNT_IPTC_URGENCY	[187] 2:10, Urgency. Non repeatable. ‘1’ is most urgent, ‘5’ = Normal, ‘8’ is least urgent. Length = 1..1.

CMNT_IPTC_SUBJECTREFERENCE	[188] 2:12, Subject reference. Repeatable. Length = 13..236.

CMNT_IPTC_CATEGORY	[189] 2:15, Category. Non repeatable. Length = 1..3.

CMNT_IPTC_SUPPLEMENTALCATEGORY	[190] 2:20, Supplemental category. Repeatable. Length = 1..32.

CMNT_IPTC_FIXTUREIDENTIFIER	[191] 2:22, Fixture identifier. Non repeatable. Length = 1..32.

CMNT_IPTC_KEYWORDS	[192] 2:25, Keywords. Repeatable. Length = 1..64.

CMNT_IPTC_CONTENTLOCATIONCODE	[193] 2:26, Content location code. Repeatable. Length = 3..3.

CMNT_IPTC_CONTENTLOCATIONNAME	[194] 2:27, Content location name. Repeatable. Length = 1..64.

CMNT_IPTC_RELEASEDATE	[195] 2:30, Release date. Non repeatable. Length = 8..8.

CMNT_IPTC_RELEASETIME	[196] 2:35, Release time. Non repeatable. Length = 11..11.

CMNT_IPTC_EXPIRATIONDATE	[197] 2:37, Expiration date. Non repeatable. Length = 8..8.

CMNT_IPTC_EXPIRATIONTIME	[198] 2:38, Expiration time. Non repeatable. Length = 11..11.

CMNT_IPTC_SPECIALINSTRUCTIONS	[199] 2:40, Special instructions. Non repeatable. Length = 1..256.

CMNT_IPTC_ACTIONADVISED	[200] 2:42, Action advised. Non repeatable. Length = 2..2.

CMNT_IPTC_REFERENCESERVICE	[201] 2:45, Reference service. Repeatable. Length = 1..10.

CMNT_IPTC_REFERENCEDATE	[202] 2:47, Reference date. Repeatable. Length = 8..8.

CMNT_IPTC_REFERENCENUMBER	[203] 2:50, Reference number. Repeatable. Length = 8..8.

CMNT_IPTC_DATECREATED	[204] 2:55, Date created. Non repeatable. Length = 8..8.

CMNT_IPTC_TIMECREATED	[205] 2:60, Time created. Non repeatable. Length = 11..11.

CMNT_IPTC_DIGITALCREATIONDATE	[206] 2:62, Digital creation date. Non repeatable. Length = 8..8.

CMNT_IPTC_DIGITALCREATIONTIME	[207] 2:63, Digital creation time. Non repeatable. Length = 11..11.

CMNT_IPTC_ORIGINATINGPROGRAM	[208] 2:65, Originating program. Non repeatable. Length = 1..32.

CMNT_IPTC_PROGRAMVERSION	[209] 2:70, Program version. Non repeatable. Length = 1..10.

CMNT_IPTC_OBJECTCYCLE	[210] 2:75, Object cycle. Non repeatable. Length = 1..1.

CMNT_IPTC_BYLINE	[211] 2:80, By-line. Repeatable. Length = 1..32.

CMNT_IPTC_BYLINETITLE	[212] 2:85, By-line title. Repeatable. Length = 1..32.

CMNT_IPTC_CITY	[213] 2:90, City Non repeatable. Length = 1..32.

CMNT_IPTC_SUBLOCATION	[214] 2:92, Sub-location. Non repeatable. Length = 1..32.

CMNT_IPTC_PROVINCE_STATE	[215] 2:95, Province/State. Non repeatable. Length = 1..32.

CMNT_IPTC_PRIMARYLOCATIONCODE	[216] 2:100, Country/Primary location code. Non repeatable. Length = 3..3.

CMNT_IPTC_PRIMARYLOCATIONNAME	[217] 2:101, Country/Primary location name. Non repeatable. Length = 1..64.

CMNT_IPTC_ORIGINALTRANSMISSIONREFERENCE	[218] 2:103, Original transmission reference. Non repeatable. Length = 1..32.

CMNT_IPTC_HEADLINE	[219] 2:105, Headline. Non repeatable. Length = 1..256.

CMNT_IPTC_CREDIT	[220] 2:110, Credit. Non repeatable. Length = 1..32.

CMNT_IPTC_SOURCE	[221] 2:115, Source. Non repeatable. Length = 1..32.

CMNT_IPTC_COPYRIGHT	[222] 2:116, Copyright Notice. Non repeatable. Length = 1..128.

CMNT_IPTC_CONTACT	[223] 2:118, Contact. Repeatable. Length = 1..128.

CMNT_IPTC_CAPTION	[224] 2:120, Caption/Abstract. Non repeatable. Length = 1..2000.

CMNT_IPTC_AUTHOR	[225] 2:122, Writer/Editor. Repeatable. Length = 1..32.

CMNT_IPTC_LANGUAGEIDENTIFIER	[226] 2:135, Language identifier. Non repeatable. Length = 2..3.


PNG File Comments

PNG has MMX optimized code for load/save and supports comments as well. The following comments are supported:

Value	Meaning

CMNT_SZARTIST	[0] Person who created the image.

CMNT_SZCOPYRIGHT	[1] Copyright notice.

CMNT_SZDATETIME	[2] Date and time (YYYY:MM:DD HH:MM:SS). The field length is 20, counting the NULL terminator.

CMNT_SZDESC	[3] Description of the image.

CMNT_SZMAKE	[5] Manufacturer of the equipment used to create the image.

CMNT_SZTITLE	[175] Title of the image.

CMNT_SZSOFTWARE	[9] Name and version of software package used to create the image.

CMNT_SZDISCLAIMER	[176] String containing the disclaimer of the software used to create the image.

CMNT_SZWARNING	[177] Warning statement associated with the software that created the image.

CMNT_MISC	[178] Miscellaneous information.


Exif File Comments

When reading or updating Exif comments, you must specify the comment type using the following constants.

For a loop counter:

Value	Meaning

CMNT_LAST	Last defined number for comments. To get all comments, you can use the comment type constant as a loop counter. The first constant is 0 and the last is CMNT_LAST.

TIFF comments in Exif files: All Exif files (TIFF and JPG) can contain the following TIFF comments. Each TIFF comment field can contain a character string. The maximum field size is 32K, except for the date-time field, which is always 20.

Value	Meaning

CMNT_SZARTIST	Person who created the image.

CMNT_SZCOPYRIGHT	Copyright notice.

CMNT_SZDATETIME	Date and time (YYYY:MM:DD HH:MM:SS). The field length is 20, counting the NULL terminator.

CMNT_SZDESC	Description of the image.

CMNT_SZHOSTCOMP	Computer and operating system in use.

CMNT_SZMAKE	Manufacturer of the equipment used to create the image.

CMNT_SZMODEL	Model name and number of the equipment.

CMNT_SZNAMEOFDOC	Name of the document from which the image was scanned.

CMNT_SZNAMEOFPAGE	Page name from which the image was scanned.

CMNT_SZSOFTWARE	Name and version of software package used to create the image.

General Exif comments: Exif files can contain the following general comments. Each comment field is constrained by its Exif data type.

Value	Meaning

CMNT_EXIFVERSION	Exif version. LEADTOOLS always writes this value as 0100, meaning version 1. Data type: UNDEFINED. Length: 4.

CMNT_SZSUBSECTIME	Decimal extension for seconds that are specified in the CMNT_SZDATETIME field. Data type: ASCII. Length: variable.

CMNT_SZDATETIMEORIGINAL	Date and time the original image is captured. The format is YYYY:MM:DD HH:MM:SS. The time is in a 24-hour format, and a blank space is left between the date and the time. Data type: ASCII. Length: 20.

CMNT_SZSUBSECTIMEORIGINAL	Decimal extension for seconds that are specified in the CMNT_SZDATETIMEORIGINAL field. Data type: ASCII. Length: variable.

CMNT_SZDATETIMEDIGITIZED	Date and time the file is generated. If the file is generated directly, as with a digital camera, this is the same as the time the original image is captured. Data type: ASCII. Length: 20.

CMNT_SZSUBSECTIMEDIGITIZED	Decimal extension for seconds that are specified in the CMNT_SZDATETIMEDIGITIZED field. Data type: ASCII. Length: variable.

CMNT_SHUTTERSPEEDVALUE	Shutter speed. The unit of measure is APEX. Data type: SRATIONAL. Length: 1.

CMNT_APERTURE	Aperture value. This is the ratio of lens aperture for the focal length. The unit of measure is APEX. Data type: RATIONAL. Length: 1.

CMNT_BRIGHTNESS	Brightness value. Data type: SRATIONAL. Length: 1.

CMNT_EXPOSUREBIAS	Exposure bias. This is the value for correcting a biased exposure. The unit of measure is APEX. Data type: SRATIONAL. Length: 1.

CMNT_MAXAPERTURE	Minimum lens f-number. Data type: RATIONAL. Length: 1.

CMNT_SUBJECTDISTANCE	Distance from lens to subject (in meters). Data type: RATIONAL. Length: 1.

CMNT_METERINGMODE	Photometry mode. Possible values are
0 = Unidentified
1 = Average
2 = Center Weighted Average
3 = Spot
4 = MultiSpot
5 = Pattern
6 = Partial
255 = Others
Data type: SHORT. Length: 1.

CMNT_LIGHTSOURCE	Light source. Possible values are
0 = Unidentified
1 = Daylight
2 = Florescence light
3 = Tungsten Lamp
17 = Standard light source A
18 = Standard light source B
19 = Standard light source C
20 = D55
21 = D65
22 = D75
255 = Others
Data type: SHORT. Length: 1.

CMNT_FLASH	Flash On/Off. Possible values are 1 for on or 0 for off. Data type: SHORT. Length: 1.

CMNT_FOCALLENGTH	Focal length, measured in millimeters. Data type: RATIONAL. Length: 1.

CMNT_EXPOSURETIME	Exposure time, expressed as a fraction of a second. Data type: RATIONAL. Length: 1.

CMNT_FNUMBER	The actual lens F stop (ratio of lens aperture to focal length). Data type: RATIONAL. Length: 1.

CMNT_MAKERNOTE 	Maker note. Data type: UNDEFINED. The creator of the file determines the data format.

CMNT_USERCOMMENT	User comment. Data type: UNDEFINED. Length: variable. The first eight bytes specify the data format, and the remainder of the comment is in the specified format. The first eight bytes can be any of the following:
41 53 43 49 49 00 00 00 = ASCII
4A 49 53 00 00 00 00 00 = JIS (Japanese)
00 00 00 00 00 00 00 00 = Undefined

CMNT_SUPPORTEDFLASHPIXVERSION	Supported FlashPix version (Exif 2.0). LEADTOOLS always writes 0100 here. Data type: UNDEFINED. Length: 4

CMNT_COLORSPACE	Color space (Exif 2.0). Specifies whether the color is calibrated or not. LEADTOOLS always writes this value as 1. Data type: SHORT. Length: 1 Possible values are:
1 = sRGB (PC monitor conditions)
0xFFFF = Uncalibrated
Other = reserved

CMNT_EXPOSUREPROGRAM	Exposure program (Exif 2.0) The class of the program used by the camera to set exposure when the picture is taken. Data type: SHORT. Length = 1. Possible values are:
0 = Not defined
1 = Manual
2 = Aperture priority
4 = Shutter priority
5 = Creative program (biased toward depth of field)
6 = Action program (biased toward fast shutter speed)
7 = Portrait mode (for closeup photos with the background out of focus)
Other = reserved

CMNT_SZSPECTRALSENSITIVITY	Spectral sensitivity (Exif) - The spectral sensitivity of each channel of the camera used. It is an ASCII string compatible with the standard developed by the ASTM technical committee. Data type: ASCII. Length: any

CMNT_ISOSPEEDRATINGS	ISO speed ratings (Exif) - the ISO speed and the ISO Latitude of the camera or input device as specified in ISO 12232 Data type: SHORT. Length: any

CMNT_OPTOELECTRICCOEFFICIENT	Optoelectric coefficient (Exif) - Opto-Electric Conversion function specified in ISO 14524. OECF is the relationship between the camera optical input and the image values. Data type: UNDEFINED. Length: ANY. This is an array of m rows and n columns. For information on how it is recorded, refer to OECF.

CMNT_SZRELATEDSOUNDFILE	Related audio file (Exif) - the name of an audio file related to the image data. The name should be 8 ASCII chars + '.' + 3 chars for extension + NULL. Data type: ASCII. Length: 13.

CMNT_FLASHENERGY	Flash energy (Exif) - the strobe energy at the time the image iscaptured, as measured in Beam Candle Power Seconds (BPCS) Data type: RATIONAL. Length: 1

CMNT_SPATIALFREQUENCYRESPONSE	Spatial frequency response (Exif) - the camera or input device spatial frequency table and SFR values in the direction of image width, image height and diagonal direction, as specified in ISO 12233. Data type: UNDEFINED. Length: ANY  This is an array of m rows and n columns.For information on how this is recorded, refer to SFR.

CMNT_FOCALPLANEXRESOLUTION	Focal plane X Resolution (Exif) - the number of dots per inch on the camera focal plane in the image width (X) direction

CMNT_FOCALPLANEYRESOLUTION	Focal plane Y Resolution (Exif) - the number of dots per inch on the camera focal plane in the image height (Y) direction

CMNT_SUBJECTLOCATION	Subject location (Exif) - the location of the main subject in the scene. The first value is the X column number and the second is the Y row number. Data type: SHORT. Length: 2

CMNT_EXPOSUREINDEX	Exposure index (Exif) - the image sensor type on the camera or input device. Data type: SHORT. Length: 1

CMNT_SENSINGMETHOD	Sensing method (Exif) - the image sensor type on the camera or input device. Data type: SHORT. Length: 1 Possible values are:
1 = not defined
2 = one-chip color area sensor
3 = two-chip color area sensor
4 = three-chip color area sensor
5 = color sequential area sensor
7 = trilinear sensor
8 = color sequential sensor
other = reserved

CMNT_FILESOURCE	File source (Exif) - the image source. If a digital camera recorded the image, the value will always be 3, to indicate that the image was recorded on a digital camera. Data type: SHORT. Length: 1 Possible values are:
3 = image recorded on a DSC (Digital Still Camera)
other = reserved

CMNT_SCENETYPE	Scene type (Exif) - the type of scene. If a DSC recorded the image, this value will always be 1, indicating that the image was directly photographed. Data type: UNDEFINED. Length: 1 Possible values are:
1 = a directly photographed image
other = reserved

CMNT_CFAPATTERN	CFA Pattern (Exif) - the color filter array (CFA) geometric pattern of the image sensor when a one-chip color sensor was applied. It does not apply to any other sensing methods. Data type: UNDEFINED. Length: ANY This is an array m x n (horz x vertical), where the pattern is repeated every m pixels on the horizontal and n pixels on the vertical. For a table of the layout, refer to CFA.

CMNT_SUBJECTAREA	Location and area of the main subject in the overall scene. Data type: SHORT. Count: 2 (Location of the subject is given in X, Y coordinates), 3 (Area of the main subject is given as a circle, X, Y, D, where X and Y are the center coordinates and D is the diameter.) and 4 (Area of the main subject is given as a rectangle, X, Y, W, H, where X and Y are the center coordinates, W is the width or the rectangle and H is the height of the rectangle.).

CMNT_CUSTOMRENDERED	Use of special processing on image data, such as rendering geared toward output. When special processing is performed, the reader is expected to disable or minimize any further processing. Data type: SHORT; Count: 1; Possible Values: 0 (Normal process), 1 (Custom process), Other (Reserved). Default: 0;

CMNT_EXPOSUREMODE	Exposure mode set when the image was shot. In auto-bracketing mode the camera shoots a series of frames of the same scene at different exposure settings. Tag: 41986; Data type: SHORT; Count: 1; Possible values are: 0 (Auto exposure), 1 (Manual exposure), 2 (Auto-bracket), Other (Reserved); Default: none.

CMNT_WHITEBALANCE	White balance mode set when the image was shot. Data type: SHORT; Count: 1; Possible values are: 0 (Auto white balance), 1 (Manual white balance), Other (Reserved); Default: none.

CMNT_DIGITALZOOMRATIO	Digital zoom ratio set when the image was shot. If the numerator of the recorded value is 0, the digital zoom was not used. Data type: RATIONAL; Count: 1; Default: none.

CMNT_FOCALLENGTHIN35MMFILM	Equivalent focal length, assuming a 35mm film camera, in mm. A value of 0 means the focal length is unknown. Note that this comment is different from the CMNT_FOCALLENGTH comment. Data type: SHORT; Count: 1; Default: none.

CMNT_SCENECAPTURETYPE	Type of scene that was shot. It can also be used to record the mode in which the image was shot. Note that this differs from the CMNT_SCENETYPE comment. Data type: SHORT; Count: 1; Possible values are: 0 (Standard), 1 (Landscape), 2 (Portrait), 3 (Night scene), Other (Reserved); Default: 0.

CMNT_GAINCONTROL	Degree of overall image gain adjustment. Data type: SHORT; Count: 1; Possible values are: 0 (None), 1 (Low gain up), 2 (High gain up), 3 (Low gain down), 4 (High gain down), Other (Reserved); Default: none.

CMNT_CONTRAST	Direction of contrast processing applied by the camera when the image was shot. Data type: SHORT; Count: 1; Possible values are: 0 (Normal), 1 (Soft), 2 (Hard), Other (Reserved); Default: 0.

CMNT_SATURATION	Direction of saturation processing applied by the camera when the image was shot. Data type: SHORT; Count: 1; Possible values are: 0 (Normal), 1 (Low saturation), 2 (High saturation), Other (Reserved); Default: 0.

CMNT_SHARPNESS	Direction of sharpness processing applied by the camera when the image was shot. Data type: SHORT; Count: 1; Possible values are: 0 (Normal), 1 (Soft), 2 (Hard), Other (Reserved); Default: 0.

CMNT_DEVICESETTINGSDESCRIPTION	Information on the picture-taking conditions of a particular camera model. Used only to indicate the picture-taking conditions in the reader. Data type: UNDEFINED; Count: Any; The data is recorded in Unicode using SHORT fro the number of display rows and columns and UNDEFINED for the camera settings. The Unicode (UCS –2) string including Signature is NULL terminated. The specifics of the Unicode string are as given in ISO/IEC 10464-1. Default: none.

CMNT_SUBJECTDISTANCERANGE	Distance to the subject. Data type: SHORT; Count: 1; Possible values are: 0 (Unknown), 1 (Macro), 2 (Close view), 3 (Distant view), Other (Reserved); Default: none.

CMNT_SZIMAGEUNIQUEID	Identifier assigned uniquely to each image. It is recorded as an ASCII string equivalent to hexadecimal notation and 128-bit fixed length. Tag: 42016; Data type: ASCII; Count: 33; Default: none

Exif GPS comments. Exif files can contain the following GPS (Global Positioning System) comments:

Value	Meaning

CMNT_GPSVERSIONID	Version number of the GPS image file directory (IFD). The current version is 2.0.0.0. This comment must be included when any GPS comments are used. Unlike the CMNT_EXIFVERSION comment, this comment is written in bytes. A version written as 2.0.0.0 is actually 0x02000000 when coded. Data type: BYTE. Length: 4.

CMNT_GPSLATITUDEREF	North or south latitude. Possible values are "N" for north and "S" for south. Data type: ASCII. Length: 2.

CMNT_GPSLATITUDE	Latitude, expressed as three RATIONAL values. When expressed in degrees, minutes, and seconds, latitude is written as dd/1,mm/1,ss/1. If degrees and minutes are used as the units, and minutes are written with fractions to two decimal places, then latitude is expressed as dd/1,mmmm/100,0/1. Data type: RATIONAL. Length: 3.

CMNT_GPSLONGITUDEREF	East or west longitude. Possible values are "E" for east and "W" for west. Data type: ASCII. Length: 2.

CMNT_GPSLONGITUDE	The longitude, expressed as three RATIONAL values. When expressed in degrees, minutes and seconds, longitude is written as ddd/1,mm/1,ss/1. If degrees and minutes are used as the units, and minutes are written with fractions to two decimal places, then longitude is expressed as dd/1,mmmm/100,0/1. Data type: RATIONAL. Length: 3.

CMNT_GPSALTITUDEREF	Reference altitude. In the current version, sea level is used as the reference, which must be zero. The reference unit is meters. Data type: BYTE. Length: 1.

CMNT_GPSALTITUDE	Altitude, in meters, relative to the reference altitude. Data type: RATIONAL. Length: 1.

CMNT_GPSTIMESTAMP	Time stamp in UTC (Coordinated Universal Time) time. The time is expressed as three RATIONAL values, for hours, minutes, and seconds. Data type: RATIONAL. Length: 3.

CMNT_GPSSATELLITES	GPS satellites used for measurement. The coding format is not stipulated. This comment can be used to code information such as the number of satellites, the satellite number, the satellite's angle of elevation, its azimuth, and its SNR. If the GPS receiver cannot make a measurement, this comment is NULL. Data type: ASCII. Length: variable.

CMNT_GPSSTATUS	Status of the GPS receiver at when the image is recorded. Possible values are "A" when measurement in progress and "V" when measurement is interrupted. Data type: ASCII. Length: 2.

CMNT_GPSMEASUREMODE	GPS measurement mode. A value of "2" denotes two-dimensional measurement, and "3" denotes three-dimensional measurement. Data type: ASCII. Length: 2.

CMNT_GPSDOP	DOP (data precision) value. This comment is an HDOP value during two-dimensional measurement and a PDOP value during three-dimensional measurement. Data type: RATIONAL. Length: 1.

CMNT_GPSSPEEDREF	Unit for measuring speed. Possible values are "K" for kilometers, "M" for miles, and "N" for knots. Data type: ASCII. Length: 2.

CMNT_GPSSPEED	Speed of the GPS receiver. Data type: RATIONAL. Length: 1.

CMNT_GPSTRACKREF	Reference for direction of movement. Possible values are "T" for a true direction and "M" for a magnetic. Data type: ASCII. Length: 2

CMNT_GPSTRACK	Direction of GPS receiver movement. The range of values is 0.00 to 359.00. Data type: RATIONAL. Length: 1.

CMNT_GPSIMGDIRECTIONREF	Reference for the direction of photography in the recorded image. Possible values are "T" for a true direction and "M" for a magnetic. Data type: ASCII. Length: 2.

CMNT_GPSIMGDIRECTION	Direction of photography in the recorded image. The range of values is 0.00 to 359.00. Data type: RATIONAL. Length: 1.

CMNT_GPSMAPDATUM	Geodetic survey data used by the receiver. If the geodetic survey data is restricted to Japan, this tag value is "TOKYO" or "WGS-84". Data type: ASCII. Length: variable.

CMNT_GPSDESTLATITUDEREF	North or south latitude for the destination point. Possible values are "N" for north and "S" for south. Data type: ASCII. Length: 2.

CMNT_GPSDESTLATITUDE	Latitude of the destination point. The latitude is expressed as three RATIONAL values, indicating degrees, minutes and seconds. Data type: RATIONAL. Length: 3.

CMNT_GPSDESTLONGITUDERE	East or west longitude for the destination point. Possible values are "E" for east and "W" for west. Data type: ASCII. Length: 2.

CMNT_GPSDESTLONGITUDE	Longitude of the destination point. The longitude is expressed as three RATIONAL values, indicating degrees, minutes and seconds. Data type: RATIONAL. Length: 3.

CMNT_GPSDESTBEARINGREF	Reference for the bearing to the destination point. Possible values are "T" for a true direction and "M" for a magnetic. Data type: ASCII. Length: 2.

CMNT_GPSDESTBEARING	Bearing to the destination point. The range of values is 0.00 to 359.00. Data type: RATIONAL. Length: 1.

CMNT_GPSDESTDISTANCEREF	Unit for measuring distance to the destination point. Possible values are "K" for kilometers, "M" for miles, and "N" for nautical miles. Data type: ASCII. Length: 2.

CMNT_GPSDESTDISTANCE	Distance to the destination point. Data type: RATIONAL. Length: 1.

CMNT_GPSPROCESSINGMETHOD	Processing method. Data type: Byte. Length: Any.

CMNT_GPSAREAINFORMATION	Area. Data type: Byte. Length: Any.

CMNT_GPSDATESTAMP	Date. Data type: SZ. Length: 11.

CMNT_GPSDIFFERENTIAL	Differential. Data type: Short. Length: 1.


Notes on Exif Data Types

The Exif standard defines the following data types for comments. Usage is dependent of your development system. To see the usage, refer to the code example for your system.

Data type	Description

UNDEFINED	The data type is determined by the field.

SHORT	Integer.

LONG	Long integer.

ASCII	Character string.

BYTE	Array of bytes.

RATIONAL	An array of two unsigned long integers that express a fraction. The first value is the numerator, and the second is the denominator. (Visual Basic does not recognize unsigned long integers and will interpret large values, as negative values.)

SRATIONAL	An array of two signed long integers that express a fraction. The first value is the numerator, and the second is the denominator.

The length of a comment is based on the data type. For example, an SRATIONAL with a length of 3 is an array of 6 long integers.

When you set a comment that requires an array, the array can be zero-based or 1-based (where the first element has an index of 1). When you get a comment that is an array, it will always be zero-based (where the first element has an index of 0).

When you assign comments, the ActiveX does data type conversions for you. For example, if a comment is a RATIONAL with a length of 3, you can assign an array of six integers. If you assign an invalid value, the value is ignored.


JPEG, J2K and LEAD File Comments

You can save comments in JPEG files, J2K files and in progressive LEAD CMP files (but not in non-progressive CMP files). When reading or updating these comments, you can specify only one type of comment.

Please note that LEADTOOLS also supports IPTC Comments, which can be saved inside JPEG files. For more information, refer to IPTC Comments.

Value	Meaning

CMNT_SZDESC	[3] Description of the image. This a variable-length character string. The maximum length is 64K.

J2K Comments

CMNT_J2K_BINARY	[179] JPEG 2000 Binary comment

CMNT_J2K_LATIN	[180] JPEG 2000 Latin comment


DICOM File Comments

Note: This topic is for the Medical Imaging only.

When reading or updating DICOM file comments, you must specify the comment type using one of the following constants.

For a loop counter:

Value	Meaning

CMNT_LAST	Last defined number for comments. To get all comments, you can use the comment type constant as a loop counter. The first constant is 0 and the last is CMNT_LAST.

For DICOM comments:

Value	Meaning

CMNT_SZPATIENTNAME	Patient name.

CMNT_SZPATIENTID	Patient ID.

CMNT_SZPATIENTBIRTHDATE	Patient birth date.

CMNT_SZPATIENTSEX	Patient sex.

CMNT_SZSTUDYINSTANCE	Study instance ID.

CMNT_SZSTUDYDATE	Study date.

CMNT_SZSTUDYTIME	Study time.

CMNT_SZSTUDYREFERRINGPHYSICIAN	Referring physician.

CMNT_SZSERIESMODALITY	Series modality. This comment determines the type of DICOM file read, or the type of DICOM file to save.  It is a NULL terminated string consisting of two bytes.  For a list of possible values, refer to Modalities. If you set the comment to anything other than a value listed in Modalities, the DICOM filter will ignore the comment and write "OT" instead.

CMNT_SZSERIESID	Series ID.

CMNT_SZSERIESNUMBER	Series number.


Exif Examples

Exif example for Visual Basic

Exif example for Visual C++ 4.0


OCR Module
OCR Features

LEAD offers OCR features, as part of the LEADTOOLS Document Imaging Suite edition, that uses Xerox Textbridge technology. The OCR features allow you to perform optical character recognition and turn images into documents. Features include preset confidence and accuracy levels for controlling how sensitive the engine is to unrecognized text, artificial intelligence for improving recognition on documents of the same type, and built-in and user-defined lexicons for limiting the type of text to recognize within a particular zone. LEADTOOLS provides the ability to verify or correct text during, and (using LEAD's unique OCR editor) after recognition. LEAD's OCR editor ties the text being edited directly to the image, providing a visual reference to the original bitmap data. The OCR engine can perform Automatic area segmentation creating multi-layered zones, recognizing areas such as tables, rules, images and text. Or, you can manually designate up to 250 such zones. The OCR features support different fonts, sizes (5 to 72 point) and styles. Fax, dot matrix and halftones can be preprocessed to improve recognition results. The OCR Engine supports major European and Scandinavian languages (Danish, Dutch, Finnish, French, German, Italian, Norwegian,  Portuguese, Russian, Spanish, and Swedish) as well as English. Support for dialects such as US. English, French Canadian, Latin American Spanish, Swiss German, and Brazilian Portuguese is also provided.

Recognized text can be exported to more than 40 different formats, including MS Word, MS Excel, Dbase and WordPerfect. The LEADTOOLS OCR features contain superior OCR processing speeds, for use in form recognition and processing applications.


JPEG 2000 Plug In Support Instructions

To implement JPEG 2000 Plug In support, you must do the following:

1.	Find the JPEG 2000 Plug In key on the JPEG 2000 Plug In Certificate e-mailed to you.

2.	Use the JPEG 2000 Plug In keyword with the UnlockSupport method to implement JPEG 2000 Plug In support in your application.


PDF Plug in Support Instructions

To implement PDF Plug in support, you must do the following:

1.	Find the PDF Plug in key on the PDF Plug in Certificate e-mailed to you.

2.	Use the PDF Plug in keyword with the UnlockSupport method function to implement PDF Plug in support in your application.


OECF

Length(bytes)	Type	Meaning

2	SHORT	Columns = n

2	SHORT	Rows = m

Any	ASCII	first column item name (NULL terminated)

:	:	:

Any	ASCII	last column item name (NULL terminated)

8	SRATIONAL	OECF[0,0]

8	SRATIONAL	OECF[0, 1]

:	:	:

8	SRATIONAL	OECF[0,n-1]

:	:	:

8	SRATIONAL	OECF[m-1,0]

8	SRATIONAL	OECF[m-1,1]

:	:	:

8	SRATIONAL	OECF[m-1,n-1]

where OECF[i,j] is the OECF coefficient for row i, column j


SFR

Length(bytes)	Type	Meaning

2	SHORT	Columns = n

2	SHORT	Rows = m

Any	ASCII	first column item name (NULL terminated)

:	:	:

Any	ASCII	last column item name (NULL terminated)

8	RATIONAL	SFR[0, 0]

8	RATIONAL	SFR[0, 1]

:	:	:

8	RATIONAL	SFR[0, n-1]

:	:	:

8	RATIONAL	SFR[m-1, 0]

8	RATIONAL	SFR[m-1, 1]

:	:	:

8	RATIONAL	SFR[m-1,n-1]

where SFR[i,j] is the SFR coefficient for row i, column j


CFA

Length(bytes)	Type	Meaning

2	SHORT	Columns = n

2	SHORT	Rows = m

1	BYTE	CFA[0,0]

1	BYTE	CFA[0,1]

:	:	:

1	BYTE	CFA[0,n-1]

1	BYTE	CFA[1,0]

:	:	:

1	BYTE	CFA[1,n-1]

:	:	:

1	BYTE	CFA[m-1,n-1]

where CFA[i,j] is the color filter value for row i, col j and can have one of these values:

CFA value	Filter color

0	RED

1	GREEN

2	BLUE

3	CYAN

4	MAGENTA

5	YELLOW

6	WHITE


Modalities

Value	Meaning

CR	computed radiography

CT	computed tomography

DS	digital subtraction angiography

MR	magnetic resonance

NM	nuclear medicine

US	ultrasound

OT	other

AS	angioscopy

BI	biomagnetic imaging

CD	color flow doppler

CF	cinefluorography

CP	culposcopy

CS	cystoscopy

DD	duplex doppler

DF	digital fluoroscopy

DG	diaphanography

DM	digital microscopy

EC	echocardiography

ES	endoscopy

FA	fluorescein angiography

FS	fundoscopy

LP	laparoscopy

LS	laser surface scan

MA	magnetic resonance angiography

MS	magnetic resonance spectroscopy

PT	positron emission tomography

RG	radiographic imaging

ST	single photon emission computed tomography

TG	thermography

VF	videofluorography


LEADTOOLS Nag Message

If you obtained a royalty-free LEADTOOLS product, simply distribute the LTKRN DLL from the REDIST\NoNagLTKRN directory.

If you obtained a royalty LEADTOOLS product (Document/Medical), then you will see a nag Message when you run your application.  The LTKRN DLL that was installed into your system directory produces this message.  This LTKRN DLL has the Document/Medical features unlocked for you.  In order to remove the nag message, you must contact LEAD Technologies to obtain "keys" to unlock the specialized features in the "no-nag" LTKRN DLL, which is located in the REDIST\NoNagLTKRN directory.  When you distribute your application, you must distribute the LTKRN DLL from the REDIST\NoNagLTKRN directory, and must unlock the specialized features in your application.


Multipage File Formats

LEADTOOLS supports the following file formats, which support multi-page files. These formats are:

Animated Cursor	Animated Gif
CALS3	DCX
DICOM (Read Only)	FlashPix
FLC	GIF
IFF	IOCA/MODCA
PCX	PDF
Tiff(MPT)
For more information on loading a multi-page file, refer to Loading a Bitmap from a File.


Using the RTF Filter in Windows 98

In order for the RTF filter to function properly on a Windows98 machine:

Replace this DLL:	With this DLL:
riched20.dll version number: 5.30.23.1200 Description: Rich Text Edit Control, v3.0 size: 421 KB	riched20.dll version number: 5.30.23.1211 Description: Rich Text Edit Control, v3.0 size: 413 KB
And replace this DLL:	With this DLL:
riched32.dll version number: 5.1.330.0 Description: Windows 98 Rich Text Edit Control size: 200 KB	riched32.dll version number: 5.1.2600.0 Description: Wrapper DLL for Richedit 1.0 size: 4.0 KB


Tutorial for Visual Access 95 and 97 Programmers
Tutorial for Microsoft Access 95 and 97 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS ActiveX.

Note:	These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

These examples were developed with Access 95. Important differences in Access 97 are noted.

Loading and Displaying an Image

Zooming Out and Zooming In

Dynamically Positioning the Control

Zooming In on a Selection

Outlining, Dragging, and Pasting a Region

Creating and Using Annotations

Using ODBC to Access Image Data

Including Images in a Report

Writing and Reading Multipage Files

Using Transparent Controls

Drawing Simple Lines and Shapes

Cropping a Bitmap

Creating, Viewing, and Merging Color Separations

Updating a Gauge and Detecting a User Interrupt

Miscellaneous Examples


Loading and Displaying an Image (Access 95 and 97)

Take the following steps to start a project and to add some code that positions, scales, and displays an image on a form:

1.	Start Microsoft Access 95 or 97.

2.	Select Blank Database, and click OK; then select a database name and click Create.

3.	In the Database window, select the Forms tab, and click the New button.

4.	In the New Form window, select Design View and click OK.

5.	Click and drag the form's detail area to make it large enough to hold an image and some command buttons.

6.	On the Insert pull-down menu, use the Custom Control option (in Access 97, the ActiveX Control option) to select the Lead Control (12).

7.	Click the OK button. The lead control appears on the form.

8.	Size and position the control as you want it to appear at run time, and change the name of the control to Lead1.

9.	 Add a command button to your form and name it as follows. (Cancel the Command Button Wizard when it appears.)

Name	Caption

LoadLead	Load Image

10.	Click the Code Window icon on the toolbar.

 For Access 95.

 For Access 97.

11.	Select the Load procedure for the form, and add the following initialization code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

Private Sub Form_Load()

  'Set defaults for displaying the image.
  'These are all persistent properties that can be set in the properties box.
  Lead1.Appearance = APPEARANCE_FLAT
  Lead1.BorderStyle = 1
  Lead1.BackColor = RGB(255, 255, 125)
  Lead1.PaintDither = PAINTDITHER_DIFFUSION
  Lead1.PaintPalette = PAINTPALETTE_AUTO
  Lead1.AutoRepaint = True
  Lead1.AutoSize = False
  Lead1.AutoSetRects = True
  Lead1.PaintSizeMode = PAINTSIZEMODE_FIT
End Sub

12.	Code the LoadLead button's click procedure as follows:

Private Sub LoadLead_Click()
    Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1
End Sub

13.	 Click the compile button on the toolbar; then close the code window.

14.	Close the form designer, saving the changes.

15.	With Form1 selected in the Database window, click the Open button to test the form.

Note:  For 256-color mode, you can improve the image quality as explained in Palette Usage in Microsoft Access.


Zooming Out and Zooming In (Access 95 and 97)

Take the following steps to add code that can reduce and enlarge the displayed size of the image. This demonstrates the scaling properties that are normally used for zooming in and zooming out. It emphasizes the relationship of the displayed rectangle to the LEAD control.

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

2.	 Add two command buttons to your form and name them as follows:

Name	Caption

ZoomIn	Zoom In

ZoomOut	Zoom Out

3.	Click the Code Window icon on the toolbar.

 For Access 95.

 For Access 97.

4.	Code the ZoomIn button's click procedure as follows:

Private Sub ZoomIn_Click()
  Lead1.AutoSetRects = True
  Lead1.PaintSizeMode = PAINTSIZEMODE_ZOOM
  Lead1.PaintZoomFactor = Lead1.PaintZoomFactor + 10
End Sub

5.	Code the ZoomOut button's click procedure as follows:

Private Sub ZoomOut_Click()
  Lead1.AutoSetRects = True
  Lead1.PaintSizeMode = PAINTSIZEMODE_ZOOM
  If Lead1.PaintZoomFactor > 10 Then
      Lead1.PaintZoomFactor = Lead1.PaintZoomFactor - 10
  End If
End Sub

6.	 Click the compile button on the toolbar; then close the code window.

7.	Close the form designer, saving the changes.

8.	With Form1 selected in the Database window, click the Open button to test the form.


Dynamically Positioning the Control (Access 95 and 97)

Take the following steps to dynamically scale and position the LEAD control when loading an image. This example scales the control to use most of the form's area while preserving the image's aspect ratio.

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

2.	Modify the LeadLoad button's click procedure so that it appears as follows. For a general explanation of how images are positioned and scaled, refer to Displaying an Image.

Private Sub LoadLead_Click()
  'Declare variables used for preserving aspect ratios.
  Dim HeightFactor As Long
  Dim WidthFactor As Long
  Dim HeightAllowed As Long
  Dim WidthAllowed As Long
  Dim ViewHeight, ViewWidth

  'Turn off automated behavior while we load and manipulate the image.
  Lead1.AutoSetRects = False
  Lead1.AutoRepaint = False
  Lead1.AutoScroll = False
  Lead1.BackErase = False

  'Load the bitmap. This hard-coded path name may be different on your system.
  Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1

  'Set the variables used for preserving the aspect ratio.
  'Allow for a border of 1/8 of the form size.
  'The units of measure do not matter, since we are calculating proportions.
  HeightFactor = Lead1.BitmapHeight
  WidthFactor = Lead1.BitmapWidth
  HeightAllowed = Me.WindowHeight * 0.75
  WidthAllowed = Me.WindowWidth * 0.75

  'Center the LEAD control on the form, preserving the aspect ratio.
  'Check to see if using the maximum width will make the image too tall.
  'Set the dimensions based on the result.
  If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
    Lead1.Left = Me.WindowWidth / 8
    Lead1.Width = WidthAllowed
    Lead1.Height = (Lead1.Width * HeightFactor) / WidthFactor
    Lead1.Top = (Me.WindowHeight - Lead1.Height) / 2
  Else
    Lead1.Top = Me.WindowHeight / 8
    Lead1.Height = HeightAllowed
    Lead1.Width = (Lead1.Height * WidthFactor) / HeightFactor
    Lead1.Left = (Me.WindowWidth - Lead1.Width) / 2
  End If

  'Set the image display size to match the LEAD control
  Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
  Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight

  'Turn on automated behavior.
  Lead1.AutoSetRects = True
  Lead1.AutoRepaint = True
  Lead1.AutoScroll = True

End Sub

3.	 Click the compile button on the toolbar; then close the code window.

4.	Close the form designer, saving the changes.

5.	With Form1 selected in the Database window, click the Open button to test the form.


Zooming In on a Selection (Access 95 and 97)

Take the following steps to add code that lets you select an area with a mouse, and zoom in on the selected area.

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

2.	In the Lead1 control's MouseDown procedure, add the following code.

Private Sub Lead1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)
   'Enable AutoRubberBand
   Lead1.AutoRubberBand = True
   Lead1.MousePointer = 2
End Sub

3.	In the Lead1 control's RubberBand procedure, add the following code.

Private Sub Lead1_RubberBand()
  Dim zoomleft As Integer
  Dim zoomtop As Integer
  Dim zoomwidth As Integer
  Dim zoomheight As Integer

  Lead1.MousePointer = 0

  'Zoom in on the selection.
  zoomleft = Lead1.RubberBandLeft
  zoomtop = Lead1.RubberBandTop
  zoomwidth = Lead1.RubberBandWidth
  zoomheight = Lead1.RubberBandHeight

  'Zoom in on the rectangle defined by the rubberband
  Lead1.ZoomToRect zoomleft, zoomtop, zoomwidth, zoomheight
  Lead1.ForceRepaint
End Sub

4.	Run your program to test it.


Outlining, Dragging, and Pasting a Region (Access 95 and 97)

Take the following steps to add code that lets you outline an area with a mouse, drag a copy of the selected area, and paste the copy into another part of the bitmap:

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

2.	Add a second LEAD control, name it Lead2, and set its Visible property to False.

3.	Add the following form-level variables to the declarations procedure of the general object in your main form. In online help, you can use the Edit pull-down menu to copy the block of code.

Dim ReadyToDrag As Boolean 'The state after marking the region but before dragging
Dim Dragging As Boolean 'The state when the mouse is used for dragging the floater
Dim StartX As Single 'Starting X position in screen twips
Dim StartY As Single 'Starting Y position in screen twips
Dim FloaterX As Single 'Floater X position in screen twips
Dim FloaterY As Single 'Floater Y position in screen twips
Dim ZoomFactorX As Single 'Used for translating positioning information
Dim ZoomFactorY As Single 'Used for translating positioning information

4.	 At the top of your main form, add two command buttons and name them as follows:

Name	Caption

SelRgnBtn	Select Region

PasteFloaterBtn	Paste Floater

5.	Add the following code to the SelRgnBtn control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub SelRgnBtn_Click()

Lead1.RgnMarkingMode = RGNMARK_FREEHAND
MsgBox "Draw a freehand region"

End Sub

6.	Add the following code to the PasteFloaterBtn control's Click procedure.

Private Sub PasteFloaterBtn_Click()

'Declare the variable for the Combine operation.
Dim MyOp As Long

'Declare variables for the client area coordinates.
Dim LCRgnX, LCRgnY , LCRgnWidth, LCRgnHeight

'Declare variables for the bitmap coordinates.
Dim LBRgnX, LBRgnY , LBRgnWidth, LBRgnHeight

'Do nothing if there is no floater.
If Lead1.Floater = 0 Then Exit Sub

'Get the floater into another bitmap
Lead2.ScaleMode = Lead1.ScaleMode
Lead2.Bitmap = Lead1.Floater

'Get the floater's client coordinates into local variables.
LCRgnX = Lead1.FloaterDstLeft
LCRgnY = Lead1.FloaterDstTop
LCRgnWidth = Lead1.FloaterDstWidth
LCRgnHeight = Lead1.FloaterDstHeight

'Delete the floater.
Lead1.FloaterVisible = False
Lead1.Floater = 0

'Translate the client coordinates to bitmap coordinates.
LBRgnX = ((LCRgnX - Lead1.DstLeft) / ZoomFactorX) + Lead1.SrcLeft
LBRgnY = ((LCRgnY - Lead1.DstTop) / ZoomFactorY) + Lead1.SrcTop
LBRgnWidth = LCRgnWidth / ZoomFactorX
LBRgnHeight = LCRgnHeight / ZoomFactorY

'Reposition the region to use it as a mask for the Combine method.
Lead1.OffsetRgn LBRgnX - Lead1.RgnLeft, LBRgnY - Lead1.RgnTop

'Use the Combine method to paste the Lead2 bitmap into the Lead1 bitmap.
MyOp = CB_OP_ADD + CB_DST_0 'Operation flags for a simple paste.
Lead1.Combine LBRgnX, LBRgnY, LBRgnWidth, LBRgnHeight, Lead2.Bitmap, 0, 0, MyOp

'Repaint the part of the client area that has changed.
Lead1.RepaintRect LCRgnX, LCRgnY, LCRgnWidth, LCRgnHeight, False

'Free the region.
Lead1.FreeRgn

End Sub

7.	In the Lead1 control's MouseDown procedure, add the following code.

Private Sub Lead1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)

'Declare local variables.
Dim BitmapX, BitmapY
Dim NewX, NewY, NewWidth, NewHeight

'Do nothing if we are drawing a region.
If Lead1.RgnMarkingMode <> RGNMARK_NONE Then Exit Sub

'Make sure we are using Twips, so that we do not have to translate mouse coordinates.
Lead1.ScaleMode = 1

' Save the starting position, in case we need it.
StartY = Y
StartX = X

'If we are ready to drag the selection, get a floater.
If ReadyToDrag = True Then
  'Translate the current mouse coordinates.
  'These coordinates account for the zoom factor and offset.
  ZoomFactorX = Lead1.DstWidth / Lead1.SrcWidth
  ZoomFactorY = Lead1.DstHeight / Lead1.SrcHeight
  BitmapX = (x / ZoomFactorX) - (Lead1.DstLeft / ZoomFactorX) + Lead1.SrcLeft
  BitmapY = (y / ZoomFactorY) - (Lead1.DstTop / ZoomFactorY) + Lead1.SrcTop

  'Continue to create the floater if the mouse is pointing to the region we marked.
  If Lead1.IsPtInRgn(BitmapX, BitmapY) Then
    'Hide the region frame.
    Lead1.RgnFrameType = RGNFRAME_NONE

    'Create the floater bitmap, which will be the part of the main bitmap that is
    'in the region's bounding rectangle.
    Lead1.Floater = Lead1.Bitmap

    'Translate the bitmap region coordinates to client area coordinates.
    NewY = ((Lead1.RgnTop - Lead1.SrcTop) * ZoomFactorY) + Lead1.DstTop
    NewX = ((Lead1.RgnLeft - Lead1.SrcLeft) * ZoomFactorX) + Lead1.DstLeft
    NewWidth = Lead1.RgnWidth * ZoomFactorX
    NewHeight = Lead1.RgnHeight * ZoomFactorY

    'Set the initial display position of the floater.
    Lead1.SetFloaterDstRect NewX, NewY, NewWidth, NewHeight

    'Set form-level variables.
    FloaterY = Lead1.FloaterDstTop
    FloaterX = Lead1.FloaterDstLeft
    Lead1.FloaterVisible = True
    Dragging = True
    ReadyToDrag = False
  End If

End If

End Sub

8.	In the Lead1 control's MouseMove procedure, add the following code.

Private Sub Lead1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)

'Declare variables for repositioning the floater.
Dim NewX, NewY, NewWidth, NewHeight, XDelta, YDelta

'Do nothing if we are drawing a region.
If Lead1.RgnMarkingMode <> RGNMARK_NONE Then Exit Sub

'Reposition the floater if we are dragging it.
If Dragging = True And Button = 1 And Lead1.Floater <> 0 Then
  If Lead1.IsPtInFloater(x, y) Then
    'Update the position variables.
    XDelta = x - StartX
    YDelta = y - StartY
    NewX = FloaterX + XDelta
    NewY = FloaterY + YDelta
    NewWidth = Lead1.FloaterDstWidth
    NewHeight = Lead1.FloaterDstHeight

    'Reposition the floater.
    Lead1.SetFloaterDstRect NewX, NewY, NewWidth, NewHeight

    'Save the form-level position variables.
    FloaterY = NewY
    FloaterX = NewX
    StartY = y
    StartX = x
  End If
End If

End Sub

9.	In the Lead1 control's MouseUp procedure, add the following code.

Private Sub Lead1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)

' If we were drawing a region, set up for the next operation.
If Lead1.RgnMarkingMode <> RGNMARK_NONE Then
  Lead1.RgnMarkingMode = RGNMARK_NONE
  Lead1.RgnFrameType = RGNFRAME_STATIC
  ReadyToDrag = True
  MsgBox "Now, drag the selection to another place."
End If

End Sub

10.	Run your program to test it.


Creating and Using Annotations (Access 95 and 97)

Note: This topic is for Document/Medical  only.

Take the following steps to add code that demonstrates the creation and deletion, saving and loading, and copying and pasting of annotation objects. This code also demonstrates the related events. Message boxes prompt for user actions that trigger events.

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

2.	 At the top of your main form, add four command buttons and name them as follows:

Name	Caption

AnnToggle	Start

IOToggle	Save

ClipboardToggle	Copy

Realize	Realize

3.	Code the AnnToggle control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub AnnToggle_Click()

'Use the button to toggle between design mode and run mode
If AnnToggle.Caption = "Start" Then
  Lead1.AnnUserMode = ANNUSERMODE_DESIGN
  Lead1.AnnTool = ANNTOOL_BUTTON
  'Make run mode the next thing.
  AnnToggle.Caption = "Run Mode"
  MsgBox "In design mode now. Draw a button object."
ElseIf AnnToggle.Caption = "Design Mode" Then
  Lead1.AnnUserMode = ANNUSERMODE_DESIGN
  Lead1.AnnTool = ANNTOOL_BUTTON
  'Make run mode the next thing.
  AnnToggle.Caption = "Run Mode"
Else 'The button takes us to run mode
  Lead1.AnnUserMode = ANNUSERMODE_RUN
  MsgBox "Click on your new button"
  AnnToggle.Caption = "Design Mode"
End If

End Sub

4.	Code the IOToggle control's Click procedure as follows:

Private Sub IOToggle_Click()

'Declare local variable
Dim nRet as integer

'Disable errors so that we can trap our own.
Lead1.EnableMethodErrors = False

'Use the button to toggle between saving and loading annotations
If IOToggle.Caption = "Save" Then
  'Do nothing if there are no annotations.
  If Lead1.AnnContainer = 0 Then Exit Sub
  'Save the selected annotations.
  nRet = Lead1.AnnSave("c:\lead\images\tmp.ann", ANNFMT_NATIVE, True)
  If nRet = 0 Then
    'Make loading the next thing.
    IOToggle.Caption = "Load"
    MsgBox "Use the right mouse button to delete any annotations, then click Load"
  Else
    MsgBox "Error code: " + Str(nRet)
  End If
Else 'We are loading annotations
  'Make sure we are in design mode
  Lead1.AnnUserMode = ANNUSERMODE_DESIGN
  'Load the annotations.
  nRet = Lead1.AnnLoad("c:\lead\images\tmp.ann", 1)
  If nRet = 0 Then
    IOToggle.Caption = "Save"
  Else
    MsgBox "No annotations to load"
  End If
End If

End Sub

5.	Code the ClipboardToggle control's Click procedure as follows. (Note that Copy, Cut, and Paste are available as automated popup menu options. This code is for tailoring your application.)

Private Sub ClipboardToggle_Click()

'Declare local variable
Dim nRet as integer

'Disable errors so that we can trap our own.
Lead1.EnableMethodErrors = False

'Use the button to toggle between copying and pasting annotations
If ClipboardToggle.Caption = "Copy" Then
  'Do nothing if there are no annotations.
  If Lead1.AnnContainer = 0 Then Exit Sub

  'Copy the selected annotations to the clipboard.
  nRet = Lead1.AnnCopy(ANNFMT_NATIVE, True, True)
  If nRet = 0 Then
    'Make pasting the next thing.
    ClipboardToggle.Caption = "Paste"
    MsgBox "Use the right mouse button to delete any annotations, then click Paste"
   Else
    MsgBox "Error code: " + Str(nRet)
  End If
Else 'We are pasting annotations
  'Make sure we are in design mode
  Lead1.AnnUserMode = ANNUSERMODE_DESIGN
  'Paste the annotations
  If Lead1.AnnPasteReady Then
    Lead1.AnnPaste
    ClipboardToggle.Caption = "Copy"
  Else
    MsgBox "No annotations to paste"
  End If
End If

End Sub

6.	Code the Realize control's Click procedure (which renders the annotation objects to the bitmap) as follows:

Private Sub Realize_Click()
Lead1.AnnRealize False
Lead1.ForceRepaint
MsgBox "Annotations are now rendered to the bitmap"
End Sub

7.	Code the Lead1 control's AnnCreate procedure as follows:

Private Sub Lead1_AnnCreate(ByVal hObject As Long)
 ' Update the tag if we need one.
Static NewTag As Integer
If Lead1.AnnGetType(hObject) = ANNOBJECT_BUTTON Or Lead1.AnnGetType(hObject) = ANNOBJECT_HOTSPOT Then
  NewTag = NewTag + 1
  Lead1.AnnSetTag hObject, NewTag
End If

End Sub

8.	Code the Lead1 control's AnnDrawn procedure as follows:

Private Sub Lead1_AnnDrawn(ByVal hObject As Long)
Lead1.AnnTool = ANNTOOL_SELECT
MsgBox "Use the right mouse button to modify this object; then click on Run Mode to test it."

End Sub

9.	Code the Lead1 control's AnnClicked procedure as follows:

Private Sub Lead1_AnnClicked(ByVal hObject As Long)
  MsgBox "This is what we do for the button tagged " + Str(Lead1.AnnGetTag(hObject))
End Sub

10.	Code the Lead1 control's AnnDestroy procedure as follows:

Private Sub Lead1_AnnDestroy(ByVal hObject As Long)
MsgBox "The object tagged " + Str(Lead1.AnnGetTag(hObject)) + " is deleted."
End Sub

11.	 Click the compile button on the toolbar; then close the code window.

12.	Close the form designer, saving the changes.

13.	With Form1 selected in the Database window, click the Open button to test the form.


Using ODBC to Access Image Data (Access 95 and 97)

This lesson describes how to use the LEADTOOLS ODBC features to maintain images in a table with other data. In this lesson, you accomplish the following:

 Create a database with one table containing images and names for the images.

 Create an ODBC data source that references the table.

 Use the Access form's default behavior to manage the table and to access the names.

 Use the LEADTOOLS methods to access the images through the ODBC data source.

 Use SQL SELECT statements to maintain a sorted view of the records.

 Synchronize the record pointers so that the two views of the same table are always correct.

1.	Start Microsoft Access 95 or 97.

2.	Select Blank Database, and click OK.

3.	Specify leadpic.mdb as the database name and click Create.

4.	In the Database window, select the Tables tab, and click the New button.

5.	In the New Table window, select Design View and click OK.

6.	In the table designer, specify two fields as follows:

a.	Field Name: who. Data Type: text. Size: 255.

b.	Field name: photo. Data Type: OLE Object.

7.	Use the Edit pulldown menu to specify who as the primary key.

8.	Close the table designer, saving the table with the following name:

Table Name: 	people

9.	In Access 97 only, close the database, and start your project with another name. (Otherwise, an ODBC error will occur when trying to open the table.)

10.	In the Database window, select the Queries tab, and click the New button.

11.	Create Query1 as follows. (You can select View SQL to enter the query directly.)

SELECT who FROM people ORDER BY who

12.	In Access 97 only, specify the leadpic.mdb as the data source in the query's property table.

13.	In the Database window, select the Forms tab, and click the New button.

14.	In the New Form window, select Design View, specify Query1 as the data source, and click OK.

15.	On the Insert pull-down menu, use the Custom Control option (in Access 97, the ActiveX Control option) to select the Lead Control (12).

16.	Click the OK button. The lead control appears on the form.

17.	Size and position the control as you want it to appear in your application.

18.	In the Properties box for the LEAD control, make the following changes:

a.	Set the Border Style property to solid.

b.	Set the Name property to Lead1.

19.	Add a TextBox control to your form and change its properties as follows:

a.	Set the Control Source property to who.

b.	Set the Name property to Cwho.

20.	Add a CommonDialog OLE control to your form and change its name to CommonDialog1. (If your system does not have a CommonDialog control, you can use any valid way of getting a file name.)

21.	 Add three command buttons to your form and name them as follows. (Cancel the Command Button Wizard when it appears.)

Name	Caption

AddPhoto	Add Photo

DeleteRecord	Delete Record

FlipPhoto	Flip Photo

22.	Close Access, and from the Windows Control Panel, create the ODBC data source as follows:

a.	Open the ODBC32 administrator and click the Add button.

b.	Select Microsoft Access driver and click the OK (or Finish) button.

c.	Enter the name LEADAC32.

d.	Select the path to the database that you created.

e.	Click the OK button; click the next OK button; then click the Close button.

23.	Restart Access, open your project, and add the following code to your form's general declarations.

' The Windows Sleep function lets us synchronize requeries on adds and deletes
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

' These are variables for implementing the dbMove method
Public OldPosition, NewPosition
Public NormalMove, OnLastRecord

24.	Add the following code to the form's Load procedure.

On Error GoTo ERRORHANDLER

  ' Declare a local variable
  Dim ODBCString, SQLString

  ' Turn off automatic scrolling and repainting
  Lead1.AutoScroll = False
  Lead1.AutoRepaint = False

  ' Open the ODBC database.
  ' Use the same SELECT statement that is used for the data control.
  ' Note that the image field must be listed first in the SELECT statement.
  ODBCString = "ODBC;DSN=LEADAC32"
  SQLString = "SELECT photo FROM people ORDER BY who"
  Lead1.dbOpen ODBCString, SQLString, "photo", DB_OPENOPTIONS_NONE

  ' Set the LEAD control's database properties
  Lead1.dbLoadBits = 0
  Lead1.dbLockingMode = DB_LOCKINGMODE_OPTIMISTIC

  ' Enable use of the dbMove method in the form's Current event
  NewPosition = 1
  If (Lead1.dbIsBOF And Lead1.dbIsEOF) = False Then
      NormalMove = True
  End If
Exit Sub
ERRORHANDLER:
MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description

25.	Add the following code to the form's Unload procedure.

Lead1.dbClose

26.	Add the following code to the AddPhoto button's Click event:

On Error GoTo Err_AddPhoto_Click

  ' Declare a local variable
  Dim Myfile

  ' Add a record
  DoCmd.GoToRecord , , acNewRec

  ' Get an image file
  CommonDialog1.Filter = "Grapics|*.cmp; *.jpg; *.jff; *.jtf; *.bmp; *.tif; *.tga; *.pcx; *.cal; *.mac; *.mac; *.img; *.msp; *.wpg; *.wpg; *.ras; *.pct; *.pcd; *.eps; *.wmf"
  CommonDialog1.Flags = cdlOFNFileMustExist
  CommonDialog1.DialogTitle = "Open File"
  CommonDialog1.CancelError = True
  CommonDialog1.ShowOpen
  Myfile = CommonDialog1.FileName

  ' Suspend use of the dbMove method in the form's Current event
  NormalMove = False

  'Set the pointer to an hourglass
  DoCmd.Hourglass True

  ' Hide the LEAD control to avoid unnecessary repaints
  Lead1.Visible = False

  ' Update the record and do a requery without inserting the image
  Cwho = Myfile
  Me.Requery
  NewPosition = 1

  ' Wait for the update to take effect
  Call Sleep(5000)

  ' Requery the LEAD control's recordset and make sure it is
  ' synchronized with the data control.
  Lead1.dbRequery
  NormalMove = True ' Do normal record synchronization
  DoCmd.GoToRecord , , acLast
  If (Lead1.dbCurrentRecord + 1) <> Me.CurrentRecord Then
    MsgBox "Synchronization error!" + Chr(13) + "Delete the record and exit"
    DoCmd.FindRecord Myfile, , , , , acCurrent
    DoCmd.Hourglass False
    Exit Sub
  End If

  ' Go to the new record, and show the LEAD control
  DoCmd.FindRecord Myfile, , , , , acCurrent
  Lead1.Visible = True

  ' Load the image file and update the recordset
  Lead1.dbEdit
  Lead1.Load Myfile, 0, 0, 1

  ' Update the recordset using the appropriate format
  If Lead1.BitmapBits = 1 Then
    Lead1.dbUpdate FILE_Lead1BIT, 1, 0
  ElseIf Lead1.BitmapBits = 4 Then
    Lead1.dbUpdate FILE_PCX, 4, 0
  ElseIf Lead1.IsGrayscale = GRAY_NO Then
    Lead1.dbUpdate FILE_CMP, 24, QFACTOR_QMS
  Else 'save as grayscale
    Lead1.dbUpdate FILE_CMP, 8, QFACTOR_QMS
  End If

  ' Set the mouse pointer back to the default
  DoCmd.Hourglass False
  Exit Sub

Err_AddPhoto_Click:
  DoCmd.Hourglass False
  ' Handle the duplicate record error
  If Err.Number = 3022 Then
    MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description
    Cwho = "Let's delete this record"
    MsgBox "Answer yes when prompted to delete this record, which you added by mistake."
    DeleteRecord_Click
  Else
    MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description
  End If

27.	Add the following code to the DeleteRecord button's Click event:

On Error GoTo Err_DeleteRecord_Click

  ' Declare local variable
  Dim RecMarker As Long

  ' Disable the normal record synchronization and hide the LEAD control.
  NormalMove = False
  Lead1.Visible = False

  'Set the pointer to an hourglass
  DoCmd.Hourglass True

  ' Save the current position
  RecMarker = Me.CurrentRecord

  ' Delete the record and wait for the deletion to take effect
  DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
  DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
  Call Sleep(5000)

  ' Requery the recordsets, move to the last record,
  ' and initialize the NewPosition global variable.
  Me.Requery
  Lead1.dbRequery

  If Lead1.dbIsBOF And Lead1.dbIsEOF Then
    MsgBox "Database is empty"
    DoCmd.Hourglass False
    NormalMove = True
    Lead1.Visible = True
    Exit Sub
  End If

  DoCmd.GoToRecord , , acLast
  NewPosition = Me.CurrentRecord
  Lead1.dbMove NewPosition - 1

  ' Make sure the LEAD control is on the last record.
  Lead1.dbMoveNext
  If Lead1.dbIsEOF Then
    Lead1.dbMovePrev
  Else
    MsgBox "Synchronization error!" + Chr(13) + "Restart the application"
    Exit Sub
  End If

  ' Return to the old record position, if possible.
  NormalMove = True
  If RecMarker < NewPosition Then
    OnLastRecord = False
    ' The LEAD control is made visible in the form's Current procedure
    DoCmd.GoToRecord , , acGoTo, RecMarker
  Else
    Lead1.Visible = True
    Lead1_Change
  End If

  'Set the mouse pointer back to the default
  DoCmd.Hourglass False
  Exit Sub

Err_DeleteRecord_Click:
  DoCmd.Hourglass False
  NormalMove = True
  MsgBox Err.Description

28.	Add the following code to the FlipPhoto button's Click event:

On Error GoTo ERRORHANDLER
  ' Flip the image and update the record
  Lead1.Flip
  Lead1.dbEdit

  ' Update the recordset using the appropriate format
  If Lead1.BitmapBits = 1 Then
    Lead1.dbUpdate FILE_Lead1BIT, 1, 0
  ElseIf Lead1.BitmapBits = 4 Then
    Lead1.dbUpdate FILE_PCX, 4, 0
  ElseIf Lead1.IsGrayscale = GRAY_NO Then
    Lead1.dbUpdate FILE_CMP, 24, QFACTOR_QMS
  Else 'save as grayscale
    Lead1.dbUpdate FILE_CMP, 8, QFACTOR_QMS
  End If

Exit Sub
ERRORHANDLER:
MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description

29.	Add the following code to the Lead1 control's Change event:

' Declare local variables
Dim HeightAllowed, WidthAllowed, DisplayTop, DisplayWidth, DisplayHeight, DisplayLeft

' Avoid processing events that occur before the bitmap is fully loaded
If Lead1.Bitmap = 0 Or Lead1.Visible = False Then Exit Sub

' Calculate the display rectangle to fit the image inside the control
HeightAllowed = Lead1.ScaleHeight
WidthAllowed = Lead1.ScaleWidth
If (HeightAllowed * Lead1.BitmapWidth / Lead1.BitmapHeight) <= WidthAllowed Then
  DisplayTop = 0
  DisplayHeight = HeightAllowed
  DisplayWidth = DisplayHeight * Lead1.BitmapWidth / Lead1.BitmapHeight
  DisplayLeft = (Lead1.ScaleWidth - DisplayWidth) / 2
Else
  DisplayLeft = 0
  DisplayWidth = WidthAllowed
  DisplayHeight = DisplayWidth * Lead1.BitmapHeight / Lead1.BitmapWidth
  DisplayTop = (Lead1.ScaleHeight - DisplayHeight) / 2
End If

'Set the image display size and paint the image
Lead1.SetDstRect DisplayLeft, DisplayTop, DisplayWidth, DisplayHeight
Lead1.SetDstClipRect DisplayLeft, DisplayTop, DisplayWidth, DisplayHeight
Lead1.ForceRepaint

30.	Add the following code to the Form's Current event:

' Use the dbMove method to move the LEAD control to the current record
If NormalMove Then
  ' The current position is the NewPosition
  ' The OldPosition is the previous position
  OldPosition = NewPosition
  NewPosition = Me.CurrentRecord
  Lead1.Visible = True
  Lead1.dbMove NewPosition - OldPosition
End If

31.	Run your program to test it.

Note:  For 256-color mode, you can improve the image quality as explained in Palette Usage in Microsoft Access.


Including Images in a Report (Access 95 and 97)

Take the following steps to create a report that includes images from an ODBC data source. (You can use a similar strategy to include images where only the pathname is stored in the database.)

Note: Quality of the output depends on the video mode. For best results, use high color or true color.

1.	Start with the project that you created in Using ODBC to Access Image Data.

2.	In the Database window, select the Reports tab, and click the New button.

3.	In the New Report window, select Design View, specify Query1 as the data source, and click OK.

4.	On the Insert pull-down menu, use the Custom Control option to select the Lead Control.

5.	Click the OK button. The lead control appears on the report.

6.	Size and position the control as you want it to appear on your report.

7.	In the Properties box for the LEAD control, make the following changes:

a.	Set the Border Style property to solid.

b.	Set the Name property to LeadOnRpt.

8.	Add a TextBox control to your report and change its properties as follows:

a.	Set the Control Source property to who.

b.	Set the Name property to Cwho.

9.	Add the following code to the Detail object's Print event:

On Error GoTo ERRORHANDLER
  ' Declare a local variables
  Dim ODBCString, SQLString
  Static GetNextRecord As Boolean

  If GetNextRecord Then
    LeadOnRpt.dbMoveNext
  Else
     ' Initialize the Lead control.
    LeadOnRpt.AutoRepaint = True
    LeadOnRpt.PaintDither = PAINTDITHER_DIFFUSION
    LeadOnRpt.PaintPalette = PAINTPALETTE_FIXED
    LeadOnRpt.AutoRepaint = True
    LeadOnRpt.AutoSetRects = True
    LeadOnRpt.PaintSizeMode = PAINTSIZEMODE_FIT

    ' Open the ODBC database.
    ' Use the same SELECT statement that is used for the data control.
    ' Note that the image field must be listed first in the SELECT statement.
    ODBCString = "ODBC;DSN=LEADAC32"
    SQLString = "SELECT photo FROM people ORDER BY who"
    LeadOnRpt.dbOpen ODBCString, SQLString, "photo", DB_OPENOPTIONS_READONLY

    ' Set the LEAD control's database properties
    LeadOnRpt.dbLoadBits = 0
    LeadOnRpt.dbLockingMode = DB_LOCKINGMODE_OPTIMISTIC
    GetNextRecord = True
  End If
Exit Sub
ERRORHANDLER:
MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description

10.	Add the following code to the Report object's Close event:

LeadOnRpt.dbClose

11.	For printing the report, add a command button to your main form. Using the Command Button Wizard, you can select Report Operations and Print Report.

12.	Run your program to test it.


Writing and Reading Multipage Files (Access 95 and 97)

Take the following steps to create a multipage file, then load and display the images from the file. Only TIFF (MPT) and PCX (DCX) formats support multipage files.

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

2.	In the Database window, select the Forms tab, select Form1, and click the Design button.

3.	On the Insert pull-down menu, use the Custom Control option to select the Lead Control.

4.	Click the OK button. The LEAD control appears on the form. (This is the second LEAD control.)

5.	Drag the LEAD control to a convenient location on. The size and position does not really matter, because it is changed in the code.

6.	In the properties box, change the name of the control to Lead2, and set its Visible property to False.

7.	 Select the Command Button control; then add a control to your form. (Cancel the Command Button Wizard when it appears.) Put the control at the top of the form to keep it away from the images.

8.	In the Properties box, change the Command Button control's Name property to Multipage and change the Caption property to Test Multipage.

9.	Click the Code Window icon on the toolbar.

 For Access 95.

 For Access 97.

10.	Select the Click procedure for the Multipage object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

' Declare some local variables
Dim HeightAllowed, WidthAllowed
Dim HeightFactor1, WidthFactor1, HeightFactor2, WidthFactor2
Dim ImageHeight1, ImageWidth1, ImageHeight2, ImageWidth2
Dim ImageLeft1, ImageTop1, ImageLeft2, ImageTop2

' Disable automatic repainting of the images.
Lead1.AutoRepaint = False
Lead2.AutoRepaint = False

' Turn off scroll bars to make sure we use the full client area.
Lead1.AutoScroll = False
Lead2.AutoScroll = False

' Hide the controls until we are ready to look at them.
Me![Lead1].Visible = False
Me![Lead2].Visible = False

' Display the form and set the mouse pointer to an hourglass.
DoCmd.Hourglass True

' Load the bitmaps. These hard-coded path names may be different on your system.
Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1
Lead2.Load "c:\lead\images\image2.cmp", 0, 0, 1

' Save the bitmaps to a single multipage TIFF file
Lead1.Save "c:\lead\images\combined.mpt", FILE_TIF, 24, 0, SAVE_OVERWRITE
Lead2.Save "c:\lead\images\combined.mpt", FILE_TIF, 24, 0, SAVE_APPEND

' Get information about the images so that we can size the controls.
Lead1.GetFileInfo "c:\lead\images\combined.mpt", 1, 0
Lead2.GetFileInfo "c:\lead\images\combined.mpt", 2, 0

' Clear the bitmaps from memory
Lead1.Bitmap = 0
Lead2.Bitmap = 0

' Make the controls visible so that we can size and position them.
Me![Lead1].Visible = True
Me![Lead2].Visible = True

'Set the variables used for preserving the aspect ratio.
HeightFactor1 = Lead1.InfoHeight
WidthFactor1 = Lead1.InfoWidth
HeightFactor2 = Lead2.InfoHeight
WidthFactor2 = Lead2.InfoWidth
HeightAllowed = Me.WindowHeight * 0.8
WidthAllowed = Me.WindowWidth * 0.45

'Center each LEAD control on half of the form, preserving the aspect ratio.
'Check to see if using the maximum width will make the image too tall.
'Set the dimensions based on the result.
If (WidthAllowed * HeightFactor1) / WidthFactor1 < HeightAllowed Then
  Me![Lead1].Left = (Me.WindowWidth / 4) - (WidthAllowed / 2)
  Me![Lead1].Width = WidthAllowed
  Me![Lead1].Height = (Me![Lead1].Width * HeightFactor1) / WidthFactor1
  Me![Lead1].Top = (Me.WindowHeight - Me![Lead1].Height) / 2
Else
  Me![Lead1].Top = (Me.WindowHeight - HeightAllowed) / 2
  Me![Lead1].Height = HeightAllowed
  Me![Lead1].Width = (Me![Lead1].Height * WidthFactor1) / HeightFactor1
  Me![Lead1].Left = (Me.WindowWidth / 4) - (Me![Lead1].Width / 2)
End If

If (WidthAllowed * HeightFactor2) / WidthFactor2 < HeightAllowed Then
  Me![Lead2].Left = (Me.WindowWidth * 3 / 4) - (WidthAllowed / 2)
  Me![Lead2].Width = WidthAllowed
  Me![Lead2].Height = (Me![Lead2].Width * HeightFactor2) / WidthFactor2
  Me![Lead2].Top = (Me.WindowHeight - Me![Lead2].Height) / 2
Else
  Me![Lead2].Top = (Me.WindowHeight - HeightAllowed) / 2
  Me![Lead2].Height = HeightAllowed
  Me![Lead2].Width = (Me![Lead2].Height * WidthFactor2) / HeightFactor2
  Me![Lead2].Left = (Me.WindowWidth * 3 / 4) - (Me![Lead2].Width / 2)
End If

' Load the bitmaps from the multipage TIFF file
Lead1.Load "c:\lead\images\combined.mpt", 24, 1, 1
Lead2.Load "c:\lead\images\combined.mpt", 24, 2, 1

' Set the image display sizes to match the LEAD controls
ImageHeight1 = Lead1.ScaleHeight
ImageWidth1 = Lead1.ScaleWidth
Lead1.SetDstRect 0, 0, ImageWidth1, ImageHeight1
Lead1.SetDstClipRect 0, 0, ImageWidth1, ImageHeight1
ImageHeight2 = Lead2.ScaleHeight
ImageWidth2 = Lead2.ScaleWidth
Lead2.SetDstRect ImageLeft2, ImageTop2, ImageWidth2, ImageHeight2
Lead2.SetDstClipRect ImageLeft2, ImageTop2, ImageWidth2, ImageHeight2

' Display the images
Lead1.ForceRepaint
Lead2.ForceRepaint

'Set the mouse pointer back to the default
DoCmd.Hourglass False

11.	 Click the compile button on the toolbar; then close the code window.

12.	Close the form designer, saving the changes.

13.	With Form1 selected in the Database window, click the Open button to test the form. Notice that the text printed on the bitmap is scaled as part of the bitmap. If you zoom in, it becomes larger, and if you zoom out, it becomes smaller. The text printed on the control is the normal size for the system font and is not affected by zooming.


Using Transparent Controls (Access 95 and 97)

Take the following steps to add transparent controls, with special effects. The controls will have a shape and some text, and they will paint on top of the existing Lead1 control.

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

2.	Add two LEAD controls, which you will set to be transparent at run time. Name the controls Lead2 and Lead3. You can put the controls anywhere on the form, because they are sized and positioned at run time.

3.	Code the Lead1 control's Paint event as follows:

Private Sub Lead1_Paint()
   'Paint the transparent controls whenever we paint Lead1.
   Lead2.ForceRepaint
   Lead3.ForceRepaint
End Sub

4.	Add a command button that will create and paint the special effects. Code its click event as follows:

Private Sub Command3_Click()
   'Declare local variables
   Dim LabelWidth, LabelHeight

   'Avoid extra repaints.
   Lead1.AutoRepaint = False
   Lead2.AutoRepaint = False
   Lead3.AutoRepaint = False

   'Make Lead2 and Lead3 transparent.
   Lead2.Transparent = True
   Lead3.Transparent = True

   'Give each control a different effect.
Lead1.PaintEffect = EFX_EFFECT_WIPE_RECTANGLE_OUT
   Lead2.PaintEffect = EFX_EFFECT_WIPE_RECTANGLE_IN
   Lead3.PaintEffect = EFX_EFFECT_WIPE4_R_B_L_B

   Lead1.EffectDelay = 20
   Lead2.EffectDelay = 20
   Lead3.EffectDelay = 20
   Lead1.EffectGrain = 1
   Lead2.EffectGrain = 5
   Lead3.EffectGrain = 1

   'Position Lead2 and Lead3.
   Lead2.Width = Lead1.Width / 2
   Lead2.Height = Lead1.Height / 2
   Lead2.Left = Lead2.Width / 2
   Lead2.Top = Lead2.Height / 2
   Lead3.Width = Lead2.Width
   Lead3.Height = Lead2.Height
   Lead3.Left = Lead2.Left
   Lead3.Top = Lead2.Top

   'Load an image into Lead1, and paint it.
   Lead1.Load "d:\lead\images\image1.cmp", 0, 0, 1
   Lead1.ForceRepaint

   'We will be drawing into the bitmaps.
   Lead2.DrawPersistence = True
   Lead3.DrawPersistence = True

   'First, we need to create the bitmaps.
   LabelWidth = Lead2.ScaleWidth
   LabelHeight = Lead2.ScaleHeight
   Lead2.CreateBitmap LabelWidth, LabelHeight, 24
   Lead3.CreateBitmap LabelWidth, LabelHeight, 24

   'Fill it with black, which we will make transparent.
   Lead2.Fill RGB(0, 0, 0)
   Lead2.BitmapEnableTransparency = True
   Lead2.BitmapTransparentColor = RGB(0, 0, 0)
   Lead3.Fill RGB(0, 0, 0)
   Lead3.BitmapEnableTransparency = True
   Lead3.BitmapTransparentColor = RGB(0, 0, 0)

   'Draw a shape into Lead2
   'Shape background
   Lead2.ShapeBackgroundStyle = EFX_BACKSTYLE_TRANSLUCENT

   'Shape location
   Lead2.ShapeTop = 0
   Lead2.ShapeLeft = 0
   Lead2.ShapeWidth = LabelWidth
   Lead2.ShapeHeight = LabelHeight

   'Shape border
   Lead2.ShapeBorderColor = RGB(255, 0, 0)
   Lead2.ShapeBorderStyle = EFX_BORDERSTYLE_SOLID
   Lead2.ShapeBorderThickness = 5

   'Shape fill pattern
   Lead2.PatternStyle = EFX_PATTERN_TRANSPARENT

   'Draw the shape.
   Lead2.DrawShape EFX_SHAPE_STAR4, 0

   'Draw text into Lead3.
   'Specify the text, font, and styles
   Lead3.Font.Name = "Arial"
   Lead3.Font.Size = 40
   Lead3.TextAngle = 450
   Lead3.DrawFontColor = RGB(0, 0, 255) 'Blue
   Lead3.TextStyle = EFX_TEXTSTYLE_NORMAL
   Lead3.TextAlign = EFX_TEXTALIGN_HCENTER_VCENTER

   'Set the location for the text.
   Lead3.TextTop = 0
   Lead3.TextLeft = 0
   Lead3.TextWidth = LabelWidth
   Lead3.TextHeight = LabelHeight

   'Set the properties for drawing a rectangle behind the text.
   Lead3.DrawPenStyle = DRAWPENSTYLE_SOLID
   Lead3.DrawPenColor = RGB(255, 255, 0)
   Lead3.DrawMode = DRAWMODE_COPY_PEN

   'Draw the rectangle, then draw the text.
   Lead3.DrawRectangle 0, 0, LabelWidth, LabelHeight
   Lead3.DrawText "Text", 0

   'Turn off paint effects.
   Lead1.PaintEffect = EFX_EFFECT_NONE
   Lead2.PaintEffect = EFX_EFFECT_NONE
   Lead3.PaintEffect = EFX_EFFECT_NONE
End Sub

5.	Run your program to test it.


Drawing Simple Lines and Shapes (Access 95 and 97)

Take the following steps to add code that lets you draw a line, rectangle and ellipse on the bitmap.

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:

Dim DrawObject As Integer 'The object we are drawing
Dim StartX As Single 'Starting X position
Dim StartY As Single 'Starting Y position
Dim EndX As Single 'Ending X position
Dim EndY As Single 'Ending Y position

3.	Code the LEAD control's MouseDown event as follows. This code selects a different drawing object each time the event occurs.

Private Sub Lead1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)

'Use the same scale mode as the mouse.
Lead1.ScaleMode = 1

'Save the starting position.
StartX = X
StartY = Y
EndX = X
EndY = Y

'Cycle through the types of drawing objects.
Select Case DrawObject
Case 0
  DrawObject = 1 'Line
Case 1
  DrawObject = 2 'Rectangle
Case 2
  DrawObject = 0 'Ellipse
Case Else
  DrawObject = 0
End Select

End Sub

4.	Code the LEAD control's MouseMove event as follows. This code uses DRAWMODE_INVERT for the DrawMode, which means that pixel colors are inverted. Thus, the drawing methods can erase the previous object and draw a new one.

Private Sub Lead1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

'Declare local variables.
Dim OldEndX, OldEndY
Dim OldDrawX, OldDrawY, OldWidth, OldHeight
Dim DrawX, DrawY, NewWidth, NewHeight

If Button = 1 Then
  'Set the drawing styles.
  Lead1.DrawPenStyle = DRAWPENSTYLE_SOLID
  Lead1.DrawMode = DRAWMODE_INVERT
  Lead1.DrawFillStyle = DRAWFILLSTYLE_TRANSPARENT
  Lead1.DrawPersistence = False 'On the window, not the bitmap

  'Save the previous ending mouse position.
  OldEndX = EndX
  OldEndY = EndY

  'Get the current mouse position.
  EndX = X
  EndY = Y

  'Calculate the origin of the current object.
  If EndX > StartX Then
      DrawX = StartX
  Else
      DrawX = EndX
  End If
  If EndY > StartY Then
      DrawY = StartY
  Else
      DrawY = EndY
  End If

  'Calculate the origin of the previous object.
  If OldEndX > StartX Then
      OldDrawX = StartX
  Else
      OldDrawX = OldEndX
  End If
  If OldEndY > StartY Then
      OldDrawY = StartY
  Else
      OldDrawY = OldEndY
  End If

  'Calculate the height and width of the current object.
  NewHeight = Abs(StartY - EndY)
  NewWidth = Abs(StartX - EndX)

  'Calculate the height and width of the previous object.
  OldHeight = Abs(StartY - OldEndY)
  OldWidth = Abs(StartX - OldEndX)

  'Erase the old object and draw the new one.
  Select Case DrawObject
  Case 0 'Ellipse
    Lead1.DrawEllipse OldDrawX, OldDrawY, OldWidth, OldHeight
    Lead1.DrawEllipse DrawX, DrawY, NewWidth, NewHeight
  Case 1 'Line
    Lead1.DrawLine StartX, StartY, OldEndX, OldEndY
    Lead1.DrawLine StartX, StartY, EndX, EndY
  Case 2 'Rectangle
    Lead1.DrawRectangle OldDrawX, OldDrawY, OldWidth, OldHeight
    Lead1.Drawrectangle DrawX, DrawY, NewWidth, NewHeight
  Case Else
  End Select

End If

End Sub

5.	Code the LEAD control's MouseUp event as follows. This code sets the drawing style and draws the object on the bitmap.

Private Sub Lead1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

'Declare local variables.
Dim DrawX, DrawY, NewWidth, NewHeight

'Set the drawing style.
Lead1.DrawPenStyle = DRAWPENSTYLE_SOLID
Lead1.DrawPenWidth = 2
Lead1.DrawPenColor = RGB(255, 0, 0) 'Red
Lead1.DrawMode = DRAWMODE_COPY_PEN
Lead1.DrawFillColor = RGB(0, 255, 0) 'Green
Lead1.DrawFillStyle = DRAWFILLSTYLE_HORIZONTAL_LINE
Lead1.DrawPersistence = True 'On the bitmap

'Get the current mouse position
EndX = X
EndY = Y

'Determine the origin of the object.
If EndX > StartX Then
  DrawX = StartX
Else
  DrawX = EndX
End If
If EndY > StartY Then
  DrawY = StartY
Else
  DrawY = EndY
End If

'Determine the height and width of the object.
NewHeight = Abs(StartY - EndY)
NewWidth = Abs(StartX - EndX)

'Draw the object
Select Case DrawObject
Case 0 'Ellipse
  Lead1.DrawEllipse DrawX, DrawY, NewWidth, NewHeight
Case 1 'Line
  Lead1.DrawLine StartX, StartY, EndX, EndY
Case 2 'Rectangle
  Lead1.DrawRectangle DrawX, DrawY, NewWidth, NewHeight
Case Else
End Select

End Sub

6.	Run your program to test it.


Cropping a Displayed Image and Copying It to a Bitmap (Access 95 and 97)
Cropping a Bitmap (Access 95 and 97)

Take the following steps to add code that lets you select an area with a mouse, crop the display to show only that area, and crop the bitmap to match the selected area.

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

2.	 Select the Command Button control; then add a control to your form. (Cancel the Command Button Wizard when it appears.) Put the control at the top of the form to keep it away from the image.

3.	In the Properties box, change the Command Button control's Name property to SelectRectangle and change the Caption property to Select Rectangle.

4.	 Select the Command Button control; then add another control to your form. Put the control at the top of the form to keep it away from the image.

5.	In the Properties box, change the Command Button control's Name property to TrimBitmap and change the Caption property to Trim Bitmap.

6.	Click the Code Window icon on the toolbar.

 For Access 95.

 For Access 97.

7.	Select the Declarations module for the General object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

Dim Cropping 'The state when the mouse is used for cropping
Dim StartX As Integer 'Starting X position in screen twips
Dim StartY As Integer 'Starting Y position in screen twips
Dim EndX As Integer 'Ending X position in screen twips
Dim EndY As Integer 'Ending Y position in screen twips

8.	Select the Click procedure for the SelectRectangle object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

' Declare local variables
Dim DstLeft, DstTop, DstWidth, DstHeight

' Set the scale mode to twips
Lead1.ScaleMode = 1

' Initialize cropping so that you can do it more than once
If Cropping = True Then
  'Set the clipping area to match the image.
  DstLeft = Lead1.DstLeft
  DstTop = Lead1.DstTop
  DstWidth = Lead1.DstWidth
  DstHeight = Lead1.DstHeight
  Lead1.SetDstClipRect DstLeft, DstTop, DstWidth, DstHeight

  ' Display the image
  Lead1.ForceRepaint
End If

' Set a global variable to let other events know that you are cropping
Cropping = True

' Set the pointer to a crosshair
Lead1.MousePointer = 2

9.	Select the MouseDown procedure for the Lead1 object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

'Save the starting position
StartX = X
StartY = Y

'Make the rubberband invisible until the mouse moves
Lead1.RubberBandVisible = False

10.	Select the MouseMove procedure for the Lead1 object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

' Declare local variables
Dim rbX, RbY, rbHeight, rbWidth

If Cropping = True And Button = 1 Then
  'Translate the current mouse position
  EndX = X
  EndY = Y

  'Determine the origin of the rubberband rectangle, regardless of which way the mouse moves.
  If EndX > StartX Then
    rbX = StartX
  Else
    rbX = EndX
  End If

  If EndY > StartY Then
    RbY = StartY
  Else
    RbY = EndY
  End If

  'Determine the height and width of the rubberband rectangle
  rbHeight = Abs(StartY - EndY)
  rbWidth = Abs(StartX - EndX)
  'Set the rubberband rectangle.
  Lead1.SetRubberBandRect rbX, RbY, rbWidth, rbHeight
    'Alternatively, you could use the following properties to set the
    'rubberband rectangle.
    ' Lead1.RubberBandHeight = rbHeight
    ' Lead1.RubberBandLeft = rbX
    ' Lead1.RubberBandTop = rbY
    ' Lead1.RubberBandWidth = rbWidth

  'Make the rubberband visible.
  Lead1.RubberBandVisible = True

End If

11.	Select the MouseUp procedure for the Lead1 object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

' Declare local variables
Dim CropLeft, CropTop, CropWidth, CropHeight

If Cropping = True Then
  'Translate the current mouse position
  EndX = X
  EndY = Y

  'Get the origin of the clipping rectangle.
  'Allow for different mouse drag directions
  If StartX < EndX Then
    CropLeft = StartX
  Else
     CropLeft = EndX
  End If

  If StartY < EndY Then
    CropTop = StartY
  Else
     CropTop = EndY
  End If

  'Get the height and width of the cropped area
  CropWidth = Abs(EndX - StartX)
  CropHeight = Abs(EndY - StartY)

  'Crop and repaint the image
  Lead1.SetDstClipRect CropLeft, CropTop, CropWidth, CropHeight
  Lead1.ForceRepaint
  Lead1.RubberBandVisible = False
  Lead1.MousePointer = 0 'Default
End If

12.	Select the Click procedure for the TrimBitmap object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

' Declare local variables
Dim XFactor, YFactor, NewTop, NewLeft, NewWidth, NewHeight
Dim HeightFactor, WidthFactor, HeightAllowed, WidthAllowed

DoCmd.Hourglass True

' Use the clipping rectangle's percentage offsets in the image rectangle
' to determine the trimmed rectangle in the bitmap.
' Using percentages allows for the possibility that the image is zoomed.
XFactor = Lead1.BitmapWidth / Lead1.DstWidth
YFactor = Lead1.BitmapHeight / Lead1.DstHeight
NewTop = (Lead1.DstClipTop - Lead1.DstTop) * YFactor
NewLeft = (Lead1.DstClipLeft - Lead1.DstLeft) * XFactor
NewWidth = Lead1.DstClipWidth * XFactor
NewHeight = Lead1.DstClipHeight * YFactor

' Make sure display rectangles are automatically adjusted.
Lead1.AutoSetRects = True

' Trim the bitmap.
Lead1.Trim NewLeft, NewTop, NewWidth, NewHeight

' Size and redisplay the control, using the new bitmap size.
' Set the variables used for preserving the aspect ratio.
' Allow for a border of 1/8 of the form size.
' The units of measure do not matter, since we are calculating proportions.
HeightFactor = Lead1.BitmapHeight
WidthFactor = Lead1.BitmapWidth
HeightAllowed = Me.WindowHeight - (Me.WindowHeight / 4)
WidthAllowed = Me.WindowWidth - (Me.WindowWidth / 4)

' Center the LEAD control on the form, preserving the aspect ratio.
' Check to see if using the maximum width will make the image too tall.
' Set the dimensions based on the result.
If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
  Me![Lead1].Left = Me.WindowWidth / 8
  Me![Lead1].Width = WidthAllowed
  Me![Lead1].Height = (Me![Lead1].Width * HeightFactor) / WidthFactor
  Me![Lead1].Top = (Me.WindowHeight - Me![Lead1].Height) / 2
Else
  Me![Lead1].Top = Me.WindowHeight / 8
  Me![Lead1].Height = HeightAllowed
  Me![Lead1].Width = (Me![Lead1].Height * WidthFactor) / HeightFactor
  Me![Lead1].Left = (Me.WindowWidth - Me![Lead1].Width) / 2
End If

' Turn off scroll bars to make sure we use the full client area.
Lead1.AutoScroll = False

' Set the image display size to match the LEAD control
Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight

'Display the image
Lead1.ForceRepaint
DoCmd.Hourglass False

13.	 Click the compile button on the toolbar; then close the code window.

14.	Close the form designer, saving the changes.

15.	With Form1 selected in the Database window, click the Open button to test the form. Notice that the text printed on the bitmap is scaled as part of the bitmap. If you zoom in, it becomes larger, and if you zoom out, it becomes smaller. The text printed on the control is the normal size for the system font and is not affected by zooming.


Creating, Viewing, and Merging Color Separations (Access 95 and 97)

Take the following steps to add code that creates CMYK color separations, displays each of the color planes, merges the planes, and displays the result. The code increases the contrast of the K plane to demonstrate how you can manipulate the color separations.

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

2.	 Select the Command Button control; then add a control to your form. (Cancel the Command Button Wizard when it appears.) Put the control at the top of the form to keep it away from the image.

3.	In the Properties box, change the Command Button control's Name property to DoSeparations and change the Caption property to Do Separations.

4.	Click the Code Window icon on the toolbar.

 For Access 95.

 For Access 97.

5.	Select the Click procedure for the DoSeparations object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

' Declare a local variable
Dim Msg

' Count the button clicks and take the next step with each click
Static ClickCount As Integer
DoCmd.Hourglass True

'Turn off the automatic display rectangles
Lead1.AutoSetRects = False

Select Case ClickCount
Case 0
  Lead1.ColorSeparate COLORSEP_CMYK

  'Just for fun, add contrast to the K plane
  Lead1.Bitmap = Lead1.ColorPlanes(3) 'Copy the K plane
  Lead1.Contrast 300 'Increase the contrast
  Lead1.ColorPlanes(3) = Lead1.Bitmap 'Update the K plane

  Msg = "Separated. Keep clicking to see separations, then merge"
  MsgBox Msg
Case 1
  Lead1.Bitmap = Lead1.ColorPlanes(0) 'Cyan
  Lead1.ForceRepaint
Case 2
  Lead1.Bitmap = Lead1.ColorPlanes(1) ' Magenta
  Lead1.ForceRepaint
Case 3
  Lead1.Bitmap = Lead1.ColorPlanes(2) ' Yellow
  Lead1.ForceRepaint
Case 4
  Lead1.Bitmap = Lead1.ColorPlanes(3) ' K
  Lead1.ForceRepaint
Case 5
  Lead1.ColorMerge COLORSEP_CMYK
  Lead1.ForceRepaint
  Lead1.ColorPlanes(0) = 0
  Lead1.ColorPlanes(1) = 0
  Lead1.ColorPlanes(2) = 0
  Lead1.ColorPlanes(3) = 0
  Msg = "Merged, with more contrast in the K plane"
  MsgBox Msg
Case Else
  ClickCount = -1
  Msg = "Cycle is finished"
  MsgBox Msg
End Select

ClickCount = ClickCount + 1
DoCmd.Hourglass False

6.	 Click the compile button on the toolbar; then close the code window.

7.	Close the form designer, saving the changes.

8.	With Form1 selected in the Database window, click the Open button to test the form. Notice that the text printed on the bitmap is scaled as part of the bitmap. If you zoom in, it becomes larger, and if you zoom out, it becomes smaller. The text printed on the control is the normal size for the system font and is not affected by zooming.


Updating a Gauge and Detecting a User Interrupt (Access 95 and 97)

Take the following steps to update a gauge during processing and detect a user interrupt:

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

2.	 Select the Command Button control; then add a control to your form. (Cancel the Command Button Wizard when it appears.) Put the control at the top of the form to keep it away from the image.

3.	In the Properties box, change the Command Button control's Name property to DoMedian and change the Caption property to Do Median.

4.	 Select the Command Button control; then add another control to your form. Put the control at the top of the form to keep it away from the image.

5.	In the Properties box, change the Command Button control's Name property to Quit and change the Caption property to Quit.

6.	Build a gauge consisting of a horizontal line [image] (Line1) inside a rectangle [image] (Box1). Put the gauge at the top of the form next to the Quit button.

7.	Click the Code Window icon on the toolbar.

 For Access 95.

 For Access 97.

8.	Select the Declarations module for the General object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

Dim fEscape As Integer 'Use to indicate the user interrupt
Dim fInProc As Integer 'Use to avoid closing the form during processing

9.	Select the Click procedure for the DoMedian object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

'Enable the ProgressStatus event
Lead1.EnableProgressEvent = True
'Initialize the indicators
fEscape = False 'The user does not want to quit
fInProc = True 'Processing is taking place
'Perform a relatively slow median filter
Lead1.Median 4
'Clean up
fInProc = False 'Processing is no longer taking place
Lead1.ForceRepaint

10.	Select the ProgressStatus procedure for the Lead1 object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

DoEvents 'Detect Windows events
If Not fEscape Then ' Look for the Click on the Quit button
  Me![Line1].Width = Me![Box1].Width * iPercent / 100 'Udpate the gauge
Else
  Lead1.EnableProgressEvent = False 'Cancel the task
End If

11.	Select the Click procedure for the Quit object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

fEscape = True 'The user wants to quit
Me![Line1].Width = 0 'Set the gauge back to the beginning

12.	Select the Unload procedure for the Form object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

If fInProc Then 'If processing is taking place
  Cancel = 1 'Do not let the user close the form
End If

13.	 Click the compile button on the toolbar; then close the code window.

14.	Close the form designer, saving the changes.

15.	With Form1 selected in the Database window, click the Open button to test the form.


Miscellaneous Examples (Access 95 and 97)

You can test any of the following examples by adding a command button to one of the previous lessons in the tutorial, and pasting the sample code in the Click procedure.

In most cases, you can add the button after the first lesson Loading and Displaying an Image. In cases where you need to zoom in or zoom out, you must first finish Zooming Out and Zooming In.

Note: You can use the Visual Basic examples for most cases in Access 95 and 97. These are the examples that are not exactly the same as in Visual Basic. In many cases, the differences are minor ones, such as the inclusion of the Hourglass command.

AnnSaveMemory example for Access 95 and 97

AutoTrim example for Access 95 and 97

BinaryFilter example for Access 95 and 97

Capture example for Access 95 and 97

ColorRes example for Access 95 and 97

Combine example for Access 95 and 97

CreateBitmap, Size, and Combine example for Access 95 and 97

dbCan... example for Access 95 and 97

DDB example for Access 95 and 97

DIB example for Access 95 and 97

FilePage Event Example for Access 95 and 97

GetBitmapDC example for Access 95 and 97

GetHistogram example for Access 95 and 97

GetMinMaxBits example for Access 95 and 97

GetMinMaxVal example for Access 95 and 97

GetServerBitmap example for Access 95 and 97

LoadInfo... example for Access 95 and 97

LoadMemory example for Access 95 and 97

ODBC Example for Access 95 and 97

Paint event example for Access 95 and 97

PaintEffect example for Access 95 and 97

PaintPalette example for Access 95 and 97

Render example for Access 95 and 97

Resize event example for Access 95 and 97

RgnChange example for Access 95 and 97

Save example for Access 95 and 97

SaveMemory example for Access 95 and 97

Scroll event example for Access 95 and 97

Underlay example for Access 95 and 97


AnnSaveMemory example for Access 95 and 97

Note: This topic is for Document/Medical  only.

This example lets you save the current annotations to a file in memory, and lets you load the annotations that were saved.

1.	Start with the project that you created in Creating and Using Annotations.

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

Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long

Dim hMem     As Long   ' For WIN16 this would be declared as Integer
Dim iSize    As Long

3.	 At the top of your main form, add two command buttons and name them as follows:

Name	Caption

AnnSaveMem	Save In Memory

AnnLoadMem	Load From Memory

4.	Code the AnnSaveMem button's Click procedure as follows:

hMem = 0
If Lead1.AnnSaveMemory(hMem, ANNFMT_NATIVE, False, iSize) <> 0 Then
   MsgBox ("Error calling AnnSaveMemory")
End If

5.	Code the AnnLoadMem button's Click procedure as follows:

'Load the annotations from the memory-resident file.
If Lead1.AnnLoadMemory(hMem, iSize) <> 0 Then
   MsgBox ("Error calling AnnLoadMemory")
Else
   MsgBox ("AnnLoadMemory succeeded")
End If
GlobalFree (hMem)

6.	Run your program to test it.


AutoTrim example for Access 95 and 97

This example scans a document and trims the edges.

'Declare local variables.
Dim SavedSetting, nRet, X, CalcHeight

'Make sure display rectangles are reset when we acquire the image.
Lead1.AutoSetRects = True

'Disable automatic repainting.
Lead1.AutoRepaint = False

'Acquire the image, allowing for possible mistakes.
SavedSetting = Lead1.EnableMethodErrors
Lead1.EnableMethodErrors = False
nRet = Lead1.Load("d:\temp\test.tif", 0, 1, 1)
If nRet <> 0 Then
    MsgBox "image not loaded"
    Lead1.EnableMethodErrors = SavedSetting
    GoTo FINISHED
End If
Lead1.EnableMethodErrors = SavedSetting

'Trim the edges of the acquired bitmap.
Lead1.AutoTrim (64)

'Use most of the window.
X = Me![Lead1].Section
Me![Lead1].Top = Me.Section(X).Height * 0.1
Me![Lead1].Left = Me.Width * 0.1
Me![Lead1].Width = Me.Width * 0.8
Me![Lead1].Height = Me.Section(X).Height * 0.8

'Set up for good display of a typical scanned document.
Lead1.BitonalScaling = BITONALSCALING_SCALETOGRAY
Lead1.AutoScroll = True
Lead1.DstWidth = Lead1.ScaleWidth 'Use the full control width.
Lead1.DstClipWidth = Lead1.ScaleWidth
CalcHeight = (Lead1.BitmapHeight * Lead1.ScaleWidth) / Lead1.BitmapWidth
Lead1.DstHeight = CalcHeight 'Use the proportional height.
Lead1.DstClipHeight = CalcHeight

'Enable automatic repainting.
Lead1.AutoRepaint = True
FINISHED:


BinaryFilter example for Access 95 and 97

This example does omni-directional erosion of black objects and repaints the image.

DoCmd.Hourglass True
Lead1.BinaryFilter BFLT_EROSION_OMNI
Lead1.ForceRepaint
DoCmd.Hourglass False


Capture example for Access 95 and 97

This example captures the current screen and displays the captured image with scroll bars.

' Declare local variables
Dim CaptureLeft, CaptureTop, CaptureWidth, CaptureHeight, OldMode

' Turn on the automatic display rectangles.
Lead1.AutoSetRects = True

' Set the scale mode to twips temporarily
OldMode = Lead1.ScaleMode
Lead1.ScaleMode = 1

CaptureLeft = 0
CaptureTop = 0
CaptureWidth = Me.WindowWidth
CaptureHeight = Me.WindowHeight
Lead1.Capture 0, CaptureLeft, CaptureTop, CaptureWidth, CaptureHeight
Lead1.AutoScroll = True
Lead1.ForceRepaint

'Set the scale mode to the previous mode
Lead1.ScaleMode = OldMode


ColorRes example for Access 95 and 97

This example checks to see if the bitmap is 8 bits per pixel and converts it if it is not.

If Lead1.BitmapBits <> 8 Then
    DoCmd.Hourglass True
    Lead1.ColorRes 8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0
    DoCmd.Hourglass False
    Lead1.ForceRepaint
End If


Combine example for Access 95 and 97

This example copies the Lead1 bitmap to Lead2, trims and filters the copied image, and combines the filtered image with the original Lead1 bitmap image. Trimming Lead2 lets you see the difference between filtered and nonfiltered regions.

' Declare local variables
Dim TrimLeft, TrimTop, TrimWidth, TrimHeight
Dim DstLeft, DstTop, DstWidth, DstHeight, SrcObj, SrcLeft, SrcTop

DoCmd.Hourglass True
Lead2.ScaleMode = 3
Lead1.ScaleMode = 3
Lead2.Bitmap = Lead1.Bitmap

TrimLeft = (Lead2.BitmapWidth * 0.2)
TrimTop = (Lead2.BitmapHeight * 0.2)
TrimWidth = (Lead2.BitmapWidth * 0.6)
TrimHeight = (Lead2.BitmapHeight * 0.6)
Lead2.Trim TrimLeft, TrimTop, TrimWidth, TrimHeight

Lead2.SpatialFilter (FLT_LINESEG_LTOR)

DstLeft = TrimLeft
DstTop = TrimTop
DstWidth = TrimWidth
DstHeight = TrimHeight
SrcObj = Lead2.Bitmap
SrcLeft = 0
SrcTop = 0
Lead1.Combine DstLeft, DstTop, DstWidth, DstHeight, SrcObj, SrcLeft, SrcTop, CB_OP_ADD

Lead1.ForceRepaint
DoCmd.Hourglass False


CreateBitmap, Size, and Combine example for Access 95 and 97

This example creates a bitmap for Lead2 (same size and BPS as Lead1) and fills it with green. It resizes the Lead1 bitmap, then uses a loop to do multiple combines with the Lead2 bitmap. It then copies the Lead2 bitmap to Lead1 and redisplays Lead1.

' Declare local variables
Dim MyWidth, MyHeight, MyBPS, ImageWidth, ImageHeight
Dim TestWidth, TestHeight, VFactor, VSpacing, HFactor, HSpacing
Dim SrcL, SrcT, SrcObj, DstT, DstL, DstW, DstH, MyOp, ViewWidth, ViewHeight

DoCmd.Hourglass True
Lead2.ScaleMode = 3
Lead1.ScaleMode = 3

' Create the Lead2 bitmap. (The control must already be on the form).
MyWidth = Lead1.BitmapWidth
MyHeight = Lead1.BitmapHeight
MyBPS = Lead1.BitmapBits
Lead2.CreateBitmap MyWidth, MyHeight, MyBPS
Lead2.Fill RGB(0, 255, 0) ' fill with green

' Resize the Lead1 bitmap
ImageWidth = CInt(MyWidth * 0.3)
ImageHeight = CInt(MyHeight * 0.3)
Lead1.Size ImageWidth, ImageHeight, RESIZE_RESAMPLE

' Initialize the variables used for multiple combines.
TestWidth = MyWidth ' Used for horizontal positioning
TestHeight = MyHeight ' Used for vertical positioning

VFactor = Int(MyHeight / ImageHeight) + 1 ' Number spaces between images
VSpacing = CInt((MyHeight Mod ImageHeight) / VFactor) ' Pixels between images

HFactor = Int(MyWidth / ImageWidth) + 1 ' Number spaces between images
HSpacing = CInt((MyWidth Mod ImageWidth) / HFactor) ' Pixels between images

DstT = VSpacing ' Top coordinate of the destination rectangle
SrcL = 0 ' Left coordinate of the source rectangle
SrcT = 0 ' Top coordinate of the source rectangle
SrcObj = Lead1.Bitmap
DstW = ImageWidth  ' Width of the destination rectangle
DstH = ImageHeight ' Height of the destination rectangle
MyOp = CB_OP_ADD + CB_DST_0 ' Operation flags used when combining images

' Do the loop that does the multiple combines
While TestHeight > ImageHeight ' Vertical loop
    DstT = MyHeight - TestHeight + VSpacing
    TestHeight = TestHeight - ImageHeight - VSpacing
    While TestWidth > ImageWidth 'Horizontal loop
        DstL = MyWidth - TestWidth + HSpacing
        TestWidth = TestWidth - ImageWidth - HSpacing
        Lead2.Combine DstL, DstT, DstW, DstH, SrcObj, SrcL, SrcT, MyOp
    Wend
    TestWidth = MyWidth
Wend

' Copy the Lead2 bitmap to Lead1
Lead1.Bitmap = Lead2.Bitmap

'Get the pixel dimensions of the LEAD control's client area.
ViewWidth  = Lead1.ScaleWidth
ViewHeight = Lead1.ScaleHeight

'Set the image display size to match the LEAD control
Lead1.SetDstRect 0, 0, ViewWidth, ViewHeight
Lead1.SetDstClipRect 0, 0, ViewWidth, ViewHeight
Lead1.ForceRepaint ' Repaint the image
DoCmd.Hourglass False


dbCan... example for Access 95 and 97

This example displays property values in a message box. You can implement this example by adding a button, with this code, to the project described in ODBC Example for Access 95 and 97.

Dim Msg, Style, Title, Response

Msg = "dbCanAppend = " & CStr(Lead1.dbCanAppend) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbCanRestart = " & CStr(Lead1.dbCanRestart) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbCanScroll = " & CStr(Lead1.dbCanScroll) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbCanUpdate = " & CStr(Lead1.dbCanUpdate) & "."

' dbCurrentRecord is 0 based
Msg = Msg & Chr(10) & Chr(13) & "dbCurrentRecord = " & CStr(Lead1.dbCurrentRecord) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbEditMode = " & CStr(Lead1.dbEditMode) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbIsBOF = " & CStr(Lead1.dbIsBOF) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbIsDeleted = " & CStr(Lead1.dbIsDeleted) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbIsEOF = " & CStr(Lead1.dbIsEOF) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbIsOpen = " & CStr(Lead1.dbIsOpen) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbLoadBits = " & CStr(Lead1.dbLoadBits) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbLockingMode = " & CStr(Lead1.dbLockingMode) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbRecordCount = " & CStr(Lead1.dbRecordCount) & "."

Style = vbOKOnly
Title = "LEADTOOLS ActiveX Database Properties"
Response = MsgBox(Msg, Style, Title)


DDB example for Access 95 and 97

This example copies the Lead1 bitmap to the clipboard as a DDB. It pastes the DDB into Lead2 and reverses the image. It then gets a DDB from Lead2, sets the same DDB to Lead1, and repaints.

Dim MyFlags, MyDC, MyDDB, MyPalette

DoCmd.Hourglass True
Me![Lead2].Visible = True
Me![Lead1].Visible = True
Lead1.AutoSetRects = False

MyFlags = COPY_EMPTY + COPY_DDB + COPY_PALETTE
Lead1.Copy MyFlags

If Lead2.Paste(PASTE_ISREADY) = 0 Then
    MsgBox ("Invalid data on the clipboard")
Else
    Lead2.Paste 0
End If

Lead2.Reverse

MyDC = Lead2.GetClientDC
MyDDB = Lead2.GetDDB(MyDC)
MyPalette = Lead2.GetPalette(MyDC)

Lead1.SetDDB MyDC, MyDDB, MyPalette
Lead1.ForceRepaint
Lead2.ReleaseClientDC

Me![Lead2].Visible = False
DoCmd.Hourglass False


DIB example for Access 95 and 97

This example copies the Lead1 bitmap to the clipboard as a DIB. It pastes the DIB into Lead2 and reverses the image. It then gets a DIB from Lead2, sets the same DIB to Lead1, and repaints.

Dim MyFlags, MyDib
Lead1.AutoSetRects = False
DoCmd.Hourglass True
MyFlags = COPY_EMPTY + COPY_DIB + COPY_PALETTE
Lead1.Copy MyFlags

If Lead2.Paste(PASTE_ISREADY) = 0 Then
    MsgBox ("Invalid data on the clipboard")
Else
    Lead2.Paste 0
End If

Lead2.Reverse
MyDib = Lead2.GetDIB
Lead1.SetDIB MyDib
Lead1.ForceRepaint
DoCmd.Hourglass False


FilePage Event Example for Access 95 and 97

This example shows how the FilePage event can be used to size and position a lead control when an image is loaded.

Private Sub Lead1_FilePage()
   Dim HeightFactor, WidthFactor  ' Factors for aspect ratio
   Dim HeightAllowed, WidthAllowed  ' Maximum width and height
   Dim Width, Height, Left, Top  ' Variables for control dimensions

   ' Set the variables used for preserving the aspect ratio.
   'Allow for a border of 1/8 of the form size.
   'The units of measure do not matter, since we are calculating proportions.
   HeightFactor = Lead1.InfoHeight
   WidthFactor = Lead1.InfoWidth
   HeightAllowed = Me.WindowHeight * 3 / 4
   WidthAllowed = Me.WindowWidth * 3 / 4

   'Center the LEAD control on the form, preserving the aspect ratio.
   'Check to see if using the maximum width will make the image too tall.
   'Set the dimensions based on the result.
   If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
     Lead1.Left = Me.WindowWidth / 8
     Lead1.Width = WidthAllowed
     Lead1.Height = (Lead1.Width * HeightFactor) / WidthFactor
     Lead1.Top = (Me.WindowHeight - Lead1.Height) / 2
   Else
     Lead1.Top = Me.WindowHeight / 8
     Lead1.Height = HeightAllowed
     Lead1.Width = (Lead1.Height * WidthFactor) / HeightFactor
     Lead1.Left = (Me.WindowWidth - Lead1.Width) / 2
   End If

   ' Turn off scroll bars and automatic display rectangles.
   Lead1.AutoScroll = False
   Lead1.AutoSetRects = False

   ' Set the image display size to match the LEAD control.
   Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
   Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
   Lead1.ForceRepaint ' Repaint the image
End Sub


GetBitmapDC example for Access 95 and 97

Take the following steps to demonstrate how GDI functions can be used to print text on the bitmap and on the control. The text printed on the bitmap is a permanent part of the bitmap and becomes permanent if the bitmap is saved; whereas the text on the control is superficial and does not affect the bitmap.

Note: For an easier way of drawing text, refer to the DrawText example.

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

2.	In the Database window, select the Modules tab, and click the New button.

3.	Add the following public declarations and constants to support the GDI functions. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it. (Refer to the Access documentation for instructions on using API functions.)

Public Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Public Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long
Global Const SYSTEM_FONT = 13
Global Const TRANSPARENT = 1

4.	Close the file, and save it as the GDI Declarations module.

5.	In the Database window, select the Forms tab, select Form1, and click the Design button.

6.	 Select the Command Button control; then add a control to your form. (Cancel the Command Button Wizard when it appears.) Put the control at the top of the form to keep it away from the image.

7.	In the Properties box, change the Command Button control's Name property to PrintText and change the Caption property to Print Text.

8.	Click the Code Window icon on the toolbar.

 For Access 95.

 For Access 97.

9.	Select the Click procedure for the PrintText object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

' Declare some local variables
Dim LeadDC, hfnt, hOldFont, MyReturn, mystring$, LeadClientDC

' Ensure that the Lead control is visible
Me![Lead1].Visible = True

' First, print text on the bitmap.
'Create a device context for the bitmap that the GDI functions can access
LeadDC = Lead1.GetBitmapDC

' Get the system font and select it. The old font is saved so that it can be restored.
' Using other fonts is more complex. Refer to the Windows API documentation.
hfnt = GetStockObject(SYSTEM_FONT)
hOldFont = SelectObject(LeadDC, hfnt)

' Make the background transparent, so that the text will overlay the image
MyReturn = SetBkMode(LeadDC, TRANSPARENT)

' Assign the string value
mystring$ = "Text on the bitmap"

' Print the text on the bitmap. This is a permanent change in the bitmap
MyReturn = TextOut(LeadDC, 20, 40, mystring$, Len(mystring$))

' Restore the previous font
MyReturn = SelectObject(LeadDC, hOldFont)
'Remove the lock from the device control
Lead1.ReleaseBitmapDC

' Repaint the part of the image that has changed
Lead1.BackErase = False
Lead1.ForceRepaint

' Allow full repainting again
Lead1.BackErase = True

' Next, print text on the control.
' Create a device context for the control that the GDI functions can access
LeadClientDC = Lead1.GetClientDC

' Get the system font and select it. The old font is saved so that it can be restored.
' Using other fonts is more complex. Refer to the Windows API documentation.
hfnt = GetStockObject(SYSTEM_FONT)
hOldFont = SelectObject(LeadDC, hfnt)

' Make the background transparent, so that the text will overlay the image
MyReturn = SetBkMode(LeadClientDC, TRANSPARENT)

' Assign the string value
mystring$ = "Text on the LEAD control"

' Print the text on the control. This is an overlay that does not affect the bitmap.
MyReturn = TextOut(LeadClientDC, 20, 80, mystring$, Len(mystring$))

' Restore the previous font
MyReturn = SelectObject(LeadClientDC, hOldFont)

' Remove the lock from the device control
Lead1.ReleaseClientDC

10.	 Click the compile button on the toolbar; then close the code window.

11.	Close the form designer, saving the changes.

12.	With Form1 selected in the Database window, click the Open button to test the form. Notice that the text printed on the bitmap is scaled as part of the bitmap. If you zoom in, it becomes larger, and if you zoom out, it becomes smaller. The text printed on the control is the normal size for the system font and is not affected by zooming.


GetHistogram example for Access 95 and 97

The following code does a CMYK separation and uses a histogram to find the brightest and darkest intensities in the K plane of the bitmap. It then remaps the intensities to use the full range and merges the color planes to recreate the bitmap:

' Declare local variables
Dim MyIndex, Brightest, Darkest, CurrentRange, Offset

DoCmd.Hourglass True

'Do a CMYK color separation and copy the K plane to the bitmap
Lead1.ColorSeparate COLORSEP_CMYK
Lead1.Bitmap = Lead1.ColorPlanes(3) 'Copy the K plane

'Load the histogram
Lead1.GetHistogram CHANNEL_MASTER

'Find the brightest and darkest intensities in the image
MyIndex = 0
Brightest = 0
Darkest = -1
While (MyIndex < 256)
    If Lead1.HistogramTable(MyIndex) > 0 Then
        Brightest = MyIndex
        If (Darkest = -1) Then
            Darkest = MyIndex
        End If
    End If
    MyIndex = MyIndex + 1
Wend

'Remap the intensities to use the full range
MyIndex = Darkest
CurrentRange = Brightest - Darkest
If CurrentRange > 0 Then
    While (MyIndex <= Brightest)
        Offset = MyIndex - Darkest
        Lead1.RemapTable(MyIndex) = (255 * Offset) / CurrentRange
        MyIndex = MyIndex + 1
    Wend
    Lead1.RemapIntensity CHANNEL_MASTER
End If

'Merge the color planes and free them from memory
Lead1.ColorPlanes(3) = Lead1.Bitmap 'Update the K plane
Lead1.ColorMerge COLORSEP_CMYK
Lead1.ColorPlanes(0) = 0
Lead1.ColorPlanes(1) = 0
Lead1.ColorPlanes(2) = 0
Lead1.ColorPlanes(3) = 0

'Set the image display size to match the LEAD control
Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
Lead1.ForceRepaint
DoCmd.Hourglass False


GetMinMaxBits example for Access 95 and 97

Note: This topic is for Document/Medical  only.

The following example retrieves the values for MinBit and MaxBit using GetMinMaxBits and writes the results.

    Lead1.GetMinMaxBits
    Text1.SetFocus
    Text1.Text = CStr(Lead1.MinBit)
    Text2.SetFocus
    Text2.Text = CStr(Lead1.MaxBit)


GetMinMaxVal example for Access 95 and 97

Note: This topic is for Document/Medical  only.

The following example retrieves the values for MinVal and MaxVal using GetMinMaxVal and writes the results.

'must call GetMinMaxVal first
    Lead1.GetMinMaxVal
    Text3.SetFocus
    Text3.Text = CStr(Lead1.MinVal)
    Text4.SetFocus
    Text4.Text = CStr(Lead1.MaxVal)


GetServerBitmap example for Access 95 and 97

This example copies a bitmap from a LEAD OLE Server, flips the bitmap, then copies the bitmap back to the server. To test this example, you must add an OLE control to your form and specify LEAD Image as the object type.

OLE1.Verb = acOLEVerbHide
OLE1.Action = acOLEActivate
Lead1.GetServerBitmap OLE1.LpOleObject
Lead1.Flip
Lead1.SetServerBitmap OLE1.LpOleObject


LoadInfo example for Access 95 and 97
LoadInfo... example for Access 95 and 97

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.	 Add a CommandButton control and code its click procedure as follows:

Private Sub Command4_Click()
    Lead1.ScaleMode = 3 'Pixels

    'Make the image look OK as a 1-bit image.
    Lead1.Size Lead1.ScaleWidth, Lead1.ScaleHeight, RESIZE_RESAMPLE
    Lead1.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 = Lead1.BitmapHeight
    MyInfoOffset = 0
    MyInfoWidth = Lead1.BitmapWidth
    MyInfoXRes = Lead1.BitmapXRes
    MyInfoYRes = Lead1.BitmapYRes

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

    'Repaint the newly loaded image.
    Lead1.ForceRepaint

End Sub

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

Private Sub Lead1_LoadInfo()
    'Use the form-level variables to supply format information.
    Lead1.LoadInfoBits = MyInfoBits
    Lead1.LoadInfoFlags = MyInfoFlags
    Lead1.LoadInfoFormat = MyInfoFormat
    Lead1.LoadInfoHeight = MyInfoHeight
    Lead1.LoadInfoOffset = MyInfoOffset
    Lead1.LoadInfoWidth = MyInfoWidth
    Lead1.LoadInfoXRes = MyInfoXRes
    Lead1.LoadInfoYRes = MyInfoYRes
End Sub

5.	Run your program to test it.


LoadMemory example for Access 95 and 97

This example uses WIN32 API calls to load a file into memory, then uses the LoadMemory method to load the memory-resident file into a bitmap.

' Declare WIN32 API constants and functions in the Declarations module.

Private Const OF_READ = &H0
Private Const OF_CREATE = &H1000
Private Const SEEK_SET = 0  '  seek to an absolute position
Private Const SEEK_END = 2  '  seek relative to end of file
Private Const GMEM_MOVEABLE = &H2
Private Const OFS_MAXPATHNAME = 128
Private Type OFSTRUCT
        cBytes As Byte
        fFixedDisk As Byte
        nErrCode As Integer
        Reserved1 As Integer
        Reserved2 As Integer
        szPathName(OFS_MAXPATHNAME) As Byte
End Type

Private Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Private Declare Function hread Lib "kernel32" Alias "_hread" (ByVal hFile As Long, ByVal lpBuffer As Long, ByVal lBytes As Long) As Long
Private Declare Function hwrite Lib "kernel32" Alias "_hwrite" (ByVal hFile As Long, ByVal lpBuffer As Long, ByVal lBytes As Long) As Long
Private Declare Function lclose Lib "kernel32" Alias "_lclose" (ByVal hFile As Long) As Long
Private Declare Function llseek Lib "kernel32" Alias "_llseek" (ByVal hFile As Long, ByVal lOffset As Long, ByVal iOrigin As Long) As Long
Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) As Long

' ---------------------- Code for LoadMemory (32 bit) -------------

Private Sub Form_Activate()
  DoCmd.Maximize
  Me.ScrollBars = False
  Me.Painting = True
   Dim hf As Long
   Dim hMem As Long
   Dim lpMem As Long
   Dim iSize As Long
   Dim of As OFSTRUCT
   Dim nRet As Long
   ' Load the file into memory.
   hf = OpenFile("c:\lead\images\image1.cmp", of, OF_READ)
   If hf = -1 Then
      MsgBox ("Error opening file!")
      GoTo quit_loadmemory
   End If
   iSize = llseek(hf, 0, SEEK_END)
   nRet = llseek(hf, 0, SEEK_SET)
   hMem = GlobalAlloc(GMEM_MOVEABLE, iSize)
   If hMem = -1 Then
      lclose (hf)
      MsgBox ("Not enough memory to hold the file in memory!")
      GoTo quit_loadmemory
   End If
   lpMem = GlobalLock(hMem)
   If lpMem = 0 Then
      lclose (hf)
      GlobalFree (hMem)
      MsgBox ("Not enough memory to hold the file in memory!")
      GoTo quit_loadmemory
   End If
   If hread(hf, lpMem, iSize) < iSize Then
      lclose (hf)
      GlobalUnlock (hMem)
      GlobalFree (hMem)
      MsgBox ("Error reading file")
      GoTo quit_loadmemory
   End If
   lclose (hf)
   GlobalUnlock (hMem)
   'Load the bitmap from the memory-resident file.
   If Lead1.LoadMemory(hMem, 0, 0, -1, iSize) <> 0 Then
      MsgBox ("Error calling LoadMemory")
   Else
      MsgBox ("LoadMemory succeeded")
   End If
   GlobalFree (hMem)
quit_loadmemory:

End Sub


ODBC Example for Access 95 and 97

Take the following steps to create and use a simple database, containing only images. (For a more sophisticated approach, refer to Using ODBC to Access Image Data.)

1.	Start Microsoft Access 95 or 97.

2.	Select Blank Database, and click OK.

3.	Specify c:\lead.mdb as the database name and click Create.

4.	In the Database window, select the Tables tab, and click the New button.

5.	In the New Table window, select Design View and click OK.

6.	In the table designer, specify one field as follows:

Field Name: 	photo
Data Type: 	OLE Object

7.	Close the table designer, saving the table with the following name:

Table Name: 	ltacpic

8.	In the Windows Control Panel, start the 32bit ODBC administrator and click the Add button.

9.	Select Microsoft Access driver and click the OK button.

10.	Enter the name LEADACCESS.

11.	Click the Select directory button and select the c:\ root directory.

12.	Click the OK button; click the next OK button; then click the Close button.

13.	Return to Access.

14.	In the Database window, select the Forms tab, and click the New button.

15.	In the New Form window, select Design View and click OK.

16.	Click and drag the form's detail area to make it 5 1/2 inches deep (large enough to fill the screen when you maximize it.)

17.	On the Insert pull-down menu, use the Custom Control option to select the Lead Control.

18.	Click the OK button. The lead control appears on the form.

19.	Drag the Lead control halfway down the form so that you will have room for command buttons later. (You do not need to resize the control, because you will add code to size and position it at runtime.)

20.	In the properties box, change the name of the control to Lead1.

21.	At the top of your main form, add seven command buttons and name them as follows:

Name	Caption

RFirst	|<

RNext	>

RPrev	<

RLast	>|

RUpdate	Flip

RAdd	Add

22.	Also at the top of the form, add a Combo Box, and set its properties as follows:

Name: SelectedFile

Row Source Type: Value List

Row Source: c:\lead\images\image1.cmp;c:\lead\images\image2.cmp

Default Value: "nothing"

23.	Click the Code Window icon on the toolbar.

 For Access 95.

 For Access 97.

24.	Select the Activate procedure for Form1, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

' Declare local variables
Dim HeightAllowed, WidthAllowed, DString, msg, answer

' Set up the application window
DoCmd.Maximize
Me.ScrollBars = False
Me.Painting = True

' Set the position and size of the LEAD control.
' Allow for a border of 1/8 of the form size.

'The units of measure do not matter, since we are calculating proportions.
HeightAllowed = Me.WindowHeight * 3 / 4
WidthAllowed = Me.WindowWidth * 3 / 4

Lead1.Left = (Me.WindowWidth - WidthAllowed) / 2
Lead1.Top = (Me.WindowHeight - HeightAllowed) / 2
Lead1.Width = WidthAllowed
Lead1.Height = HeightAllowed

'Turn off automatic repainting and turn on scroll bars.
Lead1.AutoRepaint = False
Lead1.AutoScroll = True

'Set the image display size to match the LEAD control
Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight

' Display the LEAD control.
Lead1.BorderStyle = 1

' Open the database.
DString = "ODBC;DSN=LEADACCESS"
Lead1.dbOpen DString, "ltacpic", "photo", DB_OPENOPTIONS_NONE
Lead1.dbLoadBits = 24
Lead1.dbLockingMode = DB_LOCKINGMODE_OPTIMISTIC
Lead1.ForceRepaint
If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
  msg = "The database is empty."
  answer = MsgBox(msg, 0, "Notice")
  RNext.Enabled = False
  RPrev.Enabled = False
End If

25.	For the RAdd button, add the following code to the click procedure:

Dim msg, answer, filename, nRet, ErrorStatus
ErrorStatus = Lead1.EnableMethodErrors
Lead1.EnableMethodErrors = False
If Lead1.dbCanAppend = False Then
    msg = "You cannot add to this database."
    answer = MsgBox(msg, 0, "Error")
    GoTo endofadd
End If

filename = Dir(SelectedFile.Value)
If filename = "" Then
    msg = "Specified file does not exist."
    answer = MsgBox(msg, 0, "Error")
    GoTo endofadd
End If

Lead1.dbAddNew

nRet = Lead1.Load(SelectedFile.Value, 0, 0, 1)
If nRet <> 0 Then
    msg = "Invalid file format."
    answer = MsgBox(msg, 0, "Error")
    GoTo endofadd
End If

nRet = Lead1.dbUpdate(FILE_CMP, 24, QFACTOR_QMS)
If nRet <> 0 Then
    msg = "You cannot update this database."
    answer = MsgBox(msg, 0, "Error")
    GoTo endofadd
End If

Lead1.dbMoveLast
Lead1.ForceRepaint
msg = "Image added to the database."
answer = MsgBox(msg, 0, "LEAD")
RNext.Enabled = True
RPrev.Enabled = True
If Lead1.dbIsBOF = True Then
  RPrev.Enabled = False
Else
  RPrev.Enabled = True
End If

If Lead1.dbIsEOF = True Then
  RNext.Enabled = False
Else
  RNext.Enabled = True
End If

endofadd:
Lead1.EnableMethodErrors = ErrorStatus

26.	For the RUpdate button, add the following code to the click procedure:

Dim msg, answer
If Lead1.dbCanUpdate = False Then
    msg = "You cannot update this database."
    answer = MsgBox(msg, 0, "Error")
ElseIf Lead1.dbIsBOF = True Or Lead1.dbIsEOF = True Then
    msg = "There is no current record."
    answer = MsgBox(msg, 0, "Error")
Else
    If Lead1.dbEditMode = DB_EDITMODE_NONE Then
        Lead1.dbEdit
        Lead1.Flip
        Lead1.ForceRepaint
    End If
    Lead1.dbUpdate FILE_CMP, 0, QFACTOR_QMS
End If

27.	For the RDelete button, add the following code to the click procedure:

Dim msg, answer
If Lead1.dbCanUpdate = False Then
    msg = "You cannot update this database."
    answer = MsgBox(msg, 0, "Error")
ElseIf Lead1.dbIsBOF = True Or Lead1.dbIsEOF = True Then
    msg = "There is no current record."
    answer = MsgBox(msg, 0, "Error")
Else
    Lead1.dbDelete
    Lead1.dbRequery
    Lead1.dbMoveFirst
    If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
      RNext.Enabled = False
      RPrev.Enabled = False
    End If
    Lead1.ForceRepaint
End If

28.	For the RFirst button, add the following code to the click procedure:

Dim msg, answer
If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
    msg = "The database is empty."
    answer = MsgBox(msg, 0, "Notice")
    RNext.Enabled = False
    RPrev.Enabled = False
Else
    Lead1.dbMoveFirst
    RPrev.Enabled = False
    RNext.Enabled = True
    Lead1.ForceRepaint
End If

29.	For the RNext button, add the following code to the click procedure:

Dim msg, answer
If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
    Lead1.SetFocus
    RPrev.Enabled = False
    RNext.Enabled = False
    msg = "The database is empty."
    answer = MsgBox(msg, 0, "Notice")
Else
      Lead1.dbMoveNext
      If Lead1.dbIsEOF = True Then
        Lead1.SetFocus
        RNext.Enabled = False
        Lead1.dbMovePrev
        msg = "Already at last record."
        answer = MsgBox(msg, 0, "Notice")
      Else
        RPrev.Enabled = True
      End If
      Lead1.ForceRepaint
End If

30.	For the RPrev button, add the following code to the click procedure:

Dim msg, answer
If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
    Lead1.SetFocus
    RPrev.Enabled = False
    RNext.Enabled = False
    msg = "The database is empty."
    answer = MsgBox(msg, 0, "Notice")
Else
      Lead1.dbMovePrev
      If Lead1.dbIsBOF = True Then
         Lead1.SetFocus
         RPrev.Enabled = False
         Lead1.dbMoveNext
         msg = "Already at first record."
         answer = MsgBox(msg, 0, "Notice")
      Else
         RNext.Enabled = True
      End If
      Lead1.ForceRepaint
End If

31.	For the RLast button, add the following code to the click procedure:

Dim msg, answer
If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
    msg = "The database is empty."
    answer = MsgBox(msg, 0, "Notice")
    RNext.Enabled = False
    RPrev.Enabled = False
Else
    Lead1.dbMoveLast
    RNext.Enabled = False
    RPrev.Enabled = True
    Lead1.ForceRepaint
End If

32.	Add the following code to the main form's unload procedure:

Lead1.dbClose

33.	 Click the compile button on the toolbar; then close the code window.

34.	Close the form designer, saving the changes.

35.	With Form1 selected in the Database window, click the Open button to test the form.

To add a file to the database, specify its path name in the Combo Box.


Paint event, Enabled property, and hWnd property example for Access 95 and 97
Paint event example for Access 95 and 97

This example uses some Windows API functions to demonstrate the following:

 Paint event

 Click event

 Enabled property

 hWnd property

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

2.	In the Database window, select the Modules tab, and click the New button.

3.	Add the following public type definitions and declarations to support the GDI functions. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it. (Refer to the Access documentation for instructions on using API functions.)

Type POINTAPI
        x As Long
        y As Long
End Type
Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type
Public MyRect As RECT
Public MyPoint As POINTAPI
Public Declare Function InvalidateRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT, ByVal bErase As Long) As Long
Public Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, lpPoint As POINTAPI) As Long
Public Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long

4.	Close the file, and save it as the Paint event module.

5.	In the Database window, select the Forms tab, select Form1, and click the Design button.

6.	 Select the Command Button control; then add a control to your form. (Cancel the Command Button Wizard when it appears.) Put the control at the top of the form to keep it away from the image.

7.	In the Properties box, change the Command Button control's Name property to Toggle and change the Caption property to Toggle.

8.	Select the Text Box control; then add a control to your form. (Delete the label portion of the text box.) Put the control at the top of the form to keep it away from the image.

9.	In the Properties box, change the Text Box control's Name property to Directions and change its Default Value property to the following:

"Use the Toggle button to turn on or turn off Click-Splat"

10.	Click the Code Window icon on the toolbar.

 For Access 95.

 For Access 97.

11.	Select the Click procedure for the Toggle object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

If Lead1.Enabled = False Then
  Lead1.Enabled = True
  Directions.Value = "Click on the image for a splat"
  Toggle.Caption = "Disable"
Else
  Lead1.Enabled = False
  Directions.Value = "Click does nothing"
  Toggle.Caption = "Enable"
End If

12.	Select the Click procedure for the Lead1 object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

' Declare local variables
Dim SavedMode, MyWindow

' Use pixels for API calls
SavedMode = Lead1.ScaleMode
Lead1.ScaleMode = 3 'Pixels

' Use InvalidateRect to generate a paint message
MyWindow = Lead1.hwnd
MyRect.Left = 0
MyRect.Top = 0
MyRect.Bottom = Lead1.ScaleHeight
MyRect.Right = Lead1.ScaleWidth
InvalidateRect MyWindow, MyRect, True

' Set the ScaleMode back to the default
Lead1.ScaleMode = SavedMode

13.	Select the Paint procedure for the Lead1 object, and add the following code. In online help, you can select the block of code with the mouse, then press Ctrl-C to copy it.

' Declare local variables
Dim xStart, yStart, xDelta, yDelta, xEnd, yEnd, MyReturn, i, LeadClientDC

' Create a device context for the control that the GDI functions can access
LeadClientDC = Lead1.GetClientDC

' Draw random lines on the control. This is an overlay that does not affect the bitmap.
xStart = Rnd * Lead1.ScaleWidth
yStart = Rnd * Lead1.ScaleHeight
MyPoint.x = 0
MyPoint.y = 0
MyReturn = MoveToEx(LeadClientDC, xStart, yStart, MyPoint)
For i = 1 To 50
    xDelta = (Rnd * 80) - 40  ' -40 to 40
    yDelta = (Rnd * 80) - 40  ' -40 to 40
    xEnd = xStart + xDelta
    yEnd = yStart + yDelta
    MyReturn = LineTo(LeadClientDC, xEnd, yEnd)
    MyReturn = MoveToEx(LeadClientDC, xStart, yStart, MyPoint)
Next i

' Remove the lock from the device control
Lead1.ReleaseClientDC

14.	 Click the compile button on the toolbar; then close the code window.

15.	Close the form designer, saving the changes.

16.	With Form1 selected in the Database window, click the Open button to test the form.


PaintEffect example for Access 95 and 97

The following modules use the KeyDown and KeyUp events to repaint the image with effects.

Private Sub Lead1_KeyDown(KeyCode As Integer, ByVal Shift As Integer)
If KeyCode = 76 Then 'Code for lowercase l
   Lead1.AutoRepaint = False
   Lead1.BackErase = True
   Lead1.EffectGrain = 20
   Lead1.EffectDelay = 50
   Lead1.WandSize = 5
   Lead1.WandColor = RGB(255,255,0)   'Yellow Wand
   Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R
   Lead1.ForceRepaint
End If
End Sub

Private Sub Lead1_KeyUp(KeyCode As Integer, ByVal Shift As Integer)
If KeyCode = 76 Then 'Code for lowercase l
   Lead1.PaintEffect = EFX_EFFECT_WIPE_R_TO_L
   Lead1.ForceRepaint
   Lead1.PaintEffect = EFX_EFFECT_NONE
End If
End Sub


PaintPalette example for Access 95 and 97

This example sets the paint palette to the palette of each Lead control. It then loads two images and dithers them to 8 bits per pixel with optimized palettes, and displays them side by side.  In 8-bit display mode, you can see the palette problems that result when you do not use a fixed palette.

' Declare local variables
Dim HeightFactor1, WidthFactor1, HeightFactor2, WidthFactor2, HeightAllowed, WidthAllowed
Dim ImageHeight1, ImageWidth1, ImageHeight2, ImageWidth2
Dim ImageLeft2, ImageTop2, ImageLeft1, ImageTop1

' Make the LEAD controls invisible
Me![Lead1].Visible = False
Me![Lead2].Visible = False

' Clear the bitmaps from memory
Lead1.Bitmap = 0
Lead2.Bitmap = 0

' Turn off the foreground palette
Lead1.ForePalette = False
Lead2.ForePalette = False

'Clear the paint palette
Lead1.PaintPalette = PAINTPALETTE_AUTO
Lead2.PaintPalette = PAINTPALETTE_AUTO

' Disable automatic repainting of the image.
Lead1.AutoRepaint = False
Lead2.AutoRepaint = False

' Turn off scroll bars to make sure we use the full client area.
Lead1.AutoScroll = False
Lead2.AutoScroll = False

DoCmd.Hourglass True

' Load the bitmaps. These hard-coded path names may be different on your system.
Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1
Lead2.Load "c:\lead\images\image2.cmp", 0, 0, 1

' Change the bitmaps to 8 BPS with optimized palettes
Lead1.ColorRes 8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0
Lead2.ColorRes 8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0

' Make the controls visible so that we can size and position them.
Me![Lead1].Visible = True
Me![Lead2].Visible = True

'Set the variables used for preserving the aspect ratio.
HeightFactor1 = Lead1.BitmapHeight
WidthFactor1 = Lead1.BitmapWidth
HeightFactor2 = Lead2.BitmapHeight
WidthFactor2 = Lead2.BitmapWidth
HeightAllowed = Me.WindowHeight * 0.8
WidthAllowed = Me.WindowWidth * 0.45

'Center each LEAD control on half of the form, preserving the aspect ratio.
'Check to see if using the maximum width will make the image too tall.
'Set the dimensions based on the result.
If (WidthAllowed * HeightFactor1) / WidthFactor1 < HeightAllowed Then
  Me![Lead1].Left = (Me.WindowWidth / 4) - (WidthAllowed / 2)
  Me![Lead1].Width = WidthAllowed
  Me![Lead1].Height = (Me![Lead1].Width * HeightFactor1) / WidthFactor1
  Me![Lead1].Top = (Me.WindowHeight - Me![Lead1].Height) / 2
Else
  Me![Lead1].Top = (Me.WindowHeight - HeightAllowed) / 2
  Me![Lead1].Height = HeightAllowed
  Me![Lead1].Width = (Me![Lead1].Height * WidthFactor1) / HeightFactor1
  Me![Lead1].Left = (Me.WindowWidth / 4) - (Me![Lead1].Width / 2)
End If

If (WidthAllowed * HeightFactor2) / WidthFactor2 < HeightAllowed Then
  Me![Lead2].Left = (Me.WindowWidth * 3 / 4) - (WidthAllowed / 2)
  Me![Lead2].Width = WidthAllowed
  Me![Lead2].Height = (Me![Lead2].Width * HeightFactor2) / WidthFactor2
  Me![Lead2].Top = (Me.WindowHeight - Me![Lead2].Height) / 2
Else
  Me![Lead2].Top = (Me.WindowHeight - HeightAllowed) / 2
  Me![Lead2].Height = HeightAllowed
  Me![Lead2].Width = (Me![Lead2].Height * WidthFactor2) / HeightFactor2
  Me![Lead2].Left = (Me.WindowWidth * 3 / 4) - (Me![Lead2].Width / 2)
End If

'Set the image display sizes to match the LEAD controls
ImageHeight1 = Lead1.ScaleHeight
ImageWidth1 = Lead1.ScaleWidth
Lead1.SetDstRect 0, 0, ImageWidth1, ImageHeight1
Lead1.SetDstClipRect 0, 0, ImageWidth1, ImageHeight1

'Set the image display sizes to match the LEAD controls
ImageHeight2 = Lead2.ScaleHeight
ImageWidth2 = Lead2.ScaleWidth
Lead2.SetDstRect ImageLeft2, ImageTop2, ImageWidth2, ImageHeight2
Lead2.SetDstClipRect ImageLeft2, ImageTop2, ImageWidth2, ImageHeight2

'Display the images
Lead1.ForceRepaint
Lead2.ForceRepaint
DoCmd.Hourglass False

' Show differences
MsgBox "Currently using Access palette. Click to paint Lead1 with forepalette"
Lead1.ForePalette = True
Lead1.ForceRepaint
MsgBox "Click to paint Lead2 with forepalette"
Lead2.ForePalette = True
Lead2.ForceRepaint


Render example for Access 95 and 97

This example demonstrates the Render method.

' Declare local variables
Dim HeightFactor, WidthFactor, HeightAllowed, WidthAllowed
Dim ControlWidth, ControlHeight, MyPrinter

' Set the variables used for preserving the aspect ratio.
HeightFactor = Lead1.BitmapHeight
WidthFactor = Lead1.BitmapWidth

' Allow a maximum of 6x6 inches on a 300dpi printer
HeightAllowed = 1800
WidthAllowed = 1800

' Print the LEAD control, preserving the aspect ratio.
' Check to see if using the maximum width will make the image too tall.
' Set the dimensions based on the result.
If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
    ControlWidth = WidthAllowed
    ControlHeight = (ControlWidth * HeightFactor) / WidthFactor
Else
    ControlHeight = HeightAllowed
    ControlWidth = (ControlHeight * WidthFactor) / HeightFactor
End If

MyPrinter = Lead1.PrintStart
Lead1.Render MyPrinter, 0, 0, ControlWidth, ControlHeight
Lead1.PrintEnd MyPrinter


Resize event example for Access 95 and 97

This example demonstrates the Resize event.

Private Sub Lead1_Resize()
    'Before using this example you must add a text box to your form.
    'Then, you can exercise this example by coding a command button that
    'changes the width and height of the Lead1 control
    Text1.Value = "Control size: " + CStr(Me![Lead1].Width) + " x " + CStr(Me![Lead1].Height)
End Sub


RgnChange example for Access 95 and 97

The following code for the RgnChange event updates a text box using the GetRgnArea method. You can test it by adding a text box for the lesson described in Outlining, Dragging, and Pasting a Region.

Private Sub Lead1_RgnChange()
    'Declare a local variable.
    Dim MyText As String
    MyText = "Number of pixels in region: "
    MyText = MyText + CStr(Lead1.GetRgnArea)
    Text1.SetFocus
    Text1.Text = MyText
End Sub


Save example for Access 95 and 97

This example saves the image as a PNG file, loads the new file, and redisplays the bitmap.

DoCmd.Hourglass True
Lead1.Save "c:\lead\images\tmp.png", FILE_PNG, 8, 1, SAVE_OVERWRITE
Lead1.Load "c:\lead\images\tmp.png", 0, 0, 1
Lead1.ForceRepaint
DoCmd.Hourglass False


SaveMemory example for Access 95 and 97

This example uses SaveMemory to save a bitmap to a memory-resident file, uses GetMemoryInfo to examine the file size; then uses WIN16 API calls to save the file to disk and free the memory.

' Declare WIN32 API constants and functions in the Declarations module.
Private Const OF_READ = &H0
Private Const OF_CREATE = &H1000
Private Const SEEK_SET = 0  '  seek to an absolute position
Private Const SEEK_END = 2  '  seek relative to end of file
Private Const GMEM_MOVEABLE = &H2
Private Const OFS_MAXPATHNAME = 128
Private Type OFSTRUCT
        cBytes As Byte
        fFixedDisk As Byte
        nErrCode As Integer
        Reserved1 As Integer
        Reserved2 As Integer
        szPathName(OFS_MAXPATHNAME) As Byte
End Type

Private Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Private Declare Function hread Lib "kernel32" Alias "_hread" (ByVal hFile As Long, ByVal lpBuffer As Long, ByVal lBytes As Long) As Long
Private Declare Function hwrite Lib "kernel32" Alias "_hwrite" (ByVal hFile As Long, ByVal lpBuffer As Long, ByVal lBytes As Long) As Long
Private Declare Function lclose Lib "kernel32" Alias "_lclose" (ByVal hFile As Long) As Long
Private Declare Function llseek Lib "kernel32" Alias "_llseek" (ByVal hFile As Long, ByVal lOffset As Long, ByVal iOrigin As Long) As Long
Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) As Long

' ---------------------- Code for SaveMemory (32 bit) -------------

Private Sub SaveMemory_Click()
   Dim hf       As Long
   Dim hMem     As Long
   Dim iSize    As Long
   Dim lpMem    As Long
   Dim of       As OFSTRUCT
   Dim cMsg     As String
   If Lead1.SaveMemory(hMem, FILE_CMP, 24, 2, iSize) <> 0 Then
      MsgBox ("Error calling SaveMemory")
      GoTo quit_savememory
   End If
   If Lead1.GetMemoryInfo(hMem, 0, iSize) <> 0 Then
      GlobalFree (hMem)
      GoTo quit_savememory
   End If

   ' Ask for a confirmation to save this file
   cMsg = "File info:" + Chr(13)
   cMsg = cMsg + Str(Lead1.InfoWidth) + " x " + Str(Lead1.InfoHeight)
   cMsg = cMsg + " x " + Str(Lead1.InfoBits) + " BPP" + Chr(13)
   cMsg = cMsg + "Size in memory: " + Str(Lead1.InfoSizeMem) + Chr(13)
   cMsg = cMsg + "Size on disk : " + Str(Lead1.InfoSizeDisk)
   If MsgBox(cMsg, vbYesNo, "Write this file on disk ") = vbNo Then
      GlobalFree (hMem)
      GoTo quit_savememory
   End If
   lpMem = GlobalLock(hMem)
   If lpMem = 0 Then
      GlobalFree (hMem)
      MsgBox ("Error calling GlobalLock")
      GoTo quit_savememory
   End If
   hf = OpenFile("c:\lead\images\savemem.cmp", of, OF_CREATE)
   If hf = -1 Then
      GlobalUnlock (hMem)
      GlobalFree (hMem)
      MsgBox ("Error calling GlobalLock")
      GoTo quit_savememory
   End If
   If hwrite(hf, lpMem, iSize) <> iSize Then
      MsgBox ("Error calling hwrite")
   Else
      MsgBox ("The file was saved successfully on disk.")
   End If
   lclose (hf)
   GlobalUnlock (hMem)
   GlobalFree (hMem)
quit_savememory:

End Sub


Scroll event example for Access 95 and 97

This example demonstrates the Scroll event.

Private Sub Lead1_Scroll ()
  ' Add a TextBox control to your form and use it for this test
  cText = "Image origin: " + CStr(Lead1.DstLeft) + ", " + CStr(Lead1.DstTop)
  Text1.Value = cText
End Sub


Underlay example for Access 95 and 97

This example loads a bitmap into Lead2 and uses it as a tiled underlay for Lead1.

Me![Lead2].Visible = False
Lead2.Load "c:\lead\images\ulay1.bmp", 0, 0, 1
Lead1.Underlay Lead2.Bitmap, UNDERLAY_TILE
Lead1.ForceRepaint


Tutorial for Visual FoxPro Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS ActiveX.

Note:	These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Loading and Displaying an Image

Zooming Out and Zooming In

Dynamically Positioning the Control

Zooming In on a Selection

Outlining, Dragging, and Pasting a Region

Creating and Using Annotations

Using ODBC to Access Image Data

Writing and Reading Multipage Files

Using Transparent Controls

Drawing Simple Lines and Shapes

Cropping a Bitmap

Creating, Viewing, and Merging Color Separations

Updating a Gauge and Detecting a User Interrupt

Miscellaneous Examples


Loading and Displaying an Image (FoxPro)

Take the following steps to start a project and to add some code that loads a bitmap from an image file, then positions, scales, and displays the image:

1.	Start Visual FoxPro.

2.	On the Tools menu, select Options...

3.	On the Options window, click the Controls tab, display the OLE controls, mark the LEAD control, click the Set As Default button, then click the OK button. This registers the LEAD control and makes it available for all projects.

4.	On the File menu, select New...

5.	Select the Project option, and click the New File icon.

6.	In the Create window, select the directory where you want to create a project, specify your project name, then click the Create button.

7.	In the Project window, expand the Documents icon, select the Forms icon, click the New button, then click the New Form icon. (Do not use the wizard.)

8.	 Click the View Classes icon, and select Ole Controls.

9.	 Select the LEAD Control (12) icon on the toolbar.

10.	Size and position the control as you want it to appear at run time, and change the name of the control to Lead1.

11.	 Add a command button to your form and name it as follows:

Name	Caption

LoadLead	Load Image

12.	Copy the L_FOX.H file from LEAD's INCLUDE directory to your project directory. Then, on the Form menu, select Include File... and include the file.

13.	 Click the Code Window icon on the toolbar.

14.	Select the Init procedure for Form1, and enter the following code. (In online help, you can use the edit option to copy the block of code; then paste it into the code window.)

&& Set defaults for displaying the image.
&& These are all persistent properties that can be set in the properties box.
THISFORM.Lead1.Appearance = APPEARANCE_FLAT
THISFORM.Lead1.BorderStyle = 1
THISFORM.Lead1.BackColor = RGB(255, 255, 125)
THISFORM.Lead1.PaintDither = PAINTDITHER_DIFFUSION
THISFORM.Lead1.PaintPalette = PAINTPALETTE_AUTO
THISFORM.Lead1.AutoRepaint = .T.
THISFORM.Lead1.AutoSize = .F.
THISFORM.Lead1.AutoSetRects = .T.
THISFORM.Lead1.PaintSizeMode = PAINTSIZEMODE_FIT

15.	Code the LoadLead button's click procedure as follows:

THISFORM.Lead1.Load("c:\lead\images\image1.cmp", 0, 0, 1)

16.	 To test the program, go to the Form Designer window; then click the Run icon on the toolbar. (Answer yes when you are prompted to save components.)


Zooming Out and Zooming In (FoxPro)

Take the following steps to add code that can reduce and enlarge the displayed size of the image. This demonstrates the scaling properties that are normally used for zooming in and zooming out. It emphasizes the relationship of the displayed rectangle to the LEAD control.

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

2.	 Add two command buttons to your form and name them as follows:

Name	Caption

ZoomIn	Zoom In

ZoomOut	Zoom Out

3.	 Click the Code Window icon on the toolbar.

4.	Code the ZoomIn button's click procedure as follows:

THISFORM.Lead1.AutoSetRects = .T.
THISFORM.Lead1.PaintSizeMode = PAINTSIZEMODE_ZOOM
THISFORM.Lead1.PaintZoomFactor = THISFORM.Lead1.PaintZoomFactor + 10

5.	Code the ZoomOut button's click procedure as follows:

THISFORM.Lead1.AutoSetRects = .T.
THISFORM.Lead1.PaintSizeMode = PAINTSIZEMODE_ZOOM
IF THISFORM.Lead1.PaintZoomFactor > 10
   THISFORM.Lead1.PaintZoomFactor = THISFORM.Lead1.PaintZoomFactor - 10
ENDIF

6.	 To test the program, go to the Form Designer window; then click the Run icon on the toolbar. (Answer yes when you are prompted to save components.)


Dynamically Positioning the Control (FoxPro)

Take the following steps to dynamically scale and position the LEAD control when loading an image. This example scales the control to use most of the form's area while preserving the image's aspect ratio.

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

2.	Modify the LeadLoad button's click procedure so that it appears as follows. For a general explanation of how images are positioned and scaled, refer to Displaying an Image.

&& Set the unit of measure to pixels.
THISFORM.ScaleMode = 3
_SCREEN.ScaleMode = 3

&& The hard-coded file name may be different on you system.
MyImageFile = "c:\lead\images\image1.cmp"

&& Get information about the image.
THISFORM.Lead1.GetFileInfo(MyImageFile, 0, 0)

&& Set the variables used for preserving the aspect ratio.
&& Allow for a border of 1/8 of the form size.
HeightFactor = THISFORM.Lead1.InfoHeight
WidthFactor = THISFORM.Lead1.InfoWidth
HeightAllowed = THISFORM.Height * 3/4
WidthAllowed = THISFORM.Width * 3/4

&& Center the LEAD control on the form, preserving the aspect ratio.
&& Check to see if using the maximum width will make the image too tall.
&& Set the dimensions based on the result.
IF ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed
    THISFORM.Lead1.Left = THISFORM.Width / 8
    THISFORM.Lead1.Width = WidthAllowed
    THISFORM.Lead1.Height = (THISFORM.Lead1.Width * HeightFactor) / WidthFactor
    THISFORM.Lead1.Top = (THISFORM.Height - THISFORM.Lead1.Height) / 2
ELSE
    THISFORM.Lead1.Top = THISFORM.Height / 8
    THISFORM.Lead1.Height = HeightAllowed
    THISFORM.Lead1.Width = (THISFORM.Lead1.Height * WidthFactor) / HeightFactor
    THISFORM.Lead1.Left = (THISFORM.Width - THISFORM.Lead1.Width) / 2
ENDIF

&& Set variables for the size of the display rectangle.
ViewWidth = THISFORM.Lead1.ScaleWidth
ViewHeight = THISFORM.Lead1.ScaleHeight

&& Set the image display size to match the LEAD control
THISFORM.Lead1.SetDstRect(0, 0, ViewWidth, ViewHeight)
THISFORM.Lead1.SetDstClipRect(0, 0, ViewWidth, ViewHeight)

&& Load the image file into the bitmap.
THISFORM.Lead1.AutoSetRects = .F.
THISFORM.Lead1.Load(MyImageFile , 0, 0, 1)

3.	 To test the program, go to the Form Designer window; then click the Run icon on the toolbar. (Answer yes when you are prompted to save components.)


Zooming In on a Selection (FoxPro)

Take the following steps to add code that lets you select an area with a mouse, and zoom in on the selected area.

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

2.	In the LEAD1 control's MouseDown procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

*** OLE Control Event ***
LPARAMETERS button, shift, x, y

&& Enable AutoRubberBand
THISFORM.Lead1.AutoRubberband = .T.
THISFORM.Lead1.MousePointer = 2

3.	In the LEAD1 control's RubberBand procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

*** OLE Control Event ***
THISFORM.Lead1.MousePointer = 0

&& Zoom in on the selection.
zoomleft = THISFORM.Lead1.RubberBandLeft
zoomtop = THISFORM.Lead1.RubberBandTop
zoomwidth = THISFORM.Lead1.RubberBandWidth
zoomheight = THISFORM.Lead1.RubberBandHeight

&& Zoom in on the rectangle defined by the rubberband
THISFORM.Lead1.ZoomToRect(zoomleft, zoomtop, zoomwidth, zoomheight)
THISFORM.Lead1.ForceRepaint()

4.	Run your program to test it.


Outlining, Dragging, and Pasting a Region (FoxPro)

Take the following steps to add code that lets you outline an area with a mouse, drag a copy of the selected area, and paste the copy into another part of the bitmap:

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

2.	Add a second LEAD control, name it Lead2, and set its Visible property to False.

3.	Add the following code to the bottom of the Form1 Init procedure:

PUBLIC ReadyToDrag && The state after marking the region but before dragging
PUBLIC Dragging && The state when the mouse is used for dragging the floater
PUBLIC StartX && Starting X position in screen pixels
PUBLIC StartY && Starting Y position in screen pixels
PUBLIC FloaterX && Floater X position in screen pixels
PUBLIC FloaterY && Floater Y position in screen pixels
PUBLIC ZoomFactorX && Used for translating positioning information
PUBLIC ZoomFactorY && Used for translating positioning information

4.	 At the top of your main form, add two command buttons and name them as follows:

Name	Caption

SelRgnBtn	Select Region

PasteFloaterBtn	Paste Floater

5.	Add the following code to the SelRgnBtn control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

THISFORM.Lead1.RgnMarkingMode = RGNMARK_FREEHAND
answer = MESSAGEBOX( "Draw a freehand region",0,"Note")

6.	Add the following code to the PasteFloaterBtn control's Click procedure.

&& Do nothing if there is no floater.
IF THISFORM.Lead1.Floater = 0
    RETURN
ENDIF

&& Get the floater into another bitmap
THISFORM.Lead2.ScaleMode = THISFORM.Lead1.ScaleMode
THISFORM.Lead2.Bitmap = THISFORM.Lead1.Floater

&& Get the floater's client coordinates into local variables.
LCRgnX = THISFORM.Lead1.FloaterDstLeft
LCRgnY = THISFORM.Lead1.FloaterDstTop
LCRgnWidth = THISFORM.Lead1.FloaterDstWidth
LCRgnHeight = THISFORM.Lead1.FloaterDstHeight

&& Delete the floater.
THISFORM.Lead1.FloaterVisible = .F.
THISFORM.Lead1.Floater = 0

&& Translate the client coordinates to bitmap coordinates.
LBRgnX = ((LCRgnX - THISFORM.Lead1.DstLeft) / ZoomFactorX) + THISFORM.Lead1.SrcLeft
LBRgnY = ((LCRgnY - THISFORM.Lead1.DstTop) / ZoomFactorY) + THISFORM.Lead1.SrcTop
LBRgnWidth = LCRgnWidth / ZoomFactorX
LBRgnHeight = LCRgnHeight / ZoomFactorY

&& Reposition the region to use it as a mask for the Combine method.
THISFORM.Lead1.OffsetRgn(LBRgnX - THISFORM.Lead1.RgnLeft, LBRgnY - THISFORM.Lead1.RgnTop)

&& Use the Combine method to paste the Lead2 bitmap into the Lead1 bitmap.
MyOp = CB_OP_ADD + CB_DST_0 && Operation flags for a simple paste.
THISFORM.Lead1.Combine(LBRgnX, LBRgnY, LBRgnWidth, LBRgnHeight, THISFORM.Lead2.Bitmap, 0, 0, MyOp)

&& Repaint the part of the client area that has changed.
THISFORM.Lead1.RepaintRect(LCRgnX, LCRgnY, LCRgnWidth, LCRgnHeight, .F.)

&& Free the region.
THISFORM.Lead1.FreeRgn

7.	In the Lead1 control's MouseDown procedure, add the following code.

*** OLE Control Event ***
LPARAMETERS button, shift, x, y

&& Do nothing if we are drawing a region.
IF THISFORM.Lead1.RgnMarkingMode <> RGNMARK_NONE
    RETURN
ENDIF

&& Make sure we are using Pixels, so that we do not have to translate mouse coordinates.
THISFORM.Lead1.ScaleMode = 3

&&  Save the starting position, in case we need it.
StartY = Y
StartX = X

&& IF we are ready to drag the selection, get a floater.
IF ReadyToDrag = .T.
    && Translate the current mouse coordinates.
    && These coordinates account for the zoom factor and offset.
    ZoomFactorX = THISFORM.Lead1.DstWidth / THISFORM.Lead1.SrcWidth
    ZoomFactorY = THISFORM.Lead1.DstHeight / THISFORM.Lead1.SrcHeight
    BitmapX = (x / ZoomFactorX) - (THISFORM.Lead1.DstLeft / ZoomFactorX) + THISFORM.Lead1.SrcLeft
    BitmapY = (y / ZoomFactorY) - (THISFORM.Lead1.DstTop / ZoomFactorY) + THISFORM.Lead1.SrcTop

    && Continue to create the floater if the mouse is pointing to the region we marked.
    IF THISFORM.Lead1.IsPtInRgn(BitmapX, BitmapY)
        && Hide the region frame.
        THISFORM.Lead1.RgnFrameType = RGNFRAME_NONE

        && Create the floater bitmap, which will be the part of the main bitmap that is
        && in the region's bounding rectangle.
        THISFORM.Lead1.Floater = THISFORM.Lead1.Bitmap

        && Translate the bitmap region coordinates to client area coordinates.
        NewY = ((THISFORM.Lead1.RgnTop - THISFORM.Lead1.SrcTop) * ZoomFactorY) + THISFORM.Lead1.DstTop
        NewX = ((THISFORM.Lead1.RgnLeft - THISFORM.Lead1.SrcLeft) * ZoomFactorX) + THISFORM.Lead1.DstLeft
        NewWidth = THISFORM.Lead1.RgnWidth * ZoomFactorX
        NewHeight = THISFORM.Lead1.RgnHeight * ZoomFactorY

        && Set the initial display position of the floater.
        THISFORM.Lead1.SetFloaterDstRect(NewX, NewY, NewWidth, NewHeight)

        && Set form-level variables.
        FloaterY = THISFORM.Lead1.FloaterDstTop
        FloaterX = THISFORM.Lead1.FloaterDstLeft
        THISFORM.Lead1.FloaterVisible = .T.
        Dragging = .T.
        ReadyToDrag = .F.
    ENDIF

ENDIF

8.	In the Lead1 control's MouseMove procedure, add the following code.

*** OLE Control Event ***
LPARAMETERS button, shift, x, y

&& Do nothing if we are drawing a region.
IF THISFORM.Lead1.RgnMarkingMode <> RGNMARK_NONE
    RETURN
ENDIF

&& Reposition the floater if we are dragging it.
IF Dragging = .T. And Button = 1 And THISFORM.Lead1.Floater <> 0
    IF THISFORM.Lead1.IsPtInFloater(x, y)
        && Update the position variables.
        XDelta = x - StartX
        YDelta = y - StartY
        NewX = FloaterX + XDelta
        NewY = FloaterY + YDelta
        NewWidth = THISFORM.Lead1.FloaterDstWidth
        NewHeight = THISFORM.Lead1.FloaterDstHeight

        && Reposition the floater.
        THISFORM.Lead1.SetFloaterDstRect(NewX, NewY, NewWidth, NewHeight)

        && Save the form-level position variables.
        FloaterY = NewY
        FloaterX = NewX
        StartY = y
        StartX = x
    ENDIF
ENDIF

9.	In the Lead1 control's MouseUp procedure, add the following code.

*** OLE Control Event ***
LPARAMETERS button, shift, x, y

&&  IF we were drawing a region, set up for the next operation.
IF THISFORM.Lead1.RgnMarkingMode <> RGNMARK_NONE
    THISFORM.Lead1.RgnMarkingMode = RGNMARK_NONE
    THISFORM.Lead1.RgnFrameType = RGNFRAME_STATIC
    ReadyToDrag = .T.
    answer = MESSAGEBOX( "Now, drag the selection to another place.",0,"Note")
ENDIF

10.	 To test the program, go to the Form Designer window; then click the Run icon on the toolbar. (Answer yes when you are prompted to save components.)


Creating and Using Annotations (FoxPro)

Note: This topic is for Document/Medical only.

Take the following steps to add code that demonstrates the creation and deletion, saving and loading, and copying and pasting of annotation objects. This code also demonstrates the related events. Message boxes prompt for user actions that trigger events.

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

2.	Add the following code to the bottom of the Form1 Init procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

PUBLIC NewTag && Used to identify annotations that need a tag.
NewTag = 0

3.	 At the top of your main form, add four command buttons and name them as follows:

Name	Caption

AnnToggle	Start

IOToggle	Save

ClipboardToggle	Copy

Realize	Realize

4.	Code the AnnToggle control's Click procedure as follows:

&& Use the button to toggle between design mode and run mode
IF THISFORM.Anntoggle.Caption = "Start"
    THISFORM.Lead1.AnnUserMode = ANNUSERMODE_DESIGN
    THISFORM.Lead1.AnnTool = ANNTOOL_BUTTON
    && Make run mode the next thing.
    THISFORM.Anntoggle.Caption = "Run Mode"
    answer = MESSAGEBOX( "In design mode now. Draw a button object.",0,"Note")
ELSE
    IF THISFORM.Anntoggle.Caption = "Design Mode"
        THISFORM.Lead1.AnnUserMode = ANNUSERMODE_DESIGN
        THISFORM.Lead1.AnnTool = ANNTOOL_BUTTON
        && Make run mode the next thing.
        THISFORM.Anntoggle.Caption = "Run Mode"
    ELSE && The button takes us to run mode
        THISFORM.Lead1.AnnUserMode = ANNUSERMODE_RUN
        answer = MESSAGEBOX( "Click on your new button",0,"Note")
        THISFORM.Anntoggle.Caption = "Design Mode"
    ENDIF
ENDIF

5.	Code the IOToggle control's Click procedure as follows:

&& Disable errors so that we can trap our own.
THISFORM.Lead1.EnableMethodErrors = .F.

&& Use the button to toggle between saving and loading annotations
IF THISFORM.IOToggle.Caption = "Save"
    && Do nothing if there are no annotations.
    IF THISFORM.Lead1.AnnContainer = 0
        RETURN
    ENDIF
    && Save the selected annotations.
    nRet = THISFORM.Lead1.AnnSave("c:\lead\images\tmp.ann", ANNFMT_NATIVE, .T.)
    IF nRet = 0
        && Make loading the next thing.
        THISFORM.IOToggle.Caption = "Load"
        answer = MESSAGEBOX( "Use the right mouse button to delete any annotations,  click Load",0,"Note")
    ELSE
        answer = MESSAGEBOX( "Error code: " + STR(nRet),0,"Error")
    ENDIF
ELSE && We are loading annotations
    && Make sure we are in design mode
    THISFORM.Lead1.AnnUserMode = ANNUSERMODE_DESIGN
    && Load the annotations.
    nRet = THISFORM.Lead1.AnnLoad("c:\lead\images\tmp.ann", 1)
    IF nRet = 0
        THISFORM.IOToggle.Caption = "Save"
    ELSE
        answer = MESSAGEBOX( "No annotations to load",0,"Error")
    ENDIF
ENDIF

6.	Code the ClipboardToggle control's Click procedure as follows. (Note that Copy, Cut, and Paste are available as automated popup menu options. This code is for tailoring your application.)

&& Disable errors so that we can trap our own.
THISFORM.Lead1.EnableMethodErrors = .F.

&& Use the button to toggle between copying and pasting annotations
IF THISFORM.ClipboardToggle.Caption = "Copy"
    && Do nothing if there are no annotations.
    IF THISFORM.Lead1.AnnContainer = 0
        RETURN
    ENDIF

    && Copy the selected annotations to the clipboard.
    nRet = THISFORM.Lead1.AnnCopy(ANNFMT_NATIVE, .T., .T.)
    IF nRet = 0
        && Make pasting the next thing.
        THISFORM.ClipboardToggle.Caption = "Paste"
        answer = MESSAGEBOX( "Use the right mouse button to delete any annotations,  click Paste",0,"Note")
   ELSE
        answer = MESSAGEBOX( "Error code: " + STR(nRet),0,"Error")
    ENDIF
ELSE && We are pasting annotations
    && Make sure we are in design mode
    THISFORM.Lead1.AnnUserMode = ANNUSERMODE_DESIGN
    && Paste the annotations
    IF THISFORM.Lead1.AnnPasteReady
        THISFORM.Lead1.AnnPaste
        THISFORM.ClipboardToggle.Caption = "Copy"
    ELSE
        answer = MESSAGEBOX( "No annotations to paste",0,"Error")
    ENDIF
ENDIF

7.	Code the Realize control's Click procedure (which renders the annotation objects to the bitmap) as follows:

THISFORM.Lead1.AnnRealize(.F.)
THISFORM.Lead1.ForceRepaint
answer = MESSAGEBOX( "Annotations are now rendered to the bitmap",0,"Note")

8.	Code the Lead1 control's AnnCreate procedure as follows:

*** OLE Control Event ***
LPARAMETERS hobject

&&  Update the tag if we need one.
IF THISFORM.Lead1.AnnGetType(hObject) = ANNOBJECT_BUTTON Or THISFORM.Lead1.AnnGetType(hObject) = ANNOBJECT_HOTSPOT
    NewTag = NewTag + 1
    THISFORM.Lead1.AnnSetTag(hObject, NewTag)
ENDIF

9.	Code the Lead1 control's AnnDrawn procedure as follows:

*** OLE Control Event ***
LPARAMETERS hobject

THISFORM.Lead1.AnnTool = ANNTOOL_SELECT
Msg =  "Use the right mouse button to modify this object; then click on Run Mode to test it."
answer = MESSAGEBOX(Msg,0,"Note")

10.	Code the Lead1 control's AnnClicked procedure as follows:

*** OLE Control Event ***
LPARAMETERS hobject

Msg = "This is what we do for the button tagged " +  STR(THISFORM.Lead1.AnnGetTag(hObject))
answer = MESSAGEBOX(Msg,0,"Note")

11.	Code the Lead1 control's AnnDestroy procedure as follows:

*** OLE Control Event ***
LPARAMETERS hobject

Msg = "The object tagged " + STR(THISFORM.Lead1.AnnGetTag(hObject)) + " is deleted."
answer = MESSAGEBOX(Msg,0,"Note")

12.	 To test the program, go to the Form Designer window; then click the Run icon on the toolbar. (Answer yes when you are prompted to save components.)


Using ODBC to Access Image Data (FoxPro)

This lesson describes how to use the LEADTOOLS ODBC features to maintain images in a database and synchronize the images with names stored in another database. In this lesson, you accomplish the following:

 Create two databases, one for images and another for names for the images.

 Create an ODBC data source that references the image table.

 Use the normal FoxPro data access to maintain the name table.

 Use the LEADTOOLS methods to maintain the images through the ODBC data source.

 Synchronize the record pointers so that the views of the two tables are always correct.

Furthermore, because current FoxPro limitations require us to store images in an unsorted table, this example shows how to synchronize a search for records.

Note:	The LEADTOOLS ActiveX requires ODBC drivers that can properly handle long binary fields. Examples have been tested and will work with version 3.0 of the Microsoft ODBC Desktop Driver Pack. (This driver pack ships with Access 95 and works on 32-bit systems.)  You can get ODBC drivers from Microsoft.

1.	Start Visual FoxPro.

2.	On the Tools menu, select Options...

3.	On the Options window, click the Controls tab, display the OLE controls, mark the LEAD control, click the Set As Default button, then click the OK button. This registers the LEAD control and makes it available for all projects.

4.	On the File menu, select New...

5.	Select the Project option, and click the New File icon.

6.	In the Create window, select the directory where you want to create a project, specify your project name, then click the Create button.

7.	In the Project Manager window, click the Data tab, select the Databases icon, and click the New button.

8.	Name the database c:\lead\foxtest.dbc, click the Save button, and close the database designer.

9.	Expand the foxtest database icon.

10.	Create the ODBC data source for the images as follows:

a.	Select the Tables icon, click the New button, and click the New Table icon

b.	Name the table tmppic.dbf and click the Save button.

c.	Specify one field called photo, with a datatype of Memo (binary).

d.	Click the OK button and answer no to the prompt for entering data.

e.	Expand the Tables icon and select tmppic.

f.	Go to the command window and enter the following command:

copy to c:\lead\people.dbf type FOX2X

g.	Select the tmppic table, click the Remove button, and click the Delete button.

h.	Open the ODBC administrator (an application in your Visual FoxPro group) and click the Add button.

i.	Select Microsoft FoxPro driver and click the OK button.

j.	Enter LEADFOX as the Data Source Name.

k.	Click the Select directory button and select the LEAD directory.

l.	Click the OK button; click the next OK button; then click the Close button.

11.	Create a table for the names of the images as follows:

a.	Select the Tables icon, click the New button, and click the New Table icon

b.	Name the table names.dbf and click the Save button.

c.	Specify one field called who, with a datatype of Character and a width of 254.

d.	Click the OK button and answer no to the prompt for entering data.

12.	In the Project window, expand the Documents icon, select the Forms icon, click the New button, then click the New Form icon. (Do not use the wizard.)

13.	 Click the View Classes icon, and select Ole Controls.

14.	 Select the LEAD control icon on the toolbar; then click and drag on the form to draw the control. The control should be sized and positioned as you want it to appear at run time. The code will fit each image inside the control.

15.	In the Properties window (which you can select on the View menu), change the control's name to Lead1, and change its BorderStyle property to 1.

16.	Under LEAD control, add a text box, and change its name property to Cwho.

17.	On the Form menu, select Include File... and include the L_FOX.H file from the LEAD directory.

18.	On the Form menu, select New Method... and create a method called ViewImage. This method will handle synchronization with the names table and will size and position the display.

19.	 Click the Code Window icon on the toolbar.

20.	Select the ViewImage procedure for Form1, and enter the following code. (In online help, you can use the edit option to copy the block of code; then paste it into the code window.)

&& Synchronize the image with the FoxPro record number
IF NormalMove = .T.
    && The current position is the NewPosition
    && The OldPosition is the previous position
    OldPosition = NewPosition
    NewPosition = RECNO()
    THISFORM.Lead1.dbMove(NewPosition - OldPosition)
ENDIF
&& Synchronization is turned off by default
NormalMove = .F.

&& If there is no bitmap, do not try to display it
IF THISFORM.Lead1.Bitmap = 0
    RETURN
ENDIF

&& Calculate the display rectangle to fit the image inside the control
HeightAllowed = THISFORM.Lead1.ScaleHeight
WidthAllowed = THISFORM.Lead1.ScaleWidth
IF (HeightAllowed * THISFORM.Lead1.BitmapWidth / THISFORM.Lead1.BitmapHeight) <= WidthAllowed
    DisplayTop = 0
    DisplayHeight = HeightAllowed
    DisplayWidth = DisplayHeight * THISFORM.Lead1.BitmapWidth / THISFORM.Lead1.BitmapHeight
    DisplayLeft = (THISFORM.Lead1.ScaleWidth - DisplayWidth) / 2
ELSE
    DisplayLeft = 0
    DisplayWidth = WidthAllowed
    DisplayHeight = DisplayWidth * THISFORM.Lead1.BitmapHeight / THISFORM.Lead1.BitmapWidth
    DisplayTop = (THISFORM.Lead1.ScaleHeight - DisplayHeight) / 2
ENDIF

&& Set the image display size and paint the image
THISFORM.Lead1.SetDstRect(DisplayLeft, DisplayTop, DisplayWidth, DisplayHeight)
THISFORM.Lead1.SetDstClipRect(DisplayLeft, DisplayTop, DisplayWidth, DisplayHeight)
THISFORM.Lead1.ForceRepaint

21.	Select the Load procedure for Form1, and enter the following code:

PUBLIC NormalMove && Not adding or deleting
PUBLIC OldPosition && Used for synchronization in the ViewImage procedure
PUBLIC NewPosition && Used for synchronization in the ViewImage procedure
SET EXCLUSIVE ON

22.	Select the Init procedure for Form1, and enter the following code:

&& Turn off automatic scrolling and repainting
THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead1.AutoScroll = .F.

&& Open the ODBC data source
DString = "ODBC;DSN=LEADFOX"
THISFORM.Lead1.dbOpen(DString, "people", "photo", DB_OPENOPTIONS_NONE)

&& Set the LEAD control's database properties
THISFORM.Lead1.dbLoadBits = 24
THISFORM.Lead1.dbLockingMode = DB_LOCKINGMODE_OPTIMISTIC

&& Initialize global variables
NormalMove = .F.
NewPosition = 1

&& Display the current image
THISFORM.ViewImage

23.	Select the Release procedure for Form1, and enter the following code:

&& Close the ODBC data source
THISFORM.Lead1.dbClose

24.	At the top of your main form, add seven command buttons and name them (using the Caption property) as follows: Add, Flip, Delete, First, Next, Prev, and Last.

25.	For the Add button, add the following code to the click procedure:

&& Quit if we cannot update the ODBC data source
IF THISFORM.Lead1.dbCanUpdate = .F.
    Msg = "You cannot update this database."
    answer = MESSAGEBOX(Msg, 0, "Error")
    RETURN
ENDIF

&& Add a record to the ODBC data source.
&& The record is not added to the database until dbUpdate is called.
THISFORM.Lead1.dbAddNew

&& Disable normal error processing so that we can trap some common errors.
THISFORM.Lead1.EnableMethodErrors = .F.

&& Get the file name.
&& This list includes all extensions except GIF, which requires a separate license.
MyFile = GETFILE('cmp;jpg;jff;jtf;bmp;tif;tga;pcx;cal;mac;mac;img;msp;wpg;wpg;ras;pct;pcd;eps;wmf')
IF EMPTY(MyFile)
    THISFORM.Lead1.EnableMethodErrors = .T.
    RETURN
ENDIF

&& Load the image file into the LEAD control
nRet = THISFORM.Lead1.Load(MyFile, 24, 0, 1)
IF nRet <> 0
    Msg = "Invalid file"
    answer = MESSAGEBOX(Msg, 0, "Error")
    THISFORM.Lead1.EnableMethodErrors = .T.
    RETURN
ENDIF

&& Return to normal error processing
THISFORM.Lead1.EnableMethodErrors = .T.

&& Update the recordset using the appropriate format
IF THISFORM.Lead1.BitmapBits = 1
    THISFORM.Lead1.dbUpdate(FILE_LEAD1BIT, 1, 0)
ELSE
    IF THISFORM.Lead1.BitmapBits = 4
        THISFORM.Lead1.dbUpdate(FILE_PCX, 4, 0)
     ELSE
        IF THISFORM.Lead1.IsGrayscale = GRAY_NO
            THISFORM.Lead1.dbUpdate(FILE_CMP, 24, QFACTOR_QMS)
        ELSE && save as grayscale
            THISFORM.Lead1.dbUpdate(FILE_CMP, 8, QFACTOR_QMS)
        ENDIF
    ENDIF
ENDIF

&& Use dbMoveLast to keep the record counts synchronized
THISFORM.Lead1.dbMoveLast

&& Add a record to the FoxPro 3 table, and update the record position
APPEND BLANK
LOCATE FOR RECNO() = RECCOUNT()
NewPosition = RECNO()

&& Update the text box, and display the image
THISFORM.Cwho.Value = MyFile
THISFORM.ViewImage
Msg = "Database is updated."
answer = MESSAGEBOX(Msg, 0, "LEAD")

26.	For the Flip button, add the following code to the click procedure:

&& Quit if there is no record
IF THISFORM.Lead1.dbIsEOF = .T. AND THISFORM.Lead1.dbIsBOF = .T.
    Msg = "The database is empty."
    answer = MESSAGEBOX(Msg, 0, "Notice")
    RETURN
ENDIF

&& Quit if we cannot update the ODBC data source.
IF THISFORM.Lead1.dbCanUpdate = .F.
    Msg = "You cannot update this database."
    answer = MESSAGEBOX(Msg, 0, "Error")
    RETURN
ENDIF

&& Edit, flip, and update the image; then redisplay it.
THISFORM.Lead1.dbEdit
THISFORM.Lead1.Flip

&& Update the recordset using the appropriate format
IF THISFORM.Lead1.BitmapBits = 1
    THISFORM.Lead1.dbUpdate(FILE_LEAD1BIT, 1, 0)
ELSE
    IF THISFORM.Lead1.BitmapBits = 4
        THISFORM.Lead1.dbUpdate(FILE_PCX, 4, 0)
     ELSE
        IF THISFORM.Lead1.IsGrayscale = GRAY_NO
            THISFORM.Lead1.dbUpdate(FILE_CMP, 24, QFACTOR_QMS)
        ELSE && save as grayscale
            THISFORM.Lead1.dbUpdate(FILE_CMP, 8, QFACTOR_QMS)
        ENDIF
    ENDIF
ENDIF

THISFORM.ViewImage

27.	For the Delete button, add the following code to the click procedure:

&& Quit if we cannot update the ODBC data source
IF THISFORM.Lead1.dbCanUpdate = .F.
    Msg = "You cannot update this database."
    answer = MESSAGEBOX(Msg, 0, "Error")
    RETURN
ENDIF

&& Quit if the database is empty
IF THISFORM.Lead1.dbIsEOF = .T. AND THISFORM.Lead1.dbIsBOF = .T.
    Msg = "The database is empty."
    answer = MESSAGEBOX(Msg, 0, "Notice")
    RETURN
ENDIF

&& Delete the LEAD image
THISFORM.LEAD1.dbDelete

&& Delete the FoxPro record, and pack the table to keep the record count right.
DELETE
PACK

&& Display the name in the current record, which is the first record
THISFORM.Cwho.Value = names.who

&& Go to the first image and display it.
THISFORM.LEAD1.dbMoveFirst
NormalMove = .F.
NewPosition = 1
THISFORM.ViewImage

28.	For the First button, add the following code to the click procedure:

&& Move to the first record.
LOCATE FOR RECNO() = 1
THISFORM.Cwho.Value = names.who

&& Synchronize and display the LEAD image.
NormalMove = .T.
THISFORM.ViewImage

29.	For the Next button, add the following code to the click procedure:

&& Move to the next record.
TheRec = RECNO()
LOCATE FOR RECNO() = TheRec + 1

IF EOF() = .T.
    && If this is the end of the file, go back to where we were.
    LOCATE FOR RECNO() = TheRec
    Msg = "Already at last record"
    answer = MESSAGEBOX(Msg, 0, "Notice")
ELSE
    && Otherwise, display current name; then synchronize and display the LEAD image.
    THISFORM.Cwho.Value = names.who
    NormalMove = .T.
    THISFORM.ViewImage
ENDIF

30.	For the Prev button, add the following code to the click procedure:

&& Move to the previous record.
TheRec = RECNO()
LOCATE FOR RECNO() = TheRec - 1

IF EOF() = .T. && This works here, but BOF() does not.
    && If this is the beginning of the file, go back to where we were.
    LOCATE FOR RECNO() = TheRec
    Msg = "Already at first record"
    answer = MESSAGEBOX(Msg, 0, "Notice")
ELSE
    && Otherwise, display the current name; then synchronize and display the LEAD image.
    THISFORM.Cwho.Value = names.who
    NormalMove = .T.
    THISFORM.ViewImage
ENDIF

31.	For the Last button, add the following code to the click procedure:

&& Go to the last record
LOCATE FOR RECNO() = RECCOUNT()
THISFORM.Cwho.Value = names.who

&& Synchronize and display the LEAD image.
NormalMove = .T.
THISFORM.ViewImage

32.	At the bottom of your main form, add a text box and two command buttons to be used for searching the database The caption of one command button should be Find First, and the other should be Find Next. The name of the text box should be SearchText.

33.	For the Find First button, add the following code to the click procedure:

&& Save the current record
CurrentRecord = RECNO()

&& Find the first record that contains the specified string.
&& Make both operands uppercase to make the search case insensitive.
LOCATE FOR LIKE("*" + UPPER(ALLTRIM(THISFORM.SearchText.Value))+ "*",UPPER(who))

IF FOUND()
    && If a match is found, display the current name;
    && then synchronize and display the LEAD image.
    THISFORM.Cwho.Value = who
    NormalMove = .T.
    THISFORM.ViewImage
ELSE
    && Otherwise return to the current record and display a message.
    LOCATE FOR RECNO() = CurrentRecord
    Msg = "Not found"
    answer = MESSAGEBOX(Msg, 0, "Notice")
ENDIF

34.	For the Find Next button, add the following code to the click procedure:

&& Save the current record number
CurrentRecord = RECNO()

&& Find the next record that matches the previous LOCATE command.
CONTINUE

IF FOUND()
    && If a match is found, display the current name;
    && then synchronize and display the LEAD image.
    THISFORM.Cwho.Value = who
    NormalMove = .T.
    THISFORM.ViewImage
ELSE
    && Otherwise return to the current record and display a message.
    LOCATE FOR RECNO() = CurrentRecord
    Msg = "Not found"
    answer = MESSAGEBOX(Msg, 0, "Notice")
ENDIF

35.	Run your program to test it.


Writing and Reading Multipage Files (FoxPro)

Take the following steps to create a multipage file, then load and display the images from the file. Only TIFF (MPT) and PCX (DCX) formats support multipage files.

1.	Start Visual FoxPro.

2.	On the Tools menu, select Options...

3.	On the Options window, click the Controls tab, display the OLE controls, mark the LEAD control, click the Set As Default button, then click the OK button. This registers the LEAD control and makes it available for all projects.

4.	On the File menu, select New...

5.	Select the Project option, and click the New File icon.

6.	In the Create window, select the directory where you want to create a project, specify your project name, then click the Create button.

7.	In the Project window, expand the Documents icon, select the Forms icon, click the New button, then click the New Form icon. (Do not use the wizard.)

8.	 Click the View Classes icon, and select Ole Controls.

9.	 Add two LEAD controls to the form, and name them Lead1 and Lead2.  For each control, select the LEAD Control icon on the toolbar; then click and drag on the form to draw the control. (The size and position does not matter.) Then, in the properties box, change the name of each control.

10.	On the Form menu, select Include File... and include the L_FOX.H file from LEAD's INCLUDE directory.

11.	 Click the Code Window icon on the toolbar.

12.	Select the Init procedure for Form1, and enter the following code. (In online help, you can use the edit option to copy the block of code; then paste it into the code window.)

&& Disable automatic repainting of the image.
THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead2.AutoRepaint = .F.

&& Turn off scroll bars to make sure we use the full client area.
THISFORM.Lead1.AutoScroll = .F.
THISFORM.Lead2.AutoScroll = .F.

&& Set the unit of measure to pixels.
THISFORM.ScaleMode = 3
_SCREEN.ScaleMode = 3

&& Position and size the main form.
THISFORM.Left = _SCREEN.Left + 20
THISFORM.Top = _SCREEN.Top + 20
THISFORM.Width = _SCREEN.Width - 40
THISFORM.Height = _SCREEN.Height - 80
THISFORM.Show

&& Load the bitmaps. These hard-coded path names may be different on your system.
THISFORM.Lead1.Load("c:\lead\images\image1.cmp", 0, 0, 1)
THISFORM.Lead2.Load("c:\lead\images\image2.cmp", 0, 0, 1)

&& Save the bitmaps to a single multipage TIFF file
THISFORM.Lead1.Save("c:\lead\images\combined.mpt", FILE_TIF, 24, 0, SAVE_OVERWRITE)
THISFORM.Lead2.Save("c:\lead\images\combined.mpt", FILE_TIF, 24, 0, SAVE_APPEND)

&& Get information about the images so that we can size the controls.
THISFORM.Lead1.GetFileInfo("c:\lead\images\combined.mpt", 1, 0)
THISFORM.Lead2.GetFileInfo("c:\lead\images\combined.mpt", 2, 0)

&& Clear the bitmaps from memory
THISFORM.Lead1.Bitmap = 0
THISFORM.Lead2.Bitmap = 0

&& Make the controls visible so that we can size and position them.
&& They will not really appear until we load an image and paint it.
THISFORM.Lead1.Visible = .T.
THISFORM.Lead2.Visible = .T.

&& Set the variables used for preserving the aspect ratio.
HeightFactor1 = THISFORM.Lead1.InfoHeight
WidthFactor1 = THISFORM.Lead1.InfoWidth
HeightFactor2 = THISFORM.Lead2.InfoHeight
WidthFactor2 = THISFORM.Lead2.InfoWidth
HeightAllowed = THISFORM.Height * 0.8
WidthAllowed = THISFORM.Width * 0.45

&& Center each LEAD control on half of the form, preserving the aspect ratio.
&& Check to see if using the maximum width will make the image too tall.
&& Set the dimensions based on the result.
IF (WidthAllowed * HeightFactor1) / WidthFactor1 < HeightAllowed
  THISFORM.Lead1.Left = (THISFORM.Width / 4) - (WidthAllowed / 2)
  THISFORM.Lead1.Width = WidthAllowed
  THISFORM.Lead1.Height = (THISFORM.Lead1.Width * HeightFactor1) / WidthFactor1
  THISFORM.Lead1.Top = (THISFORM.Height - THISFORM.Lead1.Height) / 2
Else
  THISFORM.Lead1.Top = (THISFORM.Height - HeightAllowed) / 2
  THISFORM.Lead1.Height = HeightAllowed
  THISFORM.Lead1.Width = (THISFORM.Lead1.Height * WidthFactor1) / HeightFactor1
  THISFORM.Lead1.Left = (THISFORM.Width / 4) - (THISFORM.Lead1.Width / 2)
ENDIF
IF (WidthAllowed * HeightFactor2) / WidthFactor2 < HeightAllowed
  THISFORM.Lead2.Left = (THISFORM.Width * 3/4) - (WidthAllowed / 2)
  THISFORM.Lead2.Width = WidthAllowed
  THISFORM.Lead2.Height = (THISFORM.Lead2.Width * HeightFactor2) / WidthFactor2
  THISFORM.Lead2.Top = (THISFORM.Height - THISFORM.Lead2.Height) / 2
Else
  THISFORM.Lead2.Top = (THISFORM.Height - HeightAllowed) / 2
  THISFORM.Lead2.Height = HeightAllowed
  THISFORM.Lead2.Width = (THISFORM.Lead2.Height * WidthFactor2) / HeightFactor2
  THISFORM.Lead2.Left = (THISFORM.Width * 3 / 4) - (THISFORM.Lead2.Width / 2)
ENDIF

&& Load the bitmaps from the multipage TIFF file
THISFORM.Lead1.Load("c:\lead\images\combined.mpt", 24, 1, 1)
THISFORM.Lead2.Load("c:\lead\images\combined.mpt", 24, 2, 1)

&& Set variables for the position and size of the Lead1 display rectangle.
ImageWidth1 = THISFORM.Lead1.ScaleWidth
ImageHeight1 = THISFORM.Lead1.ScaleHeight
THISFORM.Lead1.SetDstRect(0, 0, ImageWidth1, ImageHeight1)
THISFORM.Lead1.SetDstClipRect(0, 0, ImageWidth1, ImageHeight1)

&& Set variables for the position and size of the Lead2 display rectangle.
ImageWidth2 = THISFORM.Lead2.Width
ImageHeight2 = THISFORM.Lead2.Height
THISFORM.Lead2.SetDstRect(0, 0, ImageWidth2, ImageHeight2)
THISFORM.Lead2.SetDstClipRect(0, 0, ImageWidth2, ImageHeight2)

&& Display the images
THISFORM.Lead1.ForceRepaint
THISFORM.Lead2.ForceRepaint
_SCREEN.MousePointer = 0 && Default

13.	To test the program, go to the Form Designer window; then click the Run icon (an exclamation point) on the toolbar. (Answer yes when you are prompted to save components.)


Using Transparent Controls (FoxPro)

Take the following steps to add transparent controls, with special effects:

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

2.	Add two LEAD controls, which you will set to be transparent at run time. At design time, you can make the controls easier to see by setting the BackColor property of each control to a different color.

Add the controls as follows:

a.	Add a control named Lead2 as a child control to Lead1. In other words, draw it inside the Lead1 control.

b.	Add a control named Lead3 as a child control to Lead2. In other words, draw it inside the Lead2 control.

You can make sure the controls are nested by looking at the list box at the top of the Properties dialog box.

3.	Add a command button and code its click event as follows:

THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead1.Lead2.AutoRepaint = .F.
THISFORM.Lead1.Lead2.Lead3.AutoRepaint = .F.

&& Make Lead2 and Lead3 transparent.
THISFORM.Lead1.Lead2.Transparent = .T.
THISFORM.Lead1.Lead2.Lead3.Transparent = .T.

&& Give each control a different effect.
THISFORM.Lead1.PaintEffect = EFX_EFFECT_WIPE_RECTANGLE_OUT
THISFORM.Lead1.Lead2.PaintEffect = EFX_EFFECT_WIPE_RECTANGLE_IN
THISFORM.Lead1.Lead2.Lead3.PaintEffect = EFX_EFFECT_WIPE4_R_B_L_B

THISFORM.Lead1.EffectDelay = 20
THISFORM.Lead1.Lead2.EffectDelay = 20
THISFORM.Lead1.Lead2.Lead3.EffectDelay = 20
THISFORM.Lead1.EffectGrain = 1
THISFORM.Lead1.Lead2.EffectGrain = 5
THISFORM.Lead1.Lead2.Lead3.EffectGrain = 1

&& Position the nested controls.
THISFORM.Lead1.Lead2.Width = THISFORM.Lead1.Width / 2
THISFORM.Lead1.Lead2.Height = THISFORM.Lead1.Height / 2
THISFORM.Lead1.Lead2.Left = THISFORM.Lead1.Lead2.Width / 2
THISFORM.Lead1.Lead2.Top = THISFORM.Lead1.Lead2.Height / 2

THISFORM.Lead1.Lead2.Lead3.Top = 0
THISFORM.Lead1.Lead2.Lead3.Left = 0
THISFORM.Lead1.Lead2.Lead3.Width = THISFORM.Lead1.Lead2.Width
THISFORM.Lead1.Lead2.Lead3.Height = THISFORM.Lead1.Lead2.Height

&& Load an image into Lead1 and paint it.
THISFORM.Lead1.Load("d:\lead\images\image1.cmp", 0, 0, 1)
THISFORM.Lead1.ForceRepaint()

&& We will be drawing into the bitmaps.
THISFORM.Lead1.Lead2.DrawPersistence = .T.
THISFORM.Lead1.Lead2.Lead3.DrawPersistence = .T.

&& First, we need some bitmaps.
LabelWidth = THISFORM.Lead1.Lead2.ScaleWidth
LabelHeight = THISFORM.Lead1.Lead2.ScaleHeight
THISFORM.Lead1.Lead2.CreateBitmap(LabelWidth, LabelHeight, 24)
THISFORM.Lead1.Lead2.Lead3.CreateBitmap(LabelWidth, LabelHeight, 24)

&& Fill them with black, and make black transparent.
THISFORM.Lead1.Lead2.Fill(RGB(0, 0, 0))
THISFORM.Lead1.Lead2.Lead3.Fill(RGB(0, 0, 0))
THISFORM.Lead1.Lead2.BitmapEnableTransparency = .T.
THISFORM.Lead1.Lead2.Lead3.BitmapEnableTransparency = .T.
THISFORM.Lead1.Lead2.BitmapTransparentColor = RGB(0, 0, 0)
THISFORM.Lead1.Lead2.Lead3.BitmapTransparentColor = RGB(0, 0, 0)

&& Draw a shape into Lead2.
&& Shape background
THISFORM.Lead1.Lead2.ShapeBackgroundStyle = EFX_BACKSTYLE_TRANSLUCENT

&& Shape location
THISFORM.Lead1.Lead2.ShapeTop = 0
THISFORM.Lead1.Lead2.ShapeLeft = 0
THISFORM.Lead1.Lead2.ShapeWidth = LabelWidth
THISFORM.Lead1.Lead2.ShapeHeight = LabelHeight

&& Shape border
THISFORM.Lead1.Lead2.ShapeBorderColor = RGB(255, 0, 0)
THISFORM.Lead1.Lead2.ShapeBorderStyle = EFX_BORDERSTYLE_SOLID
THISFORM.Lead1.Lead2.ShapeBorderThickness = 5

&& Shape fill mode
THISFORM.Lead1.Lead2.PatternStyle = EFX_PATTERN_TRANSPARENT

&&Draw the shape.
THISFORM.Lead1.Lead2.DrawShape(EFX_SHAPE_STAR4, 0)

&& Draw text into Lead3.
&& Specify the text, font, and styles.
TestText = "Text"
THISFORM.Lead1.Lead2.Lead3.Font.Name = "Arial"
THISFORM.Lead1.Lead2.Lead3.Font.Size = 40
THISFORM.Lead1.Lead2.Lead3.TextAngle = 450
THISFORM.Lead1.Lead2.Lead3.DrawFontColor = RGB(0, 0, 255) &&Blue
THISFORM.Lead1.Lead2.Lead3.TextStyle = EFX_TEXTSTYLE_NORMAL
THISFORM.Lead1.Lead2.Lead3.TextAlign = EFX_TEXTALIGN_HCENTER_VCENTER

&& Set the location for the text.
THISFORM.Lead1.Lead2.Lead3.TextTop = 0
THISFORM.Lead1.Lead2.Lead3.TextLeft = 0
THISFORM.Lead1.Lead2.Lead3.TextWidth = LabelWidth
THISFORM.Lead1.Lead2.Lead3.TextHeight = LabelHeight

&& Set the properties for drawing a rectangle behind the text.
THISFORM.Lead1.Lead2.Lead3.DrawPenStyle = DRAWPENSTYLE_SOLID
THISFORM.Lead1.Lead2.Lead3.DrawPenColor = RGB(255, 255, 0)
THISFORM.Lead1.Lead2.Lead3.DrawMode = DRAWMODE_COPY_PEN

&&Draw the rectangle, then draw the text.
THISFORM.Lead1.Lead2.Lead3.DrawRectangle(0, 0, LabelWidth, LabelHeight)
THISFORM.Lead1.Lead2.Lead3.DrawText(TestText, 0)

&& Turn off the paint effects.
THISFORM.Lead1.PaintEffect = EFX_EFFECT_NONE
THISFORM.Lead1.Lead2.PaintEffect = EFX_EFFECT_NONE
THISFORM.Lead1.Lead2.Lead3.PaintEffect = EFX_EFFECT_NONE

4.	Run your program to test it.


Drawing Simple Lines and Shapes (FoxPro)

Take the following steps to add code that lets you draw a line, rectangle and ellipse on the bitmap.

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

2.	Add the following global variables in the Form Init procedure:

PUBLIC DrawObject As Integer && The object we are drawing
PUBLIC StartX As Single      && Starting X position
PUBLIC StartY As Single      && Starting Y position
PUBLIC EndX As Single        && Ending X position
PUBLIC EndY As Single        && Ending Y position

DrawObject = 0

3.	Code the LEAD control's MouseDown event as follows. This code selects a different drawing object each time the event occurs.

*** OLE Control Event ***
LPARAMETERS button, shift, x, y
&& Save the starting position.
StartX = X
StartY = Y
EndX = X
EndY = Y
&& Cycle through the types of drawing objects.
If DrawObject = 0 Then
  DrawObject = 1 && Line
Else
   If DrawObject = 1 Then
      DrawObject = 2 && Rectangle
   Else
      If DrawObject = 2 Then
       DrawObject = 0 && Ellipse
    EndIf
   Endif
EndIf

4.	Code the LEAD control's MouseMove event as follows. This code uses DRAWMODE_INVERT for the DrawMode, which means that pixel colors are inverted. Thus, the drawing methods can erase the previous object and draw a new one.

*** OLE Control Event ***
LPARAMETERS button, shift, x, y
If Button = 1 Then
  && Set the drawing styles.
  THISFORM.Lead1.DrawPenStyle = DRAWPENSTYLE_SOLID
  THISFORM.Lead1.DrawMode = DRAWMODE_INVERT
  THISFORM.Lead1.DrawFillStyle = DRAWFILLSTYLE_TRANSPARENT
  THISFORM.Lead1.DrawPersistence = .F. && On the window, not the bitmap

  && Save the previous ending mouse position.
  OldEndX = EndX
  OldEndY = EndY

  && Get the current mouse position.
  EndX = X
  EndY = Y

  && Calculate the origin of the current object.
  If EndX > StartX
    DrawX = StartX
  Else
    DrawX = EndX
  EndIf
  If EndY > StartY
    DrawY = StartY
  Else
      DrawY = EndY
  EndIf

  && Calculate the origin of the previous object.
  If OldEndX > StartX
    OldDrawX = StartX
  Else
    OldDrawX = OldEndX
  EndIf
  If OldEndY > StartY
    OldDrawY = StartY
  Else
    OldDrawY = OldEndY
  EndIf

  && Calculate the height and width of the current object.
  NewHeight = Abs(StartY - EndY)
  NewWidth = Abs(StartX - EndX)

  && Calculate the height and width of the previous object.
  OldHeight = Abs(StartY - OldEndY)
  OldWidth = Abs(StartX - OldEndX)

  && Erase the old object and draw the new one.
  If DrawObject = 0  && Ellipse
    THISFORM.Lead1.DrawEllipse(OldDrawX, OldDrawY, OldWidth, OldHeight)
    THISFORM.Lead1.DrawEllipse(DrawX, DrawY, NewWidth, NewHeight)
  EndIf
  If DrawObject = 1  && Line
    THISFORM.Lead1.DrawLine(StartX, StartY, OldEndX, OldEndY)
    THISFORM.Lead1.DrawLine(StartX, StartY, EndX, EndY)
  EndIf
  If DrawObject = 2  && Rectangle
    THISFORM.Lead1.DrawRectangle(OldDrawX, OldDrawY, OldWidth, OldHeight)
    THISFORM.Lead1.Drawrectangle(DrawX, DrawY, NewWidth, NewHeight)
    EndIf
EndIf

5.	Code the LEAD control's MouseUp event as follows. This code sets the drawing style and draws the object on the bitmap.

*** OLE Control Event ***
LPARAMETERS button, shift, x, y
&& Set the drawing style.
THISFORM.Lead1.DrawPenStyle = DRAWPENSTYLE_SOLID
THISFORM.Lead1.DrawPenWidth = 2
THISFORM.Lead1.DrawPenColor = RGB(255, 0, 0) && Red
THISFORM.Lead1.DrawMode = DRAWMODE_COPY_PEN
THISFORM.Lead1.DrawFillColor = RGB(0, 255, 0) && Green
THISFORM.Lead1.DrawFillStyle = DRAWFILLSTYLE_HORIZONTAL_LINE
THISFORM.Lead1.DrawPersistence = .T. && On the bitmap

&& Get the current mouse position
EndX = X
EndY = Y

&& Determine the origin of the object.
If EndX > StartX
  DrawX = StartX
Else
  DrawX = EndX
EndIf
If EndY > StartY
  DrawY = StartY
Else
  DrawY = EndY
EndIf

&& Determine the height and width of the object.
NewHeight = Abs(StartY - EndY)
NewWidth = Abs(StartX - EndX)

&& Draw the object
If DrawObject = 0   && Ellipse
  THISFORM.Lead1.DrawEllipse(DrawX, DrawY, NewWidth, NewHeight)
EndIf
If DrawObject = 1   && Line
  THISFORM.Lead1.DrawLine(StartX, StartY, EndX, EndY)
EndIf
If DrawObject = 2   && Rectangle
  THISFORM.Lead1.DrawRectangle(DrawX, DrawY, NewWidth, NewHeight)
EndIf

6.	Run your program to test it.


Cropping a Displayed Image and Copying It to a Bitmap (FoxPro)
Cropping a Bitmap (FoxPro)

Take the following steps to add code that lets you select an area with a mouse, crop the display to show only that area, and trim the bitmap to match the selected area.

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

2.	Add the following code to the bottom of the Form1 Init procedure:

PUBLIC Cropping && The state when the mouse is used for cropping
PUBLIC StartX && Starting X position in screen pixels
PUBLIC StartY && Starting Y position in screen pixels
PUBLIC EndX && Ending X position in screen pixels
PUBLIC EndY && Ending Y position in screen pixels
Cropping = .F.

&& Set the unit of measure to pixels.
THISFORM.ScaleMode = 3
_SCREEN.ScaleMode = 3

3.	 Select the Command button control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

4.	In the Properties box, change the Command button control's Caption property to Select Rectangle.

5.	Add the following code to the Command button control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

&& Initialize cropping so that you can do it more than once
IF Cropping = .T.
    && Set the clipping area to match the image.
    ClipLeft = THISFORM.Lead1.DstLeft
    ClipTop = THISFORM.Lead1.DstTop
    ClipWidth = THISFORM.Lead1.DstWidth
    ClipHeight = THISFORM.Lead1.DstHeight
    THISFORM.Lead1.SetDstClipRect(ClipLeft, ClipTop, ClipWidth, ClipHeight)

    && Display the image
    THISFORM.Lead1.ForceRepaint
ENDIF

&& Set a global variable to let other events know that you are cropping.
Cropping = .T.

6.	In the LEAD1 control's MouseDown procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

&& Save the starting position in screen pixels
StartX = X
StartY = Y

&& Make the rubberband invisible until the mouse moves
THISFORM.Lead1.RubberBandVisible = .F.

7.	In the LEAD1 control's MouseMove procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

IF Cropping = .T. And Button = 1

&& Translate the current mouse position
EndX = X
EndY = Y

&& Determine the origin of the rubberband rectangle, regardless of which way the mouse moves.
IF EndX > StartX
    rbX = StartX
ELSE
    rbX = EndX
ENDIF

IF EndY > StartY
    rbY = StartY
ELSE
    rbY = EndY
ENDIF

&& Determine the height and width of the rubberband rectangle
rbHeight = ABS(StartY - EndY)
rbWidth = ABS(StartX - EndX)

&& Set the rubberband rectangle.
THISFORM.Lead1.SetRubberBandRect(rbX, rbY, rbWidth, rbHeight)

    && Alternatively, you could use the following properties to set the
    && rubberband rectangle.
    && THISFORM.Lead1.RubberBandHeight = rbHeight
    && THISFORM.Lead1.RubberBandLeft = rbX
    && THISFORM.Lead1.RubberBandTop = rbY
    && THISFORM.Lead1.RubberBandWidth = rbWidth

&& Make the rubberband visible.
THISFORM.Lead1.RubberBandVisible = .T.
ENDIF

8.	In the LEAD1 control's MouseUp procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

IF Cropping = .T.

&& Get the current mouse position
EndX = X
EndY = Y

&& Get the origin of the clipping rectangle.
&& Allow for different mouse drag directions
IF StartX < EndX
    CropLeft = StartX
ELSE
   CropLeft = EndX
ENDIF

IF StartY < EndY
    CropTop = StartY
ELSE
   CropTop = EndY
ENDIF

&& Get the height and width of the cropped area
CropWidth = ABS(EndX - StartX)
CropHeight = ABS(EndY - StartY)

&& Crop and repaint the image
THISFORM.Lead1.SetDstClipRect(CropLeft, CropTop, CropWidth, CropHeight)
THISFORM.Lead1.ForceRepaint
THISFORM.Lead1.RubberBandVisible = .F.
ENDIF

9.	 Select the CommandButton control; then add another control to your main form. Put the control at the top of the form to keep it away from the image.

10.	In the Properties box, change the CommandButton control's Caption property to Trim. This command button will be used to trim the bitmap in memory and redisplay the bitmap.

11.	Add the following code to the CommandButton control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

_SCREEN.MousePointer = 11 && hourglass

&& Use the clipping rectangle's percentage offsets in the image rectangle
&& to determine the trimmed rectangle in the bitmap.
&& Using percentages allows for the possibility that the image is zoomed.
XFactor = THISFORM.Lead1.BitmapWidth / THISFORM.Lead1.DstWidth
YFactor = THISFORM.Lead1.BitmapHeight / THISFORM.Lead1.DstHeight
NewTop = ROUND((THISFORM.Lead1.DstClipTop - THISFORM.Lead1.DstTop) * YFactor, 0)
NewLeft = ROUND((THISFORM.Lead1.DstClipLeft - THISFORM.Lead1.DstLeft) * XFactor, 0)
NewWidth = ROUND(THISFORM.Lead1.DstClipWidth * XFactor, 0)
NewHeight = ROUND(THISFORM.Lead1.DstClipHeight * YFactor, 0)

&& Trim the bitmap.
THISFORM.Lead1.Trim(NewLeft, NewTop, NewWidth, NewHeight)

&& Size and redisplay the control, using the new bitmap size.
&& Set the variables used for preserving the aspect ratio.
&& Allow for a border of 1/8 of the form size.
HeightFactor = THISFORM.Lead1.BitmapHeight
WidthFactor = THISFORM.Lead1.BitmapWidth
HeightAllowed = THISFORM.Height - (THISFORM.Height / 4)
WidthAllowed = THISFORM.Width - (THISFORM.Width / 4)

&& Use some variables for the control positioning so that
&& we do not move the control every time we change a value.
ControlLeft = THISFORM.Lead1.Left
ControlWidth = THISFORM.Lead1.Width
ControlHeight = THISFORM.Lead1.Height
ControlTop = THISFORM.Lead1.Top

&& Center the LEAD control on the form, preserving the aspect ratio.
&& Check to see if using the maximum width will make the image too tall.
&& Set the dimensions based on the result.
IF ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed
    ControlLeft = THISFORM.Width / 8
    ControlWidth = WidthAllowed
    ControlHeight = (ControlWidth * HeightFactor) / WidthFactor
    ControlTop = (THISFORM.Height - ControlHeight) / 2
ELSE
    ControlTop = THISFORM.Height / 8
    ControlHeight = HeightAllowed
    ControlWidth = (ControlHeight * WidthFactor) / HeightFactor
    ControlLeft = (THISFORM.Width - ControlWidth) / 2
ENDIF

&& Set the position and size of the LEAD control.
THISFORM.Lead1.Left = ControlLeft
THISFORM.Lead1.Top = ControlTop
THISFORM.Lead1.Width = ControlWidth
THISFORM.Lead1.Height = ControlHeight

&& Set variables for the size of the display rectangle.
ViewWidth = THISFORM.Lead1.ScaleWidth
ViewHeight = THISFORM.Lead1.ScaleHeight

&& Set the image display size to match the LEAD control
THISFORM.Lead1.SetDstRect(0, 0, ViewWidth, ViewHeight)
THISFORM.Lead1.SetDstClipRect(0, 0, ViewWidth, ViewHeight)

&& Display the LEAD control.
THISFORM.Lead1.BorderStyle = 1
THISFORM.Lead1.ForceRepaint
_SCREEN.MousePointer = 0 && default

12.	Run your program to test it.


Creating, Viewing, and Merging Color Separations (FoxPro)

Take the following steps to add code that creates CMYK color separations, displays each of the color planes, merges the planes, and displays the result. The code increases the contrast of the K plane to demonstrate how you can manipulate the color separations.

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

2.	 Select the Command button control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

3. 	Add a second Lead control to the form, name it Lead2, and make it invisible.

4.	Add the following code to the end of the Form1 Init procedure:

&&  Use a global variable to count the number of times the user clicks the
&&  button for doing separations
PUBLIC SepClickCount
SepClickCount = 0

5.	In the Properties box, change the Command button control's Caption property to Do Separations.

6.	Add the following code to the Command button control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

_SCREEN.MousePointer = 11 &&  hourglass

&& Turn off automatic adjustment of display rectangles.
THISFORM.Lead1.AutoSetRects = .F.

DO CASE
CASE SepClickCount =  0
    THISFORM.Lead1.ColorSeparate(COLORSEP_CMYK)
    && Just for fun, add contrast to the K plane

    THISFORM.Lead2.Bitmap = THISFORM.Lead1.ColorPlanes(3) && Copy the K plane
    THISFORM.Lead2.Contrast(300) && Increase the contrast
    THISFORM.Lead1.ColorPlanes(3) = THISFORM.Lead2.Bitmap && Update the K plane

    Msg = "Separated. Keep clicking to see separations, then merge"
    answer = MESSAGEBOX(Msg, 0, "Notice")
CASE SepClickCount = 1
    THISFORM.Lead2.Bitmap = THISFORM.Lead1.ColorPlanes(0) && Cyan
    THISFORM.Lead1.Bitmap = THISFORM.Lead2.Bitmap
    THISFORM.Lead1.ForceRepaint
CASE SepClickCount =  2
    THISFORM.Lead2.Bitmap = THISFORM.Lead1.ColorPlanes(1) &&  Magenta
    THISFORM.Lead1.Bitmap = THISFORM.Lead2.Bitmap
    THISFORM.Lead1.ForceRepaint
CASE SepClickCount =  3
    THISFORM.Lead2.Bitmap = THISFORM.Lead1.ColorPlanes(2) &&  Yellow
    THISFORM.Lead1.Bitmap = THISFORM.Lead2.Bitmap
    THISFORM.Lead1.ForceRepaint
CASE SepClickCount =  4
    THISFORM.Lead2.Bitmap = THISFORM.Lead1.ColorPlanes(3) &&  K
    THISFORM.Lead1.Bitmap = THISFORM.Lead2.Bitmap
    THISFORM.Lead1.ForceRepaint
CASE SepClickCount =  5
    THISFORM.Lead1.ColorMerge(COLORSEP_CMYK)
    THISFORM.Lead1.ForceRepaint
    THISFORM.Lead1.ColorPlanes(0) = 0
    THISFORM.Lead1.ColorPlanes(1) = 0
    THISFORM.Lead1.ColorPlanes(2) = 0
    THISFORM.Lead1.ColorPlanes(3) = 0
    Msg = "Merged, with more contrast in the K plane"
    answer = MESSAGEBOX(Msg, 0, "Notice")
OTHERWISE
    SepClickCount = -1
    Msg = "Cycle is finished"
    answer = MESSAGEBOX(Msg, 0, "Notice")
ENDCASE

SepClickCount = SepClickCount + 1
_SCREEN.MousePointer = 0 &&  default

7.	Run your program to test it. Notice that you can click the button several times to create the separations, view each of them, and merge them to recreate the original bitmap.


Updating a Gauge and Detecting a User Interrupt (FoxPro)

Take the following steps to update a gauge during processing and detect a user interrupt.

Note: The event processing for this example works with Visual FoxPro 5.0. It does not work with version 3.0.

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

2.	 Add two command buttons to your form and name them as follows:

Name	Caption

DoMedian	Do Median

QuitBtn	Quit

3.	Build a gauge consisting of a horizontal line [image] (Line1) inside a rectangle [image] (Shape1).

4.	Add the following public variables to the bottom of the Form1 Init procedure:

PUBLIC fEscape  && Use to indicate the user interrupt
PUBLIC fInProc  && Use to avoid closing the form during processing

5.	Code to the DoMedian button's Click procedure as follows:

&& Override default processing of Windows messages.
&& This ensures that the LEAD control gets its own events.
APPLICATION.AutoYield = .F.

&& Enable the ProgressStatus event
THISFORM.Lead1.EnableProgressEvent = .T.

&& Initialize the indicators
fEscape = .F. && The user does not want to quit
fInProc = .T. && Processing is taking place

&& Perform a relatively slow median filter
THISFORM.Lead1.Median(4)

fInProc = .F. && Processing is no longer taking place
THISFORM.Lead1.ForceRepaint

6.	Code the Lead1 control's ProgressStatus procedure as follows:

*** OLE Control Event ***
LPARAMETERS ipercent

DOEVENTS && Detect Windows events

IF (fEscape = .F.) && Look for the Click on the Quit button
  LineLength = THISFORM.Shape1.Width * iPercent / 100 && Udpate the gauge
  THISFORM.Line1.Left = THISFORM.Shape1.Left
  THISFORM.Line1.Width = LineLength
ELSE
  THISFORM.Lead1.EnableProgressEvent = .F. && Cancel the task
ENDIF

7.	Code to the QuitBtn button's Click procedure as follows:

fEscape = .T. && The user wants to quit
THISFORM.Line1.Width = 1 && Set the gauge back to the beginning

8.	Add the following code to the main form's QueryUnload procedure:

IF (fInProc = .T.) && If processing is taking place
   NODEFAULT && Do not let the user close the form
ENDIF

9.	Run your program to test it.


Miscellaneous Examples (FoxPro)

You can test any of the following examples by adding a command button to one of the previous lessons in the tutorial, and pasting the sample code in the Click procedure.

In most cases, you can add the button after the first lesson Loading and Displaying an Image. In cases where you need to zoom in or zoom out, you must first finish Zooming Out and Zooming In.

AboutBox example for FoxPro

AddNoise example for FoxPro

Animate Event Example for Visual FoxPro

AnimationEnable Example for Visual FoxPro

AnnAutoDrawEnable Example for Visual FoxPro

AnnAutomation Property Example for Visual FoxPro

AnnAutoMenuEnable Example for Visual FoxPro

AnnAutoRotate example for Visual FoxPro

AnnChange Event Example for Visual FoxPro

AnnDataPath example for Visual FoxPro

AnnGetHyperlinkParam example for Visual FoxPro

AnnGetHyperlinkString example for Visual FoxPro

AnnGetHyperlinkType example for Visual FoxPro

AnnGetLocked example for Visual FoxPro

AnnGetPointCount example for Visual FoxPro

AnnGetSelectCount example for Visual FoxPro

AnnHyperlink example for Visual FoxPro

AnnHyperlinkMenu example for Visual FoxPro

AnnHyperlinkMenuEnable example for Visual FoxPro

AnnLock example for Visual FoxPro

AnnLocked example for Visual FoxPro

AnnMove example for Visual FoxPro

AnnRotate example for FoxPro

AnnSaveMemory example for Visual FoxPro

AnnSaveTag example for Visual FoxPro

AnnSetAutoText Example for Visual FoxPro

AnnSetHyperlinkMsg Example for Visual FoxPro

AnnSetHyperlinkString Example for Visual FoxPro

AnnShowLockedIcon Example for Visual FoxPro

AnnUnlock Example for Visual FoxPro

AnnUnlocked Example for Visual FoxPro

AnnUnrealize Example for Visual FoxPro

Appearance Example for Visual FoxPro

AutoAnimate Example for Visual FoxPro

AutoSize Example for Visual FoxPro

AutoTrim example for Visual FoxPro

Average example for FoxPro

BackColor example for FoxPro

BackErase example for FoxPro

BinaryFilter example for FoxPro

BitmapAlpha example for Visual FoxPro

BitmapDataPath Example for Visual FoxPro

BitmapXres and BitmapYres example for FoxPro

BitonalScaling example for FoxPro

BorderStyle example for FoxPro

Capture example for FoxPro

Change example for FoxPro

ColorRes example for FoxPro

ColorResList Example for Visual FoxPro

Combine example for FoxPro

Contrast example for FoxPro

CreateBitmap, Size, and Combine example for FoxPro

dbCan... example for Visual FoxPro

DblClick example for FoxPro

DDB example for FoxPro

DeleteBitmapListItems example for Visual FoxPro

Deskew example for FoxPro

Despeckle example for FoxPro

DIB example for FoxPro

DrawShape example for Visual FoxPro

DrawText example for Visual FoxPro

Dst.... example for FoxPro

Emboss example for FoxPro

EnableMethodErrors example for FoxPro

EnableZoomInRect example for FoxPro

FastRotate example for Visual FoxPro

FilePage Event Example for Visual FoxPro

Fill example for FoxPro

Flip example for FoxPro

FloaterDstClip... example for FoxPro

Font example for Visual FoxPro

Frame... example for Visual FoxPro

GammaCorrect example for FoxPro

GetBitmapDC example for FoxPro

GetColorCount Example for Visual FoxPro

GetFileInfo example for FoxPro

GetFloaterHandle example for FoxPro

GetHistogram example for FoxPro

GetMinMaxBits example for FoxPro

GetMinMaxVal example for FoxPro

GetRgnHandle example for FoxPro

Grayscale example for FoxPro

Halftone example for FoxPro

HistoContrast example for FoxPro

HistoEqualize example for FoxPro

Hue example for FoxPro

IgnoreFilters Example for Visual FoxPro

InsertBitmapListItem Example for Visual FoxPro

Intensity example for FoxPro

IntensityDetect example for FoxPro

Invert example for FoxPro

KeyPress example for FoxPro

LevelHighBit example for FoxPro

LevelLowBit example for FoxPro

LevelLUT example for FoxPro

LevelLUTLength example for FoxPro

LoadInfo... example for FoxPro

LoadMemory example for FoxPro

LoadUseViewPerspective example for Visual FoxPro

MaxFilter example for Visual FoxPro

Median example for FoxPro

MinFilter example for Visual FoxPro

Mosaic example for FoxPro

ODBC Example for Visual FoxPro

Oilify example for Visual FoxPro

OLEDropAllowed example for Visual FoxPro

Paint event example for FoxPro

PaintContrast example for Visual FoxPro

PaintDither example for FoxPro

PaintEffect example for FoxPro

PaintGamma example for Visual FoxPro

PaintIntensity example for Visual FoxPro

PaintMaxPasses example for Visual FoxPro

PaintPalette example for FoxPro

PaintROP3 example for FoxPro

PaintSizeMode Example for Visual FoxPro

PaintSizeUseDPI example for Visual FoxPro

PaintWhileLoad example for FoxPro

PaintZoomFactor Example for Visual FoxPro

PatternStyle example for Visual FoxPro

Pixel example for Visual FoxPro

Posterize example for FoxPro

PreLoadFilters Example for Visual FoxPro

ProgressivePasses Example for Visual FoxPro

ReadLoadResolutions Example for Visual FoxPro

ReadyState Example for Visual FoxPro

Render example for FoxPro

Resize event example for FoxPro

RgnChange example for FoxPro

Rotate example for FoxPro

Saturation example for FoxPro

Save example for FoxPro

SaveInterlaced example for Visual FoxPro

SaveMemory example for FoxPro

SaveWithStamp example for FoxPro

Scroll event example for FoxPro

SetRgn... example for FoxPro

SetSrcClipRect example for FoxPro

SetSrcRect example for FoxPro

Sharpen example for FoxPro

Shear example for FoxPro

Solarize example for Visual FoxPro

SpatialFilter example for FoxPro

Src.... example for FoxPro

StretchIntensity example for FoxPro

TextWordWrap example for Visual FoxPro

TransitionEffect example for Visual FoxPro

TransparentColor example for Visual FoxPro

Trim example for FoxPro

Underlay example for FoxPro

UserPalette and BitmapPalette example for FoxPro

Version... example for FoxPro

WindowLevel example for FoxPro

ZoomIn example for FoxPro

ZoomInDone example for FoxPro


AboutBox example for FoxPro

This example displays the LEADTOOLS ActiveX information.

THISFORM.Lead1.AboutBox


AddNoise example for FoxPro

This example adds red noise and redisplays the bitmap.

THISFORM.Lead1.AddNoise(500, CHANNEL_RED)
THISFORM.Lead1.ForceRepaint


Animate Event Example for Visual FoxPro

This example shows how the Animate event can be used to toggle the use of a button to start and stop the animation.

*** OLE Control Event ***
LPARAMETERS benable
IF benable = .T.
  THISFORM.Command1.Caption = "Stop Animation"
ELSE
  THISFORM.Command1.Caption = "Start animation"

&& Command1 Click Event
IF THISFORM.Lead1.AnimationEnable = .T.
  THISFORM.Lead1.AnimationEnable = .F.
ELSE
  THISFORM.Lead1.AnimationEnable = .T.
ENDIF


AnimationEnable Example for Visual FoxPro

This example loads and plays an animated file. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

&& Load all pages of an AVI file.
THISFORM.Lead1.Load("c:\wndsurf1.avi", 0, 1, -1)

&& Set properties for a scaled animation.
THISFORM.Lead1.AutoRepaint = .T.
THISFORM.Lead1.AutoSetRects = .F.

&& Set the image display size to match the LEAD control.
THISFORM.Lead1.SetDstRect(0, 0, THISFORM.Lead1.ScaleWidth, THISFORM.Lead1.ScaleHeight)
THISFORM.Lead1.SetDstClipRect(0, 0, THISFORM.Lead1.ScaleWidth, THISFORM.Lead1.ScaleHeight)

&& Allow a continuous loop.
THISFORM.Lead1.AnimationLoop = .T.

&& Start the animation.
THISFORM.Lead1.AnimationEnable = .T.


AnnAutoDrawEnable Example for Visual FoxPro

Note: This topic is for Document/Medical only.

This example toggles the AnnAutoDrawEnable property.

IF THISFORM.Lead1.AnnAutoDrawEnable = .T.
   THISFORM.Lead1.AnnAutoDrawEnable = .F.
ELSE
   THISFORM.Lead1.AnnAutoDrawEnable = .T.
ENDIF


AnnAutomation Property Example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example shows how you can use the AnnAutomation property to access the automation object through DLL functions.

DECLARE INTEGER L_AnnGetFontBold IN LTANN12N INTEGER hObject, INTEGER @ Bold
DECLARE INTEGER L_AnnSetFontBold IN LTANN12N INTEGER hObject, INTEGER bold, INTEGER flags

PUBLIC IsBold

hAnnObject = THISFORM.Lead1.AnnAutomation

&& Set the default font to bold, unless it already is
nRet = L_AnnGetFontBold(hAnnObject, @IsBold)
IF IsBold = .T.
  answer = MESSAGEBOX("Already bold", 0, "Notice")
ELSE
  nRet = L_AnnSetFontBold(hAnnObject,.T., 0)
ENDIF

RELEASE IsBold


AnnAutoMenuEnable Example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example toggles the AnnAutoMenuEnable property.

IF THISFORM.Lead1.AnnAutoMenuEnable = .T.
   THISFORM.Lead1.AnnAutoMenuEnable = .F.
ELSE
   THISFORM.Lead1.AnnAutoMenuEnable = .T.
ENDIF


AnnAutoRotate example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example enables automatic rotation of annotations, then rotates the bitmap 2222 hundredths of degrees to demonstrate the automation:

THISFORM.Lead1.AnnAutoRotate = .T.
THISFORM.Lead1.Rotate(2222, 0, RGB(0, 0, 255))


AnnChange Event Example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example tests the AnnChange event.

*** OLE Control Event ***

LPARAMETERS hobject
buffer = "This is a change for the button tagged " + STR(THISFORM.Lead1.AnnGetTag(hObject))
answer = MESSAGEBOX(buffer, 0, "AnnChange Event")


AnnDataPath example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example shows how to load an annotation file from the Internet.

THISFORM.Lead1.AnnDataPath = 'ftp://ftp.leadtools.com/vbaward.ann'


AnnGetHyperlinkParam example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example retrieves parameters using AnnGetHyperlinkParam.

*** OLE Control Event ***
LPARAMETERS hobject

    nType = THISFORM.Lead1.AnnGetHyperlinkType(hObject)
    If (nType = ANNLINK_ANNEVENT5) Then
        msgstr = "Params are: " + Chr(13)
        For iParamCount = 0 To 4
            lRet = THISFORM.Lead1.AnnGetHyperlinkParam(hObject, iParamCount)
            msgstr = msgstr + "   Param" + Str(iParamCount + 1) + ": " + Str(lRet) + Chr(13)
        Next
    Else
        msgstr = "Invalid Type"
    EndIf
    answer = MESSAGEBOX(msgstr)


AnnGetHyperlinkString example for Visual FoxPro

Note: This topic is for Document/Medical  only.

The following example places calls to both the AnnSetHyperlinkString method and the AnnGetHyperlinkString method.

    && Set AnnHyperLink to a URL
    THISFORM.Lead1.AnnSetHyperlinkString(ghObject, ANNLINK_WEBPAGE, "http://www.leadtools.com")
    && get the string to see what got set
    linkstr = THISFORM.Lead1.AnnGetHyperlinkString(ghObject)
    answer = MESSAGEBOX(linkstr)


AnnGetHyperlinkType example for Visual FoxPro

Note: This topic is for Document/Medical  only.

The following is an example of AnnHyperlink event code which includes a call to AnnGetHyperlinkType.

Private Sub Lead1_AnnHyperlink(ByVal hObject As Long, ByVal iParamCount As Integer, ByVal lParam1 As Long, ByVal lParam2 As Long, ByVal lParam3 As Long, ByVal lParam4 As Long, ByVal lParam5 As Long)
    Dim msgstr As String
    Dim nType As Integer

    nType = Lead1.AnnGetHyperlinkType(hObject)
    If ((nType = ANNLINK_ANNEVENT5) Or (nType = ANNLINK_ANNEVENT)) Then
If iParamCount >= 0 Then
            msgstr = Str(iParamCount) + " params are valid" + Chr(13)
        EndIf
        If iParamCount >= 1 Then
            msgstr = msgstr + "Param1: " + Str(lParam1) + Chr(13)
        EndIf
        If iParamCount >= 2 Then
            msgstr = msgstr + "Param2: " + Str(lParam2) + Chr(13)
        EndIf
        If iParamCount >= 3 Then
            msgstr = msgstr + "Param3: " + Str(lParam3) + Chr(13)
        EndIf
        If iParamCount >= 4 Then
            msgstr = msgstr + "Param4: " + Str(lParam4) + Chr(13)
        EndIf
        If iParamCount = 5 Then
            msgstr = msgstr + "Param5: " + Str(lParam5) + Chr(13)
        EndIf
    Else
        msgstr = "Invalid Type"
    EndIf
    answer = MESSAGEBOX(msgstr)


AnnGetPointCount example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example, in the AnnDrawn procedure, gets the number of points that define the polygon that was just drawn.

*** OLE Control Event ***
LPARAMETERS hobject
nType = THISFORM.Lead1.AnnGetType(hobject)

If (nType = ANNOBJECT_POLYGON) Then
    nPoints = THISFORM.Lead1.AnnGetPointCount(hobject)
    answer = MESSAGEBOX("Polygon has " + str(nPoints) + " points",0,"Note")
EndIf


AnnGetSelectCount example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example gets the number of selected annotation objects.

uCount = THISFORM.Lead1.AnnGetSelectCount()
answer = MESSAGEBOX(Str(uCount) + " objects were selected")


AnnHyperlinkMenu example for Visual FoxPro

Note: This topic is for Document/Medical  only.

Variant Problem in FoxPro

FoxPro was unable to get or set data from the VARIANT data type during testing.


AnnHyperlinkMenuEnable example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example toggles the AnnHyperlinkMenuEnable property .

    && toggle AnnHyperLinkMenu item and event
    If (THISFORM.Lead1.AnnHyperlinkMenuEnable = .T.) Then
        THISFORM.Lead1.AnnHyperlinkMenuEnable = .F.
    Else
        THISFORM.Lead1.AnnHyperlinkMenuEnable = .T.
    EndIf


AnnLock example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example locks objects of type ANNOBJECT_ELLIPSE using the key "IkeStarnes".

THISFORM.Lead1.AnnLock(ghObject, "IkeStarnes", .F.)


AnnLocked example for Visual FoxPro

Note: This topic is for Document/Medical  only.

The following is an example of an AnnLocked event.

*** OLE Control Event ***

LPARAMETERS hobject
    msg = "Object: " + Str(hobject) + " was locked"
    answer = MESSAGEBOX(msg, 0, "Locked")


AnnMove example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example moves one or more selected annotation objects.

&& Use twips.
THISFORM.Lead1.ScaleMode = 1

&& Specify arbitrary delta values.
DeltaX = +2000
DeltaY = -2000

&& Move the selected annotations.
THISFORM.Lead1.AnnMove(DeltaX, DeltaY, .T.)


AnnRotate example for FoxPro

Note: This topic is for Document/Medical  only.

This example uses the AnnFlip, AnnReverse, and AnnRotate methods. To code this example, add a command button named Test to the example you created in Loading and Displaying an Image. For best results when you run the example, draw two objects in opposite corners, and use the right mouse button to select all annotation objects. The command button then lets you cycle through the AnnFlip, AnnReverse, and AnnRotate methods.

MyCaption = THISFORM.Test.Caption

DO CASE
CASE MyCaption = "Flip"
    && Flip using the center of the bitmap as the axis.
    THISFORM.Lead1.AnnFlip(.T., THISFORM.Lead1.BitmapHeight / 2, .T.)
    THISFORM.Test.Caption = "Reverse"
CASE MyCaption = "Reverse"
    && Reverse using the center of the bitmap as the axis.
    THISFORM.Lead1.AnnReverse(.T., THISFORM.Lead1.BitmapWidth / 2, .T.)
    THISFORM.Test.Caption = "Rotate"
CASE MyCaption = "Rotate"
    && Rotate 90 degrees using the center of the bitmap as the axis.
    THISFORM.Lead1.AnnRotate(.T., THISFORM.Lead1.BitmapWidth / 2, THISFORM.Lead1.BitmapHeight / 2, 90, .T.)
    THISFORM.Test.Caption = "Flip"
OTHERWISE
    THISFORM.Test.Caption = "Flip"
    THISFORM.Lead1.AnnUserMode = ANNUSERMODE_DESIGN
    THISFORM.Lead1.AnnTool = ANNTOOL_REDACT
    Msg = "Draw two objects, use the right mouse button to select all, then click the command button"
   answer = MESSAGEBOX(Msg, 0, "Notice")
ENDCASE


AnnSaveMemory example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example lets you save the current annotations to a file in memory, and lets you load the annotations that were saved.

1.	Start with the project that you created in Creating and Using Annotations.

2.	Add the following code to the bottom of the Form1 Init procedure:

&& Declare and initialize for the memory handle and size.
PUBLIC hMem
PUBLIC iSize
hMem = 0
iSize = 0

3.	 At the top of your main form, add two command buttons and name them as follows:

Name	Caption

AnnSaveMem	Save In Memory

AnnLoadMem	Load From Memory

4.	Code the AnnSaveMem button's Click procedure as follows:

nret = THISFORM.Lead1.AnnSaveMemory( @hMem, ANNFMT_NATIVE, .F., @iSize )
if nret <> 0
   =MESSAGEBOX( "Error calling AnnSaveMemory" )
   return
endif

5.	Code the AnnLoadMem button's Click procedure as follows:

if THISFORM.Lead1.AnnLoadMemory( hMem, iSize ) <> 0
   nret = MESSAGEBOX( "Error calling AnnLoadMemory" )
else
   THISFORM.Lead1.ForceRepaint
   nret = MESSAGEBOX( "AnnLoadMemory succeeded" )
endif
nret = GlobalFree( hMem )
THISFORM.Lead1.ForceRepaint

6.	Run your program to test it.


AnnSaveTag Example for Visual FoxPro

Note: This topic is for Document/Medical  only.

The following example saves selected objects as a Wang compatible TIFF tag.

&& Save only selected objects in Wang TIFF tag
THISFORM.Lead1.AnnSaveTag(.T.,.T.)

THISFORM.Lead1.Save("d:\temp\testwang.tif", FILE_CCITT_GROUP4, 1, 2, SAVE_OVERWRITE)


AnnSetAutoText Example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example modifies the text string that is used for the undo option on the annotation pop-up menu.

TestText = THISFORM.Lead1.AnnGetAutoText(ANNAUTOTEXT_MENU_UNDO)
TestText = TestText + " - New"
THISFORM.Lead1.AnnSetAutoText(ANNAUTOTEXT_MENU_UNDO, TestText)


AnnSetHyperlinkMsg Example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This is an example for AnnSetHyperlinkMsg.

&& set HyperLink to type ANNLINK_ANNEVENT5
    && and set the 5 params to some values.
    THISFORM.Lead1.AnnSetHyperlinkMsg(ghObject, ANNLINK_ANNEVENT5, 5, 4, 3, 2, 1)


AnnShowLockedIcon Example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example toggles the AnnShowLockedIcon property.

&& Toggle AnnShowLockedIcon
If THISFORM.Lead1.AnnShowLockedIcon = .T. Then
    THISFORM.Lead1.AnnShowLockedIcon = .F.
Else
    THISFORM.Lead1.AnnShowLockedIcon = .T.
EndIf


AnnUnlock Example for Visual FoxPro

This is also the example for AnnGetLocked.

If an object is found to be locked, using AnnGetLocked method, the object is unlocked, by AnnUnlock, using the key "IkeStarnes".

bLocked = THISFORM.Lead1.AnnGetLocked(ghObject)
    If bLocked = .T. Then
        THISFORM.Lead1.AnnUnlock(ghObject, "IkeStarnes")
    EndIf


AnnUnlocked Example for Visual FoxPro

Note: This topic is for Document/Medical  only.

The following is an example of an AnnUnlocked event.

*** OLE Control Event ***
LPARAMETERS hobject
    msg = "Object: " + Str(hobject) + " was unlocked"
    answer = MESSAGEBOX(msg, 0, "Unlocked")


AnnUnrealize Example for Visual FoxPro

Note: This topic is for Document/Medical  only.

The following example calls the AnnUnrealize method.

&& Unrealize all redact objects in the container
THISFORM.Lead1.AnnUnrealize(THISFORM.Lead1.AnnContainer, .F.)


Appearance Example for Visual FoxPro

This example toggles the Appearance property.

IF THISFORM.Lead1.Appearance = APPEARANCE_FLAT Then
   THISFORM.Lead1.Appearance = APPEARANCE_THREED
ELSE
   THISFORM.Lead1.Appearance = APPEARANCE_FLAT
ENDIF


AutoAnimate Example for Visual FoxPro

This example gets information about an animated file, uses the information to position the LEAD control, and plays the animation as it loads the file.

&& Force continued looping after the file loads.
THISFORM.Lead1.AutoAnimationLoop = AUTOANIMATIONLOOP_INFINITE

&& Get information about the file we will load.
THISFORM.Lead1.GetFileInfo("c:\windows\system\wndsurf1.avi", 0, 0)

&& Exit if this is not an animated file.
IF THISFORM.Lead1.InfoAnimation = .F.
   answer = MESSAGEBOX("Not an animated file", 0, "Error")
ELSE
  HeightFactor = THISFORM.Lead1.InfoHeight
  WidthFactor = THISFORM.Lead1.InfoWidth
  HeightAllowed = THISFORM.Height * 3/4
  WidthAllowed = THISFORM.Width * 3/4
  && Use some variables for the control positioning so that
  && we do not move the control every time we change a value.
  ControlLeft = THISFORM.Lead1.Left
  ControlWidth = THISFORM.Lead1.Width
  ControlHeight = THISFORM.Lead1.Height
  ControlTop = THISFORM.Lead1.Top

  && Center the LEAD control on the form, preserving the aspect ratio.
  && Check to see if using the maximum width will make the image too tall.
  && Set the dimensions based on the result.
  IF ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed
    ControlLeft = THISFORM.Width / 8
    ControlWidth = WidthAllowed
    ControlHeight = (ControlWidth * HeightFactor) / WidthFactor
    ControlTop = (THISFORM.Height - ControlHeight) / 2
  ELSE
    ControlTop = THISFORM.Height / 8
    ControlHeight = HeightAllowed
    ControlWidth = (ControlHeight * WidthFactor) / HeightFactor
    ControlLeft = (THISFORM.Width - ControlWidth) / 2
  ENDIF

  && Set the position and size of the LEAD control.
  THISFORM.Lead1.Left = ControlLeft
  THISFORM.Lead1.Top = ControlTop
  THISFORM.Lead1.Width = ControlWidth
  THISFORM.Lead1.Height = ControlHeight

  && Set properties for playing the animation as is loads.
  THISFORM.Lead1.AutoAnimate = .T.
  THISFORM.Lead1.AutoRepaint = .T.

  && Load the animated file.
  THISFORM.Lead1.Load("c:\windows\system\wndsurf1.avi", 0, 0, -1)
ENDIF


AutoSize Example for Visual FoxPro

This example shows how the AutoSize property works when loading and when rotating an image.

THISFORM.Lead1.AutoSize = .T.
THISFORM.Lead1.Load("c:\lead\images\image1.cmp", 0, 0, 1)
answer = MESSAGEBOX("Control is sized to fit the loaded bitmap", 0, "Notice")
THISFORM.Lead1.Rotate(4500, 0, RGB(0, 0, 0))
answer = MESSAGEBOX("Control is sized to fit the rotated bitmap", 0, "Notice")


AutoTrim example for Visual FoxPro

This example trims the bitmap with threshold of 10.

THISFORM.Lead1.AutoTrim(10)
THISFORM.Lead1.ForceRepaint


Average example for FoxPro

This example applies an average filter with a 3x3 neighborhood and redisplays the bitmap.

THISFORM.Lead1.Average(3)
THISFORM.Lead1.ForceRepaint


BackColor example for FoxPro

This example sets the background color to red. You can zoom out to see the background color.

THISFORM.Lead1.BackColor = RGB(255,0,0)


BackErase example for FoxPro

This example turns off repainting of the background, then zooms out to show the effect when repainting.

THISFORM.Lead1.BackErase = .F.
THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead1.AutoScroll = .F.

&& Calculate the values to zoom out by 10 percent and center the image.
THISFORM.Lead1.DstWidth = THISFORM.Lead1.DstWidth * 0.9
THISFORM.Lead1.DstHeight = THISFORM.Lead1.DstHeight * 0.9
THISFORM.Lead1.DstTop = (THISFORM.Lead1.ScaleHeight - THISFORM.Lead1.DstHeight) / 2
THISFORM.Lead1.DstLeft = (THISFORM.Lead1.ScaleWidth - THISFORM.Lead1.DstWidth) / 2

&& Set the clipping area to the same as the destination rectangle
THISFORM.Lead1.DstClipWidth = THISFORM.Lead1.DstWidth
THISFORM.Lead1.DstClipHeight = THISFORM.Lead1.DstHeight
THISFORM.Lead1.DstClipTop = THISFORM.Lead1.DstTop
THISFORM.Lead1.DstClipLeft = THISFORM.Lead1.DstLeft

&& Redisplay the image
THISFORM.Lead1.ForceRepaint


BinaryFilter example for FoxPro

This example does omni-directional erosion of black objects and repaints the image.

THISFORM.Lead1.BinaryFilter(BFLT_EROSION_OMNI)
THISFORM.Lead1.ForceRepaint


BitmapAlpha example for Visual FoxPro

This example shows how to use the BitmapAlpha property to save a region in a file's alpha channel. It also shows how to use the region as a mask for transparency.

THISFORM.Lead1.ScaleMode = 3
THISFORM.Lead1.Load("c:\lead\images\image1.cmp", 0, 0, 1)
THISFORM.Lead1.AutoRepaint = .F.

&& Get an alpha channel bitmap, and fill it with white
THISFORM.Lead2.Bitmap = THISFORM.Lead1.BitmapAlpha
THISFORM.Lead2.Fill(RGB(255, 255, 255))

rgntop = 0
rgnleft = 0
rgnwidth = THISFORM.Lead1.BitmapWidth
rgnheight = THISFORM.Lead1.BitmapHeight

&& Create an elliptical region in the AlphaBitmap
THISFORM.Lead2.SetRgnEllipse(rgntop, rgnleft, rgnwidth, rgnheight, L_RGN_SET)

&& Fill the region with black
THISFORM.Lead2.Fill(RGB(0, 0, 0))

&& Free the region
THISFORM.Lead2.FreeRgn()

&& Update the alpha channel in the main bitmap
THISFORM.Lead1.BitmapAlpha = THISFORM.Lead2.Bitmap

&& Save the bitmap as 32-bit TGA
THISFORM.Lead1.Save("test.tga", FILE_TGA, 32, 0, SAVE_OVERWRITE)

&& Free the bitmaps
THISFORM.Lead1.Bitmap = 0
THISFORM.Lead2.Bitmap = 0

&& Load the bitmap we just saved and get the alpha channel
THISFORM.Lead1.Load("test.tga", 0, 0, 1)
THISFORM.Lead2.Bitmap = THISFORM.Lead1.BitmapAlpha

&& Create a region in the AlphaBitmap that includes all of the black pixels
THISFORM.Lead2.SetRgnColor(RGB(0, 0, 0), L_RGN_SET)

&& get the region from the AlphaBitmap and set it into the main bitmap
hRGN = THISFORM.Lead2.GetRgnHandle()
THISFORM.Lead1.SetRgnHandle(hRGN, 0, 0, L_RGN_SET)

THISFORM.Lead1.PaintRgnOnly = .T.

THISFORM.Lead1.ForceRepaint()


BitmapDataPath Example for Visual FoxPro

This example shows how to load an image from the Internet. It uses the BitmapDataPath property to start the asynchronous load; then uses the ReadyStateChange event to paint the image when loading is complete.

&& Start the asynchronous load.
THISFORM.Lead1.BitmapDataPath = "http://www.leadtools.com/images/vbaward.jpg"

*** OLE Control Event ***
LPARAMETERS readystate
    && Paint the image when loading is complete.
    IF ReadyState = READYSTATE_COMPLETE
        THISFORM.Lead1.AutoSetRects = .T.
        THISFORM.Lead1.PaintSizeMode = PAINTSIZEMODE_FIT
        THISFORM.Lead1.ForceRepaint
    ENDIF


BitmapXres and BitmapYres example for for FoxPro
BitmapXres and BitmapYres example for FoxPro

This example sets the bitmap's resolution to 300 x 600 DPI.

THISFORM.Lead1.BitmapXres = 300
THISFORM.Lead1.BitmapYres = 600


BitonalScaling example for FoxPro

This example sets the display to use scale-to-gray and repaints the image. This affects only 1-bit images.

IF THISFORM.Lead1.IsSupportLocked(L_SUPPORT_DOCUMENT)
    cMsg = "No scale to gray - You need to unlock Document/Medical capabilities"
    answer = MESSAGEBOX(cMsg, 0, "Error")
ELSE
    THISFORM.Lead1.BitonalScaling = BITONALSCALING_SCALETOGRAY
    THISFORM.Lead1.ForceRepaint
ENDIF


BorderStyle example for FoxPro

This example toggles the border style and repaints the image.

IF THISFORM.Lead1.BorderStyle = 1
   THISFORM.Lead1.BorderStyle = 0
ELSE
   THISFORM.Lead1.BorderStyle = 1
ENDIF
THISFORM.Lead1.ForceRepaint


Capture example for FoxPro

This example captures the current form and displays the captured image with scroll bars.

Turn on automatic adjustment of display rectangles.
THISFORM.Lead1.AutoSetRects = .T.

&& Set the scale mode to pixels temporarily.
OldMode = THISFORM.Lead1.ScaleMode
THISFORM.Lead1.ScaleMode = 3

&& Capture the FoxPro window
CaptureLeft = _SCREEN.Left
CaptureTop = _SCREEN.Top
CaptureWidth = _SCREEN.Width
CaptureHeight = _SCREEN.Height
THISFORM.Lead1.Capture(0, CaptureLeft, CaptureTop, CaptureWidth, CaptureHeight)

&& Turn on scroll bars and repaint.
THISFORM.Lead1.AutoScroll = .T.
THISFORM.Lead1.ForceRepaint

&& Set the scale mode back to whatever it was.
THISFORM.Lead1.ScaleMode = OldMode


Change example for Visual FoxPro

Note: The event processing for this example works with Visual FoxPro 5.0. It does not work with version 3.0.

Typically, you would use the Change event to flag changed image data and prompt the user to save the changes before closing a window or exiting an application.  That use of the event cannot be tested properly without writing a complete application; so this example just shows you a simple test of the event.

This example includes two procedures.

First, a button click makes a change in the image data:

&& Override default processing of Windows messages.
&& This ensures that the LEAD control gets its own events.
APPLICATION.AutoYield = .F.

&& Flip the image.
THISFORM.Lead1.Flip

Then, LEAD's Change event displays a message:

*** OLE Control Event ***
answer = MESSAGEBOX("Image data has changed", 0, "Notice")


ColorRes example for FoxPro

This example checks to see if the bitmap is 8 bits per pixel and converts it if it is not.

IF THISFORM.Lead1.BitmapBits <> 8
    _SCREEN.MousePointer = 11 && hourglass
    THISFORM.Lead1.ColorRes(8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0)
    THISFORM.Lead1.ForceRepaint
    _SCREEN.MousePointer = 0 && default
ENDIF


ColorResList Example for Visual FoxPro

This example changes the hue of bitmaps in a list, then plays the list as an animation. When changing the hue, it preserves the transparent color.

&& Save the current transparent color.
TransparentColor = THISFORM.Lead1.BitmapTransparentColor

&& Avoid repaints while we modify the bitmaps.
THISFORM.Lead1.AutoRepaint = .F.

&& Change the hue of each bitmap in the list,
&& and restore the transparent color as the last color in the palette.
uCount = THISFORM.Lead1.BitmapListCount
i = 0
DO WHILE(i<uCount)
   THISFORM.Lead1.BitmapListIndex = i
   THISFORM.Lead1.Hue(i * 10)
   THISFORM.Lead1.BitmapPalette(255) = TransparentColor
   i = i + 1
ENDDO

&& Get an optimized palette for the whole list.
THISFORM.Lead1.ColorResList(8, CRP_OPTIMIZEDPALETTE, CRD_NODITHERING, 0)

&& Update the palette that is used for playback.
i = 0
DO WHILE(i<256)
   THISFORM.Lead1.AnimationPalette(i) = THISFORM.Lead1.BitmapPalette(i)
   i = i + 1
ENDDO

&& Start the animation.
THISFORM.Lead1.AutoRepaint = .T.
THISFORM.Lead1.AnimationEnable = .T.


Combine example for FoxPro

This example copies the Lead1 bitmap to Lead2, trims and filters the copied image, and combines the filtered image with the original Lead1 bitmap image. Trimming Lead2 lets you see the difference between filtered and nonfiltered regions.

_SCREEN.MousePointer = 11 && hourglass
THISFORM.Lead2.Bitmap = THISFORM.Lead1.Bitmap

TrimLeft = (THISFORM.Lead2.BitmapWidth * 0.2)
TrimTop = (THISFORM.Lead2.BitmapHeight * 0.2)
TrimWidth = (THISFORM.Lead2.BitmapWidth * 0.6)
TrimHeight = (THISFORM.Lead2.BitmapHeight * 0.6)
THISFORM.Lead2.Trim(TrimLeft, TrimTop, TrimWidth, TrimHeight)

THISFORM.Lead2.SpatialFilter (FLT_LINESEG_LTOR)

DstLeft = TrimLeft
DstTop = TrimTop
DstWidth = TrimWidth
DstHeight = TrimHeight
SrcBitmap = THISFORM.Lead2.Bitmap
SrcLeft = 0
SrcTop = 0
 THISFORM.Lead1.Combine(DstLeft, DstTop, DstWidth, DstHeight, SrcBitmap, SrcLeft, SrcTop, CB_OP_ADD)

THISFORM.Lead1.ForceRepaint
_SCREEN.MousePointer = 0 && default


Contrast example for FoxPro

This example increases the contrast and repaints the image.

THISFORM.Lead1.Contrast(50)
THISFORM.Lead1.ForceRepaint


CreateBitmap, Size, and Combine example for FoxPro

This example creates a bitmap for Lead2 (same size and BPS as Lead1) and fills it with green. It resizes the Lead1 bitmap, then uses a loop to do multiple combines with the Lead2 bitmap. It then copies the Lead2 bitmap to Lead1 and redisplays Lead1.

_SCREEN.MousePointer = 11 && hourglass

&& Create the Lead2 bitmap. (The control must already be on the form).
MyWidth = THISFORM.Lead1.BitmapWidth
MyHeight = THISFORM.Lead1.BitmapHeight
MyBPS = THISFORM.Lead1.BitmapBits
THISFORM.Lead2.CreateBitmap(MyWidth, MyHeight, MyBPS)
THISFORM.Lead2.Fill(RGB(0, 255, 0)) && fill with green

&& Resize the Lead1 bitmap
ImageWidth = ROUND(MyWidth * 0.3, 0)
ImageHeight = ROUND(MyHeight * 0.3, 0)
THISFORM.Lead1.Size(ImageWidth, ImageHeight, RESIZE_RESAMPLE)

&& Initialize the variables used for multiple combines.
TestWidth = MyWidth && Used for horizontal positioning
TestHeight = MyHeight && Used for vertical positioning

VFactor = Int(MyHeight / ImageHeight) + 1 && Number spaces between images
VSpacing = ROUND(MOD(MyHeight, ImageHeight) / VFactor, 0) && Pixels between images

HFactor = Int(MyWidth / ImageWidth) + 1 && Number spaces between images
HSpacing = ROUND(MOD(MyWidth, ImageWidth) / HFactor, 0) && Pixels between images

DstT = VSpacing && Top coordinate of the destination rectangle
SrcL = 0 && Left coordinate of the source rectangle
SrcT = 0 && Top coordinate of the source rectangle
SrcBitmap = THISFORM.Lead1.Bitmap
DstW = ImageWidth  && Width of the destination rectangle
DstH = ImageHeight && Height of the destination rectangle
MyOp = CB_OP_ADD + CB_DST_0 && Operation flags used when combining images

&& Do the loop that does the multiple combines
DO WHILE(TestHeight > ImageHeight) && Vertical loop
    DstT = MyHeight - TestHeight + VSpacing
    TestHeight = TestHeight - ImageHeight - VSpacing
    DO WHILE(TestWidth > ImageWidth) && Horizontal loop
        DstL = MyWidth - TestWidth + HSpacing
        TestWidth = TestWidth - ImageWidth - HSpacing
        THISFORM.Lead2.Combine(DstL, DstT, DstW, DstH, SrcBitmap, SrcL, SrcT, MyOp)
    ENDDO
    TestWidth = MyWidth
ENDDO

&& Copy the Lead2 bitmap to Lead1
THISFORM.Lead1.Bitmap = THISFORM.Lead2.Bitmap

&& Set variables for positioning the image.
ViewWidth = THISFORM.Lead1.ScaleWidth
ViewHeight = THISFORM.Lead1.ScaleHeight

&& Set the image display size to match the LEAD control
THISFORM.Lead1.SetDstRect(0, 0, ViewWidth, ViewHeight)
THISFORM.Lead1.SetDstClipRect(0, 0, ViewWidth, ViewHeight)
THISFORM.Lead1.ForceRepaint && Repaint the image
_SCREEN.MousePointer = 0 && default


dbCan... example for Visual FoxPro

This example displays property values in a message box. You can implement this example by adding a button, with this code, to the project described in ODBC Example for Visual FoxPro.

IF THISFORM.Lead1.dbCanAppend = .T.
    Msg = "dbCanAppend = True."
ELSE
    Msg = "dbCanAppend = False."
ENDIF

IF THISFORM.Lead1.dbCanRestart = .T.
    Msg = Msg + CHR(13) + "dbCanRestart = True."
ELSE
    Msg = Msg + CHR(13) + "dbCanRestart = True."
ENDIF

IF THISFORM.Lead1.dbCanScroll = .T.
    Msg = Msg + CHR(13) + "dbCanScroll = True."
ELSE
    Msg = Msg + CHR(13) + "dbCanScroll = False."
ENDIF

IF THISFORM.Lead1.dbCanUpdate = .T.
    Msg = Msg + CHR(13) + "dbCanUpdate = True."
ELSE
    Msg = Msg + CHR(13) + "dbCanUpdate = False."
ENDIF

&& dbCurrentRecord is 0 based
Msg = Msg + CHR(13) + "dbCurrentRecord = " + ALLTRIM(STR(THISFORM.Lead1.dbCurrentRecord)) + "."
Msg = Msg + CHR(13) + "dbEditMode = " + ALLTRIM(STR(THISFORM.Lead1.dbEditMode)) + "."

IF THISFORM.Lead1.dbIsBOF = .T.
    Msg = Msg + CHR(13) + "dbIsBOF = True."
ELSE
    Msg = Msg + CHR(13) + "dbIsBOF = False."
ENDIF

IF THISFORM.Lead1.dbIsDeleted = .T.
    Msg = Msg + CHR(13) + "dbIsDeleted = True."
ELSE
    Msg = Msg + CHR(13) + "dbIsDeleted = False."
ENDIF

IF THISFORM.Lead1.dbIsEOF = .T.
    Msg = Msg + CHR(13) + "dbIsEOF = True."
ELSE
    Msg = Msg + CHR(13) + "dbIsEOF = False."
ENDIF

IF THISFORM.Lead1.dbIsOpen = .T.
    Msg = Msg + CHR(13) + "dbIsOpen = True."
ELSE
    Msg = Msg + CHR(13) + "dbIsOpen = False."
ENDIF

Msg = Msg + CHR(13) + "dbLoadBits = " + ALLTRIM(STR(THISFORM.Lead1.dbLoadBits)) + "."
Msg = Msg + CHR(13) + "dbLockingMode = " + ALLTRIM(STR(THISFORM.Lead1.dbLockingMode)) + "."
Msg = Msg + CHR(13) + "dbRecordCount = " + ALLTRIM(STR(THISFORM.Lead1.dbRecordCount)) + "."

Title = "LEADTOOLS ActiveX Database Properties"
Response = MESSAGEBOX(Msg, MB_OK + MB_EP, Title)


DblClick example for FoxPro

This example demonstrates the DblClick event.

*** OLE Control Event ***
THISFORM.Lead1.Flip && Just test the event
THISFORM.Lead1.ForceRepaint


DDB example for FoxPro

This example copies the Lead1 bitmap to the clipboard as a DDB. It pastes the DDB into Lead2 and reverses the image. It then gets a DDB from Lead2, sets the same DDB to Lead1, and repaints.

_SCREEN.MousePointer = 11 && hourglass
THISFORM.Lead1.AutoSetRects = .F.
MyFlags = COPY_EMPTY + COPY_DDB + COPY_PALETTE
THISFORM.Lead1.Copy(MyFlags)

IF THISFORM.Lead2.Paste(PASTE_ISREADY) = 0
    cMsg = " Invalid data on the clipboard "
    answer = MESSAGEBOX(cMsg, 0, "Error")
ELSE
    THISFORM.Lead2.Paste(0)
ENDIF

THISFORM.Lead2.Reverse
MyDC = THISFORM.Lead2.GetClientDC
MyPalette = THISFORM.Lead2.GetPalette(MyDC)
MyDDB = THISFORM.Lead2.GetDDB(MyDC)
THISFORM.Lead1.SetDDB(MyDC, MyDDB, MyPalette)
THISFORM.Lead1.ForceRepaint
THISFORM.Lead2.ReleaseClientDC
THISFORM.Lead1.AutoSetRects = .T.
_SCREEN.MousePointer = 0 && default


DeleteBitmapListItems example for Visual FoxPro

This example deletes the first five bitmaps from the control's bitmap list. Then, it plays the animation to show that the bitmaps are missing.

&&Delete the first five bitmaps.
THISFORM.Lead1.DeleteBitmapListItems(0, 5)

&&Play the animation without looping.
THISFORM.Lead1.AnimationLoop = .F.
THISFORM.Lead1.AnimationEnable = .T.


Deskew example for FoxPro

This example automatically straightens the bitmap and repaints the image. The image to be straightened should be mainly text.

THISFORM.Lead1.Deskew
THISFORM.Lead1.ForceRepaint


Despeckle example for FoxPro

This example automatically removes specks from the bitmap and repaints the image. Use this on a 1-bit bitmap such as a scanned document.

THISFORM.Lead1.Despeckle
THISFORM.Lead1.ForceRepaint


DIB example for FoxPro

This example copies the Lead1 bitmap to the clipboard as a DIB. It pastes the DIB into Lead2 and reverses the image. It then gets a DIB from Lead2, sets the same DIB to Lead1, and repaints.

_SCREEN.MousePointer = 11 && hourglass
THISFORM.Lead1.AutoSetRects = .F.
MyFlags = COPY_EMPTY + COPY_DIB + COPY_PALETTE
THISFORM.Lead1.Copy(MyFlags)

IF THISFORM.Lead2.Paste(PASTE_ISREADY) = 0
    cMsg = " Invalid data on the clipboard "
    answer = MESSAGEBOX(cMsg, 0, "Error")
ELSE
    THISFORM.Lead2.Paste(0)
ENDIF

THISFORM.Lead2.Reverse
MyDib = THISFORM.Lead2.GetDIB
THISFORM.Lead1.SetDIB(MyDib)
THISFORM.Lead1.ForceRepaint
THISFORM.Lead1.AutoSetRects = .T.
_SCREEN.MousePointer = 0 && default


DrawShape example for Visual FoxPro

This example demonstrates most of the three-dimensional shape properties as it draws a rectangle on the current bitmap. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

THISFORM.Lead1.AutoRepaint = .F.

&& Load an image for the main control
THISFORM.Lead1.Load ("c:\lead\images\image1.cmp", 0, 0, 1)

&& Load an image for the background of the shape
THISFORM.Lead2.Load ("ulay1.bmp", 0, 0, 1)

&& Shape background
THISFORM.Lead1.ShapeBackgroundStyle = EFX_BACKSTYLE_TILED_IMAGE
THISFORM.Lead1.BackgroundImageTop = 0
THISFORM.Lead1.BackgroundImageLeft = 0
THISFORM.Lead1.BackgroundImageWidth = THISFORM.Lead2.BitmapWidth
THISFORM.Lead1.BackgroundImageHeight = THISFORM.Lead2.BitmapHeight

&& Shape location
THISFORM.Lead1.ShapeTop = 50
THISFORM.Lead1.ShapeLeft = 50
THISFORM.Lead1.ShapeWidth = THISFORM.Lead1.DstWidth - 50
THISFORM.Lead1.ShapeHeight = THISFORM.Lead1.DstHeight - 50

&& Shape border
THISFORM.Lead1.ShapeBorderColor = RGB(255, 0, 0)
THISFORM.Lead1.ShapeBorderStyle = EFX_BORDERSTYLE_SOLID
THISFORM.Lead1.ShapeBorderThickness = 10

THISFORM.Lead1.ShapeInnerBandHiliteColor = RGB(255, 255, 255)
THISFORM.Lead1.ShapeInnerBandShadowColor = 0
THISFORM.Lead1.ShapeInnerBandStyle = EFX_INNERSTYLE_RAISED
THISFORM.Lead1.ShapeInnerBandThickness = 2

THISFORM.Lead1.ShapeOuterBandHiliteColor = RGB(0, 255, 0)
THISFORM.Lead1.ShapeOuterBandShadowColor = RGB(128, 128, 128)
THISFORM.Lead1.ShapeOuterBandStyle = EFX_OUTERSTYLE_RAISED
THISFORM.Lead1.ShapeOuterBandThickness = 2

&& Make the shape a permanent part of the bitmap
THISFORM.Lead1.DrawPersistence = .T.

&& Draw the shape
THISFORM.Lead1.DrawShape (EFX_SHAPE_RECTANGLE, THISFORM.Lead2.Bitmap)

&& Repaint
THISFORM.Lead1.AutoRepaint = .T.


DrawText example for Visual FoxPro

This example demonstrates most of the properties of a three-dimensional text object as it draws rotated text on the current bitmap.

THISFORM.Lead1.AutoRepaint = .F.

&& Load an image for the main control
THISFORM.Lead1.Load ("c:\lead\images\image1.cmp", 0, 0, 1)

&& Load an image for the foreground of the text
THISFORM.Lead2.Load ("ulay1.bmp", 0, 0, 1)

&& Text location
THISFORM.Lead1.TextTop = 50
THISFORM.Lead1.TextLeft = 50
THISFORM.Lead1.TextWidth = THISFORM.Lead1.DstWidth - 50
THISFORM.Lead1.TextHeight = THISFORM.Lead1.DstHeight - 50

&& Text alignment and angle
THISFORM.Lead1.TextAlign = EFX_TEXTALIGN_HCENTER_VCENTER
THISFORM.Lead1.TextAngle = 450   && 45 degrees

&& Text highlight color and style
THISFORM.Lead1.TextHiliteColor = RGB(255, 255, 255)
THISFORM.Lead1.TextStyle = EFX_TEXTSTYLE_DROPSHADOW

&& Text drop shadow
THISFORM.Lead1.ShadowColor = RGB(0, 0, 0)
THISFORM.Lead1.ShadowXDepth = 5
THISFORM.Lead1.ShadowYDepth = 5

&& Make the text a permanent part of the bitmap
THISFORM.Lead1.DrawPersistence = .T.

&& Draw the text
THISFORM.Lead1.DrawText ("LEADTOOLS", THISFORM.Lead2.Bitmap)
THISFORM.Lead1.ForceRepaint()


Dst.... example for FoxPro

This example uses the destination rectangle properties to zoom in on an image.

&& Get the size of the LEAD control's client area.
ClientWidth = THISFORM.Lead1.ScaleWidth
ClientHeight = THISFORM.Lead1.ScaleHeight

&& Calculate the values to zoom in by 10 percent and center the image.
THISFORM.Lead1.DstWidth = THISFORM.Lead1.DstWidth * 1.1
THISFORM.Lead1.DstHeight = THISFORM.Lead1.DstHeight * 1.1
THISFORM.Lead1.DstTop = (ClientHeight - THISFORM.Lead1.DstHeight) / 2
THISFORM.Lead1.DstLeft = (ClientWidth - THISFORM.Lead1.DstWidth) / 2

&& Set the clipping area to the same as the destination rectangle
THISFORM.Lead1.DstClipWidth = THISFORM.Lead1.DstWidth
THISFORM.Lead1.DstClipHeight = THISFORM.Lead1.DstHeight
THISFORM.Lead1.DstClipTop = THISFORM.Lead1.DstTop
THISFORM.Lead1.DstClipLeft = THISFORM.Lead1.DstLeft

&& Redisplay the image
THISFORM.Lead1.ForceRepaint


Emboss example for FoxPro

This example applies an emboss effect and repaints the image.

THISFORM.Lead1.Emboss(EMBOSS_NE, 500)
THISFORM.Lead1.ForceRepaint


EnableMethodErrors example for FoxPro

This example disables method errors temporarily so that it can give the user guidance about a particular error (an out-of-range shear angle in this case).

ShearAngle = 9000 && This would be the user's input * 100
THISFORM.Lead1.EnableMethodErrors = .F.

nRet = THISFORM.Lead1.Shear(ShearAngle, .T., RGB(0,0,255))
IF nRet = 20013
   cMsg = "The angle cannot be more than 45 degrees"
   answer = MESSAGEBOX(cMsg, 0, "Error")
Else
   THISFORM.Lead1.ForceRepaint
ENDIF

THISFORM.Lead1.EnableMethodErrors = .T.


EnableZoomInRect example for FoxPro

This example toggles the EnableZoomInRect property.

&& Toggle the ZoomInRect setting
           If (THISFORM.Lead1.EnableZoomInRect = .T.) Then
               THISFORM.Lead1.EnableZoomInRect = .F.
           Else
               THISFORM.Lead1.EnableZoomInRect = .T.
           EndIf


ReadLoadResolutions Example for Visual FoxPro

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

&& Initialize the display
THISFORM.Lead1.AutoScroll = .F.
THISFORM.Lead1.AutoSetRects = .T.
THISFORM.Lead1.PaintSizeMode = PAINTSIZEMODE_FIT
THISFORM.Lead1.GetFileInfo("v:\images\image5.fpx", 0, 0)

&& Update information about the available resolutions.
THISFORM.Lead1.ReadLoadResolutions("v:\images\image5.fpx")

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

i = 0
DO WHILE(i< THISFORM.Lead1.LoadResolutionCount)
   TempStr = STR(THISFORM.Lead1.LoadResolutionWidth(i)) + " X " + STR(THISFORM.Lead1.LoadResolutionWidth(i)) + CHR(13)
   InfoStr = InfoStr + TempStr
   i = i + 1
ENDDO

answer = MESSAGEBOX(InfoStr, 0, "Notice")

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

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

InfoStr = "Size that will be loaded:" + CHR(13) + CHR(13)
TempStr = STR(THISFORM.Lead1.LoadResolutionWidth(0)) + " X " + STR(THISFORM.Lead1.LoadResolutionWidth(0)) + CHR(13)
InfoStr = InfoStr + TempStr
answer = MESSAGEBOX(InfoStr, 0, "Notice")

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


FastRotate example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example uses fast rotation to rotate an image 90 degrees:

THISFORM.Lead1.FastRotate(90)


FilePage Event Example for Visual FoxPro

This example shows how the FilePage event can be used to size and position a lead control when an image is loaded.

Note: In FoxPro, the FilePage event works only with asynchronous loads started by the BitmapDataPath property.

*** OLE Control Event ***
   && Set the variables used for preserving the aspect ratio.
   && Allow for a border of 1/8 of the form size.
   && The units of measure do not matter, since we are calculating proportions.
   HeightFactor = THISFORM.Lead1.InfoHeight
   WidthFactor = THISFORM.Lead1.InfoWidth
   HeightAllowed = THISFORM.Height * 3 / 4
   WidthAllowed = THISFORM.Width * 3 / 4

   && Center the LEAD control on the form, preserving the aspect ratio.
   && Check to see if using the maximum width will make the image too tall.
   && Set the dimensions based on the result.
   IF ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
     THISFORM.Lead1.Left = THISFORM.Width / 8
     THISFORM.Lead1.Width = WidthAllowed
     THISFORM.Lead1.Height = (THISFORM.Lead1.Width * HeightFactor) / WidthFactor
     THISFORM.Lead1.Top = (THISFORM.Height - THISFORM.Lead1.Height) / 2
   ELSE
     THISFORM.Lead1.Top = THISFORM.Height / 8
     THISFORM.Lead1.Height = HeightAllowed
     THISFORM.Lead1.Width = (THISFORM.Lead1.Height * WidthFactor) / HeightFactor
     THISFORM.Lead1.Left = (THISFORM.Width - THISFORM.Lead1.Width) / 2
   ENDIF

   && Set the image display size to match the LEAD control.
   THISFORM.Lead1.AutoScroll = .F.
   THISFORM.Lead1.AutoSetRects = .T.
   THISFORM.Lead1.AutoRepaint = .T.
   THISFORM.Lead1.PaintSizeMode = PAINTSIZEMODE_FIT


Fill example for FoxPro

This example fills the bitmap with blue and repaints the image.

THISFORM.Lead1.Fill(RGB(0, 0, 255))
THISFORM.Lead1.ForceRepaint


Flip example for FoxPro

This example flips the bitmap and repaints the image.

THISFORM.Lead1.Flip
THISFORM.Lead1.ForceRepaint


FloaterDstClip... example for FoxPro

The following code adjusts the destination clipping rectangle of the floater. You can test it by adding it to a new command button for the lesson described in Outlining, Dragging, and Pasting a Region. By default, the destination clipping rectangle for the floater is the full client area. This code gets the current values and uses them to reduce the size of the clipping rectangle.

&& Set variables to use for adjustment increments.
AdjustX = THISFORM.Lead1.ScaleWidth / 20
AdjustY = THISFORM.Lead1.ScaleHeight / 20

&& Determine new values, based on adjustments of current values.
NewLeft = THISFORM.Lead1.FloaterDstClipLeft + AdjustX
NewTop = THISFORM.Lead1.FloaterDstClipTop + AdjustY
NewWidth = THISFORM.Lead1.FloaterDstClipWidth - (2 * NewLeft)
NewHeight = THISFORM.Lead1.FloaterDstClipHeight - (2 * NewTop)

&& Set the clipping rectangle to the new values.
THISFORM.Lead1.SetFloaterDstClipRect(NewLeft, NewTop, NewWidth, NewHeight)


Font example for Visual FoxPro

This example, in a MouseUp event, determines the size of a rectangle for a string in the specified font. It then draws the rectangle and draws the text on top of the rectangle.

*** OLE Control Event ***
LPARAMETERS button, shift, x, y

&& Specify the text, font, and styles
TestText = "This is my text."
THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead1.Font.Name = "Times New Roman"
THISFORM.Lead1.Font.Size = 16
THISFORM.Lead1.DrawFontColor = RGB(0, 0, 255) &&Blue
THISFORM.Lead1.TextStyle = EFX_TEXTSTYLE_NORMAL
THISFORM.Lead1.TextAlign = EFX_TEXTALIGN_HCENTER_VCENTER

&& Get the width and height of the text to be drawn.
TextWidth = THISFORM.Lead1.DrawTextWidth(TestText)
TextHeight = THISFORM.Lead1.DrawTextHeight(TestText)

&& Set the location for the text
THISFORM.Lead1.TextTop = y
THISFORM.Lead1.TextLeft = x
THISFORM.Lead1.TextWidth = TextWidth
THISFORM.Lead1.TextHeight = TextHeight

&& Set the properties for drawing a rectangle behind the text.
THISFORM.Lead1.DrawPenStyle = DRAWPENSTYLE_SOLID
THISFORM.Lead1.DrawMode = DRAWMODE_COPY_PEN
THISFORM.Lead1.DrawFillColor = RGB(0, 255, 0) && Green

&& Draw on the screen, not on the bitmap.
THISFORM.Lead1.DrawPersistence = .F.

&& Draw the rectangle, then draw the text.
THISFORM.Lead1.DrawRectangle(x, y, TextWidth, TextHeight)
THISFORM.Lead1.DrawText(TestText, 0)


Frame... example for Visual FoxPro

This example sets the control's frame properties. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead1.FrameThickness = 2
THISFORM.Lead1.FrameColor = RGB(0, 0, 0)
THISFORM.Lead1.FrameInnerStyle = EFX_INNERSTYLE_INSET
THISFORM.Lead1.FrameOuterStyle = EFX_OUTERSTYLE_RAISED
THISFORM.Lead1.FrameInnerHiliteColor = RGB(255, 255, 0)   && Yellow
THISFORM.Lead1.FrameInnerShadowColor = RGB(128, 128, 128) && Dark Gray
THISFORM.Lead1.FrameOuterHiliteColor = RGB(255, 0, 0)     && Red
THISFORM.Lead1.FrameOuterShadowColor = RGB(192, 192, 192) && Light Gray
THISFORM.Lead1.FrameInnerThickness = 3
THISFORM.Lead1.FrameOuterThickness = 3
THISFORM.Lead1.AutoRepaint = .T.


GammaCorrect example for FoxPro

This example applies a 2.2 gamma correction and repaints the image.

THISFORM.Lead1.GammaCorrect(220)
THISFORM.Lead1.ForceRepaint


GetBitmapDC example for FoxPro

Take the following steps to demonstrate how GDI functions can be used to print text on the bitmap and on the control. The text printed on the bitmap is a permanent part of the bitmap and becomes permanent if the bitmap is saved; whereas the text on the control is superficial and does not affect the bitmap.

Note:  For an easier way of drawing text, refer to the DrawText example.

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

2.	 Click on the Form Controls Toolbar icon.

3.	 On the toolbar, click the Command Button icon, and draw the button at the top of your form.

4.	 On the toolbar, click the Properties Window icon.

5.	In the Properties window, change the Caption property to Print Text.

6.	To display the code window, double click the button that you drew on the form.

7.	In the Click procedure for the button, enter the following code. (In online help, you can use the edit option to copy the block of code; then paste it into the code window.)

&& Define Windows constants
#DEFINE SYSTEM_FONT  13
#DEFINE TRANSPARENT   1

&& Declarations for API calls:
DECLARE INTEGER GetStockObject IN win32api INTEGER
DECLARE INTEGER SelectObject IN win32api INTEGER, INTEGER
DECLARE INTEGER SetBkMode IN win32api INTEGER, INTEGER
DECLARE SHORT TextOut IN win32api INTEGER , INTEGER, INTEGER, STRING, INTEGER

&& Ensure that the Lead control is visible.
THISFORM.Lead1.Visible = .T.

&& First, print text on the bitmap.
&& Create a device context for the bitmap that the GDI functions can access.
&& Note: This method does not work with Win32s.
LeadDC = THISFORM.Lead1.GetBitmapDC

&& Get the system font and select it. The old font is saved so that it can be restored.
&& Using other fonts is more complex. Refer to the Windows API documentation.
hfnt = GetStockObject(SYSTEM_FONT)
hOldFont = SelectObject(LeadDC, hfnt)

&& Make the background transparent, so that the text will overlay the image
MyReturn = SetBkMode(LeadDC, TRANSPARENT)
&& Assign the string value
mystring = "Text on the bitmap"

&& Print the text on the bitmap. This is a permanent change in the bitmap
MyReturn = TextOut(LeadDC, 20, 40, mystring, Len(mystring) )

&& Repaint the part of the image that has changed
THISFORM.Lead1.BackErase = .F.
THISFORM.Lead1.ForceRepaint

&& Allow full repainting again
THISFORM.Lead1.BackErase = .T.

&& Restore the previous font
MyReturn = SelectObject(LeadDC, hOldFont)

&& Remove the lock from the device control
THISFORM.Lead1.ReleaseBitmapDC

&& Next, print text on the control.
&& Create a device context for the control that the GDI functions can access
LeadClientDC = THISFORM.Lead1.GetClientDC

&& Get the system font and select it. The old font is saved so that it can be restored.
&& Using other fonts is more complex. Refer to the Windows API documentation.
hfnt = GetStockObject(SYSTEM_FONT)
hOldFont = SelectObject(LeadClientDC, hfnt)

&& Make the background transparent, so that the text will overlay the image
MyReturn = SetBkMode(LeadClientDC, TRANSPARENT)

&& Assign the string value
mystring = "Text on the LEAD control"

&& Print the text on the control. This is an overlay that does not affect the bitmap.
MyReturn = TextOut(LeadClientDC, 20, 80, mystring, Len(mystring))

&& Restore the previous font
MyReturn = SelectObject(LeadClientDC, hOldFont)

&& Remove the lock from the device control
THISFORM.Lead1.ReleaseClientDC

8.	Run your program to test it.


GetColorCount Example for Visual FoxPro

This example displays a message box showing the number of unique colors in the control's current bitmap.

&& Get the number of colors in the bitmap.
NumberOfColors = THISFORM.Lead1.GetColorCount

&& Display the result in a message.
szMessage = "The bitmap has " + STR(NumberOfColors) + " colors"
answer = MESSAGEBOX(szMessage, 0, "Number of Colors")


GetFileInfo example for FoxPro

This example gets information about the specified file.

&& Initialize variables
fname = "c:\lead\images\image2.cmp"
pg =0

&& Update the variables
THISFORM.Lead1.GetFileInfo(fname, pg, 0)

&& Read the updated properties
fmt = THISFORM.Lead1.InfoFormat
width = THISFORM.Lead1.InfoWidth
height = THISFORM.Lead1.InfoHeight
bps = THISFORM.Lead1.InfoBits
xres = THISFORM.Lead1.BitmapXRes
yres = THISFORM.Lead1.BitmapYRes
pg = THISFORM.Lead1.InfoPage
sizd = THISFORM.Lead1.InfoSizeDisk
sizm = THISFORM.Lead1.InfoSizeMem
cmp = THISFORM.Lead1.InfoCompress

&& Translate the meaning of the format constant
DO CASE
   CASE fmt = FILE_PCX
      cFmt = "ZSoft PCX"
   CASE fmt = FILE_GIF
      cFmt = "CompuServe GIF"
   CASE fmt = FILE_TGA
      cFmt = "TARGA"
   CASE fmt = FILE_PNG
      cFmt = "Portable Network Graphics"
   CASE fmt = FILE_PSD
      cFmt = "Adobe Photoshop 3.0"
   CASE fmt = FILE_BMP
      cFmt = "Windows BMP"
   CASE fmt = FILE_OS2
      cFmt = "OS/2 BMP version 1.x"
   CASE fmt = FILE_OS2_2
      cFmt = "OS/2 BMP version 2.x"
   CASE fmt = FILE_WMF
      cFmt = "Windows Meta File"
   CASE fmt = FILE_EPS
      cFmt = "Encapsulated PostScript"
   CASE fmt = FILE_TIF
      cFmt = "Tagged Image File Format (TIFF, TIFLZW, or CCITT file)"
   CASE fmt = FILE_TIF_JPEG
      cFmt = "Tagged Image File with JPEG compression"
   CASE fmt = FILE_FAX_G3_1D
      cFmt = "Raw FAX, compressed using CCITT group 3, 1 dimension"
   CASE fmt = FILE_FAX_G3_2D
      cFmt = "Raw FAX, compressed using CCITT group 3, 2 dimensions"
   CASE fmt = FILE_FAX_G4
      cFmt = "Raw FAX, compressed using CCITT group 4"
   CASE fmt = FILE_WFX_G3_1D
      cFmt = "WinFax, compressed using CCITT group 3, 1 dimension"
   CASE fmt = FILE_WFX_G4
      cFmt = "WinFax, compressed using CCITT group 4"
   CASE fmt = FILE_ICA_G3_1D
      cFmt = "IOCA, compressed using CCITT group 3, 1 dimension"
   CASE fmt = FILE_ICA_G3_2D
      cFmt = "IOCA, compressed using CCITT group 3, 2 dimensions"
   CASE fmt = FILE_ICA_G4
      cFmt = "IOCA, compressed using CCITT group 4"
   CASE fmt = FILE_CMP
      cFmt = "LEAD proprietary compression format"
   CASE fmt = FILE_CMP_NOLOSS
      cFmt = "LEAD lossless compression format"
   CASE fmt = FILE_JPEG
      cFmt = "JPEG File Interchange Format"
   CASE fmt = FILE_WPG
      cFmt = "WordPerfect"
   CASE fmt = FILE_RAS
      cFmt = "Sun Raster"
   CASE fmt = FILE_CALS
      cFmt = "CALS Raster"
   CASE fmt = FILE_MAC
      cFmt = "MacPaint"
   CASE fmt = FILE_PCT
      cFmt = "Macintosh Pict"
   CASE fmt = FILE_MSP
      cFmt = "Microsoft Paint"
   CASE fmt = FILE_IMG
      cFmt = "GEM Image"
   CASE fmt = FILE_PCD
      cFmt = "Kodak PhotoCD"
   CASE fmt = FILE_EPSTIFF
      cFmt = "Encapsulated PostScript with an embedded TIFF file"
   OTHERWISE
      cFmt = "Unknown format"
ENDCASE

&& Create the message string
cMsg = fname + CHR(13) + "Page = " + STR(pg) + CHR(13)+ "Format = " + cFmt + CHR(13)
cMsg = cMsg + "Width = " + STR(width) + CHR(13) + "Height = " + STR(height) + CHR(13)
cMsg = cMsg + "Size in memory = " + STR(sizm) + CHR(13) + "Size on disk = " + STR(sizd) + CHR(13)
cMsg = cMsg + "Bits per pixel = " + STR(bps) + CHR(13)
cMsg = cMsg + "X resolution = " + STR(xres) + CHR(13) + "Y resolution = " + STR(yres)

&& Display the message box
answer = MESSAGEBOX(cMsg, 0, "File Info")


GetFloaterHandle example for FoxPro

The following is an alternative way of coding the PasteFloaterBtn button's click procedure in  Outlining, Dragging, and Pasting a Region. This alternative uses the GetFloaterHandle and SetRgnHandle methods to specify the mask for the paste. It also shows how to use the HasRgn, FloaterWidth, and FloaterHeight properties.

&& Exit this routine if there is no region.
IF THISFORM.Lead1.HasRgn = .F.
    RETURN
ENDIF

&& Save the region that is in the floater.
SavedRgn = THISFORM.Lead1.GetFloaterHandle

&& Get the floater into another bitmap
THISFORM.Lead2.ScaleMode = THISFORM.Lead1.ScaleMode
THISFORM.Lead2.Bitmap = THISFORM.Lead1.Floater

&& Get the floater's client coordinates into local variables.
LCRgnX = THISFORM.Lead1.FloaterDstLeft
LCRgnY = THISFORM.Lead1.FloaterDstTop
LCRgnWidth = THISFORM.Lead1.FloaterDstWidth
LCRgnHeight = THISFORM.Lead1.FloaterDstHeight

&& Translate the client coordinates to bitmap coordinates.
LBRgnX = ((LCRgnX - THISFORM.Lead1.DstLeft) / ZoomFactorX) + THISFORM.Lead1.SrcLeft
LBRgnY = ((LCRgnY - THISFORM.Lead1.DstTop) / ZoomFactorY) + THISFORM.Lead1.SrcTop
LBRgnWidth = THISFORM.Lead1.FloaterWidth
LBRgnHeight = THISFORM.Lead1.FloaterHeight

&& Delete the floater.
THISFORM.Lead1.FloaterVisible = .F.
THISFORM.Lead1.Floater = 0

&& Set the saved region to use as a mask for the Combine method.
THISFORM.Lead1.SetRgnHandle(SavedRgn, LBRgnX, LBRgnY, L_RGN_SET)

&& Use the Combine method to paste the Lead2 bitmap into the Lead1 bitmap.
MyOp = CB_OP_ADD + CB_DST_0 && Operation flags for a simple paste.
THISFORM.Lead1.Combine(LBRgnX, LBRgnY, LBRgnWidth, LBRgnHeight, THISFORM.Lead2.Bitmap, 0, 0, MyOp)

&& Repaint the part of the client area that has changed.
THISFORM.Lead1.RepaintRect(LCRgnX, LCRgnY, LCRgnWidth, LCRgnHeight, .F.)

&& Free the region.
THISFORM.Lead1.FreeRgn

&& Delete the region handle.
THISFORM.Lead1.DeleteRgnHandle(SavedRgn)


GetHistogram example for FoxPro

The following code does a CMYK separation and uses a histogram to find the brightest and darkest intensities in the K plane of the bitmap. It then remaps the intensities to use the full range and merges the color planes to recreate the bitmap:

MousePointer = 11 &&  hourglass

&& Do a CMYK color separation and copy the K plane to the bitmap
THISFORM.Lead1.ColorSeparate(COLORSEP_CMYK)
THISFORM.Lead1.Bitmap = 0 && Free the bitmap
THISFORM.Lead1.Bitmap = THISFORM.Lead1.ColorPlanes(3) && Copy the K plane

&& Load the histogram
THISFORM.Lead1.GetHistogram(CHANNEL_MASTER)

&& Find the brightest and darkest intensities in the image
MyIndex = 0
Brightest = 0
Darkest = -1
DO WHILE (MyIndex < 256)
    IF THISFORM.Lead1.HistogramTable(MyIndex) > 0
        Brightest = MyIndex
        IF (Darkest = -1)
            Darkest = MyIndex
        ENDIF
    ENDIF
    MyIndex = MyIndex + 1
ENDDO

&& Remap the intensities to use the full range
MyIndex = Darkest
CurrentRange = Brightest - Darkest
IF CurrentRange > 0
    DO WHILE (MyIndex <= Brightest)
        Offset = MyIndex - Darkest
        THISFORM.Lead1.RemapTable(MyIndex) = (255 * Offset) / CurrentRange
        MyIndex = MyIndex + 1
    ENDDO
    THISFORM.Lead1.RemapIntensity(CHANNEL_MASTER)
ENDIF

&& Merge the color planes and free them from memory
THISFORM.Lead1.ColorPlanes(3) = THISFORM.Lead1.Bitmap && Update the K plane
THISFORM.Lead1.ColorMerge(COLORSEP_CMYK)
THISFORM.Lead1.ColorPlanes(0) = 0
THISFORM.Lead1.ColorPlanes(1) = 0
THISFORM.Lead1.ColorPlanes(2) = 0
THISFORM.Lead1.ColorPlanes(3) = 0

&& Set the image display size to match the LEAD control
THISFORM.Lead1.SetDstRect(0, 0, THISFORM.Lead1.ScaleWidth, THISFORM.Lead1.ScaleHeight)
THISFORM.Lead1.SetDstClipRect(0, 0, THISFORM.Lead1.ScaleWidth, THISFORM.Lead1.ScaleHeight)

THISFORM.Lead1.ForceRepaint
MousePointer = 0 && default


GetMinMaxBits example for FoxPro

The following example retrieves the values for MinBit and MaxBit using GetMinMaxBits and writes the results.

    THISFORM.Lead1.GetMinMaxBits()
    THISFORM.Label1.Caption = Str(THISFORM.Lead1.MinBit)
    THISFORM.Label2.Caption = Str(THISFORM.Lead1.MaxBit)


GetMinMaxVal example for FoxPro

The following example retrieves the values for MinVal and MaxVal using GetMinMaxVal and writes the results.

    &&must cal GetMinMaxVal first
    THISFORM.Lead1.GetMinMaxVal()
    THISFORM.Label3.Caption = Str(THISFORM.Lead1.MinVal)
    THISFORM.Label4.Caption = Str(THISFORM.Lead1.MaxVal)


GetRgnHandle example for FoxPro

The following code creates a region, saves its handle and adds the saved region beside the current region.

&& Initialize the variables that we will manipulate to simulate mouse coordinates.
OffsetX = THISFORM.Lead1.BitmapWidth / 8
OffsetY = THISFORM.Lead1.BitmapHeight / 6

&& Create an elliptical region.
THISFORM.Lead1.SetRgnEllipse(OffsetX, OffsetY, OffsetX, OffsetY, L_RGN_SET)

&& Save a copy of the region.
SavedRegion = THISFORM.Lead1.GetRgnHandle

&& Add the saved region to the bitmap, offsetting it so that we can see it.
THISFORM.Lead1.SetRgnHandle(SavedRegion, OffsetX, OffsetY, L_RGN_OR)

&& Delete the saved region.
THISFORM.Lead1.DeleteRgnHandle(SavedRegion)

&& Fill the bitmap region with blue.
THISFORM.Lead1.Fill(RGB(0, 0, 255))

&& Free the bitmap region.
THISFORM.Lead1.FreeRgn

&& Repaint the image so that we can see how the image was updated.
THISFORM.Lead1.ForceRepaint


Grayscale example for FoxPro

This example converts the bitmap to a 12-bit grayscale.

THISFORM.Lead1.Grayscale(12) && grayscale to 12-bit


Halftone example for FoxPro

This example halftones the bitmap with a horizontal pattern and repaints the image.

THISFORM.Lead1.Halftone(HALFTONE_PRINT, 0)
THISFORM.Lead1.ForceRepaint


HistoContrast example for FoxPro

This example applies a histogram contrast to the bitmap and repaints it.

THISFORM.Lead1.HistoContrast(300)
THISFORM.Lead1.ForceRepaint


HistoEqualize example for FoxPro

This example equalizes the bitmap's histogram and repaints the image.

THISFORM.Lead1.HistoEqualize
THISFORM.Lead1.ForceRepaint


Hue example for FoxPro

This example rotates the hue 180 degrees and repaints the image.

THISFORM.Lead1.Hue(180)
THISFORM.Lead1.ForceRepaint


IgnoreFilters Example for Visual FoxPro

This example shows how to ignore filters so that certain files are not loaded.

&& First, make sure PreLoaded Filters does not
&& contain CMP, and that 0 filters can be cached
THISFORM.Lead1.PreLoadFilters(3, 0, "BMP,FAX,TIF")

&& now, ignore cmp filter (never load cmp files)
THISFORM.Lead1.IgnoreFilters("CMP")


InsertBitmapListItem Example for Visual FoxPro

This example loads an ordinary file and uses it to create and play an animation. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

nMax = 160
THISFORM.Lead2.Load("c:\lead\images\image1.cmp", 0, 0, 1)
BitmapWidth = THISFORM.Lead2.BitmapWidth
BitmapHeight = THISFORM.Lead2.BitmapHeight

&& Reduce memory requirements, if necessary. Only small bitmaps play smoothly.
IF (BitmapWidth > nMax)
   THISFORM.Lead2.Size(nMax, (BitmapHeight * nMax) / BitmapWidth, RESIZE_RESAMPLE)
ENDIF

IF (BitmapHeight > nMax)
   THISFORM.Lead2.Size((BitmapWidth * nMax) / BitmapHeight, nMax, RESIZE_RESAMPLE)
ENDIF

&& Dither to an optimized palette, leaving the last color blank to use
&& for transparency.
THISFORM.Lead2.ColorRes(8, CRP_IDENTITYPALETTE, CRD_FLOYDSTEINDITHERING, 255)

&& Set an arbitrary transparent color in the last position of the bitmap palette.
THISFORM.Lead2.BitmapPalette(255) = RGB(212, 222, 202)

&& Set the playback values that will apply to all bitmaps in the list.
THISFORM.Lead2.BitmapDelay = 10
THISFORM.Lead2.BitmapTop = 0
THISFORM.Lead2.BitmapLeft = 0
THISFORM.Lead2.BitmapEnableTransparency = .T.
THISFORM.Lead2.BitmapTransparentColor = 16777216 + 255 && Specified by palette index
THISFORM.Lead2.BitmapDisposalMethod = -1 && ANIMATIONDISPOSAL_RESTOREBACKGROUND

&& Free the LEAD1 control's current bitmap list.
THISFORM.Lead1.BitmapList = 0

&& Populate the bitmap list in the LEAD1 control.
I = 0
DO WHILE(I <37)
   THISFORM.Lead1.InsertBitmapListItem(I, THISFORM.Lead2.Bitmap)
   && Rotate, using the transparent color as the fill color.
   THISFORM.Lead1.BitmapListIndex = I
   THISFORM.Lead1.Rotate(1000 * I, 0, 16777216 + 255)
   I = I + 1
ENDDO

&& Set the animation playback properties
THISFORM.Lead1.AnimationBackColor = RGB(0, 0, 255)
THISFORM.Lead1.AnimationBitsPerPixel = 8
THISFORM.Lead1.AnimationHeight = THISFORM.Lead1.ScaleHeight
THISFORM.Lead1.AnimationWidth = THISFORM.Lead1.ScaleWidth
THISFORM.Lead1.AnimationLoop = .F.
I = 0
DO WHILE (I<256)
   THISFORM.Lead1.AnimationPalette(I) = THISFORM.Lead1.BitmapPalette(I)
   I = I + 1
ENDDO

&& Set properties for a scaled animation.
THISFORM.Lead1.AutoRepaint = .T.
THISFORM.Lead1.AutoSetRects = .F.

&& Set the image display size to match the LEAD control.
THISFORM.Lead1.SetDstRect(0, 0, THISFORM.Lead1.ScaleWidth, THISFORM.Lead1.ScaleHeight)
THISFORM.Lead1.SetDstClipRect(0, 0, THISFORM.Lead1.ScaleWidth, THISFORM.Lead1.ScaleHeight)

&& Start the animation.
THISFORM.Lead1.AnimationEnable = .T.

&& Free the LEAD2 control's bitmap.
THISFORM.Lead2.BitmapList = 0


Intensity example for FoxPro

This example lightens the bitmap and repaints the image.

THISFORM.Lead1.Intensity(150)
THISFORM.Lead1.ForceRepaint


IntensityDetect example for FoxPro

This example filters the bitmap to get the lightest intensities and repaints the image.

THISFORM.Lead1.IntensityDetect(200, 255)
THISFORM.Lead1.ForceRepaint


Invert example for FoxPro

This example inverts the bitmap's colors and repaints the image.

THISFORM.Lead1.Invert
THISFORM.Lead1.ForceRepaint


KeyPress example for FoxPro

This example uses the KeyPress event to implement a custom scale mode. There is no particular reason to put this code in this event, except that we needed examples of both the event and the scale mode.

*** OLE Control Event ***
LPARAMETERS keyascii

IF keyascii = 67 && Uppercase C
    && This example sets an custom scale mode and uses it to crop the
    && display. Keep in mind that the actual height and width do not change.
    && Only the unit of measure changes.

    && Change the scale so that origin is moved one-third right and one-third down
    THISFORM.Lead1.ScaleLeft = -1
    THISFORM.Lead1.ScaleTop = -1
    THISFORM.Lead1.ScaleWidth = 3
    THISFORM.Lead1.ScaleHeight = 3

    && Crop the display so that it takes up the middle third of the height and width
    THISFORM.Lead1.DstClipLeft = 0
    THISFORM.Lead1.DstClipTop = 0
    THISFORM.Lead1.DstClipWidth = 1
    THISFORM.Lead1.DstClipHeight = 1
    THISFORM.Lead1.ForceRepaint
ENDIF


LevelLowBit example for FoxPro

This is also the example for LevelHighBit.

This example sets LevelLowBit and LevelHighBit to display the image using only the eight least significant bits.

THISFORM.Lead1.AutoRepaint = .F.
    && use least significant 8 bits
THISFORM.Lead1.LevelLowBit = 0
THISFORM.Lead1.LevelHighBit = 7
THISFORM.Lead1.AutoRepaint = .T.


LevelLUT example for FoxPro

This is also the example for MinVal property and MaxVal property.

The following example sets LevelLowBit and LevelHighBit to use all bits, gets the minimum and maximum bits and intensity values for the image, and then sets the LUT so that pixels with values in the minimum range are mapped to the color RED, while pixels with values in the maximum range are mapped to BLUE.

    THISFORM.Lead1.AutoRepaint = .F.
    && use all bits
    THISFORM.Lead1.LevelLowBit = 0
    THISFORM.Lead1.LevelHighBit = THISFORM.Lead1.BitmapBits - 1

    THISFORM.Lead1.GetMinMaxBits()
    THISFORM.Lead1.GetMinMaxVal()
    max = THISFORM.Lead1.MaxVal
    min = THISFORM.Lead1.MinVal

    && set LUT so that min range maps to RED and max range maps to BLUE
    For i = min To min + 100
     THISFORM.Lead1.LevelLUT(i) = RGB(255, 0, 0)
    Next
    For i = max - 100 To max
     THISFORM.Lead1.LevelLUT(i) = RGB(0, 0, 255)
    Next
    THISFORM.Lead1.AutoRepaint = .T.


LevelLUTLength example for FoxPro

This example writes out the number of entries in the LUT.

THISFORM.Label5.Caption = Str(THISFORM.Lead1.LevelLUTLength)


LoadInfo example for FoxPro
LoadInfo... example for FoxPro

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 a command button and code its click procedure as follows:

THISFORM.Lead1.ScaleMode = 3 && Pixels

&& Make the image look OK as a 1-bit image.
THISFORM.Lead1.Size(THISFORM.Lead1.ScaleWidth, THISFORM.Lead1.ScaleHeight, RESIZE_RESAMPLE)
THISFORM.Lead1.Halftone(HALFTONE_VIEW, 45)

&& Set the information that we will use when loading.
THISFORM.Lead1.LoadInfoBits = 1
THISFORM.Lead1.LoadInfoFlags = LOADINFO_TOPLEFT
THISFORM.Lead1.LoadInfoFormat = FILE_FAX_G3_2D
THISFORM.Lead1.LoadInfoHeight = THISFORM.Lead1.BitmapHeight
THISFORM.Lead1.LoadInfoOffset = 0
THISFORM.Lead1.LoadInfoWidth = THISFORM.Lead1.BitmapWidth
THISFORM.Lead1.LoadInfoXRes = THISFORM.Lead1.BitmapXRes
THISFORM.Lead1.LoadInfoYRes = THISFORM.Lead1.BitmapYRes

&& Save the image as raw FAX; then load the saved file.
THISFORM.Lead1.Save( "c:\lead\images\tmp.tif", FILE_FAX_G3_2D, 1, 1, SAVE_OVERWRITE)
THISFORM.Lead1.Load("c:\lead\images\tmp.tif", 0, 0, 1)

&& Repaint the newly loaded image.
THISFORM.Lead1.ForceRepaint

3.	Run your program to test it.


LoadMemory example for FoxPro

This example uses WIN32 API calls to load a file into memory, then uses the LoadMemory method to load the memory-resident file into a bitmap.

&& Declare WIN32 API functions and constants

Declare integer GlobalAlloc in win32api integer,integer
Declare integer GlobalLock in win32api integer
Declare integer GlobalFree in win32api  integer
Declare integer GlobalUnlock in win32api integer
Declare integer OpenFile in win32api String, integer, integer
Declare integer _llseek in win32api integer, integer, integer
Declare integer _hread IN win32api integer, integer, integer
Declare integer _lclose in win32api integer

#define OF_READ         0
#define GMEM_MOVEABLE    2
#define SEEK_SET        0
#define SEEK_END        2

   && To open the file, use OpenFile. OpenFile requires a pointer to an OFSTRUCT
   && structure. We will allocate enough memory to hold the structure and free it
   && as soon as we create the file

   hOF = GlobalAlloc( GMEM_MOVEABLE, 512 ) && allocate space for the OFSTRUCT structure
   lpOF = GlobalLock( hOF )
   hf = OpenFile( "c:\lead\images\image1.cmp", lpOF, OF_READ )
   nret = GlobalUnlock(hOF)
   nret = GlobalFree(hOF)

   if hf = -1                  && if the creation of the file fails, quit
      nret = MESSAGEBOX( "Error calling FCREATE()" )
      return
   endif

   iSize = _llseek( hf, 0, SEEK_END )     && get the file size

   nret = _llseek( hf, 0, SEEK_SET )      && go back to the beginning of the file

   && Allocate a chunk of memory big enough to hold the whole image

   hMem = GlobalAlloc( GMEM_MOVEABLE, iSize)
   if hMem = 0
      nret = _lclose( hf )
      nret = MESSAGEBOX( "Not enough memory to hold the file in memory!" )
      return
   endif

   && Get a pointer to the memory chunk

   lpMem = GlobalLock(hMem)
   if lpMem = 0
      nret = _lclose( hf )
      nret = GlobalFree( hMem )
      nret = MESSAGEBOX( "Not enough memory to hold the file in memory!" )
      return
   endif

   && read the file into memory in one go

   if _hread( hf, lpMem, iSize) <> iSize
      nret = _lclose( hf )
      nret = GlobalUnlock( hMem )
      nret = GlobalFree( hMem )
      nret = MESSAGEBOX( "Error reading file" )
      return
   endif

   nret = _lclose( hf )        && close the file. We don't need it anymore.

   nret = GlobalUnlock( hMem ) && unlock the memory handle

   if THISFORM.Lead1.LoadMemory( hMem, 0, 0, -1, iSize ) <> 0
      nret = MESSAGEBOX( "Error calling LoadMemory" )
   else
      THISFORM.Lead1.ForceRepaint
      nret = MESSAGEBOX( "LoadMemory succeeded" )
   endif

   nret = GlobalFree( hMem )

   return


LoadUseViewPerspective example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example times the loading of a bitmap with and without changing the internal view perspective.

&& Do not include paints when measuring time.
THISFORM.Lead1.AutoRepaint = .F.

&& Time the load using the bitmap's view perspective.
THISFORM.Lead1.LoadUseViewPerspective = .T.
StartTime = DATETIME( )
THISFORM.Lead1.Load("d:\lead\images\rotated.tif", 0, 0, 1)
DeltaTime = DATETIME( ) - StartTime
nret = MESSAGEBOX(ALLTRIM (STR(DeltaTime)) + " seconds loaded as is" )

&& Time the load that converts the bitmap's view perspective.
THISFORM.Lead1.LoadUseViewPerspective = .F.
StartTime = DATETIME( )
THISFORM.Lead1.Load("d:\lead\images\rotated.tif", 0, 0, 1)
DeltaTime = DATETIME( ) - StartTime
nret = MESSAGEBOX(ALLTRIM (STR(DeltaTime)) + " seconds converted on load" )


MaxFilter example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example erodes dark objects and repaints the image.

THISFORM.Lead1.MaxFilter(3)
THISFORM.Lead1.ForceRepaint


Median example for FoxPro

This example applies a median filter with a 3x3 neighborhood and redisplays the bitmap.

THISFORM.Lead1.Median(3)
THISFORM.Lead1.ForceRepaint


MinFilter example for Visual FoxPro

Note: This topic is for Document/Medical  only.

This example dilates dark objects and repaints the image.

THISFORM.Lead1.MinFilter(3)
THISFORM.Lead1.ForceRepaint


Mosaic example for FoxPro

This example applies a mosaic effect with 8x8 tiles and redisplays the bitmap.

THISFORM.Lead1.Mosaic(8)
THISFORM.Lead1.ForceRepaint


ODBC Example for Visual FoxPro

Take the following steps to create and use a simple database, containing only images. (For a more sophisticated approach refer to Using ODBC to Access Image Data.)

Note:	The LEADTOOLS ActiveX requires ODBC drivers that can properly handle long binary fields. Examples have been tested and will work with version 3.0 of the Microsoft ODBC Desktop Driver Pack. (This driver pack ships with Access 95 and works on 32-bit systems.) You can download drivers from the LEAD BBS, the CompuServe forum, or the Worldwide Web home page. The CompuServe forum is at GO LEADTECH. The web page is ftp://ftp.leadtools.com/pub/utils/ODBC32.zip.  The file to download is ODBC32.ZIP.

1.	Make a copy of the project that you created in Loading and Displaying an Image; then load the copied project.

2.	In the Project Manager window, click the Data tab, select the Databases icon, and click the New button.

3.	Name the database c:\lead\lead.dbc, click the Save button, and close the database designer.

4.	Expand the lead database icon.

5.	Select the Tables icon, click the New button, and click the New Table icon

6.	Name the table tmppic.dbf and click the Save button.

7.	Specify one field called photo, with a datatype of Memo (binary).

8.	Click the OK button and answer no to the prompt for entering data.

9.	Expand the Tables icon and select tmppic.

10.	Go to the command window and enter the following command:

copy to c:\lead\ltpic.dbf type FOX2X

11.	Select the tmppic table, click the Remove button, and click the Delete button.

12.	Open the ODBC administrator (an application in your Visual FoxPro group) and click the Add button.

13.	Select Microsoft FoxPro driver and click the OK button.

14.	Enter leadfox as the Data Source Name.

15.	Click the Select directory button and select the LEAD directory.

16.	Click the OK button; click the next OK button; then click the Close button.

17.	In FoxPro, replace the code in the main form's init procedure as follows:

THISFORM.ScaleMode = 3
_SCREEN.ScaleMode = 3
&& Position and size the main form.
THISFORM.Left = _SCREEN.Left + 20
THISFORM.Top = _SCREEN.Top + 20
THISFORM.Width = _SCREEN.Width - 40
THISFORM.Height = _SCREEN.Height - 80
THISFORM.Show
&& Initialize some control properties.
THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead1.AutoScroll = .T.
&& Set the position and size of the LEAD control.
&& Allow for a border of 1/8 of the form size.
HeightAllowed = THISFORM.Height * 3/4
WidthAllowed = THISFORM.Width * 3/4

THISFORM.Lead1.Left = (THISFORM.Width - WidthAllowed) / 2
THISFORM.Lead1.Top =  (THISFORM.Height - HeightAllowed) / 2
THISFORM.Lead1.Width = WidthAllowed
THISFORM.Lead1.Height = HeightAllowed
&& Set variables for the size of the display rectangle.
ViewWidth = THISFORM.Lead1.ScaleWidth
ViewHeight = THISFORM.Lead1.ScaleHeight
&& Set the image display size to match the LEAD control
THISFORM.Lead1.SetDstRect(0, 0, ViewWidth, ViewHeight)
THISFORM.Lead1.SetDstClipRect(0, 0, ViewWidth, ViewHeight)

&& Display the LEAD control.
THISFORM.Lead1.BorderStyle = 1
&& Open the database.
DString = "ODBC;DSN=LEADFOX"
THISFORM.Lead1.dbOpen(DString, "ltpic", "photo", DB_OPENOPTIONS_NONE)
THISFORM.Lead1.dbLoadBits = 24
THISFORM.Lead1.dbLockingMode = DB_LOCKINGMODE_OPTIMISTIC

THISFORM.Lead1.ForceRepaint

18.	At the top of your main form, add seven command buttons and name them (using the Caption property) as follows: Add, Update, Delete, First, Next, Prev, and Last.

19.	For the Add button, add the following code to the click procedure:

IF THISFORM.Lead1.dbCanAppend = .F.
    Msg = "You cannot add to this database."
    answer = MESSAGEBOX(Msg, 0, "Error")
ELSE
    THISFORM.Lead1.dbAddNew
    MyFile = GETFILE()
    THISFORM.Lead1.Load(MyFile, 0, 0, 1)
    nRet = THISFORM.Lead1.dbUpdate(FILE_CMP,0,0)
        IF nRet <> 0
            Msg = "You cannot update this database."
            answer = MESSAGEBOX(Msg, 0, "Error")
        ELSE
            THISFORM.Lead1.dbMoveLast
            THISFORM.Lead1.ForceRepaint
            Msg = "Database is updated."
            answer = MESSAGEBOX(Msg, 0, "LEAD")
    ENDIF
ENDIF

20.	For the Update button, add the following code to the click procedure:

IF THISFORM.Lead1.dbIsEOF = .T. AND THISFORM.Lead1.dbIsBOF = .T.
    Msg = "The database is empty."
    answer = MESSAGEBOX(Msg, 0, "Notice")
ELSE
  IF THISFORM.Lead1.dbCanUpdate = .F.
      Msg = "You cannot update this database."
      answer = MESSAGEBOX(Msg, 0, "Error")
  ELSE
      IF THISFORM.Lead1.dbEditMode = DB_EDITMODE_NONE
          THISFORM.Lead1.dbEdit
          THISFORM.Lead1.Flip
      ENDIF
      THISFORM.Lead1.dbUpdate(FILE_CMP,0,0)
      THISFORM.Lead1.ForceRepaint
  ENDIF
ENDIF

21.	For the Delete button, add the following code to the click procedure:

IF THISFORM.Lead1.dbIsEOF = .T. AND THISFORM.Lead1.dbIsBOF = .T.
    Msg = "The database is empty."
    answer = MESSAGEBOX(Msg, 0, "Notice")
ELSE
  IF THISFORM.Lead1.dbCanUpdate = .F.
      Msg = "You cannot update this database."
      answer = MESSAGEBOX(Msg, 0, "Error")
  ELSE
      THISFORM.Lead1.dbDelete
      THISFORM.Lead1.dbRequery
      THISFORM.Lead1.ForceRepaint
  ENDIF
ENDIF

22.	For the First button, add the following code to the click procedure:

IF THISFORM.Lead1.dbIsBOF = .T. AND THISFORM.Lead1.dbIsEOF = .T.
    Msg = "The database is empty."
    answer = MESSAGEBOX(Msg, 0, "Notice")
ELSE
    THISFORM.Lead1.dbMoveFirst
    THISFORM.Lead1.ForceRepaint
ENDIF

23.	For the Next button, add the following code to the click procedure:

IF THISFORM.Lead1.dbIsEOF = .T. AND THISFORM.Lead1.dbIsBOF = .T.
    Msg = "The database is empty."
    answer = MESSAGEBOX(Msg, 0, "Notice")
ELSE
    THISFORM.Lead1.dbMoveNext
    IF THISFORM.Lead1.dbIsEOF = .T.
       THISFORM.Lead1.dbMovePrev
       Msg = "Already at last record."
       answer = MESSAGEBOX(Msg, 0, "Notice")
    ENDIF
    THISFORM.Lead1.ForceRepaint
ENDIF

24.	For the Prev button, add the following code to the click procedure:

IF THISFORM.Lead1.dbIsEOF = .T. AND THISFORM.Lead1.dbIsBOF = .T.
    Msg = "The database is empty."
    answer = MESSAGEBOX(Msg, 0, "Notice")
ELSE
    THISFORM.Lead1.dbMovePrev
    IF THISFORM.Lead1.dbIsBOF = .T.
       THISFORM.Lead1.dbMoveNext
       Msg = "Already at first record."
       answer = MESSAGEBOX(Msg, 0, "Notice")
    ENDIF
    THISFORM.Lead1.ForceRepaint
ENDIF

25.	For the Last button, add the following code to the click procedure:

IF THISFORM.Lead1.dbIsBOF = .T. AND THISFORM.Lead1.dbIsEOF = .T.
    Msg = "The database is empty."
    answer = MESSAGEBOX(Msg, 0, "Notice")
ELSE
    THISFORM.Lead1.dbMoveLast
    THISFORM.Lead1.ForceRepaint
ENDIF

26.	At the end of the main form's release procedure, add the following code:

THISFORM.Lead1.dbClose

27.	Run your program to test it.


Oilify example for Visual FoxPro

This example applies an oil-painting effect and repaints the image.

THISFORM.Lead1.Oilify(10)
THISFORM.Lead1.ForceRepaint


OLEDropAllowed example for Visual FoxPro

This example toggles the OLEDropAllowed property.

&&toggle the OLEDropAllowed property
If (THISFORM.Lead1.OLEDropAllowed = .F.) Then
   THISFORM.Lead1.OLEDropAllowed = .T.
Else
   THISFORM.Lead1.OLEDropAllowed = .F.
EndIf


Paint event, Enabled property, and hWnd property example for FoxPro
Paint event example for FoxPro

This example uses some Windows API functions to demonstrate the following:

 Paint event

 Click event

 Enabled property

 hWnd property

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

2.	 Add a command button to the top of your main form and name it Toggle.

3.	Add a label to your form, name it Directions, and set its caption to the following:

"Use the Toggle button to turn on or turn of Click-Splat"

4.	Add the following code to the Toggle button's Click procedure. This code uses the Enabled property to toggle the LEAD control's ability to respond to click events.

IF (THISFORM.Lead1.Enabled = .F.) then
  THISFORM.Lead1.Enabled = .T.
  THISFORM.Directions.Caption = "Click on the image for a splat"
  THISFORM.Toggle.Caption = "Disable"
ELSE
  THISFORM.Lead1.Enabled = .F.
  THISFORM.Directions.Caption = "Click does nothing"
  THISFORM.Toggle.Caption = "Enable"
ENDIF

5.	Add the following code to the LEAD1 Click procedure. When the Enabled property is true, this code uses a Windows API call to generate a paint event.

&& Declarations for API calls:
DECLARE SHORT InvalidateRect IN win32api INTEGER, INTEGER, SHORT

hWnd = THISFORM.Lead1.hWnd
MyReturn = InvalidateRect(hWnd, 0, 0)  && Force the Paint event whenever user clicks

6.	Add the following code to the Lead1 Paint procedure. It uses Windows GDI functions to draw random lines on the control whenever there is a paint event.

&& Declarations for API calls:
DECLARE SHORT  LineTo IN win32api INTEGER, INTEGER, INTEGER
DECLARE SHORT  MoveToEx IN win32api INTEGER, INTEGER, INTEGER, INTEGER

&& Create a device context for the control that the GDI functions can access
LeadClientDC = THISFORM.Lead1.GetClientDC

&& Draw random lines on the control. This is an overlay that does not affect the bitmap.
xStart = RAND() * THISFORM.Lead1.Width
yStart = RAND() * THISFORM.Lead1.Height
MyReturn = MoveToEx(LeadClientDC, xStart, yStart, 0)
FOR i = 1 TO 50
  xDelta = (RAND() * 80) - 40  && -40 to 40
  yDelta = (RAND() * 80) - 40  && -40 to 40
  xEnd = xStart + xDelta
  yEnd = yStart + yDelta
  MyReturn = LineTo(LeadClientDC, xEnd, yEnd)
  MyReturn = MoveToEx(LeadClientDC, xStart, yStart, 0)
ENDFOR

&& Remove the lock from the device control
THISFORM.Lead1.ReleaseClientDC

7.	Run your program to test it.


PaintContrast example for Visual FoxPro

This example increases the contrast for painting images.

THISFORM.Lead1.PaintContrast = THISFORM.Lead1.PaintContrast + 100
THISFORM.Lead1.ForceRepaint


PaintDither example for FoxPro

This example turns on error diffusion and redisplays the bitmap.

THISFORM.Lead1.PaintDither = PAINTDITHER_DIFFUSION
THISFORM.Lead1.ForceRepaint


PaintEffect example for FoxPro

The following examples use the KeyDown and KeyUp events to repaint the image with effects. Notice that the examples test for different keys, because this FoxPro example does not work when testing both events on the same key.

The first one is for the KeyDown event:

*** OLE Control Event ***
LPARAMETERS keycode, shift

IF keycode = 71 AND shift = 2 && Code for ctrl/g
   THISFORM.Lead1.AutoRepaint = .F.
   THISFORM.Lead1.BackErase = .T.
   THISFORM.Lead1.EffectGrain = 20
   THISFORM.Lead1.EffectDelay = 50
   THISFORM.Lead1.WandSize = 5
   THISFORM.Lead1.WandColor = RGB(255,255,0)   && Yellow Wand
   THISFORM.Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R
   THISFORM.Lead1.ForceRepaint
ENDIF

The second one is for the KeyUp event:

*** OLE Control Event ***
LPARAMETERS keycode, shift

IF keycode = 71 AND shift = 4 && Code for alt/g
   THISFORM.Lead1.PaintEffect = EFX_EFFECT_WIPE_R_TO_L
   THISFORM.Lead1.ForceRepaint
   THISFORM.Lead1.PaintEffect = EFX_EFFECT_NONE
ENDIF


PaintGamma example for Visual FoxPro

This example increases the gamma correction for painting images.

THISFORM.Lead1.PaintGamma = THISFORM.Lead1.PaintGamma + 100
THISFORM.Lead1.ForceRepaint


PaintIntensity example for Visual FoxPro

This example increases the intensity for painting images.

THISFORM.Lead1.PaintIntensity = THISFORM.Lead1.PaintIntensity + 100
THISFORM.Lead1.ForceRepaint


PaintMaxPasses example for Visual FoxPro

Note: The event processing for this example works with Visual FoxPro 5.0. It does not work with version 3.0.

This example includes two procedures.

First, a button click starts a multi-pass paint effect:

&& Override default processing of Windows messages.
&& This ensures that the LEAD control gets its own events.
APPLICATION.AutoYield = .F.

&& Temporarily disable automatic repainting.
THISFORM.Lead1.AutoRepaint = .F.

&& Set the effect.
THISFORM.Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R

&& Use 5 total passes.
THISFORM.Lead1.PaintMaxPasses = 5

&& Start with pass number 1.
THISFORM.Lead1.PaintPass = 1

&& Delay 200 milliseconds between passes.
THISFORM.Lead1.PaintNotificationDelay = 200

&& Load and paint the image.
THISFORM.Lead1.Load ("d:\lead\images\image1.cmp", 0, 0, 1)
THISFORM.Lead1.AutoRepaint = .T.

Then, LEAD's PaintNotification event changes the direction of the effect on each pass.

*** OLE Control Event ***
LPARAMETERS upass, utype

&& If the first pass is complete
IF ((uType = EFX_NOTIFY_IMAGE) AND (uPass > 0))
  && Toggle the effect from left-to-right to right-to-left.
  IF (THISFORM.Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R)
      THISFORM.Lead1.PaintEffect = EFX_EFFECT_WIPE_R_TO_L
  ELSE
      THISFORM.Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R
  ENDIF
ENDIF


PaintPalette example for FoxPro

This example sets the paint palette to the palette of each Lead control. It then loads two images and dithers them to 8 bits per pixel with optimized palettes, and displays them side by side.  In 8-bit display mode, you can see the palette problems that result when you do not use a fixed palette.

THISFORM.Lead1.PaintPalette = 0
THISFORM.Lead2.PaintPalette = 0

&& Disable automatic repainting of the image.
THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead2.AutoRepaint = .F.

&& Turn off scroll bars to make sure we use the full client area.
THISFORM.Lead1.AutoScroll = .F.
THISFORM.Lead2.AutoScroll = .F.

&& Clear the bitmaps from memory
THISFORM.Lead1.Bitmap = 0
THISFORM.Lead2.Bitmap = 0

_SCREEN.MousePointer = 11 && Hourglass
&& Load the bitmaps. These hard-coded path names may be different on your system.
THISFORM.Lead1.Load("c:\lead\images\image1.cmp", 0, 0, 1)
THISFORM.Lead2.Load("c:\lead\images\image2.cmp", 0, 0, 1)

&& Change the bitmaps to 8 BPS with optimized palettes
THISFORM.Lead1.ColorRes(8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0)
THISFORM.Lead2.ColorRes(8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0)

&& Make the controls visible so that we can size and position them.
&& They will not really appear until we load an image and paint it.
THISFORM.Lead1.Visible = .T.
THISFORM.Lead2.Visible = .T.

&& Set the variables used for preserving the aspect ratio.
HeightFactor1 = THISFORM.Lead1.BitmapHeight
WidthFactor1 = THISFORM.Lead1.BitmapWidth
HeightFactor2 = THISFORM.Lead2.BitmapHeight
WidthFactor2 = THISFORM.Lead2.BitmapWidth
HeightAllowed = THISFORM.Height * 0.8
WidthAllowed = THISFORM.Width * 0.45

&& Center each LEAD control on half of the form, preserving the aspect ratio.
&& Check to see if using the maximum width will make the image too tall.
&& Set the dimensions based on the result.
IF (WidthAllowed * HeightFactor1) / WidthFactor1 < HeightAllowed
  THISFORM.Lead1.Left = (THISFORM.Width / 4) - (WidthAllowed / 2)
  THISFORM.Lead1.Width = WidthAllowed
  THISFORM.Lead1.Height = (THISFORM.Lead1.Width * HeightFactor1) / WidthFactor1
  THISFORM.Lead1.Top = (THISFORM.Height - THISFORM.Lead1.Height) / 2
Else
  THISFORM.Lead1.Top = (THISFORM.Height - HeightAllowed) / 2
  THISFORM.Lead1.Height = HeightAllowed
  THISFORM.Lead1.Width = (THISFORM.Lead1.Height * WidthFactor1) / HeightFactor1
  THISFORM.Lead1.Left = (THISFORM.Width / 4) - (THISFORM.Lead1.Width / 2)
ENDIF
IF (WidthAllowed * HeightFactor2) / WidthFactor2 < HeightAllowed
  THISFORM.Lead2.Left = (THISFORM.Width * 3/4) - (WidthAllowed / 2)
  THISFORM.Lead2.Width = WidthAllowed
  THISFORM.Lead2.Height = (THISFORM.Lead2.Width * HeightFactor2) / WidthFactor2
  THISFORM.Lead2.Top = (THISFORM.Height - THISFORM.Lead2.Height) / 2
Else
  THISFORM.Lead2.Top = (THISFORM.Height - HeightAllowed) / 2
  THISFORM.Lead2.Height = HeightAllowed
  THISFORM.Lead2.Width = (THISFORM.Lead2.Height * WidthFactor2) / HeightFactor2
  THISFORM.Lead2.Left = (THISFORM.Width * 3 / 4) - (THISFORM.Lead2.Width / 2)
ENDIF

&& Set variables for the position and size of the Lead1 display rectangle.
ImageWidth1 = THISFORM.Lead1.ScaleWidth
ImageHeight1 = THISFORM.Lead1.ScaleHeight
THISFORM.Lead1.SetDstRect(0, 0, ImageWidth1, ImageHeight1)
THISFORM.Lead1.SetDstClipRect(0, 0, ImageWidth1, ImageHeight1)

&& Set variables for the position and size of the Lead2 display rectangle.
ImageWidth2 = THISFORM.Lead2.Width
ImageHeight2 = THISFORM.Lead2.Height
THISFORM.Lead2.SetDstRect(0, 0, ImageWidth2, ImageHeight2)
THISFORM.Lead2.SetDstClipRect(0, 0, ImageWidth2, ImageHeight2)

&& Display the images
THISFORM.Lead1.ForceRepaint
THISFORM.Lead2.ForceRepaint
_SCREEN.MousePointer = 0 && Default


PaintROP3 example for FoxPro

This example demonstrates the PaintROP3 property.

&& Define the Windows constant
#DEFINE SRCINVERT 6684742

&& Paint an inverted image.
THISFORM.Lead1.PaintROP3 = SRCINVERT
THISFORM.Lead1.ForceRepaint


PaintSizeMode Example for Visual FoxPro

This example shows how to set the PaintSizeMode property so that the control uses only a vertical scroll bar.

THISFORM.Lead1.AutoScroll = .T.
THISFORM.Lead1.AutoSetRects = .T.
THISFORM.Lead1.PaintSizeMode = PAINTSIZEMODE_FITSIDES
THISFORM.Lead1.ForceRepaint


PaintSizeUseDPI example for Visual FoxPro

This example toggles the PaintSizeUseDPI property.

If (THISFORM.Lead1.PaintSizeUseDPI = .F.) Then
   THISFORM.Lead1.PaintSizeUseDPI = .T.
Else
   THISFORM.Lead1.PaintSizeUseDPI = .F.
EndIf


PaintWhileLoad example for FoxPro

This example causes the LEAD control to paint the image as it loads.

THISFORM.Lead1.PaintWhileLoad = .T.

&& Get information about the image so that we can size the control.
THISFORM.Lead1.GetFileInfo("c:\lead\images\image2.cmp", 0, 0)

&& Set the variables used for preserving the aspect ratio.
&& Allow for a border of 1/8 of the form size.
&& The units of measure do not matter, since we are calculating proportions.
HeightFactor = THISFORM.Lead1.InfoHeight
WidthFactor = THISFORM.Lead1.InfoWidth
HeightAllowed = ScaleHeight * 3/4
WidthAllowed = ScaleWidth * 3/4

&& Center the LEAD control on the form, preserving the aspect ratio.
&& Check to see if using the maximum width will make the image too tall.
&& Set the dimensions based on the result.
IF ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed
    THISFORM.Lead1.Left = ScaleWidth / 8
    THISFORM.Lead1.Width = WidthAllowed
    THISFORM.Lead1.Height = (THISFORM.Lead1.Width * HeightFactor) / WidthFactor
    THISFORM.Lead1.Top = (ScaleHeight - THISFORM.Lead1.Height) / 2
ELSE
    THISFORM.Lead1.Top = ScaleHeight / 8
    THISFORM.Lead1.Height = HeightAllowed
    THISFORM.Lead1.Width = (THISFORM.Lead1.Height * WidthFactor) / HeightFactor
    THISFORM.Lead1.Left = (ScaleWidth - THISFORM.Lead1.Width) / 2
ENDIF

&& Set the image display sizes to match the LEAD controls
BitmapHeight = THISFORM.Lead1.InfoHeight
BitmapWidth = THISFORM.Lead1.InfoWidth
THISFORM.Lead1.SetSrcRect(0, 0, BitmapWidth, BitmapHeight)
THISFORM.Lead1.SetSrcClipRect(0, 0, BitmapWidth, BitmapHeight)
ImageHeight = THISFORM.Lead1.ScaleHeight
ImageWidth = THISFORM.Lead1.ScaleWidth
THISFORM.Lead1.SetDstRect(0, 0, ImageWidth, ImageHeight)
THISFORM.Lead1.SetDstClipRect(0, 0, ImageWidth, ImageHeight)

&& Turn off the automatic adjustment of display rectangles
THISFORM.Lead1.AutoSetRects = .F.

&& Load the file
THISFORM.Lead1.Load("c:\lead\images\image2.cmp", 0, 0, 1)

&& Turn on the automatic adjustment of display rectangles for future use
THISFORM.Lead1.AutoSetRects = .T.


PaintZoomFactor Example for Visual FoxPro

This example shows how to set the PaintZoomFactor property so that image is scaled 200 percent for display.

THISFORM.Lead1.AutoScroll = .F.
THISFORM.Lead1.AutoSetRects = .T.
THISFORM.Lead1.PaintSizeMode = PAINTSIZEMODE_ZOOM
THISFORM.Lead1.PaintZoomFactor = 200
THISFORM.Lead1.ForceRepaint


PatternStyle example for Visual FoxPro

This example paints a transition with a diagonal cross pattern.

THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead1.EffectDelay = 20
THISFORM.Lead1.Load ("c:\lead\images\image1.cmp", 0, 0, 1)
THISFORM.Lead1.TransitionEffect = EFX_EFFECT_WIPE_RECTANGLE_OUT
THISFORM.Lead1.TransitionStyle = EFX_TRANSITION_PATTERN
THISFORM.Lead1.PatternStyle = EFX_PATTERN_DIAG_CROSS
THISFORM.Lead1.PatternBackColor = RGB(255, 0, 0)
THISFORM.Lead1.PatternForeColor = RGB(0, 0, 255)
THISFORM.Lead1.AutoRepaint = .T.


Pixel example for Visual FoxPro

This example, using the MouseDown event, gets the value of the current pixel and sets all values in the line to that value. The example shows how to convert mouse coordinates to bitmap pixel coordinates, regardless of how the image is zoomed or scrolled.

** OLE Control Event ***
LPARAMETERS button, shift, x, y

&& Set the scalemode to pixels for FoxPro.
THISFORM.Lead1.ScaleMode = 3
THISFORM.Lead1.AutoRepaint = .F.

&& Translate mouse coordinates to fractions of the destination width and height.
xfraction = (x - THISFORM.Lead1.DstLeft) / THISFORM.Lead1.DstWidth
yfraction = (y - THISFORM.Lead1.DstTop) / THISFORM.Lead1.DstHeight

&& Convert fractions to bitmap pixel coordinates.
xPixel = (THISFORM.Lead1.SrcWidth * xfraction) + THISFORM.Lead1.SrcLeft
yPixel = (THISFORM.Lead1.SrcHeight * yfraction) + THISFORM.Lead1.SrcTop

&& Make the whole line the same color as the pixel.
xycolor = THISFORM.Lead1.Pixel(xPixel, yPixel)
For xPixel = 0 To THISFORM.Lead1.BitmapWidth
  THISFORM.Lead1.Pixel(xPixel, yPixel) = xycolor
Next
THISFORM.Lead1.ForceRepaint


Posterize example for FoxPro

This example applies a six-color poster effect and redisplays the image.

THISFORM.Lead1.Posterize(6)
THISFORM.Lead1.ForceRepaint


PreLoadFilters Example for Visual FoxPro

This example shows how to preload filters.

&& preload the BMP, PCX, FAX, and TIFF filters,
&& and allow 1 filter to be cached, while always
&& keeping 3 loaded.
THISFORM.Lead1.PreLoadFilters(3, 1, "BMP,PCX,FAX,TIF")


ProgressivePasses Example for Visual FoxPro

This example shows how to save and load a progressive file.

&& Save the current image as a progressive CMP file.
THISFORM.Lead1.ProgressivePasses = 8
THISFORM.Lead1.Save("c:\lead\images\TMP.cmp", FILE_CMP, 24, QFACTOR_PQ2, SAVE_OVERWRITE)

&& Set properties to show progressive paints when we load.
THISFORM.Lead1.PaintWhileLoad = .T.
THISFORM.Lead1.AutoSetRects = .F.

&& Load the file we just saved.
THISFORM.Lead1.ProgressivePasses = PROGRESSIVEPASSES_WHEN_MEANINGFUL
THISFORM.Lead1.Load("c:\lead\images\TMP.cmp", 0, 0, 1)

&& Restore the default behavior.
THISFORM.Lead1.ProgressivePasses = 0


ReadyState Example for Visual FoxPro

This example shows how to use the ReadyState property to test whether an asynchronous load is in progress.

IF THISFORM.Lead1.ReadyState = READYSTATE_LOADING
   answer = MESSAGEBOX("Still loading the image", 0, "Notice")
ENDIF


Render example for FoxPro

This example shows how to print an image.

&& Set the variables used for preserving the aspect ratio.
HeightFactor = THISFORM.Lead1.BitmapHeight
WidthFactor = THISFORM.Lead1.BitmapWidth

&& Allow a maximum of 6x6 inches on a 300dpi printer
HeightAllowed = 1800
WidthAllowed = 1800

&& Print the LEAD control, preserving the aspect ratio.
&& Check to see if using the maximum width will make the image too tall.
&& Set the dimensions based on the result.
IF ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed
    ControlWidth = WidthAllowed
    ControlHeight = (ControlWidth * HeightFactor) / WidthFactor
ELSE
    ControlHeight = HeightAllowed
    ControlWidth = (ControlHeight * WidthFactor) / HeightFactor
ENDIF

MyPrinter = THISFORM.Lead1.PrintStart
THISFORM.Lead1.Render(MyPrinter, 0, 0, ControlWidth, ControlHeight)
THISFORM.Lead1.PrintEnd(MyPrinter)


Resize event example for FoxPro

This example demonstrates the Resize event.

*** OLE Control Event ***
&& Before using this example you must add a text box to your form.
&& Then, you can exercise this example by coding a command button that
&& changes the width and height of the Lead1 control
myStr = "Control size: " + STR(THISFORM.Lead1.Width) + " x " + STR(THISFORM.Lead1.Height)
THISFORM.Text1.Value = myStr
THISFORM.Text1.Refresh


RgnChange example for FoxPro

The following code for the RgnChange event updates a text box using the GetRgnArea method. You can test it by adding a text box for the lesson described in Outlining, Dragging, and Pasting a Region.

*** OLE Control Event ***
MyText = "Number of pixels in region: "
MyText = MyText + STR(THISFORM.Lead1.GetRgnArea)
THISFORM.Text1.Value = MyText


Rotate example for FoxPro

This example rotates the bitmap 45 degrees and redisplays the image. It resizes the bitmap to accommodate the rotation and uses blue as the fill color.

&& Turn on automatic adjustment of display rectangles and turn on scroll bars.
THISFORM.Lead1.AutoSetRects = .T.
THISFORM.Lead1.AutoScroll = .T.

&& Rotate the bitmap and repaint it.
THISFORM.Lead1.Rotate(4500, ROTATE_RESIZE, RGB(0,0,255))
THISFORM.Lead1.ForceRepaint


Saturation example for FoxPro

This example increases the saturation of colors in the bitmap and redisplays the image.

THISFORM.Lead1.Saturation(1000)
THISFORM.Lead1.ForceRepaint


Save example for FoxPro

This example saves the image as a PNG file, loads the new file, and redisplays the bitmap.

THISFORM.Lead1.Save("c:\lead\images\tmp.png", FILE_PNG, 8, 1, SAVE_OVERWRITE)
THISFORM.Lead1.Load("c:\lead\images\tmp.png", 0, 1, 1)
THISFORM.Lead1.ForceRepaint


SaveInterlaced example for Visual FoxPro

This example saves the current image as an interlaced GIF file, then loads the saved image with a paint-while-load effect that shows the interlaced behavior.

THISFORM.Lead1.SaveInterlaced = .T.
THISFORM.Lead1.Save("d:\temp\tmp.gif", FILE_GIF, 8, 1, SAVE_OVERWRITE)

&&Clear the bitmap so that we can see the paint-while-load effect.
THISFORM.Lead1.Bitmap = 0

&&Paint the image while loading, showing that it is interlaced.
THISFORM.Lead1.PaintWhileLoad = .T.
THISFORM.Lead1.Load ("d:\temp\tmp.gif", 0, 0, 1)


SaveMemory example for FoxPro

This example uses SaveMemory to save a bitmap to a memory-resident file, uses GetMemoryInfo to examine the file size; then uses WIN32 API calls to save the file to disk and free the memory.

&& Declare WIN32 API functions and constants.

Declare integer GlobalAlloc in win32api integer,integer
Declare integer GlobalLock in win32api integer
Declare integer GlobalFree in win32api  integer
Declare integer GlobalUnlock in win32api integer
Declare integer OpenFile in win32api String, integer, integer
Declare integer _hwrite in win32api integer, integer, integer
Declare integer _lclose in win32api integer

#define OF_CREATE       4096     && 0x1000
#define GMEM_MOVEABLE   2

   && declare hMem and iSize
   hMem = 0
   iSize = 0

   && SaveMemory will return a Windows Global Handle containing the image
   &&  exactly as we should write it on the disk

   nret = THISFORM.Lead1.SaveMemory( @hMem, FILE_CMP, 24, -1, @iSize )
   if nret <> 0
      =MESSAGEBOX( "Error calling SaveMemory" )
      return
   endif

   if THISFORM.Lead1.GetMemoryInfo(hMem, 0, iSize) <> 0
      =MESSAGEBOX( "Error calling GetMemoryInfo" )
      =GlobalFree (hMem)
      return
   endif

   && Ask for a confirmation to save this file
   cMsg = "File info:" + CHR(13)
   cMsg = cMsg + STR(THISFORM.Lead1.InfoWidth) + " x " + STR(THISFORM.Lead1.InfoHeight)
   cMsg = cMsg + " x " + STR(THISFORM.Lead1.InfoBits) + " BPP" + CHR(13)
   cMsg = cMsg + "Size in memory: " + STR(THISFORM.Lead1.InfoSizeMem) + CHR(13)
   cMsg = cMsg + "Size on disk : " + STR(THISFORM.Lead1.InfoSizeDisk)

   && If he doesn't say yes, quit
   if MESSAGEBOX(cMsg, 4, "Write this file on disk ?") <> 6
      =GlobalFree (hMem)
      return
   endif

   && Get a pointer to the image data. We will use an integer (32 bit value)
   && and use it like a pointer

   lpMem = GlobalLock(hMem)
   if lpMem = 0
      =GlobalFree( hMem )
      =MESSAGEBOX( "Error calling GlobalLock" )
      return
   endif

   && To create the file, use OpenFile. OpenFile requires a pointer to an OFSTRUCT
   && structure. We will allocate enough memory to hold the structure and free it
   && as soon as we create the file

   hOF = GlobalAlloc( GMEM_MOVEABLE, 512 ) && allocate space for the OFSTRUCT structure
   lpOF = GlobalLock( hOF )
   hf = OpenFile( "c:\lead\images\fox.cmp", lpOF, OF_CREATE )
   =GlobalUnlock(hOF)
   =GlobalFree(hOF)

   if hf = -1                  && if the creation of the file fails, quit
      =GlobalUnlock( hMem )
      =GlobalFree( hMem )
      =MESSAGEBOX( "Error calling FCREATE()" )
      return
   endif

   && Write the image to the file.

   nret = _hwrite( hf, lpMem, iSize )
   if nret <> iSize
      =MESSAGEBOX( "Error writing data" )
   else
      =MESSAGEBOX( " c:\lead\images\fox.cmp was saved successfully on disk." )
 endif

   =_lclose(hf)            && close the file

   =GlobalUnlock( hMem )   && we are responsible to free the memory
   =GlobalFree( hMem )     && allocated by SaveMemory

 return


SaveWithStamp example for FoxPro

This example saves the image in a JPEG file that includes a thumbnail (stamp) image. It then loads the thumbnail from the new file.

SavedMode = THISFORM.Lead1.ScaleMode
THISFORM.Lead1.ScaleMode = 3 &&  Use pixels for sizing the thumbnail
FileName = "c:\lead\images\stamp.jpg"
THISFORM.Lead1.SaveWithStamp(FileName, FILE_JPEG, 24, 30, 150, 100, 24)
THISFORM.Lead1.ScaleMode = SavedMode
THISFORM.Lead1.LoadStamp(FileName)
THISFORM.Lead1.ForceRepaint


Scroll event example for FoxPro

This example demonstrates the Scroll event.

*** OLE Control Event ***
&& You can exercise this example by coding a command button that
&& sets the Lead1 AutoScroll property to true and loads an image with the default display rectangles
myStr = " Image origin: " + STR(THISFORM.Lead1.DstLeft) + ", " + STR(THISFORM.Lead1.DstTop)
THISFORM.Text1.Value = myStr
THISFORM.Text1.Refresh


SetRgn... example for FoxPro

This example demonstrates the SetRgnEllipse, SetRgnRect, SetRgnRoundRect, and SetRgnPolygon methods by simulating client area coordinates. Normally, you would get the coordinates interactively from mouse events and would use Windows GDI functions to outline the shape of each region before it is created.

To create the polygonal region, this example uses the PolygonSize, PolygonX, and PolygonY properties.

Also, to demonstrate the SetRgnColor method, it uses the Fill method to fill the region with a solid color, then uses the fill color to create a new region.

&& Declare the arrays used for polygon points.
DIMENSION xPoint(8) && Array for polygon points
DIMENSION yPoint(8) && Array for polygon points

&& Initialize the variables that we will manipulate to simulate mouse coordinates.
OffsetX = THISFORM.Lead1.ScaleWidth / 15
OffsetY = THISFORM.Lead1.ScaleHeight / 15
CurrentX = OffsetX
CurrentY = OffsetY

&& Set the zoom factors.
ZoomFactorX = THISFORM.Lead1.DstWidth / THISFORM.Lead1.SrcWidth
ZoomFactorY = THISFORM.Lead1.DstHeight / THISFORM.Lead1.SrcHeight

&& Start by simulating the drawing of a rectangle.
SimLeft = CurrentX
SimTop = CurrentY
SimWidth = OffsetX * 2
SimHeight = OffsetY * 2

&& Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (THISFORM.Lead1.DstLeft / ZoomFactorX) + THISFORM.Lead1.SrcLeft
LBRgnTop = (SimTop / ZoomFactorY) - (THISFORM.Lead1.DstTop / ZoomFactorY) + THISFORM.Lead1.SrcTop
LBRgnWidth = SimWidth / ZoomFactorX
LBRgnHeight = SimHeight / ZoomFactorY

&& Create the rectangular region, outline it, and display a message so that we can see what happened.
THISFORM.Lead1.SetRgnRect(LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, L_RGN_SET)
THISFORM.Lead1.RgnFrameType = RGNFRAME_STATIC
answer = MESSAGEBOX( "Here is the rectangular region",0,"Note")

&& Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + OffsetX
CurrentY = CurrentY + OffsetY

&& Next, simulate the drawing of an ellipse.
SimLeft = CurrentX
SimTop = CurrentY
SimWidth = OffsetX * 3
SimHeight = OffsetY * 2

&& Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (THISFORM.Lead1.DstLeft / ZoomFactorX) + THISFORM.Lead1.SrcLeft
LBRgnTop = (SimTop / ZoomFactorY) - (THISFORM.Lead1.DstTop / ZoomFactorY) + THISFORM.Lead1.SrcTop
LBRgnWidth = SimWidth / ZoomFactorX
LBRgnHeight = SimHeight / ZoomFactorY

&& Add the elliptical region, using a Boolean OR,
&& and display a message so that we can see what happened.
THISFORM.Lead1.SetRgnEllipse(LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, L_RGN_OR)
THISFORM.Lead1.RgnFrameType = RGNFRAME_STATIC
answer = MESSAGEBOX( "Here is the added ellipse, with a Boolean OR",0,"Note")

&& Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + OffsetX
CurrentY = CurrentY + OffsetY

&& Next, simulate the drawing of a rounded rectangle.
SimLeft = CurrentX
SimTop = CurrentY
SimWidth = OffsetX * 3
SimHeight = OffsetY * 2

&& Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (THISFORM.Lead1.DstLeft / ZoomFactorX) + THISFORM.Lead1.SrcLeft
LBRgnTop = (SimTop / ZoomFactorY) - (THISFORM.Lead1.DstTop / ZoomFactorY) + THISFORM.Lead1.SrcTop
LBRgnWidth = SimWidth / ZoomFactorX
LBRgnHeight = SimHeight / ZoomFactorY

&& Define an ellipse to use for the corners.
eW = LBRgnWidth / 4
eH = LBRgnHeight / 4

&& Add the rounded rectangular region, using a Boolean exclusive OR,
&& and display a message so that we can see what happened.
THISFORM.Lead1.SetRgnRoundRect(LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, eW, eH, L_RGN_XOR)
answer = MESSAGEBOX( "Here is the rounded rectangle, with a Boolean XOR",0,"Note")

&& Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + (2 * OffsetX)
CurrentY = CurrentY + (2 * OffsetY)

&& Set up some arrays to use as client area grid values. OffsetX and OffsetY set the grid sizes.

xPoint(1) = 0
xPoint(2) = -1
xPoint(3) = 2
xPoint(4) = 1
xPoint(5) = 1
xPoint(6) = 2
xPoint(7) = -1
xPoint(8) = -2

yPoint(1) = 0
yPoint(2) = -1
yPoint(3) = -1
yPoint(4) = 1
yPoint(5) = -1
yPoint(6) = 1
yPoint(7) = 1
yPoint(8) = 1

&& Initialize the polygon size using an arbitrary number.
&& This number will be increased dynamically.
THISFORM.Lead1.PolygonSize = 5

&& Fill in the array for the polygon. This simulates a user's mouse clicks.
FOR i = 1 TO 8
    CurrentX = CurrentX + (xPoint(i) * OffsetX)
    CurrentY = CurrentY + (yPoint(i) * OffsetY)
    THISFORM.Lead1.PolygonX(i-1) = (CurrentX / ZoomFactorX) - (THISFORM.Lead1.DstLeft / ZoomFactorX) + THISFORM.Lead1.SrcLeft
    THISFORM.Lead1.PolygonY(i-1) = (CurrentY / ZoomFactorY) - (THISFORM.Lead1.DstTop / ZoomFactorY) + THISFORM.Lead1.SrcTop
    IF i + 1 = THISFORM.Lead1.PolygonSize
        THISFORM.Lead1.PolygonSize = THISFORM.Lead1.PolygonSize + 5
    ENDIF
ENDFOR

&& Adjust the polygon size to the actual number of points.
THISFORM.Lead1.PolygonSize = i-1

&& Add the polygonal region, using a Boolean OR,
&& and display a message so that we can see what happened.
THISFORM.Lead1.SetRgnPolygon(L_POLY_WINDING, L_RGN_OR)
answer = MESSAGEBOX( "Here is the added polygon, with a Boolean OR",0,"Note")

&& Fill the resulting polygon with red, and display a message.
THISFORM.Lead1.Fill(RGB(255, 0, 0))
THISFORM.Lead1.RgnFrameType = RGNFRAME_NONE
THISFORM.Lead1.ForceRepaint
answer = MESSAGEBOX( "Using SetRgnColor and L_RGN_SETNOT, all else will become blue.",0,"Note")

&& Clean up memory
THISFORM.Lead1.FreeRgn

&& Do the final region.
THISFORM.Lead1.SetRgnColor(RGB(255, 0, 0), L_RGN_SETNOT)
THISFORM.Lead1.Fill(RGB(0, 0, 255))
THISFORM.Lead1.ForceRepaint

&& Clean up memory
THISFORM.Lead1.FreeRgn
THISFORM.Lead1.PolygonSize = 0


SetSrcClipRect example for FoxPro

This example crops the image by reducing the source clipping area and repaints the image.

OldLeft = THISFORM.Lead1.SrcClipLeft
OldTop = THISFORM.Lead1.SrcClipTop
OldWidth = THISFORM.Lead1.SrcClipWidth
OldHeight = THISFORM.Lead1.SrcClipHeight
NewLeft = OldLeft + ROUND(OldWidth * .1, 0)
NewTop = OldTop + ROUND(OldHeight * .1, 0)
NewWidth = ROUND(OldWidth * .8, 0)
NewHeight = ROUND(OldHeight * .8, 0)
IF (NewWidth > 1) AND (NewHeight >1)
   THISFORM.Lead1.SetSrcClipRect(NewLeft, NewTop, NewWidth, NewHeight)
ENDIF
THISFORM.Lead1.ForceRepaint


SetSrcRect example for FoxPro

This example zooms in on the image by reducing the source rectangle and repaints the image.

OldLeft = THISFORM.Lead1.SrcLeft
OldTop = THISFORM.Lead1.SrcTop
OldWidth = THISFORM.Lead1.SrcWidth
OldHeight = THISFORM.Lead1.SrcHeight
NewLeft = OldLeft + ROUND(OldWidth * .1, 0)
NewTop = OldTop + ROUND(OldHeight * .1, 0)
NewWidth = ROUND(OldWidth * .8, 0)
NewHeight = ROUND(OldHeight * .8, 0)
IF (NewWidth > 1) AND (NewHeight >1)
   THISFORM.Lead1.SetSrcRect(NewLeft, NewTop, NewWidth, NewHeight)
ENDIF
THISFORM.Lead1.ForceRepaint


Sharpen example for FoxPro

This example increases the sharpness of the bitmap and redisplays the image.

THISFORM.Lead1.Sharpen(500)
THISFORM.Lead1.ForceRepaint


Shear example for FoxPro

This example shears the bitmap 5 degrees horizontally and redisplays the image. It uses blue as the fill color.

THISFORM.Lead1.Shear(500, .T., RGB(0,0,255))
THISFORM.Lead1.ForceRepaint


Solarize example for Visual FoxPro

This example applies a solarize effect and repaints the image.

THISFORM.Lead1.Solarize(100)
THISFORM.Lead1.ForceRepaint


SpatialFilter example for FoxPro

This example applies an emboss effect and redisplays the image.

THISFORM.Lead1.SpatialFilter(FLT_EMBOSS_NE)
THISFORM.Lead1.ForceRepaint


Src.... example for FoxPro

This example uses the source rectangle properties to zoom in on the image.

&& Calculate the values to zoom in by 10 percent and center the image.
IF (THISFORM.Lead1.SrcWidth > 1) AND (THISFORM.Lead1.SrcHeight > 1)
  THISFORM.Lead1.SrcWidth = THISFORM.Lead1.SrcWidth * 0.9
  THISFORM.Lead1.SrcHeight = THISFORM.Lead1.SrcHeight * 0.9
  THISFORM.Lead1.SrcTop = (THISFORM.Lead1.BitmapHeight - THISFORM.Lead1.SrcHeight) / 2
  THISFORM.Lead1.SrcLeft = (THISFORM.Lead1.BitmapWidth - THISFORM.Lead1.SrcWidth) / 2
ENDIF

&& Set the clipping area to the same as the destination rectangle
THISFORM.Lead1.SrcClipWidth = THISFORM.Lead1.SrcWidth
THISFORM.Lead1.SrcClipHeight = THISFORM.Lead1.SrcHeight
THISFORM.Lead1.SrcClipTop = THISFORM.Lead1.SrcTop
THISFORM.Lead1.SrcClipLeft = THISFORM.Lead1.SrcLeft

&& Redisplay the image
THISFORM.Lead1.ForceRepaint


StretchIntensity example for FoxPro

This example stretches the intensity and redisplays the image.

THISFORM.Lead1.StretchIntensity
THISFORM.Lead1.ForceRepaint


TextWordWrap example for Visual FoxPro

This example wraps text inside the rectangle that is specified for the text object.

&& Text location
THISFORM.Lead1.TextTop = 10
THISFORM.Lead1.TextLeft = 10
THISFORM.Lead1.TextWidth = 150
THISFORM.Lead1.TextHeight = 150

&& Text alignment and angle
THISFORM.Lead1.TextAlign = EFX_TEXTALIGN_HCENTER_VCENTER
THISFORM.Lead1.TextAngle = 0

&& Enable word wrap
THISFORM.Lead1.TextWordWrap = .T.

THISFORM.Lead1.DrawText ("LEADTOOLS 12 Supports WordWrap when drawing text.", 0)


TransitionEffect example for Visual FoxPro

This example paints a transition with a 255-step grayscale gradient.

THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead1.EffectDelay = 20
THISFORM.Lead1.Load ("c:\lead\images\image1.cmp", 0, 0, 1)
THISFORM.Lead1.TransitionEffect = EFX_EFFECT_WIPE_RECTANGLE_OUT
THISFORM.Lead1.TransitionStyle = EFX_TRANSITION_GRADIENT
THISFORM.Lead1.GradientStyle = EFX_GRADIENT_ANGLE_TO_LT
THISFORM.Lead1.GradientEndColor = RGB(0, 0, 0)
THISFORM.Lead1.GradientStartColor = RGB(255, 255, 255)
THISFORM.Lead1.GradientSteps = 255
THISFORM.Lead1.AutoRepaint = .T.


TransparentColor example for Visual FoxPro

This example sets white as a transparent color; then loads a test image and paints it.

THISFORM.Lead1.AutoRepaint = .F.
THISFORM.Lead1.PaintEffect = 9

&& Enable transparency
THISFORM.Lead1.BitmapEnableTransparency = .T.

&& Make white the transparent color
THISFORM.Lead1.BitmapTransparentColor = RGB(255, 255, 255)
THISFORM.Lead1.Load ("d:\temp\ctest.bmp", 0, 0, 1)
THISFORM.Lead1.ForceRepaint()


Trim example for FoxPro

This example trims one-tenth from the bitmap and repaints the image.

NewLeft = ROUND(THISFORM.Lead1.BitmapWidth * .1, 0)
NewTop = ROUND(THISFORM.Lead1.BitmapHeight * .1, 0)
NewWidth = ROUND(THISFORM.Lead1.BitmapWidth * .8, 0)
NewHeight = ROUND(THISFORM.Lead1.BitmapHeight * .8, 0)
THISFORM.Lead1.Trim(NewLeft, NewTop, NewWidth, NewHeight)

&& Set variables for the position and size of the display rectangle.
ViewWidth = THISFORM.Lead1.ScaleWidth
ViewHeight = THISFORM.Lead1.ScaleHeight

&& Set the image display size to match the LEAD control
THISFORM.Lead1.SetDstRect(0, 0, ViewWidth, ViewHeight)
THISFORM.Lead1.SetDstClipRect(0, 0, ViewWidth, ViewHeight)
THISFORM.Lead1.ForceRepaint


Underlay example for FoxPro

This example loads a bitmap into Lead2 and uses it as a tiled underlay for Lead1.

THISFORM.Lead2.Visible = .F.
THISFORM.Lead2.Load("c:\lead\images\ulay1.bmp", 0, 0, 1)
THISFORM.Lead1.Underlay(THISFORM.Lead2.Bitmap, UNDERLAY_TILE)
THISFORM.Lead1.ForceRepaint


UserPalette and BitmapPalette example for FoxPro

This example demonstrates the UserPalette and BitmapPalette properties.

&& Specify a blue and white user palette
THISFORM.Lead1.UserPalette(0) = RGB(0, 0, 255)
THISFORM.Lead1.UserPalette(1) = RGB(255, 255, 255)

&& Implement the user palette
THISFORM.Lead1.ColorRes(1, CRP_USERPALETTE, CRD_ORDEREDDITHERING, 2)

&& Display the blue and white image
THISFORM.Lead1.ForceRepaint
Msg = "This is the user palette. Click OK to change the bitmap palette."
answer = MESSAGEBOX(Msg, 0, "Notice")

&& Change the bitmap palette to red and white
THISFORM.Lead1.BitmapPalette(0) = RGB(255, 0, 0)
THISFORM.Lead1.BitmapPalette(1) = RGB(255, 255, 255)

&& Display the red and white image
THISFORM.Lead1.ForceRepaint


Version... example for FoxPro

This example puts the version information into a string and displays the string in a message box.

IF THISFORM.Lead1.VersionLevel = VERSIONLEVEL_EXP
    LevelStr = "Document/Medical"
ELSE
    LevelStr = "Professional Edition"
ENDIF

cMsg = THISFORM.Lead1.VersionProduct + Chr(13) + LevelStr + Chr(13)
cMsg = cMsg + "Version: " + STR(THISFORM.Lead1.VersionMajor) + "."
cMsg = cMsg + STR(THISFORM.Lead1.VersionMinor) + Chr(13)
 cMsg = cMsg + "Date produced: " + THISFORM.Lead1.VersionDate + Chr(13)
cMsg = cMsg + "Time produced: " + THISFORM.Lead1.VersionTime + Chr(13)
&& Display the message box
answer = MESSAGEBOX(cMsg, 0, "Version Info")


WindowLevel example for FoxPro

This example converts a bitmap to 12-bit grayscale and then performs window leveling on the eight least significant bits of the image.

    THISFORM.Lead1.Grayscale(12)  && Grayscale image to 12-bit

    && use least significant 8 bits

    THISFORM.Lead1.LevelLowBit = 0

    THISFORM.Lead1.LevelHighBit = 7

    THISFORM.Lead1.WindowLevel()


ZoomIn example for FoxPro

This example calls ZoomIn() method to zoom in on a captured image.

THISFORM.Lead1.ZoomIn()


ZoomInDone example for FoxPro

This example triggers the ZoomInDone event and displays a message that the ZoomIn image has been captured.

*** OLE Control Event ***
           LPARAMETERS x, y

               answer = MESSAGEBOX("ZoomIn Captured: " + Str(x) + "," + Str(y))


Tutorial for Visual Basic Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS ActiveX.

Note:	These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Loading and Displaying an Image

Loading and Saving Images Using Databases

Zooming Out and Zooming In

Dynamically Positioning the Control

Zooming In on a Selection

Outlining, Dragging, and Pasting a Region

Creating and Using Annotations

Loading and Saving Annotations Using Databases

Using ODBC to Access Image Data

Implementing a Database with a Data Control

Implementing a Database with the MS ADO Data Control

Printing Multiple Images

Writing and Reading Multipage Files

Using Transparent Controls

Drawing Simple Lines and Shapes

Cropping a Bitmap

Creating, Viewing, and Merging Color Separations

Updating a Gauge and Detecting a User Interrupt

Using the Magnifying Glass

Using Imaging Common Dialog

Adding a Color Resolution Dialog

Using a PanWindow

Print a Real Image Size in Inches

Combining Images with Regions

Miscellaneous Examples


Loading and Displaying an Image (Visual Basic)

Take the following steps to start a project and to add some code that displays an image on the main form:

1.	Start Visual Basic.

2.	Add the LEAD Control to your project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD OLE Custom Control (14).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Main Control (14).

3.	 Select the LEAD control; then add the control to your main form. Size and position the control as you want it to appear at run time.

4.	 Add a command button to your form and name it as follows:

Name	Caption

LoadLead	Load Image

5.	Add the following initialization code to the main form's Load procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub Form_Load()
  'Set defaults for displaying the image.
  'These are all persistent properties that can be set in the properties box.
  Lead1.Appearance = APPEARANCE_FLAT
  Lead1.BorderStyle = 1
  Lead1.BackColor = RGB(255, 255, 125)
  Lead1.PaintDither = PAINTDITHER_DIFFUSION
  Lead1.PaintPalette = PAINTPALETTE_AUTO
  Lead1.AutoRepaint = True
  Lead1.AutoSize = False
  Lead1.AutoSetRects = True
  Lead1.PaintSizeMode = PAINTSIZEMODE_FIT
End Sub

6.	Code the LoadLead button's click procedure as follows:

Private Sub LoadLead_Click()
    Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1
End Sub

7.	Run your program to test it.

8.	Save the project to use as a starting point for other tasks in this tutorial.


Loading and Saving Images Using Databases (Visual Basic)

Take the following steps to start a project and to add some code that demonstrates adding images to or deleting images from the BLOB field of a database file.

You need to create a database file (DB1.MDB) with the fields listed below, before running this tutorial.

Field Name	Type
Image	OleObject
Size	Number
1.	Start Visual Basic.
2.	Add the LEAD Main Control to your project.
	On the Project pull-down menu, use the Components option, and select the LEAD Main Control  (14).
3.	Add the Microsoft ActiveX Data Object 2.6 Library to your project.
	On the Project pull-down menu, use the References option, and select the Microsoft ActiveX Data Object 2.6 Library.
4.	Select the LEAD Main control; then add the control to your main form. Size and position the control as you want it to appear at run time.
5.	Add six command buttons to your form and name them as follows:
	Name	Caption
	cmdAddRecord	Add Record
	cmdMoveNext	Move Next
	cmdMovePrevious	Move Previous
	cmdDeleteRecord	Delete Record
	cmdConnect	Connect to Database
	cmdDisconnect	Disconnect From Database
6.	Declare the following variables as Global variables:
Dim Recordset As New ADODB.Recordset
Dim Connection As New ADODB.Connection
Dim strConnect As String

7.	Add the following initialization code to the main form's Load procedure.
   LEAD1.Load "c:\parrots.jpg", 0, 0, 1

   cmdMoveNext.Enabled = False
   cmdMovePrevious.Enabled = False
   cmdAddRecord.Enabled = False
   cmdDeleteRecord.Enabled = False

   strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\DB1.mdb"

8.	Code the cmdAddRecord button's Click procedure as follows:
   Dim Data As Variant
   Dim ByteArray() As Byte
   Dim i As Long
   Dim nSize As Long

   If Connection.State = adStateClosed Then
      MsgBox "Connection closed", vbInformation, "Save error"
      Exit Sub
   End If

   Recordset.AddNew

   Data = LEAD1.SaveArray(FILE_BMP, 0, 0)
   nSize = LEAD1.ArraySize(Data)
   Recordset.Fields("Image").Value = Data
   Recordset.Fields("Size").Value = nSize

   If Not Recordset.BOF Then Recordset.MoveFirst

   Recordset.Update

   If Recordset.RecordCount > 0 Then
    cmdMoveNext.Enabled = True
    cmdMovePrevious.Enabled = True
    cmdDeleteRecord.Enabled = True
   End If

9.	Code the cmdMoveNext button's Click procedure as follows:
   Dim i As Long
   Dim nSize As Long
   Dim Data As Variant

   If Not Recordset.EOF Then Recordset.MoveNext

   If (Recordset.EOF) Then
      MsgBox "Unable to get the image from the database"
      Recordset.MovePrevious
   Else
      nSize = Recordset.Fields("Size").Value
      Data = Recordset.Fields("Image").Value
      LEAD1.LoadArray Data, 0, 0, -1, nSize
   End If

10.	Code the cmdMovePrevious button's Click procedure as follows:
   Dim Data As Variant
   Dim i As Long
   Dim nSize As Long

   If Not Recordset.BOF Then Recordset.MovePrevious

   If (Recordset.BOF) Then
      MsgBox "Unable to get the image from the database"
      Recordset.MoveNext
   Else
      nSize = Recordset.Fields("Size").Value
      Data = Recordset.Fields("Image").Value
      LEAD1.LoadArray Data, 0, 0, -1, nSize
   End If

11.	Code the cmdDeleteRecord button's Click procedure as follows:
     If Connection.State = adStateClosed Then
      MsgBox "Connection closed", vbInformation, "Delete error"
      Exit Sub
   End If
   If Not Recordset.BOF Or Not Recordset.EOF Then
      Recordset.MoveLast
      Recordset.Delete
      Recordset.Update

      If Recordset.RecordCount <= 0 Then
         cmdMoveNext.Enabled = False
         cmdMovePrevious.Enabled = False
         cmdDeleteRecord.Enabled = False
      End If
   End If

12.	Code the cmdConnect button's Click procedure as follows:
       If Connection.State = adStateClosed Then
         Connection.Open strConnect
      End If

      If Recordset.State = adStateOpen Then Recordset.Close
      Set Recordset.ActiveConnection = Connection
      Recordset.Open "SELECT * FROM Images", Connection, adOpenKeyset, adLockOptimistic

      If Not Recordset.BOF Then Recordset.MoveFirst

      If Not Recordset.EOF Then
         cmdMoveNext.Enabled = True
         cmdMovePrevious.Enabled = True
         cmdDeleteRecord.Enabled = True
      End If

      cmdAddRecord.Enabled = True

13.	Code the cmdDisconnect button's Click procedure as follows:
      If Connection.State = adStateOpen Then Connection.Close
      If Recordset.State = adStateOpen Then Recordset.Close
      cmdMoveNext.Enabled = False
      cmdMovePrevious.Enabled = False
      cmdAddRecord.Enabled = False
      cmdDeleteRecord.Enabled = False

14.	Run your program to test it.


Zooming Out and Zooming In (Visual Basic)

Take the following steps to add code that can reduce and enlarge the displayed size of the image. This demonstrates the scaling properties that are normally used for zooming in and zooming out. It emphasizes the relationship of the displayed rectangle to the LEAD control.

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

2.	 Add two command buttons to your form and name them as follows:

Name	Caption

ZoomIn	Zoom In

ZoomOut	Zoom Out

3.	Code the ZoomIn button's click procedure as follows:

Private Sub ZoomIn_Click()
  Lead1.AutoSetRects = True
  Lead1.PaintSizeMode = PAINTSIZEMODE_ZOOM
  Lead1.PaintZoomFactor = Lead1.PaintZoomFactor + 10
End Sub

4.	Code the ZoomOut button's click procedure as follows:

Private Sub ZoomOut_Click()
  Lead1.AutoSetRects = True
  Lead1.PaintSizeMode = PAINTSIZEMODE_ZOOM
  If Lead1.PaintZoomFactor > 10 Then
      Lead1.PaintZoomFactor = Lead1.PaintZoomFactor - 10
  End If
End Sub

5.	Run your program to test it.


Dynamically Positioning the Control (Visual Basic)

Take the following steps to dynamically scale and position the LEAD control when loading an image. This example scales the control to use most of the form's area while preserving the image's aspect ratio.

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

2.	Modify the LeadLoad button's click procedure so that it appears as follows. For a general explanation of how images are positioned and scaled, refer to Displaying an Image.

Private Sub LoadLead_Click()
  'Declare variables used for preserving aspect ratios.
  Dim HeightFactor As Long
  Dim WidthFactor As Long
  Dim HeightAllowed As Long
  Dim WidthAllowed As Long

  'Position and size the main form so that it takes up most of the screen.
  Width = Screen.Width  * 0.9
  Height = Screen.Height* 0.8
  Left = (Screen.Width - Width) / 2
  TOP = (Screen.Height - Height) / 2

  'Turn off automated behavior while we load and manipulate the image.
  Lead1.AutoRepaint = False
  Lead1.AutoScroll = False
  Lead1.BackErase = False

  'Load the bitmap. This hard-coded path name may be different on your system.
  Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1

  'Set the variables used for preserving the aspect ratio.
  'Allow for a border of 1/8 of the form size.
  'The units of measure do not matter, since we are calculating proportions.
  HeightFactor = Lead1.BitmapHeight
  WidthFactor = Lead1.BitmapWidth
  HeightAllowed = ScaleHeight * 3/4
  WidthAllowed = ScaleWidth * 3/4

  'Center the LEAD control on the form, preserving the aspect ratio.
  'Check to see if using the maximum width will make the image too tall.
  'Set the dimensions based on the result.
  If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
    Lead1.Left = ScaleWidth / 8
    Lead1.Width = WidthAllowed
    Lead1.Height = (Lead1.Width * HeightFactor) / WidthFactor
    Lead1.TOP = (ScaleHeight - Lead1.Height) / 2
  Else
    Lead1.TOP = ScaleHeight / 8
    Lead1.Height = HeightAllowed
    Lead1.Width = (Lead1.Height * WidthFactor) / HeightFactor
    Lead1.Left = (ScaleWidth - Lead1.Width) / 2
  End If

  'Set the image display size to match the LEAD control
  Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
  Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
  Lead1.SetSrcRect 0, 0, Lead1.BitmapWidth, Lead1.BitmapHeight
  Lead1.SetSrcClipRect 0, 0, Lead1.BitmapWidth, Lead1.BitmapHeight

  'Turn on automated behavior while we load and manipulate the image.
  Lead1.AutoRepaint = True
  Lead1.AutoScroll = True

End Sub

6.	Run your program to test it.


Zooming In on a Selection (Visual Basic)

Take the following steps to add code that lets you select an area with a mouse, and zoom in on the selected area.

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

2.	In the LEAD1 control's MouseDown procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub Lead1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   'Enable AutoRubberBand
   Lead1.AutoRubberBand = True
   Lead1.MousePointer = 2
End Sub

3.	In the LEAD1 control's Rubberband procedure, add the following code.

Private Sub Lead1_RubberBand()
  Dim zoomleft As Integer
  Dim zoomtop As Integer
  Dim zoomwidth As Integer
  Dim zoomheight As Integer

   Lead1.MousePointer = 0
   'Zoom in on the selection.
   zoomleft = Lead1.RubberBandLeft
   zoomtop = Lead1.RubberBandTop
   zoomwidth = Lead1.RubberBandWidth
   zoomheight = Lead1.RubberBandHeight
   'Zoom in on the rectangle defined by the rubberband
   Lead1.ZoomToRect zoomleft, zoomtop, zoomwidth, zoomheight
   Lead1.ForceRepaint
End Sub

4.	Run your program to test it.


Outlining, Dragging, and Pasting a Region (Visual Basic)

Take the following steps to add code that lets you outline an area with a mouse, drag a copy of the selected area, and paste the copy into another part of the bitmap:

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

2.	Add a second LEAD control, name it Lead2, and set its Visible property to False.

3.	Add the following form-level variables to the declarations procedure of the general object in your main form. In online help, you can use the Edit pull-down menu to copy the block of code.

Dim ReadyToDrag As Boolean 'The state after marking the region but before dragging
Dim Dragging As Boolean 'The state when the mouse is used for dragging the floater
Dim StartX As Single 'Starting X position in screen twips
Dim StartY As Single 'Starting Y position in screen twips
Dim FloaterX As Single 'Floater X position in screen twips
Dim FloaterY As Single 'Floater Y position in screen twips
Dim ZoomFactorX As Single 'Used for translating positioning information
Dim ZoomFactorY As Single 'Used for translating positioning information

4.	 At the top of your main form, add two command buttons and name them as follows:

Name	Caption

SelRgnBtn	Select Region

PasteFloaterBtn	Paste Floater

5.	Add the following code to the SelRgnBtn control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub SelRgnBtn_Click()

Lead1.RgnMarkingMode = RGNMARK_FREEHAND
MsgBox "Draw a freehand region"

End Sub

6.	Add the following code to the PasteFloaterBtn control's Click procedure:

Private Sub PasteFloaterBtn_Click()

'Do nothing if there is no floater.
If Lead1.Floater = 0 Then Exit Sub

'Get the floater into another bitmap
Lead2.ScaleMode = Lead1.ScaleMode
Lead2.Bitmap = Lead1.Floater

'Get the floater's client coordinates into local variables.
LCRgnX = Lead1.FloaterDstLeft
LCRgnY = Lead1.FloaterDstTop
LCRgnWidth = Lead1.FloaterDstWidth
LCRgnHeight = Lead1.FloaterDstHeight

'Delete the floater.
Lead1.FloaterVisible = False
Lead1.Floater = 0

'Translate the client coordinates to bitmap coordinates.
LBRgnX = ((LCRgnX - Lead1.DstLeft) / ZoomFactorX) + Lead1.SrcLeft
LBRgnY = ((LCRgnY - Lead1.DstTop) / ZoomFactorY) + Lead1.SrcTop
LBRgnWidth = LCRgnWidth / ZoomFactorX
LBRgnHeight = LCRgnHeight / ZoomFactorY

'Reposition the region to use as a mask for the Combine method.
Lead1.OffsetRgn LBRgnX - Lead1.RgnLeft, LBRgnY - Lead1.RgnTop

'Use the Combine method to paste the Lead2 bitmap into the Lead1 bitmap.
MyOp = CB_OP_ADD + CB_DST_0 'Operation flags for a simple paste.
Lead1.Combine LBRgnX, LBRgnY, LBRgnWidth, LBRgnHeight, Lead2.Bitmap, 0, 0, MyOp

'Repaint the part of the client area that has changed.
Lead1.RepaintRect LCRgnX, LCRgnY, LCRgnWidth, LCRgnHeight, False

'Free the region.
Lead1.FreeRgn

End Sub

7.	In the LEAD1 control's MouseDown procedure, add the following code:

Private Sub Lead1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

'Do nothing if we are drawing a region.
If Lead1.RgnMarkingMode <> RGNMARK_NONE Then Exit Sub

'Make sure we are using Twips, so that we do not have to translate mouse coordinates.
Lead1.ScaleMode = 1

' Save the starting position, in case we need it.
StartY = y
StartX = x

'If we are ready to drag the selection, get a floater.
If ReadyToDrag = True Then
  'Translate the current mouse coordinates.
  'These coordinates account for the zoom factor and offset.
  ZoomFactorX = Lead1.DstWidth / Lead1.SrcWidth
  ZoomFactorY = Lead1.DstHeight / Lead1.SrcHeight
  BitmapX = (x / ZoomFactorX) - (Lead1.DstLeft / ZoomFactorX) + Lead1.SrcLeft
  BitmapY = (y / ZoomFactorY) - (Lead1.DstTop / ZoomFactorY) + Lead1.SrcTop

  'Continue to create the floater if the mouse is pointing to the region we marked.
  If Lead1.IsPtInRgn(BitmapX, BitmapY) Then
     'Hide the region frame.
     Lead1.RgnFrameType = RGNFRAME_NONE

     'Create the floater bitmap, which will be the part of the main bitmap that is
     'in the region's bounding rectangle.
     Lead1.Floater = Lead1.Bitmap

     'Translate the bitmap region coordinates to client area coordinates.
     NewY = ((Lead1.RgnTop - Lead1.SrcTop) * ZoomFactorY) + Lead1.DstTop
     NewX = ((Lead1.RgnLeft - Lead1.SrcLeft) * ZoomFactorX) + Lead1.DstLeft
     NewWidth = Lead1.RgnWidth * ZoomFactorX
     NewHeight = Lead1.RgnHeight * ZoomFactorY

     'Set the initial display position of the floater.
     Lead1.SetFloaterDstRect NewX, NewY, NewWidth, NewHeight

     'Set form-level variables.
     FloaterY = Lead1.FloaterDstTop
     FloaterX = Lead1.FloaterDstLeft
     Lead1.FloaterVisible = True
     Dragging = True
     ReadyToDrag = False
  End If

End If

End Sub

8.	In the LEAD1 control's MouseMove procedure, add the following code.

Private Sub Lead1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)

'Do nothing if we are drawing a region.
If Lead1.RgnMarkingMode <> RGNMARK_NONE Then Exit Sub

'Reposition the floater if we are dragging it.
If Dragging = True And Button = 1 And Lead1.Floater <> 0 Then
    If Lead1.IsPtInFloater(x, y) Then
        'Update the position variables.
        XDelta = x - StartX
        YDelta = y - StartY
        NewX = FloaterX + XDelta
        NewY = FloaterY + YDelta
        NewWidth = Lead1.FloaterDstWidth
        NewHeight = Lead1.FloaterDstHeight

        'Reposition the floater.
        Lead1.SetFloaterDstRect NewX, NewY, NewWidth, NewHeight

        'Save the form-level position variables.
        FloaterY = NewY
        FloaterX = NewX
        StartY = y
        StartX = x
    End If
End If

End Sub

9.	In the LEAD1 control's MouseUp procedure, add the following code.

Private Sub Lead1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)

' If we were drawing a region, set up for the next operation.
If Lead1.RgnMarkingMode <> RGNMARK_NONE Then
    Lead1.RgnMarkingMode = RGNMARK_NONE
    Lead1.RgnFrameType = RGNFRAME_STATIC
    ReadyToDrag = True
    MsgBox "Now, drag the selection to another place."
End If

End Sub

10.	Run your program to test it.


Creating and Using Annotations (Visual Basic)

Note: This topic is for Document/Medical  only.

Take the following steps to add code that demonstrates the creation and deletion, saving and loading, and copying and pasting of annotation objects. This code also demonstrates the related events. Message boxes prompt for user actions that trigger events.

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

2.	 At the top of your main form, add four command buttons and name them as follows:

Name	Caption

AnnToggle	Start

IOToggle	Save

ClipboardToggle	Copy

Realize	Realize

3.	Code the AnnToggle control's Click procedure as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub AnnToggle_Click()

'Use the button to toggle between design mode and run mode
If AnnToggle.Caption = "Start" Then
    Lead1.AnnUserMode = ANNUSERMODE_DESIGN
    Lead1.AnnTool = ANNTOOL_BUTTON
    'Make run mode the next thing.
    AnnToggle.Caption = "Run Mode"
    MsgBox "In design mode now. Draw a button object."
ElseIf AnnToggle.Caption = "Design Mode" Then
    Lead1.AnnUserMode = ANNUSERMODE_DESIGN
    Lead1.AnnTool = ANNTOOL_BUTTON
    'Make run mode the next thing.
    AnnToggle.Caption = "Run Mode"
Else 'The button takes us to run mode
    Lead1.AnnUserMode = ANNUSERMODE_RUN
    MsgBox "Click on your new button"
    AnnToggle.Caption = "Design Mode"
End If

End Sub

4.	Code the IOToggle control's Click procedure as follows:

Private Sub IOToggle_Click()

Dim nRet As Integer
'Disable errors so that we can trap our own.
Lead1.EnableMethodErrors = False

'Use the button to toggle between saving and loading annotations
If IOToggle.Caption = "Save" Then
    'Do nothing if there are no annotations.
    If Lead1.AnnContainer = 0 Then Exit Sub
    'Save the selected annotations.
    nRet = Lead1.AnnSave("c:\lead\images\tmp.ann", ANNFMT_NATIVE, True, SAVE_OVERWRITE, 0)
    If nRet = 0 Then
        'Make loading the next thing.
        IOToggle.Caption = "Load"
        MsgBox "Use the right mouse button to delete any annotations, then click Load"
    Else
        MsgBox "Error code: " + Str(nRet)
    End If
Else 'We are loading annotations
    'Make sure we are in design mode
    Lead1.AnnUserMode = ANNUSERMODE_DESIGN
    'Load the annotations.
    nRet = Lead1.AnnLoad("c:\lead\images\tmp.ann", 1)
    If nRet = 0 Then
        IOToggle.Caption = "Save"
    Else
        MsgBox "No annotations to load"
    End If
End If
End Sub

5.	Code the ClipboardToggle control's Click procedure as follows. (Note that Copy, Cut, and Paste are available as automated popup menu options. This code is for tailoring your application.)

Private Sub ClipboardToggle_Click()

Dim nRet As Integer
'Disable errors so that we can trap our own.
Lead1.EnableMethodErrors = False

'Use the button to toggle between copying and pasting annotations
If ClipboardToggle.Caption = "Copy" Then
    'Do nothing if there are no annotations.
    If Lead1.AnnContainer = 0 Then Exit Sub

    'Copy the selected annotations to the clipboard.
    nRet = Lead1.AnnCopy(ANNFMT_NATIVE, True, True)
    If nRet = 0 Then
        'Make pasting the next thing.
        ClipboardToggle.Caption = "Paste"
        MsgBox "Use the right mouse button to delete any annotations, then click Paste"
   Else
        MsgBox "Error code: " + Str(nRet)
    End If
Else 'We are pasting annotations
    'Make sure we are in design mode
    Lead1.AnnUserMode = ANNUSERMODE_DESIGN
    'Paste the annotations
    If Lead1.AnnPasteReady Then
        Lead1.AnnPaste
        ClipboardToggle.Caption = "Copy"
    Else
        MsgBox "No annotations to paste"
    End If
End If

End Sub

6.	Code the Realize control's Click procedure (which renders the annotation objects to the bitmap) as follows:

Private Sub Realize_Click()
Lead1.AnnRealize False
Lead1.ForceRepaint
MsgBox "Annotations are now rendered to the bitmap"
End Sub

7.	Code the LEAD1 control's AnnCreate procedure as follows:

Private Sub Lead1_AnnCreate(ByVal hObject As OLE_HANDLE)
' Update the tag if we need one.
Static NewTag As Integer
If Lead1.AnnGetType(hObject) = ANNOBJECT_BUTTON Or Lead1.AnnGetType(hObject) = ANNOBJECT_HOTSPOT Then
    NewTag = NewTag + 1
    Lead1.AnnSetTag hObject, NewTag
End If

End Sub

8.	Code the LEAD1 control's AnnDrawn procedure as follows:

Private Sub Lead1_AnnDrawn(ByVal hObject As OLE_HANDLE)
Lead1.AnnTool = ANNTOOL_SELECT
MsgBox "Use the right mouse button to modify this object; then click on Run Mode to test it."

End Sub

9.	Code the LEAD1 control's AnnClicked procedure as follows:

Private Sub Lead1_AnnClicked(ByVal hObject As OLE_HANDLE)
    MsgBox "This is what we do for the button tagged " + Str(Lead1.AnnGetTag(hObject))
End Sub

10.	Code the LEAD1 control's AnnDestroy procedure as follows:

Private Sub Lead1_AnnDestroy(ByVal hObject As OLE_HANDLE)
MsgBox "The object tagged " + Str(Lead1.AnnGetTag(hObject)) + " is deleted."
End Sub

11.	Run your program to test it.


Loading and Saving Annotations Using Databases (Visual Basic)

Note: This topic is for Document/Medical  only.

Take the following steps to start a project and to add some code that demonstrates adding annotation objects to or deleting annotation objects from the BLOB field of a database file.

You need to create a database file (DB1.MDB) with the fields listed below, before running this tutorial.

Field Name	Type
Image	OleObject
Size	Number
1.	Start Visual Basic.
2.	Add the LEAD Main Control to your project.
	On the Project pull-down menu, use the Components option, and select the LEAD Main Control  (14).
3.	Add the Microsoft ActiveX Data Object 2.6 Library to your project.
	On the Project pull-down menu, use the References option, and select the Microsoft ActiveX Data Object 2.6 Library.
4.	Select the LEAD Main control; then add the control to your main form. Size and position the control as you want it to appear at run time.
5.	Add six command buttons to your form and name them as follows:
	Name	Caption
	cmdAddRecord	Add Record
	cmdMoveNext	Move Next
	cmdMovePrevious	Move Previous
	cmdDeleteRecord	Delete Record
	cmdConnect	Connect to Database
	cmdDisconnect	Disconnect From Database
6.	Declare the following variables as Global variables:
Dim Recordset As New ADODB.Recordset
Dim Connection As New ADODB.Connection
Dim strConnect As String

7.	Add the following initialization code to the main form's Load procedure.
   LEAD1.UnlockSupport L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT
   LEAD1.Load "c:\parrots.jpg", 0, 0, 1

   LEAD1.AnnUserMode = ANNUSERMODE_DESIGN

   LEAD1.Visible = True
   LEAD1.AnnToolbar.Create 0, 0, ANNTOOLALIGN_TOP
   LEAD1.AnnToolbar.Visible = True

   cmdMoveNext.Enabled = False
   cmdMovePrevious.Enabled = False
   cmdAddRecord.Enabled = False
   cmdDeleteRecord.Enabled = False

   strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\DB1.mdb"

8.	Code the cmdAddRecord button's Click procedure as follows:
   Dim AnnVar As Variant
   Dim ByteArray() As Byte
   Dim i As Integer
   Dim nSize As Integer

   If Connection.State = adStateClosed Then
      MsgBox "Connection closed", vbInformation, "Save error"
      Exit Sub
   End If

   Recordset.AddNew

   LEAD1.AnnSaveArray AnnVar, ANNFMT_NATIVE, False, SAVE_OVERWRITE, 0

   nSize = UBound(AnnVar) - LBound(AnnVar) – 1
   Recordset.Fields("Image").Value = AnnVar
   Recordset.Fields("Size").Value = nSize

   If Not Recordset.BOF Then Recordset.MoveFirst

   Recordset.Update

   If Recordset.RecordCount > 0 Then
    cmdMoveNext.Enabled = True
    cmdMovePrevious.Enabled = True
    cmdDeleteRecord.Enabled = True
   End If

9.	Code the cmdMoveNext button's Click procedure as follows:
   Dim i As Integer
   Dim nSize As Integer
   Dim AnnVar As Variant

   If Not Recordset.EOF Then Recordset.MoveNext

   If (Recordset.EOF) Then
      MsgBox "Unable to get the annotation from the database"
      Recordset.MovePrevious
   Else
      nSize = Recordset.Fields("Size").Value
      AnnVar = Recordset.Fields("Image").Value
      LEAD1.AnnLoadArray AnnVar, nSize, 1
   End If

10.	Code the cmdMovePrevious button's Click procedure as follows:
   Dim AnnVar As Variant
   Dim i As Integer
   Dim nSize As Integer

   If Not Recordset.BOF Then Recordset.MovePrevious

   If (Recordset.BOF) Then
      MsgBox "Unable to get the annotation from the database"
      Recordset.MoveNext
   Else
      nSize = Recordset.Fields("Size").Value
      AnnVar = Recordset.Fields("Image").Value
      LEAD1.AnnLoadArray AnnVar, nSize, 1
   End If

11.	Code the cmdDeleteRecord button's Click procedure as follows:
     If Connection.State = adStateClosed Then
      MsgBox "Connection closed", vbInformation, "Delete error"
      Exit Sub
   End If
   If Not Recordset.BOF Or Not Recordset.EOF Then
      Recordset.MoveLast
      Recordset.Delete
      Recordset.Update

      If Recordset.RecordCount <= 0 Then
         cmdMoveNext.Enabled = False
         cmdMovePrevious.Enabled = False
         cmdDeleteRecord.Enabled = False
      End If
   End If

12.	Code the cmdConnect button's Click procedure as follows:
       If Connection.State = adStateClosed Then
         Connection.Open strConnect
      End If

      If Recordset.State = adStateOpen Then Recordset.Close
      Set Recordset.ActiveConnection = Connection
      Recordset.Open "SELECT * FROM Images", Connection, adOpenKeyset, adLockOptimistic

      If Not Recordset.BOF Then Recordset.MoveFirst

      If Not Recordset.EOF Then
         cmdMoveNext.Enabled = True
         cmdMovePrevious.Enabled = True
         cmdDeleteRecord.Enabled = True
      End If

      cmdAddRecord.Enabled = True

13.	Code the cmdDisconnect button's Click procedure as follows:
      If Connection.State = adStateOpen Then Connection.Close
      If Recordset.State = adStateOpen Then Recordset.Close
      cmdMoveNext.Enabled = False
      cmdMovePrevious.Enabled = False
      cmdAddRecord.Enabled = False
      cmdDeleteRecord.Enabled = False

14.	Run your program to test it.


Using ODBC to Access Image Data (Visual Basic)

This lesson describes how to use the LEADTOOLS ODBC features to maintain images in a table with other data. In this lesson, you accomplish the following:

 Create a database with one table containing images and names for the images.

 Create an ODBC data source that references the table.

 Use a data control to manage the table and to access the names.

 Use the LEADTOOLS methods to access the images through the ODBC data source.

 Use SQL SELECT statements to maintain a sorted view of the records.

 Synchronize the record pointers so that the two views of the same table are always correct.

Note:	In Visual Basic, a simpler alternative is to use the LEAD control as a data-aware control. Refer to Implementing a Database with a Data Control.

Note:	The LEADTOOLS ActiveX requires ODBC drivers that can properly handle long binary fields. Examples have been tested and will work with version 3.0 of the Microsoft ODBC Desktop Driver Pack. (This driver pack ships with Access 95 and works on 32-bit systems.) You can download drivers from the LEAD BBS, the CompuServe forum, or the Worldwide Web home page. The CompuServe forum is at GO LEADTECH. The web page is ftp://ftp.leadtools.com/pub/utils/ODBC32.zip.  The file to download is ODBC32.ZIP.

1.	Start Visual Basic.

2.	On the Add Ins menu, select the Data Manager option (Visual Data Manager in VB5).

3.	Create a new database.

For VB4: On the Select File menu, select the New Database option.

For VB5: On the File menu, select New Database, and specify Microsoft Access 7.

4.	Specify a file name of leadpic.mdb and click the Save button.

5.	Add a table.

For VB4: Click the New button.

For VB5: Use the right mouse button, and select the New Table menu option.

6.	In the Add Table window, specify a table named: people, with the following two fields:

a.	Field name: who. Data Type: text. Size: 255

b.	Field name: photo. Data Type: Long Binary (or Binary). Size: N/A.

7.	Close the Database Manager.

8.	Add a data control to the bottom of your form and change its properties as follows:

a.	Set the DatabaseName property to leadpic.mdb. (Use the browser to get the full path name.)

b.	Set the RecordSource property to the following:

SELECT who FROM people ORDER BY who

c.	Set the Name property to Dpeople.

9.	On the Tools pull-down menu, use the Custom Controls option to add the LEAD OLE Custom Control module to your project.

10.	 Select the LEAD control; then add the control to your main form. Stretch and position the control as you want it to appear at run time.

11.	In the Properties box for the LEAD control, make the following changes:

a.	Set the BorderStyle property to 1. This adds a 1-pixel border to the control.

b.	Set the Name property to Lead1.

12.	Add a TextBox control to your form and change its properties as follows:

a.	Set the DataSource property to Dpeople.

b.	Set the DataField property to who.

c.	Set the Name property to Cwho.

13.	From the Windows Control Panel, create the ODBC data source as follows:

a.	Open the ODBC administrator and click the Add button.

b.	Select Microsoft Access driver and click the OK button.

c.	Enter the name LEADODBC.

d.	Click the Select directory button and select the path to the database that you created.

e.	Click the OK button; click the next OK button; then click the Close button.

14.	In Visual Basic, add the following code to your form's general declarations. In online help, you can use the Edit pull-down menu to copy the block of code.

' The Windows Sleep function lets us synchronize requeries on adds and deletes
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

' These are variables for implementing the dbMove method
Public OldPosition, NewPosition As Long

' This variable lets us make the dbMove method conditional
Public NormalMove As Boolean

15.	Add the following code to the form's Load procedure.

On Error GoTo ERRORHANDLER
    ' Turn off automatic scrolling and repainting
    Lead1.AutoScroll = False
    Lead1.AutoRepaint = False

    ' Open the database.
    ' Use the same SELECT statement that is used for the data control.
    ' Note that the image field must be listed first in the SELECT statement.
    DString = "ODBC;DSN=LEADODBC"
    SelString = "SELECT photo,* FROM people ORDER BY who"
    Lead1.dbOpen DString, SelString, "photo", DB_OPENOPTIONS_NONE

    ' Set the LEAD control's database properties
    Lead1.dbLoadBits = 24
    Lead1.dbLockingMode = DB_LOCKINGMODE_OPTIMISTIC

    ' Enable use of the dbMove method in the data control's Reposition event
    If (Lead1.dbIsBOF And Lead1.dbIsEOF) = False Then
      NormalMove = True
    End If

Exit Sub

ERRORHANDLER:
MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description

16.	Add the following code to the form's Unload procedure.

Lead1.dbClose

17.	Add a CommonDialog control to your form.

18.	Add a CommandButton control to your form, change its Caption property to Add Photo, and add the following code to its Click event:

On Error GoTo ERRORHANDLER
    ' Get an image file
    ' This filter list is complete, except for GIF.
    CommonDialog1.Filter = "Grapics|*.cmp; *.jpg; *.jff; *.jtf; *.bmp; *.tif; *.tga; *.pcx; *.cal; *.mac; *.mac; *.img; *.msp; *.wpg; *.wpg; *.ras; *.pct; *.pcd; *.eps; *.wmf"
    CommonDialog1.Flags = cdlOFNFileMustExist
    CommonDialog1.DialogTitle = "Open File"
    CommonDialog1.CancelError = True
    CommonDialog1.ShowOpen
    Myfile = CommonDialog1.filename

    ' Suspend use of the dbMove method in the data control's Reposition event
    NormalMove = False

    'Set the pointer to an hourglass
    Screen.MousePointer = 11

    ' Hide the LEAD control to avoid unnecessary repaints
    Lead1.Visible = False

    ' Add and update the record, without inserting the image
    Dpeople.Recordset.AddNew
    Cwho = Myfile
    Dpeople.Recordset.Update

    ' Wait for the update to take effect
    Call Sleep(5000)

    ' Requery the data control's recordset
    Dpeople.Recordset.Requery

    ' Requery the LEAD control's recordset and make sure it is
    ' synchronized with the data control.
    Lead1.dbRequery
    NormalMove = True ' Do normal record synchronization
    Dpeople.Recordset.MoveLast
    If Lead1.dbCurrentRecord <> Dpeople.Recordset.AbsolutePosition Then
        MsgBox "Synchronization error!" + Chr(13) + "Delete the record and exit"
        Dpeople.Recordset.FindFirst "who = " + "'" + Myfile + "'"
        Screen.MousePointer = 0
        Exit Sub
    End If

    ' Go to the new record, and show the LEAD control
    Dpeople.Recordset.FindFirst "who = " + "'" + Myfile + "'"
    Lead1.Visible = True

    ' Load the image file and update the recordset
    Lead1.dbEdit
    Lead1.Load Myfile, 0, 0, 1

    ' Update the recordset using the appropriate format
    If Lead1.BitmapBits = 1 Then
        Lead1.dbUpdate FILE_LEAD1BIT, 1, 0
    ElseIf Lead1.BitmapBits = 4 Then
        Lead1.dbUpdate FILE_PCX, 4, 0
    ElseIf Lead1.IsGrayscale = GRAY_NO Then
        Lead1.dbUpdate FILE_CMP, 24, QFACTOR_QMS
    Else 'save as grayscale
        Lead1.dbUpdate FILE_CMP, 8, QFACTOR_QMS
    End If

    'Set the mouse pointer back to the default
    Screen.MousePointer = 0

Exit Sub

ERRORHANDLER:
'Set the mouse pointer back to the default
Screen.MousePointer = 0

If Dpeople.Recordset.EditMode = dbEditAdd Then
    Dpeople.Recordset.CancelUpdate
End If
MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description

19.	Add another CommandButton control to your form, change its Caption property to Delete Photo, and add the following code to its Click event:

On Error GoTo ERRORHANDLER
    ' Disable the normal record synchronization and hide the LEAD control.
    NormalMove = False
    Lead1.Visible = False

    'Set the pointer to an hourglass
    Screen.MousePointer = 11

    ' Save the current position
    RecMarker = Dpeople.Recordset.AbsolutePosition

   ' Delete the record and wait for the deletion to take effect
    Dpeople.Recordset.Delete
    Call Sleep(5000)

    ' Requery the recordsets, move to the last record,
    ' and initialize the NewPosition global variable.
    Dpeople.Recordset.Requery
    Lead1.dbRequery
    Dpeople.Recordset.MoveLast
    NewPosition = Dpeople.Recordset.AbsolutePosition
    Lead1.dbMove NewPosition

    ' Make sure the LEAD control is on the last record.
    Lead1.dbMoveNext
    If Lead1.dbIsEOF Then
        Lead1.dbMovePrev
    Else
        MsgBox "Synchronization error!" + Chr(13) + "Restart the application"
        Exit Sub
    End If

    ' Return to the old record position, if possible.
    NormalMove = True
    Lead1.Visible = True
    RelativePosition = RecMarker - NewPosition
    If RelativePosition < 0 Then
         Dpeople.Recordset.Move RelativePosition
    End If

    'Set the mouse pointer back to the default
    Screen.MousePointer = 0

Exit Sub

ERRORHANDLER:
'Set the mouse pointer back to the default
Screen.MousePointer = 0
MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description

20.	Add another CommandButton control to your form, change its Caption property to Flip Photo, and add the following code to its Click event:

On Error GoTo ERRORHANDLER
    ' Flip the image and update the record
    Lead1.Flip
    Lead1.dbEdit

    ' Update the recordset using the appropriate format
    If Lead1.BitmapBits = 1 Then
        Lead1.dbUpdate FILE_LEAD1BIT, 1, 0
    ElseIf Lead1.BitmapBits = 4 Then
        Lead1.dbUpdate FILE_PCX, 4, 0
    ElseIf Lead1.IsGrayscale = GRAY_NO Then
        Lead1.dbUpdate FILE_CMP, 24, QFACTOR_QMS
    Else 'save as grayscale
        Lead1.dbUpdate FILE_CMP, 8, QFACTOR_QMS
    End If

Exit Sub

ERRORHANDLER:
If Dpeople.Recordset.EditMode = dbEditInProgress Then
    Dpeople.Recordset.CancelUpdate
End If
MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description

21.	Add the following code to the Lead1 control's Change event:

' Avoid processing events that occur before the bitmap is fully loaded
If Lead1.Bitmap = 0 Then Exit Sub

' Calculate the display rectangle to fit the image inside the control
HeightAllowed = Lead1.ScaleHeight
WidthAllowed = Lead1.ScaleWidth

If (HeightAllowed * Lead1.BitmapWidth / Lead1.BitmapHeight) <= WidthAllowed Then
    DisplayTop = 0
    DisplayHeight = HeightAllowed
    DisplayWidth = DisplayHeight * Lead1.BitmapWidth / Lead1.BitmapHeight
    DisplayLeft = (Lead1.ScaleWidth - DisplayWidth) / 2
Else
    DisplayLeft = 0
    DisplayWidth = WidthAllowed
    DisplayHeight = DisplayWidth * Lead1.BitmapHeight / Lead1.BitmapWidth
    DisplayTop = (Lead1.ScaleHeight - DisplayHeight) / 2
End If

'Set the image display size
Lead1.SetDstRect DisplayLeft, DisplayTop, DisplayWidth, DisplayHeight
Lead1.SetDstClipRect DisplayLeft, DisplayTop, DisplayWidth, DisplayHeight
Lead1.ForceRepaint

22.	Add the following code to the Dpeople control's Validate event:

' Set the OldPosition, which is used in a calculation in the Reposition event
OldPosition = Dpeople.Recordset.AbsolutePosition

23.	Add the following code to the Dpeople control's Reposition event:

' Use the dbMove method to move the LEAD control to the current record
If NormalMove Then
    ' The current position is the NewPosition
    ' The OldPosition is set in the Validate event
    NewPosition = Dpeople.Recordset.AbsolutePosition
    Lead1.dbMove NewPosition - OldPosition
End If

24.	Run your program to test it.


Implementing a Database with a Data Control (Visual Basic)

In Visual Basic, the LEAD control is a data bound control. This means you can associate the LEAD control with a data control so that the LEAD control's bitmap is bound to a specified field in the data control's recordset.

Take the following steps to start a project and to add some code that associates the LEAD control with a data control:

1.	Start Visual Basic.

2.	On the Add Ins menu, select the Data Manager option.

3.	On the Data Manager window's Select File menu, select the New Database option.

4.	Specify a file name of leadpic.mdb and click the Save button.

5.	In the Database Manager window, click the New button.

6.	In the Add Table window, specify a table named: people, with the following two fields:

a.	Field name: who. Data Type: text. Size: 255

b.	Field name: photo. Data Type: Long Binary. Size: N/A.

7.	Close the Database Manager

8.	Add a data control to the bottom of your form and change its properties as follows:

a.	Set the DatabaseName property to leadpic.mdb. (Use the browser to get the full path name.)

b.	Set the RecordSource property to people.

c.	Set the Name property to Dpeople.

9.	On the Tools pull-down menu, use the Custom Controls option to add the LEAD OLE Custom Control module to your project.

10.	 Select the LEAD control; then add the control to your main form. Stretch and position the control as you want it to appear at run time.

11.	In the Properties box for the LEAD control, make the following changes:

a.	Set the DataSource property to Dpeople.

b.	Set the DataFieldproperty to photo.

c.	Set the Name property to Lead1.

12.	Add a TextBox control to your form and change its properties as follows:

a.	Set the DataSource property to Dpeople.

b.	Set the DataField property to who.

c.	Set the Name property to Cwho.

13.	 Add three command buttons to your form and name them as follows:

Name	Caption

AddPhoto	Add Photo

DeletePhoto	Delete Photo

FlipPhoto	Flip Photo

14.	 Add a CommonDialog control to your form.

15.	Add the following code to the form's Load procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

'These are all persistent properties that can be set in the properties box.
Lead1.Appearance = APPEARANCE_FLAT
Lead1.BorderStyle = 1
Lead1.BackColor = RGB(255, 255, 125)
Lead1.PaintDither = PAINTDITHER_DIFFUSION
Lead1.PaintPalette = PAINTPALETTE_AUTO
Lead1.AutoRepaint = True
Lead1.AutoSize = False
Lead1.AutoSetRects = True
Lead1.PaintSizeMode = PAINTSIZEMODE_FIT
Lead1.DataLoadBits = 0

16.	Code the AddPhoto button's Click event as follows:

On Error GoTo ERRORHANDLER
  CommonDialog1.Filter = "Grapics|*.cmp;*.jpg;*.jff;*.jtf;*.bmp;*.tif;*.tga;*.pcx;*.cal;*.mac;*.mac;*.img;*.msp;*.wpg;*.wpg;*.ras;*.pct;*.pcd;*.eps;*.wmf"
  CommonDialog1.Flags = cdlOFNFileMustExist
  CommonDialog1.DialogTitle = "Open File"
  CommonDialog1.CancelError = True
  CommonDialog1.ShowOpen
  MyFile = CommonDialog1.filename
  Dpeople.Recordset.AddNew
  Lead1.Load MyFile, 0, 0, 1
  Cwho = MyFile

  ' Specify the appropriate properties for saving the image in the database
  If Lead1.BitmapBits = 1 Then
    Lead1.DataSaveBits = 1
    Lead1.DataSaveFormat = FILE_LEAD1BIT
  ElseIf Lead1.BitmapBits = 4 Then
    Lead1.DataSaveBits = 4
    Lead1.DataSaveFormat = FILE_PCX
  ElseIf Lead1.IsGrayscale = GRAY_NO Then
    Lead1.DataSaveBits = 24
    Lead1.DataSaveFormat = FILE_CMP
    Lead1.DataSaveQuality = QFACTOR_QMS
  Else 'save as grayscale
    Lead1.DataSaveBits = 8
    Lead1.DataSaveFormat = FILE_CMP
    Lead1.DataSaveQuality = QFACTOR_QMS
  End If

  ' Force an update
  Dpeople.Recordset.MoveLast
Exit Sub

ERRORHANDLER:
If Dpeople.Recordset.EditMode = dbEditAdd Then
    Dpeople.Recordset.CancelUpdate
End If
MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description

17.	Code the DeletePhoto button's Click event as follows:

Dpeople.Recordset.Delete
Dpeople.Recordset.MoveFirst

18.	Code the FlipPhoto button's Click event as follows:

Lead1.Flip

19.	Add the following code to the Lead1 control's Change event:

' Avoid processing events that occur before the bitmap is fully loaded
If Lead1.Bitmap = 0 Then Exit Sub
' Demonstrate how the DataChanged property works
If Lead1.DataChanged And Dpeople.Recordset.EditMode <> dbEditAdd Then
        MsgBox "You flipped the photo"
End If

20.	Run your program to test it.


Implementing a Database with the MS ADO Data Control (Visual Basic)

In Visual Basic, the LEADTOOLS OLEDB control is a OLEDB data bound control. This means you can associate the LEADTOOLS OLEDB control with an ADO data control so that the LEADTOOLS OLEDB control's bitmap is bound to a specified field in the data control's recordset.

Take the following steps to start a project and to add some code that associates the LEADTOOLS OLEDB control with an ADO data control:

1.	Start Visual Basic.

2.	On the Add-Ins menu, select the Visual Data Manager option.

3.	On the Data Manager window's Select File menu, select the New Database option.

4.	Specify a file name of leadpic.mdb and click the Save button.

5.	In the Database Manager window, click the New button.

6.	In the Add Table window, specify a table named: people, with the following two fields:

a.	Field name: who. Data Type: text. Size: 255

b.	Field name: photo. Data Type: Long Binary. Size: N/A.

7.	Close the Database Manager

8.	On the Project pull-down menu, use the Components option to add the MS ADO data control to your project.  Then add an ADO control to the bottom of your form and change its properties as follows:

a.	Set the ConnectionString property to connect to leadpic.mdb. (Use the browser to properly build the connection string using the OLEDB ODBC Provider.)

b.	Set the RecordSource by setting the CommandType to adCommandTable and the table to the "people" table.

c.	Set the Name property to Dpeople.

9.	On the Project pull-down menu, use the Components option to add the LEAD Main Control Control module to your project.

10.	Select the LEAD control; then add the control to your main form. Stretch and position the control as you want it to appear at run time.

11.	On the Project pull-down menu, use the Components option to add the LEADTOOLS OLE DB Custom Control module to your project.  Select the LEADTOOLS OLEDB control; then add the control to your main form.

12.	In the Properties box for the LEADTOOLS OLEDB control, make the following changes:

a.	Set the DataSource property to Dpeople.

b.	Leave the DataMember property empty, in order to use the default for this data source.

13.	Add a TextBox control to your form and change its properties as follows:

a.	Set the DataSource property to Dpeople.

b.	Set the Name property to Cwho.

14.	Add three command buttons to your form and name them as follows:

Name	Caption

AddPhoto	Add Photo

DeletePhoto	Delete Photo

FlipPhoto	Flip Photo

15.	On the Project pull-down menu, use the Components option to add the LEAD Common Dialog Control module to your project.

16.	Add a LEAD CommonDialog Control to your form.

17.	Add the following code to the form's Load procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

'These are all persistent properties that can be set in the properties box.
LEAD1.Appearance = APPEARANCE_FLAT
LEAD1.BorderStyle = 1
LEAD1.BackColor = RGB(255, 255, 125)
LEAD1.PaintDither = PAINTDITHER_DIFFUSION
LEAD1.PaintPalette = PAINTPALETTE_AUTO
LEAD1.AutoRepaint = True
LEAD1.AutoSize = False
LEAD1.AutoSetRects = True
LEAD1.PaintSizeMode = PAINTSIZEMODE_FIT

'databind performed at run-time
Dpeople.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=LEADACCESS"
Dpeople.RecordSource = "SELECT * FROM people ORDER BY who"
LEADOLEDB1.DataField = "photo"
Cwho.DataField = "who"

' Set the data properties on the LEAD OLE DB control
LEADOLEDB1.DataLoadBits = 0
LEADOLEDB1.DataSaveBits = 24
LEADOLEDB1.DataSaveFormat = FILE_LEAD
LEADOLEDB1.DataSaveQuality = QFACTOR_QMS
LEADOLEDB1.EnableMethodErrors = True

18.	Code the AddPhoto button's Click event as follows:

    Dim Myfile$
    Const BUFFERSIZE = 1024
    Dim buffer(BUFFERSIZE - 1) As Byte
    Dim VarBuffer As Variant

On Error GoTo ERRORHANDLER
    'release any reference
    LEADOLEDB1.Bitmap = 0
    LEADDlg1.Filter = ""
    LEADDlg1.FileDlgFlags = 0 'cdlOFNFileMustExist
    LEADDlg1.DialogTitle = "Open File"
    LEADDlg1.UIFlags = DLG_FO_FILEINFO + DLG_FO_SHOWPREVIEW + DLG_FO_SHOWSTAMP

    LEADDlg1.FileOpen hWnd
    Myfile = LEADDlg1.FileName
    If Myfile = "" Then Exit Sub

    ' Hide the Lead control while we update the recordset
    LEAD1.Visible = False
    Dpeople.Recordset.AddNew
    LEADOLEDB1.DataDirty = True
    Cwho = Myfile
    Dpeople.Recordset.Update

    Open Myfile For Binary Access Read As #1
    Do
        Get #1, , buffer
        Dpeople.Recordset!photo.AppendChunk buffer
    Loop Until EOF(1)

    Close #1

    LEAD1.StartFeedLoad 0, 1, 1
    Do
        VarBuffer = Dpeople.Recordset!photo.GetChunk(BUFFERSIZE)
        If VarType(VarBuffer) <> vbNull Then
            LEAD1.FeedLoad VarBuffer, BUFFERSIZE
        End If
    Loop Until VarType(VarBuffer) = vbNull

    LEAD1.StopFeedLoad

    ' Requery the data control's recordset
    ' Go to the new record, and show the LEAD control
    LEAD1.Visible = True
    Dpeople.Recordset.Find "who = " + "'" + Myfile + "'"

Exit Sub

ERRORHANDLER:
If Dpeople.Recordset.EditMode = dbEditAdd Then
    LEAD1.Visible = True
    Dpeople.Recordset.CancelUpdate
End If
If (Err.Number <> ERROR_DLG_CANCELED) Then
   MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description
End If

19.	Code the DeletePhoto button's Click event as follows:

Dpeople.Recordset.Delete
Dpeople.Recordset.MoveFirst

20.	Code the FlipPhoto button's Click event as follows:

LEAD1.Flip
LEADOLEDB1.Bitmap = 0
LEADOLEDB1.Bitmap = LEAD1.Bitmap
LEADOLEDB1.DataDirty = True

21.	Add the following code to the LEADOLEDB1 control's DataLoaded event:

If (nStatus = 0) Then
    Lead1.RefBitmap = True 'don't make a copy
    Lead1.Bitmap = LEADOLEDB1.Bitmap 'send the image to the LEAD OCX
    Lead1.RefBitmap = False 'reset
ElseIf (nStatus = ERROR_FILENOTFOUND) Then 'if it's an empty record
    Lead1.Bitmap = 0
ElseIf (nStatus <> ERROR_FILENOTFOUND) Then 'if it's not an empty record
    Lead1.Bitmap = 0
    MsgBox "Error loading from database!"
End If
Lead1.ForceRepaint
LEADOLEDB1.DataDirty = False

22.	Add the following code to the LEADOLEDB1 control's DataSaved event:

LEADOLEDB1.Bitmap = 0 'free the current reference
Lead1.Bitmap = 0 'free the current bitmap
If (nStatus <> 0) Then
    Lead1.ForceRepaint
    MsgBox "Error saving to database!"
End If

23.	Add the L_OCXERR.BAS module to the application. It can be found in the LEAD\INCLUDE folder.

24.	Run your program to test it.


Printing Multiple Images (Visual Basic)

Take the following steps to add code that prints two images on one page. This code shows you how to control the size and position of images on the page.

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

2.	 Select the CommandButton control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

3.	In the Properties box, change the CommandButton control's Caption property to Print Twice on One Page.

4.	Add the following code to the CommandButton control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Notice that LEAD measures the printing surface in pixels, while Visual Basic uses twips. The measurements must be converted before using them together.

Private Sub Command3_Click()
    'Declare the variable for printed text
    Dim Msg As String

    'Declare the variables for pixel measurements
    Dim TextHeightInPixels
    Dim UsableWidth
    Dim UsableHeight
    Dim MaxImageHeight

    'Declare the variables for sizing and positioning the image
    Dim PrintLeft As Long
    Dim PrintTop As Long
    Dim PrintHeight As Long
    Dim PrintWidth As Long

    'Declare variables used for preserving aspect ratios
    Dim WidthFactor
    Dim HeightFactor

    'Set the variables used for preserving the aspect ratio
    HeightFactor = Lead1.BitmapHeight
    WidthFactor = Lead1.BitmapWidth

    'Set the pointer to an hourglass
    Screen.MousePointer = 11

    'Get the page width and height in pixels (dots)
    UsableWidth = Printer.Width / Printer.TwipsPerPixelX
    UsableHeight = Printer.Height / Printer.TwipsPerPixelY

    'Print a title at the top of the page
    Msg = "This is a print example using LEADTOOLS ActiveX."
    Printer.Print Msg

    'Get the maximum height of one image,
    'assuming two equal-size images and space for 12 lines of text
    TextHeightInPixels = TextHeight(Msg) / Printer.TwipsPerPixelY
    MaxImageHeight = (UsableHeight - (12 * TextHeightInPixels)) / 2

    'Size and position the first image, preserving the aspect ratio.
    'Check to see if using the maximum width will make the image too tall.
    'Set the dimensions based on the result.
    If ((UsableWidth * HeightFactor) / WidthFactor) < MaxImageHeight Then
        PrintLeft = 1
        PrintTop = Printer.CurrentY / Printer.TwipsPerPixelX
        PrintWidth = UsableWidth
        PrintHeight = (PrintWidth * HeightFactor) / WidthFactor
    Else
        PrintLeft = 1
        PrintTop = Printer.CurrentY / Printer.TwipsPerPixelX
        PrintHeight = MaxImageHeight
        PrintWidth = (PrintHeight * WidthFactor) / HeightFactor
    End If

    'Print the first image
    Lead1.Render Printer.hDC, PrintLeft, PrintTop, PrintWidth, PrintHeight

    'Update the current printing position
    Printer.CurrentY = Printer.CurrentY + (PrintHeight * Printer.TwipsPerPixelY)

    'Print a blank line, then print a caption for the next picture
    Msg = " "
    Printer.Print Msg
    Msg = "This is the second picture, which is modified before printing:"
    Printer.Print Msg

    'Stretch the intensity of the bitmap for the second printing
    'to show the difference between the second picture and the first
    Lead1.StretchIntensity

    'Size and position the second image, preserving the aspect ratio.
    'The coding is the same as for the first image.
    If ((UsableWidth * HeightFactor) / WidthFactor) < MaxImageHeight Then
        PrintLeft = 1 'This is for flush left. Use 0 for centering.
        PrintTop = Printer.CurrentY / Printer.TwipsPerPixelX
        PrintWidth = UsableWidth
        PrintHeight = (PrintWidth * HeightFactor) / WidthFactor
    Else
        PrintLeft = 1 'This is for flush left. Use 0 for centering.
        PrintTop = Printer.CurrentY / Printer.TwipsPerPixelX
        PrintHeight = MaxImageHeight
        PrintWidth = (PrintHeight * WidthFactor) / HeightFactor
    End If

    'Print the second image
    Lead1.Render Printer.hDC, PrintLeft, PrintTop, PrintWidth, PrintHeight

    'Finish the page and finish the print job
    Printer.NewPage
    Printer.EndDoc

    'Set the mouse pointer back to the default
    Screen.MousePointer = 0

End Sub

5.	Run your program to test it.


Writing and Reading Multipage Files (Visual Basic)

Take the following steps to create a multipage file, then load and display the images from the file. Only TIFF (MPT) and PCX (DCX) formats support multipage files.

1.	Start Visual Basic.

2.	On the Tools pull-down menu, use the Custom Controls option to add the LEAD Main Control module to your project.

3.	 Select the LEAD control; then add two controls to your main form. The size and position does not matter.

4.	Add the following code to the main form's Load procedure. In online help, you can use the Edit pull-down menu to copy the block of code. This code loads two bitmaps, saves them both into a single multipage TIFF file, loads them again from the TIFF file, and displays them side-by-side.

Private Sub Form_Load()
  'Disable automatic repainting of the image.
  Lead1.AutoRepaint = False
  Lead2.AutoRepaint = False

  'Turn off scroll bars to make sure we use the full client area.
  Lead1.AutoScroll = False
  Lead2.AutoScroll = False

  'Position and size the main form so that it takes up most of the screen.
  Width = Screen.Width  * 0.9
  Height = Screen.Height* 0.8
  Left = (Screen.Width - Width) / 2
  TOP = (Screen.Height - Height) / 2

  'Display the form and set the mouse pointer to an hourglass.
  Show
  Screen.MousePointer = 11

  'Load the bitmaps. These hard-coded path names may be different on your system.
  Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1
  Lead2.Load "c:\lead\images\image2.cmp", 0, 0, 1

  'Save the bitmaps to a single multipage TIFF file
  Lead1.Save "c:\lead\images\combined.mpt", FILE_TIF, 24, 0, SAVE_OVERWRITE
  Lead2.Save "c:\lead\images\combined.mpt", FILE_TIF, 24, 0, SAVE_APPEND

  'Get information about the images so that we can size the controls.
  Lead1.GetFileInfo "c:\lead\images\combined.mpt", 1, 0
  Lead2.GetFileInfo "c:\lead\images\combined.mpt", 2, 0

  'Clear the bitmaps from memory
  Lead1.Bitmap = 0
  Lead2.Bitmap = 0

  'Make the controls visible so that we can size and position them.
  'They will not really appear until we load an image and paint it.
  Lead1.Visible = True
  Lead2.Visible = True

  'Set the variables used for preserving the aspect ratio.
  HeightFactor1 = Lead1.InfoHeight
  WidthFactor1 = Lead1.InfoWidth
  HeightFactor2 = Lead2.InfoHeight
  WidthFactor2 = Lead2.InfoWidth
  HeightAllowed = ScaleHeight * 0.8
  WidthAllowed = ScaleWidth * 0.45

  'Center each LEAD control on half of the form, preserving the aspect ratio.
  'Check to see if using the maximum width will make the image too tall.
  'Set the dimensions based on the result.
  If (WidthAllowed * HeightFactor1) / WidthFactor1 < HeightAllowed Then
    Lead1.Left =  (ScaleWidth / 4) - (WidthAllowed / 2)
    Lead1.Width = WidthAllowed
    Lead1.Height = (Lead1.Width * HeightFactor1) / WidthFactor1
    Lead1.Top = (ScaleHeight - Lead1.Height) / 2
  Else
    Lead1.Top = (ScaleHeight - HeightAllowed) / 2
    Lead1.Height = HeightAllowed
    Lead1.Width = (Lead1.Height * WidthFactor1) / HeightFactor1
    Lead1.Left = (ScaleWidth / 4) - (Lead1.Width / 2)
  End If
  If (WidthAllowed * HeightFactor2) / WidthFactor2 < HeightAllowed Then
    Lead2.Left =  (ScaleWidth * 3/4) - (WidthAllowed / 2)
    Lead2.Width = WidthAllowed
    Lead2.Height = (Lead2.Width * HeightFactor2) / WidthFactor2
    Lead2.Top = (ScaleHeight - Lead2.Height) / 2
  Else
    Lead2.Top = (ScaleHeight - HeightAllowed) / 2
    Lead2.Height = HeightAllowed
    Lead2.Width = (Lead2.Height * WidthFactor2) / HeightFactor2
    Lead2.Left = (ScaleWidth * 3 / 4) - (Lead2.Width / 2)
  End If

  'Load the bitmaps from the multipage TIFF file
  Lead1.Load "c:\lead\images\combined.mpt", 24, 1, 1
  Lead2.Load "c:\lead\images\combined.mpt", 24, 2, 1

  'Set the image display sizes to match the LEAD controls
  ImageWidth1 = Lead1.ScaleWidth
  ImageHeight1 = Lead1.ScaleHeight

  Lead1.SetDstRect 0, 0, ImageWidth1, ImageHeight1
  Lead1.SetDstClipRect 0, 0, ImageWidth1, ImageHeight1

  'Set the image display sizes to match the LEAD controls
  ImageWidth2= Lead2.ScaleWidth
  ImageHeight2= Lead2.ScaleHeight

  Lead2.SetDstRect 0, 0, ImageWidth2, ImageHeight2
  Lead2.SetDstClipRect 0, 0, ImageWidth2, ImageHeight2

  'Display the images
  Lead1.ForceRepaint
  Lead2.ForceRepaint

  'Set the mouse pointer back to the default
  Screen.MousePointer = 0

End Sub

5.	Run your program to test it.


Using Transparent Controls (Visual Basic)

Take the following steps to add transparent controls, with special effects. The transparent controls are added as child controls so that they will scroll with the parent image.

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

2.	Add two LEAD controls, which you will set to be transparent at run time. (At design time, you can make the controls easier to see by setting the BackColor property of each control to a different color.) Add the controls as follows:

a.	Add a control named Lead2 as a child control to Lead1. In other words, draw it inside the Lead1 control.

b.	Add a control named Lead3 as a child control to Lead2. In other words, draw it inside the Lead2 control.

3.	Add a command button and code its click event as follows:

Private Sub Command1_Click()
   Dim TestText As String
   Dim TextWidth As Single
   Dim TextHeight As Single

   Lead1.EnableMethodErrors = False
   Lead1.AutoRepaint = False
   Lead2.AutoRepaint = False
   Lead3.AutoRepaint = False

   'Make Lead2 and Lead3 transparent.
   Lead2.Transparent = True
   Lead3.Transparent = True

   'Give each control a different effect.
   Lead1.PaintEffect = EFX_EFFECT_WIPE_RECTANGLE_OUT
   Lead2.PaintEffect = EFX_EFFECT_WIPE_RECTANGLE_IN
   Lead3.PaintEffect = EFX_EFFECT_WIPE4_R_B_L_B

   Lead1.EffectDelay = 20
   Lead2.EffectDelay = 20
   Lead3.EffectDelay = 20
   Lead1.EffectGrain = 1
   Lead2.EffectGrain = 5
   Lead3.EffectGrain = 1

   ScaleMode = 1
   Lead1.ScaleMode = 1
   Lead2.ScaleMode = 1

   'Position Lead2 and Lead3 inside Lead1.
   Lead2.Width = Lead1.Width / 2
   Lead2.Height = Lead1.Height / 2
   Lead2.Top = (Lead1.Width - Lead2.Width) / 2
   Lead2.Left = (Lead1.Height - Lead2.Height) / 2

   Lead3.Top = 0
   Lead3.Left = 0
   Lead3.Width = Lead2.Width
   Lead3.Height = Lead2.Height

   'We will be drawing into the bitmaps.
   Lead2.DrawPersistence = True
   Lead3.DrawPersistence = True

   'First, we need some bitmaps.
   Lead2.ScaleMode = 3
   Lead3.ScaleMode = 3
   Lead2.CreateBitmap Lead2.ScaleWidth, Lead3.ScaleHeight, 24
   Lead3.CreateBitmap Lead3.ScaleWidth, Lead3.ScaleHeight, 24

   'Fill them with black, which we will make transparent.
   Lead2.Fill RGB(0, 0, 0)
   Lead3.Fill RGB(0, 0, 0)
   Lead2.BitmapEnableTransparency = True
   Lead3.BitmapEnableTransparency = True
   Lead2.BitmapTransparentColor = RGB(0, 0, 0)
   Lead3.BitmapTransparentColor = RGB(0, 0, 0)

   'Draw a shape into Lead2.
   'Shape background
   Lead2.ShapeBackgroundStyle = EFX_BACKSTYLE_TRANSLUCENT

   'Shape location
   Lead2.ShapeTop = 0
   Lead2.ShapeLeft = 0
   Lead2.ShapeWidth = Lead2.BitmapWidth
   Lead2.ShapeHeight = Lead2.BitmapHeight

   'Shape border
   Lead2.ShapeBorderColor = RGB(255, 0, 0)
   Lead2.ShapeBorderStyle = EFX_BORDERSTYLE_SOLID
   Lead2.ShapeBorderThickness = 5

   Lead2.PatternStyle = EFX_PATTERN_TRANSPARENT

   'Draw the shape
   Lead2.DrawShape EFX_SHAPE_STAR4, 0

   'Draw text into Lead3.
   'Specify the text, font, and styles.
   TestText = "Text"
   Lead3.Font.Name = "Arial"
   Lead3.Font.Size = 40
   Lead3.TextAngle = 450
   Lead3.DrawFontColor = RGB(0, 0, 255) 'Blue
   Lead3.TextStyle = EFX_TEXTSTYLE_NORMAL
   Lead3.TextAlign = EFX_TEXTALIGN_HCENTER_VCENTER

   'Set the location for the text.
   Lead3.TextTop = 0
   Lead3.TextLeft = 0
   Lead3.TextWidth = Lead3.BitmapWidth
   Lead3.TextHeight = Lead3.BitmapHeight

   'Set the properties for drawing a rectangle behind the text..
   Lead3.DrawPenStyle = DRAWPENSTYLE_SOLID
   Lead3.DrawPenColor = RGB(255, 255, 0)
   Lead3.DrawMode = DRAWMODE_COPY_PEN

   'Draw the rectangle, then draw the text.
   Lead3.DrawRectangle 0, 0, Lead3.BitmapWidth, Lead3.BitmapHeight
   Lead3.DrawText TestText, 0

'Load an image into Lead1.
   Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1
   Lead1.PaintSizeMode = PAINTSIZEMODE_ZOOM
   Lead1.PaintZoomFactor = 150
   Lead1.ForceRepaint

   'Turn off the effects.
   Lead1.PaintEffect = EFX_EFFECT_NONE
   Lead2.PaintEffect = EFX_EFFECT_NONE
   Lead3.PaintEffect = EFX_EFFECT_NONE
End Sub

4.	Run your program to test it.


Drawing Simple Lines and Shapes (Visual Basic)

Take the following steps to add code that lets you draw a line, rectangle and ellipse on the bitmap.

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:

Dim DrawObject As Integer 'The object we are drawing
Dim StartX As Single 'Starting X position
Dim StartY As Single 'Starting Y position
Dim EndX As Single 'Ending X position
Dim EndY As Single 'Ending Y position

3.	Code the LEAD control's MouseDown event as follows. This code selects a different drawing object each time the event occurs.

Private Sub Lead1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

'Temp. Disable scrolling
Lead1.EnableKeyboard = False
Lead1.EnableScroll = False
'Use the same scale mode as the mouse.
Lead1.ScaleMode = 1

'Save the starting position.
StartX = X
StartY = Y
EndX = X
EndY = Y

'Cycle through the types of drawing objects.
Select Case DrawObject
Case 0
  DrawObject = 1 'Line
Case 1
  DrawObject = 2 'Rectangle
Case 2
  DrawObject = 0 'Ellipse
Case Else
  DrawObject = 0
End Select

End Sub

4.	Code the LEAD control's MouseMove event as follows. This code uses DRAWMODE_INVERT for the DrawMode, which means that pixel colors are inverted. Thus, the drawing methods can erase the previous object and draw a new one.

Private Sub Lead1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

'Declare local variables.
Dim OldEndX, OldEndY
Dim OldDrawX, OldDrawY, OldWidth, OldHeight
Dim DrawX, DrawY, NewWidth, NewHeight

If Button = 1 Then
  'Set the drawing styles.
  Lead1.DrawPenStyle = DRAWPENSTYLE_SOLID
  Lead1.DrawMode = DRAWMODE_INVERT
  Lead1.DrawFillStyle = DRAWFILLSTYLE_TRANSPARENT
  Lead1.DrawPersistence = False 'On the window, not the bitmap

  'Save the previous ending mouse position.
  OldEndX = EndX
  OldEndY = EndY

  'Get the current mouse position.
  EndX = X
  EndY = Y

  'Calculate the origin of the current object.
  If EndX > StartX Then
      DrawX = StartX
  Else
      DrawX = EndX
  End If
  If EndY > StartY Then
      DrawY = StartY
  Else
      DrawY = EndY
  End If

  'Calculate the origin of the previous object.
  If OldEndX > StartX Then
      OldDrawX = StartX
  Else
      OldDrawX = OldEndX
  End If
  If OldEndY > StartY Then
      OldDrawY = StartY
  Else
      OldDrawY = OldEndY
  End If

  'Calculate the height and width of the current object.
  NewHeight = Abs(StartY - EndY)
  NewWidth = Abs(StartX - EndX)

  'Calculate the height and width of the previous object.
  OldHeight = Abs(StartY - OldEndY)
  OldWidth = Abs(StartX - OldEndX)

  'Erase the old object and draw the new one.
  Select Case DrawObject
  Case 0 'Ellipse
    Lead1.DrawEllipse OldDrawX, OldDrawY, OldWidth, OldHeight
    Lead1.DrawEllipse DrawX, DrawY, NewWidth, NewHeight
  Case 1 'Line
    Lead1.DrawLine StartX, StartY, OldEndX, OldEndY
    Lead1.DrawLine StartX, StartY, EndX, EndY
  Case 2 'Rectangle
    Lead1.DrawRectangle OldDrawX, OldDrawY, OldWidth, OldHeight
    Lead1.Drawrectangle DrawX, DrawY, NewWidth, NewHeight
  Case Else
  End Select

End If

End Sub

5.	Code the LEAD control's MouseUp event as follows. This code sets the drawing style and draws the object on the bitmap.

Private Sub Lead1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

'Declare local variables.
Dim DrawX, DrawY, NewWidth, NewHeight

'Restore scrolling
Lead1.EnableKeyboard = True
Lead1.EnableScroll = True
'Set the drawing style.
Lead1.DrawPenStyle = DRAWPENSTYLE_SOLID
Lead1.DrawPenWidth = 2
Lead1.DrawPenColor = RGB(255, 0, 0) 'Red
Lead1.DrawMode = DRAWMODE_COPY_PEN
Lead1.DrawFillColor = RGB(0, 255, 0) 'Green
Lead1.DrawFillStyle = DRAWFILLSTYLE_HORIZONTAL_LINE
Lead1.DrawPersistence = True 'On the bitmap

'Get the current mouse position
EndX = X
EndY = Y

'Determine the origin of the object.
If EndX > StartX Then
  DrawX = StartX
Else
  DrawX = EndX
End If
If EndY > StartY Then
  DrawY = StartY
Else
  DrawY = EndY
End If

'Determine the height and width of the object.
NewHeight = Abs(StartY - EndY)
NewWidth = Abs(StartX - EndX)

'Draw the object
Select Case DrawObject
Case 0 'Ellipse
  Lead1.DrawEllipse DrawX, DrawY, NewWidth, NewHeight
Case 1 'Line
  Lead1.DrawLine StartX, StartY, EndX, EndY
Case 2 'Rectangle
  Lead1.DrawRectangle DrawX, DrawY, NewWidth, NewHeight
Case Else
End Select

End Sub

6.	Run your program to test it.


Cropping a Displayed Image and Copying It to a Bitmap (Visual Basic)
Cropping a Bitmap (Visual Basic)

Take the following steps to add code that lets you select an area with a mouse, crop the display to show only that area, and trim the bitmap to match the selected area. (This example uses both cropping and trimming, so that you can see the difference.)

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:

Dim Cropping 'The state when the mouse is used for cropping
Dim StartX As Integer 'Starting X position in screen pixels
Dim StartY As Integer 'Starting Y position in screen pixels
Dim EndX As Integer 'Ending X position in screen pixels
Dim EndY As Integer 'Ending Y position in screen pixels

3.	 Select the CommandButton control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

4.	In the Properties box, change the CommandButton control's Caption property to Select Rectangle.

5.	Add the following code to the CommandButton control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub Command4_Click()

    'Set the scale mode to twips so that we do not have to
    'translate mouse coordinates
    Lead1.ScaleMode = 1

    'Initialize cropping so that you can do it more than once
    If Cropping = True Then
        'Set the clipping area to match the image.
        Lead1.SetDstClipRect Lead1.DstLeft, Lead1.DstTop, Lead1.DstWidth, Lead1.DstHeight

        'Display the image
        Lead1.ForceRepaint
    End If

    'Set a global variable to let other events know that you are cropping
    Cropping = True

    'Set the pointer to a crosshair
    Lead1.MousePointer = 2

End Sub

6.	In the LEAD1 control's MouseDown procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub Lead1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

    'Save the starting position
    StartX = X
    StartY = Y

    'Make the rubberband invisible until the mouse moves
    Lead1.RubberBandVisible = False

End Sub

7.	In the LEAD1 control's MouseMove procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub Lead1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Cropping = True And Button = 1 Then

    'Get the current mouse position
    EndX = X
    EndY = Y

    'Determine the origin of the rubberband rectangle, regardless of which way the mouse moves.
    If EndX > StartX Then
        rbX = StartX
    Else
        rbX = EndX
    End If
    If EndY > StartY Then
        rbY = StartY
    Else
        rbY = EndY
    End If

    'Determine the height and width of the rubberband rectangle
    rbHeight = Abs(StartY - EndY)
    rbWidth = Abs(StartX - EndX)

    'Set the rubberband rectangle
    Lead1.SetRubberBandRect rbX, rbY, rbWidth, rbHeight

        'Alternatively, you could use the following properties to set the
        'rubberband rectangle.
        'Lead1.RubberBandHeight = rbHeight
        'Lead1.RubberBandLeft = rbX
        'Lead1.RubberBandTop = rbY
        'Lead1.RubberBandWidth = rbWidth

    'Make the rubberband rectangle visible
    Lead1.RubberBandVisible = True
End If

End Sub

8.	In the LEAD1 control's MouseUp procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub Lead1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Cropping = True Then

    'Get the current mouse position
    EndX = X
    EndY = Y

    'Get the origin of the clipping rectangle.
    'Allow for different mouse drag directions
    If StartX < EndX Then
        CropLeft = StartX
    Else
       CropLeft = EndX
    End If
    If StartY < EndY Then
        CropTop = StartY
    Else
       CropTop = EndY
    End If

    'Get the height and width of the cropped area
    CropWidth = Abs(EndX - StartX)
    CropHeight = Abs(EndY - StartY)

    'Crop and repaint the image
    Lead1.SetDstClipRect CropLeft, CropTop, CropWidth, CropHeight
    Lead1.ForceRepaint
    Lead1.RubberBandVisible = False
    Lead1.MousePointer = 0 'Default
End If

End Sub

9.	 Select the CommandButton control; then add another control to your main form. Put the control at the top of the form to keep it away from the image.

10.	In the Properties box, change the CommandButton control's Caption property to Trim. This command button will be used to trim the bitmap in memory and redisplay the bitmap.

11.	Add the following code to the CommandButton control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub Command5_Click()

    Screen.MousePointer = 11 'hourglass

    'Use the clipping rectangle's percentage offsets in the image rectangle
    'to determine the trimmed rectangle in the bitmap.
    'Using percentages allows for the possibility that the image is zoomed.
    XFactor = Lead1.BitmapWidth / Lead1.DstWidth
    YFactor = Lead1.BitmapHeight / Lead1.DstHeight
    NewTop = (Lead1.DstClipTop - Lead1.DstTop) * YFactor
    NewLeft = (Lead1.DstClipLeft - Lead1.DstLeft) * XFactor
    NewWidth = Lead1.DstClipWidth * XFactor
    NewHeight = Lead1.DstClipHeight * YFactor

    'Make sure display rectangles are automatically adjusted.
    Lead1.AutoSetRects = True

    'Trim the bitmap.
    Lead1.Trim NewLeft, NewTop, NewWidth, NewHeight

    'Size and redisplay the control, using the new bitmap size.
    'Set the variables used for preserving the aspect ratio.
    'Allow for a border of 1/8 of the form size.
    'The units of measure do not matter, since we are calculating proportions.
    HeightFactor = Lead1.BitmapHeight
    WidthFactor = Lead1.BitmapWidth
    HeightAllowed = ScaleHeight - (ScaleHeight / 4)
    WidthAllowed = ScaleWidth - (ScaleWidth / 4)

    'Center the LEAD control on the form, preserving the aspect ratio.
    'Check to see if using the maximum width will make the image too tall.
    'Set the dimensions based on the result.
    If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
      Lead1.Left = ScaleWidth / 8
      Lead1.Width = WidthAllowed
      Lead1.Height = (Lead1.Width * HeightFactor) / WidthFactor
      Lead1.TOP = (ScaleHeight - Lead1.Height) / 2
    Else
      Lead1.TOP = ScaleHeight / 8
      Lead1.Height = HeightAllowed
      Lead1.Width = (Lead1.Height * WidthFactor) / HeightFactor
      Lead1.Left = (ScaleWidth - Lead1.Width) / 2
    End If

    'Turn off scroll bars to make sure we use the full client area.
    Lead1.AutoScroll = False

    'Set the image display size to match the LEAD control
    Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
    Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight

    'Display the image
    Lead1.ForceRepaint
    Screen.MousePointer = 0 'Default

End Sub

12.	Run your program to test it.


Creating, Viewing, and Merging Color Separations (Visual Basic)

Take the following steps to add code that creates CMYK color separations, displays each of the color planes, merges the planes, and displays the result. The code increases the contrast of the K plane to demonstrate how you can manipulate the color separations.

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

2.	 Select the CommandButton control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

3.	In the Properties box, change the CommandButton control's Caption property to Do Separations.

4.	Add the following code to the CommandButton control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Sub Command6_Click ()

' Count the button clicks and take the next step with each click
Static ClickCount As Integer
MousePointer = 11 ' hourglass
'Turn off the automatic display rectangles.
Lead1.AutoSetRects = False

Select Case ClickCount
Case 0
    Lead1.ColorSeparate COLORSEP_CMYK

    'Just for fun, add contrast to the K plane
    Lead1.Bitmap = Lead1.ColorPlanes(3) 'Copy the K plane
    Lead1.Contrast 300 'Increase the contrast
    Lead1.ColorPlanes(3) = Lead1.Bitmap 'Update the K plane

    Msg = "Separated. Keep clicking to see separations, then merge"
    MsgBox Msg
Case 1
    Lead1.Bitmap = Lead1.ColorPlanes(0) 'Cyan
    Lead1.ForceRepaint
Case 2
    Lead1.Bitmap = Lead1.ColorPlanes(1) ' Magenta
    Lead1.ForceRepaint
Case 3
    Lead1.Bitmap = Lead1.ColorPlanes(2) ' Yellow
    Lead1.ForceRepaint
Case 4
    Lead1.Bitmap = Lead1.ColorPlanes(3) ' K
    Lead1.ForceRepaint
Case 5
    Lead1.ColorMerge COLORSEP_CMYK
    Lead1.ForceRepaint
    Lead1.ColorPlanes(0) = 0
    Lead1.ColorPlanes(1) = 0
    Lead1.ColorPlanes(2) = 0
    Lead1.ColorPlanes(3) = 0
    Msg = "Merged, with more contrast in the K plane"
    MsgBox Msg
Case Else
    ClickCount = -1
    Msg = "Cycle is finished"
    MsgBox Msg
End Select

ClickCount = ClickCount + 1
MousePointer = 0 ' default

End Sub

5.	Run your program to test it. Notice that you can click the button several times to create the separations, view each of them, and merge them to recreate the original bitmap.


Updating a Gauge and Detecting a User Interrupt (Visual Basic)

Take the following steps to update a gauge during processing and detect a user interrupt:

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

2.	 Select the CommandButton control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

3.	In the Properties box, change the CommandButton control's Caption property to Do Median.

4.	 Select the CommandButton control; then add another control to your main form. Put the control at the top of the form to keep it away from the image.

5.	In the Properties box, change the CommandButton control's Caption property to Quit.

6.	Build a gauge consisting of a horizontal line [image] (Line1) inside a rectangle [image] (Shape1). Put the gauge at the top of the form next to the Quit button.

7.	Add the following code to the general declarations:

Dim fEscape As Integer 'Use to indicate the user interrupt
Dim fInProc As Integer 'Use to avoid closing the form during processing

8.	Add the following code to the first CommandButton control's Click procedure:

Private Sub Command1_Click ()
    'Enable the ProgressStatus event
    Lead1.EnableProgressEvent = True

    'Initialize the indicators
    fEscape = False 'The user does not want to quit
    fInProc = True 'Processing is taking place

    'Perform a relatively slow median filter
    Lead1.Median 4

    'Clean up
    fInProc = False 'Processing is no longer taking place
    Lead1.ForceRepaint
End Sub

9.	Add the following code to the Lead1 control's ProgressStatus procedure:

Private Sub Lead1_ProgressStatus(ByVal iPercent As Integer)
    DoEvents 'Detect Windows events
    If Not fEscape Then ' Look for the Click on the Quit button
      LineLength = Form1.Shape1.Width * iPercent / 100 'Udpate the gauge
      Me.Line1.X1 = Me.Shape1.Left
      Me.Line1.X2 = Me.Line1.X1 + LineLength
    Else
      Lead1.EnableProgressEvent = False 'Cancel the task
    End If
End Sub

10.	Add the following code to the second CommandButton control's Click procedure:

Private Sub Command2_Click ()
  fEscape = True 'The user wants to quit
  Me.Line1.X2 = Me.Line1.X1 'Set the gauge back to the beginning
End Sub

11.	Add the following code to the main form's QueryUnload procedure:

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  If fInProc Then 'If processing is taking place
    Cancel = 1 'Do not let the user close the form
  End If
End Sub

12.	12.	Run your program to test it.


Using the Magnifying Glass (Visual Basic)

Take the following steps to enable the generation of the MagGlass event and updating the zoomed image using the Inet toolkit methods.

1.	Start Visual Basic.

2.	Add the LEAD Control and LEAD Internet Control to your project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD OLE Custom Control (14) then select the LEAD Internet Control (14).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Main Control (14) then select the LEAD Internet Control (14).

3.	Select the LEAD Main control; then add the control to your main form. Size and position the control as you want it to appear at run time.

4.	Select the LEAD Internet Control; then add the control to your main form.

5.	Add seven command buttons to your main form and name them as follows:

Name	Caption

StartUpServer	Start Up Server

ShutDownServer	Shut Down Server

ConnectToRemoteServer	Connect To Remote Server

DisconnectFromRemoteServer	Disconnect From Remote Server

LoadRemoteImage	Load Remote Image

StartMagnifyingGlass	Start Magnifying Glass

StopMagnifyingGlass	Stop Magnifying Glass

6.	Add a Text box to your main form and name it as follows:

Name

RemoteComputer.

Set the Text property to the name of the computer you will use as a server, or set it to 10.0.32.241.

7.	Define the following global variables:

Dim hServer As Integer ' handle to server
Dim gnCommandID As Long
Dim bMagGlass As Boolean

8.	Add the following initialization code to the main form's Load procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub Form_Load()
    ' Initialize some variables
    hServer = 0
    gnCommandID = 0
    bMagGlass = False

    'Set defaults for displaying the image.
    'These are all persistent properties that can be set in the properties box.
    LEAD1.Appearance = APPEARANCE_FLAT
    LEAD1.BorderStyle = 1
    LEAD1.BackColor = RGB(255, 255, 125)
    LEAD1.PaintDither = PAINTDITHER_DIFFUSION
    LEAD1.PaintPalette = PAINTPALETTE_AUTO
    LEAD1.AutoRepaint = True
    LEAD1.AutoSize = False
    LEAD1.AutoSetRects = True
    LEAD1.PaintSizeMode = PAINTSIZEMODE_FIT

    ' Unlock the Internet features.  Note that TestKey is a sample key and will not work in your toolkit.
    LEADNet1.UnlockSupport L_SUPPORT_INTERNET, "TestKey"

    'Stop runtime exceptions generation for LEAD Main and LEAD Internet Controls.
    LEAD1.EnableMethodErrors = False
    LEADNet1.EnableMethodErrors = False
End Sub

9.	Code the main form's Form_Unload procedure as follows:

Private Sub Form_Unload(Cancel As Integer)
    Dim i As Integer
    Dim num As Integer

    ' Disconnect all connections
    num = LEADNet1.ConnectListNum
    For i = 0 To LEADNet1.ConnectListNum - 1
        LEADNet1.InetDisconnect LEADNet1.ConnectList(i)
    Next i

    If bMagGlass Then
        LEAD1.StopMagGlass
    End If
End Sub

10.	Code the StartUpServer button's click procedure as follows:

Private Sub StartUpServer_Click()
    Dim nRet As Integer

    ' Initialize server on port 1000
    nRet = LEADNet1.InetServerInit(hServer, 1000)

    If nRet <> 0 Then
        MsgBox "Error Initializing server: " + CStr(nRet)
    End If
End Sub

11.	Code the ShutDownServer button's click procedure as follows:

Private Sub ShutDownServer_Click()
    Dim nRet As Integer

    If hServer <> 0 Then
        nRet = LEADNet1.InetServerClose(hServer)

        If nRet <> 0 Then
            MsgBox "Error Shutting Down server: " + CStr(nRet)
        Else
            hServer = 0
        End If
    End If
End Sub

12.	Code the LEADNet1_InetAccept event as follows:

Private Sub LEADNet1_InetAccept(ByVal iServer As Integer)
    Dim hComputer As Integer
    Dim hName As String

    nRet = LEADNet1.InetAcceptConnect(hServer, hComputer)

    If nRet <> 0 Then
        MsgBox "Error accepting connection: " + CStr(nRet)
        Exit Sub
    End If

    LEADNet1.InetGetHostName hComputer, HOST_NAME_DESCRP, hName
    ' Add to our list
    LEADNet1.SendList(LEADNet1.SendListNum) = hComputer
    MsgBox "Connection accepted from: " + hName
End Sub

13.	Code the ConnectToRemoteServer button's click procedure as follows:

Private Sub ConnectToRemoteServer_Click()
    Dim nRet As Integer

    ' Connect to remote computer on port 1000
    nRet = LEADNet1.InetConnect(RemoteComputer.Text, 1000)

    If nRet <> 0 Then
        MsgBox "Error connecting to " + RemoteComputer.Text + ": " + CStr(nRet)
    End If
End Sub

14.	Code the DisconnectFromRemoteServer button's click procedure as follows:

Private Sub DisconnectFromRemoteServer_Click()
    Dim nRet As Integer

    ' We are assuming only one connection in this example.
    ' Therefore, the handle to the remote computer will be
    ' in the first position in the SendList
    nRet = LEADNet1.InetDisconnect(LEADNet1.SendList(0))

    If nRet <> 0 Then
        MsgBox "Error disconnecting from remote: " + CStr(nRet)
    End If
End Sub

15.	Code the LEADNet1_InetConnected event as follows:

Private Sub LEADNet1_InetConnected(ByVal iComputer As Integer)
    Dim sRemote As String

    ' Get remote host name
    LEADNet1.InetGetHostName iComputer, HOST_NAME_DESCRP, sRemote

    ' Add this connection to our SendList
    LEADNet1.SendList(LEADNet1.SendListNum) = iComputer
    MsgBox "Successfully connected to remote computer: " + sRemote
End Sub

16.	Code the LEADNet1_InetDisconnected event as follows:

Private Sub LEADNet1_InetDisconnected(ByVal iComputer As Integer)
    If hServer = 0 Then
        MsgBox "Disconnect from remote server"
    Else
        MsgBox "Connection to remote computer closed"
    End If
End Sub

17.	Code the LoadRemoteImage button's click procedure as follows:

Private Sub LoadRemoteImage_Click()
    Dim nRet As Integer

    nRet = LEADNet1.InetSendLoadCmd(999, "v:\images\eagle.cmp", 0, 1)

    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then
        MsgBox "ERROR " & CStr(nRet) & " calling InetSendLoadCmd."
    End If
End Sub

18.	Code the StartMagnifyingGlass button's click procedure as follows:

Private Sub StartMagnifyingGlass_Click()
    Dim nRet As Integer

    If LEAD1.Bitmap <> 0 And hServer = 0 Then
        ' Enable MagGlass event.
        If LEAD1.EnableMagGlassEvent = False Then
            LEAD1.EnableMagGlassEvent = True
        End If

        LEAD1.RgnFrameType = 0

        ' Start the Magnifying Glass
        nRet = LEAD1.StartMagGlass(100, 100, 400, RGB(255, 0, 0), RGB(128, 128, 128), True, 1, False, CROSSHAIR_FINE, True, True)

        If nRet = 0 Then
            bMagGlass = True
        End If
    End If
End Sub

19.	Code the StopMagnifyingGlass button's click procedure as follows:

Private Sub StopMagnifyingGlass_Click()
    Dim nRet As Integer

    If LEAD1.Bitmap <> 0 And hServer = 0 Then
        nRet = LEAD1.StopMagGlass

        If nRet = 0 Then
            bMagGlass = False
        End If
    End If
End Sub

20.	Code the LEAD1_MagGlass event as follows:

Private Sub LEAD1_MagGlass(ByVal nMaskPlaneStart As Long, ByVal nMaskPlaneEnd As Long, ByVal vMaskPlane As Variant)
    Dim nRet As Integer

    gnCommandID = gnCommandID + 1

    nRet = LEADNet1.InetSendGetMagGlassDataCmd(gnCommandID, 0, CVar(vMaskPlane), nMaskPlaneStart, nMaskPlaneEnd)

    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then
        MsgBox "ERROR " & CStr(nRet) & " calling InetSendGetMagGlassDataCmd."
    End If
End Sub

21.	Code the LEADNet1_InetReceiveCmd event as follows:

    Dim nStatus As Integer
    Dim vColorBuffer As Variant

    nStatus = ERROR_FEATURE_NOT_SUPPORTED

    If (nError <> 0) Then
        nStatus = ERROR_TRANSFER_ABORTED
    Else
        Select Case InetCommand
            Case INETCMD_LOAD
                ' check the validity of the parameters
                If ((Params.ParamCount = 4) And (Params.ParamType(0) = PARAM_TYPE_STRING) And (Params.ParamType(1) = PARAM_TYPE_INT32) And (Params.ParamType(2) = PARAM_TYPE_INT32) And (Params.ParamType(3) = PARAM_TYPE_UINT32)) Then
                    nStatus = LEAD1.Load(Params.ParamValue(0), Params.ParamValue(1), 1, 1)

                    If nStatus <> 0 Then
                        MsgBox "Load Bitmap failed with error code: " & CStr(nRet)
                    Else
                        nStatus = LEADNet1.InetSendBitmap(LEAD1.Bitmap, FILE_CMP, 0, QFACTOR_PQ2)

                        If nStatus <> 0 Then
                            MsgBox "SendBitmap failed with error code: " & CStr(nRet)
                        End If
                    End If
                Else
                    nStatus = ERROR_INV_PARAMETER    ' Invalid parameters
                End If

                LEADNet1.InetSendLoadRsp nCommandID, 0, 0, Null, nStatus
                Exit Sub

            Case INETCMD_GET_MAGGLASS_DATA
                ' check the validity of the parameters
                If ((Params.ParamCount = 5) And (Params.ParamType(0) = PARAM_TYPE_UINT32) _
                    And (Params.ParamType(1) = PARAM_TYPE_UINT32) And (Params.ParamType(2) = PARAM_TYPE_USTRING) _
                    And (Params.ParamType(3) = PARAM_TYPE_INT32) And (Params.ParamType(4) = PARAM_TYPE_INT32)) Then
                    If LEAD1.Bitmap <> 0 Then
                        nStatus = LEADNet1.InetGetMagGlassData(LEAD1.Bitmap, vColorBuffer, CVar(Params.ParamValue(2)), Params.ParamValue(3), Params.ParamValue(4))

                        If nStatus <> 0 Then
                            MsgBox "InetGetMagGlassData failed with error code: " & CStr(nStatus)
                        End If
                    Else
                        nStatus = ERROR_INV_PARAMETER   ' Invalid parameter
                    End If
                Else
                    nStatus = ERROR_INV_PARAMETER    ' Invalid parameters
                End If

                LEADNet1.InetSendGetMagGlassDataRsp nCommandID, CVar(vColorBuffer), CVar(Params.ParamValue(2)), Params.ParamValue(3), Params.ParamValue(4), 0, Null, nStatus
                Exit Sub
        End Select
    End If

    LEADNet1.InetSendRsp InetCommand, nCommandID, Nothing, 0, Null, nStatus
End Sub

22.	Code the LEADNet1_InetReceiveRsp event as follows:

Private Sub LEADNet1_InetReceiveRsp(ByVal iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As Long, ByVal nError As Integer, ByVal nStatus As Integer, ByVal Params As LEADNetLibCtl.ILTInetPacket, ByVal nExtraDataSize As Long, ByVal ExtraData As Variant)
    Dim nRet As Integer

    If (nError <> 0) Then Exit Sub

    Select Case InetCommand
        Case INETCMD_LOAD:
            If nStatus <> 0 Then
               MsgBox "Load failed with error code: " + CStr(nStatus)
            End If

        Case INETCMD_GET_MAGGLASS_DATA
            If (nStatus = 0) Then
                If ((Params.ParamCount = 6) And (Params.ParamType(0) = PARAM_TYPE_UINT32) _
                    And (Params.ParamType(1) = PARAM_TYPE_USTRING) And (Params.ParamType(2) = PARAM_TYPE_UINT32) _
                    And (Params.ParamType(3) = PARAM_TYPE_USTRING) And (Params.ParamType(4) = PARAM_TYPE_INT32)) _
                    And (Params.ParamType(5) = PARAM_TYPE_INT32) Then

                    nRet = LEAD1.UpdateMagGlass(CVar(Params.ParamValue(1)), CVar(Params.ParamValue(3)), Params.ParamValue(4), Params.ParamValue(5), True)

                    If (nRet <> 0) Then
                        MsgBox "UpdateMagGlass failed with error code: " & CStr(nRet)
                    End If
                Else
                    MsgBox "Invalid parameter passed to INETCMD_GET_MAGGLASS_DATA response"
                End If
            Else
                MsgBox "Get MagGlass Data from server with error code " & CStr(nStatus)
            End If
    End Select
End Sub

23.	Code the LEADNet1_InetReceiveBitmap event as follows:

Private Sub LEADNet1_InetReceiveBitmap(ByVal iComputer As Integer, ByVal hBitmap As Long)

    LEAD1.Bitmap = hBitmap

End Sub

24.	On the main menu, select File > Make .exe, specify a path for the exe file then press OK.

25.	Run the exe file two times to execute two applications.

26.	In the first application press Start Up Server button.

27.	In the second application fill the edit box with the IP address of the remote computer on which you started the first application as the server. Then, press the Connect To Remote Server button to connect to the specified address.

28.	Press the Load Remote Image button of the second application to load an image on the server. Then press the Start Magnifying Glass button to start the Magnifying Glass with Internet support. Press the left mouse button and move over the image to see the zoomed area using the Magnifying Glass with Internet support.


Using a PanWindow (Visual Basic)

1.	Start Visual Basic.  Select Standard EXE and click Open.

2. 	Add the LEAD Main Control to your project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD Main Control (14).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Main Control (14).

3. 	Select the LEAD Main Control and add the control to your main form.  Size and position the control as you want it to appear at run time.  You may want to size it small so you can observe the changes that occur as you move the PanWin rect

4.	Add an Option Button to the form and set the Name and Caption properties as follows:

Name	Caption

Check1	Pan Window

5.	Add a Command Button to the form and set the Name and Caption properties as follows:

Name	Caption

PanWindow	Show Pan Window

6. 	Code the Form_Load procedure as follows:

Private Sub Form_Load()

'change the path and filename to something present on your system.
   LEAD1.Load "v:\images\eagle.cmp", 0, 0, 1
End Sub

7.	Code the PanWindow_Click() procedure as follows:

Private Sub PanWindow_Click()
With LEAD1
       'set the location of the PanWindow
      .PanWinX = 100
      .PanWinY = 100
       'set the size of the PanWindow
       'requested width
      .PanWinWidth = 150
       'requested height
      .PanWinHeight = 200
       'use the icon already being used for LEAD1.
      .PanWinIcon = Icon
       'set custom pointer
      .PanWinPointer = 99
       'use an ICO file present on your system
      .PanWinCursor = LoadPicture("d:\temp\snow.ico")
      .PanWinTitle = "PanWindow"
      .PanWinRectColor = RGB(0, 0, 255)
      .PanWinSysMenu = True
       'use the settings for LEAD1.
      .PanWinPaintPalette = .PaintPalette
      .PanWinBitonalScaling = .BitonalScaling
      .PanWinPaintScaling = .PaintScaling
      .PanWinPaintDither = .PaintDither
       'show the Pan Window
      .ShowPanWin True
   End With
Check1.Value = 1

End Sub

8. 	Code the LEAD1_PanWin procedure as follows:

Private Sub LEAD1_PanWin(ByVal hPanWin As Stdole.OLE_HANDLE, ByVal iFlag As Integer)
    If (iFlag = PANWIN_DESTROYED) Then
        Check1.Value = False 'indicate no more Pan Window
    End If
End Sub.

9.	Run your program to test it.


Print a Real Image Size in Inches (Visual Basic)

Take the following steps to start a project and to add some code that prints an image:

1.	Start Visual Basic.

2.	Add the LEAD Control to your project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD OLE Custom Control (14).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Main Control (14).

3.	 Select the LEAD control; then add the control to your main form. Size and position the control as you want it to appear at run time.

4.	Add the following variables to the main form's Load procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Dim fRealWidth As Double ' Image's real width in inches
Dim fRealHeight As Double ' Image's real height in inches
Dim fPrnDPIX As Double ' Number of pixels per logical inch along the screen width
Dim fPrnDPIY As Double ' Number of pixels per logical inch along the screen height
Dim hdc As Long

5.	Add the following code to the main form's Load procedure to load the image:

LEAD1.Load "c:\image1.cmp", 0, 0, 1

6.	Calculate the real width and height of the bitmap in inches. Add the following code to the main form's Load procedure:

fRealWidth = LEAD1.BitmapWidth / LEAD1.BitmapXRes
fRealHeight = LEAD1.BitmapHeight / LEAD1.BitmapYRes

7.	Now you are ready to print the image using its real size in inches. Add the following code to the main form's Load procedure:

hdc = LEAD1.PrintStart

LEAD1.Render hdc, 1, 1, Printer.PrintQuality * fRealWidth, Printer.PrintQuality * fRealHeight

LEAD1.PrintEnd (hdc)

8.	Run your program to test it.


Combining Images with Regions (Visual Basic)

Take the following steps to start a project and to add some code that combines two images with a region:

1.	Start Visual Basic.

2.	Add the LEAD Control to your project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD OLE Custom Control (14).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Main Control (14).

3.	 Select the LEAD control; then add the control to your main form. Size and position the control as you want it to appear at run time.

4.	 Select the LEAD control; then add the control to your main form. Size and position the control as you want it to appear at run time.

5.	Select the second LEAD control, and pull-down the View menu and select Properties Window.

6.	Make sure the Visible property is set to FALSE.

7	Add the following code to the main form's Load procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

   LEAD1.Load "c:\sample1.cmp", 0, 0, 1
   LEAD2.Load "c:\sample2.cmp", 0, 0, 1

   LEAD1.SetRgnRect 100, 100, 300, 300, L_RGN_SET
   LEAD1.Combine 100, 100, 300, 300, LEAD2.Bitmap, 0, 0, CB_OP_ADD + CB_DST_0

   LEAD1.FreeRgn

8	Run your program to test it.


Miscellaneous Examples (Visual Basic)

You can test any of the following examples by adding a command button to one of the previous lessons in the tutorial, and pasting the sample code in the Click procedure.

In most cases, you can add the button after the first lesson Loading and Displaying an Image. In cases where you need to zoom in or zoom out, you must first finish Zooming Out and Zooming In. In cases where you need to use the Imaging Common Dialog Control, you must first finish Using Imaging Common Dialog.

AboutBox example for Visual Basic

AddBitmaps example for Visual Basic

AddBorder example for Visual Basic

AddFrame example for Visual Basic

AddNoise example for Visual Basic

AlphaBlend example for Visual Basic

Animate Event example for Visual Basic

AnimationEnable example for Visual Basic

AnimationPause example for Visual Basic

AnnAutoDialogFontSize example for Visual Basic

AnnAutoDrawEnable example for Visual Basic

AnnAutomation Property example for Visual Basic

AnnAutoMenuEnable example for Visual Basic

AnnAutoResize example for Visual Basic

AnnAutoRotate example for Visual Basic

AnnBoundingRect... example for Visual Basic

AnnChange Event example for Visual Basic

AnnContainer (OLE DB Control) example for Visual Basic

AnnDataPath example for Visual Basic

AnnDeletePage example for Visual Basic

AnnDeletePageArray example for Visual Basic

AnnDeletePageMemory example for Visual Basic

AnnDestroy example for Visual Basic

AnnEnumerate example for Visual Basic

AnnGetContainer example for Visual Basic

AnnGetGrouping example for Visual Basic

AnnGetNameOffsetX example for Visual Basic

AnnGetNameRestrict example for Visual Basic

AnnGetProtractorOptions example for Visual Basic

AnnHitTest example for Visual Basic

AnnGetHyperlinkParam example for Visual Basic

AnnGetHyperlinkString example for Visual Basic

AnnGetHyperlinkType example for Visual Basic

AnnGetObjectFromTag example for Visual Basic

AnnGetPoint... example for Visual Basic

AnnGetRgnHandle example for Visual Basic

AnnGetScalarX example for Visual Basic

AnnGetSelectList example for Visual Basic

AnnGroup example for Visual Basic

AnnHyperlinkMenuEnable example for Visual Basic

AnnInsert example for Visual Basic

AnnLoadArray example for Visual Basic

AnnLock example for Visual Basic

AnnLocked example for Visual Basic

AnnMenu example for Visual Basic

AnnMouseDown example for Visual Basic

AnnMove example for Visual Basic

AnnNameBoundingRectLeft example for Visual Basic

AnnNameRectLeft example for Visual Basic

Annotation Colors example for Visual Basic

AnnRectLeft example for Visual Basic

AnnRotate example for Visual Basic

AnnSaveArray example for Visual Basic

AnnSaveMemory example for Visual Basic

AnnSaveOffset example for Visual Basic

AnnSaveTag example for Visual Basic

AnnSelect example for Visual Basic

AnnSelectRect example for Visual Basic

AnnSetAutoMenuItemEnable example for Visual Basic

AnnSetAutoText example for Visual Basic

AnnSetGrouping example for Visual Basic

AnnSetHyperlinkMsg example for Visual Basic

AnnSetMetafile example for Visual Basic

AnnSetPolyFillMode example for Visual Basic

AnnSetROP2 example for Visual Basic

AnnSetSecondaryBitmap example for Visual Basic

AnnSetUnit example for Visual Basic

AnnSetUser example for Visual Basic

AnnSetWnd example for Visual Basic

AnnShowLockedIcon example for Visual Basic

AnnToolChecked example for Visual Basic

AnnToolDestroy example for Visual Basic

AnnUndo example for Visual Basic

AnnUndoDepth example for Visual Basic

AnnUndoEnable example for Visual Basic

AnnUngroup example for Visual Basic

AnnUnlock example for Visual Basic

AnnUnlocked example for Visual Basic

AnnUnrealize example for Visual Basic

AntiAlias example for Visual Basic

Appearance (ImageList Control) example for Visual Basic

Appearance example for Visual Basic

AutoAnimate example for Visual Basic

AutoPan example for Visual Basic

AutoSegment (Mixed Raster Content Control) example for Visual Basic

AutoSize example for Visual Basic

AutoTrim example for Visual Basic

Average example for Visual Basic

BackColor (ImageList Control) example for Visual Basic

BackColor example for Visual Basic

BackErase example for Visual Basic

BalanceColors example for Visual Basic

BinaryFilter example for Visual Basic

BitmapAlpha example for Visual Basic

BitmapCompression example for Visual Basic

BitmapDataPath example for Visual Basic

BitmapDataPathClosed example for Visual Basic

BitmapDpi example for Visual Basic

BitmapToClient example for Visual Basic

BitmapXres and BitmapYres example for Visual Basic

BitonalScaling (ImageList Control) example for Visual Basic

BitonalScaling example for Visual Basic

BorderColor (ImageList Control) example for Visual Basic

BorderRemove example for Visual Basic

BorderStyle example for Visual Basic

BrowseDir (Thumbnail Browser Control) example for Visual Basic

ButtonColumns example for Visual Basic

ButtonMenuTool example for Visual Basic

ButtonRows example for Visual Basic

ButtonVisible example for Visual Basic

Capture example for Visual Basic

CenterImage example for Visual Basic

Change example for Visual Basic

Clear (ImageList Control) example for Visual Basic

Click and MouseIcon example for Visual Basic

ClientToBitmap example for Visual Basic

ColorRes example for Visual Basic

ColorResList example for Visual Basic

Combine example for Visual Basic

CombineBitmapWarp example for Visual Basic

CombineExt example for Visual Basic

Comment example for Visual Basic

ContinueBrowse (Thumbnail Browser Control) example for Visual Basic

ContourFilter example for Visual Basic

Contrast example for Visual Basic

ConvertToColoredGray example for Visual Basic

Create Bitmap, Size, and Combine example for Visual Basic

Create example for Visual Basic

CreateUserBitmap example for Visual Basic

CreateThumbnailFromFile example for Visual Basic

CurveToBezier example for Visual Basic

dbCan... example for Visual Basic

DblClick (ImageList Control) example for Visual Basic

DblClick example for Visual Basic

DDB example for Visual Basic

DeleteBitmapListItems example for Visual Basic

DeletePage example for Visual Basic

Deskew example for Visual Basic

Deskew example for Visual Basic

Despeckle example for Visual Basic

DIB example for Visual Basic

DocCleanBitmap example for Visual Basic

DocCleanSuccess example for Visual Basic

DoubleBuffer example for Visual Basic

DrawShape example for Visual Basic

DrawText example for Visual Basic

Dst... example for Visual Basic

EdgeDetector example for Visual Basic

Emboss example for Visual Basic

EnableFastRender example for Visual Basic

EnableKeyboard (ImageList Control) example for Visual Basic

EnableMethodErrors (ImageList Control) example for Visual Basic

EnableMethodErrors example for Visual Basic

EnableMethodErrors (Thumbnail Browser Control) example for Visual Basic

EnablePaint example for Visual Basic

EnableZoomInRect example for Visual Basic

EnumSegments (Mixed Raster Content Control) example for Visual Basic

Exif example for Visual Basic

FastRotate example for Visual Basic

FeatherAlphaBlend example for Visual Basic

FeedLoad example for Visual Basic

FileOpen example for Visual Basic

FilePage Event example for Visual Basic

FilePageLoaded example for Visual Basic

Fill example for Visual Basic

Flip example for Visual Basic

FloaterDstClip... example for Visual Basic

Font (ImageList Control) example for Visual Basic

Font example for Visual Basic

ForeColor (ImageList Control) example for Visual Basic

Frame... example for Visual Basic

GammaCorrect example for Visual Basic

GaussianFilter example for Visual Basic

GetBitmapClipSegments example for Visual Basic

GetBitmapDC example for Visual Basic

GetColorCount example for Visual Basic

GetDIB example for Visual Basic

GetFileInfo example for Visual Basic

GetFloaterHandle example for Visual Basic

GetFunctionalLookupTable example for Visual Basic

GetHistogram example for Visual Basic

GetHistogramGray example for Visual Basic

GetMinMaxBits example for Visual Basic

GetMinMaxVal example for Visual Basic

GetPicture and SetPicture example for Visual Basic

GetRgnHandle example for Visual Basic

GetServerBitmap example for Visual Basic

GetUserLookupTable example for Visual Basic

Grayscale example for Visual Basic

GrayscaleExt example for Visual Basic

Halftone example for Visual Basic

HasMagGlass example for Visual Basic

HistoContrast example for Visual Basic

HistoEqualize example for Visual Basic

HistogramTableSize example for Visual Basic

HScrollInfo example for Visual Basic

HSV_HfromRGB example for Visual Basic

HTableL example for Visual Basic

Hue example for Visual Basic

hDocCleanRgn example for Visual Basic

hWnd (AnnToolbar) example for Visual Basic

IgnoreFilters example for Visual Basic

InfoBits (Thumbnail Browser Control) example for Visual Basic

InfoHasAlpha example for Visual Basic

InfoLayers example for Visual Basic

InfoViewPerspective example for Visual Basic

Insert (ImageList Control) example for Visual Basic

InsertAt (ImageList Control) example for Visual Basic

InsertBitmapListItem example for Visual Basic

InsertFromBitmapList (ImageList Control) example for Visual Basic

Intensity example for Visual Basic

IntensityDetect example for Visual Basic

Invert example for Visual Basic

InvertedText example for Visual Basic

ISISAcquire example for Visual Basic

ISISAcquireMulti example for Visual Basic

ISISGetASCIITag example for Visual Basic

ISISGetASCIITagChoiceCount example for Visual Basic

ISISGetTagChoiceCount example for Visual Basic

IsISISAvailable example for Visual Basic

ISISSelect example for Visual Basic

ISISSetScanOptions example for Visual Basic

IsSigned example for Visual Basic

IsSupportLocked (ISIS Control) example for Visual Basic

IsSupportLocked (OLE DB Control) example for Visual Basic

Item (ImageList Control) example for Visual Basic

ItemBackgroundColor (ImageList Control) example for Visual Basic

ItemSelected (ImageList Control) example for Visual Basic

ItemUnSelected example for Visual Basic

ItemWidth (ImageList Control) example for Visual Basic

J2KCompressionControl example for Visual Basic

J2KCompressionRatio example for Visual Basic

J2KROIControl Example for Visual Basic

J2KSetDefaults example for Visual Basic

J2KTargetFileSize example for Visual Basic

KeyDown (ImageList Control) example for Visual Basic

KeyPress (ImageList Control) example for Visual Basic

KeyPress example for Visual Basic

KeyUp (ImageList Control) example for Visual Basic

LevelLowBit example for Visual Basic

LevelHighBit example for Visual Basic

LevelLUT example for Visual Basic

LevelLUTLength example for Visual Basic

LineProfile example for Visual Basic

LineRemove example for Visual Basic

Load (Mixed Raster Content Control) example for Visual Basic

LoadArray example for Visual Basic

LoadCompressed example for Visual Basic

LoadDatabase example for Visual Basic

LoadFromFile (ImageList Control) example for Visual Basic

LoadIFD example for Visual Basic

LoadInfo... example for Visual Basic

LoadICCProfile example for Visual Basic

LoadMemory example for Visual Basic

LoadResize example for Visual Basic

LoadUseViewPerspective example for Visual Basic

MagGlassPaintContrast example for Visual Basic

MaxFilter example for Visual Basic

MaxVal example for Visual Basic

Median example for Visual Basic

MinFilter example for Visual Basic

MinVal example for Visual Basic

Mosaic example for Visual Basic

MotionBlur example for Visual Basic

MouseDown (ImageList Control) example for Visual Basic

MouseMove (ImageList Control) example for Visual Basic

MousePointer (ImageList Control) example for Visual Basic

MouseWheel (Main Control) example for Visual Basic

ODBC example for Visual Basic

Oilify example for Visual Basic

OLEDropAllowed example for Visual Basic

OLEDropFile example for Visual Basic

OLEStartDrag (ImageList Control) example for Visual Basic

OLEStartDrag (Main Control) example for Visual Basic

OwnerDrawItem event example for Visual Basic

OwnerDrawItems example for Visual Basic

PageCount (ImageList Control) example for Visual Basic

Paint event example for Visual Basic

PaintContrast example for Visual Basic

PaintDither (ImageList Control) example for Visual Basic

PaintDither example for Visual Basic

PaintEffect example for Visual Basic

PaintGamma example for Visual Basic

PaintIntensity example for Visual Basic

PaintMaxPasses example for Visual Basic

PaintPalette example for Visual Basic

PaintROP3 example for Visual Basic

PaintScaling (ImageList Control) example for Visual Basic

PaintScaling example for Visual Basic

PaintSizeMode example for Visual Basic

PaintSizeUseDPI example for Visual Basic

PaintWhileLoad example for Visual Basic

PaintZoomFactor example for Visual Basic

PatternStyle example for Visual Basic

PCDRes example for Visual Basic

PDFSaveLowMemory example for Visual Basic

PDFSaveUseDPI example for Visual Basic

PDFXResolution example for Visual Basic

PicturizeBitmapList example for Visual Basic

Picturize example for Visual Basic

PicturizeSingle example for Visual Basic

Pixel example for Visual Basic

PixelData example for Visual Basic

Posterize example for Visual Basic

PreferredLoadFormat example for Visual Basic

PreLoadFilters example for Visual Basic

PrinterScaleHeight example for Visual Basic

PrintNewPage example for Visual Basic

ProgressivePasses example for Visual Basic

ProgressStatus example for Visual Basic

RasterizeViewMode example for Visual Basic

RawLoad example for Visual Basic

RawSave example for Visual Basic

ReadLoadResolutions example for Visual Basic

ReadyState example for Visual Basic

RefBitmapList example for Visual Basic

RemapHue example for Visual Basic

RemapTableSize example for Visual Basic

Remove (ImageList Control) example for Visual Basic

RemoveRedeye example for Visual Basic

RenderCenter example for Visual Basic

Resize (ImageList Control) example for Visual Basic

Resize event example for Visual Basic

ResizeRgn example for Visual Basic

RGBfromHSV example for Visual Basic

RgnChange example for Visual Basic

RgnFrameColor example for Visual Basic

Rotate example for Visual Basic

RowCount (ImageList Control) example for Visual Basic

Saturation example for Visual Basic

Save example for Visual Basic

Save (Mixed Raster Content Control) example for Visual Basic

SaveArray example for Visual Basic

SaveBuffer example for Visual Basic

SaveDatabase example for Visual Basic

SaveIFD example for Visual Basic

SaveInterlaced example for Visual Basic

SaveLayers example for Visual Basic

SaveLSB example for Visual Basic

SaveMemory example for Visual Basic

SavePage example for Visual Basic

SaveResolutionCount example for Visual Basic

SaveTileWidth example for Visual Basic

SaveToFile (ImageList Control) example for Visual Basic

SaveWithStamp example for Visual Basic

ScaleMode (ImageList Control) example for Visual Basic

Scroll event example for Visual Basic

ScrollItems (ImageList Control) example for Visual Basic

ScrollStyle (ImageList Control) example for Visual Basic

SelectAll (ImageList Control) example for Visual Basic

SelectedItems example for Visual Basic

SelectionColor (ImageList Control) example for Visual Basic

SelectionStyle (ImageList Control) example for Visual Basic

SetNewStripe (Mixed Raster Content Control) example for Visual Basic

SetRgn... example for Visual Basic

SetRgnColorHSVRange example for Visual Basic

SetRgnColorRGBRange example for Visual Basic

SetRgnMagicWand example for Visual Basic

SetSelectionBitmap example for Visual Basic

SetSrcClipRect example for Visual Basic

SetSrcRect example for Visual Basic

SetTag example for Visual Basic

SkipFile example for Visual Basic

Sharpen example for Visual Basic

Shear example for Visual Basic

ShowHelpButton example for Visual Basic

ShowMagGlass example for Visual Basic

Solarize example for Visual Basic

Sort (ImageList Control) example for Visual Basic

SpatialFilter example for Visual Basic

Src... example for Visual Basic

STable example for Visual Basic

StopMagGlass example for Visual Basic

StretchIntensity example for Visual Basic

SwapColors example for Visual Basic

TextWordWrap example for Visual Basic

TransitionEffect example for Visual Basic

TransparentColor example for Visual Basic

Trim example for Visual Basic

Underlay example for Visual Basic

UnlockSupport (ImageList Control) example for Visual Basic

UnlockSupport (ISIS Control) example for Visual Basic

UnlockSupport (Mixed Raster Content Control) example for Visual Basic

UnlockSupport (OLE DB Control) example for Visual Basic

UnlockSupport (Thumbnail Browser Control) example for Visual Basic

UnsharpMask example for Visual Basic

UserPalette and BitmapPalette example for Visual Basic

Version... example for Visual Basic

ViewSize example for Visual Basic

VTable example for Visual Basic

Window (ImageList Control) example for Visual Basic

WindowLevel example for Visual Basic

WindowLevelBitmap example for Visual Basic

WindowLevelFillLUT example for Visual Basic

WMFResolution example for Visual Basic

WriteComment example for Visual Basic

WriteMarkerAction example for Visual Basic

ZoomIn example for Visual Basic

ZoomInDone example for Visual Basic


AboutBox example for Visual Basic

Note: Also works with Access 95 and 97.

This example displays the LEADTOOLS ActiveX information.

Lead1.AboutBox


AddBitmaps example for Visual Basic

   Dim i As Integer
   LEAD3.Bitmap = 0
   For i = 0 To 4
      LEAD2.Bitmap = LEAD1.Bitmap
      LEAD2.Rotate 7200 * i, 0, RGB(255, 0, 0)
      LEAD3.InsertBitmapListItem -1, LEAD2.Bitmap
   Next i
   LEAD3.AddBitmaps BC_AVG


AddBorder example for Visual Basic

LEAD1.AddBorder 30, 30, 30, 30, BORDER_OUTSIDE, BORDER_STYLE_OPAQUE, BORDER_EFFECT_CURVEDIN, 0, BORDER_GRAD_INSIDEOUT, RGB(200, 150, 150), 0, 200, False, False, 0, BORDER_SHADOW_LEFT, False


AddFrame example for Visual Basic

LEAD1.AddFrame LEAD2.Bitmap, False, False, 0, 0, FRAME_OUTSIDE, FRAME_QUALITY_LOW


AddNoise example for Visual Basic

Note: Also works with Access 95 and 97.

This example adds red noise and redisplays the bitmap.

Lead1.AddNoise 500, CHANNEL_RED
Lead1.ForceRepaint


AlphaBlend example for Visual Basic

   LEAD2.Bitmap = LEAD1.Bitmap
   LEAD2.IntensityDetect 150, 250
   LEAD1.AlphaBlend 0, 0, LEAD1.BitmapWidth, LEAD1.BitmapHeight, LEAD2.Bitmap, 0, 0, 128


Animate Event example for Visual Basic

Note: Also works with Access 95 and 97.

This example shows how the Animate event can be used to toggle the use of a button to start and stop the animation.

Private Sub Lead1_Animate(ByVal bEnable As Boolean)
  If bEnable = True Then
    Command1.Caption = "&Stop Animation"
  Else
    Command1.Caption = "&Start animation"
  End If
End Sub

Private Sub Command1_Click()
   If Lead1.AnimationEnable = True Then
     Lead1.AnimationEnable = False
   Else
     Lead1.AnimationEnable = True
   End If
End Sub


AnimationEnable example for Visual Basic

Note: Also works with Access 95 and 97.

This example loads and plays an animated file. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

' Load all pages of an AVI file.
Lead1.Load "c:\windows\system\wndsurf1.avi", 0, 1, -1

' Set properties for a scaled animation.
Lead1.AutoRepaint = True
Lead1.AutoSetRects = False

' Set the image display size to match the LEAD control.
Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight

' Allow a continuous loop.
Lead1.AnimationLoop = True

' Start the animation.
Lead1.AnimationEnable = True


AnimationPause example for Visual Basic

Private Sub btnEnableAnimation_Click()

   ' Load all pages of an animated gif file.
   LEAD1.Load "E:\LEADTOOLS\Images\eye.gif", 0, 1, -1
   ' Set properties for a scaled animation.
   Lead1.AutoRepaint = True
   Lead1.AutoSetRects = False
   ' Set the image display size to match the LEAD control.
   Lead1.SetDstRect 0, 0, LEAD1.Width, LEAD1.Height
   Lead1.SetDstClipRect 0, 0, LEAD1.Width, LEAD1.Height
   ' Allow a continuous loop.
   Lead1.AnimationLoop = True

   ' Start the animation.
   Lead1.AnimationEnable = True

   'Set the middle frame as the start frame in the animation
   LEAD1.AnimationFrameIndex = Int(Lead1.BitmapListCount / 2) - 1

End Sub

Private Sub btnTogglePauseAnimation_Click()
   LEAD1.AnimationPause = Not LEAD1.AnimationPause
End Sub


AnnAutoDialogFontSize example for Visual Basic

   ' This example will set the dialog fonts to use Courier 15
   LEAD1.AnnSetAutoText ANNAUTOTEXT_DIALOG_FONT, "Courier New"
   LEAD1.AnnAutoDialogFontSize = 15


AnnAutoDrawEnable example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example toggles the AnnAutoDrawEnable property.

If (Lead1.AnnAutoDrawEnable = True) Then
   Lead1.AnnAutoDrawEnable = False
Else
   Lead1.AnnAutoDrawEnable = True
End If


AnnAutomation Property example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example shows how you can use the AnnAutomation property to access the automation object through DLL functions.

Dim IsBold As Long ' Is the object’s text bold
Dim hAnnObject As Long

hAnnObject = Lead1.AnnAutomation

' Set the default font to bold, unless it already is
L_AnnGetFontBold hAnnObject, IsBold
If IsBold <> 0 Then
    MsgBox "Already bold", 0, "Notice"
Else
    L_AnnSetFontBold hAnnObject, True, 0
End If


AnnAutoMenuEnable example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example toggles the AnnAutoMenuEnable property.

If (Lead1.AnnAutoMenuEnable = True) Then
   Lead1.AnnAutoMenuEnable = False
Else
   Lead1.AnnAutoMenuEnable = True
End If


AnnAutoResize example for Visual Basic

' This example will double the size of the bitmap and annotations

LEAD1.AnnAutoResize = True

LEAD1.Size LEAD1.BitmapWidth * 2, LEAD1.BitmapHeight * 2, RESIZE_RESAMPLE


AnnAutoRotate example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example enables automatic rotation of annotations, then rotates the bitmap 2222 hundredths of degrees to demonstrate the automation:

Lead1.AnnAutoRotate = True
Lead1.Rotate 2222, ROTATE_RESIZE, RGB(0, 0, 255)


AnnBoundingRect… example for Visual Basic
AnnBoundingRect... example for Visual Basic

   hObj = LEAD1.AnnCreateItem (LEAD1.AnnContainer, ANNOBJECT_PROTRACTOR, True)
   hObj2 = LEAD1.AnnCreateItem(LEAD1.AnnContainer, ANNOBJECT_POLYGON, True)
    ReDim x(3) As Single, y(3) As Single
   ' Assign values for x and y from 1 through 3
   x(1) = 10:  y(1) = 20
   x(2) = 100: y(2) = 200
   x(3) = 200: y(3) = 100
   LEAD1.AnnSetPoints hObj, x, y, 3
   x(0) = 50:  y(0) = 220 ' SetPoints starts at 0 because No. of points set to 4
   LEAD1.AnnSetPoints hObj2, x, y, 4
   LEAD1.AnnSetFillMode hObj2, ANNFILLMODE_OPAQUE, False
   Form1.Caption = "Protractor Bounding Rectangle, Left:" & LEAD1.AnnBoundingRectLeft (hObj) & ", Top:" & LEAD1.AnnBoundingRectTop (hObj) & ", Width:" & LEAD1.AnnBoundingRectWidth (hObj) & ", Height:" & LEAD1.AnnBoundingRectHeight(hObj)
   LEAD1.AnnBringToFront hObj2
   MsgBox "Brought Polygon to front"
   Form1.Caption = "Polygon Area:" & LEAD1.AnnGetArea (hObj2)
   LEAD1.AnnSendToBack hObj2
   MsgBox "Sent Polygon to back"
   LEAD1.AnnCut hObj2, ANNFMT_WMF, False, True
   Form1.Caption = "Angle:" & LEAD1.AnnGetAngle (hObj)


AnnChange Event example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example tests the AnnChange event.

Private Sub Lead1_AnnChange(ByVal hObject As Long, ByVal uType As Long)
   Dim buffer As String
   buffer = " This is a change for the button tagged " + CStr(Lead1.AnnGetTag(hObject))
   MsgBox buffer, 0, "NOTE"
End Sub


AnnContainer(OLE DB Control) example for Visual Basic

Private Sub LEADOLEDB1_DataLoaded()
    Lead1.AnnContainer = 0
    Lead1.AnnContainer = LEADOLEDB1.AnnContainer
    Lead1.ForceRepaint
End Sub


AnnDataPath example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example shows how to load an annotation file from the Internet.

Lead1.AnnDataPath = "ftp://ftp.leadtools.com/vbaward.ann"


AnnDeletePage example for Visual Basic

'This sample saves the annotations as the first page of a multipage annotation file
'The format is specified by the 'uFormat' parameter (either ANNFMT_NATIVE or ANNFMT_ENCODED)
'The annotations are flipped, and saved as the second page
'The annotations are rotated, and saved as the third page
'Information is displayed about the annotation file
'The second page is deleted, and information is again displayed about the annotation file
Private Sub SampleAnnSave(strFileName As String, uFormat As Long)
   Dim nRet As Integer
   Dim strFormat As String
   Dim strMsg As String

   'Save as the first page of the annotation file
   LEAD1.AnnSave strFileName, uFormat, False, SAVE_OVERWRITE, 0

   'Flip the container, and save as the second page (insert before page 2)
   LEAD1.AnnFlip True, LEAD1.BitmapHeight / 2, False
   LEAD1.AnnSave strFileName, uFormat, False, SAVE_INSERT, 2

   'Rotate the container, and save as the third page
   'Here we could pass the SAVE_INSERT flag and 3 for nPage,
   'but instead we will use the SAVE_APPEND flag
   LEAD1.AnnRotate False, LEAD1.BitmapWidth / 2, LEAD1.BitmapHeight / 2, 45, False
   LEAD1.AnnSave strFileName, uFormat, False, SAVE_APPEND, 0

   'Verify contents of file
   nRet = LEAD1.AnnFileInfo(strFileName)
    If (nRet = 0) Then
        Select Case LEAD1.AnnInfoFormat
           Case ANNFMT_NATIVE
             strFormat = "ANNFMT_NATIVE"
           Case ANNFMT_WMF
             strFormat = "ANNFMT_WMF"
           Case ANNFMT_ENCODED
             strFormat = "ANNFMT_ENCODED"
           Case Else
             strFormat = "Unknown"
        End Select

        strMsg = "File: " + strFileName + Chr(13)
        strMsg = strMsg + "Format: " + strFormat + Chr(13)
        strMsg = strMsg + "Version: " + Str(LEAD1.AnnInfoVersion) + Chr(13)
        strMsg = strMsg + "Total Pages: " + Str(LEAD1.AnnInfoTotalPages) + Chr(13)

        MsgBox strMsg
    Else
        MsgBox "Invalid Annotation File: " + strFileName
    End If

   'Now delete the second page, and display informtion
   LEAD1.AnnDeletePage strFileName, 2

   'Verify contents of file
   nRet = LEAD1.AnnFileInfo(strFileName)
    If (nRet = 0) Then
        Select Case LEAD1.AnnInfoFormat
           Case ANNFMT_NATIVE                  ' Cut command.
             strFormat = "ANNFMT_NATIVE"
           Case ANNFMT_WMF                ' Copy command.
             strFormat = "ANNFMT_WMF"
           Case ANNFMT_ENCODED                 ' Clear command.
             strFormat = "ANNFMT_ENCODED"
           Case Else
             strFormat = "Unknown"
        End Select

        strMsg = "File: " + strFileName + Chr(13)
        strMsg = strMsg + "Format: " + strFormat + Chr(13)
        strMsg = strMsg + "Version: " + Str(LEAD1.AnnInfoVersion) + Chr(13)
        strMsg = strMsg + "Total Pages: " + Str(LEAD1.AnnInfoTotalPages) + Chr(13)

        MsgBox strMsg
    Else
        MsgBox "Invalid Annotation File: " + strFileName
    End If
End Sub


AnnDeletePageArray example for Visual Basic

'This sample saves the annotations as the first page of a multipage annotation file in memory
'The annotations are flipped, and saved as the second page
'The annotations are rotated, and saved as the third page
'Information is displayed about the annotation file
'The second page is deleted, and information is again displayed about the annotation file
'Assume this global declaration:
'   Dim AnnVariant as VARIANT
Private Sub SampleAnnFileInfoArray_Click()
   Dim nRet As Integer
   Dim strFormat As String
   Dim strMsg As String
   Dim uFormat As Long

   uFormat = ANNFMT_ENCODED

   AnnVariant = Empty

   'Save as the first page of the annotation file
   nRet = LEAD1.AnnSaveArray (AnnVariant, uFormat, False, SAVE_OVERWRITE, 0)

   'Flip the container, and save as the second page (insert before page 2)
   LEAD1.AnnFlip True, LEAD1.BitmapHeight / 2, False
   nRet = LEAD1.AnnSaveArray(AnnVariant, uFormat, False, SAVE_INSERT, 2)

   'Rotate the container, and save as the third page
   'Here we could pass the SAVE_INSERT flag and 3 for nPage,
   'but instead we will use the SAVE_APPEND flag
   LEAD1.AnnRotate False, LEAD1.BitmapWidth / 2, LEAD1.BitmapHeight / 2, 45, False
   LEAD1.AnnSaveArray AnnVariant, uFormat, False, SAVE_APPEND, 0

   'Verify contents of file
   nRet = LEAD1.AnnFileInfoArray(AnnVariant)
    If (nRet = 0) Then
        Select Case LEAD1.AnnInfoFormat
           Case ANNFMT_NATIVE
             strFormat = "ANNFMT_NATIVE"
           Case ANNFMT_WMF
             strFormat = "ANNFMT_WMF"
           Case ANNFMT_ENCODED
             strFormat = "ANNFMT_ENCODED"
           Case Else
             strFormat = "Unknown"
        End Select

        strMsg = ""
        strMsg = strMsg + "Format: " + strFormat + Chr(13)
        strMsg = strMsg + "Version: " + Str(LEAD1.AnnInfoVersion) + Chr(13)
        strMsg = strMsg + "Total Pages: " + Str(LEAD1.AnnInfoTotalPages) + Chr(13)

        MsgBox strMsg
    Else
        MsgBox "Invalid Annotation Memory File"
    End If

   'Now delete the second page, and display informtion
   LEAD1.AnnDeletePageArray AnnVariant, 2

   'Verify contents of file
   nRet = LEAD1.AnnFileInfoArray(AnnVariant)
    If (nRet = 0) Then
        Select Case LEAD1.AnnInfoFormat
           Case ANNFMT_NATIVE                  ' Cut command.
             strFormat = "ANNFMT_NATIVE"
           Case ANNFMT_WMF                ' Copy command.
             strFormat = "ANNFMT_WMF"
           Case ANNFMT_ENCODED                 ' Clear command.
             strFormat = "ANNFMT_ENCODED"
           Case Else
             strFormat = "Unknown"
        End Select

        strMsg = ""
        strMsg = strMsg + "Format: " + strFormat + Chr(13)
        strMsg = strMsg + "Version: " + Str(LEAD1.AnnInfoVersion) + Chr(13)
        strMsg = strMsg + "Total Pages: " + Str(LEAD1.AnnInfoTotalPages) + Chr(13)

        MsgBox strMsg
    Else
        MsgBox "Invalid Annotation File"
    End If

    'If finished with AnnVariant, then free the memory by setting to empty
End Sub


AnnDeletePageMemory example for Visual Basic

'This sample saves the annotations as the first page of a multipage annotation file in memory
'The annotations are flipped, and saved as the second page
'The annotations are rotated, and saved as the third page
'Information is displayed about the annotation file
'The second page is deleted, and information is again displayed about the annotation file
'Assume this global declaration:
'   Dim hGlobal as OLE_HANDLE
Private Sub SampleAnnFileInfoMemory_Click()
   Dim nRet As Integer
   Dim strFormat As String
   Dim strMsg As String
   Dim lSize As Long
   Dim uFormat As Long

   uFormat = ANNFMT_NATIVE
   'Save as the first page of the annotation file
   hGlobal = 0
   LEAD1.AnnSaveMemory hGlobal, uFormat, False, lSize, SAVE_OVERWRITE, 0

   'Flip the container, and save as the second page (insert before page 2)
   LEAD1.AnnFlip True, LEAD1.BitmapHeight / 2, False
   LEAD1.AnnSaveMemory hGlobal, uFormat, False, lSize, SAVE_INSERT, 2

   'Rotate the container, and save as the third page
   'Here we could pass the SAVE_INSERT flag and 3 for nPage,
   'but instead we will use the SAVE_APPEND flag
   LEAD1.AnnRotate False, LEAD1.BitmapWidth / 2, LEAD1.BitmapHeight / 2, 45, False
   LEAD1.AnnSaveMemory hGlobal, uFormat, False, lSize, SAVE_APPEND, 0

   'Verify contents of file
   nRet = LEAD1.AnnFileInfoMemory(hGlobal, lSize)
    If (nRet = 0) Then
        Select Case LEAD1.AnnInfoFormat
           Case ANNFMT_NATIVE
             strFormat = "ANNFMT_NATIVE"
           Case ANNFMT_WMF
             strFormat = "ANNFMT_WMF"
           Case ANNFMT_ENCODED
             strFormat = "ANNFMT_ENCODED"
           Case Else
             strFormat = "Unknown"
        End Select

        strMsg = ""
        strMsg = strMsg + "Format: " + strFormat + Chr(13)
        strMsg = strMsg + "Version: " + Str(LEAD1.AnnInfoVersion) + Chr(13)
        strMsg = strMsg + "Total Pages: " + Str(LEAD1.AnnInfoTotalPages) + Chr(13)
        strMsg = strMsg + "Total Size: " + Str(lSize) + Chr(13)

        MsgBox strMsg
    Else
        MsgBox "Invalid Annotation Memory File"
    End If

   'Now delete the second page, and display informtion
   LEAD1.AnnDeletePageMemory hGlobal, lSize, 2

   'Verify contents of file
   nRet = LEAD1.AnnFileInfoMemory (hGlobal, lSize)
    If (nRet = 0) Then
        Select Case LEAD1.AnnInfoFormat
           Case ANNFMT_NATIVE                  ' Cut command.
             strFormat = "ANNFMT_NATIVE"
           Case ANNFMT_WMF                ' Copy command.
             strFormat = "ANNFMT_WMF"
           Case ANNFMT_ENCODED                 ' Clear command.
             strFormat = "ANNFMT_ENCODED"
           Case Else
             strFormat = "Unknown"
        End Select

        strMsg = ""
        strMsg = strMsg + "Format: " + strFormat + Chr(13)
        strMsg = strMsg + "Version: " + Str(LEAD1.AnnInfoVersion) + Chr(13)
        strMsg = strMsg + "Total Pages: " + Str(LEAD1.AnnInfoTotalPages) + Chr(13)
        strMsg = strMsg + "Total Size: " + Str(lSize) + Chr(13)

        MsgBox strMsg
    Else
        MsgBox "Invalid Annotation File"
    End If

    'If finished with hGlobal, then free the memory by calling GlobalFree
End Sub


AnnDestroy example for Visual Basic

Note: This topic is for Document/Medical  only.

Private Sub Command4_Click()
   LEAD1.AnnDestroy LEAD1.AnnContainer, ANNFLAG_RECURSE + ANNFLAG_SELECTED
End Sub


AnnEnumerate example for Visual Basic

Note: This topic is for Document/Medical  only.

'This event is fired for each annotation
'Displays the handle for each annotation
Private Sub LEAD1_AnnEnumerate(ByVal hObject As Stdole.OLE_HANDLE)
MsgBox "hObject: " & Hex(hObject)
End Sub

'Load image and annotation file and then enumerate all the annotations
Private Sub Command1_Click()
LEAD1.Load App.Path & "\rgbw.bmp", 0, 0, 1
LEAD1.AnnLoad App.Path & "\rgbw.ann", 0
LEAD1.AnnUserMode = ANNUSERMODE_RUN
LEAD1.AnnEnumerate LEAD1.AnnContainer, ANNFLAG_RECURSE + ANNFLAG_NOTTHIS, ""
End Sub


AnnGetContainer example for Visual Basic

   Dim hPin As OLE_HANDLE, h1 As OLE_HANDLE, h2 As OLE_HANDLE
   hCont = LEAD1.AnnCreate (ANNOBJECT_CONTAINER, True, False)
   If hCont <> 0 Then
      hPin = LEAD1.AnnCreateItem (hCont, ANNOBJECT_PUSHPIN, False)
      h1 = LEAD1.AnnGetContainer (hCont)
      h2 = LEAD1.AnnGetTopContainer (hPin)
      If h1 = h2 And h1 = LEAD1.AnnContainer Then
         MsgBox "root container is same as that of LEAD1"
      End If
   End If


AnnGetGrouping example for Visual Basic

' This example will toggle the grouping feature for all
' the subcontainers

' This event is fired for each annotation
' Toggles the Grouping feature for all the containers

Private Sub LEAD1_AnnEnumerate(ByVal hObject As Stdole.OLE_HANDLE)
   If LEAD1.AnnGetType(hObject) = ANNOBJECT_CONTAINER Then
      LEAD1.AnnSetGrouping hObject, Not LEAD1.AnnGetGrouping(hObject),0
   End If
End Sub

 ' Add subcontainers by selecting objects and grouping them
 '  before clicking on this button
 ' Note that after you disable the grouping you can select and change
 ' individual objects belonging to a group. When you re-enable
 ' the grouping, the objects act as a group again.

Private Sub Command1_Click()
   LEAD1.AnnUserMode = ANNUSERMODE_DESIGN
   LEAD1.AnnEnumerate LEAD1.AnnContainer, ANNFLAG_RECURSE + ANNFLAG_NOTTHIS, ""
End Sub


AnnGetNameOffsetX example for Visual Basic

‘This sample shifts the NameOffset of the annotation object hObject
‘two pixels in the X direction and one pixel in the Y direction
Private Sub SampleNameOffset(hObject As OLE_HANDLE)
Dim OffsetX As Long
Dim OffsetY As Long
OffsetX = LEAD1.AnnGetNameOffsetX(hObject)
OffsetY = LEAD1.AnnGetNameOffsetY(hObject)

OffsetX = OffsetX + 2
OffsetY = OffsetY + 1
MsgBox "Shifting Name Offset to " + CStr(OffsetX) + "," + CStr(OffsetY)

LEAD1.AnnSetNameOffsetX hObject, OffsetX, False
LEAD1.AnnSetNameOffsetY hObject, OffsetY, False
End Sub


AnnGetNameRestrict example for Visual Basic

'This sample toggles the bNameRestrict property of the annotation object hObject
Private Sub SampleNameRestrict(hObject As OLE_HANDLE)
Dim bNameRestrict As Boolean
bNameRestrict = LEAD1.AnnGetNameRestrict(hObject)
MsgBox "Changing bNameRestrict property to " + Str(Not bNameRestrict)
LEAD1.AnnSetNameRestrict hObject, Not bNameRestrict, False
End Sub


AnnGetHyperlinkParam example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example retrieves parameters using AnnGetHyperlinkParam.

Private Sub Lead1_AnnChange(ByVal hObject As Long)
    Dim msgstr As String
    Dim nType As Integer
    Dim iParamCount As Integer
    Dim lRet As Long

    nType = Lead1.AnnGetHyperlinkType(hObject)
    If (nType = ANNLINK_ANNEVENT5) Then
        msgstr = "Params are: " & Chr(13)
        For iParamCount = 0 To 4
            lRet = Lead1.AnnGetHyperlinkParam(hObject, iParamCount)
            msgstr = msgstr & "   Param" & CStr(iParamCount + 1) & ": " & CStr(lRet) & Chr(13)
        Next
    Else
        msgstr = "Invalid Type"
    End If
    MsgBox msgstr
End Sub


AnnGetHyperlinkString example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

The following example places calls to both the AnnSetHyperlinkString method and the AnnGetHyperlinkString method.

Private Sub Lead1_AnnHyperlinkMenu(ByVal aObjects As Variant, ByVal uCount As Integer)
Dim x As Integer
Dim linkstr As String

    'Set AnnHyperLink to a URL
    For x = 0 To uCount - 1
        Lead1.AnnSetHyperlinkString aObjects(x), ANNLINK_WEBPAGE, "http://www.leadtools.com"
        'get the string to see what got set
        linkstr = Lead1.AnnGetHyperlinkString(aObjects(x))
        MsgBox linkstr
    Next
End Sub


AnnGetHyperlinkType example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

The following is an example of AnnHyperlink event code which includes a call to AnnGetHyperlinkType.

Private Sub Lead1_AnnHyperlink(ByVal hObject As Long, ByVal iParamCount As Integer, ByVal lParam1 As Long, ByVal lParam2 As Long, ByVal lParam3 As Long, ByVal lParam4 As Long, ByVal lParam5 As Long)

    Dim msgstr As String
    Dim nType As Integer

    nType = Lead1.AnnGetHyperlinkType(hObject)
    If ((nType = ANNLINK_ANNEVENT5) Or (nType = ANNLINK_ANNEVENT)) Then
        If iParamCount >= 0 Then
            msgstr = CStr(iParamCount) & " params are valid" & Chr(13)
        End If
        If iParamCount >= 1 Then
            msgstr = msgstr & "Param1: " & CStr(lParam1) & Chr(13)
        End If
        If iParamCount >= 2 Then
            msgstr = msgstr & "Param2: " & CStr(lParam2) & Chr(13)
        End If
        If iParamCount >= 3 Then
            msgstr = msgstr & "Param3: " & CStr(lParam3) & Chr(13)
        End If
        If iParamCount >= 4 Then
            msgstr = msgstr & "Param4: " & CStr(lParam4) & Chr(13)
        End If
        If iParamCount = 5 Then
            msgstr = msgstr & "Param5: " & CStr(lParam5) & Chr(13)
        End If
    Else
        msgstr = "Invalid Type"
    End If
    MsgBox msgstr
End Sub


AnnGetObjectFromTag example for Visual Basic

Note: This topic is for Document/Medical  only.

Private Sub Command11_Click()
   Dim hObject As OLE_HANDLE
   a$ = InputBox("Which tag should I find?")
   hObject = LEAD1.AnnGetObjectFromTag(LEAD1.AnnContainer, CInt(a$), False)
   ' if the message box shows a=a, then it is ok. If it shows a=b then the object is not found properly
   MsgBox a$ + " = " + CStr(LEAD1.AnnGetTag(hObject)) + " ?"
End Sub


AnnGetPoint example for Visual Basic
AnnGetPoint... example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

In the AnnDrawn event, this example checks to see if the annotation object is a polygon. If it is a polygon, the example gets the number of points that define the object; then it gets the arrays of X and Y coordinates and displays the points in a message box.

Private Sub Lead1_AnnDrawn(ByVal hObject As Long)
  Dim nType As Integer
  Dim a As Integer
  Dim xPoints As Variant  'array for the X coordinates
  Dim yPoints As Variant  'array for the Y coordinates
  Dim nPoints As Long     'number of points in the object
  Dim msg$

  nType = Lead1.AnnGetType(hObject)
  If nType = ANNOBJECT_POLYGON Then  'Is the object a polygon?
    MsgBox "Object is a Polygon"
    nPoints = Lead1.AnnGetPointCount(hObject) 'get the number of points
    xPoints = Lead1.AnnGetPointX(hObject)     'get the X coordinates
    yPoints = Lead1.AnnGetPointY(hObject)     'get the Y coordinates
    msg$ = "("
    For a = 1 To nPoints
     msg$ = msg$ & "{" & CStr(xPoints(a - 1)) & "," & CStr(yPoints(a - 1)) & "}"
    Next
    msg$ = msg$ & ")"
    MsgBox msg$, vbOKOnly, "The Polygon's " & CStr(nPoints) & " points are:"
  End If
End Sub


AnnGetProtractorOptions example for Visual Basic

   Dim ArcRadius As Single, bAcute As Boolean, nUnit As Integer, nPrecision As Integer, abbr As String
   abbr = LEAD1.AnnGetProtractorOptions (hProt, bAcute, nUnit, nPrecision, ArcRadius)
   LEAD1.AnnSetProtractorOptions hProt, bAcute = False, 1 - ANNANGLE_DEGREES, abbr, (nPrecision + 1) Mod 5, ArcRadius, False
   LEAD1.AnnSetShowFlags hProt, (LEAD1.AnnGetShowFlags (hProt) + 1) Mod 4, False


AnnGetRgnHandle example for Visual Basic

   LEAD2.SetRgnHandle LEAD1.AnnGetRgnHandle (hPlgn), 1, 1, L_RGN_SET
   LEAD2.RgnFrameType = RGNFRAME_ANIMATED


AnnGetScalarX example for Visual Basic

   MsgBox "ScalarX: " & LEAD1.AnnGetScalarX (hCont) & ", ScalarY: " & LEAD1.AnnGetScalarY (hCont) & ", OffsetX: " & LEAD1.AnnGetOffsetX (hCont) & ", OffsetY: " & LEAD1.AnnGetOffsetY (hCont)
   LEAD1.AnnSetScalarX hCont, 1.5, False
   LEAD1.AnnSetScalarY hCont, 1.5, False
   LEAD1.AnnSetOffsetX hCont, 10, False
   LEAD1.AnnSetOffsetY hCont, 20, False
   MsgBox "ScalarX: " & LEAD1.AnnGetScalarX(hCont) & ", ScalarY: " & LEAD1.AnnGetScalarY(hCont) & ", OffsetX: " & LEAD1.AnnGetOffsetX(hCont) & ", OffsetY: " & LEAD1.AnnGetOffsetY(hCont)


AnnGetSelectList example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example gets the number of selected annotation objects; then it gets an array of the selected object handles and checks to see if any of the objects in the array are polygons.

Dim nType As Integer
Dim a As Integer
Dim bSelected As Boolean
Dim uCount As Integer
Dim aObjects As Variant 'array for the selected object handles

bSelected = False
uCount = Lead1.AnnGetSelectCount  'get number of selected objects
aObjects = Lead1.AnnGetSelectList 'get the handles of the selected objects
MsgBox CStr(uCount) & " objects were selected"
For a = 1 To uCount
   nType = Lead1.AnnGetType(aObjects(a - 1))
   If nType = ANNOBJECT_POLYGON Then  'Is the object a polygon?
      bSelected = True
   End If
Next

If bSelected <> True Then
   MsgBox "No Polygon Objects were selected"
End If


AnnGroup example for Visual Basic

Note: This topic is for Document/Medical  only.

Private Sub Command6_Click()
   LEAD1.AnnGroup LEAD1.AnnContainer, ANNFLAG_SELECTED + ANNFLAG_RECURSE, ""
End Sub


AnnHitTest example for Visual Basic

   If LEAD1.AnnHitTest (LEAD1.AnnContainer, 100, 100, hObj) = ANNHIT_BODY Then
      LEAD1.AnnSetName hObj, True, "AnnHitFound", False
      If LEAD1.AnnGetType (hObj) = ANNOBJECT_TEXT Then
         CommonDialog1.FontBold = LEAD1.AnnGetFontBold (hObj)
         CommonDialog1.FontItalic = LEAD1.AnnGetFontItalic (hObj)
         CommonDialog1.FontStrikethru = LEAD1.AnnGetFontStrikeThrough(hObj)
         CommonDialog1.FontUnderline = LEAD1.AnnGetFontUnderline (hObj)
         CommonDialog1.FontName = LEAD1.AnnGetFontName (hObj)
         CommonDialog1.FontSize = LEAD1.AnnGetFontSize (hObj)
         CommonDialog1.Flags = cdlCFBoth
         CommonDialog1.ShowFont
         LEAD1.AnnSetFontBold hObj, CommonDialog1.FontBold, False
         LEAD1.AnnSetFontItalic hObj, CommonDialog1.FontItalic, False
         LEAD1.AnnSetFontStrikeThrough hObj, CommonDialog1.FontStrikethru, False
         LEAD1.AnnSetFontUnderline hObj, CommonDialog1.FontUnderline, False
         LEAD1.AnnSetFontName hObj, CommonDialog1.FontName, False
         LEAD1.AnnSetFontSize hObj, CommonDialog1.FontSize, False
         Dim bShow As Boolean
         LEAD1.AnnSetText hObj, LEAD1.AnnGetText (hObj) + LEAD1.AnnGetName (hObj, bShow), False
      End If
   End If


AnnHyperlinkMenuEnable example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example toggles the AnnHyperlinkMenuEnable property .

    'toggle AnnHyperLinkMenu item and event
    If (Lead1.AnnHyperlinkMenuEnable = True) Then
        Lead1.AnnHyperlinkMenuEnable = False
    Else
        Lead1.AnnHyperlinkMenuEnable = True
    End If


AnnInsert example for Visual Basic

Note: This topic is for Document/Medical only.

      hEllipseObject = LEAD1.AnnCreate(ANNOBJECT_ELLIPSE, False,

True)
      LEAD1.AnnInsert LEAD1.AnnContainer, hEllipseObject, False


AnnLoadArray example for Visual Basic

Note: This topic is for Document/Medical only.

Private Sub AnnLoadArray_Click()
   Dim MyVar() As Byte
   Dim nLen As Long
   Dim FileName As String
   Dim AnnFileName As String

   FileName = "d:\work\images\a.bmp"
   AnnFileName = "d:\work\images\a.ann"

   'Note that this is a sample key, which will not work in your toolkit.
   LEAD1.UnlockSupport L_SUPPORT_DOCUMENT, "TestKey"

   LEAD1.Load FileName, 0, 1, 1
   LEAD1.AnnUserMode = ANNUSERMODE_DESIGN

   nLen = FileLen(AnnFileName)
   ReDim MyVar(nLen)

   Open AnnFileName For Binary Access Read As #1
   Get #1, , MyVar

   LEAD1.AnnLoadArray MyVar, nLen, 1
   Close #1
End Sub


AnnLock example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example locks objects of type ANNOBJECT_ELLIPSE using the key "IkeStarnes".

Dim nType As Integer
Dim a As Integer
Dim bSelected As Boolean
Dim uCount As Integer
Dim aObjects As Variant 'array for the selected object handles

    'lock only the ellipse objects that are selected

    bSelected = False
    uCount = Lead1.AnnGetSelectCount  'get number of selected objects
    aObjects = Lead1.AnnGetSelectList 'get the handles of the selected objects
    For a = 1 To uCount
        nType = Lead1.AnnGetType(aObjects(a - 1))
        If nType = ANNOBJECT_ELLIPSE Then  'Is the object an ellipse?
            bSelected = True
            Lead1.AnnLock aObjects(a - 1), "IkeStarnes", False
        End If
    Next

    If bSelected <> True Then
        MsgBox "No Ellipse Objects were selected"
    End If


AnnLocked example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

The following is an example of an AnnLocked event.

Private Sub Lead1_AnnLocked(ByVal hObject As Long)
    MsgBox "AnnObject: " & CStr(hObject) & " was locked!"
End Sub


AnnMenu example for Visual Basic

Note: This topic is for Document/Medical only.

Private Sub LEAD1_AnnMenu(ByVal AnnMenu As LEADLib.IAnnMenu)
    Dim nID As Integer
    Dim x As Integer
    Dim PopupMenuItem As LEADLib.IAnnMenu

    MsgBox "There are " & CStr(AnnMenu.count) & " Items"

    MsgBox "Original Text for item#2: " & AnnMenu.ItemString(1)
    'set new string
    AnnMenu.ItemString(1) = "TestText"
    MsgBox "Custom Text for item#2: " & AnnMenu.ItemString(1)

    'make 3rd and 4th menu items have the same command id
    nID = AnnMenu.ItemID(3)
    AnnMenu.ItemID(2) = nID

    'check all unchecked menu items that are not popup submenus
    'disable all enabled menu items that are not popup submenus
    For x = 0 To AnnMenu.count - 1
        If AnnMenu.ItemType(x) = ANNMENUITEMTYPE_NORMAL Then
            If (AnnMenu.ItemChecked(x) = False) Then
                AnnMenu.ItemChecked(x) = True
            End If
            If (AnnMenu.ItemEnabled(x) = True) Then
                AnnMenu.ItemEnabled(x) = False
            End If
        End If
    Next x

    'insert 2 user-defined menu items
    AnnMenu.AddItem "&Flip", ANNMENUITEMTYPE_NORMAL, LTANNEVENT_MENUFIRST, AnnMenu.count
    AnnMenu.AddItem "Test&2", ANNMENUITEMTYPE_NORMAL, LTANNEVENT_MENUFIRST + 1, AnnMenu.count

    'delete the last menu item
    AnnMenu.DeleteItem AnnMenu.count - 1
    'delete the first menu item
    AnnMenu.DeleteItem 0

    'insert a popup menu
    AnnMenu.AddItem "&Popup1", ANNMENUITEMTYPE_SUBMENU, 0, AnnMenu.count
    'get the new item, and add some items to it
    Set PopupMenuItem = AnnMenu.GetSubMenu(AnnMenu.count - 1)
    PopupMenuItem.AddItem "Test&1", ANNMENUITEMTYPE_NORMAL, LTANNEVENT_MENUFIRST + 2, PopupMenuItem.count
    PopupMenuItem.AddItem "Test&2", ANNMENUITEMTYPE_NORMAL, LTANNEVENT_MENUFIRST + 3, PopupMenuItem.count
End Sub
Private Sub LEAD1_AnnUserMenu(ByVal nID As Long)
   If nID = LTANNEVENT_MENUFIRST Then
       LEAD1.AnnFlip False, 0, True
   Else
       MsgBox "nID = LTANNEVENT_MENUFIRST + " + CStr (nID - LTANNEVENT_MENUFIRST)
   End If
End Sub


AnnMouseDown example for Visual Basic

Note: This topic is for Document/Medical only.

Private Sub LEAD1_AnnMouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   x0 = x
   y0 = y
   Select Case LEAD1.AnnTool
   Case ANNTOOL_USER_FIRST
      ' create the objects
      LEAD1.AnnSetSelected LEAD1.AnnContainer, False, True
      'Add an undo node to undo the creation of these objects.
      LEAD1.AnnAddUndoNode
      hRectObject = LEAD1.AnnCreate(ANNOBJECT_RECT, True, True)
      hEllipseObject = LEAD1.AnnCreate(ANNOBJECT_ELLIPSE, True, True)
      ' set the automation defaults to the objects newly created
      LEAD1.AnnSetAutoDefaults hRectObject, 0
      LEAD1.AnnSetAutoDefaults hEllipseObject, 0
      ' start defining them from the x, y coordinate
      LEAD1.AnnDefine hRectObject, x, y, ANNDEFINE_BEGINSET
      LEAD1.AnnDefine hEllipseObject, x, y, ANNDEFINE_BEGINSET
   End Select
End Sub

Private Sub LEAD1_AnnMouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   If Button = 1 Then
      Select Case LEAD1.AnnTool
      Case ANNTOOL_USER_FIRST
         ' update the objects from the x, y coordinate
         LEAD1.AnnDefine hRectObject, x, y, ANNDEFINE_UPDATE
         LEAD1.AnnDefine hEllipseObject, x, y, ANNDEFINE_UPDATE
      Case ANNTOOL_RECT
         AdjustMousePos Shift, x, y
      End Select
   End If
End Sub

Private Sub LEAD1_AnnMouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   Select Case LEAD1.AnnTool
   Case ANNTOOL_USER_FIRST
      LEAD1.AnnDefine hRectObject, x, y, ANNDEFINE_END
      LEAD1.AnnDefine hEllipseObject, x, y, ANNDEFINE_END
      LEAD1.AnnSetSelected hRectObject, True, False
      LEAD1.AnnSetSelected hEllipseObject, True, False
      LEAD1.AnnGroup LEAD1.AnnContainer, ANNFLAG_RECURSE + ANNFLAG_SELECTED, ""
      hEllipseObject = 0
      hRectObject = 0
   Case ANNTOOL_RECT
      AdjustMousePos Shift, x, y
   End Select
End Sub

Private Sub AdjustMousePos(ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   If Shift = 1 Then
      ' if shift key is down, force the creation of squares
      dx = Abs(x - x0)
      dy = Abs(y - y0)
      If (dx > dy) Then
         ' adjust y to be as far from y0 as x is from x0
         If y > y0 Then y = y0 + dx Else y = y0 - dx
      Else
         ' adjust x to be as far from x0 as y is from y0
         If x > x0 Then x = x0 + dy Else x = x0 - dy
      End If
      ' set the mouse cursor and update its position
      LEAD1.SetMousePos x, y, False
   End If
End Sub


AnnMove example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example moves one or more selected annotation objects.

'Declare local variables.
Dim DeltaX, DeltaY

'Use twips.
Lead1.ScaleMode = 1

'Specify arbitrary delta values.
DeltaX = +2000
DeltaY = -2000

'Move the selected annotations.
Lead1.AnnMove DeltaX, DeltaY, True


AnnNameBoundingRectLeft example for Visual Basic

Private Sub ExampleAnnNameBoundingRect(hObject As OLE_HANDLE)
Dim left, top, width, height As String
left = Str(LEAD1.AnnNameBoundingRectLeft(hObject))
top = Str(LEAD1.AnnNameBoundingRectTop(hObject))
width = Str(LEAD1.AnnNameBoundingRectWidth(hObject))
height = Str(LEAD1.AnnNameBoundingRectHeight(hObject))
MsgBox "Ann Name Bounding Rect: left[" + left + "], top[" + top + "], width[" + width + "], height[" + height + "]"
End Sub


AnnNameRectLeft example for Visual Basic

Private Sub ExampleAnnNameRect(hObject As OLE_HANDLE)
Dim left, top, width, height As String
left = Str(LEAD1.AnnNameRectLeft(hObject))
top = Str(LEAD1.AnnNameRectTop(hObject))
width = Str(LEAD1.AnnNameRectWidth(hObject))
height = Str(LEAD1.AnnNameRectHeight(hObject))
MsgBox "Ann Name Rect: left[" + left + "], top[" + top + "], width[" + width + "], height[" + height + "]"
End Sub


Annotation Colors example for Visual Basic

   Dim cr As Long
   LEAD2.Load "C:\TEMP\flagsel.bmp", 0, 1, 1
   LEAD1.AnnSetBitmap hStamp, LEAD2.Bitmap, False
   LEAD1.AnnSetAutoBackColor LEAD1.AnnAutomation, ANNOBJECT_ALL, RGB(40, 80, 160)
   cr = LEAD1.AnnGetAutoBackColor (LEAD1.AnnAutomation, ANNOBJECT_POLYGON)
   MsgBox "AutoBackColor: " & Hex(cr)

   If Not LEAD1.AnnGetTransparent (hStamp) Then
      LEAD1.AnnSetTransparent hStamp, True, False
   End If

   LEAD1.AnnSetTransparentColor hStamp, vbGreen, False
   cr = LEAD1.AnnGetTransparentColor (hStamp)
   MsgBox "TransparentColor: " & Hex(cr)

  LEAD1.AnnSetBackColor hPlgn, vbMagenta, False
   cr = LEAD1.AnnGetBackColor (hPlgn)
   MsgBox "BackColor: " & Hex(cr)

   LEAD1.AnnSetForeColor hPlgn, vbCyan, False
   cr = LEAD1.AnnGetForeColor (hPlgn)
   MsgBox "ForeColor: " & Hex(cr)
   LEAD1.Bitmap = LEAD1.AnnGetBitmap (hStamp)


AnnRectLeft example for Visual Basic

Note: This topic is for Document/Medical only.

Private Sub LEAD1_AnnEnumerate(ByVal hObject As Stdole.OLE_HANDLE)
Select Case iEnumerate
   Case 0
      ' Code that tests AnnGetVisible
      If LEAD1.AnnGetVisible(hObject) = True Then
         MsgBox CStr(LEAD1.AnnGetType(hObject)), vbOK, "Visible"
      Else
         MsgBox CStr(LEAD1.AnnGetType(hObject)), vbOK, "NOT Visible"
      End If
   Case 1
      ' Code that tests AnnSetTag/AnnGetObjectFromTag
      a$ = InputBox("Tag for object " + CStr(LEAD1.AnnGetType(hObject)))
      LEAD1.AnnSetTag hObject, CInt(a$)
   Case 2
      ' code that tests the object positioning properties
      LEAD1.AnnRectLeft(hObject) = LEAD1.AnnRectLeft(hObject) + 50
   Case 3
      ' code that tests the object positioning properties
      LEAD1.AnnRectTop(hObject) = LEAD1.AnnRectTop(hObject) + 50
   Case 4
      ' code that tests the object positioning properties
      LEAD1.AnnRectWidth(hObject) = LEAD1.AnnRectWidth(hObject) + 50
   Case 5
      ' code that tests the object positioning properties
      LEAD1.AnnRectHeight(hObject) = LEAD1.AnnRectHeight(hObject) + 50
   Case 6
      ' bring a message box showing the value of AnnGetAutoMenuItemEnable for hObject
      MsgBox CStr(LEAD1.AnnGetAutoMenuItemEnable(hObject, 0, ANNAUTOTEXT_MENU_DELETE))
End Select
End Sub


AnnRotate example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example uses the AnnFlip, AnnReverse, and AnnRotate methods. To code this example, add a command button named Test to the example you created in Loading and Displaying an Image. For best results when you run the example, draw two objects in opposite corners, and use the right mouse button to select all annotation objects. The command button then lets you cycle through the AnnFlip, AnnReverse, and AnnRotate methods.

Private Sub Test_Click()
Dim MyCaption As String
MyCaption = Test.Caption
Select Case MyCaption
Case "Flip"
    'Flip using the center of the bitmap as the axis.
    Lead1.AnnFlip True, Lead1.BitmapHeight / 2, True
    Test.Caption = "Reverse"
Case "Reverse"
    'Reverse using the center of the bitmap as the axis.
    Lead1.AnnReverse True, Lead1.BitmapWidth / 2, True
    Test.Caption = "Rotate"
Case "Rotate"
    'Rotate 90 degrees using the center of the bitmap as the axis.
    Lead1.AnnRotate True, Lead1.BitmapWidth / 2, Lead1.BitmapHeight / 2, 90, True
    Test.Caption = "Flip"
Case Else
    Test.Caption = "Flip"
    Lead1.AnnUserMode = ANNUSERMODE_DESIGN
    Lead1.AnnTool = ANNTOOL_REDACT
    MsgBox "Draw two objects, use the right mouse button to select all, then click the command button"
End Select

End Sub


AnnSaveArray example for Visual Basic

Note: This topic is for Document/Medical only.

'This sample saves the currently loaded annotations in memory (as a VARIANT)
'The variant is then saved as a readable annotation file
Private Sub AnnSaveArray_Click()
   Dim AnnVar As Variant
   Dim x As Long
   Dim MyByte() As Byte
   Dim lSize As Long
   LEAD1.AnnSaveArray AnnVar, ANNFMT_ENCODED, False, SAVE_OVERWRITE, 0

   lSize = UBound(AnnVar)

   ReDim MyByte(lSize)

   Open "d:\\work\\images\\a.ann" For Binary Access Write As #1

   MyByte = AnnVar
   For x = 0 To lSize
      Put #1, , MyByte(x)
    Next
   Close #1
End Sub


AnnSaveMemory example for Visual Basic

Note: This topic is for Document/Medical  only.

This example lets you save the current annotations to a file in memory, and lets you load the annotations that were saved.

1.	Start with the project that you created in Creating and Using Annotations.

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

Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long

Dim hMem     As Long   ' For WIN16 this would be declared as Integer
Dim iSize    As Long

3.	 At the top of your main form, add two command buttons and name them as follows:

Name	Caption

AnnSaveMem	Save In Memory

AnnLoadMem	Load From Memory

4.	Code the AnnSaveMem button's Click procedure as follows:

hMem = 0
If Lead1.AnnSaveMemory (hMem, ANNFMT_NATIVE, False, iSize, SAVE_OVERWRITE, 0) <> 0 Then
   MsgBox ("Error calling AnnSaveMemory")
End If

5.	Code the AnnLoadMem button's Click procedure as follows:

'Load the annotations from the memory-resident file.
If Lead1.AnnLoadMemory(hMem, iSize, 1) <> 0 Then
   MsgBox ("Error calling AnnLoadMemory")
Else
   MsgBox ("AnnLoadMemory succeeded")
End If
GlobalFree (hMem)

6.	Run your program to test it.


AnnSaveOffset example for Visual Basic

Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal handle As Long) As Long
Private Const GENERIC_WRITE = &H40000000
Private Const CREATE_ALWAYS = 2
Private Const FILE_ATTRIBUTE_NORMAL = &H80
Private Const INVALID_HANDLE_VALUE = -1

Private Sub SaveOffset_Click()
   Dim hFile As Long
   hFile = CreateFile("c:\temp\test1.wmf", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)

   If hFile = INVALID_HANDLE_VALUE Then
      MsgBox "Could not open file."
      Exit Sub
   End If
   LEAD1.AnnSaveOffset hFile, 0, hPlgn, ANNFMT_WMF, False
   CloseHandle hFile
End Sub


AnnSaveTag example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical only.

The following example saves selected objects as a Wang compatible TIFF tag.

    'Save only selected objects in Wang TIFF tag
    Lead1.AnnSaveTag True, True

    Lead1.Save "d:\temp\testwang.tif", FILE_CCITT_GROUP4, 1, 2, SAVE_OVERWRITE


AnnSelect example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical only.

This example for the AnnSelect event displays a message box showing the number of selected annotation objects. It then goes through the array of selected objects to see if any of them are polygons.

Private Sub Lead1_AnnSelect(ByVal aObjects As Variant, ByVal uCount As Integer)
   Dim nType As Integer
   Dim x As Integer
   Dim bSelected As Boolean

   bSelected = False
   MsgBox CStr(uCount) & " objects were selected"
   For x = 1 To uCount
     nType = Lead1.AnnGetType(aObjects(x - 1))
     If nType = ANNOBJECT_POLYGON Then
         bSelected = True
     End If
   Next

   If bSelected <> True Then
     MsgBox "No Polygon Objects were selected"
   End If
End Sub


AnnSelectRect example for Visual Basic

   LEAD1.AnnSelectRect LEAD1.AnnContainer, 10, 10, 200, 100
   LEAD1.AnnSelectPoint LEAD1.AnnContainer, 300, 300
   If LEAD1.AnnGetSelected (hPlgn) Then
      LEAD1.AnnRemove hPlgn
      LEAD1.AnnSetSelected hPlgn, False, False
   Else
      LEAD1.AnnInsert LEAD1.AnnContainer, hPlgn, False
   End If

   Caption = "Left:" & LEAD1.AnnSelectRectLeft (LEAD1.AnnContainer) _
   & ", Top:" & LEAD1.AnnSelectRectTop (LEAD1.AnnContainer) _
   & ", Width:" & LEAD1.AnnSelectRectWidth (LEAD1.AnnContainer) _
   & ", Height:" & LEAD1.AnnSelectRectHeight (LEAD1.AnnContainer)


AnnSetAutoMenuItemEnable example for Visual Basic

Note: This topic is for Document/Medical only.

Private Sub Command17_Click()
   ' disable the Delete menu item from all the selected objects
   LEAD1.AnnSetAutoMenuItemEnable LEAD1.AnnContainer, 0, ANNAUTOTEXT_MENU_DELETE, ANNMENU_DISABLED, ANNFLAG_RECURSE + ANNFLAG_SELECTED, ""
   ' disable the Delete menu item from all the ellipse objects
   LEAD1.AnnSetAutoMenuItemEnable LEAD1.AnnAutomation, ANNOBJECT_ELLIPSE, ANNAUTOTEXT_MENU_DELETE, ANNMENU_DISABLED, 0, ""
End Sub


AnnSetAutoText example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example modifies the text string that is used for the undo option on the annotation pop-up menu.

Dim TestText As String
TestText = Lead1.AnnGetAutoText(ANNAUTOTEXT_MENU_UNDO)
TestText = TestText + " - New"
Lead1.AnnSetAutoText ANNAUTOTEXT_MENU_UNDO, TestText


AnnSetGrouping example for Visual Basic

' This example will temporarily disable the grouping in all objects
' and re-enable the grouping later.

' disable grouping in all groups

LEAD1.AnnSetGrouping LEAD1.AnnContainer, False, ANNFLAG_RECURSE

… ' you can now select and change individual objects from groups
… ' you can also put the two calls to AnnSetGrouping in two
… ' buttons

' re-enable grouping all groups
' note that we do NOT enable grouping in the topmost container!
' if you enable the grouping in the top container, then all the
' objects will act as a group!

LEAD1.AnnSetGrouping LEAD1.AnnContainer, True, ANNFLAG_RECURSE+ANNFLAG_NOTTHIS


AnnSetHyperlinkMsg example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

The following is an example of AnnHyperlinkMenu event code, which includes a call to AnnSetHyperlinkMsg.

Private Sub Lead1_AnnHyperlinkMenu(ByVal aObjects As Variant, ByVal uCount As Integer)
Dim x As Integer

    'set HyperLink to type ANNLINK_ANNEVENT5
    'and set the 5 params to some values.
    For x = 0 To uCount - 1
        Lead1.AnnSetHyperlinkMsg aObjects(x), ANNLINK_ANNEVENT5, 5, 4, 3, 2, 1
    Next
End Sub


AnnSetMetafile example for Visual Basic

Private Declare Function GetObjectType Lib "gdi32" (ByVal hgdiobj As Long) As Long
Private Const OBJ_ENHMETAFILE = 13
Private Const OBJ_METAFILE = 9

Private Sub Metafile_Click()
   Dim hMeta As OLE_HANDLE
   Dim bEnh As Boolean
   hMeta = LEAD1.AnnGetPredefinedMetafile (ANNMETAFILE_IMPORTANT, bEnh)
   LEAD1.AnnSetPredefinedMetafile ANNMETAFILE_TOPSECRET, hMeta
   LEAD1.AnnSetMetafile hStamp, 0, ANNMETAFILE_TOPSECRET, False
   MsgBox "stamp set to TopSecret"

   hMeta = LEAD1.AnnGetMetafile (hStamp)
   Select Case GetObjectType(hMeta)
      Case OBJ_ENHMETAFILE
         MsgBox "Type is EMF"
      Case OBJ_METAFILE
         MsgBox "Type is WMF"
   End Select
End Sub


AnnSetPolyFillMode example for Visual Basic

   Dim nNodes As Integer, bShow As Boolean
   LEAD1.AnnSetFillPattern hPlgn, (LEAD1.AnnGetFillPattern (hPlgn) + 1) Mod 7, False
   LEAD1.AnnSetFillMode hPlgn, (LEAD1.AnnGetFillMode (hPlgn) + 1) Mod 3, False
   LEAD1.AnnSetPolyFillMode hPlgn, 1 - LEAD1.AnnGetPolyFillMode (hPlgn), False
   LEAD1.AnnSetLineStyle hPlgn, (LEAD1.AnnGetLineStyle (hPlgn) + 1) Mod 6, False
   LEAD1.AnnSetLineWidth hPlgn, (LEAD1.AnnGetLineWidth (hPlgn)) Mod 4 + 1, False
   nNodes = LEAD1.AnnGetNodes (hPlgn, bShow)
   LEAD1.AnnSetNodes hPlgn, bShow = False, (nNodes + 1) Mod LEAD1.AnnGetPointCount (hPlgn), False


AnnSetROP2 example for Visual Basic

   LEAD1.AnnSetROP2 hPlgn, (LEAD1.AnnGetROP2 (hPlgn) + 1) Mod 3, False


AnnSetSecondaryBitmap example for Visual Basic

   LEAD1.AnnSetSecondaryBitmap hPushPin, LEAD2.Bitmap, False
   LEAD1.AnnUserMode = ANNUSERMODE_RUN
   MsgBox "secondary bitmap set"
   LEAD1.Bitmap = LEAD1.AnnGetSecondaryBitmap (hPushPin)


AnnSetUnit example for Visual Basic

   Dim nUnit As Integer, nPrecision As Integer, Distance2 As Single
   LEAD1.AnnGetUnit hCrossProd, nUnit, nPrecision
   nUnit = (nUnit + 1) Mod 10
   LEAD1.AnnSetUnit hCrossProd, nUnit + ANNUNIT_DEF_ABBR, vbNullString, 2, False
   LEAD1.AnnSetGaugeLength hCrossProd, 3, False
   MsgBox "Unit: " & LEAD1.AnnGetUnit (hCrossProd, nUnit, nPrecision) & Chr(13) _
      & "Distance: " & LEAD1.AnnGetDistance (hCrossProd, Distance2) & Chr(13) _
      & "Gauge Length: " & LEAD1.AnnGetGaugeLength (hCrossProd)


AnnSetUser example for Visual Basic

Note: This topic is for Document/Medical only.

Private Sub Command8_Click()
   ' hide the selected objects
   LEAD1.AnnSetVisible LEAD1.AnnContainer, False, ANNFLAG_RECURSE + ANNFLAG_SELECTED, ""
   ' set the selected objects to belong to user XXX
   LEAD1.AnnSetUser LEAD1.AnnContainer, "", "xxx", True
End Sub


AnnSetWnd example for Visual Basic

   Dim oldWnd As OLE_HANDLE
   oldWnd = LEAD1.AnnGetWnd (hPlgn)
   LEAD1.AnnSetWnd hPlgn, Command1.hWnd
   LEAD1.AnnSetVisible hPlgn, False, 0, 0
   LEAD1.AnnSetVisible hPlgn, True, 0, 0
   MsgBox "will restore old window"
   LEAD1.AnnSetWnd hPlgn, oldWnd


AnnShowLockedIcon example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical only.

This example toggles the AnnShowLockedIcon property.

'Toggle AnnShowLockedIcon
    If Lead1.AnnShowLockedIcon = True Then
        Lead1.AnnShowLockedIcon = False
    Else
        Lead1.AnnShowLockedIcon = True
    End If


AnnToolChecked example for Visual Basic

Note: This topic is for Document/Medical only.

Private Sub LEAD1_AnnToolChecked(ByVal iTool As Integer)
Dim TestString As String

Select Case iTool
Case ANNTOOL_SELECT
  TestString = "Selection pointer tool"
Case ANNTOOL_LINE
  TestString = "Line tool"
Case ANNTOOL_RECT
  TestString = "Rectangle tool"
Case ANNTOOL_ELLIPSE
  TestString = "Ellipse tool"
.

.

.
Case Else
  TestString = "User defined tool"
End Select
MsgBox TestString, 0, "Notice"

End Sub


AnnToolDestroy example for Visual Basic

Note: This topic is for Document/Medical only.

Private Sub LEAD1_AnnToolDestroy()
MsgBox "You have closed the toolbar.", 0, "Notice"
End Sub


AnnUndo example for Visual Basic

' Make some changes and then call this method.
' See how the last change is undone.

LEAD1.AnnUndo


AnnUndoDepth example for Visual Basic

' This example increases the length of the undo stack

LEAD1.AnnUndoDepth = LEAD1.AnnUndoDepth + 5


AnnUndoEnable example for Visual Basic

' This example toggles the Undo feature

LEAD1.AnnUndoEnable = Not LEAD1.AnnUndoEnable


AnnUngroup example for Visual Basic

Note: This topic is for Document/Medical  only.

Private Sub Command7_Click()
   LEAD1.AnnUngroup LEAD1.AnnContainer, ANNFLAG_SELECTED + ANNFLAG_RECURSE, ""
End Sub


AnnUnlock example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This is also the example for AnnGetLocked method.

If an object is found to be locked, using AnnGetLocked method, the object is unlocked, by AnnUnlock, using the key "IkeStarnes".

Dim bLocked As Boolean

    bLocked = Lead1.AnnGetLocked(ghObject)
    If bLocked = True Then
        Lead1.AnnUnlock ghObject, "IkeStarnes"
    End If


AnnUnlocked example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

The following is an example of an AnnUnlocked event.

Private Sub Lead1_AnnLocked (ByVal hObject As Long)
    MsgBox "AnnObject: " & CStr(hObject) & " was unlocked!"
End Sub


AnnUnrealize example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical only.

The following example calls the AnnUnrealize method.

'Unrealize all redact objects in the container
    Lead1.AnnUnrealize Lead1.AnnContainer, False


AntiAlias example for Visual Basic

   LEAD1.AntiAlias 128, 3, ANTIALIAS_1


Appearance (ImageList Control) example for Visual Basic

    'set the control to have 3d appearance
    LEADImgList1.Appearance = APPEARANCE_THREED


Appearance example for Visual Basic

Note: Also works with Access 95 and 97.

This example toggles the Appearance property.

If Lead1.Appearance = APPEARANCE_FLAT Then
   Lead1.Appearance = APPEARANCE_THREED
Else
   Lead1.Appearance = APPEARANCE_FLAT
End If


AutoAnimate example for Visual Basic

Note: Also works with Access 95 and 97.

This example gets information about an animated file, uses the information to position the LEAD control, and plays the animation as it loads the file.

' Declare variables for positioning the control.
Dim DisplayWidth, DisplayHeight, DisplayLeft, DisplayTop
Dim HeightFactor, WidthFactor, HeightAllowed, WidthAllowed

' Force continued looping after the file loads.
Lead1.AutoAnimationLoop = AUTOANIMATIONLOOP_INFINITE

' Get information about the file we will load.
Lead1.GetFileInfo "c:\windows\system\wndsurf1.avi", 0, 0

' Exit if this is not an animated file.
If Lead1.InfoAnimation = False Then
   MsgBox "Not an animated file", 0, "Error"
Else
  ' Calculate information for centering the LEAD control.
  'Set the variables used for preserving the aspect ratio.
  'Allow for a border of 1/8 of the form size.
  'The units of measure do not matter, since we are calculating proportions.
  HeightFactor = Lead1.InfoHeight
  WidthFactor = Lead1.InfoWidth
  HeightAllowed = ScaleHeight * 3 / 4
  WidthAllowed = ScaleWidth * 3 / 4

  'Center the LEAD control on the form, preserving the aspect ratio.
  'Check to see if using the maximum width will make the image too tall.
  'Set the dimensions based on the result.
  If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
    Lead1.Left = ScaleWidth / 8
    Lead1.Width = WidthAllowed
    Lead1.Height = (Lead1.Width * HeightFactor) / WidthFactor
    Lead1.Top = (ScaleHeight - Lead1.Height) / 2
  Else
    Lead1.Top = ScaleHeight / 8
    Lead1.Height = HeightAllowed
    Lead1.Width = (Lead1.Height * WidthFactor) / HeightFactor
    Lead1.Left = (ScaleWidth - Lead1.Width) / 2
  End If

  ' Set properties for playing the animation as is loads.
  Lead1.AutoAnimate = True
  Lead1.AutoRepaint = True
  ' Load the animated file.
  Lead1.Load "c:\windows\system\wndsurf1.avi", 0, 0, -1
End If


AutoPan example for Visual Basic

Lead1.Load "v:\images\babe.cmp", 0, 1, 1
Lead1.AutoPan = True


AutoSegment (Mixed Raster Content Control) example for Visual Basic

Private Sub Command1_Click()
   LEADMrc1.Bitmap= LEAD1.Bitmap
   LEADMrc1.BaseBackColor= RGB(200, 255, 255)
   LEADMrc1.BaseForeColor= RGB(0, 80, 0)
   LEADMrc1.StripeMaxHeight= 100
   LEADMrc1.AutoSegment 60, 40, 30
   Caption = "Picture segments will be green-hashed"
End Sub

Private Sub LEADMrc1_AutoSegment (ByVal nStripeNo As Long, ByVal nStripeStartRow As Long, ByVal nStripeEndRow As Long, ByVal nSegmentNo As Long, ByVal SegmentLeft As Long, ByVal SegmentTop As Long, ByVal SegmentRight As Long, ByVal SegmentBottom As Long, ByVal SegType As LEADMrcLibCtl.MRCSegmentTypeConstants, ByVal TextForeColor As stdole.long, ByVal TextBackColor As stdole.long)
   LEAD1.DrawFillStyle= DRAWFILLSTYLE_DIAGONAL_CROSS
   LEAD1.DrawPenWidth= 6
   LEAD1.DrawPenColor= vbYellow
   If SegType = SEGMENT_PICTURE Then
      LEAD1.DrawFillColor= vbGreen
   Else
      LEAD1.DrawFillColor = vbRed
   End If
   LEAD1.DrawRectangle SegmentLeft, SegmentTop, SegmentRight - SegmentLeft, SegmentBottom - SegmentTop
End Sub


AutoSize example for Visual Basic

Note: Also works with Access 95 and 97.

This example shows how the AutoSize property works when loading and when rotating an image.

Lead1.AutoSize = True
Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1
MsgBox "Control is sized to fit the loaded bitmap"
Lead1.Rotate 4500, ROTATE_RESIZE, RGB(0, 0, 0)
MsgBox "Control is sized to fit the rotated bitmap"


AutoTrim example for Visual Basic

Note: Also works with Access 95 and 97.

This example scans a document and trims the edges.

'Make sure display rectangles are reset when we acquire the image.
Lead1.AutoSetRects = True

'Disable automatic repainting.
Lead1.AutoRepaint = False

'Acquire the image, allowing for possible mistakes.
SavedSetting = Lead1.EnableMethodErrors
Lead1.EnableMethodErrors = False
nRet = Lead1.Load("d:\temp\test.tif", 0, 1, 1)
If nRet <> 0 Then
    MsgBox "image not loaded"
    Lead1.EnableMethodErrors = SavedSetting
    GoTo FINISHED
End If
Lead1.EnableMethodErrors = SavedSetting

'Trim the edges of the acquired bitmap.
Lead1.AutoTrim (64)

'Use the whole window.
Lead1.Top = 0
Lead1.Left = 0
Lead1.Width = ScaleWidth
Lead1.Height = ScaleHeight

'Set up for good display of a typical scanned document.
Lead1.BitonalScaling = BITONALSCALING_SCALETOGRAY
Lead1.AutoScroll = True
Lead1.DstWidth = Lead1.ScaleWidth 'Use the full control width.
Lead1.DstClipWidth = Lead1.ScaleWidth
CalcHeight = (Lead1.BitmapHeight * Lead1.ScaleWidth) / Lead1.BitmapWidth
Lead1.DstHeight = CalcHeight 'Use the proportional height.
Lead1.DstClipHeight = CalcHeight

'Enable automatic repainting.
Lead1.AutoRepaint = True

FINISHED:


Average example for Visual Basic

Note: Also works with Access 95 and 97.

This example applies an average filter with a 3x3 neighborhood and redisplays the bitmap.

Lead1.Average 3
Lead1.ForceRepaint


BackColor (ImageList Control) example for Visual Basic

'This example sets the background color to red.

LEADImgList1.BackColor = RGB(255,0,0)


BackColor example for Visual Basic

Note: Also works with Access 95 and 97.

This example sets the background color to red. You can zoom out to see the background color.

Lead1.BackColor = RGB(255,0,0)


BackErase example for Visual Basic

Note: Also works with Access 95 and 97.

This example turns off repainting of the background, then zooms out to show the effect when repainting.

Lead1.BackErase = False
Lead1.AutoRepaint = False
Lead1.AutoScroll = False

'Calculate the values to zoom out by 10 percent and center the image.
Lead1.DstWidth = Lead1.DstWidth * 0.9
Lead1.DstHeight = Lead1.DstHeight * 0.9
Lead1.DstTop = (Lead1.ScaleHeight - Lead1.DstHeight) / 2
Lead1.DstLeft = (Lead1.ScaleWidth - Lead1.DstWidth) / 2

'Set the clipping area to the same as the destination rectangle
Lead1.DstClipWidth = Lead1.DstWidth
Lead1.DstClipHeight = Lead1.DstHeight
Lead1.DstClipTop = Lead1.DstTop
Lead1.DstClipLeft = Lead1.DstLeft

'Redisplay the image
Lead1.ForceRepaint


BalanceColors example for Visual Basic

   Const RedFactToRed = 0.25
   Const RedFactToGreen = 0.5
   Const RedFactToBlue = 0.25
   Const GreenFactToRed = 0.3
   Const GreenFactToGreen = 0.4
   Const GreenFactToBlue = 0.3
   Const BlueFactToRed = 0.1
   Const BlueFactToGreen = 0.6
   Const BlueFactToBlue = 0.3
   LEAD1.BalanceColors RedFactToRed, RedFactToGreen, RedFactToBlue, GreenFactToRed, GreenFactToGreen, GreenFactToBlue, BlueFactToRed, BlueFactToGreen, BlueFactToBlue


BinaryFilter example for Visual Basic

This example does omni-directional erosion of black objects and repaints the image.

Lead1.BinaryFilter BFLT_EROSION_OMNI
Lead1.ForceRepaint


BitmapAlpha example for Visual Basic

Note: Also works with Access 95 and 97.

This example shows how to use the BitmapAlpha property to save a region in a file's alpha channel. It also shows how to use the region as a mask for transparency.

   Dim rgntop As Single
   Dim rgnleft As Single
   Dim rgnwidth As Single
   Dim rgnheight As Single
   Dim hRGN As Long
   Dim test As Long

   LEAD1.ScaleMode = 3
   LEAD1.Load "v:\images\eagle.cmp", 0, 0, 1
   LEAD1.AutoRepaint = False
   'Get an alpha channel bitmap, and fill it with white
   LEAD2.Bitmap = LEAD1.BitmapAlpha
   LEAD2.SetRgnColor RGB(0, 0, 0), L_RGN_SETNOT

   test = LEAD2.GetRgnArea
   ' test here is test = 0, then Alpha is all black
   If test = 0 Then
      MsgBox "Alpha image is all black"
   End If

   LEAD2.Fill RGB(255, 255, 255)
   rgntop = 0
   rgnleft = 0
   rgnwidth = LEAD1.BitmapWidth
   rgnheight = LEAD1.BitmapHeight

   'Create an elliptical region in the AlphaBitmap
   LEAD2.SetRgnEllipse rgntop, rgnleft, rgnwidth, rgnheight, L_RGN_SET
   'Fill the region with black
   LEAD2.Fill RGB(0, 0, 0)
   'Free the region
   LEAD2.FreeRgn
   'Update the alpha channel in the main bitmap
   LEAD1.BitmapAlpha = LEAD2.Bitmap
   'Save the bitmap as 32-bit TGA
   LEAD1.Save "test.tga", FILE_TGA, 32, 0, SAVE_OVERWRITE
   'Free the bitmaps
   LEAD1.Bitmap = 0
   LEAD2.Bitmap = 0

   'Load the bitmap we just saved and get the alpha channel
   LEAD1.Load "test.tga", 0, 0, 1
   LEAD2.Bitmap = LEAD1.BitmapAlpha
   'Create a region in the AlphaBitmap that includes all of the black pixels
   LEAD2.SetRgnColor RGB(0, 0, 0), L_RGN_SET
   'Get the region from the AlphaBitmap and set it into the main bitmap
   hRGN = LEAD2.GetRgnHandle
   LEAD1.SetRgnHandle hRGN, 0, 0, L_RGN_SET
   LEAD1.PaintRgnOnly = True
   LEAD1.ForceRepaint


BitmapCompression example for Visual Basic

' This example toggles the bitmap’s compression
Dim oldSize As Long
oldSize = LEAD1.BitmapSize

If LEAD1.BitmapCompression = COMP_NONE Then
   ' Compress the bitmap
   If LEAD1.BitmapBits = 24 Then
      LEAD1.BitmapCompression = COMP_SUPER
   ElseIf LEAD1.BitmapBits = 1 Then
      LEAD1.BitmapCompression = COMP_RLE
   End If
Else
   ' Bitmap is compressed. Uncompress it
   LEAD1.BitmapCompression = COMP_NONE
End If

MsgBox "old Size = " + CStr(oldSize) + vbCr + "New Size = " + CStr(LEAD1.BitmapSize)


BitmapDataPath example for Visual Basic

Note: Also works with Access 95 and 97.

This example shows how to load an image from the Internet. It uses the BitmapDataPath property to start the asynchronous load; then uses the ReadyStateChange event to paint the image when loading is complete.

Private Sub Command1_Click()
    ' Start the asynchronous load.
    Lead1.BitmapDataPath = "http://www.leadtools.com/images/vbaward.jpg"
End Sub

Private Sub Lead1_ReadyStateChange(ReadyState As Long)
    ' Paint the image when loading is complete.
    If ReadyState = READYSTATE_COMPLETE Then
        Lead1.AutoSetRects = True
        Lead1.PaintSizeMode = PAINTSIZEMODE_FIT
        Lead1.ForceRepaint
    End If
End Sub


BitmapDataPathClosed example for Visual Basic

Public BmpClosed As Boolean

Private Sub Command1_Click()
    BmpClosed = True
    LEAD1.BitmapDataPath = "http://www.leadtools.com/Home2/vertmkts/images/v13web.jpg"

    While BmpClosed
      DoEvents
    Wend

    LEAD1.BitmapDataPath = "http://www.leadtools.com/images/end-user.jpg"
End Sub

Private Sub LEAD1_BitmapDataPathClosed()
   BmpClosed = False
End Sub


BitmapDpi example for Visual Basic

   Dim x, y
   hAuto = LEAD1.AnnCreate (ANNOBJECT_AUTOMATION, False, False)
   x = LEAD1.AnnGetBitmapDpiX (hAuto)
   y = LEAD1.AnnGetBitmapDpiY (hAuto)
   MsgBox x & ", " & y
   LEAD1.AnnSetBitmapDpiX hAuto, x + 2, False
   LEAD1.AnnSetBitmapDpiY hAuto, y + 2, False
   x = LEAD1.AnnGetBitmapDpiX(hAuto)
   y = LEAD1.AnnGetBitmapDpiY(hAuto)
   MsgBox x & ", " & y


BitmapToClient example for Visual Basic

    Dim szOut As String

    'Test a bitmap location for its screen location
    LEAD1.ScaleMode = 3 'pixels b/c I'm passing pixels
    LEAD1.BitmapToClient 50, 50
    szOut = ""
    szOut = szOut + "ClientX = " & CStr(LEAD1.ConvertX) & Chr(10) & Chr(13)
    szOut = szOut + "ClientY = " & CStr(LEAD1.ConvertY) & Chr(10) & Chr(13)
    MsgBox szOut


BitmapXres and BitmapYres example for Visual Basic

Note: Also works with Access 95 and 97.

This example sets the bitmap's resolution to 300 x 600 DPI.

Lead1.BitmapXres = 300
Lead1.BitmapYres = 600


BitonalScaling (ImageList Control) example for Visual Basic

    'set the control to use scale to gray
    LEADImgList1.BitonalScaling = BITONALSCALING_SCALETOGRAY


BitonalScaling example for Visual Basic

Note: Also works with Access 95 and 97.

This example sets the display to use scale-to-gray and repaints the image. This affects only 1-bit images.

If Lead1.IsSupportLocked(L_SUPPORT_DOCUMENT) Then
   MsgBox "No scale to gray - You need to unlock Document/Medical capabilities"
Else
   Lead1.BitonalScaling = BITONALSCALING_SCALETOGRAY
   Lead1.ForceRepaint
End If


BorderColor (ImageList Control) example for Visual Basic

'This sets the border style to Fixed Single.
'And sets the border color to red.
LEADImgList1.Appearance = APPEARANCE_FLAT
LEADImgList1.BorderStyle = 1
LEADImgList1.BorderColor = RGB(255, 0, 0)


BorderRemove example for Visual Basic

Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Public hRgnAll As Long
Private Const RGN_OR = 2

    Dim szBorder As String
    CombineRgn hRgnAll, hRgnAll, hRgn, RGN_OR
    Select Case (uBorderToRemove)
        Case BORDER_TOP:
            szBorder = "Top"
        Case BORDER_LEFT:
            szBorder = "Left"
        Case BORDER_RIGHT:
            szBorder = "Right"
        Case BORDER_BOTTOM:
            szBorder = "Bottom"
    End Select
    Debug.Print "Border - " & szBorder & " Bounds:" & CStr(fBoundingRectLeft) & ", " & CStr(fBoundingRectTop) & ", " & CStr(fBoundingRectWidth) & ", " & CStr(fBoundingRectHeight); ""
    LEAD1.DocCleanSuccess = SUCCESS_REMOVE

Private Sub LEAD1_BorderRemove (ByVal hRgn As Stdole.OLE_HANDLE, ByVal uBorderToRemove As Long, ByVal fBoundingRectLeft As Single, ByVal fBoundingRectTop As Single, ByVal fBoundingRectWidth As Single, ByVal fBoundingRectHeight As Single)
    Dim szBorder As String
    CombineRgn hRgnAll, hRgnAll, hRgn, RGN_OR
    Select Case (uBorderToRemove)
        Case BORDER_TOP:
            szBorder = "Top"
        Case BORDER_LEFT:
            szBorder = "Left"
        Case BORDER_RIGHT:
            szBorder = "Right"
        Case BORDER_BOTTOM:
            szBorder = "Bottom"
    End Select
    Debug.Print "Border - " & szBorder & " Bounds:" & CStr(fBoundingRectLeft) & ", " & CStr(fBoundingRectTop) & ", " & CStr(fBoundingRectWidth) & ", " & CStr(fBoundingRectHeight); ""
    LEAD1.DocCleanSuccess = SUCCESS_REMOVE
End Sub


BorderStyle example for Visual Basic

Note: Also works with Access 95 and 97.

This example toggles the border style and repaints the image.

If Lead1.BorderStyle = 1 Then
   Lead1.BorderStyle = 0
Else
   Lead1.BorderStyle = 1
End If
Lead1.ForceRepaint


BrowseDir (Thumbnail Browser Control) example for Visual Basic

LEADThumb1.EnableMethodErrors = False
    LEADThumb1.StopOnError = True

    LEADThumb1.Filter = "*.jpg" 'search for JPEG files

    LEADThumb1.ThumbnailWidth = 150
    LEADThumb1.ThumbnailHeight = 150
    LEADThumb1.ThumbnailBitsPerPixel = 0

    LEADThumb1.MaintainAspect = True
    LEADThumb1.ForceSize = True
    LEADThumb1.ThumbnailBackgroundColor = RGB(0, 255, 0)

    LEADThumb1.LoadStamp = True
    LEADThumb1.Resample = True

    LEADThumb1.IncludeSubDirectories = False

    LEADThumb1.ExpandMultipage = False

    LEADThumb1.MaxSizeDisk = 0 'no filesize limit
    LEADThumb1.MaxSizeMem = 4096000 'set a image size limit

    LEADThumb1.DitherFlags = CRD_STUCKIDITHERING
    LEADThumb1.PaletteFlags = CRP_FIXEDPALETTE

    LEADThumb1.BrowseDir "f:\images\new"


ButtonColumns example for Visual Basic

Private Sub Command3_Click()
   LEAD1.AnnToolbar.ButtonColumns = LEAD1.AnnToolbar.ButtonColumns + 1
End Sub


ButtonMenuTool example for Visual Basic

   ' make the first rubber stamp tool draw a rectangle
   For i = 0 To LEAD1.AnnToolbar.ButtonCount - 1
      ' is this the button with the rubber stamps ?
      If LEAD1.AnnToolbar.ButtonToolCount(i) > 1 Then
         LEAD1.AnnToolbar.ButtonMenuTool(i, 0) = ANNTOOL_RECT
      End If
   Next


ButtonRows example for Visual Basic

Private Sub Command2_Click()
   LEAD1.AnnToolbar.ButtonRows = LEAD1.AnnToolbar.ButtonRows + 1
End Sub


ButtonVisible example for Visual Basic

   ' hide/show the first toolbar button
   LEAD1.AnnToolbar.ButtonVisible(0) = Not
LEAD1.AnnToolbar.ButtonVisible(0)


Capture example for Visual Basic

This example captures the current form and displays the captured image with scroll bars.

'Turn on the automatic display rectangles.
Lead1.AutoSetRects = True

'Set the scale mode to twips temporarily
OldMode = Lead1.ScaleMode
Lead1.ScaleMode = 1

Lead1.Capture 0, Left, Top, Width, Height
Lead1.AutoScroll = True
Lead1.ForceRepaint

'Set the scale mode to the previous mode
Lead1.ScaleMode = OldMode


CenterImage example for Visual Basic

'toggle CenterImage
LEAD1.CenterImage = Not LEAD1.CenterImage


Change example for Visual Basic

Note: Also works with Access 95 and 97.

Typically, you would use this event to flag changed image data and prompt the user to save the changes before closing a window or exiting an application.  That use of the event cannot be tested properly without writing a complete application; so this example just shows you a simple test of the event.

Private Sub Lead1_Change()
    MsgBox "Image data changed"
End Sub


Clear (ImageList Control) example for Visual Basic

'empty the current list
LEADImgList1.Clear


Click and MouseIcon example for Visual Basic

This example demonstrates the Click event and the MouseIcon property.

Private Sub Lead1_Click()
    'This example, on a click event, toggles between the default
    'mouse pointer and a loaded icon.
    If Lead1.MousePointer = 0 Then
        Lead1.MouseIcon = LoadPicture("c:\vb\icons\arrows\point04.ico")
        Lead1.MousePointer = 99
    Else
        Lead1.MousePointer = 0
    End If
End Sub


ClientToBitmap example for Visual Basic

Private Sub LEAD1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim BitmapX As Single
    Dim BitmapY As Single

    BitmapX = x
    BitmapY = y
    LEAD1.ScaleMode = 1 'twips b/c that's what we get in VB's MouseDown
    LEAD1.ClientToBitmap BitmapX, BitmapY

    'Change that pixel to White
    LEAD1.Pixel(LEAD1.ConvertX, LEAD1.ConvertY) = vbWhite
End Sub


ColorRes example for Visual Basic

This example checks to see if the bitmap is 8 bits per pixel and converts it if it is not.

If Lead1.BitmapBits <> 8 Then
    MousePointer = 11 ' hourglass
    Lead1.ColorRes 8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0
    Lead1.ForceRepaint
    MousePointer = 0 ' default
End If


ColorResList example for Visual Basic

Note: Also works with Access 95 and 97.

This example changes the hue of bitmaps in a list, then plays the list as an animation. When changing the hue, it preserves the transparent color.

Dim i As Integer  ' Loop counter
Dim uCount As Integer ' Number of bitmaps in the list
Dim TransparentColor As Long ' Color used for transparency

' Save the current transparent color.
TransparentColor = Lead1.BitmapTransparentColor

' Avoid repaints while we modify the bitmaps.
Lead1.AutoRepaint = False

' Change the hue of each bitmap in the list,
' and restore the transparent color as the last color in the palette.
uCount = Lead1.BitmapListCount
For i = 0 To uCount - 1
   Lead1.BitmapListIndex = i
   Lead1.Hue i * 10
   Lead1.BitmapPalette(255) = TransparentColor
Next i

' Get an optimized palette for the whole list.
Lead1.ColorResList 8, CRP_OPTIMIZEDPALETTE, CRD_NODITHERING, 0

' Update the palette that is used for playback.
For i = 0 To 255
   Lead1.AnimationPalette(i) = Lead1.BitmapPalette(i)
Next i

' Start the animation.
Lead1.AutoRepaint = True
Lead1.AnimationEnable = True


Combine example for Visual Basic

This example copies the Lead1 bitmap to Lead2, trims and filters the copied image, and combines the filtered image with the original Lead1 bitmap image. Trimming Lead2 lets you see the difference between filtered and nonfiltered regions.

MousePointer = 11 ' hourglass
Lead2.Bitmap = Lead1.Bitmap

TrimLeft = (Lead2.BitmapWidth * 0.2)
TrimTop = (Lead2.BitmapHeight * 0.2)
TrimWidth = (Lead2.BitmapWidth * 0.6)
TrimHeight = (Lead2.BitmapHeight * 0.6)
Lead2.Trim TrimLeft, TrimTop, TrimWidth, TrimHeight

Lead2.SpatialFilter (FLT_LINESEG_LTOR)

DstLeft = TrimLeft
DstTop = TrimTop
DstWidth = TrimWidth
DstHeight = TrimHeight
SrcLeft = 0
SrcTop = 0
Lead1.Combine DstLeft, DstTop, DstWidth, DstHeight, Lead2.Bitmap, SrcLeft, SrcTop, CB_OP_ADD

Lead1.ForceRepaint
MousePointer = 0 ' default


CombineBitmapWarp example for Visual Basic

   Dim xPt(4) As Single
   Dim yPt(4) As Single
   Dim nRet As Integer

 ‘ Load master bitmap
   LEADMaster.Load "C:\master.jpg", 0, 1, 1
 ‘ Load slave bitmap
   LEADSlave.Load "C:\slave.jpg", 0, 1, 1

 ‘ Set the rectangle point
   xPt(0) = 50
   yPt(0) = 50
   xPt(1) = 150
   yPt(1) = 50
   xPt(2) = 150
   yPt(2) = 150
   xPt(3) = 50
   yPt(3) = 150

 ‘ Combine
   nRet = LEADMaster.CombineBitmapWarp(xPt, yPt, 4, LEADSlave.Bitmap, 0, 0, LEADSlave.BitmapWidth, LEADSlave.BitmapHeight, CBW_BILINEAR + CBW_RESERVED8)


CombineExt example for Visual Basic

This example copies the Lead1 bitmap to Lead2, trims and filters the copied image, and combines the filtered image with the original Lead1 bitmap image. Trimming Lead2 lets you see the difference between filtered and nonfiltered regions.

   Dim TrimLeft As Single, TrimTop As Single, TrimWidth As Single, TrimHeight As Single
   Dim DstLeft As Single, DstTop As Single, DstWidth As Single, DstHeight As Single
   Dim SrcLeft As Single, SrcTop As Single
   LEAD2.Bitmap = LEAD1.Bitmap
   TrimLeft = (LEAD2.BitmapWidth * 0.2)
   TrimTop = (LEAD2.BitmapHeight * 0.2)
   TrimWidth = (LEAD2.BitmapWidth * 0.6)
   TrimHeight = (LEAD2.BitmapHeight * 0.6)
   LEAD2.Trim TrimLeft, TrimTop, TrimWidth, TrimHeight
   LEAD2.SpatialFilter FLT_LINESEG_HORZ
   DstLeft = TrimLeft
   DstTop = TrimTop
   DstWidth = TrimWidth
   DstHeight = TrimHeight
   SrcLeft = 0
   SrcTop = 0
   LEAD1.CombineExt DstLeft, DstTop, DstWidth, DstHeight, LEAD2.Bitmap, SrcLeft, SrcTop, CB_OP_ADD
   LEAD1.ForceRepaint


Comment example for Visual Basic

Note: Also works with Access 95 and 97.

This example does the following:

1.	Loads an image from a TIFF file.

2.	Updates the current comment array by reading comments from the file.

3.	Modifies one of the comments.

4.	Modifies and saves the file.

5.	Reads the comment that was saved, and displays it in a message box.

This example handles only string comments. For more complex comments, refer to Exif examples.

Dim MyCommentText As String 'String for CMNT_SZDESC
Dim NewCommentText As String 'String for CMNT_SZDESC that we read
Dim FilePath As String 'File to be updated
Dim i As Long 'Loop counter and array index

'Specify the file that we will update.
FilePath = "d:\lead\images\testcmt.tif"

'Get all of the current comments from the file.
'Temporarily disable method errors so that we do not fail when comments are missing.
Lead1.EnableMethodErrors = False
For i = 0 To CMNT_LAST
  Lead1.Comment(i) = Empty
  Lead1.Comment(i) = Lead1.ReadComment(FilePath, 0, i)
Next i
Lead1.EnableMethodErrors = True

'Load and modify the image.
Lead1.Load FilePath, 0, 0, 1
Lead1.Reverse

'Update the CMNT_SZDESC comment.
MyCommentText = Chr(13) + "This image has been reversed."
Lead1.Comment(CMNT_SZDESC) = Lead1.Comment(CMNT_SZDESC) + MyCommentText

'Save the file and read the comment that we saved.
Lead1.Save FilePath, FILE_TIF, Lead1.BitmapBits, 0, SAVE_OVERWRITE
NewCommentText = Lead1.ReadComment(FilePath, 0, CMNT_SZDESC)

'Display the message
MsgBox NewCommentText

'Clear the comments from memory
For i = 0 To CMNT_LAST
  Lead1.Comment(i) = Empty
Next i


ContinueBrowse (Thumbnail Browser Control) example for Visual Basic

'in this example, nCount is a global variable used to count the thumbnails

Private Sub LEADThumb1_ThumbnailEvent(ByVal Bitmap As Long, ByVal pszFilename As String, ByVal nStatusCode As Integer, ByVal nPercent As Integer)
    If (nStatusCode = 0) Then 'successful thumbnail generation
        'save thumbnails in a multipage TIFF file
        LEAD1.Bitmap = Bitmap
        LEAD1.Save "d:\temp\thumbs.tif", FILE_TIF, 24, 0, SAVE_APPEND
        nCount = nCount + 1
        If nCount > 20 Then 'allow max of 20 thumbnails
            LEADThumb1.ContinueBrowse = False 'stop the browse
            Exit Sub
        End If
    End If
    LEADThumb1.ContinueBrowse = True 'continue the browse operation
End Sub


ContourFilter example for Visual Basic

On Error GoTo ContourError
   LEADDlg1.UIFlags = DLG_CONTOUR_SHOWPREVIEW + DLG_CONTOUR_OPTION + DLG_CONTOUR_THRESHOLD + _
                      DLG_CONTOUR_DELTADIRECTION + DLG_CONTOUR_MAXIMUMERROR + DLG_CONTOUR_95CONTEXTHELP
   LEADDlg1.ContourOptionFlags = DLG_CONTOUR_OPTION_THIN + DLG_CONTOUR_OPTION_LINK_BW + DLG_CONTOUR_OPTION_LINK_GRAY + _
                      DLG_CONTOUR_OPTION_LINK_COLOR + DLG_CONTOUR_OPTION_APPROX_COLOR
   LEADDlg1.Bitmap = LEAD1.Bitmap
   LEADDlg1.GetContourFilter hWnd
   LEADDlg1.Bitmap = 0

   LEAD1.ContourFilter LEADDlg1.ContourThreshold, LEADDlg1.ContourDeltaDirection, LEADDlg1.ContourMaximumError, LEADDlg1.ContourOption
   Exit Sub
ContourError:
   If Err.Number <> ERROR_DLG_CANCELED Then
      MsgBox Err.Source + " " + CStr(Err.Number) + Chr(13) + Err.Description
   End If


Contrast example for Visual Basic

Note: Also works with Access 95 and 97.

This example increases the contrast and repaints the image.

Lead1.Contrast 50
Lead1.ForceRepaint


Create example for Visual Basic

Private Sub Command1_Click()
   LEAD1.AutoPan = False
   LEAD1.AnnToolbar.Visible = False
   LEAD1.AnnToolbar.Create 0, 0, ANNTOOLALIGN_TOP + ANNTOOLALIGN_LEFT

   LEAD1.AnnToolbar.AutoSetTool = True
   LEAD1.AnnToolbar.ButtonTool(LEAD1.AnnToolbar.ButtonCount) = ANNTOOL_USER_FIRST

   LEAD1.Load "d:\ltwin14x\images\Ulay1.bmp", 0, 0, 1
   LEAD1.AnnToolbar.ButtonBitmapUp(LEAD1.AnnToolbar.ButtonCount) = LEAD1.Bitmap
   LEAD1.Load "d:\ltwin14x\images\Ulay2.bmp", 0, 0, 1
   LEAD1.AnnToolbar.ButtonBitmapDown(LEAD1.AnnToolbar.ButtonCount) = LEAD1.Bitmap
   LEAD1.Load "d:\ltwin14x\images\image1.cmp", 0, 0, 1
   LEAD1.AnnToolbar.ButtonToolTipTextID(LEAD1.AnnToolbar.ButtonCount) = -1
   LEAD1.AnnToolbar.ButtonToolTipText(LEAD1.AnnToolbar.ButtonCount) = "User defined tool"

   LEAD1.AnnToolbar.ButtonCount = LEAD1.AnnToolbar.ButtonCount + 1
   LEAD1.AnnToolbar.Visible = True
   LEAD1.AnnUserMode = ANNUSERMODE_DESIGN

   LEAD1.AnnToolbar.ButtonMenuTextID(13, 1) = -1
   LEAD1.AnnToolbar.ButtonMenuText(13, 1) = "My text"
End Sub


CreateUserBitmap example for Visual Basic

' allocate memory for a 640x480x24 bpp image
Dim lDataSize As Long
Dim BitmapData(640# * 480 * 24 / 8) As Byte

lDataSize = 640# * 480 * 24 / 8

' make sure I am using pixels
LEAD1.ScaleMode = 3

' Create the user bitmap
LEAD1.CreateUserBitmap 640, 480, 24, Empty, 0

' fill the bitmap data with gray
For i = 0 To lDataSize - 1
   BitmapData(i) = 128 ' gray
Next

' set the bitmap data pointer
LEAD1.SetBitmapDataPointer BitmapData, lDataSize

' save the bitmap
LEAD1.Save "c:\gray.jpg", FILE_JPEG, 0, 25, SAVE_OVERWRITE

' reset the bitmap data pointer, because the BitmapData array
' will be freed when we exit this function
LEAD1.SetBitmapDataPointer Empty, 0
End Sub

Private Sub Command2_Click()
LEAD1.Load "c:\gray.jpg", 0, 0, 1
End Sub


ConvertToColoredGray example for Visual Basic

   Const RedFact = 300
   Const GreenFact = 590
   Const BlueFact = 110
   Const RedGrayFact = 500
   Const GreenGrayFact = 300
   Const BlueGrayFact = 200
   LEAD1.ConvertToColoredGray RedFact, GreenFact, BlueFact, RedGrayFact, GreenGrayFact, BlueGrayFact


Create Bitmap, Size, and Combine example for Visual Basic

This example creates a bitmap for Lead2 (same size and BPS as Lead 1) and fills it with green. It resizes the Lead1 bitmap, then uses a loop to do multiple combines with the Lead2 bitmap. It then copies the Lead2 bitmap to Lead1 and redisplays Lead1.

MousePointer = 11 ' hourglass

' Create the Lead2 bitmap. (The control must already be on the form).
MyWidth = Lead1.BitmapWidth
MyHeight = Lead1.BitmapHeight
MyBPS = Lead1.BitmapBits
Lead2.CreateBitmap MyWidth, MyHeight, MyBPS
Lead2.Fill RGB(0, 255, 0) ' fill with green

' Resize the Lead1 bitmap
ImageWidth = CInt(MyWidth * 0.3)
ImageHeight = CInt(MyHeight * 0.3)
Lead1.Size ImageWidth, ImageHeight, RESIZE_RESAMPLE

' Initialize the variables used for multiple combines.
TestWidth = MyWidth ' Used for horizontal positioning
TestHeight = MyHeight ' Used for vertical positioning

VFactor = Int(MyHeight / ImageHeight) + 1 ' Number spaces between images
VSpacing = CInt((MyHeight Mod ImageHeight) / VFactor) ' Pixels between images

HFactor = Int(MyWidth / ImageWidth) + 1 ' Number spaces between images
HSpacing = CInt((MyWidth Mod ImageWidth) / HFactor) ' Pixels between images

DstT = VSpacing ' Top coordinate of the destination rectangle
SrcL = 0 ' Left coordinate of the source rectangle
SrcT = 0 ' Top coordinate of the source rectangle
DstW = ImageWidth  ' Width of the destination rectangle
DstH = ImageHeight ' Height of the destination rectangle
MyOp = CB_OP_ADD + CB_DST_0 ' Operation flags used when combining images

' Do the loop that does the multiple combines
While TestHeight > ImageHeight ' Vertical loop
    DstT = MyHeight - TestHeight + VSpacing
    TestHeight = TestHeight - ImageHeight - VSpacing
    While TestWidth > ImageWidth 'Horizontal loop
        DstL = MyWidth - TestWidth + HSpacing
        TestWidth = TestWidth - ImageWidth - HSpacing
        Lead2.Combine DstL, DstT, DstW, DstH, Lead1.Bitmap, SrcL, SrcT, MyOp
    Wend
    TestWidth = MyWidth
Wend

' Copy the Lead2 bitmap to Lead1
Lead1.Bitmap = Lead2.Bitmap

'Set the image display size to match the LEAD control
Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
Lead1.ForceRepaint ' Repaint the image
MousePointer = 0 ' default


CreateThumbnailFromFile example for Visual Basic

Private Sub Command1_Click()
    LEADThumb1.LoadStamp = False
    LEADThumb1.ForceSize = True
    LEADThumb1.ThumbnailBackgroundColor = vbGreen
    LEADThumb1.ThumbnailWidth = 80
    LEADThumb1.ThumbnailHeight = 40

    LEADThumb1.CreateThumbnailFromFile "c:\temp\testdb6.tif", 1
    LEADThumb1.CreateThumbnailFromFile "c:\temp\testdb6.tif", 2
    LEADThumb1.CreateThumbnailFromFile "c:\temp\testdb6.tif", 3
End Sub

Private Sub LEADThumb1_ThumbnailEvent(ByVal Bitmap As Long, ByVal pszFilename As String, ByVal nStatusCode As Integer, ByVal nPercent As Integer)
    If (nStatusCode = 0 And nPercent = 0 And Bitmap <> 0) Then
        LEAD1.Bitmap = Bitmap
        MsgBox "pause"
    End If
End Sub


CurveToBezier example for Visual Basic

Private Declare Function PolyBezier Lib "gdi32" (ByVal hdc As Long, lppt As POINTAPI, ByVal cPoints As Long) As Long
Private Type POINTAPI
   x As Long
   y As Long
End Type

Private Sub Bezier_Click()
   LEAD2.CurveClose = CURVE_CLOSE
   LEAD2.CurveSize = 4
   LEAD2.CurveX(1) = 10
   LEAD2.CurveY(1) = 30
   LEAD2.CurveX(2) = 20
   LEAD2.CurveY(2) = 240
   LEAD2.CurveX(3) = 250
   LEAD2.CurveY(3) = 260
   LEAD2.CurveX(0) = 220
   LEAD2.CurveY(0) = 10
   LEAD2.CurveTension = 0.35
   LEAD2.CurveType = CURVE_STANDAR
   LEAD2.SetRgnCurve L_POLY_WINDING, L_RGN_SET
   LEAD2.RgnFrameType = RGNFRAME_ANIMATED

   LEAD2.CurveToBezier

   ReDim p(LEAD2.BezierSize) As POINTAPI

   Dim i
   For i = 1 To LEAD2.BezierSize
      p(i).x = LEAD2.BezierX(i - 1)
      p(i).y = LEAD2.BezierY(i - 1)
   Next
   PolyBezier Form1.hdc, p(1), LEAD2.BezierSize
End Sub


dbCan... example for Visual Basic

This example displays property values in a message box. You can implement this example by adding a button, with this code, to the project described in ODBC example for Visual Basic.

Msg = "dbCanAppend = " & CStr(Lead1.dbCanAppend) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbCanRestart = " & CStr(Lead1.dbCanRestart) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbCanScroll = " & CStr(Lead1.dbCanScroll) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbCanUpdate = " & CStr(Lead1.dbCanUpdate) & "."

' dbCurrentRecord is 0 based
Msg = Msg & Chr(10) & Chr(13) & "dbCurrentRecord = " & CStr(Lead1.dbCurrentRecord) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbEditMode = " & CStr(Lead1.dbEditMode) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbIsBOF = " & CStr(Lead1.dbIsBOF) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbIsDeleted = " & CStr(Lead1.dbIsDeleted) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbIsEOF = " & CStr(Lead1.dbIsEOF) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbIsOpen = " & CStr(Lead1.dbIsOpen) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbLoadBits = " & CStr(Lead1.dbLoadBits) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbLockingMode = " & CStr(Lead1.dbLockingMode) & "."
Msg = Msg & Chr(10) & Chr(13) & "dbRecordCount = " & CStr(Lead1.dbRecordCount) & "."

Style = vbOKOnly
Title = "LEADTOOLS ActiveX Database Properties"
Response = MsgBox(Msg, Style, Title)


DblClick (ImageList Control) example for Visual Basic

Private Sub LEADImgList1_DblClick()
    MsgBox "Control was Double-Clicked"
End Sub


DblClick example for Visual Basic

Note: Also works with Access 95 and 97.

This example demonstrates the DblClick event.

Private Sub Lead1_DblClick()
    Lead1.Flip ' Just test the event
    Lead1.ForceRepaint
End Sub


DDB example for Visual Basic

This example copies the Lead1 bitmap to the clipboard as a DDB. It pastes the DDB into Lead2 and reverses the image. It then gets a DDB from Lead2, sets the same DDB to Lead1, and repaints.

MousePointer = 11 ' hourglass
MyFlags = COPY_EMPTY + COPY_DDB + COPY_PALETTE
Lead1.Copy MyFlags

If Lead2.Paste(PASTE_ISREADY) = 0 Then
    MsgBox ("Invalid data on the clipboard")
Else
    Lead2.Paste 0
End If

Lead2.Reverse
MyDC = Lead2.GetClientDC
MyDDB = Lead2.GetDDB(MyDC)
MyPalette = Lead2.GetPalette(MyDC)
Lead1.SetDDB MyDC, MyDDB, MyPalette
Lead1.ForceRepaint
Lead2.ReleaseClientDC
MousePointer = 0 ' default


DeleteBitmapListItems example for Visual Basic

Note: Also works with Access 95 and 97.

This example deletes the first five bitmaps from the control's bitmap list. Then, it plays the animation to show that the bitmaps are missing.

'Delete the first five bitmaps.
Lead1.DeleteBitmapListItems 0, 5

'Play the animation without looping.
Lead1.AnimationLoop = False
Lead1.AnimationEnable = True


DeletePage example for Visual Basic

‘ delete page 1 from TEST.TIF
LEAD1.DeletePage "TEST.TIF", 1


Deskew example for Visual Basic

Note: Also works with Access 95 and 97.

This example automatically straightens the bitmap and repaints the image. The image to be straightened should be mainly text.

Lead1.Deskew vbGreenLead1.ForceRepaint


Despeckle example for Visual Basic

Note: Also works with Access 95 and 97.

This example automatically removes specks from the bitmap and repaints the image. Use this on a 1-bit bitmap such as a scanned document.

Lead1.Despeckle
Lead1.ForceRepaint


DIB example for Visual Basic

This example copies the Lead1 bitmap to the clipboard as a DIB. It pastes the DIB into Lead2 and reverses the image. It then gets a DIB from Lead2, sets the same DIB to Lead1, and repaints.

MousePointer = 11 ' hourglass
MyFlags = COPY_EMPTY + COPY_DIB + COPY_PALETTE
 Lead1.Copy MyFlags

If Lead2.Paste(PASTE_ISREADY) = 0 Then
    MsgBox ("Invalid data on the clipboard")
Else
    Lead2.Paste 0
End If

Lead2.Reverse
MyDib = Lead2.GetDIB
Lead1.SetDIB MyDib
Lead1.ForceRepaint
MousePointer = 0 ' default


DocCleanBitmap example for Visual Basic

    Dim nRet As Integer
    'Smooth
    'This example smooths all nicks and bumps up to 2 pixels in length
    'Long bumps/nicks are treated before short bumps/nicks
    'A LEAD region is updated to show all the changes
    'The Smooth Event is used to display information about bump or nick
    LEAD1.DocCleanSuccess = SUCCESS_REMOVE
    nRet = LEAD1.Smooth(2, SMOOTH_SINGLE_REGION Or
SMOOTH_LEAD_REGION Or SMOOTH_FAVOR_LONG)
    If (nRet = 0) Then
        LEAD1.FreeRgn
        LEAD2.Bitmap = LEAD1.DocCleanBitmap 'copy the result so we can get the rgn handle
        LEAD1.SetRgnHandle LEAD2.GetRgnHandle, 0, 0, L_RGN_SET
        LEAD2.Bitmap = 0 'no longer need copy
        LEAD1.DocCleanBitmap = 0 'no longer need rgn either
        LEAD1.RgnFrameType = RGNFRAME_COLOR
    End If

Private Sub LEAD1_Smooth(ByVal nBumpOrNick As Long, ByVal nStartRow As Long, ByVal nStartCol As Long, ByVal nLength As Long, ByVal uHorV As Long)
    Dim szType As String
    Dim szHorV As String
    If (nBumpOrNick = SMOOTH_BUMP) Then
        szType = "Bump"
    Else
        szType = "Nick"
    End If
    If (uHorV = SMOOTH_HORIZONTAL_ELEMENT) Then
        szHorV = "Horz."
    Else
        szHorV = "Vert."
    End If
    Debug.Print "Found " & szType & " at " & CStr(nStartRow) & "," & CStr(nStartCol) & " Length=" & CStr(nLength) & " - " & szHorV
End Sub


DocCleanSuccess example for Visual Basic

    Dim nRet As Integer
    'This example updates a region with all 1x1 to 3x3 specks that are solid black
    'If a speck has any white pixels, it is NOT part of the updated region
    'The call is configured to update a single LEAD region with all changes
    'The image itself is unchanged
    'The DotRemove Event is used to display information about each speck that is removed
    nRet = LEAD1.DotRemove(DOT_USE_SIZE Or DOT_SINGLE_REGION Or DOT_LEAD_REGION Or DOT_IMAGE_UNCHANGED, 1, 1, 3, 3)
    If (nRet = 0) Then
        LEAD1.FreeRgn
        LEAD2.Bitmap = LEAD1.DocCleanBitmap 'copy the result so we can get the rgn handle
        LEAD1.SetRgnHandle LEAD2.GetRgnHandle, 0, 0, L_RGN_SET
        LEAD2.Bitmap = 0 'no longer need copy
        LEAD1.DocCleanBitmap = 0 'no longer need rgn either
        LEAD1.RgnFrameType = RGNFRAME_COLOR
    End If

Private Sub LEAD1_DotRemove(ByVal hRgn As Stdole.OLE_HANDLE, ByVal fBoundingRectLeft As Single, ByVal fBoundingRectTop As Single, ByVal fBoundingRectWidth As Single, ByVal fBoundingRectHeight As Single, ByVal iWhiteCount As Long, ByVal iBlackCount As Long)
    Dim nRet As Long
    Debug.Print "Dot Found at " & CStr(fBoundingRectLeft) & "," & CStr(fBoundingRectTop) & "," & CStr(fBoundingRectWidth) & "," & CStr(fBoundingRectHeight) & " WhiteCount=" & CStr(iWhiteCount) & " BlackCount=" & CStr(iBlackCount)
    'Do not remove the speck if it contains any white pixels
    If (iWhiteCount > 0) Then
        nRet = SUCCESS_NOREMOVE
    Else
        nRet = SUCCESS_REMOVE
    End If
    LEAD1.DocCleanSuccess = nRet
End Sub


DoubleBuffer example for Visual Basic

    LEAD1.DoubleBuffer = True ' enable double buffer paint

    LEAD1.Load "d:\temp\images\golf.jpg", 0, 1, 1


DrawShape example for Visual Basic

Note: Also works with Access 95 and 97.

This example demonstrates most of the three-dimensional shape properties as it draws a rectangle on the current bitmap. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

Lead1.AutoRepaint = False

'Load an image for the main control
Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1

'Load an image for the background of the shape
Lead2.Load "ulay1.bmp", 0, 0, 1

'Shape background
Lead1.ShapeBackgroundStyle = EFX_BACKSTYLE_TILED_IMAGE
Lead1.BackgroundImageTop = 0
Lead1.BackgroundImageLeft = 0
Lead1.BackgroundImageWidth = Lead2.BitmapWidth
Lead1.BackgroundImageHeight = Lead2.BitmapHeight

'Shape location
Lead1.ShapeTop = 50
Lead1.ShapeLeft = 50
Lead1.ShapeWidth = Lead1.DstWidth - 50
Lead1.ShapeHeight = Lead1.DstHeight - 50

'Shape border
Lead1.ShapeBorderColor = RGB(255, 0, 0)
Lead1.ShapeBorderStyle = EFX_BORDERSTYLE_SOLID
Lead1.ShapeBorderThickness = 10

Lead1.ShapeInnerBandHiliteColor = RGB(255, 255, 255)
Lead1.ShapeInnerBandShadowColor = 0
Lead1.ShapeInnerBandStyle = EFX_INNERSTYLE_RAISED
Lead1.ShapeInnerBandThickness = 2

Lead1.ShapeOuterBandHiliteColor = RGB(0, 255, 0)
Lead1.ShapeOuterBandShadowColor = RGB(128, 128, 128)
Lead1.ShapeOuterBandStyle = EFX_OUTERSTYLE_RAISED
Lead1.ShapeOuterBandThickness = 2

'Make the shape a permanent part of the bitmap
Lead1.DrawPersistence = True

'Draw the shape
Lead1.DrawShape EFX_SHAPE_RECTANGLE, Lead2.Bitmap

'Repaint
Lead1.AutoRepaint = True


DrawText example for Visual Basic

Note: Also works with Access 95 and 97.

This example demonstrates most of the properties of a three-dimensional text object as it draws rotated text on the current bitmap.

Lead1.AutoRepaint = False

'Load an image for the main control
Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1

'Load an image for the foreground of the text
Lead2.Load "ulay1.bmp", 0, 0, 1

'Text location
Lead1.TextTop = 50
Lead1.TextLeft = 50
Lead1.TextWidth = Lead1.DstWidth - 50
Lead1.TextHeight = Lead1.DstHeight - 50

'The foreground image needs to be the correct size.
Lead2.Size Lead1.TextWidth, Lead1.TextHeight, 0

'Text alignment and angle
Lead1.TextAlign = EFX_TEXTALIGN_HCENTER_VCENTER
Lead1.TextAngle = 450   '45 degrees

'Text highlight color and style
Lead1.TextHiliteColor = RGB(255, 255, 255)
Lead1.TextStyle = EFX_TEXTSTYLE_DROPSHADOW

'Text drop shadow
Lead1.ShadowColor = RGB(0, 0, 0)
Lead1.ShadowXDepth = 5
Lead1.ShadowYDepth = 5

'Make the text a permanent part of the bitmap
Lead1.DrawPersistence = True

'Draw the text
Lead1.DrawText "LEADTOOLS", Lead2.Bitmap
Lead1.ForceRepaint


Dst... example for Visual Basic

Note: Also works with Access 95 and 97.

' Declare local variables
Dim ClHeight, ClWidth

' Set variables for the client area of the control.
ClHeight = Lead1.ScaleHeight
ClWidth = Lead1.ScaleWidth

'Calculate the values to zoom in by 10 percent and center the image.
Lead1.DstWidth = Lead1.DstWidth * 1.1
Lead1.DstHeight = Lead1.DstHeight * 1.1
Lead1.DstTop = (ClHeight - Lead1.DstHeight) / 2
Lead1.DstLeft = (ClWidth - Lead1.DstWidth) / 2

'Set the clipping area to the same as the destination rectangle
Lead1.DstClipWidth = Lead1.DstWidth
Lead1.DstClipHeight = Lead1.DstHeight
Lead1.DstClipTop = Lead1.DstTop
Lead1.DstClipLeft = Lead1.DstLeft

'Redisplay the image
Lead1.ForceRepaint


EdgeDetector example for Visual Basic

   LEAD1.EdgeDetector 60, EDG_SOBEL_ALL


Emboss example for Visual Basic

Note: Also works with Access 95 and 97.

This example applies an emboss effect and repaints the image.

Lead1.Emboss EMBOSS_NE, 500
Lead1.ForceRepaint


EnableFastRender (Main Control) example for Visual Basic

Dim TmphDc As Long
Lead1.Load "c:\Wizard4.jpg", 0, 0, 1
Lead1.EnableFastRender = True
TmphDc = Lead1.PrintStart
Lead1.Render TmphDc, 0, 0, 0, 0
Lead1.PrintEnd TmphDc
Lead1.EnableFastRender = False


EnableKeyboard (ImageList Control) example for Visual Basic

'disable keyboard processing
LEADImgList1.EnableKeyboard = False


EnableMethodErrors (ImageList Control) example for Visual Basic

Private Sub LEADImgList1_Click()
    Dim lIndex As Long

    If (LEADImgList1.AllowSelection = ALLOWSELECTION_NONE) Then 'manual selection?
        LEADImgList1.EnableMethodErrors = False
        lIndex = LEADImgList1.HitTest(gLastX, gLastY) 'did we hit an item?
        LEADImgList1.EnableMethodErrors = True
        If ((lIndex >= 0) And (lIndex < LEADImgList1.Count)) Then
            'set item as selected
            LEADImgList1.SelectAll (False)
            LEADImgList1.Item(lIndex).Selected = True 'make sure the item is selected
        End If
    End If
End Sub


EnableMethodErrors example for Visual Basic

Note: Also works with Access 95 and 97.

This example disables method errors temporarily so that it can give the user guidance about a particular error (an out-of-range shear angle in this case).

' Declare local variables.
Dim ShearAngle, nRet, cMsg, answer

ShearAngle = 9000 ' This would be the user's input * 100
Lead1.EnableMethodErrors = False

nRet = Lead1.Shear(ShearAngle, TRUE, RGB(0,0,255))
If nRet = 20013 Then
   cMsg = "The angle cannot be more than 45 degrees"
   answer = MsgBox(cMsg, 0, "Error")
Else
   Lead1.ForceRepaint
EndIf

Lead1.EnableMethodErrors = True


EnableMethodErrors (Thumbnail Browser Control) example for Visual Basic

'disable method errors
LEADThumb1.EnableMethodErrors = False


EnablePaint example for Visual Basic

   ' disable the paint
   LEAD1.EnablePaint = False
   ' do whatever changes you want. The control will not repaint
   LEAD1.Size LEAD1.BitmapWidth * 2, LEAD1.BitmapHeight * 2, RESIZE_BICUBIC
   ' re-enable the paint
   LEAD1.EnablePaint = True
   ' call ForceRepaint because the control will not automatically repaint
   LEAD1.ForceRepaint


EnableZoomInRect example for Visual Basic

Note: Also works with Access 95 and 97.

This example toggles the EnableZoomInRect property.

'Toggle the ZoomInRect setting
           If Lead1.EnableZoomInRect = True Then
               Lead1.EnableZoomInRect = False
           Else
               Lead1.EnableZoomInRect = True
           End If


EnumSegments (Mixed Raster Content Control) example for Visual Basic

Private Sub LEADMrc1_EnumSegments (ByVal nSegId As Long, ByVal SegmentLeft As Long, ByVal SegmentTop As Long, ByVal SegmentRight As Long, ByVal SegmentBottom As Long, ByVal SegType As LEADMrcLibCtl.MRCSegmentTypeConstants, ByVal TextForeColor As stdole.long, ByVal TextBackColor As stdole.long)
   LEAD1.DrawFillStyle= DRAWFILLSTYLE_DIAGONAL_CROSS
   LEAD1.DrawPenWidth= 6
   LEAD1.DrawPenColor= vbYellow
   If SegType = SEGMENT_PICTURE Then
      LEAD1.DrawFillColor= vbGreen
   Else
      LEAD1.DrawFillColor = vbRed
   End If
   LEAD1.DrawRectangle SegmentLeft, SegmentTop, SegmentRight - SegmentLeft, SegmentBottom - SegmentTop
End Sub

Private Sub Command2_Click()
   LEADMrc1.EnumSegments
   Caption = "Picture segments will be green-hashed"
End Sub


RasterizeViewMode example for Visual Basic

Private Sub Go_Click()

' This example will set current viewport mode to L2D_USE_WIDTH_AND_HEIGHT,
' sets the current viewport size to 400*400 pixels and then loads a DXF file

' Set viewport mode to L2D_USE_WIDTH_HEIGHT
LEAD1.RasterizeViewMode = L2D_USE_WIDTH_HEIGHT
' Set viewport size to 400*400 pixels
LEAD1.RasterizeViewportWidth = 400
LEAD1.RasterizeViewportHeight = 400
' Load a DXF file
LEAD1.Load "c:\Test.dxf", 0, 0, 1
End Sub


RawLoad example for Visual Basic

'This example loads RAW data into a LEAD control.
'Raw data parameters are set in the LoadInfo event, which gets called
'when the file format is FILE_RAW, or any unrecognized file format.
'The LoadInfo event obtains information through global variables.

'Global variables used in the LoadInfo event
Dim nWidth As Integer               'width of image
Dim nHeight As Integer               'height of image
Dim nBitsPerPixel As Integer        ' bits per pixel of image--if palettized, a gray palette is generated
Dim nViewPerspective As Integer     'view perspective of raw data (TOP_LEFT, BOTTOM_LEFT, etc)
Dim bOrderBGR As Integer             'TRUE if order BGR, FALSE if order RGB
Dim nOffset As Long                 'offset into file where raw data begins
Dim bPadding As Boolean             'TRUE if each line of data is padded to four bytes
Dim bReverseBits As Boolean         'TRUE if the bits of each byte are reversed

Private Sub LoadRawData(szFileName As String)
Dim nRet As Integer
'Fill in the values of the global variables
'The global variables will get access in the LoadInfo event
nWidth = 294
nHeight = 415
nBitsPerPixel = 24
nViewPerspective = BOTTOM_LEFT
bOrderBGR = True
nOffset = 100
bPadding = True
bReverseBits = True

nRet = LEAD1.Load(szFileName, nBitsPerPixel, 0, 1)
If (nRet = 0) Then
    MsgBox ("SUCCESS file load: " & szFileName)
Else
    MsgBox ("FAILED--file load: " & szFileName)
End If
End Sub

Private Sub LEAD1_LoadInfo()
Dim nColors As Integer
Dim i As Long
Dim nGray As Long

LEAD1.LoadInfoFormat = FILE_RAW
LEAD1.LoadInfoWidth = nWidth
LEAD1.LoadInfoHeight = nHeight
LEAD1.LoadInfoBits = nBitsPerPixel
LEAD1.LoadInfoXRes = 150
LEAD1.LoadInfoYRes = 150
LEAD1.LoadInfoOffset = nOffset
LEAD1.LoadInfoFlags = 0

If (bPadding) Then
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_PAD4
End If

If (bOrderBGR = False) Then
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_ORDERRGB
End If

If (bReverseBits) Then
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_LSB
End If

Select Case nViewPerspective
   Case TOP_LEFT
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_TOPLEFT

   Case BOTTOM_LEFT
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_REVERSE

   Case TOP_RIGHT 'BOTTOM_LEFT180
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_BOTTOMLEFT180

   Case BOTTOM_RIGHT 'TOP_LEFT180
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_TOPLEFT180

   Case RIGHT_TOP   'TOP_LEFT90
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_TOPLEFT90

   Case LEFT_BOTTOM 'TOP_LEFT270
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_TOPLEFT270

   Case LEFT_TOP    'BOTTOM_LEFT90
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_BOTTOMLEFT90

   Case RIGHT_BOTTOM    'BOTTOM_LEFT270
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_BOTTOMLEFT270
   End Select

   'if image is palettized create a grayscale palette
   If (nBitsPerPixel <= 8) Then
    nColors = 2 ^ nBitsPerPixel
    LEAD1.LoadInfoFlags = LEAD1.LoadInfoFlags Or LOADINFO_PALETTE

    For i = 0 To nColors - 1
      nGray = (i * 256) / nColors
      LEAD1.UserPalette(i) = RGB(nGray, nGray, nGray)
      Next i
   End If

End Sub


RawSave example for Visual Basic

'This example saves a LEAD BITMAPHANDLE as RAW data starting at offset uOffset.
'The data is padded so that each line of bytes is evenly divided by 4.
'The bits in each byte are reversed before saving.
'The bits per pixel of the raw data is the same as the bits per pixel of pBitmap.
'If pBitmap is a palettized image, the palette is not saved--only the raw data.

Private Sub SaveRawData(szFileName As String, uOffset As Long)
Dim nRet As Integer
LEAD1.SaveLSB = True
LEAD1.SavePad4 = True
nRet = LEAD1.SaveOffset(szFileName, uOffset, FILE_RAW, 0, 0, 0)
If (nRet = 0) Then
    MsgBox ("SUCCESS file save: " & szFileName & "  Size Written: " & LEAD1.FileSizeWritten)
Else
    MsgBox ("FAILED--file save: " & szFileName)
End If
End Sub


ReadLoadResolutions example for Visual Basic

Note: Also works with Access 95 and 97.

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


Exif example for Visual Basic

Note: Also works with Access 95 and 97.

This example does the following:

1.	Reads all of the comments in an existing Exif file, updating the Comment array.

2.	Loads and modifies the file's image.

3.	Updates some of the comments in the comment array.

4.	Saves the file.

5.	Reads and displays the updated comments.

Note: Comments for GIF, TIFF, and DICOM files are simpler than the ones in this Exif example. With those file types, all of the comments are strings that you can get and set with simple assignments.

Dim SubjectDistance(1) As Long 'Array for CMNT_SUBJECTDISTANCE
Dim NewSubjectDistance As Variant 'Array to be updated by ReadComment
Dim NewDateTime As String 'String to be updated by ReadComment
Dim MyComment() As Byte 'Array for CMNT_USERCOMMENT
Dim MyCommentText As String 'String for CMNT_USERCOMMENT
Dim MyCommentSize As Integer 'Size of the comment array
Dim NewComment As Variant 'Array to be updated by ReadComment
Dim NewCommentText As String 'String for CMNT_USERCOMMENT that we read
Dim FilePath, DistanceString, ThisDate, ThisTime, MyMsg 'Miscellaneous
Dim i as Integer 'Counter
Dim ArraySize 'Size of an array

'Specify the file that we will update.
FilePath = "d:\lead\images\exif1.tif"

'Get all of the current comments from an Exif file.
'Temporarily disable method errors so that we do not fail when comments are missing.
Lead1.EnableMethodErrors = False
For i = 0 To CMNT_LAST
  Lead1.Comment(i) = Empty
  Lead1.Comment(i) = Lead1.ReadComment(FilePath, 0, i)
Next i
Lead1.EnableMethodErrors = True

'Load and modify the image.
Lead1.Load FilePath, 0, 0, 1
Lead1.Reverse

'Update the date when the file is generated.
ThisDate = Format(Date, "yyyy:mm:dd ")
ThisTime = Format(Time, "hh:mm:ss")
Lead1.Comment(CMNT_SZDATETIMEDIGITIZED) = ThisDate + ThisTime
Lead1.Comment(CMNT_SZSUBSECTIMEDIGITIZED) = Empty

'Change the subject distance to 4 1/3 meters.
SubjectDistance(0) = 13
SubjectDistance(1) = 3
Lead1.Comment(CMNT_SUBJECTDISTANCE) = SubjectDistance

'Specify the user comment string.
MyCommentText = "This is my new comment."
MyCommentSize = 8 + Len(MyCommentText)

'Define the array for the user comment.
ReDim MyComment(MyCommentSize) As Byte

'Fill in the ASCII prefix.
MyComment(0) = Asc("A")
MyComment(1) = Asc("S")
MyComment(2) = Asc("C")
MyComment(3) = Asc("I")
MyComment(4) = Asc("I")
MyComment(5) = &H0
MyComment(6) = &H0
MyComment(7) = &H0

'Fill in the rest of the comment, starting at the end.
MyComment(MyCommentSize) = &H0
For i = MyCommentSize - 1 To 8 Step -1
  MyComment(i) = Asc(Right(MyCommentText, MyCommentSize - i))
Next i

'Update the user comment.
Lead1.Comment(CMNT_USERCOMMENT) = Empty
Lead1.Comment(CMNT_USERCOMMENT) = MyComment

'Save the file and read the comments that we saved.
Lead1.Save FilePath, FILE_EXIF, 24, 0, SAVE_OVERWRITE
NewDateTime = Lead1.ReadComment(FilePath, 0, CMNT_SZDATETIMEDIGITIZED)
NewSubjectDistance = Lead1.ReadComment(FilePath, 0, CMNT_SUBJECTDISTANCE)
NewComment = Lead1.ReadComment(FilePath, 0, CMNT_USERCOMMENT)

'Interpret the Subject-Distance RATIONAL.
DistanceString = Format(NewSubjectDistance(0) / NewSubjectDistance(1), "0.000000")

'Initialize the string for the message box.
MyMsg = "Subject Distance = " + DistanceString + Chr(13) + "Date/Time = " + NewDateTime

'Add the ASCII comment if it is there
If Chr$(NewComment(0)) = "A" Then
  ArraySize = UBound(NewComment, 1) - LBound(NewComment, 1)
  NewCommentText = ""
  For i = 8 To ArraySize
    NewCommentText = NewCommentText + Chr$(NewComment(i))
  Next i
  MyMsg = MyMsg + Chr(13) + Chr(13) + NewCommentText
End If

'Display the message
MsgBox MyMsg

'Clear the comments from memory
For i = 0 To CMNT_LAST
  Lead1.Comment(i) = Empty
Next i


FastRotate example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical only.

This example uses fast rotation to rotate an image 90 degrees:

Lead1.FastRotate 90


FeatherAlphaBlend example for Visual Basic

   LEAD2.CreateBitmap 800, 600, 24
   LEAD2.SetRgnRoundRect 50, 50, 500, 500, 150, 150, L_RGN_SET
   LEAD3.CreateFadedMask LEAD2.Bitmap, 60, 20, 3, 0, FADE_DUMPFILL + FADE_NOTRANSPARENCY, 255, RGB(0, 0, 255)
   LEAD2.Load "c:\temp\test.cmp", 0, 1, 1
   LEAD1.FeatherAlphaBlend 0, 0, LEAD3.BitmapWidth, LEAD3.BitmapHeight, LEAD2.Bitmap, 0, 0, LEAD3.Bitmap


FeedLoad example for Visual Basic

Note: Works with Access 97, but not with Access 95.

This example uses StartFeedLoad, FeedLoad, and StopFeedLoad and loads a file through a buffer to simulate receiving a transmitted image.

Private Sub FeedLoad_Click()
   ' Declare a buffer that you will use to feed the file-load process.
   Const BUFFERSIZE = 1000
   Dim MyArray(0 To BUFFERSIZE - 1) As Byte ' index the array starting with 0

   ' Declare other local variables.
   Dim BytesRead As Long
   Dim FileLength As Long

   ' Open an image file and get its length.
   Open "c:\lead\images\image1.cmp" For Binary Access Read As #1
   FileLength = LOF(1)

   ' Set PaintWhileLoad so that we can watch the progress.
   Lead1.PaintWhileLoad = True

   ' Initialize the file-load process.
   ' Specify the default bits per pixel and first page
   If Lead1.StartFeedLoad(0, 0, 1) <> 0 Then
      MsgBox ("Error in StartFeedLoad !")
      GoTo quit_function
   End If

   ' Use FeedLoad in a loop to load the file into the bitmap.
   Do
      Get #1, , MyArray        ' read from the file

      If FileLength > BUFFERSIZE Then
         BytesRead = BUFFERSIZE
      Else
         BytesRead = FileLength
      End If

      FileLength = FileLength - BytesRead

      If Lead1.FeedLoad(MyArray, BytesRead) <> 0 Then
         MsgBox ("Error in FeedLoad !")
         GoTo quit_function
      End If
   Loop Until FileLength <= 0

   ' Finish the file-load process.
   If Lead1.StopFeedLoad() <> 0 Then
      MsgBox ("Error in StopFeedLoad !")
      GoTo quit_function
   End If

quit_function:

   ' Close the file.
   Close #1
End Sub


FileOpen example for Visual Basic

Private Sub Command1_Click()
    LEADDlg1.FileDlgFlags!JumpID(`ltdlgocxn.hlp',`FileDlgFlagsproperty') = 0
    LEADDlg1.DialogTitle!JumpID(`ltdlgocxn.hlp',`DialogTitleproperty') = "Open A File"
    LEADDlg1.PreviewEnabled!JumpID(`ltdlgocxn.hlp',`PreviewEnabledproperty') = True
    LEADDlg1.Filter!JumpID(`ltdlgocxn.hlp',`Filterproperty') = "All |*.*|CMP|*.cmp|JPEG|*.jpg"
    LEADDlg1.FilterIndex!JumpID(`ltdlgocxn.hlp',`FilterIndexproperty') = 2 'look for *.cmp first
    LEADDlg1.InitialDir!JumpID(`ltdlgocxn.hlp',`InitialDirproperty') = "f:\images\"
    LEADDlg1.LoadPasses!JumpID(`ltdlgocxn.hlp',`LoadPassesproperty') = 0
    LEADDlg1.LoadRotated!JumpID(`ltdlgocxn.hlp',`LoadRotatedproperty') = True
    LEADDlg1.LoadCompressed!JumpID(`ltdlgocxn.hlp',`LoadCompressedproperty') = COMP_NONE
    LEADDlg1.Bitmap!JumpID(`ltdlgocxn.hlp',`BitmapCDproperty') = 0 'free any existing bitmap reference
    LEADDlg1.UIFlags!JumpID(`ltdlgocxn.hlp',`UIFlagsproperty') = DLG_FO_AUTOPROCESS + _
                           DLG_FO_PROGRESSIVE + _
                           DLG_FO_MULTIPAGE + _
                           DLG_FO_LOADROTATED + _
                           DLG_FO_LOADCOMPRESSED + _
                           DLG_FO_FILEINFO + _
                           DLG_FO_SHOWSTAMP + DLG_FO_SHOWPREVIEW
    LEADDlg1.FileOpen!JumpID(`ltdlgocxn.hlp',`FileOpenmethod') (hWnd)
    'output the results
    LEAD1.RefBitmap!JumpID(`ltocxn.hlp',`RefBitmapProperty') = True 'don't make a copy
    LEAD1.Bitmap!JumpID(`ltocxn.hlp',`BitmapProperty') = LEADDlg1.Bitmap    'send the image to LEAD OCX
    LEAD1.RefBitmap!JumpID(`ltocxn.hlp',`RefBitmapProperty') = False 'reset

    LEAD2.Bitmap = 0
    LEAD2.Bitmap = LEADDlg1.Thumbnail!JumpID(`ltdlgocxn.hlp',`Thumbnailproperty') 'copy thumbnail image to LEAD OCX

    'output the results
    Text1.Text = LEADDlg1.FileName!JumpID(`ltdlgocxn.hlp',`FileNameproperty')
    Text2.Text = LEADDlg1.PageNumber!JumpID(`ltdlgocxn.hlp',`PageNumberproperty')
    Text3.Text = LEADDlg1.LoadCompressed!JumpID(`ltdlgocxn.hlp',`LoadCompressedproperty')
    Text4.Text = LEADDlg1.LoadRotated!JumpID(`ltdlgocxn.hlp',`LoadRotatedproperty')
    Text5.Text = LEADDlg1.LoadPasses!JumpID(`ltdlgocxn.hlp',`LoadPassesproperty')
End Sub


FilePage Event example for Visual Basic

This example shows how the FilePage event can be used to size and position a lead control when an image is loaded.

Private Sub Lead1_FilePage()
   Dim HeightFactor, WidthFactor  ' Factors for aspect ratio
   Dim HeightAllowed, WidthAllowed   ' Maximum width and height
   Dim Width, Height, Left, Top  ' Variables for control dimensions

   ' Set the variables used for preserving the aspect ratio.
   'Allow for a border of 1/8 of the form size.
   'The units of measure do not matter, since we are calculating proportions.
   HeightFactor = Lead1.InfoHeight
   WidthFactor = Lead1.InfoWidth
   HeightAllowed = ScaleHeight * 3 / 4
   WidthAllowed = ScaleWidth * 3 / 4

   'Center the LEAD control on the form, preserving the aspect ratio.
   'Check to see if using the maximum width will make the image too tall.
   'Set the dimensions based on the result.
   If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
     Lead1.Left = ScaleWidth / 8
     Lead1.Width = WidthAllowed
     Lead1.Height = (Lead1.Width * HeightFactor) / WidthFactor
     Lead1.Top = (ScaleHeight - Lead1.Height) / 2
   Else
     Lead1.Top = ScaleHeight / 8
     Lead1.Height = HeightAllowed
     Lead1.Width = (Lead1.Height * WidthFactor) / HeightFactor
     Lead1.Left = (ScaleWidth - Lead1.Width) / 2
   End If

   ' Set the image display size to match the LEAD control.
   Lead1.AutoScroll = False
   Lead1.AutoSetRects = True
   Lead1.AutoRepaint = True
   Lead1.PaintSizeMode = PAINTSIZEMODE_FIT
End Sub


FilePageLoaded example for Visual Basic

' The following example loads the first five pages of a multipage file,
' and writes the individual pages as TIF files

Dim nCount As Integer

Private Sub LEAD1_FilePageLoaded()
Dim strFileName As String
nCount = nCount + 1
strFileName = "d:\erase\mpage" + CStr(nCount) + ".TIF"
LEAD1.Save strFileName, FILE_TIF, 0, 0, SAVE_OVERWRITE
End Sub

Private Sub Command8_Click()
nCount = 0
LEAD1.EnableFilePageLoadedEvent = True
LEAD1.Load "d:\work\images\mtif.tif", 0, 0, 5
LEAD1.EnableFilePageLoadedEvent = False
End Sub


Fill example for Visual Basic

Note: Also works with Access 95 and 97.

This example fills the bitmap with blue and repaints the image.

Lead1.Fill RGB(0, 0, 255)
Lead1.ForceRepaint


Flip example for Visual Basic

Note: Also works with Access 95 and 97.

This example flips the bitmap and repaints the image.

Lead1.Flip
Lead1.ForceRepaint


FloaterDstClip... example for Visual Basic

Note: Also works with Access 95 and 97.

The following code adjusts the destination clipping rectangle of the floater. You can test it by adding it to a new command button for the lesson described in Outlining, Dragging, and Pasting a Region. By default, the destination clipping rectangle for the floater is the full client area. This code gets the current values and uses them to reduce the size of the clipping rectangle.

'Declare local variables.
Dim AdjustX, AdjustY, NewLeft, NewTop, NewWidth, NewHeight

'Set variables to use for adjustment increments.
AdjustX = Lead1.ScaleWidth / 20
AdjustY = Lead1.ScaleHeight / 20

'Determine new values, based on adjustments of current values.
NewLeft = Lead1.FloaterDstClipLeft + AdjustX
NewTop = Lead1.FloaterDstClipTop + AdjustY
NewWidth = Lead1.FloaterDstClipWidth - (2 * NewLeft)
NewHeight = Lead1.FloaterDstClipHeight - (2 * NewTop)

'Set the clipping rectangle to the new values.
Lead1.SetFloaterDstClipRect NewLeft, NewTop, NewWidth, NewHeight


Font (ImageList Control) example for Visual Basic

'change the font properties
If LEADImgList1.Font.Bold = True Then
    LEADImgList1.Font.Bold = False
Else
    LEADImgList1.Font.Bold = True
End If
LEADImgList1.Font.Size = 10
LEADImgList1.Font.Name = "Arial"


Font example for Visual Basic

Note: Also works with Access 95 and 97.

This example, in a MouseUp event, determines the size of a rectangle for a string in the specified font. It then draws the rectangle and draws the text on top of the rectangle.

Private Sub Lead1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
   Dim TestText As String
   Dim TextWidth As Single
   Dim TextHeight As Single

   'Specify the text, font, and styles
   TestText = "This is my text."
   Lead1.Font.Name = "Times New Roman"
   Lead1.Font.Size = 16
   Lead1.DrawFontColor = RGB(0, 0, 255) 'Blue
   Lead1.TextStyle = EFX_TEXTSTYLE_NORMAL
   Lead1.TextAlign = EFX_TEXTALIGN_HCENTER_VCENTER

   'Use the same scalemode as the mouse.
   Lead1.ScaleMode = 1

   'Get the width and height of the text to be drawn.
   TextWidth = Lead1.DrawTextWidth(TestText)
   TextHeight = Lead1.DrawTextHeight(TestText)

   'set the location for the text
   Lead1.TextTop = y
   Lead1.TextLeft = x
   Lead1.TextWidth = TextWidth
   Lead1.TextHeight = TextHeight

   'Set the properties for drawing a rectangle behind the text.
   Lead1.DrawPenStyle = DRAWPENSTYLE_SOLID
   Lead1.DrawMode = DRAWMODE_COPY_PEN
   Lead1.DrawFillColor = RGB(0, 255, 0) 'Green

   'Draw on the screen, not on the bitmap.
   Lead1.DrawPersistence = False

   'Draw the rectangle, then draw the text.
   Lead1.DrawRectangle x, y, TextWidth, TextHeight
   Lead1.DrawText TestText, 0
End Sub


ForeColor (ImageList Control) example for Visual Basic

'set text color to green
LEADImgList1.ForeColor = RGB(0, 255, 0)


Frame... example for Visual Basic

Note: Also works with Access 95 and 97.

This example sets the control's frame properties. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

Lead1.AutoRepaint = False
Lead1.FrameThickness = 2
Lead1.FrameColor = RGB(0, 0, 0)
Lead1.FrameInnerStyle = EFX_INNERSTYLE_INSET
Lead1.FrameOuterStyle = EFX_OUTERSTYLE_RAISED
Lead1.FrameInnerHiliteColor = RGB(255, 255, 0)   'Yellow
Lead1.FrameInnerShadowColor = RGB(128, 128, 128) 'Dark Gray
Lead1.FrameOuterHiliteColor = RGB(255, 0, 0)     'Red
Lead1.FrameOuterShadowColor = RGB(192, 192, 192) 'Light Gray
Lead1.FrameInnerThickness = 3
Lead1.FrameOuterThickness = 3
 Lead1.AutoRepaint = True


GammaCorrect example for Visual Basic

Note: Also works with Access 95 and 97.

This example applies a 2.2 gamma correction and repaints the image.

Lead1.GammaCorrect 220
Lead1.ForceRepaint


GaussianFilter example for Visual Basic

   LEAD1.GaussianFilter 20


GetArrayInfo example for Visual Basic

' This example
' 1. creates a file in memory
' 2. Calls GetInfoMemory
' 3. Displays information about the file in memory

Private Sub Command6_Click()
Dim strFormat As String
Dim nWidth As Integer
Dim nHeight As Integer
Dim nBpp As Integer
Dim nPage As Integer
Dim nSizeDisk As Long
Dim nSizeMem As Long
Dim strCompress As String
Dim nFormat As Integer
Dim strMsg As String
Dim nTotalPages As Integer
Dim xRes As Integer
Dim yRes As Integer
Dim MyVar As Variant
Dim lSize As Long

' Create the memory file
LEAD1.Load "d:\work\images\gabe.bmp", 0, 0, 1
MyVar = LEAD1.SaveArray(FILE_BMP, 4, 0)
LEAD1.Bitmap = 0

' Get information about the file
lSize = UBound(MyVar) - LBound(MyVar) + 1
LEAD1.GetArrayInfo MyVar, 1, lSize, FILEINFO_TOTALPAGES

' Read the updated properties
nFormat = LEAD1.InfoFormat
nWidth = LEAD1.InfoWidth
nHeight = LEAD1.InfoHeight
nBpp = LEAD1.InfoBits
nPage = LEAD1.InfoPage
nSizeDisk = LEAD1.InfoSizeDisk
nSizeMem = LEAD1.InfoSizeMem
strCompress = LEAD1.InfoCompress
xRes = LEAD1.InfoXRes
yRes = LEAD1.InfoYRes
nTotalPages = LEAD1.InfoTotalPages

' Translate the meaning of the format constant
Select Case nFormat
   Case FILE_PCX
      strFormat = "ZSoft PCX"
   Case FILE_GIF
      strFormat = "CompuServe GIF"
   Case FILE_TGA
      strFormat = "TARGA"
   Case FILE_PNG
      strFormat = "Portable Network Graphics"
   Case FILE_PSD
      strFormat = "Adobe Photoshop 3.0"
   Case FILE_BMP
      strFormat = "Windows BMP"
   Case FILE_OS2
      strFormat = "OS/2 BMP version 1.x"
   Case FILE_OS2_2
      strFormat = "OS/2 BMP version 2.x"
   Case FILE_WMF
      strFormat = "Windows Meta File"
   Case FILE_EPS
      strFormat = "Encapsulated PostScript"
   Case FILE_PCT
      strFormat = "Macintosh Pict"
   Case FILE_MSP
      strFormat = "Microsoft Paint"
   Case FILE_IMG
      strFormat = "GEM Image"
   Case FILE_PCD
      strFormat = "Kodak PhotoCD"
   Case FILE_EPSTIFF
      strFormat = "Encapsulated PostScript with an embedded TIFF file"
   Case Else
      strFormat = "Unknown format"
End Select
' Create the message string
strMsg = "Page = " + Str(nPage) + " of " + CStr(nTotalPages) + vbCrLf + "Format = " + strFormat + vbCrLf
strMsg = strMsg + "Width = " + Str(nWidth) + vbCrLf + "Height = " + Str(nHeight) + vbCrLf
strMsg = strMsg + "Size in memory = " + Str(nSizeMem) + vbCrLf + "Size on disk = " + Str(nSizeDisk) + vbCrLf
strMsg = strMsg + "Bits per pixel = " + Str(nBpp) + vbCrLf
strMsg = strMsg + "X resolution = " + Str(xRes) + vbCrLf + "Y resolution = " + Str(yRes)

' Display the message box
 MsgBox strMsg, 0, "File Info"
End Sub


GetBitmapClipSegments example for Visual Basic

Dim vSegments As Variant
Dim uSegments As Integer
Dim y As Single

LEAD1.ScaleMode = 3 ' use pixels
LEAD1.AutoRepaint = False ' disable repainting

y = LEAD1.RgnTop

' get the clip segments
vSegments = LEAD1.GetBitmapClipSegments(y)

' loop through all the segments
For i = LBound(vSegments) To UBound(vSegments) - 1 Step 2
   ' for every segment, set all the pixels to black
   For j = vSegments(i) To vSegments(i + 1) - 1
      LEAD1.Pixel(j, y) = RGB(0, 0, 0)
   Next j
Next i

LEAD1.AutoRepaint = True ' re-enable repainting


GetBitmapDC example for Visual Basic

Take the following steps to demonstrate how GDI functions can be used to print text on the bitmap and on the control. The text printed on the bitmap is a permanent part of the bitmap and becomes permanent if the bitmap is saved; whereas the text on the control is superficial and does not affect the bitmap.

Note: For an easier way of drawing text, refer to the DrawText example.

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

2.	 Open the API Viewer by double-clicking the API Text Viewer icon in the Visual Basic program group on your desktop.

3.	From the File menu, choose Load Text File.

4.	Open either WIN31API.TXT (16-bit Windows declares, types, and constants), or WIN32API.TXT (32-bit Windows declares, types, and constants), which are located in the \WINAPI subdirectory of the main Visual Basic directory.

5.	In the API Type drop-down list box, select Declares; then select and add the following items:

SetBkMode
TextOut
GetStockObject
SelectObject

6.	In the API Type drop-down list box, select Constants; then select and add the following items:

SYSTEM_FONT
TRANSPARENT

7.	Copy the selected items, and paste them into the declarations procedure of the general object in your form. In this example, you must edit the declarations and constants to make them private. On a 16-bit system, they should appear as follows:

Private Declare Function SetBkMode Lib "GDI" (ByVal hDC As Integer, ByVal nBkMode As Integer) As Integer
Private Declare Function SelectObject Lib "GDI" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
Private Declare Function TextOut Lib "GDI" (ByVal hDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal lpString As String, ByVal nCount As Integer) As Integer
Private Declare Function GetStockObject Lib "GDI" (ByVal nIndex As Integer) As Integer
Const SYSTEM_FONT = 13
Const TRANSPARENT = 1

8.	 Select the CommandButton control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

9.	In the Properties box, change the CommandButton control's Caption property to GDI for Text.

10.	Add the following code to the CommandButton control's Click procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Notice that the code prints in two different places: the bitmap and the control. You can see the difference when you run the program.

Sub Command1_Click ()
    'Ensure that the Lead control is visible
    Lead1.Visible = True

    'First, print text on the bitmap.

    'Create a device context for the bitmap that the GDI functions can access
    LeadDC = Lead1.GetBitmapDC

    'Get the system font and select it. The old font is saved.
    'Using other fonts is more complex. Refer to the Windows API documentation.
    hfnt = GetStockObject(SYSTEM_FONT)
    hOldFont = SelectObject(LeadDC, hfnt)

    'Make the background transparent, so that the text will overlay the image
    MyReturn = SetBkMode(LeadDC, TRANSPARENT)
    'Assign the string value
    mystring$ = "Text on the bitmap"
    'Print the text on the bitmap. This is a permanent change in the bitmap
    MyReturn = TextOut(LeadDC, 20, 40, mystring$, Len(mystring$) )

    'Restore the previous font
    MyReturn = SelectObject(LeadDC, hOldFont)

    'Remove the lock from the device control
    Lead1.ReleaseBitmapDC

    'Repaint the part of the image that has changed
    Lead1.BackErase = False
    Lead1.ForceRepaint

    'Allow full repainting again
    Lead1.BackErase = True
    'Next, print text on the control.

    'Create a device context for the control that the GDI functions can access
    LeadClientDC = Lead1.GetClientDC

    'Get the system font and select it. The old font is saved.
    'Using other fonts is more complex. Refer to the Windows API documentation.
    hfnt = GetStockObject(SYSTEM_FONT)
    hOldFont = SelectObject(LeadDC, hfnt)

    'Make the background transparent, so that the text will overlay the image
    MyReturn = SetBkMode(LeadClientDC, TRANSPARENT)
    'Assign the string value
    mystring$ = "Text on the LEAD control"
    'Print the text on the control.
    'This is an overlay that does not affect the bitmap.
    MyReturn = TextOut(LeadClientDC, 20, 80, mystring$, Len(mystring$))

    'Restore the previous font
    MyReturn = SelectObject(LeadClientDC, hOldFont)
    'Remove the lock from the device control
    Lead1.ReleaseClientDC

End Sub

11.	Run your program to test it. Notice that the text printed on the bitmap is scaled as part of the bitmap. If you zoom in, it becomes larger, and if you zoom out, it becomes smaller. The text printed on the control is the normal size for the system font and is not affected by zooming.


GetColorCount example for Visual Basic

Note: Also works with Access 95 and 97.

This example displays a message box showing the number of unique colors in the control's current bitmap.

' Declare local variables.
Dim szMessage As String ' Buffer for the MessageBox string
Dim NumberOfColors As Long ' Number of colors in the bitmap

' Get the number of colors in the bitmap.
NumberOfColors = Lead1.GetColorCount

' Display the result in a message.
szMessage = "The bitmap has " + CStr(NumberOfColors) + " colors"
MsgBox szMessage, 0, "Notice"


GetDIB example for Visual Basic

'This example gets the image from LEAD1 as a V5 DIB
'and then loads the DIB into LEAD2

Private Sub Command1_Click()
Dim MyDIB As OLE_HANDLE

'LEAD1 has an image at this point
MyDIB = LEAD1.GetDIB(DIB_BITMAPV5HEADER)
LEAD2.SetDIB (MyDIB)

'Free the DIB using the Windows API
GlobalFree MyDIB
End Sub


GetFileInfo example for Visual Basic

Note: Also works with Access 95 and 97.

This example gets information about the specified file.

' Declare local variables
Dim fname, pg, fmt, LeadWidth, LeadHeight, bps, xres, yres, sizd, sizm, cmp, cFmt, cMsg, answer

' Initialize variables
fname = "c:\lead\images\image2.cmp"
pg = 0

' Update the variables
Lead1.GetFileInfo fname, pg, FILEINFO_TOTALPAGES

' Read the updated properties
fmt = Lead1.InfoFormat
LeadWidth = Lead1.InfoWidth
LeadHeight = Lead1.InfoHeight
bps = Lead1.InfoBits
pg = Lead1.InfoPage
sizd = Lead1.InfoSizeDisk
sizm = Lead1.InfoSizeMem
cmp = Lead1.InfoCompress

' Translate the meaning of the format constant
Select Case fmt
   Case FILE_PCX
      cFmt = "ZSoft PCX"
   Case FILE_GIF
      cFmt = "CompuServe GIF"
   Case FILE_TGA
      cFmt = "TARGA"
   Case FILE_PNG
      cFmt = "Portable Network Graphics"
   Case FILE_PSD
      cFmt = "Adobe Photoshop 3.0"
   Case FILE_BMP
      cFmt = "Windows BMP"
   Case FILE_OS2
      cFmt = "OS/2 BMP version 1.x"
   Case FILE_OS2_2
      cFmt = "OS/2 BMP version 2.x"
   Case FILE_WMF
      cFmt = "Windows Meta File"
   Case FILE_EPS
      cFmt = "Encapsulated PostScript"
.

.

.

   Case FILE_MAC
      cFmt = "MacPaint"
   Case FILE_PCT
      cFmt = "Macintosh Pict"
   Case FILE_MSP
      cFmt = "Microsoft Paint"
   Case FILE_IMG
      cFmt = "GEM Image"
   Case FILE_PCD
      cFmt = "Kodak PhotoCD"
   Case FILE_EPSTIFF
      cFmt = "Encapsulated PostScript with an embedded TIFF file"
   Case Else
      cFmt = "Unknown format"
End Select

' Create the message string
cMsg = fname + Chr(13) + "Page = " + Str(pg) + " of " + CStr(LEAD1.InfoTotalPages) + Chr(13) + "Format = " + cFmt + Chr(13)
cMsg = cMsg + "Width = " + Str(LeadWidth) + Chr(13) + "Height = " + Str(LeadHeight) + Chr(13)
cMsg = cMsg + "Size in memory = " + Str(sizm) + Chr(13) + "Size on disk = " + Str(sizd) + Chr(13)
cMsg = cMsg + "Bits per pixel = " + Str(bps) + Chr(13)
cMsg = cMsg + "X resolution = " + Str(xres) + Chr(13) + "Y resolution = " + Str(yres)

' Display the message box
 MsgBox cMsg, 0, "File Info"


GetFloaterHandle example for Visual Basic

Note: Also works with Access 95 and 97.

The following is an alternative way of coding the PasteFloaterBtn button's click procedure in  Outlining, Dragging, and Pasting a Region. This alternative uses the GetFloaterHandle and SetRgnHandle methods to specify the mask for the paste. It also shows how to use the HasRgn, FloaterWidth, and FloaterHeight properties.

Private Sub PasteFloaterBtn_Click()

'Declare the variable for the Combine operation.
Dim MyOp As Long

'Declare the variable for the saved region.
Dim SavedRgn As Long

'Declare the variables for the client area coordinates.
Dim LCRgnX, LCRgnY , LCRgnWidth, LCRgnHeight

'Declare the variables for the bitmap coordinates.
Dim LBRgnX, LBRgnY , LBRgnWidth, LBRgnHeight

'Exit this routine if there is no region.
If Lead1.HasRgn = False Then Exit Sub

'Save the region that is in the floater.
SavedRgn = Lead1.GetFloaterHandle

'Get the floater into another bitmap
Lead2.ScaleMode = Lead1.ScaleMode
Lead2.Bitmap = Lead1.Floater

'Get the floater's client coordinates into local variables.
LCRgnX = Lead1.FloaterDstLeft
LCRgnY = Lead1.FloaterDstTop
LCRgnWidth = Lead1.FloaterDstWidth
LCRgnHeight = Lead1.FloaterDstHeight

'Translate the client coordinates to bitmap coordinates.
LBRgnX = ((LCRgnX - Lead1.DstLeft) / ZoomFactorX) + Lead1.SrcLeft
LBRgnY = ((LCRgnY - Lead1.DstTop) / ZoomFactorY) + Lead1.SrcTop
LBRgnWidth = Lead1.FloaterWidth
LBRgnHeight = Lead1.FloaterHeight

'Delete the floater.
Lead1.FloaterVisible = False
Lead1.Floater = 0

'Set the saved region to use as a mask for the Combine method.
Lead1.SetRgnHandle SavedRgn, LBRgnX, LBRgnY, L_RGN_SET

'Use the Combine method to paste the Lead2 bitmap into the Lead1 bitmap.
MyOp = CB_OP_ADD + CB_DST_0 'Operation flags for a simple paste.
Lead1.Combine LBRgnX, LBRgnY, LBRgnWidth, LBRgnHeight, Lead2.Bitmap, 0, 0, MyOp

'Repaint the part of the client area that has changed.
Lead1.RepaintRect LCRgnX, LCRgnY, LCRgnWidth, LCRgnHeight, False

'Free the region.
Lead1.FreeRgn

'Delete the region handle.
Lead1.DeleteRgnHandle SavedRgn

End Sub


GetFunctionalLookupTable example for Visual Basic

   LEAD1.GetFunctionalLookupTable 0, 255, 5, FLT_EXP
   LEAD1.RemapIntensity CHANNEL_MASTER


GetHistogram example for Visual Basic

The following code does a CMYK separation and uses a histogram to find the brightest and darkest intensities in the K plane of the bitmap. It then remaps the intensities to use the full range and merges the color planes to recreate the bitmap:

Private Sub Command1_Click ()
    MousePointer = 11 ' hourglass

    'Do a CMYK color separation and copy the K plane to the bitmap
    Lead1.ColorSeparate COLORSEP_CMYK
    Lead1.Bitmap = 0 'Free the bitmap
    Lead1.Bitmap = Lead1.ColorPlanes(3) 'Copy the K plane

    'Load the histogram
    Lead1.GetHistogram CHANNEL_MASTER

    'Find the brightest and darkest intensities in the image
    MyIndex = 0
    Brightest = 0
    Darkest = -1
    While (MyIndex < 256)
        If Lead1.HistogramTable(MyIndex) > 0 Then
            Brightest = MyIndex
            If (Darkest = -1) Then
                Darkest = MyIndex
            End If
        End If
        MyIndex = MyIndex + 1
    Wend

    'Remap the intensities to use the full range
    MyIndex = Darkest
    CurrentRange = Brightest - Darkest
    If CurrentRange > 0 Then
        While (MyIndex <= Brightest)
            Offset = MyIndex - Darkest
            Lead1.RemapTable(MyIndex) = (255 * Offset) / CurrentRange
            MyIndex = MyIndex + 1
        Wend
        Lead1.RemapIntensity CHANNEL_MASTER
    End If

    'Merge the color planes and free them from memory
    Lead1.ColorPlanes(3) = Lead1.Bitmap 'Update the K plane
    Lead1.ColorMerge COLORSEP_CMYK
    Lead1.ColorPlanes(0) = 0
    Lead1.ColorPlanes(1) = 0
    Lead1.ColorPlanes(2) = 0
    Lead1.ColorPlanes(3) = 0

    'Set the image display size to match the LEAD control
    Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
    Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight

    Lead1.ForceRepaint
    MousePointer = 0 ' default
End Sub


GetHistogramGray example for Visual Basic

'This example gets a histogram for a 12-bit or 16-bit grayscale image and then
'displays the number of occurrences of the brightest and darkest intensities

Private Sub Command4_Click()
Dim nRet As Integer

MsgBox "Table size before call to GetHistogramGray: " & LEAD1.HistogramGrayTableSize
nRet = LEAD1.GetHistogramGray
If nRet = 0 Then
   LEAD1.GetMinMaxVal
   MsgBox "Highest Intensity: 0x" & Hex(LEAD1.MaxVal) & "  Count: " & LEAD1.HistogramGrayTable(LEAD1.MaxVal) _
   & Chr(13) & "Lowest Intensity: 0x" & Hex(LEAD1.MinVal) & "  Count: " & LEAD1.HistogramGrayTable(LEAD1.MinVal)
End If
MsgBox "Table size of current histogram: " & LEAD1.HistogramGrayTableSize
End Sub


GetMinMaxBits example for Visual Basic

The following example retrieves the values for MinBit and MaxBit using GetMinMaxBits and writes the results.

     Lead1.GetMinMaxBits
     Text1.Text = CStr(Lead1.MinBit)
     Text2.Text = CStr(Lead1.MaxBit)


GetMinMaxVal example for Visual Basic

The following example retrieves the values for MinVal and MaxVal using GetMinMaxVal and writes the results.

    'must call GetMinMaxVal first
    Lead1.GetMinMaxVal
    Text3.Text = CStr(Lead1.MinVal)
    Text4.Text = CStr(Lead1.MaxVal)


GetPicture and SetPicture example for Visual Basic

To use this code, you must first add a PictureBox control to your form, and make it invisible.

' Hide the LEAD control
Lead1.Visible = False

'Assign the picture object to the PictureBox control
Picture1 = Lead1.GetPicture

'Give the PictureBox control the same size and position as the LEAD control
Picture1.Top = Lead1.Top
Picture1.Left = Lead1.Left
Picture1.Height = Lead1.Height
Picture1.Width = Lead1.Width

'Interrupt with a message.
MsgBox "This is the PictureBox. Click OK for the SetPicture method"

'Get the picture object back to the LEAD control and repaint it
Lead1.AutoSetRects = False ' Keep the previous display rectangles.
Lead1.SetPicture Picture1 ' Load the bitmap from the PictureBox control.
Picture1.Visible = False ' Hide the PictureBox control.
Lead1.Visible = True ' Make the LEAD control visible.
Lead1.ForceRepaint


GetRgnHandle example for Visual Basic

Note: Also works with Access 95 and 97.

The following code creates a region, saves its handle and adds the saved region beside the current region.

'Declare local variables.
Dim OffsetX, OffsetY
Dim SavedRegion As Long

'Initialize the variables that we will manipulate to simulate mouse coordinates.
OffsetX = Lead1.BitmapWidth / 8
OffsetY = Lead1.BitmapHeight / 6

'Create an elliptical region.
Lead1.SetRgnEllipse OffsetX, OffsetY, OffsetX, OffsetY, L_RGN_SET

'Save a copy of the region.
SavedRegion = Lead1.GetRgnHandle

'Add the saved region to the bitmap, offsetting it so that we can see it.
Lead1.SetRgnHandle SavedRegion, OffsetX, OffsetY, L_RGN_OR

'Delete the saved region.
Lead1.DeleteRgnHandle SavedRegion

'Fill the bitmap region with blue.
Lead1.Fill RGB(0, 0, 255)

'Free the bitmap region.
Lead1.FreeRgn

'Repaint the image so that we can see how the image was updated.
Lead1.ForceRepaint


GetServerBitmap example for Visual Basic

This example copies a bitmap from a LEAD OLE Server, flips the bitmap, then copies the bitmap back to the server. To test this example, you must add an OLE control to your form and specify LEAD Image as the object type.

OLE1.AppIsRunning = True
Lead1.GetServerBitmap OLE1.LpOleObject
Lead1.Flip
Lead1.SetServerBitmap OLE1.LpOleObject


GetUserLookupTable example for Visual Basic

   Dim PointCount As Long
   LEAD1.UserLUTCurveSize = 3
   LEAD1.UserLUTCurveX(0) = 0
   LEAD1.UserLUTCurveY(0) = 0
   LEAD1.UserLUTCurveX(1) = 128
   LEAD1.UserLUTCurveY(1) = 150
   LEAD1.UserLUTCurveX(2) = 255
   LEAD1.UserLUTCurveY(2) = 255
   LEAD1.GetUserLookupTable PointCount
   LEAD1.RemapIntensity CHANNEL_MASTER
   MsgBox PointCount & " Points were modified"


Grayscale example for Visual Basic

Note: Also works with Access 95 and 97.

This example converts the bitmap to 12-bit grayscale.

Lead1.Grayscale 12  'Grayscale image to 12-bit


GrayscaleExt example for Visual Basic

   LEAD1.GrayscaleExt 300, 590, 110


Halftone example for Visual Basic

This example halftones the bitmap with a horizontal pattern and repaints the image.

Lead1.Halftone HALFTONE_PRINT, 0, 0
Lead1.ForceRepaint


HasMagGlass example for Visual Basic

    If (LEAD1.HasMagGlass) Then
        Caption = "Stop"
        'Stop the MagGlass
        LEAD1.StopMagGlass
    Else
        Caption = "Error"
    End If


HistoContrast example for Visual Basic

Note: Also works with Access 95 and 97.

This example applies a histogram contrast to the bitmap and repaints the image.

Lead1.HistoContrast 300
Lead1.ForceRepaint


HistoEqualize example for Visual Basic

Note: Also works with Access 95 and 97.

This example equalizes the bitmap's histogram and repaints the image.

   LEAD1.HistoEqualize YUV_SPACE


HistogramTableSize example for Visual Basic

   If LEAD1.BitmapBits = 64 Or LEAD1.BitmapBits = 48 Then
      LEAD1.HistogramTableSize = 65536
   Else
      LEAD1.HistogramTableSize = 256
   End If


HScrollInfo example for Visual Basic

Private Sub LEAD1_Resize()
    If (LEAD1.HScrollInfo.Visible) Then
        LEAD1.HScrollInfo.Page = LEAD1.HScrollInfo.Max / 10
        LEAD1.HScrollInfo.Line = 10
    End If
    If (LEAD1.VScrollInfo.Visible) Then
        LEAD1.VScrollInfo.Page = LEAD1.VScrollInfo.Max / 10
        LEAD1.VScrollInfo.Line = 10
    End If
    Debug.Print "*************"
    Debug.Print "HScrollMin: " & CStr(LEAD1.HScrollInfo.Min)
    Debug.Print "HScrollMax: " & CStr(LEAD1.HScrollInfo.Max)
    Debug.Print "VScrollMin: " & CStr(LEAD1.VScrollInfo.Min)
    Debug.Print "VScrollMax: " & CStr(LEAD1.VScrollInfo.Max)
    Debug.Print "-------------"
    Debug.Print "HScrollPage: " & CStr(LEAD1.HScrollInfo.Page)
    Debug.Print "HScrollLine: " & CStr(LEAD1.HScrollInfo.Line)
    Debug.Print "VScrollPage: " & CStr(LEAD1.VScrollInfo.Page)
    Debug.Print "VScrollLine: " & CStr(LEAD1.VScrollInfo.Line)
    Debug.Print "-------------"
    Debug.Print "HScrollPos: " & CStr(LEAD1.HScrollInfo.Pos)
    Debug.Print "VScrollPos: " & CStr(LEAD1.VScrollInfo.Pos)
    Debug.Print "-------------"
    Debug.Print "HScrollWidth: " & CStr(LEAD1.HScrollInfo.Width)
    Debug.Print "VScrollWidth: " & CStr(LEAD1.VScrollInfo.Width)
End Sub


HSV_HfromRGB example for Visual Basic

'Takes an RGB, displays the RGB components, and displays the HSV components

Private Sub RGBtoHSV(cr As OLE_COLOR)
Dim red As Integer
Dim green As Integer
Dim blue As Integer
Dim h As Integer
Dim s As Integer
Dim v As Integer

red = cr And &HFF
green = (cr \ &H100) And &HFF
blue = cr \ &H10000

h = LEAD1.HSV_HfromRGB(cr)
s = LEAD1.HSV_SfromRGB(cr)
v = LEAD1.HSV_VfromRGB(cr)

MsgBox "RGB (" & red & "," & green & "," & blue & ") is HSV(" & h & "," & s & "," & v & ")"
End Sub


HTableL example for Visual Basic

    Dim i As Long
    LEAD1.Load App.Path & "\image.jpg", 16, 0, 1
    LEAD1.RemapHueTablesSize = 65536
    For i = 0 To LEAD1.RemapHueTablesSize – 1
        LEAD1.MaskTableL(i) = 0
        LEAD1.HTableL(i) = 1
        LEAD1.STableL(i) = 0
        LEAD1.VTableL(i) = 0
    Next

    LEAD1.RemapHue False, True, False, False


Hue example for Visual Basic

Note: Also works with Access 95 and 97.

This example rotates the hue 180 degrees and repaints the image.

Lead1.Hue 180
Lead1.ForceRepaint


hDocCleanRgn example for Visual Basic

    Dim nRet As Integer
    'HolePunch Remove
    'This example updates a windows region with all removed hole punches
    'For the example, a windows region is updated and then converted to a LEAD region
    'but in practice it would easier and faster to just update a LEAD region
    'The HOLEPUNCH_USE_DPI flag instructs the API to determine the size of the hole punches
    'based on the image DPI
    'The image is modified
    'The HolePunch Event is used to display information about each hole punch removed
    nRet = LEAD1.HolePunchRemove(HOLEPUNCH_SINGLE_REGION Or HOLEPUNCH_USE_DPI Or HOLEPUNCH_USE_COUNT Or HOLEPUNCH_USE_LOCATION, _
                                 2, 4, 0, 0, 0, 0, HOLEPUNCH_LEFT)

    If (nRet = 0) Then
        LEAD1.FreeRgn
        LEAD1.SetRgnHandle LEAD1.hDocCleanRgn, 0, 0, L_RGN_SET
        LEAD1.hDocCleanRgn = 0 'no longer need rgn
        LEAD1.RgnFrameType = RGNFRAME_COLOR
    End If

Private Sub LEAD1_HolePunchRemove(ByVal hRgn As Stdole.OLE_HANDLE, ByVal fBoundingRectLeft As Single, ByVal fBoundingRectTop As Single, ByVal fBoundingRectWidth As Single, ByVal fBoundingRectHeight As Single, ByVal iHoleIndex As Long, ByVal iHoleTotalCount As Long, ByVal iWhiteCount As Long, ByVal iBlackCount As Long)
    Debug.Print "HolePunch at " & CStr(fBoundingRectLeft) & "," & CStr(fBoundingRectTop) _
                & "," & CStr(fBoundingRectWidth) & "," & CStr(fBoundingRectHeight) _
                & " HoleIndex=" & CStr(iHoleIndex) & " TotalCount=" & CStr(iHoleTotalCount) _
                & " WhiteCount=" & CStr(iWhiteCount) & " BlackCount=" & CStr(iBlackCount)
End Sub


hWnd example for Visual Basic
hWnd (AnnToolbar) example for Visual Basic

Private Sub LEAD1_AnnToolDestroy()
   Dim iTool As Integer
   Dim x As Long
   MsgBox "Toolbar has been destroyed!"
   If (LEAD1.AnnToolbar.hWnd = 0) Then LEAD1.AnnToolbar.Create 0, 0, 0
   iTool = LEAD1.AnnToolbar.Tool
End Sub


IgnoreFilters example for Visual Basic

Note: Also works with Access 95 and 97.

This example shows how to ignore filters so that certain files are not loaded.

    'First, make sure PreLoaded Filters does not
    'contain CMP, and that 0 filters can be cached
    Lead1.PreLoadFilters 3, 0, "BMP,FAX,TIF"

    'now, ignore cmp filter (never load cmp files)
    Lead1.IgnoreFilters "CMP"


InfoBits (Thumbnail Browser Control) example for Visual Basic

Private Sub LEADThumb1_ThumbnailEvent(ByVal Bitmap As Long, ByVal pszFilename As String, ByVal nStatusCode As Integer, ByVal nPercent As Integer)
    Dim out$

    If (nStatusCode = 0) Then 'successful thumbnail generation
        'save thumbnails in a multipage TIFF file
        LEAD1.Bitmap = Bitmap
        LEAD1.Save "d:\temp\thumbs.tif", FILE_TIF, 24, 0, SAVE_APPEND
        out$ = pszFilename & Chr(13)
        out$ = out$ & "Format: " & CStr(LEADThumb1.InfoFormat) & Chr(13)
        out$ = out$ & "Compression: " & CStr(LEADThumb1.InfoCompression) & Chr(13)
        out$ = out$ & "Bits: " & CStr(LEADThumb1.InfoBits) & Chr(13)
        out$ = out$ & "Width: " & CStr(LEADThumb1.InfoWidth) & Chr(13)
        out$ = out$ & "Height: " & CStr(LEADThumb1.InfoHeight) & Chr(13)
        out$ = out$ & "Page: " & CStr(LEADThumb1.InfoPage) & Chr(13)
        out$ = out$ & "TotalPages: " & CStr(LEADThumb1.InfoTotalPages) & Chr(13)
        out$ = out$ & "SizeDisk: " & CStr(LEADThumb1.InfoSizeDisk) & Chr(13)
        out$ = out$ & "SizeMem: " & CStr(LEADThumb1.InfoSizeMem) & Chr(13)
        out$ = out$ & "XRes: " & CStr(LEADThumb1.InfoXRes) & Chr(13)
        out$ = out$ & "YRes: " & CStr(LEADThumb1.InfoYRes) & Chr(13)
        MsgBox out$
    End If
    LEADThumb1.ContinueBrowse = True 'continue the browse operation
End Sub


InfoHasAlpha example for Visual Basic

    LEAD1.Load "c:\temp\1.jpg", 24, 1, 1 'load a 24-bit image
    LEAD2.Bitmap = LEAD1.Bitmap
    LEAD2.ColorRes 8, 0, 0, 0 'just make it 8-bit
    'now set an alpha channel
    LEAD1.BitmapAlpha = LEAD2.Bitmap

    'save and free
    LEAD1.Save "c:\temp\32.png", FILE_PNG, 32, 0, 0
    LEAD1.Bitmap = 0
    LEAD2.Bitmap = 0

    MsgBox "Pause"

    're-load
    LEAD1.GetFileInfo "c:\temp\32.png", 0, 0
    If (LEAD1.InfoHasAlpha <> False) Then
        LEAD1.Load "c:\temp\32.png", 0, 1, 1
    End If
    LEAD2.Bitmap = LEAD1.BitmapAlpha


InfoLayers example for Visual Basic

' This example all the layers in a file to a bitmap list
LEAD1.GetFileInfo "c:\temp\layers.psd", 0, 0

If LEAD1.InfoLayers = 0 then
   MsgBox "This file has no layers!"
Else
   ' load the first layer directly
LEAD1.LoadLayer "c:\temp\layers.psd", 0, 0

' steal the bitmaps from the other control
LEAD1.RefBitmap = True

For i = 1 to LEAD1.InfoLayers - 1
   ' use a second control to load the other layers
   ' using LEAD1 to load the other layers would invalidate the bitmap list
   LEAD2.LoadLayer "c:\temp\layers.psd", 0, i
   ' append the layer to the bitmap list
   LEAD1.InsertBitmapListItem -1, LEAD2.Bitmap
   Next
End If


InfoViewPerspective example for Visual Basic

    LEAD1.GetFileInfo "c:\test.tif", 1, 0
    MsgBox CStr(LEAD1.InfoViewPerspective)


Insert (ImageList Control) example for Visual Basic

'load an image
LEAD1.Load "v:\images\eagle.cmp", 0, 0, 1
'insert it into the ImageList control
LEADImgList1.Insert LEAD1.Bitmap, "testing", 1
LEADImgList1.EnsureVisible LEADImgList1.Count – 1
MsgBox "new item, press OK to move back to top"
LEADImgList1.ScrollItems -LEADImgList1.RowCount


InsertAt (ImageList Control) example for Visual Basic

'load an image
LEAD1.Load "v:\images\eagle.cmp", 0, 0, 1
'insert it into the ImageList control at the first item
LEADImgList1.InsertAt LEAD1.Bitmap, "test2", 1, 0


InsertBitmapListItem example for Visual Basic

Note: Also works with Access 95 and 97.

This example loads an ordinary file and uses it to create and play an animation. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

Dim nMax As Double ' Maximum width or height for bitmaps in the list
Dim BitmapWidth As Double ' Width of the bitmap
Dim BitmapHeight As Double ' Height of the bitmap
Dim I As Long  ' Loop Counter

nMax = 160
Lead2.Load "c:\lead\images\image1.cmp", 0, 0, 1
BitmapWidth = Lead2.BitmapWidth
BitmapHeight = Lead2.BitmapHeight

' Reduce memory requirements, if necessary. Only small bitmaps play smoothly.
If (BitmapWidth > nMax) Then
   Lead2.Size nMax, (BitmapHeight * nMax) / BitmapWidth, RESIZE_RESAMPLE
ElseIf (BitmapHeight > nMax) Then
   Lead2.Size (BitmapWidth * nMax) / BitmapHeight, nMax, RESIZE_RESAMPLE
End If

' Dither to an optimized palette, leaving the last color blank to use
' for transparency.
Lead2.ColorRes 8, CRP_IDENTITYPALETTE, CRD_FLOYDSTEINDITHERING, 255

' Set an arbitrary transparent color in the last position of the bitmap palette.
Lead2.BitmapPalette(255) = RGB(212, 222, 202)

' Set the playback values that will apply to all bitmaps in the list.
Lead2.BitmapDelay = 10
Lead2.BitmapTop = 0
Lead2.BitmapLeft = 0
Lead2.BitmapEnableTransparency = True
Lead2.BitmapTransparentColor = 16777216 + 255 ' Specified by palette index
Lead2.BitmapDisposalMethod = ANIMATIONDISPOSAL_RESTOREBACKGROUND

' Free the LEAD1 control's current bitmap list.
Lead1.BitmapList = 0

' Populate the bitmap list in the LEAD1 control.
For I = 0 To 36
   Lead1.InsertBitmapListItem I, Lead2.Bitmap
   ' Rotate, using the transparent color as the fill color.
   Lead1.BitmapListIndex = I
   Lead1.Rotate 1000 * I, 0, 16777216 + 255
Next I

' Set the animation playback properties
Lead1.AnimationBackColor = RGB(0, 0, 255)
Lead1.AnimationBitsPerPixel = 8
Lead1.AnimationHeight = Lead1.ScaleHeight
Lead1.AnimationWidth = Lead1.ScaleWidth
Lead1.AnimationLoop = False
For I = 0 To 255
   Lead1.AnimationPalette(I) = Lead1.BitmapPalette(I)
Next I

' Set properties for a scaled animation.
Lead1.AutoRepaint = True
Lead1.AutoSetRects = False

' Set the image display size to match the LEAD control.
Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight

' Start the animation.
Lead1.AnimationEnable = True

' Free the LEAD2 control's bitmap.
Lead2.BitmapList = 0


InsertFromBitmapList (ImageList Control) example for Visual Basic

'load an image
LEAD1.Load "v:\images\eagle.cmp", 0, 0, 1
'make a bitmap list
LEAD2.InsertBitmapListItem 0, LEAD1.Bitmap
LEAD1.Rotate 2500, 0, 0
LEAD2.InsertBitmapListItem 0, LEAD1.Bitmap
LEAD1.Rotate 2500, 0, 0
LEAD2.InsertBitmapListItem 0, LEAD1.Bitmap
LEAD1.Rotate 2500, 0, 0

'now, insert the items from the bitmap list into the ImageList Control
LEADImgList1.InsertFromBitmapList LEAD2.BitmapList, "test_list"


Intensity example for Visual Basic

Note: Also works with Access 95 and 97.

This example lightens the bitmap and repaints the image.

Lead1.Intensity 150
Lead1.ForceRepaint


IntensityDetect example for Visual Basic

Note: Also works with Access 95 and 97.

This example filters the bitmap to get the lightest intensities and repaints the image.

Lead1.IntensityDetect 200, 255
Lead1.ForceRepaint


Invert example for Visual Basic

Note: Also works with Access 95 and 97.

This example inverts the bitmap's colors and repaints the image.

Lead1.Invert
Lead1.ForceRepaint


InvertedText example for Visual Basic

    Dim nRet As Integer
    'InvertedText
    'This example finds all inverted text regions greater than 5 inches in width and 1/2 inch in height
    'and inverts the text so that it appears normal
    'The InvertedText Event is used to display additional information about the inverted text regions
    'A LEAD region is updated to show all of the changes
    LEAD1.DocCleanSuccess = SUCCESS_REMOVE
    nRet = LEAD1.InvertedText(INVERTEDTEXT_SINGLE_REGION Or INVERTEDTEXT_LEAD_REGION Or INVERTEDTEXT_USE_DPI, 5000, 500, 70, 95)
    If (nRet = 0) Then
        LEAD1.FreeRgn
        LEAD2.Bitmap = LEAD1.DocCleanBitmap 'copy the result so we can get the rgn handle
        LEAD1.SetRgnHandle LEAD2.GetRgnHandle, 0, 0, L_RGN_SET
        LEAD2.Bitmap = 0 'no longer need copy
        LEAD1.DocCleanBitmap = 0 'no longer need rgn either
        LEAD1.RgnFrameType = RGNFRAME_COLOR
    End If

Private Sub LEAD1_InvertedText(ByVal hRgn As Stdole.OLE_HANDLE, ByVal fBoundingRectLeft As Single, ByVal fBoundingRectTop As Single, ByVal fBoundingRectWidth As Single, ByVal fBoundingRectHeight As Single, ByVal iWhiteCount As Long, ByVal iBlackCount As Long)
    Debug.Print "Inverted at " & CStr(fBoundingRectLeft) & "," & CStr(fBoundingRectTop) & "," & CStr(fBoundingRectWidth) & "," & CStr(fBoundingRectHeight) & " WhiteCount=" & CStr(iWhiteCount) & " BlackCount=" & CStr(iBlackCount)
End Sub


IsSigned example for Visual Basic

' Load the bitmap data as signed so we can use a different conversion
LEAD1.LoadSigned = True
LEAD1.Load "c:\temp\signed.tif", 0, 0, 1
' use the non-default conversion "zero to center"
LEAD1.ConvertSignedToUnsigned SHIFT_ZERO_TO_CENTER


ISISAcquire example for Visual Basic

    'The following example acquires a single image using ISISAcquire.
    Dim nret As Integer
    LEADISIS1.EnableMethodErrors = False
    nret = LEADISIS1.ISISLoadDriver
    If (nret = 0) Then
        nret = LEADISIS1.ISISAcquire(hWnd, ISIS_SHOWUI)
        LEADISIS1.ISISUnloadDriver
    End If
    If (nret = 0) Then
        LEAD1.Bitmap = LEADISIS1.Bitmap
    Else
       If nret <> ERROR_ISIS_CANCEL Then
          MsgBox "Error " & CStr(nret) & "during ISIS Scan!"
       End If
    End If


ISISAcquireMulti example for Visual Basic

'The following example prepares for scanning multiple images by setting tags and enabling the ISISPage event and then scans multiple images, using ISISAcquireMulti method.

Dim nMaxPages As Long
Dim nRet As Integer
    nMaxPages = 10
    LEADISIS1.EnableMethodErrors = False
    LEADISIS1.EnableISISEvent = True
    nRet = LEADISIS1.ISISLoadDriver
    If (nRet = 0) Then
        LEADISIS1.ISISSetTag TAG_SCANAHEAD, TAG_SCANAHEAD_YES
        LEADISIS1.ISISGetTag TAG_MAXPAGES, nMaxPages
        LEADISIS1.ISISSetTag TAG_SCANAHEAD_MAXPAGES, nMaxPages / 2
        LEADISIS1.ISISSetTag TAG_COMPRESSION, TAG_COMPRESSION_G4
        nRet = LEADISIS1.ISISAcquireMulti(hWnd, "d:\temp\vbtest.tif", ISIS_SHOWUI,
FILE_CCITT_GROUP4, True)
        LEADISIS1.ISISUnloadDriver
        If (nRet <> 0) Then
            If (nRet = ERROR_USER_ABORT) Then
                MsgBox "Acquire canceled, " & CStr(LEADISIS1.PagesDiscarded) & " pages were
aborted!"
            ElseIf nRet <> ERROR_ISIS_CANCEL Then
                MsgBox "Error " & CStr(nRet) & Chr(13) & "During ISIS Scan"
            End If
        Else
            MsgBox "Image(s) acquired to file(s)" & "d:\temp\vbtest.tif"
        End If
    End If

Private Sub LEADISIS1_ISISPage(ByVal nPage As Long, ByVal pszFileName As String)
    Text1.Text = CStr(nPage)
    Text1.Refresh
    Text2.Text = pszFileName
    Text2.Refresh
    DoEvents
End Sub


ISISGetASCIITag example for Visual Basic

    Dim szVal As String

    LEADISIS1.ISISLoadDriver

    'get the default value
    LEADISIS1.ISISGetASCIITag TAG_PAGESIZE, szVal, True
    MsgBox "Default: " & szVal

    'get the current value
    LEADISIS1.ISISGetASCIITag TAG_PAGESIZE, szVal, False
    MsgBox "Current: " & szVal

    'set a new value
    'NOTE, this would have to be a valid choice for the scanner
    LEADISIS1.ISISSetASCIITag TAG_PAGESIZE, "Scanner's Maximum"

    'get the default value
    LEADISIS1.ISISGetASCIITag TAG_PAGESIZE, szVal, False
    MsgBox "Current: " & szVal

    LEADISIS1.ISISUnloadDriver


ISISGetASCIITagChoiceCount example for Visual Basic

    Dim n As Long
    Dim x As Long
    Dim szChoice As String

    LEADISIS1.ISISLoadDriver
    LEADISIS1.ISISGetASCIITagChoiceCount TAG_PAGESIZE, n
    MsgBox "Scanner has " & CStr(n) & " choices"
    For x = 0 To n - 1
        LEADISIS1.ISISGetASCIITagChoice TAG_PAGESIZE, x, szChoice
        MsgBox "Choice: " & CStr(x) & "  Value: " & szChoice
    Next x

    LEADISIS1.ISISUnloadDriver


ISISGetTagChoiceCount example for Visual Basic

    Dim lCount As Long
    Dim lVal As Long
    Dim x As Long

    LEADISIS1.ISISLoadDriver

    'try a long tag
    LEADISIS1.ISISGetTagChoiceCount TAG_IMAGEWIDTH, lCount
    MsgBox "Scanner has " & CStr(lCount) & " choices"
    For x = 0 To lCount - 1
        LEADISIS1.ISISGetTagChoice TAG_IMAGEWIDTH, x, lVal
        List1.AddItem "Choice: " & CStr(x) & "  Value: " & CStr(lVal)
    Next x

    'try a short tag
    LEADISIS1.ISISGetTagChoiceCount TAG_BRIGHTNESS, lCount
    MsgBox "Scanner has " & CStr(lCount) & " choices"
    For x = 0 To lCount - 1
        LEADISIS1.ISISGetTagChoice TAG_BRIGHTNESS, x, lVal
        List2.AddItem "Choice: " & CStr(x) & "  Value: " & CStr(lVal)
    Next x

    LEADISIS1.ISISUnloadDriver


IsISISAvailable example for Visual Basic

'The following example tests to see if ISIS is available.  If not, then a message is output in MsgBox.
    If (LEADISIS1.IsISISAvailable = False) Then
        MsgBox "ISIS Support not installed!"
    End If


ISISSelect example for Visual Basic

'The following example displays the ISISSelect DialogBox and writes a message indicating which ISIS Scanner Driver was selected.
    LEADISIS1.ISISSelect hWnd
    MsgBox LEADISIS1.DriverName & " was selected! "


ISISSetScanOptions example for Visual Basic

    LEADISIS1.ISISLoadDriver
    LEADISIS1.ISISSetScanOptions hWnd
    LEADISIS1.ISISUnloadDriver


IsSupportLocked (ISIS Control) example for Visual Basic

    Dim bRet As Boolean

    bRet = LEADISIS1.IsSupportLocked(L_SUPPORT_OCR)
    If (bRet) Then
        MsgBox "OCR Support Locked"
    End If


IsSupportLocked (OLE DB Control) example for Visual Basic

Dim bRet As Boolean

  bRet = LEADOLEDB1.IsSupportLocked(L_SUPPORT_DOCUMENT)
  If (bRet) Then
    MsgBox "Document Support Locked"
  End If


Item (ImageList Control) example for Visual Basic

Dim LEADItem As LEADImageListItem
Dim nCount As Long

LEADImgList1.SelectAll False
'flip the 3rd item's bitmap
LEAD1.Bitmap = LEADImgList1.Item(2).Bitmap
LEAD1.Flip
LEADImgList1.Item(2).Bitmap = LEAD1.Bitmap
'set the 4th and 6th items as selected
LEADImgList1.Item(3).Selected = True
LEADImgList1.Item(5).Selected = True

'now, count the selected items
nCount = 0
For Each LEADItem In LEADImgList1
    If LEADItem.Selected = True Then nCount = nCount + 1
Next
MsgBox CStr(nCount) & " Items were selected!"


ItemBackgroundColor (ImageList Control) example for Visual Basic

LEADImgList1.ItemBackgroundColor = RGB(255, 0, 0) 'set to RED


ItemSelected (ImageList Control) example for Visual Basic

Private Sub LEADImgList1_ItemSelected(ByVal nIndex As Long)
    MsgBox LEADImgList1.Item(nIndex).Text & " was selected!"
End Sub


ItemUnSelected example for Visual Basic

Private Sub LEADImgList1_ItemUnSelected(ByVal nIndex As Long)    MsgBox LEADImgList1.Item(nIndex).Text & " was unselected!"End Sub


ItemWidth (ImageList Control) example for Visual Basic

'set item display options
LEADImgList1.ItemWidth = 150
LEADImgList1.ItemHeight = 150
LEADImgList1.ItemVerticalSpacing = 20
LEADImgList1.ItemHorizontalSpacing = 20
LEADImgList1.DisplayItemText = False


J2KCompressionControl example for Visual Basic

   ' compress a lossless file
   LEAD1.J2KCompressionControl = J2K_COMP_LOSSLESS
   LEAD1.Save "c:\temp\lossless.j2k", FILE_J2K, 0, 0, SAVE_OVERWRITE


J2KCompressionRatio example for Visual Basic

   ' compress a JPEG2000 file using 100:1 comp ratio
   LEAD1.J2KCompressionControl = J2K_COMP_RATIO
   LEAD1.J2KCompressionRatio = 100#
   LEAD1.Save "c:\temp\100_to_1.j2k", FILE_J2K, 0, 0, SAVE_OVERWRITE


J2KROIControl Example for Visual Basic

Private Sub Command1_Click()
   LEAD1.J2KSetDefaults
   ' Set our options
   LEAD1.J2KCompressionRatio = 1000
   LEAD1.J2KCompressionControl = J2K_COMP_RATIO
   LEAD1.J2KUseROI = True
   LEAD1.J2KROIControl = J2K_USEOPTION_RECT
   LEAD1.J2KROILeft = 200
   LEAD1.J2KROITop = 200
   LEAD1.J2KROIWidth = 600
   LEAD1.J2KROIHeight = 600

   LEAD1.J2KXTsiz = 100
   LEAD1.J2KYTsiz = 100
   ' Save the bitmap to disk
   LEAD1.Save "c:\image1.j2k", FILE_J2K, 24, 2, SAVE_OVERWRITE
End Sub


J2KSetDefaults example for Visual Basic

   Dim msg$

   LEAD1.UnlockSupport L_SUPPORT_J2K, L_KEY_J2K

   ' Display all the default JPEG2000 advanced options
   LEAD1.J2KSetDefaults

   msg$ = msg$ + "J2KUseColorTransform = " + CStr(LEAD1.J2KUseColorTransform) + vbCrLf
   msg$ = msg$ + "J2KDerivedQuantization = " + CStr(LEAD1.J2KDerivedQuantization) + vbCrLf

   msg$ = msg$ + "J2KXOsiz = " + CStr(LEAD1.J2KXOsiz) + vbCrLf
   msg$ = msg$ + "J2KYOsiz = " + CStr(LEAD1.J2KYOsiz) + vbCrLf
   msg$ = msg$ + "J2KXTsiz = " + CStr(LEAD1.J2KXTsiz) + vbCrLf
   msg$ = msg$ + "J2KYTsiz = " + CStr(LEAD1.J2KYTsiz) + vbCrLf
   msg$ = msg$ + "J2KXTOsiz = " + CStr(LEAD1.J2KXTOsiz) + vbCrLf
   msg$ = msg$ + "J2KYTOsiz = " + CStr(LEAD1.J2KYTOsiz) + vbCrLf

   msg$ = msg$ + "J2KDecompLevel = " + CStr(LEAD1.J2KDecompLevel) + vbCrLf
   msg$ = msg$ + "J2KProgressOrder = " + CStr(LEAD1.J2KProgressOrder) + vbCrLf
   msg$ = msg$ + "J2KCodBlockWidth = " + CStr(LEAD1.J2KCodBlockWidth) + vbCrLf
   msg$ = msg$ + "J2KCodBlockHeight = " + CStr(LEAD1.J2KCodBlockHeight) + vbCrLf

   msg$ = msg$ + "J2KCBS_SelectiveACBypass = " + CStr(LEAD1.J2KCBS_SelectiveACBypass) + vbCrLf
   msg$ = msg$ + "J2KCBS_ResetContextOnBoundaries = " + CStr(LEAD1.J2KCBS_ResetContextOnBoundaries) + vbCrLf
   msg$ = msg$ + "J2KCBS_TerminationOnEachPass = " + CStr(LEAD1.J2KCBS_TerminationOnEachPass) + vbCrLf
   msg$ = msg$ + "J2KCBS_VerticallyCausalContext = " + CStr(LEAD1.J2KCBS_VerticallyCausalContext) + vbCrLf
   msg$ = msg$ + "J2KCBS_PredictableTermination = " + CStr(LEAD1.J2KCBS_PredictableTermination) + vbCrLf
   msg$ = msg$ + "J2KCBS_ErrorResilienceSymbol = " + CStr(LEAD1.J2KCBS_ErrorResilienceSymbol) + vbCrLf

   msg$ = msg$ + "J2KGuardBits = " + CStr(LEAD1.J2KGuardBits) + vbCrLf
   msg$ = msg$ + "J2KDerivedBaseMantissa = " + CStr(LEAD1.J2KDerivedBaseMantissa) + vbCrLf
   msg$ = msg$ + "J2KDerivedBaseExponent = " + CStr(LEAD1.J2KDerivedBaseExponent) + vbCrLf

   msg$ = msg$ + "J2KUseSOPMarker = " + CStr(LEAD1.J2KUseSOPMarker) + vbCrLf
   msg$ = msg$ + "J2KUseEPHMarker = " + CStr(LEAD1.J2KUseEPHMarker) + vbCrLf

   MsgBox msg$


J2KTargetFileSize example for Visual Basic

   ' compress a 30K JPEG2000 file
   LEAD1.J2KCompressionControl = J2K_COMP_TARGETSIZE
   LEAD1.J2KTargetFileSize = 30 * 1024
   LEAD1.Save "c:\temp\30k.j2k", FILE_J2K, 0, 0, SAVE_OVERWRITE


KeyDown (ImageList Control) example for Visual Basic

Private Sub LEADImgList1_KeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer)
    MsgBox "KeyDown event"
End Sub


KeyPress (ImageList Control) example for Visual Basic

Private Sub LEADImgList1_KeyPress(ByVal KeyAscii As Integer)
    MsgBox "KeyPress event!"
End Sub


KeyPress example for Visual Basic

Note: Also works with Access 95 and 97.

This example demonstrates the KeyPress event.

Private Sub Lead1_KeyPress(KeyAscii As Integer)

    'This example uses the KeyPress event to implement a custom scale mode.
    'There is no particular reason to put this code in this event, except that
    'we needed examples of both the event and the scale mode.

    If KeyAscii = 67 Then 'Uppercase C
        'This example sets an custom scale mode and uses it to crop the
        'display. Keep in mind that the actual height and width do not change.
        'Only the unit of measure changes.

        'Change the scale so that origin is moved one-third right and one-third down
        Lead1.ScaleLeft = -1
        Lead1.ScaleTop = -1
        Lead1.ScaleWidth = 3
        Lead1.ScaleHeight = 3

        'Crop the display so that it takes up the middle third of the height and width
        Lead1.DstClipLeft = 0
        Lead1.DstClipTop = 0
        Lead1.DstClipWidth = 1
        Lead1.DstClipHeight = 1

        Lead1.ForceRepaint
    End If

End Sub


KeyUp (ImageList Control) example for Visual Basic

Private Sub LEADImgList1_KeyUp(ByVal KeyCode As Integer, ByVal Shift As Integer)
    MsgBox "KeyUp event"
End Sub


LevelLowBit example for Visual Basic

Note: Also works with Access 95 and 97.

This is also the example for LevelHighBit.

This example sets LevelLowBit and LevelHighBit to display the image using only the eight least significant bits.

     Lead1.AutoRepaint = False
     'use least significant 8 bits
     Lead1.LevelLowBit = 0
     Lead1.LevelHighBit = 7

     Lead1.AutoRepaint = True


LevelLUT example for Visual Basic

Note: Also works with Access 95 and 97.

This is also the example for MinVal property and MaxVal property.

The following example sets LevelLowBit and LevelHighBit to use all bits, gets the minimum and maximum bits and intensity values for the image, and then sets the LUT so that pixels with values in the minimum range are mapped to the color RED, while pixels with values in the maximum range are mapped to BLUE.

Dim min As Long
Dim max As Long
Dim i As Long

    Lead1.AutoRepaint = False
    'use all bits
    Lead1.LevelLowBit = 0
    Lead1.LevelHighBit = Lead1.BitmapBits - 1

    Lead1.GetMinMaxBits
    Lead1.GetMinMaxVal
    max = Lead1.MaxVal
    min = Lead1.MinVal

    'set LUT so that min range maps to RED and max range maps to BLUE
    For i = min To min + 100
     Lead1.LevelLUT(i) = RGB(255, 0, 0)
    Next
    For i = max - 100 To max
     Lead1.LevelLUT(i) = RGB(0, 0, 255)
    Next
    Lead1.AutoRepaint = True


LevelLUTLength example for Visual Basic

Note: Also works with Access 95 and 97.

This example writes out the number of entries in the LUT.

Text1.Text = CStr(Lead1.LevelLUTLength)


LineProfile example for Visual Basic

   Dim maxR As Long, maxG As Long, maxB As Long, i As Integer
   LEAD1.LineProfile 10, 10, 220, 120
   For i = 0 To LEAD1.LineProfileSize - 1
      If LEAD1.LineProfileRed(i) > maxR Then maxR = LEAD1.LineProfileRed(i)
      If LEAD1.LineProfileGreen(i) > maxG Then maxG = LEAD1.LineProfileGreen(i)
      If LEAD1.LineProfileBlue(i) > maxB Then maxB = LEAD1.LineProfileBlue(i)
   Next
   MsgBox "maxR= " & maxR & ", maxG= " & maxG & ", maxB= " & maxB


LineRemove example for Visual Basic

    Dim nRet As Integer
    'Line Remove
    'This examples removes vertical lines that are at least 200 pixels in length
    'and no more than 5 pixels in width
    'The lines can have gaps up to two pixels in length
    'The LineRemove Event is used to display information about each line removed
    nRet = LEAD1.LineRemove(LINE_USE_GAP, 200, 5, 7, 10, 2, 0, LINEREMOVE_HORIZONTAL)

Private Sub LEAD1_LineRemove(ByVal nStartRow As Long, ByVal nStartCol As Long, ByVal nLength As Long, ByVal hRgnLine As Stdole.OLE_HANDLE)
    Debug.Print "Line at " & CStr(nStartRow) & "," & CStr(nStartCol) & " Length=" & CStr(nLength)
End Sub


Load (Mixed Raster Content Control) example for Visual Basic

   Dim nPages As Long
   LEADMrc1.EnableMethodErrors= True
   LEADMrc1.GetPagesCount "c:\temp\testT44.mrc", nPages
   Caption = "File has " & nPages & " pages"
   ' load last page
   LEADMrc1.Load "c:\temp\testT44.mrc", nPages
   LEAD1.Bitmap = LEADMrc1.Bitmap


LoadArray example for Visual Basic

Command1_Click()
   Dim buf(20000) As Byte
   Dim count As Integer

   Open "c:\Test.JPG" For Binary Access Read As #1
      Get #1, , buf
      LEAD1.LoadArray buf, 0, 0, -1, UBound(buf) - LBound(buf) + 1
   Close #1
End Sub


LoadDatabase example for Visual Basic

    'load existing db
    LEADImgList1.LoadDatabase "c:\temp\testdb6.tif"


LoadFromFile (ImageList Control) example for Visual Basic

'Insert all pages from a multipage file
LEADImgList1.LoadFromFile "d:\temp\img\test1.tif", 0, 0, -1
MsgBox "Inserted " & CStr(LEADImgList1.Count) & " Items!"


LoadCompressed example for Visual Basic

LEAD1.LoadCompressed = COMP_NONE
' now "test.tif" will be loaded uncompressed
LEAD1.Load "test.tif",0,0,1


LoadICCProfile example for Visual Basic

   Dim i As Integer
   Dim pData As Variant
   Dim nRet As Integer
   Open "c:\MyICC.ICM" For Binary As #1
   nRet = LEAD1.LoadICCProfile("c:\dst_rgb_image.tif", pData, 1)

   For i = 0 To UBound(pData) - LBound(pData) - 1
     Put #1, , CByte(pData(i))
   Next i
   Close #1


LoadIFD example for Visual Basic

' All examples will assume that "test.tif" has over 1002 images
' This example will load pages 1000 and 1001 after getting the information for page 1000:
LEAD1.GetFileInfo "test.tif", 1000, 0
' Setting LoadIFD to InfoIFD indicates that 1000 is treated as page 1
LEAD1.LoadIFD = LEAD1.InfoIFD
LEAD1.Load "test.tif", 0, 1, 2
' Reset LoadIFD to 0 so other TIF files will be handled properly
LEAD1.LoadIFD = 0


LoadInfo example for Visual Basic
LoadInfo... example for Visual Basic

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.	 Add a CommandButton control and code its click procedure as follows:

Private Sub Command4_Click()
    Lead1.ScaleMode = 3 'Pixels

    'Make the image look OK as a 1-bit image.
    Lead1.Size Lead1.ScaleWidth, Lead1.ScaleHeight, RESIZE_RESAMPLE
    Lead1.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 = Lead1.BitmapHeight
    MyInfoOffset = 0
    MyInfoWidth = Lead1.BitmapWidth
    MyInfoXRes = Lead1.BitmapXRes
    MyInfoYRes = Lead1.BitmapYRes

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

    'Repaint the newly loaded image.
    Lead1.ForceRepaint

End Sub

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

Private Sub Lead1_LoadInfo()
    'Use the form-level variables to supply format information.
    Lead1.LoadInfoBits = MyInfoBits
    Lead1.LoadInfoFlags = MyInfoFlags
    Lead1.LoadInfoFormat = MyInfoFormat
    Lead1.LoadInfoHeight = MyInfoHeight
    Lead1.LoadInfoOffset = MyInfoOffset
    Lead1.LoadInfoWidth = MyInfoWidth
    Lead1.LoadInfoXRes = MyInfoXRes
    Lead1.LoadInfoYRes = MyInfoYRes
End Sub

5.	Run your program to test it.


LoadMemory example for Visual Basic

This example uses WIN16 API calls to load a file into memory, then uses the LoadMemory method to load the memory-resident file into a bitmap.

' Declare WIN16 API constants and functions in the Declarations module.

Private Const OF_READ = &H0
Private Const OF_CREATE = &H1000
Private Const SEEK_SET = 0
Private Const SEEK_END = 2
Private Const GMEM_MOVEABLE = &H2

Private Type OFSTRUCT
    cBytes As String * 1
    fFixedDisk As String * 1
    nErrCode As Integer
    reserved As String * 4
    szPathName As String * 128
End Type

Private Declare Function OpenFile Lib "kernel" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Integer) As Integer

Private Declare Function hread Lib "kernel" Alias "_hread" (ByVal hFile As Integer, ByVal lpBuffer As Long, ByVal wBytes As Long) As Long

Private Declare Function hwrite Lib "kernel" Alias "_hwrite" (ByVal hFile As Integer, ByVal lpBuffer As Long, ByVal lBytes As Long) As Long

Private Declare Function lclose Lib "kernel" Alias "_lclose" (ByVal hFile As Integer) As Integer

Private Declare Function llseek Lib "kernel" Alias "_llseek"(ByVal hFile As Integer, ByVal lOffset As Long, ByVal iOrigin As Integer) As Long

Private Declare Function GlobalAlloc Lib "kernel" (ByVal wFlags As Integer, ByVal dwBytes As Long) As Integer

Private Declare Function GlobalFree Lib "kernel" (ByVal hMem As Integer) As Integer

Private Declare Function GlobalLock Lib "kernel" (ByVal hMem As Integer) As Long

Private Declare Function GlobalUnlock Lib "kernel" (ByVal hMem As Integer) As Integer

' ---------------------- Code for LoadMemory (16 bit) -------------

Private Sub LoadMemory_Click()
   Dim hf As Integer   ' For WIN32 declare this as Long
   Dim hMem As Integer   ' For WIN32 declare this as Long
   Dim lpMem As Long
   Dim iSize As Long
   Dim of As OFSTRUCT
   Dim nRet As Long

   ' Load the file into memory.

   hf = OpenFile("c:\lead\images\image1.cmp", of, OF_READ)
   If hf = -1 Then
      MsgBox ("Error opening file!")
      GoTo quit_loadmemory
   End If

   iSize = llseek(hf, 0, SEEK_END)

   nRet = llseek(hf, 0, SEEK_SET)

   hMem = GlobalAlloc(GMEM_MOVEABLE, iSize)
   If hMem = -1 Then
      lclose (hf)
      MsgBox ("Not enough memory to hold the file in memory!")
      GoTo quit_loadmemory
   End If

   lpMem = GlobalLock(hMem)
   If lpMem = 0 Then
      lclose (hf)
      GlobalFree (hMem)
      MsgBox ("Not enough memory to hold the file in memory!")
      GoTo quit_loadmemory
   End If

   If hread(hf, lpMem, iSize) < iSize Then
      lclose (hf)
      GlobalUnlock (hMem)
      GlobalFree (hMem)
      MsgBox ("Error reading file")
      GoTo quit_loadmemory
   End If

   lclose (hf)

   GlobalUnlock (hMem)

   'Load the bitmap from the memory-resident file.

   If Lead1.LoadMemory(hMem, 0, 0, -1, iSize) <> 0 Then
      MsgBox ("Error calling LoadMemory")
   Else
      MsgBox ("LoadMemory succeeded")
   End If

   GlobalFree (hMem)

quit_loadmemory:
End Sub


LoadResize example for Visual Basic

   LEAD2.LoadResize"c:\temp\test1.cmp", 250, 50, RESIZE_RESAMPLE, 0


LoadUseViewPerspective example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example times the loading of a bitmap with and without changing the internal view perspective.

'Declare local variables
Dim StartTime, DeltaTime

'Do not include paints when measuring time.
Lead1.AutoRepaint = False

'Time the load using the bitmap's view perspective.
Lead1.LoadUseViewPerspective = True
StartTime = Now
Lead1.Load "d:\lead\images\rotated.tif", 0, 0, 1
DeltaTime = DateDiff("s", StartTime, Now)
MsgBox Str$(DeltaTime) + " seconds loaded as is"

'Time the load that converts the bitmap's view perspective.
Lead1.LoadUseViewPerspective = False
StartTime = Now
Lead1.Load "d:\lead\images\rotated.tif", 0, 0, 1
DeltaTime = DateDiff("s", StartTime, Now)
MsgBox Str$(DeltaTime) + " seconds converted on load"


MagGlassPaintContrast example for Visual Basic

Private Sub StartMagnifyingGlass()
    Dim nStatus As Integer

    ' Setting the Magnifying Glass Paint contrast, gamma and intensity
    LEAD1.MagGlassPaintContrast= LEAD1.MagGlassPaintContrast + 100
    LEAD1.MagGlassPaintGamma= LEAD1.MagGlassPaintGamma + 100
    LEAD1.MagGlassPaintIntensity= LEAD1.MagGlassPaintIntensity + 100

    ' Starting the Magnifying Glass
    nStatus = LEAD1.StartMagGlass (100, 100, 400, RGB(255, 0, 0), RGB(128, 128, 128), False, 1, False, CROSSHAIR_FINE, True, True)

    If (nStatus <> 0) Then
        MsgBox "Error Starting the Magnifying Glass, Error: " & CStr(nStatus)
    End If
End Sub


MaxFilter example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example erodes dark objects and repaints the image.

Lead1.EnableProgressEvent = True
Lead1.MaxFilter 3
Lead1.ForceRepaint


Median example for Visual Basic

Note: Also works with Access 95 and 97.

This example applies a median filter with a 3x3 neighborhood and redisplays the bitmap.

Lead1.Median 3
Lead1.ForceRepaint


MinFilter example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical  only.

This example dilates dark objects and repaints the image.

Lead1.EnableProgressEvent = True
Lead1.MinFilter 3
Lead1.ForceRepaint


Mosaic example for Visual Basic

Note: Also works with Access 95 and 97.

This example applies a mosaic effect with 8x8 tiles and redisplays the bitmap.

Lead1.Mosaic 8
Lead1.ForceRepaint


MotionBlur example for Visual Basic

   LEAD1.MotionBlur 12, 4500, False


MouseDown (ImageList Control) example for Visual Basic

Private Sub LEADImgList1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    Dim nItem As Long

    nItem = LEADImgList1.HitTest(x, y)

    If (nItem >= 0) Then
        LEADImgList1.SelectionColor = RGB(255, 0, 0)
        LEADImgList1.Item(nItem).Selected = True
    End If
End Sub
Private Sub LEADImgList1_Mouseup(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    Dim nItem As Long

    nItem = LEADImgList1.HitTest(x, y)

    If (nItem >= 0) Then
        LEADImgList1.SelectionColor = RGB(0, 0, 255)
        LEADImgList1.Item(nItem).Selected = True
    End If
End Sub


MouseMove (ImageList Control) example for Visual Basic

Private Sub LEADImgList1_Click()
    Dim nItem As Long

    nItem = LEADImgList1.HitTest(CInt(Label1.Caption), CInt(Label2.Caption))

    If (nItem >= 0) Then
        LEADImgList1.SelectionColor = RGB(255, 0, 0)
        LEADImgList1.Item(nItem).Selected = True
    End If
End Sub

Private Sub LEADImgList1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    Label1.Caption = x
    Label2.Caption = y
End Sub


MousePointer (ImageList Control) example for Visual Basic

LEADImgList1.MousePointer = 99
LEADImgList1.MouseIcon = LoadPicture("d:\temp\eye.ico")


MouseWheel (Main Control) example for Visual Basic

Private Sub Form_Load()
   LEAD1.Load "c:\1.bmp", 0, 0, 1
   LEAD1.EnableMouseWheel = True
End Sub

Private Sub LEAD1_MouseWheel(ByVal nDelta As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   If (Shift = 2) Then  ‘CTRL Key
      If (nDelta < 0) Then
         If (LEAD1.PaintZoomFactor < 100 * 16) Then
            LEAD1.PaintZoomFactor = LEAD1.PaintZoomFactor * 2
         End If
      Else
         If (LEAD1.PaintZoomFactor > 100 / 16) Then
            LEAD1.PaintZoomFactor = LEAD1.PaintZoomFactor / 2
         End If
      End If
   Else
      LEAD1.VScrollInfo.Pos = LEAD1.VScrollInfo.Pos – nDelta
   End If
End Sub


ODBC example for Visual Basic

Take the following steps to create and use a simple ODBC database, containing only images. (For a more sophisticated approach, refer to Using ODBC to Access Image Data.)

Note:	The LEADTOOLS ActiveX requires ODBC drivers that can properly handle long binary fields. examples have been tested and will work with version 3.0 of the Microsoft ODBC Desktop Driver Pack. (This driver pack ships with Access 95 and works on 32-bit systems.) You can download drivers from the LEAD BBS, the CompuServe forum, or the Worldwide Web home page. The CompuServe forum is at GO LEADTECH. The web page is ftp://ftp.leadtools.com/pub/utils/ODBC32.zip.  The file to download is ODBC32.ZIP.

1.	Make a copy of the project that you created in Loading and Displaying an Image; then load the copied project.

2.	In the Add-Ins menu, select the Data Manager...

3.	In the Data Manager Window's File menu, select New, and create an Access database named c:\lead\lead.mdb.

4.	Click the New button, and create a table with one field as follows:

Name: 	ltvbpic
Field Name: 	photo
Data Type: 	long binary

5.	Exit the Data Manager.

6.	Open the ODBC administrator and click the Add button.

7.	Select Microsoft Access driver and click the OK button.

8.	Enter the name LEADACCESS.

9.	Click the Select directory button and select the LEAD directory.

10.	Click the OK button; click the next OK button; then click the Close button.

11.	In Visual Basic, replace the code in the main form's init procedure as follows:

Private Sub Form_Load()

  'Position and size the main form so that it takes up most of the screen.
  Width = Screen.Width * 0.9
  Height = Screen.Height * 0.8
  Left = (Screen.Width - Width) / 2
  Top = (Screen.Height - Height) / 2
  ' Set the position and size of the LEAD control.
  ' Allow for a border of 1/8 of the form size.
  ' The units of measure do not matter, since we are calculating proportions.
  HeightAllowed = ScaleHeight * 3 / 4
  WidthAllowed = ScaleWidth * 3 / 4

  Lead1.Left = (ScaleWidth - WidthAllowed) / 2
  Lead1.Top = (ScaleHeight - HeightAllowed) / 2
  Lead1.Width = WidthAllowed
  Lead1.Height = HeightAllowed
  'Turn off automatic repainting and turn on scroll bars.
  Lead1.AutoRepaint = False
  Lead1.AutoScroll = True
  'Set the image display size to match the LEAD control
  Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
  Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
  ' Display the LEAD control.
  ' Lead1.BorderStyle = 1

  ' Open the database.
  DString = "ODBC;DSN=LEADACCESS"
  Lead1.dbOpen DString, "ltvbpic", "photo", DB_OPENOPTIONS_NONE
  Lead1.dbLoadBits = 24
  Lead1.dbLockingMode = DB_LOCKINGMODE_OPTIMISTIC
  Lead1.ForceRepaint

  If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
    Msg = "The database is empty."
    answer = MsgBox(Msg, 0, "Notice")
    Next.Enabled = False
    Prev.Enabled = False
  End If

End Sub

12.	Add a common dialog control to your main form and name it Commdlg.

13.	At the top of your main form, add seven command buttons and name them as follows: Add, Update, Delete, First, Next, Prev, and Last.

14.	For the Add button, add the following code to the click procedure:

If Lead1.dbCanAppend = False Then
    Msg = "You cannot add to this database."
    answer = MsgBox(Msg, 0, "Error")
Else
    Lead1.dbAddNew
    Commdlg.Filter = "All Files|*.*"
    Commdlg.Flags = cdlOFNFileMustExist
    Commdlg.DialogTitle = "Open File"
    Commdlg.CancelError = True
    Commdlg.ShowOpen
    filename = Commdlg.filename
    Lead1.Load filename, 0, 0, 1
    nRet = Lead1.dbUpdate(FILE_CMP, 0, QFACTOR_QMS)
        If nRet <> 0 Then
            Msg = "You cannot update this database."
            answer = MsgBox(Msg, 0, "Error")
        Else
            Lead1.dbMoveLast
            Lead1.ForceRepaint
            Msg = "Image added to the database."
            answer = MsgBox(Msg, 0, "LEAD")
            Next.Enabled = True
            Prev.Enabled = True
            If Lead1.dbIsBOF = True Then
              Prev.Enabled = False
            Else
              Prev.Enabled = True
            End If
            If Lead1.dbIsEOF = True Then
              Next.Enabled = False
            Else
              Next.Enabled = True
            End If
    End If
End If

15.	For the Update button, add the following code to the click procedure:

If Lead1.dbCanUpdate = False Then
    Msg = "You cannot update this database."
    answer = MsgBox(Msg, 0, "Error")
ElseIf Lead1.dbIsBOF = True Or Lead1.dbIsEOF = True Then
    Msg = "There is no current record."
    answer = MsgBox(Msg, 0, "Error")
Else
    If Lead1.dbEditMode = DB_EDITMODE_NONE Then
        Lead1.dbEdit
        Lead1.Flip
        Lead1.ForceRepaint
    End If
    Lead1.dbUpdate FILE_CMP, 0, QFACTOR_QMS
End If

16.	For the Delete button, add the following code to the click procedure:

If Lead1.dbCanUpdate = False Then
    Msg = "You cannot update this database."
    answer = MsgBox(Msg, 0, "Error")
ElseIf Lead1.dbIsBOF = True Or Lead1.dbIsEOF = True Then
    Msg = "There is no current record."
    answer = MsgBox(Msg, 0, "Error")
Else
    Lead1.dbDelete
    Lead1.dbRequery
    Lead1.dbMoveFirst
    If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
      Next.Enabled = False
      Prev.Enabled = False
    End If
    Lead1.ForceRepaint
End If

17.	For the First button, add the following code to the click procedure:

If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
    Msg = "The database is empty."
    answer = MsgBox(Msg, 0, "Notice")
    Next.Enabled = False
    Prev.Enabled = False
Else
    Lead1.dbMoveFirst
    Prev.Enabled = False
    Next.Enabled = True
    Lead1.ForceRepaint
End If

18.	For the Next button, add the following code to the click procedure:

If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
    Prev.Enabled = False
    Next.Enabled = False
    Msg = "The database is empty."
    answer = MsgBox(Msg, 0, "Notice")
Else
      Lead1.dbMoveNext
      If Lead1.dbIsEOF = True Then
        Next.Enabled = False
        Lead1.dbMovePrev
        Msg = "Already at last record."
        answer = MsgBox(Msg, 0, "Notice")
      Else
        Prev.Enabled = True
      End If
      Lead1.ForceRepaint
End If

19.	For the Prev button, add the following code to the click procedure:

If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
    Prev.Enabled = False
    Next.Enabled = False
    Msg = "The database is empty."
    answer = MsgBox(Msg, 0, "Notice")
Else
      Lead1.dbMovePrev
      If Lead1.dbIsBOF = True Then
         Prev.Enabled = False
         Lead1.dbMoveNext
         Msg = "Already at first record."
         answer = MsgBox(Msg, 0, "Notice")
      Else
         Next.Enabled = True
      End If
      Lead1.ForceRepaint
End If
End Sub

20.	For the Last button, add the following code to the click procedure:

If Lead1.dbIsBOF = True And Lead1.dbIsEOF = True Then
    Msg = "The database is empty."
    answer = MsgBox(Msg, 0, "Notice")
    Next.Enabled = False
    Prev.Enabled = False
Else
    Lead1.dbMoveLast
    Next.Enabled = False
    Prev.Enabled = True
    Lead1.ForceRepaint
End If

21.	Update the main form's unload procedure as follows:

Private Sub Form_Unload(Cancel As Integer)
    Lead1.dbClose
End Sub

22.	Run your program to test it.


Oilify example for Visual Basic

Note: Also works with Access 95 and 97.

This example applies an oil-painting effect and repaints the image. The progress event is enabled because this the Oilify method, with a neighborhood of 10, is slow.

Lead1.EnableProgressEvent = True
Lead1.Oilify 10
Lead1.ForceRepaint


OLEDropAllowed example for Visual Basic

Note: Also works with Access 95 and 97.

This example toggles the OLEDropAllowed property.

If Lead1.OLEDropAllowed = False Then
  Lead1.OLEDropAllowed = True
Else
  Lead1.OLEDropAllowed = False
End If


OLEDropFile example for Visual Basic

This example sets the OLEDropAutoLoad property, based on the input from the MsgBox.

Private Sub LEAD1_OLEDropFile(ByVal pszName As String)
   ' when a file is dropped, bring up a dialog box and ask the user
   ' whether to load the file or not
   If MsgBox(pszName, vbYesNo) = vbYes Then
      LEAD1.OLEDropAutoLoad = True
   Else
      LEAD1.OLEDropAutoLoad = False
   End If
End Sub


OLEStartDrag (ImageList Control) example for Visual Basic

Dim strHistory As String
Private Sub Form_Load()
  LEADImgList1.DisplayItemText = True
  LEADImgList1.ScrollStyle = SCROLLSTYLE_VERTICAL
  LEADImgList1.ItemHeight = 150
  LEADImgList1.ItemWidth = 150
  LEADImgList1.AllowSelection = ALLOWSELECTION_MULTI

  LEADImgList2.DisplayItemText = True
  LEADImgList2.ScrollStyle = SCROLLSTYLE_VERTICAL
  LEADImgList2.ItemHeight = 150
  LEADImgList2.ItemWidth = 150
  LEADImgList2.AllowSelection = ALLOWSELECTION_MULTI

  LEADImgList1.LoadFromFile "c:\parrots.jpg", 0, 0, 1
End Sub
Private Sub History_Click()
   MsgBox strHistory
End Sub

Private Sub LEADImgList1_OLECompleteDrag(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   strHistory = strHistory + "LEADImgList1: OLE Complete Drag at pos X = " + CStr(x) + " and pos y = " + CStr(y)
End Sub

Private Sub LEADImgList1_OLEDragOver(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   strHistory = strHistory + "LEADImgList1: OLE Drag Over at pos X = " + CStr(x) + " and pos y = " + CStr(y)
End Sub
Private Sub LEADImgList1_OLEGiveFeedback()
   LEADImgList1.EnableUseDefaultCursor = False
End Sub

Private Sub LEADImgList1_OLEStartDrag(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   strHistory = strHistory + "LEADImgList1: OLE Start Drag at pos X = " + CStr(x) + " and pos y = " + CStr(y)
End Sub

Private Sub LEADImgList2_OLEGiveFeedback()
   LEADImgList2.EnableUseDefaultCursor = False
End Sub

Private Sub StartDrag_Click()
  LEADImgList1.EnableOLEDragMethod = True
  LEADImgList2.EnableOLEDragMethod = True

  LEADImgList1.OLEDragCursor = LoadPicture("g:\leadbase.ico")
  LEADImgList1.OLEDragCursor = LoadPicture("g:\leadbase.ico")
End Sub
Private Sub StopDrag_Click()
  LEADImgList1.EnableOLEDragMethod = False
  LEADImgList2.EnableOLEDragMethod = False
End Sub


OLEStartDrag (Main Control) example for Visual Basic

Dim strHistory As String
Private Sub Form_Load()
  LEAD1.Load "c:\Test.cmp", 0, 0, 1
End Sub

Private Sub History_Click()
   MsgBox strHistory
End Sub

Private Sub LEAD1_OLECompleteDrag(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   strHistory = strHistory + "LEAD1: OLE Complete Drag at pos X = " + CStr(x) + " and pos y = " + CStr(y)
End Sub

Private Sub LEAD1_OLEDragOver(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   strHistory = strHistory + "LEAD1: OLE Drag Over at pos X = " + CStr(x) + " and pos y = " + CStr(y)
End Sub

Private Sub LEAD1_OLEGiveFeedback(pbUseDefaultCursor As Boolean)
   pbUseDefaultCursor = False
End Sub

Private Sub LEAD1_OLEStartDrag(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   strHistory = strHistory + "LEAD1: OLE Start Drag at pos X = " + CStr(x) + " and pos y = " + CStr(y)
End Sub

Private Sub LEAD2_OLEGiveFeedback(pbUseDefaultCursor As Boolean)
   pbUseDefaultCursor = False
End Sub

Private Sub StartDrag_Click()
  LEAD1.EnableOLEDragMethod = True
  LEAD2.EnableOLEDragMethod = True

  LEAD1.OLEDragCursor = LoadPicture("e:\lead14\com\leadbase.ico")
  LEAD2.OLEDragCursor = LoadPicture("e:\lead14\com\leadbase.ico")
End Sub

Private Sub StopDrag_Click()
  LEAD1.EnableOLEDragMethod = False
  LEAD2.EnableOLEDragMethod = False
End Sub


OwnerDrawItem event example for Visual Basic

Private Sub LEADImgList1_OwnerDrawItem(ByVal nIndex As Long, ByVal hDC As Long, ByVal ItemLeft As Single, ByVal ItemTop As Single, ByVal ItemRight As Single, ByVal ItemBottom As Single, ByVal ItemBackLeft As Single, ByVal ItemBackTop As Single, ByVal ItemBackRight As Single, ByVal ItemBackBottom As Single)
    'use Windows GDI to custom paint the items
    'make sure you have previously set ScaleMode to Pixels (3) so
    'that you get these values in Pixels rather than Twips!!!!!!!
    'ex. LEADImgList1.ScaleMode = 3 'pixels

    'You will need these 2 Windows API declarations
    'Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
    'Private Declare Function Ellipse Lib "gdi32" (ByVal hDC As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long

    Dim szText As String
    szText = LEADImgList1.Item(nIndex).Text

    Ellipse hDC, ItemLeft, ItemTop, ItemRight, ItemBottom
    TextOut hDC, ItemLeft, ItemTop, szText, Len(szText)
End Sub


OwnerDrawItems example for Visual Basic

    'toggle OwnerDraw
    LEADImgList1.OwnerDrawItems = Not LEADImgList1.OwnerDrawItems


PageCount (ImageList Control) example for Visual Basic

Private Sub LEADImgList1_Scroll()
    MsgBox "Page: " & CStr(LEADImgList1.CurrentPage) & " of " _
                  & CStr(LEADImgList1.PageCount)
End Sub


Paint event example for Visual Basic

This example uses some Windows API functions to demonstrate the following:

 Paint event

 Click event

 Enabled property

 hWnd property

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

2.	On the Insert menu, select the Module option, and use the API Text Viewer to add the following from the appropriate (16- or 32-bit) Windows API file:

Data types: RECT and POINTAPI

Declarations: InvalidateRect, LineTo, and MoveToEx

3.	Add global variables for MyRect and MyPoint as shown in the following 16-bit code:

Type RECT
    left As Integer
    top As Integer
    right As Integer
    bottom As Integer
End Type
Global MyRect As RECT

Type POINTAPI
    x As Integer
    y As Integer
End Type
Global MyPoint As POINTAPI

Declare Sub InvalidateRect Lib "User" (ByVal hWnd As Integer, lpRect As RECT, ByVal bErase As Integer)
Declare Function LineTo Lib "GDI" (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer) As Integer
Declare Function MoveToEx Lib "GDI" (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer, lpPoint As POINTAPI) As Integer

4.	Close the code module.

5.	Return to Form1, add a command button to the top of your main form, and in the properties box, change both its name and caption to Toggle.

6.	Add a text box to the top of your form, and in the properties box, change its name to Directions, and change its Text property to the following:

Use the Toggle button to turn on or turn off Click-Splat

7.	Add the following code to the Toggle button's Click procedure. This code uses the Enabled property to toggle the LEAD control's ability to respond to click events.

If (Lead1.Enabled = False) Then
  Lead1.Enabled = True
  Directions.Caption = "Click on the image for a splat"
  Toggle.Text = "Disable"
Else
  Lead1.Enabled = False
  Directions.Text = "Click does nothing"
  Toggle.Caption = "Enable"
End If

8.	Add the following code to the LEAD1 Click procedure. When the Enabled property is true, this code uses a Windows API call to generate a paint event.

' Use pixels for API calls
SavedMode = Lead1.ScaleMode
Lead1.ScaleMode = 3 'Pixels

' Use InvalidateRect to generate a paint message
MyRect.left = 0
MyRect.top = 0
MyRect.bottom = Lead1.ScaleHeight
MyRect.right = Lead1.ScaleWidth

hCtl = Form1.Lead1.hWnd
InvalidateRect hCtl, MyRect, True

' Set the ScaleMode back to the default
Lead1.ScaleMode = SavedMode

9.	Add the following code to the Lead1 Paint procedure. It uses Windows GDI functions to draw random lines on the control whenever there is a paint event.

MyPoint.x = 0
MyPoint.y = 0

' Create a device context for the control that the GDI functions can access
LeadClientDC = Lead1.GetClientDC

' Draw random lines on the control. This overlay does not affect the bitmap.
xStart = Int((Rnd(1) * Lead1.ScaleWidth) + 1)
yStart = Int((Rnd(1) * Lead1.ScaleHeight) + 1)
MyReturn = MoveToEx(LeadClientDC, xStart, yStart, MyPoint)
For i = 1 To 50
  xDelta = Int(81 * Rnd(1)) - 40
  yDelta = Int(81 * Rnd(1)) - 40
  xEnd = xStart + xDelta
  yEnd = yStart + yDelta
  MyReturn = LineTo(LeadClientDC, xEnd, yEnd)
  MyReturn = MoveToEx(LeadClientDC, xStart, yStart, MyPoint)
Next

' Remove the lock from the device control
Lead1.ReleaseClientDC

10.	Run your program to test it.


PaintContrast example for Visual Basic

Note: Also works with Access 95 and 97.

This example increases the contrast for painting images.

Lead1.PaintContrast = Lead1.PaintContrast + 100
Lead1.ForceRepaint


PaintDither (ImageList Control) example for Visual Basic

    'set the control to use error diffusion
    LEADImgList1.PaintDither = PAINTDITHER_DIFFUSION


PaintDither example for Visual Basic

Note: Also works with Access 95 and 97.

This example turns on error diffusion and redisplays the bitmap.

Lead1.PaintDither = PAINTDITHER_DIFFUSION
Lead1.ForceRepaint


PaintEffect example for Visual Basic

The following modules use the KeyDown and KeyUp events to repaint the image with effects.

Private Sub Lead1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 116 Then 'Code for F5
   Lead1.AutoRepaint = False
   Lead1.BackErase = True
   Lead1.EffectGrain = 20
   Lead1.EffectDelay = 50
   Lead1.WandSize = 5
   Lead1.WandColor = RGB(255,255,0)   'Yellow Wand
   Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R
   Lead1.ForceRepaint
End If
End Sub

Private Sub Lead1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 116 Then 'Code for F5
   Lead1.PaintEffect = EFX_EFFECT_WIPE_R_TO_L
   Lead1.ForceRepaint
   Lead1.PaintEffect = EFX_EFFECT_NONE
End If
End Sub


PaintGamma example for Visual Basic

Note: Also works with Access 95 and 97.

This example increases the gamma correction for painting images.

Lead1.PaintGamma = Lead1.PaintGamma + 100
Lead1.ForceRepaint


PaintIntensity example for Visual Basic

Note: Also works with Access 95 and 97.

This example increases the intensity for painting images.

Lead1.PaintIntensity = Lead1.PaintIntensity + 100
Lead1.ForceRepaint


PaintMaxPasses example for Visual Basic

Note: Also works with Access 95 and 97.

This example includes two procedures. First, a button click starts a multi-pass paint effect; then LEAD's PaintNotification event changes the direction of the effect on each pass.

Private Sub StartEffect_Click()
  Lead1.AutoRepaint = False
  Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R 'Set the Effect
  Lead1.PaintMaxPasses = 5                     '5 total passes
  Lead1.PaintPass = 1                          'Start with pass number 1
  Lead1.PaintNotificationDelay = 200          ' Delay 200 milliseconds between passes
  Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1             'Load the image
  Lead1.AutoRepaint = True
End Sub

Private Sub Lead1_PaintNotification(ByVal uPass As Integer, ByVal uType As Integer)
  'If the first pass is complete
  If ((uType = EFX_NOTIFY_IMAGE) And (uPass > 0)) Then
      'Toggle the effect from left_to_right to right_to_left
      If Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R Then
          Lead1.PaintEffect = EFX_EFFECT_WIPE_R_TO_L
      Else
          Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R
      End If
  End If
End Sub


PaintPalette example for Visual Basic

This example sets the paint palette to the palette of each Lead control. It then loads two images and dithers them to 8 bits per pixel with optimized palettes, and displays them side by side.  In 8-bit display mode, you can see the palette problems that result when you do not use a fixed palette.

Lead1.PaintPalette = PAINTPALETTE_AUTO
Lead2.PaintPalette = PAINTPALETTE_AUTO

'Disable automatic repainting of the image.
Lead1.AutoRepaint = False
Lead2.AutoRepaint = False

'Turn off scroll bars to make sure we use the full client area.
Lead1.AutoScroll = False
Lead2.AutoScroll = False

'Clear the bitmaps from memory
Lead1.Bitmap = 0
Lead2.Bitmap = 0

Screen.MousePointer = 11 'Hourglass
'Load the bitmaps. These hard-coded path names may be different on your system.
Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1
Lead2.Load "c:\lead\images\image2.cmp", 0, 0, 1

'Change the bitmaps to 8 BPS with optimized palettes
Lead1.ColorRes 8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0
Lead2.ColorRes 8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0

'Make the controls visible so that we can size and position them.
'They will not really appear until we load an image and paint it.
Lead1.Visible = True
Lead2.Visible = True

'Set the variables used for preserving the aspect ratio.
HeightFactor1 = Lead1.BitmapHeight
WidthFactor1 = Lead1.BitmapWidth
HeightFactor2 = Lead2.BitmapHeight
WidthFactor2 = Lead2.BitmapWidth
HeightAllowed = ScaleHeight * 0.8
WidthAllowed = ScaleWidth * 0.45

'Center each LEAD control on half of the form, preserving the aspect ratio.
'Check to see if using the maximum width will make the image too tall.
'Set the dimensions based on the result.
If (WidthAllowed * HeightFactor1) / WidthFactor1 < HeightAllowed Then
  Lead1.Left =  (ScaleWidth / 4) - (WidthAllowed / 2)
  Lead1.Width = WidthAllowed
  Lead1.Height = (Lead1.Width * HeightFactor1) / WidthFactor1
  Lead1.Top = (ScaleHeight - Lead1.Height) / 2
Else
  Lead1.Top = (ScaleHeight - HeightAllowed) / 2
  Lead1.Height = HeightAllowed
  Lead1.Width = (Lead1.Height * WidthFactor1) / HeightFactor1
  Lead1.Left = (ScaleWidth / 4) - (Lead1.Width / 2)
End If
If (WidthAllowed * HeightFactor2) / WidthFactor2 < HeightAllowed Then
  Lead2.Left =  (ScaleWidth * 3/4) - (WidthAllowed / 2)
  Lead2.Width = WidthAllowed
  Lead2.Height = (Lead2.Width * HeightFactor2) / WidthFactor2
  Lead2.Top = (ScaleHeight - Lead2.Height) / 2
Else
  Lead2.Top = (ScaleHeight - HeightAllowed) / 2
  Lead2.Height = HeightAllowed
  Lead2.Width = (Lead2.Height * WidthFactor2) / HeightFactor2
  Lead2.Left = (ScaleWidth * 3 / 4) - (Lead2.Width / 2)
End If

'Set the image display sizes to match the LEAD controls
Lead1.SetDstRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
Lead1.SetDstClipRect 0, 0, Lead1.ScaleWidth, Lead1.ScaleHeight
Lead2.SetDstRect 0, 0, Lead2.ScaleWidth, Lead2.ScaleHeight
Lead2.SetDstClipRect 0, 0, Lead2.ScaleWidth, Lead2.ScaleHeight

'Display the images
Lead1.ForceRepaint
Lead2.ForceRepaint
Screen.MousePointer = 0 ' Default


PaintROP3 example for Visual Basic

Note: Also works with Access 95 and 97.

This example demonstrates the PaintROP3 property.

' Add this WIN32 constant to the Declarations module
Private Const SRCINVERT = 6684742

' Use this code to paint an inverted image.
Lead1.PaintROP3 = SRCINVERT
Lead1.ForceRepaint


PaintScaling (ImageList Control) example for Visual Basic

'toggle through the paint scale modes
Select Case LEADImgList1.PaintScaling
Case PAINTSCALING_NORMAL
LEADImgList1.PaintScaling = PAINTSCALING_RESAMPLE
Text1.Text = "Resample"
Case PAINTSCALING_RESAMPLE
LEADImgList1.PaintScaling = PAINTSCALING_BICUBIC
Text1.Text = "Bicubic"
Case PAINTSCALING_BICUBIC
LEADImgList1.PaintScaling = PAINTSCALING_NORMAL
Text1.Text = "Normal"
End Select


PaintScaling example for Visual Basic

' This example sets the display to use bilinear interpolation
LEAD1.PaintScaling = PAINTSCALING_RESAMPLE


PaintSizeMode example for Visual Basic

Note: Also works with Access 95 and 97.

This example shows how to set the PaintSizeMode property so that the control uses only a vertical scroll bar.

Lead1.AutoScroll = True
Lead1.AutoSetRects = True
Lead1.PaintSizeMode = PAINTSIZEMODE_FITSIDES
Lead1.ForceRepaint


PaintSizeUseDPI example for Visual Basic

Note: Also works with Access 95 and 97.

This example toggles the PaintSizeUseDPI property.

If Lead1.PaintSizeUseDPI = False Then
  Lead1.PaintSizeUseDPI = True
Else
  Lead1.PaintSizeUseDPI = False
End If


PaintWhileLoad example for Visual Basic

Note: Also works with Access 95 and 97.

This example causes the LEAD control to paint the image as it loads.

Lead1.AutoRepaint = False
Lead1.AutoSetRects = True
Lead1.PaintSizeMode = PAINTSIZEMODE_FIT
Lead1.PaintWhileLoad = True

Lead1.Load "d:\lead\images\image1.cmp", 0, 0, 1


PaintZoomFactor example for Visual Basic

Note: Also works with Access 95 and 97.

This example shows how to set the PaintZoomFactor property so that image is scaled 200 percent for display.

Lead1.AutoScroll = False
Lead1.AutoSetRects = True
Lead1.PaintSizeMode = PAINTSIZEMODE_ZOOM
Lead1.PaintZoomFactor = 200
Lead1.ForceRepaint


PatternStyle example for Visual Basic

Note: Also works with Access 95 and 97.

This example paints a transition with a diagonal cross pattern.

Lead1.AutoRepaint = False
Lead1.EffectDelay = 50
Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1
Lead1.TransitionEffect = EFX_EFFECT_WIPE_RECTANGLE_OUT
Lead1.TransitionStyle = EFX_TRANSITION_PATTERN
Lead1.PatternStyle = EFX_PATTERN_DIAG_CROSS
Lead1.PatternBackColor = RGB(255, 0, 0)
Lead1.PatternForeColor = RGB(0, 0, 255)
 Lead1.AutoRepaint = True


PCDRes example for Visual Basic

This example checks for a high resolution image and loads it if possible.

myfile = "v:\images\img0024.pcd" 'No PCD sample image is included with LEADTOOLS
Lead1.GetFileInfo myfile, 0, 0
If Lead1.InfoPCDRes(PCDRES_4BASE) = True Then
    Lead1.PCDRes = PCDRES_4BASE
    msg = "Loading 1024 x 1536 resolution"
Else
    Lead1.PCDRes = PCDRES_BASE
    msg = "Loading 512 x 768 resolution"
End If
MsgBox msg

MousePointer = 11 ' hourglass

'Turn on the automatic display rectangles and the scroll bars.
Lead1.AutoSetRects = True
Lead1.AutoScroll = True

'Load the file.
Lead1.Load myfile, 0, 0, 1

Lead1.ForceRepaint

MousePointer = 0 ' default


PDFSaveLowMemory example for Visual Basic

'Save a Color PDF file using less RAM for the process
LEAD1.PDFSaveLowMemory = True
LEAD1.Save "d:\temp\test.pdf", FILE_RAS_PDF_JPEG, 0, 0, 0


PDFSaveUseDPI example for Visual Basic

Private Sub Save_Click()
'Use image DPI when saving as PDF .
LEAD1.PDFSaveUseDPI = True
'Save image as Raster PDF with CCITT G4 compression
LEAD1.Save "c:\\tmp.pdf", FILE_RAS_PDF_G4, 1, 1, SAVE_OVERWRITE
End Sub


PDFXResolution example for Visual Basic

Private Sub Command1_Click()

'This example does the following :
' 1- Changes the horizontal and vertical PDF resolutions to 150 dpi .
' 2- Sets the pixel depth to 8.
' 3- Disables both font and graphics anti-aliasing.
' 4- Forces the PDF module to use it's own installed fonts.
' 5- Loads a PDF file using the new settings.

'Set horizontal resolution
LEAD1.PDFXResolution = 150
'Set vertical resolution
LEAD1.PDFYResolution = 150
'Set Display depth
LEAD1.PDFDisplayDepth = 8
' No font anti-aliasing
LEAD1.PDFTextAlpha = 1
' No graphics anti-aliasing
LEAD1.PDFGraphicsAlpha = 1
' Use fonts installed by the PDF module
LEAD1.PDFUseLibFonts = True
'Load the PDF file
LEAD1.Load "c:\Test.pdf", 0, 0, 1
End Sub


PicturizeBitmapList example for Visual Basic

   LEAD1.PicturizeBitmapList 20, 15, 200, LEAD3.BitmapList


Picturize example for Visual Basic

' replace the current image in the main control with an image created
' from all the images present in c:\images. Resize all images present in that directory
' to 32x32 pixels and load them all in memory before proceeding

LEAD1.ScaleMode = 3	‘use pixels as measurement units for size
LEAD1.Picturize "c:\images", PICTURIZE_LOADALL+PICTURIZE_RESIZE, 32, 32


PicturizeSingle example for Visual Basic

   LEAD2.Load "c:\temp\test.cmp", 0, 1, 1
   LEAD1.PicturizeSingle LEAD2.Bitmap, 20, 15, 200


Pixel example for Visual Basic

Note: Also works with Access 95 and 97.

This example, using the MouseDown event, gets the value of the current pixel and sets all values in the line to that value. The example shows how to convert mouse coordinates to bitmap pixel coordinates, regardless of how the image is zoomed or scrolled.

Private Sub Lead1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
   Dim xycolor As Long
   Dim xfraction As Single
   Dim yfraction As Single
   Dim xPixel As Long
   Dim yPixel As Long

   'In VB, you get TWIPS; so set the scalemode accordingly.
   Lead1.ScaleMode = 1

   'Translate mouse coordinates to fractions of the destination width and height.
   xfraction = (x - Lead1.DstLeft) / Lead1.DstWidth
   yfraction = (y - Lead1.DstTop) / Lead1.DstHeight

   'Set the scalemode to pixels and convert fractions to bitmap pixel coordinates.
   Lead1.ScaleMode = 3
   xPixel = (Lead1.SrcWidth * xfraction) + Lead1.SrcLeft
   yPixel = (Lead1.SrcHeight * yfraction) + Lead1.SrcTop

   'Make the whole line the same color as the pixel.
   xycolor = Lead1.Pixel(xPixel, yPixel)
   For xPixel = 0 To Lead1.BitmapWidth - 1
      Lead1.Pixel(xPixel, yPixel) = xycolor
   Next
   Lead1.ForceRepaint
End Sub


PixelData example for Visual Basic

This example, using the MouseDown event, gets the value of the current pixel and sets all values in the line to that value. The example shows how to convert mouse coordinates to bitmap pixel coordinates, regardless of how the image is zoomed or scrolled.

Private Sub Lead1_MouseDown (Button As Integer, Shift As Integer, x As Single, y As Single)
   Dim xycolor As Variant
   Dim xfraction As Single
   Dim yfraction As Single
   Dim xPixel As Long
   Dim yPixel As Long
   'In VB, you get TWIPS; so set the scale mode accordingly.
   Lead1.ScaleMode = 1
   'Translate mouse coordinates to fractions of the destination width and height.
   xfraction = (x - Lead1.DstLeft) / Lead1.DstWidth
   yfraction = (y - Lead1.DstTop) / Lead1.DstHeight

   'Set the scale mode to pixels and convert fractions to bitmap pixel coordinates.
   Lead1.ScaleMode = 3
   xPixel = (Lead1.SrcWidth * xfraction) + Lead1.SrcLeft
   yPixel = (Lead1.SrcHeight * yfraction) + Lead1.SrcTop
   'Make the whole line the same color as the pixel.
   xycolor = Lead1.PixelData(xPixel, yPixel)
   'disable repainting
   Lead1.AutoRepaint = False
   For xPixel = 0 To Lead1.BitmapWidth - 1
      Lead1.PixelData(xPixel, yPixel) = xycolor
   Next
   ' re-enable repainting
   Lead1.AutoRepaint = True
End Sub


Posterize example for Visual Basic

Note: Also works with Access 95 and 97.

This example applies a six-color poster effect and redisplays the image.

Lead1.Posterize 6
Lead1.ForceRepaint


PreferredLoadFormat example for Visual Basic

LEAD1.PreferredLoadFormat = FILE_CMP


PreLoadFilters example for Visual Basic

Note: Also works with Access 95 and 97.

This example shows how to pre-load filters.

    'preload the BMP, PCX, FAX, and TIFF filters,
    'and allow 1 filter to be cached, while always
    'keeping 3 loaded.
    Lead1.PreLoadFilters 3, 1, "BMP,PCX,FAX,TIF"


PrinterScaleHeight example for Visual Basic

    Dim hdc As Long
    MsgBox "Width: " & CStr(LEAD1.PrinterScaleWidth) & "  Height: " & CStr(LEAD1.PrinterScaleHeight)
    hdc = LEAD1.PrintStart
    'print 1/4 of the printable region
    LEAD1.Render hdc, 0, 0, LEAD1.PrinterScaleWidth / 4, LEAD1.PrinterScaleHeight / 4
    LEAD1.PrintEnd (hdc)


PrintNewPage example for Visual Basic

    'change this to a file on your system
    LEAD1.Load "v:\images\babe.cmp", 0, 1, 1

    ' Set the variables used for preserving the aspect ratio.
    HeightFactor = LEAD1.BitmapHeight
    WidthFactor = LEAD1.BitmapWidth
    ' Allow a maximum of 3x3 inches on a 300dpi printer
    HeightAllowed = 900
    WidthAllowed = 900
    ' Print the LEAD control, preserving the aspect ratio.
    ' Check to see if using the maximum width will make the image too tall.
    ' Set the dimensions based on the result.
    If ((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed Then
        ControlWidth = WidthAllowed
        ControlHeight = (ControlWidth * HeightFactor) / WidthFactor
    Else
        ControlHeight = HeightAllowed
        ControlWidth = (ControlHeight * WidthFactor) / HeightFactor
    End If

    'start the print job
    MyPrinter = LEAD1.PrintStart
    LEAD1.Render MyPrinter, 0, 0, ControlWidth, ControlHeight
    'flip the image
    LEAD1.Flip
    'start a new page
    LEAD1.PrintNewPage MyPrinter
    'print the flipped image
    LEAD1.Render MyPrinter, 0, 0, ControlWidth, ControlHeight
    'end the print job
    LEAD1.PrintEnd MyPrinter


ProgressivePasses example for Visual Basic

Note: Also works with Access 95 and 97.

This example shows how to save and load a progressive file.

' Save the current image as a progressive CMP file.
Lead1.ProgressivePasses = 8
Lead1.Save "c:\lead\images\TMP.cmp", FILE_CMP, 24, QFACTOR_PQ2, SAVE_OVERWRITE

' Set properties to show progressive paints when we load.
Lead1.PaintWhileLoad = True
Lead1.AutoSetRects = False

' Load the file we just saved.
Lead1.ProgressivePasses = PROGRESSIVEPASSES_WHEN_MEANINGFUL
Lead1.Load "c:\lead\images\TMP.cmp", 0, 0, 1

' Restore the default behavior.
Lead1.ProgressivePasses = 0


ProgressStatus (OLE DB Control) example for Visual Basic

Private Sub LEADOLEDB1_ProgressStatus(ByVal nPercent As Integer)
    MAIN.Caption = CStr(nPercent) & "%"
    DoEvents
    'user asked to stop
    If (gbQuit = True) Then
        LEADOLEDB1.EnableProgressEvent = False
    End If
End Sub


ReadyState example for Visual Basic

Note: Also works with Access 95 and 97.

This example shows how to use the ReadyState property to test whether an asynchronous load is in progress.

If Lead1.ReadyState = READYSTATE_LOADING Then
    MsgBox "Still loading the image"
End If


RemapHue example for Visual Basic

' This example changes all green hues(and hues near green) to the hue of crNewColor

Private Function Increment(x As Integer) As Integer
Increment = (x + 1) Mod 256
End Function

Private Function Decrement(x As Integer) As Integer
Decrement = (x + 255) Mod 256
End Function

Private Function Add(x As Integer, y As Integer) As Integer
Add = (x + y) Mod 256
End Function

Private Sub Command1_Click()
   Dim i As Integer
   Dim nHueGreen As Integer
   Dim nHueNewColor As Integer
   Dim nHueChange As Integer
   Dim crNewColor As OLE_COLOR
   Dim iCount As Integer

   For i = 0 To 255
      LEAD1.MaskTable(i) = 0
      LEAD1.HTable(i) = i
   Next i

   'Get the hue for green
   nHueGreen = LEAD1.HSV_HfromRGB(RGB(0, 255, 0))

   'Obtain new hue (crNewColor can be any color)
   crNewColor = RGB(255, 255, 0)
   nHueNewColor = LEAD1.HSV_HfromRGB(crNewColor)
   nHueChange = nHueNewColor - nHueGreen

   If (nHueChange < 0) Then
    nHueChange = nHueChange + 256
   End If

   'Set values in uHueTable, uMaskTable
   LEAD1.HTable(nHueGreen) = LEAD1.HTable(nHueGreen) + nHueChange
   LEAD1.MaskTable(nHueGreen) = 1

   'set the hues near green (+/- 5)
   iCount = 0
   i = Increment(nHueGreen)
   While iCount < 5
      LEAD1.HTable(i) = Add(LEAD1.HTable(i), nHueChange)
      LEAD1.MaskTable(i) = 1
      i = Increment(i)
      iCount = iCount + 1
   Wend

   iCount = 0
   i = Decrement(nHueGreen)
   While iCount < 5
      LEAD1.HTable(i) = Add(LEAD1.HTable(i), nHueChange)
      LEAD1.MaskTable(i) = 1
      i = Decrement(i)
      iCount = iCount + 1
   Wend

   LEAD1.RemapHue True, True, False, False
End Sub


RemapTableSize example for Visual Basic

   If (LEAD1.BitmapBits = 16 And LEAD1.IsGrayscale()) _
      Or LEAD1.BitmapBits = 64 Or LEAD1.BitmapBits = 48 Then
      LEAD1.RemapTableSize = 65536
   ElseIf LEAD1.BitmapBits = 12 Then
      LEAD1.RemapTableSize = 4096
   Else
      LEAD1.RemapTableSize = 256
   End If


Remove (ImageList Control) example for Visual Basic

'remove the last item from the ImageList Control
LEADImgList1.Remove LEADImgList1.Count - 1


RefBitmapList example for Visual Basic

   ' tell LEAD1 to "steal" the bitmap list from LEAD2
   LEAD1.RefBitmapList = True
   ' move the bitmap list from LEAD2 to LEAD1
   LEAD1.BitmapList = LEAD2.BitmapList
   ' restore the default value for RefBitmapList
   LEAD1.RefBitmapList = False
   ' for safety, let LEAD2 know that its list has been emptied
   LEAD2.BitmapList = 0


RemoveRedeye example for Visual Basic

   LEAD1.SetRgnEllipse 80, 55, 35, 30, L_RGN_SET
   LEAD1.RemoveRedeye RGB(5, 20, 10), 125, 100


RenderCenter example for Visual Basic

    Printer.Print "Center the image on the page"

    LEAD1.RenderCenter = True

    LEAD1.Render Printer.hDC, 0, 0, LEAD1.BitmapWidth, LEAD1.BitmapHeight

    Printer.NewPage

    Printer.EndDoc


Resize event example for Visual Basic

This example demonstates the Resize event.

Private Sub Lead1_Resize()
    'Before using this example you must add a text box to your form.
    'Then, you can exercise this example by coding a command button that
    'changes the width and height of the Lead1 control
    Text1.Text = "Control size: " + CStr(Lead1.Width) + " x " + CStr(Lead1.Height)
    Text1.Refresh
End Sub


Resize (ImageList Control) example for Visual Basic

Private Sub LEADImgList1_Resize()
    Dim out$
    'display new Row/Col counts
    out$ = "RowCount: " & CStr(LEADImgList1.RowCount)
    out$ = out$ & "  ColumnCount: " & CStr(LEADImgList1.ColumnCount)
    MsgBox out$
End Sub


ResizeRgn example for Visual Basic

   LEAD1.RgnFrameType = RGNFRAME_ANIMATED
   LEAD1.SetRgnRect 40, 60, 280, 200, L_RGN_SET
   MsgBox "About to resize"
   LEAD1.ResizeRgn 20, RGN_CONTRACT, False


RGBfromHSV example for Visual Basic

'Takes an HSV, displays the HSV components, and displays the RGB components

Private Sub HSVtoRGB(h As Integer, s As Integer, v As Integer)
Dim cr As OLE_COLOR
Dim red As Integer
Dim green As Integer
Dim blue As Integer

cr = LEAD1.RGBfromHSV(h, s, v)
red = cr And &HFF
green = (cr \ &H100) And &HFF
blue = cr \ &H10000
MsgBox "HSV (" & h & "," & s & "," & v & ") is RGB(" & red & "," & green & "," & blue & ")"
End Sub


RgnChange example for Visual Basic

The following code for the RgnChange event updates a text box using the GetRgnArea method. You can test it by adding a text box for the lesson described in Outlining, Dragging, and Pasting a Region.

Private Sub Lead1_RgnChange()
    MyText = "Number of pixels in region: "
    MyText = MyText + CStr(Lead1.GetRgnArea)
    Text1.Text = MyText
End Sub


RgnFrameColor example for Visual Basic

LEAD1.RgnFrameColor = vbBlue
LEAD1.RgnFrameType = RGNFRAME_COLOR
LEAD1.SetRgnRect 10, 10, 200, 200, L_RGN_SET


Rotate example for Visual Basic

This example rotates the bitmap 45 degrees and redisplays the image. It resizes the bitmap to accommodate the rotation and uses blue as the fill color.

Lead1.Rotate 4500, ROTATE_RESIZE, RGB(0,0,255)
Lead1.AutoSetRects = True 'Make sure the display rectangles are adjusted
Lead1.ForceRepaint


RowCount (ImageList Control) example for Visual Basic

Dim LinesPerPage as Long

If (LEADImgList1.ScrollStyle = SCROLLSTYLE_VERTICAL) Then
    LinesPerPage = LEADImgList1.RowCount / LEADImgList1.PageCount
Else
    LinesPerPage = LEADImgList1.ColumnCount / LEADImgList1.PageCount
End If


Saturation example for Visual Basic

Note: Also works with Access 95 and 97.

This example increases the saturation of colors in the bitmap and redisplays the image.

Lead1.Saturation 1000
Lead1.ForceRepaint


Save example for Visual Basic

This example saves the image as a PNG file, loads the new file, and redisplays the bitmap.

Screen.MousePointer = 11 'Hourglass
Lead1.Save "c:\lead\images\tmp.png", FILE_PNG, 8, 1, SAVE_OVERWRITE
Lead1.Load "c:\lead\images\tmp.png", 0, 0, 1
Lead1.ForceRepaint
Screen.MousePointer = 0 ' default


Save (Mixed Raster Content Control) example for Visual Basic

   LEADMrc1.MaskCoder= MRC_MASK_COMPRESSION_FAX_G4
   LEADMrc1.BackgroundCoder= MRC_BACKGROUND_COMPRESSION_JPEG
   LEADMrc1.BackgroundQFactor = 20
   LEADMrc1.EnhanceQuality = False
   LEADMrc1.Save "c:\temp\test.mrc", False
   LEADMrc1.SaveT44 "c:\temp\testT44.mrc", False


SaveArray example for Visual Basic

Private Sub SaveArray_Click()
   Dim MyVar As Variant
   Dim lSize As Long
   MyVar = LEAD1.SaveArray(FILE_CMP, 0, 2)
   lSize = LEAD1.ArraySize(MyVar)
   Open "c:\i\1.jpg" For Binary Access Write As #1
      Put #1, 1, MyVar
   Close #1
End Sub


SaveBuffer example for Visual Basic

'This sample loads the file 'szFileName', and saves it to memory buffer allocated by the user
'The original memory buffer is 1 bytes, which is too small to accommodate the image
'The SaveBuffer callback gets called as necessary, allowing the user to reallocate the memory buffer as needed
'When the image is completely saved in memory, it is loaded into a second LEAD control
'
'The following declarations are for calling Windows API's to allocate memory
'Private Declare Function HeapAlloc Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal dwBytes As Long) As Long
'Private Declare Function HeapReAlloc Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal lpMem As Long, ByVal dwBytes As Long) As Long
'Private Declare Function HeapFree Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal lpMem As Long) As Long
'Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
'Private Declare Function HeapCreate Lib "kernel32" (ByVal flOptions As Long, ByVal dwInitialSize As Long, ByVal dwMaximumSize As Long) As Long
'Private Declare Function HeapDestroy Lib "kernel32" (ByVal hHeap As Long) As Long
'
'The following variables are declared globally
'Dim lHeap As Long
'Dim lHeapAddress As Long

Private Sub SampleLoadSaveBuffer(szFileName As String)
Dim lHeapInitialSize As Long
Dim lMemInitialSize As Long
Dim nRet As Integer

'Create the heap
lHeap = 0
lHeapInitialSize = 1000
lHeap = HeapCreate(0, lHeapInitialSize, 0)

'Allocate the first chunk of memory to be 100 bytes
lHeapAddress = 0
lMemInitialSize = 1
lHeapAddress = HeapAlloc(lHeap, 0, lMemInitialSize)

LEAD1.Load szFileName, 0, 0, 1
LEAD1.SaveBufferSize= lMemInitialSize
LEAD1.SaveBufferAddress= lHeapAddress
LEAD1.EnableSaveBufferEvent= True
nRet = LEAD1.SaveBuffer(FILE_TIF, 24, 0, SAVE_OVERWRITE)
If (nRet <> 0) Then
    MsgBox "SaveBuffer Error: " + Str(nRet)
End If

'Load the file in memory into a second LEAD control
nRet = LEAD1.LoadBuffer(LEAD1.SaveBufferAddress, 24, 0, 1, LEAD1.SaveBufferSize)

'Free the allocated memory
HeapFree lHeap, 0, lHeapAddress

'Destroy the heap
HeapDestroy lHeap
End Sub

'The SaveBuffer event allows the user to reallocate the buffer as needed
Private Sub LEAD1_SaveBuffer(ByVal uRequiredSize As Long)
Dim dRet As Long
lHeapAddress = HeapReAlloc(lHeap, 0, lHeapAddress, uRequiredSize)
If (lHeapAddress = 0) Then
    MsgBox "HeapReAlloc Error"
    LEAD1.EnableSaveBufferEvent= False
Else
    LEAD1.SaveBufferSize = uRequiredSize
    LEAD1.SaveBufferAddress = lHeapAddress
End If
End Sub


SaveDatabase example for Visual Basic

    'save to db
    LEADImgList1.SaveDatabase "c:\temp\testdb7.tif", False


SaveIFD example for Visual Basic

' This example will add 100 pages to a file faster by continuously using the IFD of the last page
dim Page as integer
' Save page 1, to make sure the file exists
LEAD1.Save "test.tif", FILE_TIF, 0, 0, SAVE_APPEND
For Page = 2 To 100
   ' get the IFD of the last page
   LEAD1.GetFileInfo "test.tif", 100000, 0
   LEAD1.SaveIFD = LEAD1.InfoIFD
   LEAD1.Save "test.tif", FILE_TIF, 0, 0, SAVE_APPEND
Next
' reset the SaveIFD property so the other Save calls will work properly
LEAD1.SaveIFD = 0


SaveInterlaced example for Visual Basic

Note: Also works with Access 95 and 97.

This example saves the current image as an interlaced GIF file, then loads the saved image with a paint-while-load effect that shows the interlaced behavior.

'Save the current image as an interlaced GIF file.
Lead1.SaveInterlaced = True
Lead1.Save "d:\ltwin70\images\tmp.gif", FILE_GIF, 8, 1, SAVE_OVERWRITE

'Clear the bitmap so that we can see the paint-while-load effect.
Lead1.Bitmap = 0

'Paint the image while loading, showing that it is interlaced.
Lead1.PaintWhileLoad = True
Lead1.Load "d:\ltwin70\images\tmp.gif", 0, 0, 1


SaveLayers example for Visual Basic

' Save all the extra bitmaps in the bitmap list as layers
LEAD1.SaveLayers = True
For i = 1 to LEAD1.BitmapListCount - 1
   ' reset the layer info so all the layers are saved from 0,0 offset
   LEAD1.LayerLeft(i) = 0
   LEAD1.LayerTop(i) = 0
   LEAD1.LayerBlendModeKey(i) = "dark"
   LEAD1.LayerClipping(i) = 0
   LEAD1.LayerOpacity(i) = 40
   LEAD1.LayerMaskBitmap(i) = 0
Next
' set the active bitmap to be the first in the list
LEAD1.Save "c:\temp\layers.psd", FILE_PSD, 0, 0, SAVE_OVERWRITE


SaveLSB example for Visual Basic

' This example saves a bitmap compatible with the requirements
   ' of the TIFF Class F format
   ' make sure we are using pixels
   LEAD1.ScaleMode = 3
   LEAD1.SaveLSB = True
   LEAD1.SavePageNumberTag = True
   LEAD1.BitmapXRes = 204
   LEAD1.BitmapYRes = 196
   ' scale the bitmap (preserving the aspect ratio) to have a width of 1728 pixels
   LEAD1.Size 1728, LEAD1.BitmapHeight * 1728 / LEAD1.BitmapWidth, 0
   LEAD1.Save "c:\i\lsb.tif", FILE_CCITT_GROUP3_1DIM, 1, 0, SAVE_OVERWRITE


SaveMemory example for Visual Basic

This example uses SaveMemory to save a bitmap to a memory-resident file, uses GetMemoryInfo to examine the file size; then uses WIN16 API calls to save the file to disk and free the memory.

' Declare WIN16 API constants and functions in the Declarations module.

Private Const OF_READ = &H0
Private Const OF_CREATE = &H1000
Private Const SEEK_SET = 0
Private Const SEEK_END = 2
Private Const GMEM_MOVEABLE = &H2

Private Type OFSTRUCT
    cBytes As String * 1
    fFixedDisk As String * 1
    nErrCode As Integer
    reserved As String * 4
    szPathName As String * 128
End Type

Private Declare Function OpenFile Lib "kernel" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Integer) As Integer

Private Declare Function hread Lib "kernel" Alias "_hread" (ByVal hFile As Integer, ByVal lpBuffer As Long, ByVal wBytes As Long) As Long

Private Declare Function hwrite Lib "kernel" Alias "_hwrite" (ByVal hFile As Integer, ByVal lpBuffer As Long, ByVal lBytes As Long) As Long

Private Declare Function lclose Lib "kernel" Alias "_lclose" (ByVal hFile As Integer) As Integer

Private Declare Function llseek Lib "kernel" Alias "_llseek"(ByVal hFile As Integer, ByVal lOffset As Long, ByVal iOrigin As Integer) As Long

Private Declare Function GlobalAlloc Lib "kernel" (ByVal wFlags As Integer, ByVal dwBytes As Long) As Integer

Private Declare Function GlobalFree Lib "kernel" (ByVal hMem As Integer) As Integer

Private Declare Function GlobalLock Lib "kernel" (ByVal hMem As Integer) As Long

Private Declare Function GlobalUnlock Lib "kernel" (ByVal hMem As Integer) As Integer

' ---------------------- Code for SaveMemory (16 bit) -------------

Private Sub SaveMemory_Click()
   Dim hf       As Integer    ' For WIN32 this would be declared as Long
   Dim hMem     As Integer    ' For WIN32 this would be declared as Long
   Dim iSize    As Long
   Dim lpMem    As Long
   Dim of       As OFSTRUCT

   If Lead1.SaveMemory(hMem, FILE_CMP, 24, 2, iSize) <> 0 Then
      MsgBox ("Error calling SaveMemory")
      GoTo quit_savememory
   End If

   If Lead1.GetMemoryInfo(hMem, 0, iSize) <> 0 Then
      GlobalFree (hMem)
      GoTo quit_savememory
   End If

   ' Ask for a confirmation to save this file
   cMsg = "File info:" + Chr(13)
   cMsg = cMsg + Str(Lead1.InfoWidth) + " x " + Str(Lead1.InfoHeight)
   cMsg = cMsg + " x " + Str(Lead1.InfoBits) + " BPP" + Chr(13)
   cMsg = cMsg + "Size in memory: " + Str(Lead1.InfoSizeMem) + Chr(13)
   cMsg = cMsg + "Size on disk : " + Str(Lead1.InfoSizeDisk)

   If MsgBox(cMsg, vbYesNo, "Write this file on disk ") = vbNo Then
      GlobalFree (hMem)
      GoTo quit_savememory
   End If

   lpMem = GlobalLock(hMem)
   If lpMem = 0 Then
      GlobalFree (hMem)
      MsgBox ("Error calling GlobalLock")
      GoTo quit_savememory
   End If

   hf = OpenFile("c:\lead\images\savemem.cmp", of, OF_CREATE)
   If hf = -1 Then
      GlobalUnlock (hMem)
      GlobalFree (hMem)
      MsgBox ("Error calling GlobalLock")
      GoTo quit_savememory
   End If

   If hwrite(hf, lpMem, iSize) <> iSize Then
      MsgBox ("Error calling hwrite")
   Else
      MsgBox ("The file was saved successfully on disk.")
   End If

   lclose (hf)
   GlobalUnlock (hMem)
   GlobalFree (hMem)

quit_savememory:
End Sub


SavePage example for Visual Basic

 ‘ replace page 1 from TEST.TIF
LEAD1.SavePage = 1
LEAD1.Save "TEST.TIF", FILE_TIF, 8, 0, SAVE_REPLACE


SaveResolutionCount example for Visual Basic

Dim i As Integer

    ' assume that our bitmap is 800 x 600
    ' save 3 resolutions
    LEAD1.SaveResolutionCount = 3

    LEAD1.SaveResolutionWidth(0) = 800
    LEAD1.SaveResolutionHeight(0) = 600
    LEAD1.SaveResolutionWidth(1) = 400
    LEAD1.SaveResolutionHeight(1) = 300
    LEAD1.SaveResolutionWidth(2) = 200
    LEAD1.SaveResolutionHeight(2) = 150

    ' get the SaveResolution info
    MsgBox "SaveResolutionCount = " + CStr(LEAD1.SaveResolutionCount)

    For i = 0 To LEAD1.SaveResolutionCount - 1
        MsgBox "SaveResolution(" + CStr(i) + ") = " +  _
        CStr(LEAD1.SaveResolutionWidth(i)) + " x " +  _
        CStr(LEAD1.SaveResolutionHeight(i))
    Next


SaveTileWidth example for Visual Basic

' save TIF files with a tile size of 512x512
LEAD1.ScaleMode = 3 ' use pixels for the tile size
LEAD1.SaveTileWidth = 512
LEAD1.SaveTileHeight = 512
LEAD1.Save "c:\temp\tiled.tif", FILE_CCITT_GROUP4, 0, 0, SAVE_OVERWRITE


SaveToFile (ImageList Control) example for Visual Basic

'save all selected items to a multipage file

LEADImgList1.SaveToFile "d:\temp\testing.tif", FILE_TIF, 0, 0, True

'clear list

LEADImgList1.Clear

'reload file

LEADImgList1.LoadFromFile "d:\temp\testing.tif", 0, 1, -1


SaveWithStamp example for Visual Basic

Note: Also works with Access 95 and 97.

This example saves the image in a JPEG file that includes a thumbnail (stamp) image. It then loads the thumbnail from the new file.

' Declare a local variable
Dim SavedMode

SavedMode = Lead1.ScaleMode
Lead1.ScaleMode = 3 ' Use pixels for sizing the thumbnail
Lead1.SaveWithStamp "c:\lead\images\stamp.jpg", FILE_JPEG, 24, 30, 150, 100, 24
Lead1.ScaleMode = SavedMode
Lead1.LoadStamp "c:\lead\images\stamp.jpg"
Lead1.ForceRepaint


ScaleMode (ImageList Control) example for Visual Basic

'set the scalemode to pixels
LEADImgList1.ScaleMode = 3
'........
'setup a custom scale
LEADImgList1.ScaleMode = SCALEMODE_USER
LEADImgList1.ScaleWidth = 1000
LEADImgList1.ScaleHeight = 500


Scroll event example for Visual Basic

This example demonstrates the Scroll event.

Private Sub Lead1_Scroll()
    ' Add a TextBox control to your form and use it for this test
    Text1.Text = "Image origin: " + CStr(Lead1.DstLeft) + ", " + cStr(Lead1.DstTop)
    Text1.Refresh
End Sub


ScrollItems (ImageList Control) example for Visual Basic

   'scroll items down 2 lines
    LEADImgList1.ScrollItems 2


ScrollStyle (ImageList Control) example for Visual Basic

'Set scroll style to horizontal

LEADImgList1.ScrollStyle = SCROLLSTYLE_HORIZONTAL


SelectAll (ImageList Control) example for Visual Basic

'select all items

LEADImgList1.SelectAll True

MsgBox "wait"

'deselect allitems

LEADImgList1.SelectAll False


SelectedItems example for Visual Basic

    Dim x As Long
    x = LEADImgList1.SelectedCount
    While (x > 0)
        LEADImgList1.SelectedItems(0).Selected = False
        x = LEADImgList1.SelectedCount
    Wend


SelectionColor (ImageList Control) example for Visual Basic

LEADImgList1.SelectionColor = RGB(255, 0, 0) 'set to RED


SelectionStyle (ImageList Control) example for Visual Basic

'show selected items as pressed buttons
LEADImgList1.SelectionStyle = SELECTIONSTYLE_PRESSEDBUTTON


SetNewStripe (Mixed Raster Content Control) example for Visual Basic

   Dim nStripe As Long, nSeg As Long, nRet As Integer
   nStripe = LEADMrc1.SetNewStripe (0, 100)
   If nStripe >= 0 Then
      nSeg = LEADMrc1.SetStripeSegment (nStripe, 10, 10, 140, 80, SEGMENT_PICTURE, 0, 0)
      If nSeg >= 0 Then
         nRet = LEADMrc1.UpdateSegmentData (nSeg, 5, 5, 150, 90, SEGMENT_TEXT, vbBlack, vbWhite, True)
         If nRet = 0 Then
            MsgBox "Update Successful"
         End If
         nRet = LEADMrc1.DeleteSegment (nSeg)
         If nRet = 0 Then
            MsgBox "delete Successful"
         End If
      End If
   End If


SetRgn... example for Visual Basic

Note: Also works with Access 95 and 97.

This example demonstrates the SetRgnEllipse, SetRgnRect, SetRgnRoundRect, and SetRgnPolygon methods by simulating client area coordinates. Normally, you would get the coordinates interactively from mouse events and would use Windows GDI functions to outline the shape of each region before it is created.

To create the polygonal region, this example uses the PolygonSize, PolygonX, and PolygonY properties.

Also, to demonstrate the SetRgnColor method, it uses the Fill method to fill the region with a solid color, then uses the fill color to create a new region.

'Declare local variables.
Dim ZoomFactorX As Single 'Used for translating positioning information
Dim ZoomFactorY As Single 'Used for translating positioning information
Dim OffsetX, OffsetY, CurrentX, CurrentY 'To simulate mouse coordinates
Dim SimLeft, SimTop, SimWidth, SimHeight 'To simulate mouse coordinates
Dim LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, eW, eH 'For bitmap coordinates
Dim i As Integer 'Loop counter
Dim xPoint, yPoint 'Arrays for polygon points

'Initialize the variables that we will manipulate to simulate mouse coordinates.
OffsetX = Lead1.ScaleWidth / 15
OffsetY = Lead1.ScaleHeight / 15
CurrentX = OffsetX
CurrentY = OffsetY

'Set the zoom factors.
ZoomFactorX = Lead1.DstWidth / Lead1.SrcWidth
ZoomFactorY = Lead1.DstHeight / Lead1.SrcHeight

'Start by simulating the drawing of a rectangle.
SimLeft = CurrentX
SimTop = CurrentY
SimWidth = OffsetX * 2
SimHeight = OffsetY * 2

'Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (Lead1.DstLeft / ZoomFactorX) + Lead1.SrcLeft
LBRgnTop = (SimTop / ZoomFactorY) - (Lead1.DstTop / ZoomFactorY) + Lead1.SrcTop
LBRgnWidth = SimWidth / ZoomFactorX
LBRgnHeight = SimHeight / ZoomFactorY

'Create the rectangular region, outline it, and display a message so that we can see what happened.
Lead1.SetRgnRect LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, L_RGN_SET
Lead1.RgnFrameType = RGNFRAME_STATIC
MsgBox "Here is the rectangular region"

'Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + OffsetX
CurrentY = CurrentY + OffsetY

'Next, simulate the drawing of an ellipse.
SimLeft = CurrentX
SimTop = CurrentY
SimWidth = OffsetX * 3
SimHeight = OffsetY * 2

'Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (Lead1.DstLeft / ZoomFactorX) + Lead1.SrcLeft
LBRgnTop = (SimTop / ZoomFactorY) - (Lead1.DstTop / ZoomFactorY) + Lead1.SrcTop
LBRgnWidth = SimWidth / ZoomFactorX
LBRgnHeight = SimHeight / ZoomFactorY

'Add the elliptical region, using a Boolean OR,
'and display a message so that we can see what happened.
Lead1.SetRgnEllipse LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, L_RGN_OR
Lead1.RgnFrameType = RGNFRAME_STATIC
MsgBox "Here is the added ellipse, with a Boolean OR"

'Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + OffsetX
CurrentY = CurrentY + OffsetY

'Next, simulate the drawing of a rounded rectangle.
SimLeft = CurrentX
SimTop = CurrentY
SimWidth = OffsetX * 3
SimHeight = OffsetY * 2

'Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (Lead1.DstLeft / ZoomFactorX) + Lead1.SrcLeft
LBRgnTop = (SimTop / ZoomFactorY) - (Lead1.DstTop / ZoomFactorY) + Lead1.SrcTop
LBRgnWidth = SimWidth / ZoomFactorX
LBRgnHeight = SimHeight / ZoomFactorY

'Define an ellipse to use for the corners.
eW = LBRgnWidth / 4
eH = LBRgnHeight / 4

'Add the rounded rectangular region, using a Boolean exclusive OR,
'and display a message so that we can see what happened.
Lead1.SetRgnRoundRect LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, eW, eH, L_RGN_XOR
MsgBox "Here is the rounded rectangle, with a Boolean XOR"

'Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + (2 * OffsetX)
CurrentY = CurrentY + (2 * OffsetY)

'Set up some arrays to use as client area grid values.
'OffsetX and OffsetY set the grid sizes.
xPoint = Array(0, -1, 2, 1, 1, 2, -1, -2)
yPoint = Array(0, -1, -1, 1, -1, 1, 1, 1)

'Initialize the polygon size using an arbitrary number.
'This number will be increased dynamically.
Lead1.PolygonSize = 5

'Fill in the array for the polygon. This simulates a user's mouse clicks.
For i = 0 To 7
    CurrentX = CurrentX + (xPoint(i) * OffsetX)
    CurrentY = CurrentY + (yPoint(i) * OffsetY)
    Lead1.PolygonX(i) = (CurrentX / ZoomFactorX) - (Lead1.DstLeft / ZoomFactorX) + Lead1.SrcLeft
    Lead1.PolygonY(i) = (CurrentY / ZoomFactorY) - (Lead1.DstTop / ZoomFactorY) + Lead1.SrcTop
    If i + 1 = Lead1.PolygonSize Then Lead1.PolygonSize = Lead1.PolygonSize + 5
Next

'Adjust the polygon size to the actual number of points.
Lead1.PolygonSize = i

'Add the polygonal region, using a Boolean OR,
'and display a message so that we can see what happened.
Lead1.SetRgnPolygon L_POLY_WINDING, L_RGN_OR
MsgBox "Here is the added polygon, with a Boolean OR"

'Fill the resulting polygon with red, and display a message.
Lead1.Fill RGB(255, 0, 0)
Lead1.RgnFrameType = RGNFRAME_NONE
Lead1.ForceRepaint
MsgBox "Using SetRgnColor and L_RGN_SETNOT, all else will become blue."

'Clean up memory
Lead1.FreeRgn

'Do the final region.
Lead1.SetRgnColor RGB(255, 0, 0), L_RGN_SETNOT
Lead1.Fill RGB(0, 0, 255)
Lead1.ForceRepaint

'Clean up memory
Lead1.FreeRgn
Lead1.PolygonSize = 0


SetRgnColorHSVRange example for Visual Basic

'This example sets a region corresponding to all pure green (Hue = 85)
'and colors near green (+/- 10)
'where Saturation is at least 40 and Value is at least 40

Private Sub Command2_Click()
   Dim H0 As Integer
   Dim S0 As Integer
   Dim V0 As Integer
   Dim H1 As Integer
   Dim S1 As Integer
   Dim V1 As Integer

   H0 = 75
   S0 = 40
   V0 = 40

   H1 = 95
   S1 = 255
   V1 = 255

   LEAD1.SetRgnColorHSVRange H0, S0, V0, H1, S1, V1, L_RGN_SET
   LEAD1.RgnFrameType = RGNFRAME_ANIMATED
End Sub


SetRgnColorRGBRange example for Visual Basic

'This example sets a region corresponding to all colors that
'have an rgb that includes red but no green and no blue

Private Sub Command3_Click()
Dim rgbLo As OLE_COLOR
Dim rgbHi As OLE_COLOR

rgbLo = RGB(1, 0, 0)
rgbHi = RGB(255, 0, 0)
LEAD1.SetRgnColorRGBRange rgbLo, rgbHi, L_RGN_SET
LEAD1.RgnFrameType = RGNFRAME_ANIMATED
End Sub


SetRgnMagicWand example for Visual Basic

Private Sub LEAD1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    LEAD1.ScaleMode = 1
    LEAD1.SetRgnMagicWand x, y, 10, L_RGN_SET
    LEAD1.RgnFrameType = 2
    LEAD1.ScaleMode = 3
End Sub


SetSelectionBitmap example for Visual Basic

    'set the selection bitmap and selection style
    LEAD1.Load "d:\temp\flagsel.bmp", 0, 0, 1
    LEADImgList1.SetSelectionBitmap RGB(0, 255, 0), LEAD1.Bitmap
    LEADImgList1.SelectionStyle = SELECTIONSTYLE_USERBITMAP


SetSrcClipRect example for Visual Basic

Note: Also works with Access 95 and 97.

This example crops the image by reducing the source clipping area and repaints the image.

' Declare local variables
Dim NewLeft, NewTop, NewWidth, NewHeight

NewLeft = Lead1.SrcClipLeft+ (Lead1.SrcClipWidth * 0.1)
NewTop = Lead1.SrcClipTop + (Lead1.SrcClipHeight * 0.1)
NewWidth = Lead1.SrcClipWidth * 0.8
NewHeight = Lead1.SrcClipHeight * 0.8
If (NewWidth > 1) AND (NewHeight >1) Then
   Lead1.SetSrcClipRect NewLeft, NewTop, NewWidth, NewHeight
End If
Lead1.ForceRepaint


SetSrcRect example for Visual Basic

Note: Also works with Access 95 and 97.

This example zooms in on the image by reducing the source rectangle and repaints the image.

' Declare local variables
Dim NewLeft, NewTop, NewWidth, NewHeight

NewLeft = Lead1.SrcLeft+ (Lead1.SrcWidth * 0.1)
NewTop = Lead1.SrcTop + (Lead1.SrcHeight * 0.1)
NewWidth = Lead1.SrcWidth * 0.8
NewHeight = Lead1.SrcHeight * 0.8
If (NewWidth > 1) AND (NewHeight >1) Then
   Lead1.SetSrcRect NewLeft, NewTop, NewWidth, NewHeight
End If
Lead1.ForceRepaint


SetTag example for Visual Basic

Private Sub SetAndRead_Click()
   Dim myArray(4) As Long

   ' initialize the array
   myArray(0) = 1
   myArray(1) = 2
   myArray(2) = 3
   myArray(3) = 127
'   set a tag using one of the following:
   LEAD1.SetTag 32768, TAG_ASCII, 0, "My text string"
'   LEAD1.SetTag 32768, TAG_BYTE, 4, myArray
'   LEAD1.SetTag 32768, TAG_DOUBLE, 4, myArray
'   LEAD1.SetTag 32768, TAG_FLOAT, 4, myArray
'   LEAD1.SetTag 32768, TAG_LONG, 4, myArray
'   LEAD1.SetTag 32768, TAG_RATIONAL, 2, myArray
'   LEAD1.SetTag 32768, TAG_SBYTE, 4, myArray
'   LEAD1.SetTag 32768, TAG_SHORT, 4, myArray
'   LEAD1.SetTag 32768, TAG_SLONG, 4, myArray
'   LEAD1.SetTag 32768, TAG_SRATIONAL, 2, myArray
'   LEAD1.SetTag 32768, TAG_SSHORT, 4, myArray
'   LEAD1.SetTag 32768, TAG_UNDEFINED, 4, myArray

   ' Write the tag
   LEAD1.WriteTag Text1.Text, 1

   Call ReadTag_Click
End Sub

Private Sub ReadTag_Click()
   ' read the tag back
   LEAD1.ReadTag Text1.Text, 1, 32768

   Call GetAndDisplayTag(0)

End Sub

' This sub will get a certain tag and display it according to the tag type.
Private Sub GetAndDisplayTag(lTag As Long)
   Dim myVar As Variant
   Dim Msg$
   Dim i As Long
   Dim count As Long

   myVar = LEAD1.GetTagData (lTag)
   count = LEAD1.GetTagCount (lTag)

   Msg$ = "Type = " + CStr(LEAD1.GetTagType (lTag))
   Msg$ = Msg$ + Chr$(10) + Chr$(13) + "count = " + CStr(count)
   If LEAD1.GetTagType(lTag) = TAG_ASCII Then
      Msg$ = Msg$ + Chr$(10) + Chr$(13) + "Data = " + myVar
   ElseIf LEAD1.GetTagType(lTag) = TAG_RATIONAL Or LEAD1.GetTagType(lTag) = TAG_SRATIONAL Then
      For i = 0 To count - 1
         Msg$ = Msg$ + Chr$(10) + Chr$(13) + "Data(" + CStr(i) + ") = " + CStr(myVar(i * 2)) + "/" + CStr(myVar(i * 2 + 1))
      Next i
   Else
      For i = 0 To count - 1
         Msg$ = Msg$ + Chr$(10) + Chr$(13) + "Data(" + CStr(i) + ") = " + CStr(myVar(i))
      Next
   End If

   MsgBox Msg$
End Sub


Shear example for Visual Basic

Note: Also works with Access 95 and 97.

This example shears the bitmap 5 degrees horizontally and redisplays the image. It uses blue as the fill color.

Lead1.Shear 500, True, RGB(0,0,255)
Lead1.ForceRepaint


ShowHelpButton example for Visual Basic

'Toggle ShowHelpButton status
   If LEADDlg12.ShowHelpButton = True Then
      LEADDlg12.ShowHelpButton = False
   Else
      LEADDlg12.ShowHelpButton = True
   End If


ShowMagGlass example for Visual Basic

' Global variables
Public ghMagGlassCursor As Long
Public gbLeftButton As Boolean

' Windows API functions headers
Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long

Private Sub Form_Load()
    LEAD1.EnableMethodErrors = False
    LEAD1.Load App.Path & "\Sample1.cmp", 0, 1, 1
    LEAD2.Load App.Path & "\Sample2.cmp", 0, 1, 1
    LEAD1.MagGlassFlags = MAGGLASS_MANUAL_UPDATE

    ' Starting the Magnifying Glass
    LEAD1.StartMagGlass 100, 100, 400, RGB(255, 0, 0), RGB(128, 128, 128), False, 1, False, CROSSHAIR_FINE, True, True

    ' Updating the Magnifying Glass bitmap of 1st control with bitmap of the
    ' 2nd control that has the same width and height.
    LEAD1.UpdateMagGlassFromHandle LEAD2.Bitmap, True

    ' Use this Windows API function to load the MagGlass cursor from a file
    ghMagGlassCursor = LoadCursorFromFile(App.Path & "\MagGlassCursor.cur")
End Sub

Private Sub LEAD1_MagGlassCursor()
    ' Check if the left button is not down and the Magnifying Glass is started
    If ((Not gbLeftButton) And (LEAD1.HasMagGlass)) Then
        SetCursor (ghMagGlassCursor)
    End If
End Sub

Private Sub LEAD1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim nStatus As Integer

    ' Check if this is a left button and the Magnifying Glass is started
    If ((Button <> 1) Or Not (LEAD1.HasMagGlass)) Then
        Exit Sub
    End If

    ' Move the Magnifying Glass to the hit position
    nStatus = SetMagGlassMousePosition (x, y)
    If (nStatus <> 0) Then
        MsgBox "Error while displaying Magnifying Glass, Error: " & CStr(nStatus)
        Exit Sub
    End If

    ' Show the Magnifying Glass
    nStatus = LEAD1.ShowMagGlass(True)
    If (nStatus <> 0) Then
        MsgBox "Error while displaying Magnifying Glass, Error: " & CStr(nStatus)
        Exit Sub
    End If

    ' Left button is currently pressed
    gbLeftButton = True

    ' Call this Windows API function to hide the cursor
    ShowCursor (False)
End Sub

Private Sub LEAD1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim nStatus As Integer

    ' Check if the left button is down and the Magnifying Glass is started
    If ((Button <> 1) Or Not (LEAD1.HasMagGlass)) Then
        Exit Sub
    End If

    ' Move the Magnifying Glass to the mouse position
    nStatus = SetMagGlassMousePosition(x, y)
    If (nStatus <> 0) Then
        MsgBox "Error while Moving Magnifying Glass, Error: " & CStr(nStatus)
    End If
End Sub

Private Sub LEAD1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim nStatus As Integer

    ' Check if the left button is down and the Magnifying Glass is started
    If ((Button <> 1) Or Not (LEAD1.HasMagGlass)) Then
        Exit Sub
    End If

    ' Show the Magnifying Glass
    nStatus = LEAD1.ShowMagGlass (False)
    If (nStatus <> 0) Then
        MsgBox "Error while Hiding Magnifying Glass, Error: " & CStr(nStatus)
    End If

    ' Left button is released
    gbLeftButton = True

    ' Call this Windows API function to show the cursor
    ShowCursor (True)
End Sub

Private Function SetMagGlassMousePosition(xPos As Single, yPos As Single) As Integer
    Dim nStatus As Integer
    Dim nOldScaleMode As Long

    ' Save the current Scale mode
    nOldScaleMode = LEAD1.ScaleMode
    ' Change the Scaling mode to Twip
    LEAD1.ScaleMode = 1
    ' Set the MagGlass new position
    nStatus = LEAD1.SetMagGlassPos(xPos, yPos)
    ' Switch back to the old Scale mode
    LEAD1.ScaleMode = nOldScaleMode

    SetMagGlassMousePosition = nStatus
End Function


SkipFile example for Visual Basic

Private Sub LEADThumb1_ThumbnailEvent(ByVal Bitmap As Long, ByVal pszFilename As String, ByVal nStatusCode As Integer, ByVal nPercent As Integer)
    Dim out$

    If (nStatusCode = 0) Then 'successful thumbnail generation
        'save thumbnails in a multipage TIFF file
        LEAD1.Bitmap = Bitmap
        LEAD1.Save "c:\temp\thumbs.tif", FILE_TIF, 24, 0, SAVE_APPEND
        out$ = pszFilename & Chr(13)
        out$ = out$ & "Format: " & CStr(LEADThumb1.InfoFormat) & Chr(13)
        out$ = out$ & "Compression: " & CStr(LEADThumb1.InfoCompression) & Chr(13)
        out$ = out$ & "Bits: " & CStr(LEADThumb1.InfoBits) & Chr(13)
        out$ = out$ & "Width: " & CStr(LEADThumb1.InfoWidth) & Chr(13)
        out$ = out$ & "Height: " & CStr(LEADThumb1.InfoHeight) & Chr(13)
        out$ = out$ & "Page: " & CStr(LEADThumb1.InfoPage) & Chr(13)
        out$ = out$ & "TotalPages: " & CStr(LEADThumb1.InfoTotalPages) & Chr(13)
        out$ = out$ & "SizeDisk: " & CStr(LEADThumb1.InfoSizeDisk) & Chr(13)
        out$ = out$ & "SizeMem: " & CStr(LEADThumb1.InfoSizeMem) & Chr(13)
        out$ = out$ & "XRes: " & CStr(LEADThumb1.InfoXRes) & Chr(13)
        out$ = out$ & "YRes: " & CStr(LEADThumb1.InfoYRes) & Chr(13)
        MsgBox out$
    ElseIf (nStatusCode = BROWSE_PRELOAD) Then
        'check the extension, if it is ".DOC", then skip
        If (UCase(Right$(pszFilename, 4)) = ".DOC") Then
            LEADThumb1.SkipFile = True
            MsgBox "skipping - " & pszFilename
        End If
    End If
    LEADThumb1.ContinueBrowse = True 'continue the browse operation
End Sub


Sharpen example for Visual Basic

Note: Also works with Access 95 and 97.

This example increases the sharpness of the bitmap and redisplays the image.

Lead1.Sharpen 100
Lead1.ForceRepaint


Solarize example for Visual Basic

Note: Also works with Access 95 and 97.

This example applies a solarize effect and repaints the image.

Lead1.Solarize 100
Lead1.ForceRepaint


Sort (ImageList Control) example for Visual Basic

'Sort the items in ascending order
LEADImgList1.Sort True


SpatialFilter example for Visual Basic

Note: Also works with Access 95 and 97.

This example applies Laplacian line detection and redisplays the image.

Lead1.SpatialFilter FLT_LAPLACE_1
Lead1.ForceRepaint


Src... example for Visual Basic

Note: Also works with Access 95 and 97.

This example uses the source rectangle properties to zoom in on the image.

'Calculate the values to zoom in by 10 percent and center the image.
If (Lead1.SrcWidth > 1) And (Lead1.SrcHeight > 1) Then
  Lead1.SrcWidth = Lead1.SrcWidth * 0.9
  Lead1.SrcHeight = Lead1.SrcHeight * 0.9
  Lead1.SrcTop = (Lead1.BitmapHeight - Lead1.SrcHeight) / 2
  Lead1.SrcLeft = (Lead1.BitmapWidth - Lead1.SrcWidth) / 2
End If

'Set the clipping area to the same as the source rectangle
Lead1.SrcClipWidth = Lead1.SrcWidth
Lead1.SrcClipHeight = Lead1.SrcHeight
Lead1.SrcClipTop = Lead1.SrcTop
Lead1.SrcClipLeft = Lead1.SrcLeft

'Redisplay the image
Lead1.ForceRepaint


STable example for Visual Basic

'This example remaps the saturation of each color to one half its original

Private Sub Command6_Click()
Dim i As Integer

For i = 0 To 255
LEAD1.STable(i) = i \ 2
Next i
LEAD1.RemapHue False, False, True, False
End Sub


StopMagGlass example for Visual Basic

    Dim hRgn As Long

    LEAD1.ScaleMode = 3

    ' Set MagGlass flags

    ' In this case the masked colors from the Magnifying Glass area will be all the colors

    ' except those colors which will be set using the MagGlassMask property

    LEAD1.MagGlassFlags = MAGGLASS_MASK_INVERT

    'set the color mask to mask out all colors except a few shades of black

    LEAD1.MagGlassMaskCount = 3

    LEAD1.MagGlassMask(0) = RGB(0, 0, 0)

    LEAD1.MagGlassMask(1) = RGB(1, 1, 1)

    LEAD1.MagGlassMask(2) = RGB(2, 2, 2)

    LEAD1.RgnFrameType = 0

    LEAD1.StartMagGlass 100, 100, 400, RGB(255, 0, 0), RGB(128, 128, 128), True, 1, False, CROSSHAIR_FINE, True, True

    'assume that VB API viewer Add-In Module was added to the current project

    hRgn = CreateRoundRectRgn(0, 0, 100, 100, 25, 25)

    LEAD1.UpdateMagGlassShape MAGGLASS_SHAPE_HRGN, hRgn

    DeleteObject hRgn

   '.......some other work..............

   '.......some other work..............

    'Stop the MagGlass

    LEAD1.StopMagGlass


StretchIntensity example for Visual Basic

Note: Also works with Access 95 and 97.

This example stretches the intensity and redisplays the image.

Lead1.StretchIntensity
Lead1.ForceRepaint


SwapColors example for Visual Basic

   LEAD1.SwapColors SWAP_RG


TextWordWrap example for Visual Basic

Note: Also works with Access 95 and 97.

This example wraps text inside the rectangle that is specified for the text object.

'Text location
Lead1.TextTop = 10
Lead1.TextLeft = 10
Lead1.TextWidth = 150
Lead1.TextHeight = 150

'Text alignment and angle
Lead1.TextAlign = EFX_TEXTALIGN_LEFT_VCENTER
Lead1.TextAngle = 0

'Enable word wrap
Lead1.TextWordWrap = True

Lead1.DrawText "LEADTOOLS 14 Supports WordWrap when drawing text.", 0


TransitionEffect example for Visual Basic

Note: Also works with Access 95 and 97.

This example paints a transition with a 255-step grayscale gradient.

Lead1.AutoRepaint = False
Lead1.EffectDelay = 50
Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1
Lead1.TransitionEffect = EFX_EFFECT_WIPE_RECTANGLE_OUT
Lead1.TransitionStyle = EFX_TRANSITION_GRADIENT
Lead1.GradientStyle = EFX_GRADIENT_ANGLE_TO_LT
Lead1.GradientEndColor = RGB(0, 0, 0)
Lead1.GradientStartColor = RGB(255, 255, 255)
Lead1.GradientSteps = 255
 Lead1.AutoRepaint = True


TransparentColor example for Visual Basic

Note: Also works with Access 95 and 97.

This example sets white as a transparent color; then loads a test image and paints it.

Lead1.AutoRepaint = False

'Enable transparency
Lead1.BitmapEnableTransparency = True

'Make white the transparent color
Lead1.BitmapTransparentColor = RGB(255, 255, 255)
Lead1.Load "d:\temp\ctest.bmp", 0, 0, 1
Lead1.ForceRepaint


Trim example for Visual Basic

This example trims one-tenth from the bitmap and repaints the image.

' Declare local variables
Dim NewLeft, NewTop, NewWidth, NewHeight, ViewWidth, ViewHeight

NewLeft = Lead1.BitmapWidth * .1
NewTop = Lead1.BitmapHeight * .1
NewWidth = Lead1.BitmapWidth * .8
NewHeight = Lead1.BitmapHeight * .8
Lead1.Trim NewLeft, NewTop, NewWidth, NewHeight

' Set variables for the position and size of the display rectangle.
ViewWidth = Lead1.ScaleWidth
ViewHeight = Lead1.ScaleHeight

' Set the image display size to match the LEAD control
Lead1.SetDstRect 0, 0, ViewWidth, ViewHeight
Lead1.SetDstClipRect 0, 0, ViewWidth, ViewHeight
Lead1.ForceRepaint


Underlay example for Visual Basic

This example loads a bitmap into Lead2 and uses it as a tiled underlay for Lead1.

LEAD1.Load "d:\temp\golf.jpg", 0, 0, 1
LEAD2.Visible = False
LEAD2.Load "d:\temp\ulay1.bmp", 0, 0, 1
LEAD1.Underlay LEAD2.Bitmap, UNDERLAY_TILE
LEAD1.ForceRepaint


UnlockSupport (ImageList Control) example for Visual Basic

Dim bRet As Boolean

    bRet = LEADImgList1.IsSupportLocked(L_SUPPORT_DOCUMENT)
    If (bRet = True) Then
        LEADImgList1.UnlockSupport L_SUPPORT_DOCUMENT, "yourstringhere"
    End If


UnlockSupport (ISIS Control) example for Visual Basic

    'Unlock Document support.
    'Note that this is a sample key, which will not work in your toolkit.
    LEADISIS1.UnlockSupport L_SUPPORT_DOCUMENT, "TestKey"


UnlockSupport (Mixed Raster Content Control) example for Visual Basic

   LEADMrc1.UnlockSupport L_SUPPORT_DOCUMENT, "TestKey"
   If LEADMrc1.IsSupportLocked(L_SUPPORT_DOCUMENT) Then
      MsgBox "UnlockSupport did not work with given key"
   End If


UnlockSupport (OLE DB Control) example for Visual Basic

'Unlock Document support.
'Note that this is a sample key, which will not work in your toolkit
LEADOLEDB1.UnlockSupport L_SUPPORT_DOCUMENT, "TestKey"


UnlockSupport (Thumbnail Browser Control) example for Visual Basic

Dim bRet As Boolean

    bRet = LEADThumb1.IsSupportLocked(L_SUPPORT_DOCUMENT)
    If (bRet = True) Then
        LEADThumb1.UnlockSupport L_SUPPORT_DOCUMENT, "yourstinghere"
    End If


UnsharpMask example for Visual Basic

   LEAD1.UnsharpMask 200, 15, 50, 1 'RGB_SPACE


UserPalette and BitmapPalette example for Visual Basic

Note: Also works with Access 95 and 97.

This example demonstrates the UserPalette and BitmapPalette properties.

'Specify a blue and white user palette
Lead1.UserPalette(0) = RGB(0, 0, 255)
Lead1.UserPalette(1) = RGB(255, 255, 255)

'Implement the user palette
Lead1.ColorRes 1, CRP_USERPALETTE, CRD_ORDEREDDITHERING, 2

'Display the blue and white image
Lead1.ForceRepaint
MsgBox "This is the user palette. Click OK to change the bitmap palette."

'Change the bitmap palette to red and white
Lead1.BitmapPalette(0) = RGB(255, 0, 0)
Lead1.BitmapPalette(1) = RGB(255, 255, 255)

'Display the red and white image
Lead1.ForceRepaint


Version... example for Visual Basic

Note: Also works with Access 95 and 97.

This example puts the version information into a string and displays the string in a message box.

' Declare local variables
Dim LevelStr, cMsg

If Lead1.VersionLevel = VERSIONLEVEL_EXP Then
    LevelStr = "Document/Medical "
Else
    LevelStr = "Professional Edition"
End If

cMsg = Lead1.VersionProduct + Chr(13) + LevelStr + Chr(13)
cMsg = cMsg + "Version: " + CStr(Lead1.VersionMajor) + "."
cMsg = cMsg + CStr(Lead1.VersionMinor) + Chr(13)
cMsg = cMsg + "Date produced: " + Lead1.VersionDate + Chr(13)
cMsg = cMsg + "Time produced: " + Lead1.VersionTime + Chr(13)
' Display the message box
MsgBox cMsg, 0, "Version Info"


ViewSize example for Visual Basic

    Dim nSize As Long
    Dim nFirst As Long
    Dim nLast As Long
    Dim nCols As Long
    Dim nCount As Long

    'NOTE: assume scroll style = SCROLLSTYLE_VERTICAL
    'get the view size
    nSize = LEADImgList1.ViewSize
    'get the first visible item
    nFirst = LEADImgList1.FirstVisibleItem
    'get the column count
    nCols = LEADImgList1.ColumnCount
    'calculate the index of last visible item
    nLast = nFirst + (nSize * nCols) - 1 '0 based index
    nCount = LEADImgList1.Count
    If (nLast > nCount - 1) Then
        nLast = nCount - 1
    End If


VTable example for Visual Basic

'This example remaps the "value" of each color to one half its original

Private Sub Command8_Click()
Dim i As Integer

For i = 0 To 255
LEAD1.VTable(i) = i \ 2
Next i
LEAD1.RemapHue False, False, False, True
End Sub


Window (ImageList Control) example for Visual Basic

This example shows how to call one of the Windows API functions and pass the ImageList Control's Window property as a parameter.

First, add the following Windows API declaration to a module in your VB application:
    Declare Function ShowWindow Lib "User32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Boolean

Next, add the following code to call the function:
    'hide the control
    ShowWindow LEADImgList1.Window, 0
    MsgBox "wait"
    'restore the window
    ShowWindow LEADImgList1.Window, 1


WindowLevel example for Visual Basic

Note: Also works with Access 95 and 97.

This example converts a bitmap to 12-bit grayscale and then performs window leveling on the four most significant bits of the image.

    Lead1.Grayscale 12    'Grayscale image to 12-bit

    Lead1.LevelLowBit = 8 ' use 4 most significant bits

    Lead1.LevelHighBit = 11

    Lead1.WindowLevel


WindowLevelBitmap example for Visual Basic

'This example loads a 16-bit grayscale, fills the window level lookup table,
' and window levels the bitmap for display only
Private Sub Command2_Click()
Dim i As Long

'Load a 16-bit grayscale image
LEAD1.Load App.Path & "\gray16.tif", 0, 0, 1
LEAD1.AutoRepaint = False

'Use all bits
LEAD1.LevelLowBit = 0
LEAD1.LevelHighBit = LEAD1.BitmapBits - 1

LEAD1.GetMinMaxBits
LEAD1.GetMinMaxVal

'Set LUT so the range is from pure blue to pure red
For i = LEAD1.MinVal To LEAD1.MaxVal
    LEAD1.LevelLUT(i) = RGB(i Mod 256, 0, 256 - i Mod 256)
Next I

'Window level for display only--leave the bitmap data unchanged
LEAD1.WindowLevelBitmap = True
LEAD1.WindowLevel
LEAD1.ForceRepaint
End Sub


WindowLevelFillLUT example for Visual Basic

 Dim nHigh As Long
 Dim nLow As Long

 LEAD1.Grayscale 16

 LEAD1.GetMinMaxBits
 LEAD1.GetMinMaxVal

 LEAD1.LevelLowBit = 0
 LEAD1.LevelHighBit = LEAD1.BitmapBits – 1

 nLow = LEAD1.MinBit
 nHigh = 2 ^ (LEAD1.MaxBit - LEAD1.MinBit + 1)

 'allocate the LUT
 LEAD1.LevelLUT(nHigh - 1) = 0

 'fill the entire LUT with gradient from RED to BLUE
LEAD1.WindowLevelFillLUT RGB(255, 0, 0), RGB(0, 0, 255), _
                          nLow, nHigh, _
                          LEAD1.MinBit, _
                          LEAD1.MaxBit, _
                          LEAD1.MinVal, _
                          LEAD1.MaxVal, _
                          0, _
                          FILLLUT_INSIDE Or FILLLUT_LINEAR

 'now use it
 LEAD1.WindowLevel


WMFResolution example for Visual Basic

'This example displays the default resolution stored in a WMF,
'changes the resolution to 150 dpi, and then loads the image
Private Sub Command3_Click()
Dim wmfFileName As String

wmfFileName = App.Path & "\test.wmf"

'Display resolution stored in WMF
'Note that InfoXRex and InfoYRes will return the same value
LEAD1.GetFileInfo wmfFileName, 0, 0
MsgBox "InfoXRes: " & LEAD1.InfoXRes & "  InfoYRes: " & LEAD1.InfoYRes

'Set resolution so WMF is loaded at 150 dpi
LEAD1.WMFResolution = 150
LEAD1.Load wmfFileName, 0, 0, 1
End Sub


WriteComment example for Visual Basic

   ' set the comment
   LEAD1.Comment(CMNT_SZARTIST) = "Me"

   ' write the comment into page 1 of TEST.TIF
   LEAD1.WriteComment "TEST.TIF", 1

   ' read the comment and display it
   MsgBox LEAD1.ReadComment("TEST.TIF", 1, CMNT_SZARTIST)


WriteMarkerAction example for Visual Basic

' Rotate the file 90 degrees
LEAD1.TransformFile "c:\temp\1.jpg", "c:\temp\2.jpg", FILE_TRANSFORM_ ROTATE90, 1

' I will replace the comment present in the file with my own comment
Private Sub LEAD1_TransformMarker(ByVal iMarker As Integer, ByVal lSize As Long, ByVal vData As Variant, ByVal iTransform As Integer)
   If iMarker = &HFE Then
      LEAD1.WriteMarkerAction = WRITEMARKER_IGNORE
      LEAD1.WriteMarker iMarker, 10, "My comment"
   End If
End Sub


ZoomIn example for Visual Basic

Note: Also works with Access 95 and 97.

This example calls ZoomIn() method to zoom in on a captured image.

Lead1.ZoomIn


ZoomInDone example for Visual Basic

Note: Also works with Access 95 and 97.

This example triggers the ZoomInDone event and displays a message that the ZoomIn image has been captured.

Private Sub Lead1_ZoomInDone(ByVal x As Long, ByVal y As Long)
          MsgBox "ZoomIn Captured: " & CStr(x) & "," & CStr(y)
End Sub


Error Codes

LEADTOOLS provides defined error constants.  Visual Basic users must include L_OCXERR.BAS in order to use the defined error constants.  This file can be found in the lead\include directory.

The following are the possible return values for LEADTOOLS functions. These are the values in the L_ERROR.H file.

Note:	The following are the errors that you can test for with an On Error statement.
Error	No.	Description
ERROR_NO_MEMORY	20001	Not enough memory available
ERROR_NO_BITMAP	20002	Invalid bitmap handle
ERROR_MEMORY_TOO_LOW	20003	Not enough memory available
ERROR_FILE_LSEEK	20004	Error seeking to position
ERROR_FILE_WRITE	20005	Error writing file
ERROR_FILE_GONE	20006	File not present - abort
ERROR_FILE_READ	20007	Error reading file
ERROR_INV_FILENAME	20008	Invalid filename specified
ERROR_FILE_FORMAT	20009	Invalid file format
ERROR_FILENOTFOUND	20010	File not found
ERROR_INV_RANGE	20011	Invalid width/height
ERROR_IMAGE_TYPE	20012	Image format recognized, but sub-type not supported
ERROR_INV_PARAMETER	20013	Invalid parameter passed
ERROR_FILE_OPEN	20014	Not able to open file
ERROR_UNKNOWN_COMP	20015	Unknown compression format
ERROR_FEATURE_NOT_SUPPORTED	20016	Feature not supported
ERROR_NOT_256_COLOR	20017	VGA card only supports 256 colors (8 bit)
ERROR_PRINTER	20018	Printer error
ERROR_CRC_CHECK	20019	Data CRC check error
ERROR_QFACTOR	20021	Invalid QFactor specified
ERROR_TARGAINSTALL	20022	TARGA not installed
ERROR_OUTPUTTYPE	20023	Invalid compression format
ERROR_XORIGIN	20024	X origin specified invalid
ERROR_YORIGIN	20025	Y origin specified invalid
ERROR_VIDEOTYPE	20026	Invalid video mode
ERROR_BITPERPIXEL	20027	Invalid bits/pixel
ERROR_WINDOWSIZE	20028	Invalid window size
ERROR_NORMAL_ABORT	20029	Escape key pressed - or user aborted operation
ERROR_NOT_INITIALIZED	20030	Internal error - call LEAD
ERROR_CU_BUSY	20031	Internal error - call LEAD
ERROR_INVALID_TABLE_TYPE	20032	Internal error - call LEAD
ERROR_UNEQUAL_TABLES	20033	Internal error - call LEAD
ERROR_INVALID_BUFFER	20034	Internal error - call LEAD
ERROR_MISSING_TILE_DATA	20035	Internal error - call LEAD
ERROR_INVALID_QVALUE	20036	Internal error - call LEAD
ERROR_INVALIDDATA	20037	Internal error - call LEAD
ERROR_INVALID_COMPRESSED_TYPE	20038	Internal error - call LEAD
ERROR_INVALID_COMPONENT_NUM	20039	Internal error - call LEAD
ERROR_INVALID_PIXEL_TYPE	20040	Internal error - call LEAD
ERROR_INVALID_PIXEL_SAMPLING	20041	Internal error - call LEAD
ERROR_INVALID_SOURCE_FILE	20042	Internal error - call LEAD
ERROR_INVALID_TARGET_FILE	20043	Internal error - call LEAD
ERROR_INVALID_IMAGE_DIMS	20044	Internal error - call LEAD
ERROR_INVALID_TILE_DIMS	20045	Internal error - call LEAD
ERROR_INVALID_PIX_BUFF_DIMS	20046	Internal error - call LEAD
ERROR_SEGMENT_OVERFLOW	20047	Internal error - call LEAD
ERROR_INVALID_SUBSAMPLING	20048	Internal error - call LEAD
ERROR_INVALID_Q_VIS_TABLE	20049	Internal error - call LEAD
ERROR_INVALID_DC_CODE_TABLE	20050	Internal error - call LEAD
ERROR_INVALID_AC_CODE_TABLE	20051	Internal error - call LEAD
ERROR_INSUFFICIENT_DATA	20052	Internal error - call LEAD
ERROR_MISSING_FUNC_POINTER	20053	Internal error - call LEAD
ERROR_TOO_MANY_DC_CODE_TABLES	20054	Internal error - call LEAD
ERROR_TOO_MANY_AC_CODE_TABLES	20055	Internal error - call LEAD
ERROR_INVALID_SUBIMAGE	20056	Internal error - call LEAD
ERROR_INVALID_ABORTION	20057	Internal error - call LEAD
ERROR_CU_NO_SUPPORT	20058	Internal error - call LEAD
ERROR_CU_FAILURE	20059	Internal error - call LEAD
ERROR_BAD_POINTER	20060	Internal error - call LEAD
ERROR_HEADER_DATA_FAILUR	20061	Internal error - call LEAD
ERROR_COMPRESSED_DATA_FAILURE	20062	Internal error - call LEAD
ERROR_FIXEDPAL_DATA	20063	Fixed palette data not found
ERROR_LOADFONT_DATA	20064	Fixed palette data not found
ERROR_NO_STAMP	20065	Stamp not found
ERROR_G3CODE_INVALID	20070	Invalid group 3 dat
ERROR_G3CODE_EOF	20071	Group3 code end of file
ERROR_G3CODE_EOL	20072	Group3 code end of code
ERROR_PREMATURE_EOF	20073	Premature EOF at scanline
ERROR_PREMATURE_EOL	20074	Premature end-of-line code
ERROR_UNCOMP_EOF	20075	Premature end-of-line code
ERROR_ACT_INCOMP	20076	Premature end-of-line code
ERROR_BAD_DECODE_STATE	20077	Premature end-of-line code
ERROR_VERSION_NUMBER	20078	Bad version number
ERROR_TWAIN_NODSM	20079	TWAIN source manager not found
ERROR_TWAIN_BUMMER	20080	TWAIN failure due to unknown causes
ERROR_TWAIN_LOWMEMORY	20081	TWAIN not enough memory to perform operation
ERROR_TWAIN_NODS	20082	TWAIN no data source
ERROR_TWAIN_MAXCONNECTIONS	20083	TWAIN DS is connected to max possible apps
ERROR_TWAIN_OPERATIONERROR	20084	TWAIN DS or DSM reported error, app shouldn't (no need for your app to report the error
ERROR_TWAIN_BADCAP	20085	TWAIN unknown capability
ERROR_TWAIN_BADPROTOCOL	20086	TWAIN unrecognized MSG DG DAT combination
ERROR_TWAIN_BADVALUE	20087	TWAIN data parameter out of range
ERROR_TWAIN_SEQERROR	20088	TWAIN DG DAT MSG out of expected sequence
ERROR_TWAIN_BADDEST	20089	TWAIN unknown destination App/Src in DSM_Entry
ERROR_TWAIN_CANCEL	20090	TWAIN operation was cancelled
ERROR_PANWINDOW_NOT_CREATED	20091	PanWindow creation failed
ERROR_NOT_ENOUGH_IMAGES	20092	Not enough images - more input images are required
ERROR_TWAIN_CAPUNSUPPORTED	20093	TWAIN capability unsupported
ERROR_TWAIN_FILEXFER_UNSUPPORTED	20094	TWAIN File Transfer unsupported
ERROR_USER_ABORT	20100	User has aborted operation
ERROR_FPX_INVALID_FORMAT_ERROR	20101	Invalid FlashPix format
ERROR_FPX_FILE_WRITE_ERROR	20102	Error writing file
ERROR_FPX_FILE_READ_ERROR	20103	Error reading file
ERROR_FPX_FILE_NOT_FOUND	20104	File not found
ERROR_FPX_COLOR_CONVERSION_ERROR	20105	Color conversion error
ERROR_FPX_SEVER_INIT_ERROR	20106	Server initialize error
ERROR_FPX_LOW_MEMORY_ERROR	20107	Not enough memory available
ERROR_FPX_IMAGE_TOO_BIG_ERROR	20108	Image too big
ERROR_FPX_INVALID_COMPRESSION_ERROR	20109	Invalid compression
ERROR_FPX_INVALID_RESOLUTION	20110	Invalid resolution
ERROR_FPX_INVALID_FPX_HANDLE	20111	Invalid handle
ERROR_FPX_TOO_MANY_LINES	20112	Too many lines
ERROR_FPX_BAD_COORDINATES	20113	Invalid coordinates
ERROR_FPX_FILE_SYSTEM_FULL	20114	File system full
ERROR_FPX_MISSING_TABLE	20115	The table is missing
ERROR_FPX_RETURN_PARAMETER_TOO_LARGE	20116	Parameter too large
ERROR_FPX_NOT_A_VIEW	20117	Error view
ERROR_FPX_VIEW_IS_TRANFORMLESS	20118	The view is tranformless
ERROR_FPX_ERROR	20119	General error
ERROR_FPX_UNIMPLEMENTED_FUNCTION	20120	Unimplemented function
ERROR_FPX_INVALID_IMAGE_DESC	20121	Invalid image description
ERROR_FPX_INVALID_JPEG_TABLE	20122	Invalid jpeg table
ERROR_FPX_ILLEGAL_JPEG_ID	20123	Illegal jpeg identifier
ERROR_FPX_MEMORY_ALLOCATION_FAILED	20124	Memory allocation failed
ERROR_FPX_NO_MEMORY_MANAGEMENT	20125	No memory management
ERROR_FPX_OBJECT_CREATION_FAILED	20126	Object creation failed
ERROR_FPX_EXTENSION_FAILED	20127	Extension failed
ERROR_FPX_FREE_NULL_PTR	20128	Free null pointer
ERROR_FPX_INVALID_TILE	20129	Invalid tile
ERROR_FPX_FILE_IN_USE	20130	File in use
ERROR_FPX_FILE_CREATE_ERROR	20131	Error creating file
ERROR_FPX_FILE_NOT_OPEN_ERROR	20132	File not open
ERROR_FPX_USER_ABORT	20133	User abort
ERROR_FPX_OLE_FILE_ERROR	20134	OLE file error
ERROR_BAD_TAG	20140	Bad TIFF tag
ERROR_INVALID_STAMP_SIZE	20141	Stamp size is too big or invalid bits/pixel, etc
ERROR_BAD_STAMP	20142	Stamp is present but data is corrupted
ERROR_DOCUMENT_NOT_ENABLED	20143	Document capability is required to use this function
ERROR_IMAGE_EMPTY	20144	Image is empty
ERROR_NO_CHANGE	20145	The image hasn't changed
ERROR_FPXEXTENSIONS_LOCKED	20147	FPX Extensions is locked
ERROR_ANN_LOCKED	20148	The annotation object is locked
ERROR_EXCEPTION	20149	An unspecified exception occurred - could be memory access violations
ERROR_DLG_FAILED	20150	An error occurred during the creation of the common dialog.
ERROR_DLG_ALREADYINITIATED	20151	The dialogs are already initialized.
ERROR_DLG_NOTINITIATED	20152	The dialogs have not been initialized.
ERROR_DLG_COLORNOTINITIALIZED	20153	The dialogs were not initialized with DLG_INIT_COLOR.
ERROR_DLG_COLORDLL_UNABLETOLOAD	20154	The dialogs could not load the LTCLR dll.
ERROR_DLG_RESDLL_UNABLETOLOAD	20155	The dialogs could not load the LTDLGRES dll.
ERROR_ISIS_NOCURSCANNER	20160	ISIS No Scanner selected
ERROR_ISIS_SCANDRIVER_NOT_LOADED	20161	ISIS Scanner driver failed to load
ERROR_ISIS_CANCEL	20162	ISIS Operation cancelled
ERROR_ISIS_BAD_TAG_OR_VALUE	20163	ISIS Bad Tag or Bad Tag Value
ERROR_ISIS_NOT_READY	20164	ISIS Scanner not ready
ERROR_ISIS_NO_PAGE	20165	ISIS No page in the Scanner
ERROR_ISIS_JAM	20166	ISIS Scanner Jam error
ERROR_ISIS_SCANNER_ERROR	20167	ISIS Scanner driver error
ERROR_ISIS_BUSY	20168	ISIS Scanner is busy
ERROR_ISIS_FILE_ERROR	20169	ISIS File driver error
ERROR_ISIS_NETWORK_ERROR	20170	ISIS Network error
ERROR_ISIS_NOT_INSTALLED	20171	ISIS Is not installed - you need to have ISIS installed to use this method/property
ERROR_ISIS_NO_PIXDFLT	20172	ISIS Is not installed
ERROR_ISIS_PIXVERSION	20173	ISIS Version is incorrect
ERROR_ISIS_PERM_NOACCESS	20174	ISIS No permission/access
ERROR_DOC_NOT_INITIALIZED	20180	The document was not initialized
ERROR_DOC_HANDLE	20181	The document handle is NULL
ERROR_DOC_EMPTY	20182	The document is empty
ERROR_DOC_INVALID_FONT	20183	Invalid font
ERROR_DOC_INVALID_PAGE	20184	Invalid page number
ERROR_DOC_INVALID_RULE	20185	Invalid rule
ERROR_DOC_INVALID_ZONE	20186	Invalid zone number
ERROR_DOC_TYPE_ZONE	20187	Invalid zone type
ERROR_DOC_INVALID_COLUMN	20188	Invalid column number
ERROR_DOC_INVALID_LINE	20189	Invalid line number
ERROR_DOC_INVALID_WORD	20190	Invalid word number
ERROR_OCR_LOCKED	20191	OCR methods are locked
ERROR_RECORDING	20250	Wave device is currently recording
ERROR_COMPRESSOR	20251	Invalid compressor
ERROR_SOUND_DEVICE	20252	Problem with sound card
ERROR_DEVICE_INUSE	20253	The sound card is currently in use
ERROR_INV_TRACKTYPE	20254	Invalid track for operation
ERROR_NO_SOUNDCARD	20255	No sound card is present
ERROR_NOT_RECORDING	20256	Not currently recording
ERROR_INV_MODE	20257	Invalid open mode for operation
ERROR_NO_VIDEO_MODULE	20258	No video module present on machine
ERROR_QUEUE_FULL	20259	The buffer queue is full
ERROR_HOST_RESOLVE	20270	Invalid horizontal display size
ERROR_CANT_INITIALIZE	20271	Invalid vertical display size
ERROR_NO_CONNECTION	20272	Invalid Intra DC Precision
ERROR_HOST_NOT_FOUND	20273	Invalid f code
ERROR_NOT_SERVER	20274	Invalid motion data search window
ERROR_NO_CONNECTIONS	20275	Invalid profile identification
ERROR_CONNECT_REFUSED	20276	Invalid level identification
ERROR_IS_CONNECTED	20277	Computer is already connected
ERROR_NET_UNREACH	20278	Network is unreachable from host
ERROR_TIME_OUT	20279	Connect attempt time out without connecting
ERROR_NET_DOWN	20280	Network subsystem is down
ERROR_NO_BUFFERS	20281	No buffer space is available, too many connections
ERROR_NO_FILE_DESCR	20282	No more file handle available
ERROR_DATA_QUEUED	20283	Data has been queued to send later
ERROR_UNKNOWN	20284	Unknown network error has occurred
ERROR_CONNECT_RESET	20285	Connection was reset - socket might be unusable
ERROR_TRANSFER_ABORTED	20286	Transfer was aborted
ERROR_DSHOW_FAILURE	20287	DirectShow isn't installed correctly
ERROR_REGISTRY_READ	20288	Error reading from the registry
ERROR_WAVE_FORMAT	20289	The wave format is not supported
ERROR_BUFFER_TOO_SMALL	20290	The buffer size is too small
ERROR_WAVE_CONVERT	20291	Error converting the wave format
ERROR_MULTIMEDIA_NOT_ENABLED	20292	Video capability is required to use this function
ERROR_CAP_CONNECT	20293	Error connecting to capture device
ERROR_CAP_DISCONNECT	20294	Error disconnecting capture device
ERROR_DISK_ISFULL	20295	Not enough disk space
ERROR_CAP_OVERLAY	20296	Error setting capture overlay
ERROR_CAP_PREVIEW	20297	Error setting capture preview
ERROR_CAP_COPY	20298	Error copying to clipboard
ERROR_CAP_WINDOW	20299	Error with capture window
ERROR_CAP_ISCAPTURING	20300	Operation invalid during capture
ERROR_NO_STREAMS	20301	No streams to play
ERROR_CREATE_STREAM	20302	Error creating streams
ERROR_FRAME_DELETE	20303	Error deleting frames
ERROR_DXF_FILTER_MISSING	20309	The DXF filter is needed to use this function
ERROR_PAGE_NOT_FOUND	20310	Page not found
ERROR_DELETE_LAST_PAGE	20311	You cannot delete a page from a file containing only one page
ERROR_NO_HOTKEY	20312	There is no hotkey
ERROR_CANNOT_CREATE_HOTKEY_WINDOW	20313	Error creating the hotkey window
ERROR_MEDICAL_NOT_ENABLED	20314	Medical capability is required to use this function
ERROR_JBIG_NOT_ENABLED	20315	JBIG capability is required to use this function
ERROR_UNDO_STACK_EMPTY	20316	Undo stack is empty - too many undos
ERROR_NO_TOOLBAR	20317	ActiveX error - the toolbar window was not created
ERROR_MEDICAL_NET_NOT_ENABLED	20318	Medical Network capability is required to use this function
ERROR_JBIG_FILTER_MISSING	20319	The JBIG filter is needed to use this function
ERROR_CAPTURE_STILL_IN_PROCESS	20320	Capture Is Still In Progress
ERROR_INVALID_DELAY	20321	Invalid delay specified
ERROR_INVALID_COUNT	20322	Invalid capture count specified
ERROR_INVALID_INTERVAL	20323	Invalid interval specified
ERROR_HOTKEY_CONFILCTS_WITH_CANCELKEY	20324	Hotkey Conflicts With Cancelkey
ERROR_CAPTURE_INVALID_AREA_TYPE	20325	Invalid Area Type specified
ERROR_CAPTURE_NO_OPTION_STRUCTURE	20326	Invalid or missing options structure
ERROR_CAPTURE_INVALID_FILL_PATTERN	20327	Invalid fill pattern
ERROR_CAPTURE_INVALID_LINE_STYLE	20328	Invalid line style
ERROR_CAPTURE_INVALID_INFOWND_POS	20329	Invalid info window position
ERROR_CAPTURE_INVALID_INFOWND_SIZE	20330	Invalid info window size
ERROR_CAPTURE_ZERO_AREA_SIZE	20331	Zero Area Size for capture
ERROR_CAPTURE_FILE_ACCESS_FAILED	20332	The specified filename could not be read
ERROR_CAPTURE_INVALID_32BIT_EXE_OR_DLL	20333	The specified filename is not a valid 32bit EXE/DLL
ERROR_CAPTURE_INVALID_RESOURCE_TYPE	20334	The specified resource type is not supported
ERROR_CAPTURE_INVALID_RESOURCE_INDEX	20335	The index resource is out of range
ERROR_CAPTURE_NO_ACTIVE_WINDOW	20336	No active window for capture
ERROR_CAPTURE_CANNOT_CAPTURE_WINDOW	20337	Could not capture the window
ERROR_CAPTURE_STRING_ID_NOT_DEFINED	20338	String ID Not Defined
ERROR_CAPTURE_DELAY_LESS_THAN_ZERO	20339	Delay value cannot be less than zero
ERROR_CAPTURE_NO_MENU	20340	No menu to capture
ERROR_BROWSE_FAILED	20350	Directory browsing failed
ERROR_NOTHING_TO_DO	20351	There is nothing to do! - i.e. no files were found
ERROR_INTERNET_NOT_ENABLED	20352	Internet capability is required to use this function
ERROR_LVKRN_MISSING	20353	The LVKRN DLL is needed to use this function
ERROR_CMW_LOCKED	20354	The CMW support is locked
ERROR_CMW_FILTER_MISSING	20355	CMW filter is needed to use this function
ERROR_CMP_FILTER_MISSING	20356	CMP filter is needed to use this function
ERROR_FAX_FILTER_MISSING	20357	FAX filter is needed to use this function
ERROR_INV_HORZSIZE	20360	The horizontal size is outside the specification
ERROR_INV_VERTSIZE	20361	The vertical size is outside the specification
ERROR_ASPECTRATIO	20362	Invalid pel aspect ratio
ERROR_BITRATE	20363	Invalid bitrate
ERROR_VBV_BUFFER	20364	VBV Buffer Size is isn't valid
ERROR_CHROMA_FORMAT	20365	Invalid chroma format
ERROR_VIDEO_FORMAT	20366	Invalid video format
ERROR_COLOR_PRIMARY	20367	Invalid number of color primaries
ERROR_TRANSFER_CHAR	20368	Invalid number of transfer characteristics
ERROR_MATRIX_COEFF	20369	Invalid number of matrix coefficients
ERROR_DISPLAY_HORZSIZE	20370	Invalid horizontal display size
ERROR_DISPLAY_VERTSIZE	20371	Invalid vertical display size
ERROR_INTRA_DCPREC	20372	Invalid Intra DC Precision
ERROR_FCODE	20373	Invalid f code
ERROR_SRCH_WINDOW	20374	Invalid motion data search window
ERROR_PROFILEID	20375	Invalid profile id
ERROR_LEVELID	20376	Invalid level id
ERROR_PROFILEID_NS	20377	Encoder doesn't support scalable bitstreams
ERROR_INV_COMBINATION	20378	Undefined Profile & Level id combination
ERROR_BPIC_NOTALLOWED	20379	B Pictures not allowed
ERROR_RPTFIRST_MUSTBEZERO	20380	Repeat first must be zero
ERROR_FRAME_RATE	20381	Invalid frame rate
ERROR_VECTOR_NOT_ENABLED	20400	Vector capability is required to use this function
ERROR_VECTOR_DXF_NOT_ENABLED	20401	Vector DXF capability is required to use this function
ERROR_VECTOR_DWG_NOT_ENABLED	20402	Vector DWG capability is required to use this function
ERROR_VECTOR_MISC_NOT_ENABLED	20403	Vector Misc capability is required to use this function
ERROR_TAG_MISSING	20404	Tag not found
ERROR_VECTOR_DWF_NOT_ENABLED	20405	Vector DWF capability is required to use this function.
ERROR_NO_UNDO_STACK	20406	There is no undo stack
ERROR_UNDO_DISABLED	20407	The undo is disabled
ERROR_PDF_NOT_ENABLED	20408	PDF capability is required to use this function
ERROR_ENTENSIONS_MISSING	20409	EXIF extensions are missing
ERROR_BARCODE_DIGIT_CHECK	20410	Invalid error check digit
ERROR_BARCODE_INVALID_TYPE	20411	Invalid bar code type
ERROR_BARCODE_TEXTOUT	20412	Invalid bar code text out option
ERROR_BARCODE_WIDTH	20413	Invalid bar code width
ERROR_BARCODE_HEIGHT	20414	Invalid bar code height
ERROR_BARCODE_TOSMALL	20415	Bar code string is too small
ERROR_BARCODE_STRING	20416	Invalid bar code string for a specified bar code type
ERROR_BARCODE_NOTFOUND	20417	No bar code recognition
ERROR_BARCODE_UNITS	20418	Invalid bar code measurement unit
ERROR_BARCODE_MULTIPLEMAXCOUNT	20419	Invalid multiple max count
ERROR_BARCODE_GROUP	20420	Invalid bar code group
ERROR_BARCODE_NO_DATA	20421	Invalid BARCODEDATA structure
ERROR_BARCODE_NOTFOUND_DUPLICATED	20422	No duplicated bar code
ERROR_BARCODE_LAST_DUPLICATED	20423	Reached the last duplicated bar code
ERROR_BARCODE_STRING_LENGTH	20424	Invalid bar code data string length
ERROR_BARCODE_LOCATION	20425	Invalid bar code area location
ERROR_BARCODE_1D_LOCK	20426	Bar Code 1D is locked
ERROR_BARCODE_2D_READ_LOCKED	20427	Bar Code Read 2D (CodeOne) is locked
ERROR_BARCODE_2D_WRITE_LOCKED	20428	Bar Code Write 2D (CodeOne) is locked
ERROR_BARCODE_PDF_READ_LOCKED	20429	Bar Code Read PDF is locked
ERROR_BARCODE_PDF_WRITE_LOCKED	20430	Bar Code Write PDF is locked
ERROR_BARCODE_FOUNDCORRUPT	20431	Barcode PDF417 symbol is found but cannot be read successfully.
ERROR_BARCODE_DATAMATRIX_READ_LOCKED	20432	Bar Code Read DataMatrix is locked.
ERROR_BARCODE_DATAMATRIX_WRITE_LOCKED	20433	Bar Code Write DataMatrix is locked.
ERROR_NET_FIRST	20435
ERROR_NET_OUT_OF_HANDLES	20435	No more handles could be generated at this time
ERROR_NET_TIMEOUT	20436	The request has timed out
ERROR_NET_EXTENDED_ERROR	20437	An extended error has occurred
ERROR_NET_INTERNAL_ERROR	20438	An internal WinInet error
ERROR_NET_INVALID_URL	20439	The URL is invalid
ERROR_NET_UNRECOGNIZED_SCHEME	20440	The URL scheme could not be recognized or is not supported
ERROR_NET_NAME_NOT_RESOLVED	20441	The server name could not be resolved
ERROR_NET_PROTOCOL_NOT_FOUND	20442	The requested protocol could not be located
ERROR_NET_INVALID_OPTION	20443	Invalid option specified
ERROR_NET_BAD_OPTION_LENGTH	20444	The length of option is incorrect
ERROR_NET_OPTION_NOT_SETTABLE	20445	The option can not be set
ERROR_NET_SHUTDOWN	20446	The Win32 Internet function support is being shut down or unload
ERROR_NET_INCORRECT_USER_NAME	20447	Invalid user name
ERROR_NET_INCORRECT_PASSWORD	20448	Invalid password
ERROR_NET_LOGIN_FAILURE	20449	User could not connect to site
ERROR_NET_INVALID_OPERATION	20450	The requested operation is invalid
ERROR_NET_OPERATION_CANCELLED	20451	The operation was cancelled
ERROR_NET_INCORRECT_HANDLE_TYPE	20452	The type of handle supplied is incorrect for the operation
ERROR_NET_INCORRECT_HANDLE_STATE	20453	Handle is not in the correct state
ERROR_NET_NOT_PROXY_REQUEST	20454	The request cannot be made via a proxy
ERROR_NET_REGISTRY_VALUE_NOT_FOUND	20455	The registry value could not be found
ERROR_NET_BAD_REGISTRY_PARAMETER	20456	Incorrect registry value
ERROR_NET_NO_DIRECT_ACCESS	20457	Direct network access cannot be made at this time
ERROR_NET_NO_CONTEXT	20458	An asynchronous request could not be made because a zero context value was supplied
ERROR_NET_NO_CALLBACK	20459	A callback function has not been defined
ERROR_NET_REQUEST_PENDING	20460	Operation could not be completed because one or more operations are pending
ERROR_NET_INCORRECT_FORMAT	20461	The format of the request is invalid
ERROR_NET_ITEM_NOT_FOUND	20462	The requested item could not be located
ERROR_NET_CANNOT_CONNECT	20463	The attempt to connect to the server failed
ERROR_NET_CONNECTION_ABORTED	20464	The connection with the server has been terminated
ERROR_NET_CONNECTION_RESET	20465	The connection with the server has been reset
ERROR_NET_FORCE_RETRY	20466	Calls for the Win32 Internet function to redo the request
ERROR_NET_INVALID_PROXY_REQUEST	20467	The proxy request is invalid
ERROR_NET_NEED_UI	20468	User interface needed
ERROR_NET_HANDLE_EXISTS	20469	The request failed because the handle already exits
ERROR_NET_SEC_CERT_DATE_INVALID	20470	SSL certificate date that was received from the server is bad
ERROR_NET_SEC_CERT_CN_INVALID	20471	SSL certificate common name is incorrect
ERROR_NET_HTTP_TO_HTTPS_ON_REDIR	20472	Moving from a non-SSL to an SSL connection because of a redirect
ERROR_NET_HTTPS_TO_HTTP_ON_REDIR	20473	Moving from an SSL to a no-SSL connection because of a redirect
ERROR_NET_MIXED_SECURITY	20474	Indicates that the content is not entirely secure.  Some of the content being viewed may have come from unsecured servers
ERROR_NET_CHG_POST_IS_NON_SECURE	20475	Changing the post is not secure.
ERROR_NET_POST_IS_NON_SECURE	20476	Current posts is not secure.
ERROR_NET_CLIENT_AUTH_CERT_NEEDED	20477	Client need certificate authority.
ERROR_NET_INVALID_CA	20478	Invalid certificate authority
ERROR_NET_CLIENT_AUTH_NOT_SETUP	20479	Client authorization wasn't setup yet.
ERROR_NET_ASYNC_THREAD_FAILED	20480	Asynchronous thread failed
ERROR_NET_REDIRECT_SCHEME_CHANGE	20481	Redirect scheme change.
ERROR_NET_DIALOG_PENDING	20482
ERROR_NET_RETRY_DIALOG	20483
ERROR_NET_HTTPS_HTTP_SUBMIT_REDIR	20484	HTTP submitting redirect
ERROR_NET_INSERT_CDROM	20485	Insert CD Rom
ERROR_NET_HTTP_HEADER_NOT_FOUND	20486	The requested header could not be located
ERROR_NET_HTTP_DOWNLEVEL_SERVER	20487	The server did not return any headers
ERROR_NET_HTTP_INVALID_SERVER_RESPONSE	20488	The server response could not be parsed
ERROR_NET_HTTP_INVALID_HEADER	20489	The supplied header is invalid
ERROR_NET_HTTP_INVALID_QUERY_REQUEST	20490	The request made to HttpQueryInfo is invalid
ERROR_NET_HTTP_HEADER_ALREADY_EXISTS	20491	The header could not be added because it already exists
ERROR_NET_HTTP_REDIRECT_FAILED	20492	An HTTP redirection failed
ERROR_NET_HTTP_NOT_REDIRECTED	20493	The HTTP redirection did not occur
ERROR_NET_HTTP_COOKIE_NEEDS_CONFIRMATION	20494	Before a cookie is set there needs to be confirmation
ERROR_NET_HTTP_COOKIE_DECLINED	20495	Trying to assign a cookie was declined
ERROR_NET_HTTP_REDIRECT_NEEDS_CONFIRMATION	20496	The HTTP redirection needs to be confirmed
ERROR_NET_NO_OPEN_REQUEST	20497	Operation cannot be completed because there are no open requests
ERROR_VECTOR_IS_LOCKED	20500	Vector handle is locked
ERROR_VECTOR_IS_EMPTY	20501	Vector is empty
ERROR_VECTOR_LAYER_NOT_FOUND	20502	Layer is not found
ERROR_VECTOR_LAYER_IS_LOCKED	20503	Layer is locked
ERROR_VECTOR_LAYER_ALREADY_EXISTS	20504	Layer already exists
ERROR_VECTOR_OBJECT_NOT_FOUND	20505	Object is not found
ERROR_VECTOR_INVALID_OBJECT_TYPE	20506	Invalid object type
ERROR_VECTOR_PEN_NOT_FOUND	20507	Pen is not found
ERROR_VECTOR_BRUSH_NOT_FOUND	20508	Brush is not found
ERROR_VECTOR_FONT_NOT_FOUND	20509	Font is not found
ERROR_VECTOR_BITMAP_NOT_FOUND	20510	Bitmap is not found
ERROR_VECTOR_POINT_NOT_FOUND	20511	Point is not found
ERROR_VECTOR_ENGINE_NOT_FOUND	20512	Vector engine not found
ERROR_VECTOR_INVALID_ENGINE	20513	Invalid vector engine
ERROR_VECTOR_CLIPBOARD	20514	Clipboard error
ERROR_VECTOR_CLIPBOARD_IS_EMPTY	20515	Clipboard is empty
ERROR_VECTOR_CANT_ADD_TEXT	20516	Cannot add text
ERROR_VECTOR_CANT_READ_WMF	20517	Cannot read WMF
ERROR_VECTOR_GROUP_NOT_FOUND	20518	Cannot find the vector group
ERROR_VECTOR_GROUP_ALREADY_EXISTS	20519	Vector group already exists
ERROR_JP2_FAILURE	20530	JP2 Error in JP2 Box values
ERROR_JP2_SIGNATURE	20531	JP2 The header does not match the JP2 signature - not a JP2 file
ERROR_JP2_UNSUPPORTED	20532	JP2 file has a feature that is unsupported
ERROR_J2K_FAILURE	20533	J2K Invalid save options were specified to the encoder
ERROR_J2K_NO_SOC	20534	J2K File header does not contain SOC marker
ERROR_J2K_NO_SOT	20535	J2K File contains complete header but no compressed image data
ERROR_J2K_INFORMATION_SET	20536	J2K Invalid save options were specified or file includes invalid encoded values
ERROR_J2K_LOW_TARGET_SIZE	20537	J2K Compression ratio, target file size, or tile size was too small for encoder
ERROR_J2K_DECOMPOSITION_LEVEL	20538	J2K Specified Wavelet decomposition level was too high
ERROR_J2K_MARKER_VALUE	20539	J2K Decoder could not translate J2K marker - file is corrupt or invalid
ERROR_J2K_UNSUPPORTED	20540	J2K file has image with more than 30 bits per component
ERROR_J2K_FILTER_MISSING	20541	J2K filter is needed to use this function
ERROR_J2K_LOCKED	20542	J2K support is locked
ERROR_PAINT_INTERNAL	20600	Internal error (Call LEAD)
ERROR_PAINT_INV_DATA	20601	Internal error (Call LEAD)
ERROR_PAINT_NO_RESOURCES	20602	Internal error (Call LEAD)
ERROR_PAINT_NOT_ENABLED	20603	DigitalPaint capability is required.
ERROR_CONTAINER_INV_HANDLE	20630	Invalid container handle.
ERROR_CONTAINER_INV_OPERATION	20631	Invalid container operation.
ERROR_CONTAINER_NO_RESOURCES	20632	Not enough container resources.
ERROR_TOOLBAR_NO_RESOURCES	20660	Not enough toolbar resources.
ERROR_TOOLBAR_INV_STATE	20661	Invalid toolbar state.
ERROR_TOOLBAR_INV_HANDLE	20662	Invalid toolbar handle.
ERROR_AUTOMATION_INV_HANDLE	20690	Invalid automation handle.
ERROR_AUTOMATION_INV_STATE	20691	Invalid automation state.
ERROR_INV_SEG_HANDLE	20700	MRC - Invalid Segment Handle
ERROR_INV_SEG_DATA	20701	MRC - Invalid Segment Data
ERROR_INV_LAYER_DATA	20702	MRC - Invalid Layer Data
ERROR_MRC_NOT_ALLOCATED	20703	MRC - Not Allocated
ERROR_INV_MIN_SEGMENT	20704	MRC - Invalid Minimum Segment
ERROR_SEGMENTATION_FAILURE	20705	MRC - Segmentation Failure
ERROR_MRC_INV_PAGE	20706	MRC - Invalid page
ERROR_PDF_FILE_ENCRYPTED	20721	The PDF file is encrypted and the szPassword member of the FILEPDFOPTIONS is not set. (No password.)
ERROR_PDF_INVALID_PASSWORD	20722	Invalid password.
ERROR_PDF_FAX_NOT_ENABLED	20723	This feature requires a Fax engine.
ERROR_PDF_JPEG_NOT_ENABLED	20724	This feature requires a JPEG engine.
ERROR_PDF_INV_DOC_STRUCTURING_COMMENTS	20725	Invalid Document Structuring Comments (PS and EPS)
ERROR_PDF_FONTS_DIRECTORY_NOT_FOUND	20726	Could not find the Fonts directory.
ERROR_PDF_CANNOT_EDIT_FILE	20727	Cannot insert, delete, append or replace pages.
ERROR_PDF_BAD_CONTENT	20728	File is corrupted.
ERROR_PDF_BAD_INITIALIZATION_FILES	20729	The files required for initializing the PDF engine were not found, or they were found, but are not correct.
ERROR_SVG_FILE_SIZE_READ	20770	SVG - Invalid File Size Read
ERROR_SVG_ROOT_NOT_SVG	20771	SVG - ROOT is Not SVG
ERROR_SVG_NOFOUND_ROOT_ELEMENT	20772	SVG - Root Element Not Found
ERROR_SVG_INV_ELEMENT	20773	SVG - Invalid Element
ERROR_SVG_DUPLICATED_ATTRIBUTE	20774	SVG - Duplicated Attribute
ERROR_SVG_INV_ATTRIBUTE	20775	SVG - Invalid Attribute
ERROR_SVG_INV_ATTRIBUTE_VALUE	20776	SVG - Invalid Attribute Value
ERROR_SVG_BAD_CSS_PROPERTY	20777	SVG - Bad CSS Property
ERROR_SVG_MISSING_REQUIRED_ATTRIBUTE	20778	SVG - Missing Required Attribute
ERROR_SVG_DUPLICATED_ID	20779	SVG - Duplicated ID
ERROR_SVG_INV_COORDINATES_NUMBER	20780	SVG - Invalid Coordinates Number
ERROR_SVG_INV_STRING_COMMA	20781	SVG - Invalid String Comma
ERROR_LTCLR_DLL_NOTLOADED	20900	The ltclr13n dll is not loaded
ERROR_BARCODE_QR_READ_LOCKED	21380	Bar Code Read QR is locked.
ERROR_BARCODE_QR_WRITE_LOCKED	21381	Bar Code Write QR is locked.


Introduction To Image Processing with LEADTOOLS

The following topics provide general information about image processing, and where appropriate, they describe the related LEADTOOLS capabilities. These topics build up concepts and terminology; so if you are new to image processing, it is best to read them in order.

Bits Per Pixel and Related Ideas

Color Resolution and Dithering

Palette Handling

Image Manipulation and Analysis

Image Display

Bitmaps in Memory and in Files

DIBs, DDBs, and the Clipboard

Printing

TWAIN and ISIS Input

Database Interaction

Data Transfer

Animation


Introduction: Bits Per Pixel and Related Ideas

The terminology for image formats can be confusing because there are often several ways of describing the same format. This topic explains what the terms mean.

If an image is 24 bits per pixel, it is also called a 24-bit image, a true color image, or a 16M color image. Sixteen million is roughly the number of different colors that can be represented by 24 bits, where there are 8 bits for each of the red, green, and blue (RGB) values.

A 32-bit image is a specialized true-color format used in image files, where the extra byte carries information that is either converted or ignored when the file is loaded. The extra byte is used for an additional color plane in CMYK files, which are specialized files for color printing. In that case, LEADTOOLS, by default, converts the values to 24-bit RGB values when loading the image. The additional byte may also be used for an Alpha channel, which carries extra information such as a transparency indicator.

If an image is 16 bits per pixel, it is also called a 16-bit image, a high color image, or a 32K color image. Thirty-two thousand is roughly the number of different colors that can be represented by 16 bits, where there are 5 bits for each of the red, green, and blue values. (Devices that specify 64K color support are also referring to 16-bit images, but they are counting the left-over bit.)

If an image is 8 bits per pixel, it is also called an 8-bit image or a 256-color image. Two hundred fifty-six is the number of different colors that can be achieved by using the image data as 8-bit indexes to an array of colors called a palette.

If an image is 4 bits per pixel, it is also called a 4-bit image or a 16-color image. Sixteen is the number of different colors that can be achieved by using the image data as 4-bit indexes to a palette.

If an image is 1 bit per pixel, it is also called a 1-bit image, a black and white image, a 2-color image, or a bitonal image. Two is the number of different colors that can be achieved by using the image data as 1-bit indexes to a palette. The palette can contain colors other than black and white, although black and white are most common.

If an image is grayscale, its red, green, and blue values are all the same, and the values are incremented from the lowest to the highest. For example, an 8-bit grayscale image has 256 shades of gray, with values from 0 to 255. LEADTOOLS supports 4, 8, 12, and 16-bit grayscale.  Support for the 12 and 16-bit grayscale images is only available in the Document/Medical.

Most of this same terminology is applied to video cards. For example, an 8-bit card is one that is capable of displaying 256 colors.


Introduction: Color Resolution and Dithering

Color resolution (also called color depth) refers to the number of possible colors in an image, as determined by the bits-per-pixel. If an image in your computer is loaded from a FAX scanner or received as a FAX transmission, it is a black-and-white (1-bit) image. If it is loaded from a color scanner or a JPEG file, it can have 16 million colors. If it is loaded from a GIF file, it is likely to have 256 colors. There are many possibilities, ranging from two colors to 16 million.

LEADTOOLS lets you manipulate an image and display it on any Windows-compatible device, regardless of the image's color resolution. Therefore, in most cases you can load, display, modify, and save an image without ever changing its color resolution. Nevertheless, in some cases you may need to increase or decrease the color resolution. Here are some examples:

 Suppose you need to load a large 24-bit image on a computer that does not have much memory. You can conserve memory by loading it as an 8-bit image. Then, if you were using an 8-bit display device, you would not see any difference in the quality of the image. Of course, there would be some loss of quality on a 24-bit display device, and the loss would be permanent if you then saved the image in the same file.

 Suppose you want to save an image in a different file format. If the new file format does not support the original color resolution, you can specify a different color resolution when you save the image.

 Suppose you want to combine one 8-bit image with another one. To combine two images, they must have the same color resolution, and if they are less than 16 bits per pixel, they must use the same palette. The simplest solution is to convert both images to 24 bits per pixel before combining them. Then, if necessary, you can reduce the color resolution of the combined image.

Whenever you reduce an image's color resolution to 8 bits per pixel or less, a dithering method comes into play. One alternative is to use a nearest-color match (no dithering), which means that the color of each pixel is changed to the palette color that most closely matches it. If the original image contains subtle color details, the result of a nearest-color match may have large blotches of color that are not very pleasing.

Dithering methods create the appearance of more subtle shades by mixing in pixels of different colors. This is similar to the way newspaper pictures produce the appearance of shades of gray, even though the only actual colors are black and white.

Ordered dithering is the fastest method. It is the default dithering method when painting to a display device that is 256 colors or less. Ordered dithering takes advantage of the fact that the colors in most palettes are ordered so that similar shades are next to each other in the palette. This method avoids blotches of color by adding to or subtracting from the nearest-color value of each pixel to ensure that adjacent pixels do not have exactly the same color. (If the colors in the palette are not ordered, the results are not good.)

All of the other dithering methods in LEADTOOLS use error-diffusion algorithms. In error diffusion, the error is the difference between the original pixel color and the nearest match, and diffusion of this error is what the algorithm accomplishes. Floyd-Steinberg is a high-quality, fast error-diffusion method. It is the default method that LEADTOOLS uses if you reduce the color resolution when loading or saving an image, or if you specify error diffusion as the dithering method when painting to a display device that is 256 colors or less.

If you use a LEADTOOLS function to change the color resolution of a bitmap in memory, you can choose from a list of possible dithering methods. All of the alternative error-diffusion methods are slower than Floyd-Steinberg, and the quality may or may not be better, depending on the original image, and depending on whether the resulting image is to be displayed or printed. Choosing an alternative dithering method is a subjective, trial-and-error decision. Stevenson and Arce dithering, the slowest of the alternatives, is most likely to produce a higher quality result.


Introduction: Palette Handling

Any image that is 8 bits per pixel or less must have a palette. The palette is an array that contains the colors for displaying the image. The pixel values are indexes into the array. An image can have its own unique palette or it can share a common fixed palette. In either case, every bitmap in memory that is 8 bits per pixel or less has its own copy of a palette (even if it is a common fixed palette).

One way for a bitmap to have a unique palette is to load an image from a file that is 8 bits per pixel or less. In that case, the file contains a palette for the image, and you can assume that the palette is unique. By default, LEADTOOLS loads the palette that is stored in the file and associates it with the bitmap in memory.

Another way for a bitmap to get a unique palette is to create the palette. For example, if you reduce a 24-bit image to 8 bits per pixel, you can let LEADTOOLS create an optimized palette for the image.

By using a unique, optimized palette, you get the best possible image quality, but there is a drawback. When a display device uses a palette (for example, when it is in 256-color mode), it can only use one palette at a time to display colors. Therefore, if you are displaying more than one image at the same time, the current image may look perfect, while all of the others look bad, because they are mapped to the wrong palette. This is called palette shift.

Using a fixed palette solves these palette-shift problems. The best approach is to specify the fixed palette as a display option. Then, LEADTOOLS remaps each image to the fixed palette when it is displayed, without disturbing the individual image's palette. (When displaying 16-, 24-, or 32-bit images on a device with 256 colors or less, LEADTOOLS always uses the fixed palette.)

Alternatively, you can use a color resolution function to specify a fixed palette for each individual image. But then, when you save the image to a file, the fixed palette is saved in the file, and any unique palette information is lost.


Introduction: Image Manipulation and Analysis

Most LEADTOOLS functions for image manipulation and analysis act on the bitmap in memory. It is important to keep this in mind, because the changes become permanent when you save the bitmap in a file. Sometimes you want the changes to be permanent, and sometimes you do not. It all depends on the reason for making the changes.

Sometimes, you start with an image that has some undesirable qualities. For example, if the original image is too flat, you may want to use one of the contrast enhancement functions to make permanent improvements.

At other times, you may need to make temporary changes for use on a particular monitor or printer. Using the ActiveX control or DLL functions, you can set the brightness, contrast, and gamma correction for the display of all images, without affecting the bitmaps. But for other changes, such as creating a halftone for printing, a good strategy is to modify a copy of the image, and give the user the ability to undo changes. The undo strategy also makes sense with a manipulation, such as a mosaic effect, that intentionally distorts an image.

Some image manipulations, such as edge-detection filters, are commonly used to analyze an image, rather than to improve it. For example, in an industrial quality-assurance application, defects in a machine part may be easier to detect if an image of the part is processed with an edge-detection filter. Similarly, the creation of a histogram (an array that charts the frequency of color usage in an image) can be of value in an analytical situation.

Edge detection and histogram creation can also be used as steps in improving an image. For example, creating a histogram is a necessary step, internally, in some of the contrast-improvement functions. Also, an image created with an edge detection filter can be combined with the original image to harden or soften the original's edges.


Introduction: Image Display

When you display an image, the following things come into play:

 Sizing and positioning the display.

 Adapting the image to the color resolution of the display device.

 Making other refinements that affect the display but not the bitmap in memory.

The LEADTOOLS paint functions let you specify which part of an image to display, how big to make the display, and where to position the origin (for scrolling and zooming). In the ActiveX, the origin defaults to 0,0 and the size defaults to the bitmap size. This is arbitrary, and even with automatic scroll bars, it is unlikely to be what a user wants to see. Instead, the typical user either wants to see the whole image or wants to select a portion of the image to view.

Fortunately, LEADTOOLS makes it easy to show the user exactly what he wants to see. LEADTOOLS lets you control the size and position of the display without resizing or trimming the bitmap. In fact, it usually is best to think of the bitmap size as a measure of resolution, rather than a measure of size. The larger the bitmap, the more you can zoom in without losing detail.

As for adapting to the color resolution of the display device, if the color resolution of your device is greater than 256 colors, no adaptation is necessary.  If the color resolution is higher than 256 colors, images are displayed using their own color values. Of course, if a 24-bit image is displayed on a 16-bit device, there is some loss, but there are still no programming issues, since the only remedy is to change the display mode.

If the color resolution of your display device is 256 colors or less, you have to make some programming decisions regarding dithering and palette selection. When displaying 16-, 24-, or 32-bit images, you can determine whether LEADTOOLS uses ordered dithering or error diffusion to handle the color reduction. (LEADTOOLS uses a fixed palette for these images.) When displaying 8-, 4-, or 1-bit images, you must decide whether to use a fixed palette or the individual image's palette. Using the fixed palette avoids palette shifting when more than one image is displayed at the same time. Using the image's original palette produces the best possible display of the image's colors.

Other LEADTOOLS functions let you determine how the new display interacts with whatever is already on the display device. For example, you can use Windows ROP codes to combine the displayed images. Also, when displaying 1-bit images, you can set scale-to-gray or favor-black options that can improve the readability of scaled images (images that are zoomed in or out to fit the available space).

For displaying 12 to 16-bit grayscale images, LEADTOOLS provides functions for window leveling. Window leveling is only available in the Medical Imaging editions.


Introduction: Bitmaps in Memory and in Files

Generally, the size of a bitmap in memory is determined by its dimensions and its color resolution. For example, to calculate the number of bytes for a 500-by-500 pixel, 24-bit image, you multiply 500 * 500 * 3. (Multiply by 3 because there are 3 bytes in 24 bits.) For an 8-bit image, it would be 500 * 500, plus the size of its palette, which is about 1K. There is an exception for 1-bit files, which can be loaded in a compressed format using the LEADTOOLS Document/Medical toolkit.

For any color image, whether the color values are in a palette or in the image data, the color of each pixel in the bitmap consists of red, green, and blue values. They always use the RGB color-space model, which means that red, green, and blue values are combined to represent a color.

The size of the same color image when it is stored in a file is often much smaller, and the color-space model is not always RGB. For example, JPEG and LEAD CMP files both use a YUV color-space model, where Y is a luminance value, and the U and V values are chrominance values. In this color-space model, brightness information is stored in the luminance value, and color information is stored in the chrominance values. JPEG and LEAD CMP achieve data compression through sampling techniques that can affect the accuracy of the YUV values. This kind of compression is sometimes referred to as lossy compression, because you can manipulate the compression parameters to choose between greater compression or greater accuracy. (YCbCr, used in TIFF images, is the same color-space model as YUV.)

Another color-space model used in image files is CMYK (designed for color printing using cyan, magenta, yellow, and blackness). Other compression techniques include RLE (run-length encoding) and LZW (Lempel-Ziv and Welch). Both of these techniques preserve the accuracy of the image data, and they achieve compression solely by identifying repetitions of data. Some grayscale and 1-bit image file formats also use RLE and LZW compression techniques.

The image file formats are not only used for storage in the computer's file system, but are also used for database storage and for transmission of images. Furthermore, some applications keep frequently-used images in memory in a compressed file format. Thus, they can take advantage of memory speed when loading bitmaps from these files.


Introduction: DIBs, DDBs, and the Clipboard

A DIB (device independent bitmap) is a standard Windows representation of a bitmap. It is similar to the LEADTOOLS representation of a bitmap in that it includes palette information. A DDB (device dependent bitmap) is a hardware-specific representation that does not include palette information. Sometimes, you may need to manipulate a bitmap using Windows functions that work with DIBs or DDBs. For example, you may need to interact with an existing application that uses those functions. For that purpose, LEADTOOLS functions let you convert or copy to and from DIBs or DDBs. Of course, when converting to and from a DDB, you must preserve the palette information separately.

The clipboard is a standard Windows object for copying data from one application to another. LEADTOOLS lets you copy images to the clipboard and paste images from the clipboard. When copying to the clipboard, most LEADTOOLS functions clear the existing data from the clipboard, and copy image data to it in the form of a DIB, a DDB, and a palette (if one is needed). If that is not what you want, you can use a LEADTOOLS DLL function to specify exactly which actions to take.


Introduction: Printing

LEADTOOLS printing functions are designed to work with Windows printing functions. Normally, you use Windows to select a device context (DC) and start the print job. LEADTOOLS functions let you scale and position one or more images in the printer DC. You use Windows functions to get the available page dimensions. You also use Windows functions to eject each page and to end the print job.

In most cases, you can scale and position an image on a printer DC with the same flexibility as when you display an image on a computer screen. You can let the printer handle any dithering or halftoning. However, if you halftone a bitmap, yourself, before sending it to a printer, you should resize the bitmap to the desired height and width, then use the halftone function, then send the image to the printer without scaling it. (You get bad results if you scale a halftoned image.)

In C, C++, Visual Basic, and Delphi, you can use the actual Windows printing functions, or their equivalents in the development system. However, printing with Microsoft FoxPro and older versions of Access is more limited, because they do not give you direct access to the printer DC. The LEADTOOLS ActiveX handles this problem by providing methods to start and stop the print job.

With Access 7.0, you can also add code to a report's Print event to include ActiveX images. Or, more simply, you can embed the LEAD OLE Server, which is provided as a separate toolkit component.


Introduction: TWAIN and ISIS Input
Introduction: TWAIN and ISIS® Input

TWAIN:

TWAIN is a standard for image input devices, such as scanners and digital cameras. Getting an image from a TWAIN device can be very simple. First, there is a standard facility for selecting the input device. It is similar to selecting a default printer, and you can skip this step if you know that the default is right. Then, each TWAIN device has its own user interface, which you invoke to acquire an image.

Some complexity is introduced only when acquiring multiple images or when bypassing the user interface. If you acquire multiple images, you must code a callback function or event procedure to handle each image. If you bypass the user interface, you must set some standard TWAIN parameters to provide the information that the TWAIN driver would normally get from the user interface. The tricky part is that some TWAIN drivers implement the standard more fully than others. If you do not know in advance how the TWAIN device will behave, it is a good idea to add logic to your program to test the success of setting the TWAIN parameters. LEADTOOLS provides functions for all of this.

Please note that TWAIN support requires TWAIN.DLL for 16-bit or TWAIN_32.DLL for 32-bit.  These files must be obtained from the TWAIN device manufacturer.

Note: Starting with version 14, the LEADTOOLS Main ActiveX control no longer provides functionality for TWAIN support.  TWAIN support is now provided by the LEAD RasterTwain COM Object.

ISIS [Document/Medical]:

The Image and Scanner Interface Specification (ISIS) is a standard for scanner control and provides a complete framework for image processing.  LEADTOOLS supports image acquisition from ISIS scanner drivers.  The ISIS interface is message based, using tags to get and set scanner information and operating parameters.

LEADTOOLS provides ISIS Scanner support which allows you to determine if ISIS is available, load and unload ISIS Scanner Drivers, select and/or add an ISIS Scanner Driver through a dialog, scan one or more pages and save the images to files, and get or set Scanner Driver tags.  These tags provide information about the scanner and let you set parameters pertaining to scanning, such as contrast, brightness, resolution, compression method, etc.  With multipage scanning, you can code a callback function to provide a status report or cancel the operation.

Please note that ISIS support requires PIXDFLTN.DLL, which is not included with this package.  This file must be obtained from the ISIS device manufacturer.  Also note that you must obtain an ISIS driver from the scanner manufacturer or from Pixel Translations.  The .chn or .chw file must be in your path for ISIS scanning to work. LEAD does not grant any license to the ISIS driver or to ISIS development capabilities.  It is your responsibility to obtain the appropriate license to your development project, either from Pixel Translations, or one of their licensees. For more information on using ISIS, refer to Using ISIS to Scan Images.


Introduction: Database Interaction

With LEADTOOLS, you can use a variety of strategies to maintain images in a database. This variety is necessary because of the uneven support for storing images using different development and database systems.

The simplest database support is with Visual Basic, where you can bind a LEAD control (ActiveX) to a data control. You can associate the LEAD control with a long binary field in the database, and let the data control handle all of the database maintenance and navigation.

For other systems with ActiveX support, you may be able to use ODBC (Open Database Connectivity). ODBC is a standard interface for accessing local and remote databases. To use it, you define a data source that is implemented with an ODBC driver; then you access the data source in the same way you would a local database. LEADTOOLS provides ActiveX methods and properties that let you directly access image data through an ODBC data source. There are a couple of limitations in this approach. First, since the ActiveX accesses the image data directly and does not access any other data in the record, you must deal with the problem of identifying the image. To solve this problem, you can use another means of selecting records; then synchronize the ActiveX's view, so that it is always accessing the same record. (The ActiveX tutorials describe how to do this.) The second limitation is with ODBC drivers. Most of the available ODBC drivers do not properly support access to long binary fields. (The ACCESS 7.0 and FoxPro 2.x drivers have been tested successfully and are described in the ActiveX tutorials.)

Also, for systems with ActiveX support, you can use OLE DB and ADO to access data.  You can bind the LEADTOOLS OLE DB Control to an OLE DB data source, such as the Microsoft ADO Data Control.  You can associate the LEADTOOLS OLE DB Control with a long binary field in the database, and let the data control handle all of the database maintenance and navigation.

A more flexible approach on lower-level development systems, such as C, C++, and Delphi, is to use the ability of LEADTOOLS to save a file in memory. Once the image is available in memory in a compressed file format, you can use your choice of database engines to store and retrieve the data.

Finally, you may want to consider using your computer's or network's file system to store the images, use a database to store the file paths as strings, and write your own code to do the synchronization. In some cases, this could be a better solution than storing the images directly in the database.


Introduction: Data Transfer

When receiving transferred data, as in an Internet application or a FAX modem transmission, you often want to display the image as it is received.

To meet that need, LEADTOOLS provides simple functions that let you load image data into a bitmap as it is received. You can also use the LEADTOOLS paint-while-load feature to display the bitmap as it is received.

For Internet support, LEADTOOLS provides a plug-in DLL that can be used on WIN32 systems to view compressed images with Netscape Navigator or Microsoft Internet Explorer.


Introduction: Animation

GIF files are commonly used for small animated images in applications. These are multipage files, and animation is achieved by processing the list of images. (This is not the same as AVI or other full-motion video formats.)

LEADTOOLS lets you load a multipage file into a list of bitmaps; then create and play an animation sequence using the list. With the paint-while-load feature, you can also play the animation while the list is being loaded.

LEADTOOLS takes advantage of the special animation features in GIF files, such as using one palette for the whole list of bitmaps. But you can create, play, and save animations in any multipage format, including GIF, TIFF, and PCX. You can also create a list of bitmaps from an AVI file, but this is a read-only feature.


Copyright notice
Copyright Notices

©Copyright LEAD Technologies, Inc. 1991-2005. ALL RIGHTS RESERVED

Portions of the PCDLIB32.DLL, PCDLIB.DLL, LFFPX7.DLL, LFKODAK.DLL, EKFPIXJPEG140.DLL, PDC_SDK.DLL, PROFIRE.DLL, DC120V154_32.DLL, LFDCR14N.DLL, DCSPROBACK.DLL, DCSPRO3SLR.DLL, LFDCS14N.DLL, and LFKDC14N.DLL files contain material that is ©Copyright Eastman Kodak Company, 1996-2001. This software is based in part on the work of the Independent JPEG Group.

Portions of the LFCRW14N.DLL, LTCMP14.DLL, CDSDK.reg, CDSDK.dll, CDRAPCLS.dll, czs_ui.dll, deimg.dll, deImg010.dll, deImg110.dll, deImg153.dll, deimg301.dll, deimg401.dll, deImg404.dll, deimg602.dll, Deimg603.dll, DeImgd60.dll, pscAdimg.dll, pscCllct.dll, pscCStUI.dll, pscDcd.dll, pscDevUI.dll, pscDvlp.dll, Pscl2STI.dll, pscll.dll, pscParse.dll, pscSetup.dll, psdkdll.dll, psdkReg.dll, psParse.dll. file contain material that is © Canon, Inc. 2002

Portions of the LFFPX7.DLL and LFKODAK.DLL files contain material that is ©Copyright Hewlett Packard, 1996.

Portions of the OCR/ICR/OMR Features and the help file for the OCR/ICR/OMR Features are ©Copyright Scansoft, Inc. 1995-2003. ALL RIGHTS RESERVED

Portions of the Barcode Modules contain material that is ©Copyright Axtel Inc., 1999.

Portions of the LEADTOOLS PDF Plug in and the LEADTOOLS Vector Imaging Pro are ©Copyright 1996, 2000 Artifex Software Inc. All rights reserved.

File filters for decoding MrSID ® and DjVu ® formats are provided under a license from Lizardtech, Inc.

The "FlashPix" format uses Microsoft's OLE structured storage.

Portions of the DICOM help files in Medical Imaging product line are reprinted with permission from the National Electrical Manufacturers Association ©Copyright 1998 by the National Electrical Manufacturers Association. All rights including translation into other languages, reserved under the Universal Copyright Convention, the Berne Convention or the Protection of Literacy and Artistic Works, and the International and Pan American Copyright Conventions.

Portions of LEADTOOLS Data Security Add On contain software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/), including cryptographic software written by Eric Young (eay@cryptsoft.com) and by Tim Hudson (tjh@cryptsoft.com). Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. Copyright Tim Hudson 1995-1998 (tjh@cryptsoft.com) All rights reserved.

Portions of LEADTOOLS Data Security Add On contain software based on the MD5 Message Digest Algorithm developed by RSA Data Security, Inc.. Copyright (c) 1991-92 RSA Data Security, Inc. All Rights Reserved.

Portions hereof licensed under US patent 5,327,254 and foreign counterparts.

Portions of the LEADTOOLS ICC Profiles material is © Copyright 2004, International Color Consortium.

Trademarks

LEAD® and LEADTOOLS® are registered trademarks of LEAD Technologies, Inc.
Microsoft, Windows, Windows NT, Visual Basic, Visual FoxPro, and Microsoft Access are either trademarks or registered trademarks of the Microsoft Corporation.
OS/2® is a registered trademark of International Business Machines Corporation.

TextBridge®OCR is a registered trademark of Scansoft, Inc.

ISIS® is a registered trademark of Pixel Translations, Inc.

ScanAhead™ is a trademark of Pixel Translations, Inc.

FlashPix™ is a trademark of Eastman Kodak Company.

All other brand or product names used in this online help are trademarks of their respective holders.

Address and Contact Information

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

(704) 332-5532
FAX: (704) 372-8161
E-mail: support@leadtools.com
Technical support: (704) 372-9681 or support@leadtools.com
Home page: http://www.leadtools.com


Topic Selection

LEAD Technologies, Inc. Suite 400 1201 Greenwood Cliff Charlotte, NC 28204 Sales@Leadtools.com www.leadtools.com	(704) 332-5532 FAX: (704) 372-8161 Tech Support: (704) 372-9681
LEADTOOLS is ideal for developers involved in still frame, multimedia, document, medical, and vector imaging projects, including Internet/Intranet applications.  Independent of the specific application requirement – scanning, file format support/conversion, compression, image processing, annotation, database support, multimedia, etc. – LEADTOOLS provides the most comprehensive, robust, flexible, and powerful imaging solution available.

	Click this button to start the LEADTOOLS Licensing help file.
	Click this button to start the LEADTOOLS Products help file.
	Click this button to start the LEADTOOLS Image Categories help file.


Barcode Modules

The following Barcode Modules are available from LEAD. Please note (*) that each module requires runtime-licensing.

LEADTOOLS 1D Symbols (read and write)   $1195*

LEADTOOLS 2D Code One (read)   $1595*

LEADTOOLS 2D Code One (write)   $1395*

LEADTOOLS 2D PDF417 (read)   $1595*

LEADTOOLS 2D PDF417 (write)   $1395*


Technical Support

As a registered user, free technical support is available. You must register your software to receive any technical support. Technical support is available 9 a.m. through 6 p.m. Eastern Standard Time. If you are calling by phone, please be at your computer. You can also contact us through the following methods:

Phone: 	(704) 372-9681

E-mail: 	support@leadtools.com

FAX: 	(704) 372-8161

Online Support / FAQs	http://www.leadtools.com (click on Customers Only)

Home page: 	http://www.leadtools.com

FTP:	ftp.leadtools.com

You can also contact LEAD by mail at:

LEAD Technologies, Inc.
Attn: Technical Support
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Before calling technical support, please look in the online documentation and the example programs for an answer to your question.


Raster Pro/Document/Medical Features

Raster Pro:

LEADTOOLS Raster Imaging Pro provides some imaging capabilities that are not available in the LEADTOOLS Raster Imaging product.  In order to access these features, you must unlock support for L_SUPPORT_LTPRO, using the UnlockSupport method.  To unlock this support, call UnlockSupport(L_SUPPORT_LTPRO, L_KEY_LTPRO). L_KEY_LTPRO can be found in ltkey.h for C++ programmers and in L_OCX.bas for VB programmers.

If you are a licensed user of LEADTOOLS Raster Imaging, and would like to access Raster Imaging Pro features, you must contact Tech Support for information on obtaining a license and the unlock key for calling UnlockSupport.

Document/Medical:

LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite are the most comprehensive imaging toolkits on the market.  No other toolkit provides as many imaging features for color, gray-scale and black & white images in one development package, and for one price.  These toolkits comprise LEAD's best code and are designed for the programmer who is looking for the fastest performance, and/or the most extensive color, document, and medical imaging capabilities available.

These toolkits contain powerful annotation capabilities and optimized document image processing filters, and high performance compression, decompression and viewing of JPEG, LEAD CMP, and CCITT G3/G4. The annotation capabilities enable the programmer to add text, highlights, sticky notes, audio, ellipses, buttons, lines, arrows, rectangles, polygons, redaction (blackout), hotspots, freehand scribble, pointers, bitmap and text stamps, to black & white and color images.  Programmers working with document imaging will also find special processing filters such as despeckle, deskew, favor black, and scale to gray to enhance their black and white 1 bit images.  Additionally, you can achieve faster rotation in 90-degree increments by applying a rotated view perspective to the bitmap. These LEADTOOLS toolkits offer the fastest software-only JPEG decoder available.

LEADTOOLS Document Imaging

The LEADTOOLS Document Imaging toolkit contains all the features available in the LEADTOOLS Raster Imaging Pro. In addition, it contains the following capabilities:

 Special functions for Document (bitonal) images. The LEADTOOLS functions for bitonal images are especially useful for working with images from black-and-white scanners or FAX machines. These functions let you do things such as automatically straighten (deskew) an image, remove spots (despeckle), or clarify a scaled display (using scale-to-gray and favor-black features).

 Annotation. LEADTOOLS supports annotation of images by letting you overlay images with text, lines, shapes, arrows, buttons, highlights, hot spots, sticky notes, stamps, buttons, and sounds.

 Fast rotation. LEADTOOLS achieves fast rotation in 90-degree increments by applying a rotated view perspective to the bitmap.

 ISIS support. LEADTOOLS supports ISIS interfaces for driving scanning devices.

 Faster compression and decompression. The Document/Medical editions work faster when loading and saving LEAD CMP, JPEG, and CCITT Group 3 and Group 4 images. The LEADTOOLS functions for loading and saving are the same in all products. The only difference is in performance.

 1-bit Image Clean-up. The Document toolkits include support for removing dots, blobs, holes, inverted text, lines, borders, bumps and nicks from 1-bit images.

 Region Clean-up. [Document/Medical] Remove all the holes from a region.

 Embedded Messages. The Document toolkits include support for embedding messages in lossless image formats like bmp, tiff, lossless jpeg, etc. The message is embedded without any visible changes to the image, and does not appreciably increase the size of the image. The message is password-protected.

 12 and 16 bit grayscale images. [Document/Medical] Load, process, display, window level and save 12 and 16 bit grayscale images (including support for 16-bit grayscale TIFF).

 48 and 64 bit color images. [Document/Medical] Load, process, display, and save 48 and 64 bit color images.

LEADTOOLS Document Imaging Suite

The LEADTOOLS Document Imaging Suite toolkit contains all the capabilities of LEADTOOLS Document Imaging, and includes the features listed below. Please note that the OCR features are included in this toolkit, however they can also be purchased as a plug-in for the LEADTOOLS Document Imaging toolkit. Also, JBIG support is provided in this toolkit, however a JBIG Module may be added on to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite.

 OCR features. [Document/Medical] LEAD offers OCR features that use Scansoft Textbridge technology. Support for these features is included in the LEADTOOLS Document Imaging Suite, and can be added, via plug-in to the LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. The OCR features allow you to perform optical character recognition and turn images into documents. Features include preset confidence and accuracy levels for controlling how sensitive the engine is to unrecognized text, artificial intelligence for improving recognition on documents of the same type, and built-in and user-defined lexicons for limiting the type of text to recognize within a particular zone. LEADTOOLS provides the ability to verify or correct text during, and (using LEAD's unique OCR editor) after recognition. LEAD's OCR editor ties the text being edited directly to the image, providing a visual reference to the original bitmap data. The OCR engine can perform Automatic area segmentation creating multi-layered zones, recognizing areas such as tables, rules, images and text. Or, you can manually designate up to 250 such zones. The OCR features support different fonts, sizes (5 to 72 point) and styles. Fax, dot matrix and halftones can be preprocessed to improve recognition results. The OCR Engine supports major European and Scandinavian languages (Danish, Dutch, Finnish, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, and Swedish) as well as English. Support for dialects such as US. English, French Canadian, Latin American Spanish, Swiss German, and Brazilian Portuguese is also provided.

Recognized text can be exported to more than 40 different formats, including MS Word, MS Excel, Dbase and WordPerfect. The LEADTOOLS OCR features contain superior OCR processing speeds, for use in form recognition and processing applications.

 LEAD's JBIG filter. [Document/Medical] LEAD includes support for this filter in the LEADTOOLS Document Imaging Suite toolkit. Support for this filter can be added to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite by purchasing the JBIG Module. JBIG defines a method for lossless compression encoding of a bi-level image (two-color image). This method can also be used for coding grayscale and color images. LEADTOOLS completely supports all three types of images, giving you the ability to make full use of this powerful compression technology.  LEADTOOLS also supports the progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead.

LEADTOOLS Medical Imaging

LEADTOOLS Medical Imaging contains all the capabilities of LEADTOOLS Document Imaging.  It also includes general medical imaging technologies (1-16,24,32 bit color, 1-16 bit grayscale and window leveling of 12 and 16-bit grayscale images) and support for the DICOM file format.

 DICOM file support. [Medical] LEADTOOLS Medical Imaging provides COMPLETE support for the DICOM 3.0 specification, including all standard IOD classes and modalities (CR, CT, MR, NM, US, RF, SC, VL, etc.) and complete DICOM Basic Directory support.

 Window leveling. [Medical] Detect and set LowBit and HighBit for image data, display images with automatic LUT intensity expansion, or set LUT entries and ranges with specific values and gradients. Display images through the LUT without changing the data, or process the image data using the LUT. Linearize the number of pixels locally in a bitmap, based on the specified color space in order to bring out the detail in dark areas of an image, and smooth the edges between blocks.

 Medical Imaging Processing. [Medical] LEADTOOLS Medical Imaging provides image processing functionality designed specifically to allow you to examine and improve the quality of medical images.

LEADTOOLS Medical Imaging Suite

LEADTOOLS Medical Imaging Suite contains all the capabilities of LEADTOOLS Medical Imaging. In addition, it supports the following:

 DICOM Communication support. [Medical Suite] LEADTOOLS provides COMPLETE support for DICOM Communications, including all Service Classes (Verification, Storage, Query/Retrieve, Patient Management, etc), and contains high-level communications functions simplifying the creation of DICOM client/server applications.

(Document/Medical) is used in the documentation to designate the features that are available in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. Those features that are available only in the Medical toolkits are indicated in the documentation by (Medical). Features available only in the LEADTOOLS Medical Imaging Suite toolkit are indicated in the documentation by (Medical Suite).

(Internet only) is used in the documentation to designate the features that are available only in the LEADTOOLS Internet toolkit.

For more information, refer to Document/Medical Edition Support and Licensing Requirements.

	Click this button to start the LEADTOOLS Products help file.


LEADTOOLS Documentation
LEADTOOLS Reference Manuals

LEADTOOLS provides reference manuals that contain the same information as the online help. You can print them from PDF files. Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

To print the PDF files, you must use the Adobe Acrobat Reader 3.0 or higher.  You can download a copy of the Acrobat Reader from the Adobe web site (http://www.adobe.com). Note that different versions of the Acrobat Reader are available for different operating systems, but they all can read the same PDF files.


Introduction

LEADTOOLS ActiveX (OCX) has several custom controls developed by LEAD Technologies, Inc.

•	LEAD Main Control Module provides the custom controls for incorporating image compression, file format support, and image processing into your applications.

•	LEAD Imaging Common Dialog Control Module provides custom controls for incorporating dialog boxes that combine Windows Common Dialog functionality with LEADTOOLS Imaging functionality.

•	LEAD ISIS Control Module provides custom controls for incorporating ISIS scanner control into your applications.

•	LEAD ImageList Control Module provides the custom controls for displaying and manipulating image lists.

•	LEAD Thumbnail Browser Control Module provides custom controls for generating thumbnails of LEAD supported images from a directory.

•	LEAD Vector Control Module provides custom controls for working with vector images.

In the documentation, the properties, methods and events in the LEAD Main Module are designated by (Main Control). The properties, methods and events are designated as follows:

•	in the LEAD Imaging Common Dialog Module they are designated by (Common Dialog Control)

•	in the LEAD ISIS Module they are designated by(ISIS Control)

•	in the LEAD ImageList Module they are designated by (ImageList Control)

•	in the LEAD Thumbnail Browser Module they are designated by (ThumbnailBrowser Control)

•	in the LEAD Vector Module they are designated by (Vector Control)

To use the same bitmap between controls, assign the bitmap property from one control to the other control.

The toolkit comes in 32-bit Document/Medical and non-Document/Medical editions. You can use the LEADTOOLS ActiveX in any programming environment that supports OLE custom controls, including the following:

Visual C++ 1.5 and later (32-bit)
Visual Basic 4.0 and later (32-bit)
Access 95, version 7.0, and Access 97 (32-bit)
Visual FoxPro 3.0 and later (32-bit)
Delphi 2.0 and later (32-bit)

If you are upgrading an existing application that uses the LEADTOOLS ActiveX, refer to Upgrade Instructions.

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

Advisories

Introduction To Image Processing with LEADTOOLS

Compression Using LEAD and JPEG Formats

Summary of All Supported Image File Formats

Compression Quality Factors


Advisories

Limitations with Visual Basic

Limitations with Visual Basic 4.0

Limitations with Visual FoxPro

Limitations with Microsoft Access

Palette Usage in Microsoft Access

Limitations with Delphi 2.0

Limitations with Borland C++ Builder


Limitations with Visual Basic

Installations created with the Visual Basic 4.0 Setup Toolkit sometimes fail because of incompatible versions of the Olepro32.dll and Oleaut32.dll files. This is a known problem in Visual Basic, and a resolution of the problem is described in article Q162518 in the Microsoft Knowledge Base.

In an MDI application, Visual Basic 4.0 sometimes fails to update the palette on a child window when painting a 256-color image. This is a known bug in Visual Basic, and it is described in article Q149233 in the Microsoft Knowledge Base. The workaround recommended in the Knowledge Base article has been unreliable in testing performed by LEAD Technologies.


Limitations with Visual Basic 4.0

The Common Dialog ActiveX controls are created using Microsoft's ATL library for ActiveX controls.  OLE_COLOR, IPictureDisp*, and IFontDisp* properties do not persist properly in Visual Basic 4.0 using the ATL implementation of property persistence.  You will not be able to save settings for these properties at design-time.  When you save your form in VB 4.0, the values for these properties will be empty.  When you reload that form, you will get errors indicating failure to load these property values.  You can ignore these errors.  You should initialize these properties to the desired values in your code at run-time.  The properties involved are:

Font property

BackColor property

ForeColor property

StartColor property

EndColor property

TransparentColor property

WandColor property

ShapeBorderColor property

ShapeInnerHiliteColor property

ShapeInnerShadowColor property

ShapeOuterHiliteColor property

ShapeOuterShadowColor property

ShadowColor property

TextColor property

TextHiliteColor property

Note:	This limitation does not apply to VB 5.0.


Limitations with Visual FoxPro

The LEADTOOLS ActiveX supports database access using Open Database Connectivity (ODBC). The ActiveX requires ODBC drivers that can properly handle long binary fields. Examples have been tested and will work with the Microsoft FoxPro Driver, version 3.5, which can access FoxPro 2.x databases. The examples will not work with version 5.0 of the Microsoft Visual FoxPro Driver. (The non-ODBC LEADTOOLS functions can be used with Visual FoxPro 5.0.)

You can download ODBC drivers from the Worldwide Web home page, the CompuServe forum, or the LEAD BBS. The web page is ftp://ftp.leadtools.com/pub/utils/ODBC32.zip.  The CompuServe forum is at GO LEADTECH. The file to download is ODBC32.ZIP.

You cannot add images to a database using FoxPro's table browser, and you cannot print images using FoxPro's Report Designer.

Visual FoxPro 3.0 does not recognize events that the ActiveX generates during a process. (In Version 5.0, the APPLICATION AutoYield property allows processing of these events.) Therefore, version 3.0 does not support the following properties and events:

Change event

EnableProgressEvent property

LoadInfo event

ProgressStatus event

Under Visual FoxPro, LEADTOOLS was unable to load PCD files during testing. Therefore, the following properties are not supported under FoxPro:

InfoPCDRes property

PCDRes property

In addition, Visual FoxPro does not appear to support the following:

GetPicture method

SetPicture method

MousePointer property

MouseIcon property


Limitations with Microsoft Access

The LEADTOOLS ActiveX supports database access using Open Database Connectivity (ODBC). Because of problems with the 16-bit version of ODBC, the LEADTOOLS ActiveX does not provide database access with version 2.0 of Access. (Access 95 does not have this limitation.)

You can easily convert the Access 95 examples to Access 97. When reading the Access 95 tutorial, you will find some minor differences in Access 97.

LEADTOOLS provides over 2000 defined constant identifiers for effects. Several of these have been omitted from L_ACCESS.BAS because the file size exceeds that allowed by Visual Basic. The entire list of defined effects identifiers are included in L_ACCEFX.BAS. You can replace effects identifiers in L_ACCESS.BAS with effects identifiers in L_ACCEFX.BAS.

In addition, several of the defined constant identifiers for effects exceed the identifier length allowed by Access 2.0.  Consequently, some of the defined effects identifiers have been commented out.  You can pass any of the values, but if you wish to use a defined effects identifier, you must do one of the following:

1. Make sure it is not commented out in the .BAS file.

2. Replace an unused effects identifier in L_ACCESS.BAS with one you wish to use from L_ACCEFX.BAS.

3. Shorten the length of an effects identifier that has been commented out.

You cannot use buttons and hot spots as annotations with Access 2.0. (Access 95 does not have this limitation.) The following methods and events are affected:

AnnClicked event

AnnCreate event

AnnDestroy event

AnnDrawn event

AnnGetTag method

AnnGetType method

AnnSetTag method

Access 2.0 cannot use the three-dimensional text properties, because of a reserved-word failure when setting the TextWidth and TextHeight properties.

Under Access 2.0 and Access 95, LEADTOOLS was unable to load PCD files during testing. Therefore, the following properties are not supported under Access:

InfoPCDRes property

PCDRes property

In addition, Access does not appear to support the following:

GetPicture method

SetPicture method

MouseIcon property


Palette Usage in Microsoft Access

With all versions of Microsoft Access, you can often improve the display of images in 256-color mode by implementing LEAD’s fixed palette as the custom palette on a form. To do so, take the following steps:

1.	Use the LEADTOOLS Main Demo to save an 8-bit BMP file with a fixed palette. To do this, you load any image, use the Color Resolution option to convert it to 8-bit with a fixed palette, then save it as an 8-bit BMP file in your application directory.

2.	In the Properties box for the form or report, change the Palette Source property to a custom palette by specifying the BMP file that you saved.

3.	In the code that initializes the LEAD control, specify LEAD’s fixed palette as the paint palette. For example:

Lead1.PaintPalette = PAINTPALETTE_FIXED


Limitations with Delphi 2.0

The LEADTOOLS ActiveX supports database access using Open Database Connectivity (ODBC). Because of problems with the ODBC drivers for Paradox and dBase, the LEADTOOLS ActiveX does not currently support database access using Delphi 2.0.

In addition, Delphi 2.0 does not appear to support the following:

GetPicture method

SetPicture method

MouseIcon property

PanWinCursor property

PanWinIcon property


Limitations with Borland C++ Builder

When you first install the Common Dialog ActiveX control into the Borland C++ Builder IDE, you will get an error message during the library build process.  The error message will be "Integer Constant Too Large", and will refer to the constant DLG_IMG_AUTOPROCESS.  In the file \cbuilder\lib\ltdlg14n.pas, change the line:

DLG_IMG_AUTOPROCESS = -2147483648;

to

DLG_IMG_AUTOPROCESS = $80000000;

Then, rebuild the component library using the Component | Rebuild Library menu item.  When prompted to save \cbuilder\lib\ltdlg14n.pas, choose "Yes".


Compression Using LEAD and JPEG Formats

Compression of color and grayscale graphic image files is useful because the files are big. They can range from 100 kilobytes to more than 200 megabytes. Compressing the image files does the following:

 Dramatically decreases the storage requirements

 Improves the input and output speed within a system

 Improves the transmission speed over networks or phone lines

By incorporating the LEAD and JPEG image compression, you can develop applications that would be impractical otherwise. Image files can be reduced to 200 times smaller than their original size.

The LEAD CMP compression format was created by LEAD Technologies, Inc., and it delivers a much smaller file size and better image quality than other compression techniques, including JPEG.

LEAD's CMP file format allows for decompression to a 24-bit medium at 24-bit color and to an 8-bit medium at 8-bit color without sacrificing image quality. This eliminates the need to convert all images to 8 bits in order to support the low end users or to save one 8-bit file and one 24-bit file. The result is one much smaller file size that can be viewed on a 24-bit video card at 24-bit true color, as well as on an 8-bit VGA card at 256 colors.

LEAD's CMW format uses Wavelet CMP compression. Currently, 24 color images and 8, 12 and 16-bit grayscale images are supported in this format. (This is available only in the LEADTOOLS CMW Plug in. 12 and 16-bit formats also require the Document/Medical capabilities)

Summary of All Supported Image File Formats describes the LEAD and JPEG compression formats, in addition to other formats that LEADTOOLS supports.

The amount of compression is controllable, allowing the compressed image quality to match the needs of your application. Compression Quality Factors describes how the quality factors are used.

JPEG Compliant

LEADTOOLS ActiveX is fully JPEG compliant. Any file using compression that is compliant with the JPEG Interchange File Format can be viewed and converted.

However, some images that are not fully compliant with the JPEG specification will be displayed upside-down. (The JPEG Interchange File Format specifies that all images must be stored top-down.) You can change the orientation of an image by modifying the ViewPerspective flag in the LEAD bitmap handle.

JPEG 2000 Compliant

LEADTOOLS ActiveX can load and save JPEG 2000 files. You can load 24-48 bit color images (images with 25-47 bits/pixel will be loaded as 48-bit). You can load 8-16 bit grayscale images. Images with 9-11 bits/pixel will be loaded as 12-bit while images with 13-15 bit are loaded as 16 bits/pixel.

You can save 24 and 48-bit color images and 8, 12 and 16-bit grayscale images.

LEADTOOLS supports JPEG2000 stream (J2K) and JP2 format files. LEADTOOLS supports the mandatory boxes of the JP2 format only.

4 and 1-bit Images

JPEG and LEAD CMP compression are intended for use with high resolution images, and they are impractical for use with 4- or 1-bit images.

You can use the CCITT, LEAD 1-bit, RLE, LZW, and ZIPLib compression methods available in many of LEADTOOLS supported formats.

8 and 24-bit Images

Using JPEG, JPEG2000 and LEAD CMP or CMW compression, color images are 24 bits per pixel, and grayscale images are 8 bits per pixel. Therefore, to compress an 8-bit color image, the internal JPEG, JPEG2000 and LEAD CMP or CMW compression functions must convert the 8-bit data into raw RGB 24-bit before compressing it as a color image.

Compressing the original 24-bit image will result in a smaller file size and higher quality than compressing an optimized 8-bit color image.

LEADTOOLS functions compress 8-bit grayscale as 8-bit grayscale JPEG or CMP images.

You can use RLE, LZW and ZIPLib (PNG) compression methods available in many of LEADTOOLS supported formats.


Compression Quality Factors

You can specify a quality factor when saving an image file to LEAD, JFIF, LEAD2JFIF, LEAD2JFIF, JTIF, LEAD1JTIF, and LEAD2JTIF. The quality factor (Q factor) is a number that determines the degree of loss in the compression process. You can set a value from 2 to 255, where 2 is the highest quality and 255 is the most compression.

For JFIF and JTIF compression only, you can also use a factor of 0 to produce lossless JPEG files

For LEAD CMP compression (8-bit, 12-bit and 24-bit only), you can also use one of the following enhanced options:

Q Factor	Predefined options for LEAD only
PQ1	(-1) Perfect quality 1 This option compresses all colors of a 24-bit file and maintains the quality of the original image at a smaller file size. As the name suggests, there is no visual loss of color at this setting.
PQ2	(-2) Perfect quality 2 This will produce a smaller file size than PQ1 while maintaining similar quality.
QFS	(-3) Quality far more important than size This option removes colors not noticed by the human eye. Most viewers cannot tell the difference between an image compressed at this level and the original image.
QMS	(-4) Quality more important than size While more colors are removed, most of them are colors or shades that are close to one another. The compressed image will appear very much like the original image. It will take some study to see the difference.
QS	(-5) Quality and size equally important This option provides the highest compression while maintaining good image quality. Try this option first, then move up or down the list accordingly to obtain acceptable compression size and image quality.
SQS	(-6) Size more important that quality (sharp) This option is recommended for images that have sharp edges. For example, an image that has a text overlay or an image with many straight lines. While it creates a larger file than the next option, it retains better edges.
SQT	(-7) Size more important than quality (less tiling) This option produces less tiling in the image than the previous options. However, it may distort text or straight lines. It is a good option for image database applications.
MCQ	(-8) Maximum compression keeping quality This option provides maximum compression while maintaining as high as possible image quality.
MC	(-9) Maximum compression This option gives maximum compression. It is equivalent to a Q factor of 255.

For the PNG format, the qFactor can be a value between 0 and 9.   0 = (default compression), 1 (fastest compression) ... 9 (highest compression ratio)

For JP2 and J2K files, the Qfactor can be a value between –1 and 255. –1, and 0 represent lossless compression, while all the values between 1 and 255 are considered as compression ratios. For example a Qfactor of 10 is a compression ratio of 10. A Qfactor of 1 gives the best lossy quality, while a Qfactor of 255 gives the highest compression. If the compression control used by the toolkit when saving J2K files is J2K_COMPRESSION_QFACTOR, then the compression used is based on the Qfactor passed to the SaveXXX method. For more information about setting the options for saving J2K files, refer to the J2KXXX properties of the Main Control.

For the LMC compression (FILE_LMC and FILE_TIF_LMC), the qFactor can be one of the following values:

Q Factor	Predefined options for LEAD only
LMCQ_LOSSLESS	[0] Lossless compression. This option compresses a 1-bit file and maintains image data unchanged.  Highest quality.
LMCQ_VIRTUALLOSSLESS	[1] Lossy compression. This option removes the image's noisy pixels and compresses it to a smaller file size than LMCQ_LOSSLESS.
LMCQ_REMOVEBORDER	[2] Lossy compression. This option removes the image's border, if it exists, and compresses it to a smaller file size than LMCQ_ VIRTUALLOSSLESS.
LMCQ_ENHANCE	[3] Lossy compression. This option cleans up the image, removes its border if it exists, and compresses it to a smaller file size than LMCQ_REMOVEBORDER.
LMCQ_MODIFIED1	[4] Lossy compression. This option cleans up the image, removes its border if it exists, and compresses it to a smaller file size than LMCQ_ENHANCE. However, it may distort text or straight lines.
LMCQ_MODIFIED2	[5] Lossy compression. This option cleans up the image, removes its border if it exists, and compresses it to a smaller file size than LMCQ_MODIFIED1. However, it may distort text or straight lines. Maximum compression.


Properties, Methods, and Events

MRC Bitmap Functions

Automatic Segmentation

Auxiliary Elements

General Segmentation

Loading a Page

Manipulating Segments

Manual Segmentation

Saving a Page

Working with the Control

General Behavior

Client Area Usage

Raster Images

Creation, Deletion, and Copying

Displaying and Printing

Image Processing

Input and Output

Palettes

Region Processing

Annotations (Document/Medical only)

Annotation Events

Annotation Hyperlinks

Annotation Security

Automation

Input and Output

Object Manipulation

Using the Clipboard

Bitmap

Databases

OLE DB

Using ODBC

Visual Basic Data Binding

Support

Version and License Information


MRC Bitmap Functions:
Automatic Segmentation

AutoSegment event (Mixed Raster Content Control)

AutoSegment method (Mixed Raster Content Control)

StripeMaxHeight property (Mixed Raster Content Control)


MRC Bitmap Functions:
Saving a Page

BackgroundCoder property (Mixed Raster Content Control)

BackgroundQFactor property (Mixed Raster Content Control)

EnhanceQuality property (Mixed Raster Content Control)

MaskCoder property (Mixed Raster Content Control)

Save method (Mixed Raster Content Control)

SaveT44 method (Mixed Raster Content Control)


MRC Bitmap Functions:
General Segmentation

BaseBackColor property (Mixed Raster Content Control)

BaseForeColor property (Mixed Raster Content Control)

Bitmap property (Mixed Raster Content Control)


MRC Bitmap Functions:
Manipulating Segments

DeleteSegment method (Mixed Raster Content Control)

EnumSegments event (Mixed Raster Content Control)

EnumSegments method (Mixed Raster Content Control)

UpdateSegmentData method (Mixed Raster Content Control)


MRC Bitmap Functions:
Auxiliary Elements

EnableMethodErrors property (Mixed Raster Content Control)

IsSupportLocked method (Mixed Raster Content Control)

UnlockSupport method (Mixed Raster Content Control)


MRC Bitmap Functions:
Loading a Page

GetPagesCount method (Mixed Raster Content Control)

Load method (Mixed Raster Content Control)


MRC Bitmap Functions:
Manual Segmentation

SetNewStripe method (Mixed Raster Content Control)

SetStripeSegment method (Mixed Raster Content Control)


Working with the Control:
General Behavior

Control usage:

Enabled property

EnableMethodErrors property

EnableProgressEvent property

hWnd property

MouseIcon property

MousePointer property

OLEDropAllowed property

OLEDropAutoLoad property

OLEDropFile event

ProgressStatus event

Appearance:

Appearance property

BackColor property

BorderStyle property

FrameColor property

FrameInnerHiliteColor property

FrameInnerShadowColor property

FrameInnerStyle property

FrameInnerThickness property

FrameOuterHiliteColor property

FrameOuterShadowColor property

FrameOuterStyle property

FrameOuterThickness property

FrameThickness property

Transparent property

Keyboard events:

KeyDown event

KeyPress event

KeyUp event

Mouse events:

Click event

DblClick event

EnableMouseWheel property

MouseDown event

MouseMove event

MouseUp event

MouseWheel event

Input/Output File Format Filters:

IgnoreFilters method

PreLoadFilters method


Working with the Control:
Client Area Usage

Mouse events:

Click event

DblClick event

EnableMouseWheel property

MouseDown event

MouseMove event

MouseUp event

MouseWheel event

Display events:

Paint event

RubberBand event

Scroll event

Selecting a rectangular area:

AutoRubberBand property

MouseIcon property

MousePointer property

RubberBandHeight property

RubberBandLeft property

RubberBandTop property

RubberBandVisible property

RubberBandWidth property

SetRubberBandRect method

Getting the device context:

GetClientDC method

ReleaseClientDC method

Getting client-area measurements:

ScaleHeight property

ScaleLeft property

ScaleMode property

ScaleTop property

ScaleWidth property

Converting Between Bitmap and Client Coordinates

BitmapToClient method

ClientToBitmap method

ConvertX property

ConvertY property

Specifying the client area as the drawing surface:

DrawPersistence property

Drawing simple objects:

DrawEllipse method

DrawFillColor property

DrawFillStyle property

DrawLine method

DrawMode property

DrawPenColor property

DrawPenStyle property

DrawPenWidth property

DrawRectangle method

Drawing three-dimensional shapes:

DrawShape method

ShapeHeight property

ShapeLeft property

ShapeTop property

ShapeWidth property

ShapeBackgroundStyle property

BackgroundImageHeight property

BackgroundImageLeft property

BackgroundImageTop property

BackgroundImageWidth property

ShapeBorderColor property

ShapeBorderStyle property

ShapeBorderThickness property

ShapeInnerBandHiliteColor property

ShapeInnerBandShadowColor property

ShapeInnerBandStyle property

ShapeInnerBandThickness property

ShapeOuterBandHiliteColor property

ShapeOuterBandShadowColor property

ShapeOuterBandStyle property

ShapeOuterBandThickness property

ShadowColor property

ShadowXDepth property

ShadowYDepth property

Drawing three-dimensional text objects:

DrawText method

DrawTextOut method (limited support for related properties)

TextAlign property

TextHeight property

TextLeft property

TextTop property

TextWidth property

DrawFontColor property

Font property

TextAngle property

TextHiliteColor property

TextStyle property

TextWordWrap property

ShadowColor property

ShadowXDepth property

ShadowYDepth property

DrawTextHeight method

DrawTextWidth method

Specifying gradient colors or patterns:

GradientEndColor property

GradientStartColor property

GradientSteps property

GradientStyle property

 PatternBackColor property

PatternForeColor property

PatternStyle property


Raster Images:
Input and Output

Capturing a Screen Image

Exchanging Images with Other Objects

Getting and Setting File Information

Loading and Saving Large TIFF Files

Loading and Saving Stamp Images

Loading Files

Saving Files

Scanning Images using ISIS

Scanning Images using Twain

Using the Thumbnail Browser


Raster Images: Loading Files
Raster Images:
Input and Output
Loading Files

Getting information before loading:

GetArrayInfo method

GetFileInfo method

GetMemoryInfo method

InfoBits property

InfoCompress property

InfoFormat property

InfoHasAlpha property

InfoHeight property

InfoIFD property

InfoLayers property

InfoPage property

InfoPCDRes property

InfoSizeDisk property

InfoSizeMem property

InfoXRes property

InfoYRes property

InfoViewPerspective property

InfoWidth property

LoadResolutionCount property

LoadResolutionHeight property

LoadResolutionWidth property

ReadLoadResolutions method

Optional settings before loading:

PaintWhileLoad property

ProgressivePasses property

GetLoadResolution method

PCDRes property

SetLoadResolution method

WMFResolution property

LoadCompressed property

LoadIFD property

LoadInfo event

LoadInfoBits property

LoadInfoFlags property

LoadInfoFormat property

LoadInfoHeight property

LoadInfoOffset property

LoadInfoWidth property

LoadInfoXRes property

LoadInfoYRes property

LoadSigned property

LoadUseViewPerspective property

RasterizeViewMode property

RasterizeViewportHeight property

RasterizeViewportWidth property

PDFDisplayDepth property

PDFGraphicsAlpha property

PDFTextAlpha property

PDFUseLibFonts property

PDFXResolution property

PDFYResolution property

Alternatives to load from a file on a disk:

Load method

LoadLayer method

LoadResize method

LoadStamp method

OLEDropAllowed property

OLEDropAutoLoad property

OLEDropFile event

Loading from the Internet or from a file on a disk:

BitmapDataPath property

BitmapDataPathClosed event (Main Control)

ReadyState property

ReadyStateChange event

Loading from a file in memory:

LoadArray method

LoadBuffer method

LoadMemory method

Loading multi-page files

EnableFilePageLoadedEvent property

FilePageLoaded event

Loading Embedded ICC Profiles

LoadICCProfile method

Where you supply the image data to load:

FeedLoad method

StartFeedLoad method

StopFeedLoad method

Events during a load:

Change event

FilePage event


Raster Images: Saving Files
Raster Images:
Input and Output
Saving Files

Optional settings before saving:

AnimationBackColor property

AnimationBitsPerPixel property

AnimationHeight property

AnimationPalette property

AnimationWidth property

Comment property

LayerLeft property

LayerTop property

PDFSaveLowMemory property

PDFSaveUseDPI property

ProgressivePasses property

SaveInterlaced property

SaveLayers property

SaveLSB property

SavePad4 property

SavePage property

SaveResolutionCount property

SaveResolutionHeight property

SaveResolutionWidth property

Alternatives to save a file on disk:

Save method

SaveOffset method

SaveWithStamp method

Saving a file in memory:

EnableSaveBufferEvent property

SaveArray method

SaveBuffer event

SaveBuffer method

SaveBufferAddress property

SaveBufferSize property

SaveMemory method

Information available after saving:

FileSizeWritten property

Optional settings for saving JPEG 2000 files:

J2KCBS_ErrorResilienceSymbol property

J2KCBS_PredictableTermination property

J2KCBS_ResetContextOnBoundaries property

J2KCBS_SelectiveACBypass property

J2KCBS_TerminationOnEachPass property

J2KCBS_VerticallyCausalContext property

J2KCodBlockHeight property

J2KCodBlockWidth property

J2KCompressionControl property

J2KCompressionRatio property

J2KDecompLevel property

J2KDerivedBaseExponent property

J2KDerivedBaseMantissa property

J2KDerivedQuantization property

J2KGuardBits property

J2KProgressOrder property

J2KROIControl property

J2KROIHeight property

J2KROILeft property

J2KROITop property

J2KROIWidth property

J2KSetDefaults method

J2KTargetFileSize property

J2KUseColorTransform property

J2KUseEPHMarker property

J2KUseROI property

J2KUseSOPMarker property

J2KXOsiz property

J2KXTOsiz property

J2KXTsiz property

J2KYOsiz property

J2KYTOsiz property

J2KYTsiz property

Optional settings for saving TIF files:

SaveTileHeight property

SaveTileWidth property


Raster Images: Getting and Setting File Information
Raster Images:
Input and Output
Getting and Setting File Information

Getting information:

GetArrayInfo method

GetFileInfo method

GetMemoryInfo method

InfoBits property

InfoCompress property

InfoFormat property

InfoHasAlpha property

InfoHeight property

InfoIFD property

InfoLayers property

InfoPage property

InfoPCDRes property

InfoSizeDisk property

InfoSizeMem property

InfoTotalPages property

InfoViewPerspective property

InfoWidth property

InfoXRes property

InfoYRes property

IsSigned property

ReadComment method

ReadTag method

GetTagCount method

GetTagData method

GetTagType method

LoadResolutionCount property

LoadResolutionHeight property

LoadResolutionWidth property

ReadLoadResolutions method

Setting information:

AnimationBackColor property

AnimationBitsPerPixel property

AnimationHeight property

AnimationPalette property

AnimationWidth property

Comment property

ProgressivePasses property

SavePage property

SaveResolutionCount property

SaveResolutionHeight property

SaveResolutionWidth property

SetTag method

WriteComment method

WriteTag method


Raster Images: Loading and Saving Stamp Images
Raster Images:
Input and Output
Loading and Saving Stamp Images

LoadStamp method

SaveWithStamp method


Raster Images: Scanning Images using Twain
Raster Images:
Input and Output
Scanning Images using Twain

Beginning in LEADTOOLS Version 14, TWAIN support has been removed from the LEADTOOLS Main ActiveX control.  For TWAIN support, use the LEAD RasterTwain COM Object.


Raster Images: Scanning Images using ISIS
Raster Images:
Input and Output
Scanning Images using ISIS

Before scanning:

Bitmap property

DriverName property

EnableISISEvent property

EnableMethodErrors property

ISISGetTag method

IsISISAvailable property

ISISLoadDriver method

ISISSelect method

ISISSetScanOptions method

ISISSetTag method

ISISGetASCIITag method

ISISGetASCIITagChoice method

ISISGetASCIITagChoiceCount method

ISISGetTagChoice method

ISISGetTagChoiceCount method

ISISSetASCIITag method

Scanning:

Bitmap property

ISISAcquire method

ISISAcquireMulti method

ISISPage event

After Scanning:

Bitmap property

ISISUnloadDriver method

PagesDiscarded property


Raster Images: Capturing a Screen Image
Raster Images:
Input and Output
Capturing a Screen Image

Capture method

EnableZoomInRect property

ZoomIn method

ZoomInDone event


Raster Images: Exchanging Images with Other Objects
Raster Images:
Input and Output
Exchanging Images with Other Objects

Picture object:

GetPicture method

SetPicture method

LEAD OLE Server:

GetServerBitmap method

SetServerBitmap method

DIB:

GetDIB method

SetDIB method

DDB:

GetDDB method

SetDDB method

Windows Clipboard:

Copy method

Paste method


Raster Images: Using the Thumbnail Browser
Raster Images:
Input and Output
Using the Thumbnail Browser

BrowseDir method

ContinueBrowse property

CreateThumbnailFromFile method

DitherFlags property

EnableMethodErrors property

ExpandMultipage property

Filter property

ForceSize property

IncludeSubDirectories property

InfoBits property

InfoCompression property

InfoFormat property

InfoIFD property

InfoHeight property

InfoPage property

InfoSizeDisk property

InfoSizeMem property

InfoTotalPages property

InfoWidth property

InfoXRes property

InfoYRes property

IsSupportLocked method

LoadStamp property

MaintainAspect property

MaxSizeDisk property

MaxSizeMem property

PaletteFlags property

Resample property

SkipFile property

StopOnError property

ThumbnailBackgroundColor property

ThumbnailBitsPerPixel property

ThumbnailEvent event

ThumbnailHeight property

ThumbnailWidth property

UnlockSupport method


Raster Images:
Creation, Deletion, and Copying

Copying Images

Creating and Deleting Images

Creating and Maintaining Lists of Images

Using the Clipboard


Raster Images: Creating and Deleting Images
Raster Images:
Creation, Deletion, and Copying
Creating and Deleting Images

Creating an image:

CreateBitmap method

CreateUserBitmap method

Fill method

GetBitmapDC method

ReleaseBitmapDC method

SetBitmapDataPointer method

Deleting images:

Bitmap property

DeleteBitmapListItems method

DeletePage method


Raster Images: Creating and Maintaining Lists of Images
Raster Images:
Creation, Deletion, and Copying
Creating and Maintaining Lists of Images

Creating, saving, and deleting lists:

BitmapList property

Load method

Save method

Maintaining list items:

DeleteBitmapListItems method

InsertBitmapListItem method

Accessing bitmaps in a list:

BitmapListCount property

BitmapListIndex property

Bitmap property

Assigning bitmap lists from one control to another:

RefBitmapList


Raster Images: Using the Clipboard
Raster Images:
Creation, Deletion, and Copying
Using the Clipboard

Copy method

Paste method


Raster Images: Copying Images
Raster Images:
Creation, Deletion, and Copying
Copying Images

Copying whole bitmaps:

Bitmap property

BitmapList property

Copying part of one bitmap to another bitmap:

Combine method

CombineBitmapWarp method

CombineExt method

Creating and using a floater (Document/Medical only):

Floater property

FloaterVisible property

IsPtInFloater method

SetFloaterDstClipRect method

SetFloaterDstRect method

FloaterDstClipHeight property

FloaterDstClipLeft property

FloaterDstClipTop property

FloaterDstClipWidth property

FloaterDstHeight property

FloaterDstLeft property

FloaterDstTop property

FloaterDstWidth property

FloaterHeight property

FloaterWidth property

OLE Drag and Drop

EnableOLEDragMethod property (ImageList Control)

EnableOLEDragMethod property (Main Control)

EnableUseDefaultCursor property (ImageList Control)

OLECompleteDrag event (ImageList Control)

OLECompleteDrag event (Main Control)

OLEDragCursor property (ImageList Control)

OLEDragCursor property (Main Control)

OLEDragOver event (ImageList Control)

OLEDragOver event (Main Control)

OLEGiveFeedback event (ImageList Control)

OLEGiveFeedback event (Main Control)

OLEStartDrag event (ImageList Control)

OLEStartDrag event (Main Control)


Raster Images:
Palettes

Manipulating palettes:

BitmapPalette property

GetPalette method

UserPalette property

Implementing palettes:

ColorRes method

ColorResList method

PaintPalette property

Implementing window leveling:

Note: This topic is for Document/Medical  only.

LEADTOOLS provides window leveling properties, methods and events for working with 12 and 16-bit grayscale images.  The properties, methods and events allow you to specify which bits should be used for display, remap intensity levels to user defined palette colors, and change the bitmap to match the displayed image.

GetMinMaxBits method

GetMinMaxVal method

LevelLowBit property

LevelHighBit property

LevelLUT property

LevelLUTLength property

MaxBit property

MaxVal property

MinBit property

MinVal property

WindowLevel method

WindowLevelBitmap property


Raster Images:
Displaying and Printing

Cleaning - up 1-Bit Images

Displaying Images

Implementing Special Effects

Playing Animated Images

Printing Images


Raster Images: Cleaning - up 1-Bit Images
Raster Images:
Displaying and Printing
Cleaning - up 1-Bit Images

(Document/Medical only)

BorderRemove event

BorderRemove method

DocCleanBitmap property

DocCleanSuccess property

hDocCleanRgn property

DotRemoveEvent event

DotRemove method

HolePunchRemoveEvent event

HolePunchRemove method

InvertedTextEvent event

InvertedText method

LineRemoveEvent event

LineRemove method

SmoothEvent event

SmoothEvent method


Raster Images: Displaying Images
Raster Images:
Displaying and Printing
Displaying Images

Setting the control's appearance:

Appearance property

BackColor property

BorderStyle property

FrameThickness property

FrameColor property

FrameInnerHiliteColor property

FrameInnerShadowColor property

FrameInnerStyle property

FrameInnerThickness property

FrameOuterHiliteColor property

FrameOuterShadowColor property

FrameOuterStyle property

FrameOuterThickness property

Automated display options:

AutoRepaint property

AutoScroll property

AutoSetRects property

AutoSize property

CenterImage property

EnableKeyboard property

EnableScroll property

PaintSizeMode property

PaintSizeUseDPI property

PaintZoomFactor property

ZoomToRect method

Painting options:

BackErase property

BitonalScaling property (Document/Medical only)

DoubleBuffer property

EnablePaint property

ForePalette property

PaintContrast property

PaintDither property

PaintEffect property

PaintGamma property

PaintIntensity property

PaintPalette property

PaintRgnOnly property

PaintROP3 property

PaintScaling property

Forced painting:

ForceRepaint method

RepaintRect method

Getting client-area measurements:

ScaleHeight property

ScaleLeft property

ScaleMode property

ScaleTop property

ScaleWidth property

Converting between client and bitmap coordinates

BitmapToClient method

ClientToBitmap method

ConvertX property

ConvertY property

Setting source and destination rectangles:

SetDstClipRect method

SetDstRect method

SetSrcClipRect method

SetSrcRect method

Source and destination rectangle properties:

SrcHeight property

SrcLeft property

SrcTop property

SrcWidth property

SrcClipHeight property

SrcClipLeft property

SrcClipTop property

SrcClipWidth property

DstHeight property

DstLeft property

DstTop property

DstWidth property

DstClipHeight property

DstClipLeft property

DstClipTop property

DstClipWidth property

Scrolling an Image

AutoScroll property

HScrollInfo property

Scroll event

VScrollInfo property

Using a PanWindow:

PanWin event

PanWinBitonalScaling property

PanWinCursor property

PanWinHeight property

PanWinIcon property

PanWinPaintDither property

PanWinPaintPalette property

PanWinPaintScaling property

PanWinPointer property

PanWinRectColor property

PanWinSysMenu property

PanWinTitle property

PanWinWidth property

PanWinX property

PanWinY property

ShowPanWin method

Using the Magnifying Glass

EnableMagGlassEvent property

HasMagGlass property

MagGlass event

MagGlassFlags property

MagGlassMask property

MagGlassMaskCount property

StartMagGlass method

StopMagGlass method

UpdateMagGlass method

UpdateMagGlassShape method

Using the ImageList Control

AllowSelection property (ImageList Control)

Appearance property (ImageList Control)

BackColor property (ImageList Control)

BitonalScaling property (ImageList Control)

BorderColor property (ImageList Control)

BorderStyle property (ImageList Control)

Clear method (ImageList Control)

Click event (ImageList Control)

ColumnCount property (ImageList Control)

ControlWindow property (ImageList Control)

Count property (ImageList Control)

CurrentPage property (ImageList Control)

DblClick event (ImageList Control)

DisplayItemText property (ImageList Control)

EnableKeyboard property (ImageList Control)

EnableMethodErrors property (ImageList Control)

EnsureVisible method (ImageList Control)

FirstVisibleItem property(ImageList Control)

Font property (ImageList Control)

ForeColor property (ImageList Control)

HitTest method (ImageList Control)

Insert method (ImageList Control)

InsertAt method (ImageList Control)

InsertFromBitmapList method (ImageList Control)

IsSupportLocked method (ImageList Control)

Item property (ImageList Control)

ItemBackgroundColor property (ImageList Control)

ItemHeight property (ImageList Control)

ItemHorizontalSpacing property (ImageList Control)

ItemSelected event (ImageList Control)

ItemUnSelected event (ImageList Control)

ItemVerticalSpacing property (ImageList Control)

ItemWidth property (ImageList Control)

KeyDown event (ImageList Control)

KeyPress event (ImageList Control)

KeyUp event (ImageList Control)

LoadDatabase method (ImageList Control)

LoadFromFile method (ImageList Control)

MouseDown event (ImageList Control)

MouseIcon property (ImageList Control)

MouseMove event (ImageList Control)

MousePointer property (ImageList Control)

MouseUp event (ImageList Control)

OwnerDrawItem event (ImageList Control)

OwnerDrawItems property (ImageList Control)

PageCount property (ImageList Control)

PaintDither property (ImageList Control)

PaintScaling property (ImageList Control)

Remove method (ImageList Control)

Resize event (ImageList Control)

RowCount property (ImageList Control)

SaveDatabase method (ImageList Control)

SaveToFile method (ImageList Control)

ScaleHeight property (ImageList Control)

ScaleLeft property (ImageList Control)

ScaleMode property (ImageList Control)

ScaleTop property (ImageList Control)

ScaleWidth property (ImageList Control)

Scroll event (ImageList Control)

ScrollItems method (ImageList Control)

ScrollStyle property (ImageList Control)

SelectAll method (ImageList Control)

SelectedCount property (ImageList Control)

SelectedItems property (ImageList Control)

SelectionColor property (ImageList Control)

SelectionStyle property (ImageList Control)

SetSelectionBitmap method (ImageList Control)

Sort method (ImageList Control)

UnlockSupport method (ImageList Control)

ViewSize property (ImageList Control)

Window property (ImageList Control)


Raster Images: Implementing Special Effects
Raster Images:
Displaying and Printing
Implementing Special Effects

Specifying effects and transitions:

PaintEffect property

TransitionEffect property

TransitionStyle property

Controlling speed and granularity:

EffectDelay property

EffectGrain property

Controlling multiple passes:

PaintMaxPasses property

PaintNotification event

PaintNotificationDelay property

PaintPass property

Using a transparent color:

BitmapEnableTransparency property

BitmapTransparentColor property

Transparent property

Using a wand:

WandColor property

WandSize property

Specifying transition colors or patterns:

GradientEndColor property

GradientStartColor property

GradientSteps property

GradientStyle property

PatternBackColor property

PatternForeColor property

PatternStyle property


Raster Images: Playing Animated Images
Raster Images:
Displaying and Printing
Playing Animated Images

Starting and stopping a playback:

Animate event

AnimationEnable property

AnimationLoop property

AutoAnimate property

AutoAnimationLoop property

Information in an animated file:

GetFileInfo method

InfoAnimation property

InfoAnimationHeight property

InfoAnimationWidth property

Bitmap behavior during playback:

BitmapDelay property

BitmapDisposalMethod property

BitmapEnableTransparency property

BitmapTransparentColor property

Bitmap positioning during playback:

BitmapLeft property

BitmapTop property

Playback target properties:

AnimationBackColor property

AnimationBitsPerPixel property

AnimationFrameIndex property

AnimationHeight property

AnimationPalette property

AnimationPause property

AnimationWidth property


Raster Images: Printing Images
Raster Images:
Displaying and Printing
Printing Images

EnableFastRender property

PrintEnd method

PrinterScaleHeight property

PrinterScaleWidth property

PrintNewPage method

PrintStart method

Render methodRenderMethod

RenderCenter property


Raster Images:
Image Processing

Combining Images

Doing Color Expansion or Reduction

Doing Color Space Conversions

Doing Geometric Transformations

Drawing on a Bitmap

Filtering Images

Getting Current Information

Modifying Individual Pixels

Modifying Intensity Values

Using Histograms

Using the Alpha Channel


Raster Images: Getting Current Information
Raster Images:
Image Processing
Getting Current Information

BitmapBits property

BitmapCompression property

BitmapHeight property

BitmapSize property

BitmapWidth property

BitmapXRes property

BitmapYRes property

GetColorCount method

LineProfile method

LineProfileBlue property

LineProfileGreen property

LineProfileRed property

LineProfileSize property

Pixel property

PixelData property


Raster Images: Doing Color Space Conversions
Raster Images:
Image Processing
Doing Color Space Conversions

ColorMerge method

ColorPlanes property

ColorSeparate method

HSV_HfromRGB method

HSV_SfromRGB method

HSV_VfromRGB method

RGBfromHSV method


Raster Images: Doing Color Expansion or Reduction
Raster Images:
Image Processing
Doing Color Expansion or Reduction

Automated color reduction:

PaintDither property

General color expansion or reduction:

ColorRes method

ColorResList method

ConvertSignedToUnsigned method

Support for dithering to a custom palette:

UserPalette property

Specialized color expansion or reduction:

ConvertToColoredGray method

Grayscale method

GrayscaleExt method

Halftone method

IsGrayscale property


Raster Images: Doing Geometric Transformations
Raster Images:
Image Processing
Doing Geometric Transformations

Resizing a bitmap:

Resize event

Size method

Other transformations:

AutoTrim method

Deskew method (Document/Medical only)

FastRotate method (Document/Medical only)

Flip method

Reverse method

Rotate method

Shear method

Trim method


Raster Images: Modifying Individual Pixels
Raster Images:
Image Processing
Modifying Individual Pixels

Pixel property


Raster Images: Modifying Intensity Values
Raster Images:
Image Processing
Modifying Intensity Values

Overall brightness and contrast:

Contrast method

GammaCorrect method

HistoContrast method

HistoEqualize method

Intensity method

StretchIntensity method

Color changes:

Hue method

Invert method

Saturation method

Bitmaps changes:

AddBitmaps method

Filtering intensity values:

BalanceColors method

IntensityDetect method

RemoveRedeye method

SwapColors method

Low-level manipulation:

HTable property

HTableL property

MaskTable property

MaskTableL property

RemapHue method

RemapIntensity method

RemapTable property

STable property

STableL property

VTable property

VTableL property


Raster Images: Filtering Images
Raster Images:
Image Processing
Filtering Images

General Filters

BinaryFilter method (Document/Medical only)

SpatialFilter method

Specialized Filters

AddNoise method

AntiAlias method

Average method

ContourFilter method

Despeckle method

EdgeDetector method

Emboss method

GaussianFilter method

IntensityDetect method

MaxFilter method (Document/Medical only)

Median method

MinFilter method (Document/Medical only)

Mosaic method

MotionBlur method

Oilify method

Posterize method

Sharpen method

Solarize method

UnsharpMask method


Raster Images: Using Histograms
Raster Images:
Image Processing
Using Histograms

GetHistogram method

GetHistogramGray method

HistoContrast method

HistoEqualize method

HistogramGrayTable property

HistogramGrayTableSize property

HistogramTable property


Raster Images: Using the Alpha Channel
Raster Images:
Image Processing
Using the Alpha Channel

Getting and setting alpha channel data:

BitmapAlpha property

Using the alpha channel for transparency:

GetRgnHandle method

PaintRgnOnly property

SetRgnColor method

SetRgnHandle method


Raster Images: Combining Images
Raster Images:
Image Processing
Combining Images

AlphaBlend method

Combine method

CombineBitmapWarp method

CombineExt method

CreateFadedMask method

FeatherAlphaBlend method

Picturize method

PicturizeBitmapList method

PicturizeSingle method

Underlay method


Raster Images: Drawing on a Bitmap
Raster Images:
Image Processing
Drawing on a Bitmap

Using Windows GDI functions:

GetBitmapDC method

ReleaseBitmapDC method

Specifying the bitmap as the drawing surface:

DrawPersistence property

Drawing simple objects:

DrawEllipse method

DrawFillColor property

DrawFillStyle property

DrawLine method

DrawMode property

DrawPenColor property

DrawPenStyle property

DrawPenWidth property

DrawRectangle method

Drawing three-dimensional shapes:

DrawShape method

ShapeHeight property

ShapeLeft property

ShapeTop property

ShapeWidth property

BackgroundImageHeight property

BackgroundImageLeft property

BackgroundImageTop property

BackgroundImageWidth property

ShapeBackgroundStyle property

ShapeBorderColor property

ShapeBorderStyle property

ShapeBorderThickness property

ShapeInnerBandHiliteColor property

ShapeInnerBandShadowColor property

ShapeInnerBandStyle property

ShapeInnerBandThickness property

ShapeOuterBandHiliteColor property

ShapeOuterBandShadowColor property

ShapeOuterBandStyle property

ShapeOuterBandThickness property

ShadowColor property

ShadowXDepth property

ShadowYDepth property

Drawing three-dimensional text objects:

DrawText method

TextAlign property

TextHeight property

TextLeft property

TextTop property

TextWidth property

DrawFontColor property

Font property

TextAngle property

TextHiliteColor property

TextStyle property

TextWordWrap property

ShadowColor property

ShadowXDepth property

ShadowYDepth property

DrawTextHeight method

DrawTextWidth method

Specifying gradient colors or patterns:

GradientEndColor property

GradientStartColor property

GradientSteps property

GradientStyle property

PatternBackColor property

PatternForeColor property

PatternStyle property


Raster Images:
Loading and Saving Large TIFF Files

InfoIFD property (Main Control)

LoadIFD property (Main Control)

Save IFD property (Main Control)


Raster Images:
Region Processing

Creating and Using a Region

Methods That Transform the Region and the Bitmap

Where the Region Preempts the Bitmap


Raster Images: Creating and Using a Region
Raster Images:
Region Processing
Creating and Using a Region

Automatic creation of a region:

RgnChange event

RgnFrameType property

RgnMarkingMode property

Creating and using a floater:

Floater property

FloaterVisible property

IsPtInFloater method

SetFloaterDstClipRect method

SetFloaterDstRect method

FloaterDstHeight property

FloaterDstLeft property

FloaterDstTop property

FloaterDstWidth property

FloaterDstClipHeight property

FloaterDstClipLeft property

FloaterDstClipTop property

FloaterDstClipWidth property

FloaterHeight property

FloaterWidth property

Storing, retrieving, and deleting regions:

DeleteRgnHandle method

GetFloaterHandle method

GetRgnHandle method

FreeRgn method

SetRgnHandle method

Getting region information:

GetBitmapClipSegments method

GetRgnArea method

HasRgn property

IsPtInRgn method

RgnHeight property

RgnLeft property

RgnTop property

RgnWidth property

Low-level methods for creating regions:

BezierSize property

BezierX property

BezierY property

CurveClose property

CurveSize property

CurveTension property

CurveToBezier method

CurveType property

CurveX property

CurveY property

SetRgnCurve method

SetRgnColor method

SetRgnColorHSVRange method

SetRgnColorRGBRange method

SetRgnEllipse method

SetRgnMagicWand method

SetRgnRect method

SetRgnRoundRect method

PolygonSize property

PolygonX property

PolygonY property

SetRgnPolygon method

Resizing a region:

ResizeRgn method

Moving a region:

OffsetRgn method

Displaying a region:

PaintRgnOnly property

RepaintRect method

Coloring a region:

RgnFrameColor property

SetRgnColorHSVRange method

SetRgnColorRGBRange method


Raster Images: Where the Region Preempts the Bitmap
Raster Images:
Region Processing
Where the Region Preempts the Bitmap

AddNoise method

Average method

BinaryFilter method

Combine method

CombineBitmapWarp method

CombineExt method

Contrast method

Despeckle method

Emboss method

Fill method

GammaCorrect method

GetHistogram method

GetHistogramGray method

HistoContrast method

HistoEqualize method

Hue method

Intensity method

IntensityDetect method

Invert method

Median method

Mosaic method

Posterize method

RemapIntensity method

Saturation method

Sharpen method

SpatialFilter method

StretchIntensity method


Raster Images: Methods That Transform the Region and the Bitmap
Raster Images:
Region Processing
Methods That Transform the Region and the Bitmap

ContourFilter method (Medical Imaging only)

FastRotate method

Flip method

Reverse method

Rotate method

Shear method

Size method

Trim method


Annotations (Document/Medical only): Input and Output
Annotations (Document/Medical only):ExpressEd
Input and Output

Files on disk:

AnnLoad method

AnnSave method

AnnSaveOffset method

Files across the Internet:

AnnDataPath property

ReadyState property

ReadyStateChange event

Files in memory:

AnnLoadArray method

AnnLoadMemory method

AnnSaveArray method

AnnSaveMemory method

Deleting Pages from an Annotation File:

AnnDeletePage method

AnnDeletePageArray method

AnnDeletePageMemory method

Getting Annotation File Information:

AnnFileInfo method

AnnFileInfoArray method

AnnFileInfoMemory method

AnnInfoFormat property

AnnInfoTotalPages property

AnnInfoVersion property


Annotations (Document/Medical only): Automation
Annotations (Document/Medical only):ExpressEd
Automation

Controlling automation:

AnnAutoDrawEnable property

AnnAutoMenuEnable property

AnnGetAutoBackColor method

AnnGetAutoMenuItemEnable method

AnnSetAutoBackColor method

AnnSetAutoMenuItemEnable method

AnnUserMode property

Selecting object types:

AnnGetType method

AnnTool property

Modifying automated text strings:

AnnAutoDialogFontSize property

AnnGetAutoText method

AnnSetAutoText method

Undoing automation operations/changes

AnnAddUndoNode method

AnnUndo method

AnnUndoDepth property

AnnUndoEnable property

DLL support:

AnnAutomation property

AnnBringToFront method

AnnContainer property

AnnGetContainer method

AnnGetOffsetX method

AnnGetOffsetY method

AnnGetPointCount method

AnnGetPointX method

AnnGetPointY method

AnnGetScalarX method

AnnGetScalarY method

AnnGetSelectCount method

AnnGetSelectList method

AnnGetTopContainer method

AnnGetWnd method

AnnHitTest method

AnnSelect event

AnnSelectPoint method

AnnSelectRect method

AnnSelectRectHeight property

AnnSelectRectLeft property

AnnSelectRectTop property

AnnSelectRectWidth property

AnnSendToBack method

AnnSetOffsetX method

AnnSetOffsetY method

AnnSetScalarX method

AnnSetScalarY method

AnnSetWnd method

Manipulating the toolbar

AnnToolChecked event

AnnToolDestroy event

AutoSetTool property

ButtonBitmapDown property

ButtonBitmapUp property

ButtonColumns property

ButtonCount property

ButtonMenuText property

ButtonMenuTextID property

ButtonMenuTool property

ButtonRows property

ButtonTool property

ButtonToolCount property

ButtonToolTipText property

ButtonToolTipTextID property

ButtonVisible property

Create method

hWnd property

Tool property

Visible property

Modifying the annotation automation menu

AddItem method

AnnMenu event

AnnUserMenu event

Count property

DeleteItem method

GetSubMenu method

ItemChecked property

ItemEnabled property

ItemID property

ItemString property

ItemType property


Annotations (Document/Medical only): Annotation Events
Annotations (Document/Medical only):ExpressEd
Annotation Events

AnnChange event

AnnClicked event

AnnCreate event

AnnDestroy event

AnnDrawn event

AnnEnumerate event

AnnHyperlink event

AnnHyperlinkMenu event

AnnLocked event

AnnMouseDown event

AnnMouseMove event

AnnMouseUp event

AnnSelect event

AnnUnlocked event


Annotations (Document/Medical only): Annotation Security
Annotations (Document/Medical only):ExpressEd
Annotation Security

AnnGetLocked method

AnnLock method

AnnLocked event

AnnSetUser method

AnnShowLockedIcon property

AnnUnlock method

AnnUnlocked event


Annotations (Document/Medical only): Annotation Hyperlink
Annotations (Document/Medical only):ExpressEd
Annotation Hyperlink

AnnGetHyperlinkString method

AnnSetHyperlinkString method

AnnGetHyperlinkParam method

AnnGetHyperlinkType method

AnnHyperlink event

AnnHyperlinkMenu event

AnnHyperlinkMenuEnable property

AnnSetHyperlinkMsg method


Annotations (Document/Medical only): Using the Clipboard
Annotations (Document/Medical only):ExpressEd
Using the Clipboard

AnnCopy method

AnnCut method

AnnPaste method

AnnPasteReady property


Annotations (Document/Medical only): Object Manipulation
Annotations (Document/Medical only):ExpressEd
Object Manipulation

Transforming annotations:

AnnAutoResize property

AnnAutoRotate property

AnnBoundingRectHeight property

AnnBoundingRectLeft property

AnnBoundingRectTop property

AnnBoundingRectWidth property

AnnFlip method

AnnMove method

AnnRectHeight property

AnnRectLeft property

AnnRectTop property

AnnRectWidth property

AnnReverse method

AnnRotate method

Identifying annotations:

AnnGetObjectFromTag method

AnnGetTag method

AnnSetTag method

Realizing annotations to a bitmap:

AnnRealize method

AnnUnrealize method

Creating an object

AnnCreate method

AnnCreateItem method

Object characteristics

AnnGetBackColor method

AnnGetFillMode method

AnnGetFillPattern method

AnnGetLineStyle method

AnnGetLineWidth method

AnnGetMetafile method

AnnGetName method

AnnGetNodes method

AnnGetPredefinedMetafile method

AnnGetSelected method

AnnGetText method

AnnGetUnit method

AnnGetVisible method

AnnInsert method

AnnSetAutoDefaults method

AnnSetBackColor method

AnnSetFillMode method

AnnSetFillPattern method

AnnSetLineStyle method

AnnSetLineWidth method

AnnSetMetafile method

AnnSetName method

AnnSetNodes method

AnnSetPredefinedMetafile method

AnnSetSelected method

AnnSetText method

AnnSetVisible method

Grouping and ungrouping objects

AnnGetGrouping method

AnnGroup method

AnnSetGrouping method

AnnUngroup method

Destroying an object

AnnDestroy method

AnnRemove method

Polygon

AnnGetPolyFillMode method

AnnSetPolyFillMode method

Protractor

AnnGetAngle method

AnnGetProtractorOptions method

AnnGetShowFlags method

AnnSetProtractorOptions method

AnnSetShowFlags method

Working with Ruler object

AnnGetDistance method

AnnGetBitmapDpiX method

AnnGetBitmapDpiY method

AnnGetGaugeLength method

AnnSetGaugeLength method

Creating a Region

AnnGetArea method

AnnGetRgnHandle method

Using ROP2

AnnGetROP2 method

AnnSetROP2 method

Font and Color for an Object

AnnGetFontBold method

AnnGetFontItalic method

AnnGetFontName method

AnnGetFontSize method

AnnGetFontStrikeThrough method

AnnGetFontUnderline method

AnnGetForeColor method

AnnSetFontBold method

AnnSetFontItalic method

AnnSetFontName method

AnnSetFontSize method

AnnSetFontStrikeThrough method

AnnSetFontUnderline method

AnnSetForeColor method

Moving the Name of an Annotation

AnnGetNameOffsetX method

AnnGetNameOffsetY method

AnnGetNameRestrict method

AnnNameBoundingRectHeight property

AnnNameBoundingRectLeft property

AnnNameBoundingRectTop property

AnnNameBoundingRectWidth property

AnnNameRectHeight property

AnnNameRectLeft property

AnnNameRectTop property

AnnNameRectWidth property

AnnSetNameOffsetX method

AnnSetNameOffsetY method

AnnSetNameRestrict method


Annotations (Document/Medical only): Bitmap
Annotations (Document/Medical only):ExpressEd
Bitmap

AnnGetBitmap method

AnnGetTransparentColor method

AnnSetBitmap method

AnnSetBitmapDpiX method

AnnSetBitmapDpiY method

AnnSetTransparentColor method

Bitmap Stamp

AnnGetTransparent method

AnnSetTransparent method

Secondary Bitmap

AnnGetSecondaryBitmap method

AnnSetSecondaryBitmap method


Databases:
Visual Basic Data Binding

Accessing data:

DataField property

DataSource property

Specifying how images are loaded:

DataLoadBits property

Specifying how images are saved:

DataSaveBits property

DataSaveFormat property

DataSaveQuality property

Detecting changes:

DataChanged property


Databases:
Using ODBC

Accessing data:

dbClose method

dbLoadBits property

dbOpen method

dbRequery method

Updating data:

dbAddNew method

dbDelete method

dbEdit method

dbLockingMode property

dbUpdate method

Navigation:

dbMove method

dbMoveFirst method

dbMoveLast method

dbMoveNext method

dbMovePrev method

Getting status information:

dbCanAppend property

dbCanRestart property

dbCanScroll property

dbCanUpdate property

dbCurrentRecord property

dbEditMode property

dbIsBOF property

dbIsDeleted property

dbIsEOF property

dbIsOpen property

dbRecordCount property


Databases: OLE Data Binding
Databases:
OLE DB

Specifying the data control and field to which the OLE DB is bound:

DataField property (OLE DB Control)

DataMember property (OLE DB Control)

DataSource property (OLE DB Control)

Specifying how images are stored:

DataSaveBits property (OLE DB Control)

DataSaveFormat property (OLE DB Control)

DataSaveQuality property (OLE DB Control)

Specifying the bits per pixel of the bitmap in memory:

DataLoadBits property (OLE DB Control)

Updating the database field:

DataDirty property (OLE DB Control)

Copying data between the Main Control and the OLE DB Control:

AnnContainer property (OLE DB Control)

Bitmap property (OLE DB Control)

Notification events:

DataLoaded event (OLE DB Control)

DataSaved event (OLE DB Control)

Generating system error events:

EnableMethodErrors property (OLE DB Control)

Support:

IsSupportLocked method (OLE DB Control)

UnlockSupport method (OLE DB Control)


Support:
Version and License Information

IsSupportLocked method

UnlockSupport method

AboutBox method

VersionDate property

VersionLevel property

VersionMajor property

VersionMinor property

VersionProduct property

VersionTime property


Tutorial for C++ Builder 3.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS ActiveX.

Note:	These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Loading and Displaying an Image

Zooming Out and Zooming In

Zooming In on a Selection

Using Transparent Controls

Using a Pan Window


Loading and Displaying an Image (C++ Builder 3.0)

Take the following steps to start a project and to add some code that positions, scales, and displays an image on the main form:

1.	Start C++ Builder 3.0.

2.	On the C++ Builder toolbar, click the ActiveX tab. If you have used a LEAD ActiveX control before, the icon appears on the toolbar. Otherwise, add the LEAD control as follows:

a.	On the Component menu, choose Import ActiveX Control.

b.	In the Import ActiveX dialog, highlight the LEAD Main Control (12). Change the Class name to TLEAD. Click Install.

c.	If you have previously added a LEAD control, you will get a Confirm dialog that tells you that the xxx_TLB.cpp file already exists, and asks if you want to replace it.  Click Yes.

d.	In the Install dialog, click OK.

e.	In the Confirm dialog, click Yes.

f.	The Compiling Package DCLUSR35 dialog will appear.  You may elect not to have this dialog appear again.  Click Yes.

g.	The Compiling dialog will appear.

f.	After compiling has completed, the Information dialog will appear. Click OK.

g.	At this point you will be presented with the DCLUSR35.cpp window, with USEUNIT and USERES lines for each LEAD control installed in the project. Save and close DLCUSR35.bpk. Do not save Unit1.cpp, Project1 or ProjectGroup1.

3.	In the File menu, choose New Application.

4.	Select the LEAD control on the ActiveX toolbar. Size and position the control as you want it to appear at run time, and change the name of the control to LEAD1.

5.	Add a command button to your form and name it as follows:

Name	Caption

LoadLead	Load Image

6.	Code the main form's FormShow procedure as follows. In online help, you can copy the block of code and paste it into your application.

void __fastcall TForm1::FormShow(TObject *Sender)
{
  /* Set defaults for displaying the image. */
  /*These are all persistent properties that can be set in the properties box. */
  LEAD1->Appearance = APPEARANCE_FLAT;
  LEAD1->BorderStyle = 1;
  LEAD1->BackColor = clYellow;
  LEAD1->PaintDither = PAINTDITHER_DIFFUSION;
  LEAD1->PaintPalette = PAINTPALETTE_AUTO;
  LEAD1->AutoRepaint = True;
  LEAD1->AutoSize = False;
  LEAD1->AutoSetRects = True;
  LEAD1->PaintSizeMode = PAINTSIZEMODE_FIT;
}

7.	Code the LoadLead button's click procedure as follows:

void __fastcall TForm1::LoadLeadClick(TObject *Sender)
{
LEAD1->Load(StringToOleStr("e:\\LTWIN12x\\images\\image1.cmp"), 0, 0, 1);

}

8.	Run your program to test it.

9.	Save the project to use as a starting point for other tasks in this tutorial.


Zooming Out and Zooming In (C++ Builder 3.0)

Take the following steps to add code that can reduce and enlarge the displayed size of the image. This demonstrates the scaling properties that are normally used for zooming in and zooming out. It emphasizes the relationship of the displayed rectangle to the LEAD control.

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

2.	Add two command buttons to your form and name them as follows:

Name	Caption

ZoomIn	Zoom In

ZoomOut	Zoom Out

3.	Code the ZoomIn button's click procedure as follows:

void __fastcall TForm1::ZoomInClick(TObject *Sender)
{
  LEAD1->AutoSetRects = True;
  LEAD1->PaintSizeMode = PAINTSIZEMODE_ZOOM;
  LEAD1->PaintZoomFactor = LEAD1->PaintZoomFactor + 10;
}

4.	Code the ZoomOut button's click procedure as follows:

void __fastcall TForm1::ZoomOutClick(TObject *Sender)
{
  LEAD1->AutoSetRects = True;
  LEAD1->PaintSizeMode = PAINTSIZEMODE_ZOOM;
  if (LEAD1->PaintZoomFactor > 10)
      LEAD1->PaintZoomFactor = LEAD1->PaintZoomFactor - 10;
}

5.	Run your program to test it.


Zooming In on a Selection (C++ Builder 3.0)

Take the following steps to add code that lets you select an area with a mouse, and zoom in on the selected area.

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

2.	Code the LEAD control's MouseDown procedure as follows.

void __fastcall TForm1::LEAD1MouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
LEAD1->AutoRubberBand = TRUE;
LEAD1->MousePointer = 2;
}

3.	Code the LEAD control's RubberBand procedure as follows.

void __fastcall TForm1::LEAD1RubberBand(TObject *Sender)
{
    float zoomleft, zoomtop, zoomwidth, zoomheight;

    LEAD1->MousePointer = 0;
    zoomleft = LEAD1->RubberBandLeft;
    zoomtop = LEAD1->RubberBandTop;
    zoomwidth = LEAD1->RubberBandWidth;
    zoomheight = LEAD1->RubberBandHeight;
    LEAD1->ZoomToRect(zoomleft, zoomtop, zoomwidth, zoomheight);
    LEAD1->ForceRepaint();
}

4.	Run your program to test it.


Using Transparent Controls (C++ Builder 3.0)

Take the following steps to add transparent controls, with special effects. The transparent controls are added as child controls so that they will scroll with the parent image.

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

2.	Add two LEAD controls, which you will set to be transparent at run time. (At design time, you can make the controls easier to see by setting the BackColor property of each control to a different color.) Add the controls as follows:

a.	Add a control named LEAD2 as a child control to LEAD1. In other words, draw it inside the LEAD1 control.

b.	Add a control named LEAD3 as a child control to LEAD2. In other words, draw it inside the LEAD2 control.

3.	Add a command button to your form and name it as follows:

Name	Caption

Trans	Transparent

4.	Code the Trans button's click procedure as follows:

void __fastcall TForm1::TransClick(TObject *Sender)
{
   LEAD1->EnableMethodErrors = False;
   LEAD1->AutoRepaint = False;
   LEAD2->AutoRepaint = False;
   LEAD3->AutoRepaint = False;
   //Make Lead2 and Lead3 Transparent
   LEAD2->Transparent = True;
   LEAD3->Transparent = True;
   //Give each control a different effect
   LEAD1->PaintEffect = EFX_EFFECT_WIPE_RECTANGLE_OUT;
   LEAD2->PaintEffect = EFX_EFFECT_WIPE_RECTANGLE_IN;
   LEAD3->PaintEffect = EFX_EFFECT_CHECKERBOARD_T_TO_B_THEN_T_TO_B;
   LEAD1->EffectDelay = 20;
   LEAD2->EffectDelay = 20;
   LEAD3->EffectDelay = 20;
   LEAD1->EffectGrain = 1;
   LEAD2->EffectGrain = 5;
   LEAD3->EffectGrain = 1;
   LEAD1->ScaleMode = 3;
   LEAD2->ScaleMode = 3;
   LEAD3->ScaleMode = 3;

   //Position Lead2 and Lead3 inside Lead1
   LEAD2->Width = LEAD1->Width / 2;
   LEAD2->Height = LEAD1->Height / 2;
   LEAD2->Left = (LEAD1->Width - LEAD2->Width) / 2;
   LEAD2->Top = (LEAD1->Height - LEAD2->Height) / 2;
   LEAD3->Top = 0;
   LEAD3->Left = 0;
   LEAD3->Width = LEAD2->Width;
   LEAD3->Height = LEAD2->Height;
   //We will be drawing into the bitmaps
   LEAD2->DrawPersistence = True;
   LEAD3->DrawPersistence = True;

   //First, we need some bitmaps
   LEAD2->CreateBitmap(LEAD2->ScaleWidth, LEAD3->ScaleHeight, 24);
   LEAD3->CreateBitmap(LEAD3->ScaleWidth, LEAD3->ScaleHeight, 24);
   //Fill them with black, which we will make transparent
   LEAD2->Fill(clBlack);
   LEAD3->Fill(clBlack);
   LEAD2->BitmapEnableTransparency = True;
   LEAD3->BitmapEnableTransparencyr = True;
   LEAD2->BitmapTransparentColor = clBlack;
   LEAD3->BitmapTransparentColor = clBlack;

   //Draw a shape into Lead2
   //Shape background
   LEAD2->ShapeBackgroundStyle = EFX_BACKSTYLE_TRANSLUCENT;
   //Shape location
   LEAD2->ShapeTop = 0;
   LEAD2->ShapeLeft = 0;
   LEAD2->ShapeWidth = LEAD2->BitmapWidth;
   LEAD2->ShapeHeight = LEAD2->BitmapHeight;
   //Shape border
   LEAD2->ShapeBorderColor = clFuchsia;
   LEAD2->ShapeBorderStyle = EFX_BORDERSTYLE_SOLID;
   LEAD2->ShapeBorderThickness = 5;
   LEAD2->PatternStyle = EFX_PATTERN_TRANSPARENT;

   //Draw the shape
   LEAD2->DrawShape(EFX_SHAPE_STAR4, 0);
   //Draw text into Lead3
   //Specify the text, font, and styles
   LEAD3->Font->Name = StringToOleStr("Arial");
   LEAD3->Font->Size = 40;
   LEAD3->TextAngle = 450;
   LEAD3->DrawFontColor = clBlue;
   LEAD3->TextStyle = EFX_TEXTSTYLE_NORMAL;
   LEAD3->TextAlign = EFX_TEXTALIGN_HCENTER_VCENTER;
   //Set the location for the text
   LEAD3->TextTop = 0;
   LEAD3->TextLeft = 0;
   LEAD3->TextWidth = LEAD3->BitmapWidth;
   LEAD3->TextHeight = LEAD3->BitmapHeight;

   //Set the properties for drawing a rectangle behind the text.
   LEAD3->DrawPenStyle = DRAWPENSTYLE_SOLID;
   LEAD3->DrawPenColor = clAqua;
   LEAD3->DrawMode = DRAWMODE_COPY_PEN;
   //Draw the rectangle, then draw the text.
   LEAD3->DrawRectangle(0, 0, LEAD3->BitmapWidth, LEAD3->BitmapHeight);
   LEAD3->DrawText(StringToOleStr("Text"), 0);
  //Load an image into Lead1}
   LEAD1->Load(StringToOleStr("e:\\LTWIN12x\\images\\image1.cmp"), 0, 0, 1);
   LEAD1->PaintSizeMode = PAINTSIZEMODE_ZOOM;
   LEAD1->PaintZoomFactor = 150;
   LEAD1->ForceRepaint();

   //Turn off the effects.
   LEAD1->PaintEffect = EFX_EFFECT_NONE;
   LEAD2->PaintEffect = EFX_EFFECT_NONE;
   LEAD3->PaintEffect = EFX_EFFECT_NONE;
}

4.	Run your program to test it.


Using a PanWindow (C++ Builder 3.0)

1.	Start C++ Builder 3.0.

2.	On the C++ Builder toolbar, click the ActiveX tab. If you have used a LEAD ActiveX control before, the icon appears on the toolbar. Otherwise, add the LEAD control as follows:

a.	On the Component, and choose Import ActiveX Control.

b.	In the Import ActiveX dialog, highlight the LEAD Main Control (12). Change the Class name to TLEAD. Click Install.

c.	If you have previously added a LEAD control, you will get a Confirm dialog that tells you that the xxx_TLB.cpp file already exists, and asks if you want to replace it.  Click Yes.

d.	In the Install dialog, click OK.

e.	In the Confirm dialog, click Yes.

f.	The Compiling Package DCLUSR35 dialog will appear.  You may elect not to have this dialog appear again.  Click Yes.

g.	The Compiling dialog will appear.

f.	After compiling has completed, the Information dialog will appear. Click OK.

g.	At this point you will be presented with the DCLUSR35.cpp window, with USEUNIT and USERES lines for each LEAD control installed in the project. Save and close DLCUSR35.bpk. Do not save Unit 1, Project 1 or ProjectGroup 1.

3.	In the File menu, choose New Application.

4.	Select the LEAD control on the ActiveX toolbar. Size and position the control as you want it to appear at run time, and change the name of the control to LEAD1.

5.	Add a command button from the Standard toolbar to your form and name it as follows:

Name	Caption

PanWin	Show Pan Window

6.	Add a RadioButton from the Standard toolbar to the form and name it as follows:

Name	Caption

RadioButton1	Pan Window

7.	Code the PanWinClick procedure as follows:

void __fastcall TForm1::PanWinClick(TObject *Sender)
{
     /*set the location of the PanWindow*/
     LEAD1->PanWinX = 100;
     LEAD1->PanWinY = 100;
     /*set the size of the PanWindow*/
     LEAD1->PanWinWidth = 150;
     LEAD1->PanWinHeight = 200;
     /*set the type of mouse pointer*/
     LEAD1->PanWinPointer = 12;

     LEAD1->PanWinTitle = StringToOleStr("PanWindow");
     LEAD1->PanWinRectColor = clBlue;
     LEAD1->PanWinSysMenu = True;
     /*use the settings for LEAD1*/
     LEAD1->PanWinPaintPalette = LEAD1->PaintPalette;
     LEAD1->PanWinBitonalScaling = LEAD1->BitonalScaling;
     LEAD1->PanWinPaintDither = LEAD1->PaintDither;
     LEAD1->ShowPanWin(True);

    RadioButton1->Checked = True;
}

10.	Code the FormActivate procedure as follows:

void __fastcall TForm1::FormActivate(TObject *Sender)
{
       /*set the path and name to an image file on your system*/
       LEAD1->Load (StringToOleStr("e:\\ltwin12x\\images\\image1.cmp"), 0, 0, 1);
}

11.	Code the Lead1PanWin procedure as follows:

void __fastcall TForm1::LEAD1PanWin(TObject *Sender, OLE_HANDLE hPanWin,
      short iFlag)
{
    if (iFlag == PANWIN_DESTROYED)
        RadioButton1->Checked = False;
}

12.	Run your program to test it.


Tutorial for Visual J++ Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS ActiveX.

Note:	These tutorial examples are intended to be easy to understand and easy to test.

Loading and Displaying an Image

Zooming Out and Zooming In

Dynamically Positioning the Control

Zooming In on a Selection

Outlining, Dragging, and Pasting a Region

Creating and Using Annotations

Writing and Reading Multipage Files

Using Transparent Controls

Drawing Simple Lines and Shapes

Cropping a Bitmap

Creating, Viewing, and Merging Color Separations

Updating a Progress Bar and Detecting a User Interrupt

Using Imaging Common Dialog

Adding a Color Resolution Dialog

Using a PanWindow

Miscellaneous Examples


Loading and Displaying an Image (Visual J++)

Take the following steps to start a project and to add some code that displays an image on the main form:

1.	Start Visual J++, Choose Windows Application and click Open..

2.	Add the LEAD Control to your project.

On the Tools pull-down menu, use the Customize Toolbox option, choose the ActiveX Controls tab and select the LEAD Main Control (14).

3.	 Select the LEAD control; then add the control to your main form. Size and position the control as you want it to appear at run time.

4.	 Add a command button to your form and name it as follows:

Name	Text

LoadLead	Load Image

5.	Add the following initialization code to the main form's constructor right under the TODO comment. In online help, you can use the Edit pull-down menu to copy the block of code.

// Set defaults for displaying the image.
// These are all persistent properties that can be set in the properties box.
LEAD1.setAppearance( (short) ltocx14n.AppearanceConstants.APPEARANCE_FLAT );
LEAD1.setBorderStyle( (short) 1 );
LEAD1.setBackColor( new Color( 255, 255, 125 ) );
LEAD1.setPaintDither( (short) ltocx14n.PaintDitherConstants.PAINTDITHER_DIFFUSION );
LEAD1.setPaintPalette( (short) ltocx14n.PaintPaletteConstants.PAINTPALETTE_AUTO );
LEAD1.setAutoRepaint( true );
LEAD1.setAutoSize( false );
LEAD1.setAutoSetRects( true );
LEAD1.setPaintSizeMode( (short) ltocx14n.PaintSizeModeConstants.PAINTSIZEMODE_FIT );

6.	Code the LoadLead button's click event as follows:

private void LoadLead_click(Object source, Event e)
{
   LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );
}

7.	Run your program to test it.

8.	Save the project to use as a starting point for other tasks in this tutorial.


Zooming Out and Zooming In (Visual J++)

Take the following steps to add code that can reduce and enlarge the displayed size of the image. This demonstrates the scaling properties that are normally used for zooming in and zooming out. It emphasizes the relationship of the displayed rectangle to the LEAD control.

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

2.	 Add two command buttons to your form and name them as follows:

Name	Text

ZoomIn	Zoom In

ZoomOut	Zoom Out

3.	Code the ZoomIn button's click event as follows:

private void ZoomIn_click(Object source, Event e)
{
   LEAD1.setAutoSetRects( true );
   LEAD1.setPaintSizeMode( (short) ltocx14n.PaintSizeModeConstants.PAINTSIZEMODE_ZOOM );
   LEAD1.setPaintZoomFactor( LEAD1.getPaintZoomFactor() + 10 );
}

4.	Code the ZoomOut button's click procedure as follows:

private void ZoomOut_click(Object source, Event e)
{
   LEAD1.setAutoSetRects( true );
   LEAD1.setPaintSizeMode( (short) ltocx14n.PaintSizeModeConstants.PAINTSIZEMODE_ZOOM );
   if( LEAD1.getPaintZoomFactor() > 10 )
      LEAD1.setPaintZoomFactor( LEAD1.getPaintZoomFactor() - 10 );
}

5.	Run your program to test it.


Dynamically Positioning the Control (Visual J++)

Take the following steps to dynamically scale and position the LEAD control when loading an image. This example scales the control to use most of the form's area while preserving the image's aspect ratio.

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

2.	Modify the LeadLoad button's click procedure so that it appears as follows. For a general explanation of how images are positioned and scaled, refer to Displaying an Image.

private void LoadLead_click(Object source, Event e)
{
   // Position and size the main form so that it takes up most of the screen.
   Rectangle r = SystemInformation.getWorkingArea();
   setWidth ( (int) ( r.width * 0.9f ) );
   setHeight( (int) ( r.height * 0.8f ) );
   setLeft( ( r.width - getWidth() ) / 2 );
   setTop( ( r.height - getHeight() ) / 2 );

   //Turn off automated behavior while we load and manipulate the image.
   LEAD1.setAutoSetRects( false );
   LEAD1.setAutoRepaint( false );
   LEAD1.setAutoScroll( false );
   LEAD1.setBackErase( false );

   // Load the bitmap. This hard-coded path name may be different on your system.
   LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );

   // Set the variables used for preserving the aspect ratio.
   // Allow for a border of 1/8 of the form size.
   // The units of measure do not matter, since we are calculating proportions.
   int nHeightFactor = (int) LEAD1.getBitmapHeight();
   int nWidthFactor = (int) LEAD1.getBitmapWidth();
   int nHeightAllowed = getSize().y * 3/4;
   int nWidthAllowed = getSize().x * 3/4;

   // Center the LEAD control on the form, preserving the aspect ratio.
   // Check to see if using the maximum width will make the image too tall.
   // Set the dimensions based on the result.
   if( ( ( nWidthAllowed * nHeightFactor) / nWidthFactor) < nHeightAllowed )
   {
      LEAD1.setLeft( getSize().x / 8 );
      LEAD1.setWidth( nWidthAllowed );
      LEAD1.setHeight( ( LEAD1.getWidth() * nHeightFactor) / nWidthFactor );
      LEAD1.setTop( ( getSize().y - LEAD1.getHeight() ) / 2 );
   }
   else
   {
      LEAD1.setTop( getSize().y / 8 );
      LEAD1.setHeight( nHeightAllowed );
      LEAD1.setWidth( ( LEAD1.getHeight() * nWidthFactor) / nHeightFactor );
      LEAD1.setLeft( ( getSize().x - LEAD1.getWidth() ) / 2 );
   }

   // Set the image display size to match the LEAD control
   LEAD1.SetDstRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
   LEAD1.SetDstClipRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );

   // Turn on automated behavior while we load and manipulate the image.
   LEAD1.setAutoSetRects( true );
   LEAD1.setAutoRepaint( true );
   LEAD1.setAutoScroll( true );
}

3.	Run your program to test it.


Zooming In on a Selection (Visual J++)

Take the following steps to add code that lets you select an area with a mouse, and zoom in on the selected area.

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

2.	In the LEAD1 control's MouseDown procedure, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

private void LEAD1_mouseDown(Object source, MouseEvent e)
{
   // Enable AutoRubberBand
   LEAD1.setAutoRubberBand( true );
   LEAD1.setMousePointer( (short) 2 );
}

3.	In the LEAD1 control's Rubberband event, add the following code.

private void LEAD1_rubberBand(Object source, Event e)
{
   LEAD1.setMousePointer( (short) 0 );

   // Zoom in on the selection.
   int nZoomleft = (int) LEAD1.getRubberBandLeft();
   int nZoomtop = (int) LEAD1.getRubberBandTop();
   int nZoomwidth = (int) LEAD1.getRubberBandWidth();
   int nZoomheight = (int) LEAD1.getRubberBandHeight();

   // Zoom in on the rectangle defined by the rubberband
   LEAD1.ZoomToRect( nZoomleft, nZoomtop, nZoomwidth, nZoomheight );
   LEAD1.ForceRepaint();
}

4.	Run your program to test it.


Outlining, Dragging, and Pasting a Region (Visual J++)

Take the following steps to add code that lets you outline an area with a mouse, drag a copy of the selected area, and paste the copy into another part of the bitmap:

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

2.	Add a second LEAD control, name it Lead2, and set its Visible property to False.

3. 	3. 	Add the following private variables to your main form. In online help, you can use the Edit pull-down menu to copy the block of code.

private boolean m_bReadyToDrag = false;  // The state after marking the region but before dragging
private boolean m_bDragging = false;  // The state when the mouse is used for dragging the floater
private int m_nStartX = 0;  // Starting X position in screen twips
private int m_nStartY = 0;  // Starting Y position in screen twips
private int m_nFloaterX = 0;  // Floater X position in screen twips
private int m_nFloaterY = 0;  // Floater Y position in screen twips
private float m_fZoomFactorX = 0f;  // Used for translating positioning information
private float m_fZoomFactorY = 0f;  // Used for translating positioning information

4.	 At the top of your main form, add two buttons and name them as follows:

Name	Text

SelRgnBtn	Select Region

PasteFloaterBtn	Paste Floater

5.	Add the following code to the SelRgnBtn control's Click event. In online help, you can use the Edit pull-down menu to copy the block of code.

private void SelRgnBtn_click(Object source, Event e)
{
   LEAD1.setRgnMarkingMode( (short) ltocx14n.RgnMarkingModeConstants.RGNMARK_FREEHAND );
   MessageBox.show( "Draw a freehand region" );
}

6.	Add the following code to the PasteFloaterBtn control's Click event:

private void PasteFloaterBtn_click(Object source, Event e)
{
   // Do nothing if there is no floater.
   if( LEAD1.getFloater() == 0 )
      return;

   // Get the floater into another bitmap
   LEAD2.setBitmap( LEAD1.getFloater() );

   // Get the floater's client coordinates into local variables.
   int nLCRgnX = (int) LEAD1.getFloaterDstLeft();
   int nLCRgnY = (int) LEAD1.getFloaterDstTop();
   int nLCRgnWidth = (int) LEAD1.getFloaterDstWidth();
   int nLCRgnHeight = (int) LEAD1.getFloaterDstHeight();

   // Delete the floater.
   LEAD1.setFloaterVisible( false );
   LEAD1.setFloater( 0 );

   // Translate the client coordinates to bitmap coordinates.
   int nLBRgnX = (int) ( ( ( nLCRgnX - LEAD1.getDstLeft() ) / m_fZoomFactorX ) + LEAD1.getSrcLeft() );
   int nLBRgnY = (int) ( ( ( nLCRgnY - LEAD1.getDstTop() ) / m_fZoomFactorY ) + LEAD1.getSrcTop() );
   int nLBRgnWidth = (int) ( nLCRgnWidth / m_fZoomFactorX );
   int nLBRgnHeight = (int) ( nLCRgnHeight / m_fZoomFactorY );

   // Reposition the region to use as a mask for the Combine method.
   LEAD1.OffsetRgn( nLBRgnX - LEAD1.getRgnLeft(), nLBRgnY - LEAD1.getRgnTop() );

   // Use the Combine method to paste the LEAD2 bitmap into the LEAD1 bitmap.
   int nMyOp = ltocx14n.CombineConstants.CB_OP_ADD | ltocx14n.CombineConstants.CB_DST_0;  // Operation flags for a simple paste.
   LEAD1.Combine( nLBRgnX, nLBRgnY, nLBRgnWidth, nLBRgnHeight,
   LEAD2.getBitmap(), 0, 0, nMyOp );

   // Repaint the part of the client area that has changed.
   LEAD1.RepaintRect( nLCRgnX, nLCRgnY, nLCRgnWidth, nLCRgnHeight, false );

   // Free the region.
   LEAD1.FreeRgn();
}

7.	In the LEAD1 control's MouseDown event, add the following code:

private void LEAD1_mouseDown(Object source, MouseEvent e)
{
   // Do nothing if we are drawing a region.
   if( LEAD1.getRgnMarkingMode() != ltocx14n.RgnMarkingModeConstants.RGNMARK_NONE )
      return;

   // Save the starting position, in case we need it.
   m_nStartY = e.y;
   m_nStartX = e.x;

   // If we are ready to drag the selection, get a floater.
   if( m_bReadyToDrag )
   {
      // Translate the current mouse coordinates.
      // These coordinates account for the zoom factor and offset.
      m_fZoomFactorX = LEAD1.getDstWidth() / LEAD1.getSrcWidth();
      m_fZoomFactorY = LEAD1.getDstHeight() / LEAD1.getSrcHeight();
      int nBitmapX = (int) ( ( e.x / m_fZoomFactorX ) - ( LEAD1.getDstLeft() / m_fZoomFactorX ) + LEAD1.getSrcLeft() );
      int nBitmapY = (int) ( ( e.y / m_fZoomFactorY ) - ( LEAD1.getDstTop() / m_fZoomFactorY ) +  LEAD1.getSrcTop() );

      // Continue to create the floater if the mouse is pointing to the region we marked.
      if( LEAD1.IsPtInRgn( nBitmapX, nBitmapY ) )
      {
         // Hide the region frame.
         LEAD1.setRgnFrameType( (short) ltocx14n.RgnFrameTypeConstants.RGNFRAME_NONE );

         // Create the floater bitmap, which will be the part of the main bitmap that is
         // in the region's bounding rectangle.
         LEAD1.setFloater( LEAD1.getBitmap() );

         // Translate the bitmap region coordinates to client area coordinates.
         int nNewY = (int) ( ( ( LEAD1.getRgnTop() - LEAD1.getSrcTop() ) * m_fZoomFactorY ) + LEAD1.getDstTop() );
         int nNewX = (int) ( ( ( LEAD1.getRgnLeft() - LEAD1.getSrcLeft() ) * m_fZoomFactorX ) + LEAD1.getDstLeft() );
         int nNewWidth = (int) ( LEAD1.getRgnWidth() * m_fZoomFactorX );
         int nNewHeight = (int) ( LEAD1.getRgnHeight() * m_fZoomFactorY );

         // Set the initial display position of the floater.
         LEAD1.SetFloaterDstRect( nNewX, nNewY, nNewWidth, nNewHeight );
         // Set form-level variables.
         m_nFloaterY = (int) LEAD1.getFloaterDstTop();
         m_nFloaterX = (int) LEAD1.getFloaterDstLeft();
         LEAD1.setFloaterVisible( true );
         m_bDragging = true;
         m_bReadyToDrag = false;
      }
   }
}

8.	In the LEAD1 control's MouseMove event, add the following code.

private void LEAD1_mouseMove(Object source, MouseEvent e)
{
   // Do nothing if we are drawing a region.
   if( LEAD1.getRgnMarkingMode() != ltocx14n.RgnMarkingModeConstants.RGNMARK_NONE )
      return;

   // Reposition the floater if we are dragging it.
   if( m_bDragging && LEAD1.getFloater() != 0 )
      if( LEAD1.IsPtInFloater( e.x, e.y ) )
      {
         // Update the position variables.
         int nXDelta = e.x - m_nStartX;
         int nYDelta = e.y - m_nStartY;
         int nNewX = m_nFloaterX + nXDelta;
         int nNewY = m_nFloaterY + nYDelta;
         int nNewWidth = (int) LEAD1.getFloaterDstWidth();
         int nNewHeight = (int) LEAD1.getFloaterDstHeight();

         // Reposition the floater.
         LEAD1.SetFloaterDstRect( nNewX, nNewY, nNewWidth, nNewHeight );

         // Save the form-level position variables.
         m_nFloaterY = nNewY;
         m_nFloaterX = nNewX;
         m_nStartY = e.y;
         m_nStartX = e.x;
      }
}

9.	In the LEAD1 control's MouseUp event, add the following code.

private void LEAD1_mouseUp(Object source, MouseEvent e)
{
   // If we were drawing a region, set up for the next operation.
   if( LEAD1.getRgnMarkingMode() != ltocx14n.RgnMarkingModeConstants.RGNMARK_NONE )
   {
      LEAD1.setRgnMarkingMode( (short) ltocx14n.RgnMarkingModeConstants.RGNMARK_NONE );
      LEAD1.setRgnFrameType( (short) ltocx14n.RgnFrameTypeConstants.RGNFRAME_STATIC );
      m_bReadyToDrag = true;
      MessageBox.show( "Now, drag the selection to another place." );
   }
}

10.	Run your program to test it.


Creating and Using Annotations (Visual J++)

Note: This topic is for Document/Medical  only.

Take the following steps to add code that demonstrates the creation and deletion, saving and loading, and copying and pasting of annotation objects. This code also demonstrates the related events. Message boxes prompt for user actions that trigger events.

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

2.	 At the top of your main form, add four buttons and name them as follows:

Name	Text

AnnToggle	Start

IOToggle	Save

ClipboardToggle	Copy

Realize	Realize

3.	Code the AnnToggle control's Click event as follows. In online help, you can use the Edit pull-down menu to copy the block of code.

private void AnnToggle_click(Object source, Event e)
{
   // Use the button to toggle between design mode and run mode
   if( AnnToggle.getText().equals( "Start" ) )
   {
      LEAD1.setAnnUserMode( (short) ltocx14n.AnnUserModeConstants.ANNUSERMODE_DESIGN );
      LEAD1.setAnnTool( (short) ltocx14n.AnnToolConstants.ANNTOOL_BUTTON );

      // Make run mode the next thing.
      AnnToggle.setText( "Run Mode" );
      MessageBox.show( "In design mode now. Draw a button object." );
   }
   else
   if( AnnToggle.getText().equals( "Design Mode" ) )
   {
      LEAD1.setAnnUserMode( (short) ltocx14n.AnnUserModeConstants.ANNUSERMODE_DESIGN );
      LEAD1.setAnnTool( (short) ltocx14n.AnnToolConstants.ANNTOOL_BUTTON );

      // Make run mode the next thing.
      AnnToggle.setText( "Run Mode" );
   }
   else  // The button takes us to run mode
   {
      LEAD1.setAnnUserMode( (short) ltocx14n.AnnUserModeConstants.ANNUSERMODE_RUN );
      MessageBox.show( "Click on your new button" );
      AnnToggle.setText( "Design Mode" );
   }
}

4.	Code the IOToggle control's Click event as follows:

private void IOToggle_click(Object source, Event e)
{
   // Disable errors so that we can trap our own.
   LEAD1.setEnableMethodErrors( false );

   // Use the button to toggle between saving and loading annotations
   if( IOToggle.getText().equals( "Save" ) )
   {
      // Do nothing if there are no annotations.
      if( LEAD1.getAnnContainer() == 0 )
         return;

      //Save the selected annotations.
      short sRet = LEAD1.AnnSave( "c:\\lead\\images\\tmp.ann", (short) ltocx14n.AnnFormatConstants.ANNFMT_NATIVE, true );
      if( sRet == 0 )
      {
         // Make loading the next thing.
         IOToggle.setText( "Load" );
         MessageBox.show( "Use the right mouse button to delete any annotations, then click Load" );
      }
      else
         MessageBox.show( "Error code: " + sRet );
   }
   else  // We are loading annotations
   {
      // Make sure we are in design mode
      LEAD1.setAnnUserMode( (short) ltocx14n.AnnUserModeConstants.ANNUSERMODE_DESIGN );

      // Load the annotations.
      short sRet = LEAD1.AnnLoad( "c:\\lead\\images\\tmp.ann", (short) 1 );
      if( sRet == 0 )
         IOToggle.setText( "Save" );
      else
         MessageBox.show( "No annotations to load" );
   }
}

5.	Code the ClipboardToggle control's Click event as follows. (Note that Copy, Cut, and Paste are available as automated popup menu options. This code is for tailoring your application.)

private void ClipboardToggle_click(Object source, Event e)
{
   // Disable errors so that we can trap our own.
   LEAD1.setEnableMethodErrors( false );

   // Use the button to toggle between copying and pasting annotations
   if( ClipboardToggle.getText().equals( "Copy" ) )
   {
      // Do nothing if there are no annotations.
      if( LEAD1.getAnnContainer() == 0 )
         return;

      // Copy the selected annotations to the clipboard.
      short sRet = LEAD1.AnnCopy( (short) ltocx14n.AnnFormatConstants.ANNFMT_NATIVE, true, true );
      if( sRet == 0 )
      {
         // Make pasting the next thing.
         ClipboardToggle.setText( "Paste" );
         MessageBox.show( "Use the right mouse button to delete any annotations, then click Paste" );
      }
      else
         MessageBox.show( "Error code: " + sRet );
   }
   else  // We are pasting annotations
   {
      // Make sure we are in design mode
      LEAD1.setAnnUserMode( (short) ltocx14n.AnnUserModeConstants.ANNUSERMODE_DESIGN );

      // Paste the annotations
      if( LEAD1.getAnnPasteReady() )
      {
         LEAD1.AnnPaste();
         ClipboardToggle.setText( "Copy" );
      }
      else
         MessageBox.show( "No annotations to paste" );
   }
}

6.	Code the Realize control's Click event (which renders the annotation objects to the bitmap) as follows:

private void Realize_click(Object source, Event e)
{
   LEAD1.AnnRealize( false );
   LEAD1.ForceRepaint();
   MessageBox.show( "Annotations are now rendered to the bitmap" );
}

7.	Code the LEAD1 control's AnnCreate event as follows:

private int m_nNewTag = 0;
private void LEAD1_annCreate(Object source, ltocx14n.LEAD.AnnCreateEvent e)
{
   // Update the tag if we need one.
   if( LEAD1.AnnGetType( e.hObject ) == ltocx14n.AnnObjectConstants.ANNOBJECT_BUTTON ||
      LEAD1.AnnGetType( e.hObject ) == ltocx14n.AnnObjectConstants.ANNOBJECT_HOTSPOT )
   {
      m_nNewTag++;
      LEAD1.AnnSetTag( e.hObject, m_nNewTag );
   }
}

8.	Code the LEAD1 control's AnnDrawn event as follows:

private void LEAD1_annDrawn(Object source, ltocx14n.LEAD.AnnDrawnEvent e)
{
   LEAD1.setAnnTool( (short) ltocx14n.AnnToolConstants.ANNTOOL_SELECT );
   MessageBox.show( "Use the right mouse button to modify this object;" + " then click on Run Mode to test it." );
}

9.	Code the LEAD1 control's AnnClicked event as follows:

private void LEAD1_annClicked(Object source, ltocx14n.LEAD.AnnClickedEvent e)
{
   MessageBox.show( "This is what we do for the button tagged " + LEAD1.AnnGetTag( e.hObject ) );
}

10.	Code the LEAD1 control's AnnDestroy event as follows:

private void LEAD1_annDestroy(Object source, ltocx14n.LEAD.AnnDestroyEvent e)
{
   MessageBox.show( "The object tagged " + LEAD1.AnnGetTag( e.hObject ) + " is deleted." );
}

11.	Run your program to test it.


Writing and Reading Multipage Files (Visual J++)

Take the following steps to create a multipage file, then load and display the images from the file. Only TIFF (MPT) and PCX (DCX) formats support multipage files.

1.	Start Visual J++ 6.0.

2.	On the Tools pull-down menu, use the Customize Toolbox option, choose the ActiveX Controls tab and add the LEAD Main Control (14) to your project.

3.	 Select the LEAD control; then add two controls to your main form. The size and position does not matter.

4.	Add the following code to the main form's constructor right after the TODO Comment. In online help, you can use the Edit pull-down menu to copy the block of code. This code loads two bitmaps, saves them both into a single multipage TIFF file, loads them again from the TIFF file, and displays them side-by-side.

// TODO: Add any constructor code after initForm call

// Disable automatic repainting of the image.
LEAD1.setAutoRepaint( false );
LEAD2.setAutoRepaint( false );

// Turn off scroll bars to make sure we use the full client area.
LEAD1.setAutoScroll( false );
LEAD2.setAutoScroll( false );

// Position and size the main form so that it takes up most of the screen.
Rectangle r = SystemInformation.getWorkingArea();
setWidth( (int) ( r.width * 0.9f ) );
setHeight( (int) ( r.height* 0.8f ) );
setLeft( (int) ( ( r.width - getWidth() ) / 2 ) );
setTop( (int) ( ( r.height - getHeight() ) / 2 ) );

// set the mouse pointer to an hourglass.
setCursor( Cursor.WAIT );

// Load the bitmaps. These hard-coded path names may be different on your system.
LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );
LEAD2.Load( "c:\\lead\\images\\image2.cmp", (short) 0, (short) 0, (short) 1 );

// Save the bitmaps to a single multipage TIFF file
LEAD1.Save( "c:\\lead\\images\\combined.mpt", (short) ltocx14n.FileConstants.FILE_TIF,
            (short) 24, (short) 0, (short) ltocx14n.SaveModifyConstants.SAVE_OVERWRITE );
LEAD2.Save( "c:\\lead\\images\\combined.mpt", (short) ltocx14n.FileConstants.FILE_TIF,
            (short) 24, (short) 0, (short) ltocx14n.SaveModifyConstants.SAVE_APPEND );

// Get information about the images so that we can size the controls.
LEAD1.GetFileInfo( "c:\\lead\\images\\combined.mpt", (short) 1, 0 );
LEAD2.GetFileInfo( "c:\\lead\\images\\combined.mpt", (short) 2, 0 );

// Clear the bitmaps from memory
LEAD1.setBitmap( 0 );
LEAD2.setBitmap( 0 );

// Make the controls visible so that we can size and position them.
// They will not really appear until we load an image and paint it.
LEAD1.setVisible ( true );
LEAD2.setVisible( true );

// Set the variables used for preserving the aspect ratio.
int nHeightFactor1 = (int) LEAD1.getInfoHeight();
int nWidthFactor1 = (int)LEAD1.getInfoWidth();
int nHeightFactor2 = (int)LEAD2.getInfoHeight();
int nWidthFactor2 = (int)LEAD2.getInfoWidth();
int nHeightAllowed = (int) ( getSize().y * 0.8f );
int nWidthAllowed = (int) ( getSize().x * 0.45f );

// Center each LEAD control on half of the form, preserving the aspect ratio.
// Check to see if using the maximum width will make the image too tall.
// Set the dimensions based on the result.
if( ( ( nWidthAllowed * nHeightFactor1 ) / nWidthFactor1 ) < nHeightAllowed )
{
   LEAD1.setLeft( ( getSize().x / 4) - ( nWidthAllowed / 2 ) );
   LEAD1.setWidth( nWidthAllowed );
   LEAD1.setHeight( ( LEAD1.getWidth() * nHeightFactor1 ) / nWidthFactor1 );
   LEAD1.setTop( ( getSize().y - LEAD1.getHeight() ) / 2 );
}
else
{
   LEAD1.setTop( ( getSize().y - nHeightAllowed) / 2 );
   LEAD1.setHeight( nHeightAllowed );
   LEAD1.setWidth( ( LEAD1.getHeight() * nWidthFactor1) / nHeightFactor1 );
   LEAD1.setLeft( ( getSize().x / 4 ) - ( LEAD1.getWidth() / 2 ) );
}

if( ( ( nWidthAllowed * nHeightFactor2 ) / nWidthFactor2 ) < nHeightAllowed )
{
   LEAD2.setLeft( ( getSize().x * 3/4 ) - ( nWidthAllowed / 2 ) );
   LEAD2.setWidth( nWidthAllowed );
   LEAD2.setHeight( ( LEAD2.getWidth() * nHeightFactor2 ) / nWidthFactor2 );
   LEAD2.setTop( ( getSize().y - LEAD2.getHeight() ) / 2 );
}
else
{
   LEAD2.setTop( ( getSize().y - nHeightAllowed ) / 2 );
   LEAD2.setHeight( nHeightAllowed );
   LEAD2.setWidth( ( LEAD2.getHeight() * nWidthFactor2 ) / nHeightFactor2 );
   LEAD2.setLeft( ( getSize().x * 3/4 ) - ( LEAD2.getWidth() / 2 ) );
}

// Load the bitmaps from the multipage TIFF file
LEAD1.Load( "c:\\lead\\images\\combined.mpt", (short) 24, (short) 1, (short) 1 );
LEAD2.Load( "c:\\lead\\images\\combined.mpt", (short) 24, (short) 2, (short) 1 );

// Set the image display sizes to match the LEAD controls
int nImageWidth1 = (int) LEAD1.getScaleWidth();
int nImageHeight1 = (int) LEAD1.getScaleHeight();
LEAD1.SetDstRect( 0, 0, nImageWidth1, nImageHeight1 );
LEAD1.SetDstClipRect( 0, 0, nImageWidth1, nImageHeight1 );

// Set the image display sizes to match the LEAD controls
int nImageWidth2= (int) LEAD2.getScaleWidth();
int nImageHeight2= (int) LEAD2.getScaleHeight();
LEAD2.SetDstRect( 0, 0, nImageWidth2, nImageHeight2 );
LEAD2.SetDstClipRect( 0, 0, nImageWidth2, nImageHeight2 );

// Display the images
LEAD1.ForceRepaint();
LEAD2.ForceRepaint();

// Set the mouse pointer back to the default
setCursor( Cursor.DEFAULT );

5.	Run your program to test it.


Using Transparent Controls (Visual J++)

Take the following steps to add transparent controls, with special effects. The transparent controls are added as child controls so that they will scroll with the parent image.

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

2.	Add two LEAD controls, which you will set to be transparent at run time. (At design time, you can make the controls easier to see by setting the BackColor property of each control to a different color.) Add the controls as follows:

a.	Add a control named Lead2 as a child control to Lead1. In other words, draw it inside the Lead1 control.

b.	Add a control named Lead3 as a child control to Lead2. In other words, draw it inside the Lead2 control.

3.	Add a button and code its click event as follows:

private void button1_click(Object source, Event e)
{
   LEAD1.setEnableMethodErrors( false );
   LEAD1.setAutoRepaint( false );
   LEAD2.setAutoRepaint( false );
   LEAD3.setAutoRepaint( false );

   // Make LEAD2 and LEAD3 transparent.
   LEAD2.setTransparent( true );
   LEAD3.setTransparent( true );

   // Give each control a different effect.
   LEAD1.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_OUT );
   LEAD2.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_IN );
   LEAD3.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_ZOOM_FROM_C );
   LEAD1.setEffectDelay( (short) 20 );
   LEAD2.setEffectDelay( (short) 20 );
   LEAD3.setEffectDelay( (short) 20 );
   LEAD1.setEffectGrain( (short) 1 );
   LEAD2.setEffectGrain( (short) 5 );
   LEAD3.setEffectGrain( (short) 1 );

   // Position LEAD2 and LEAD3 inside LEAD1.
   LEAD2.setWidth( LEAD1.getWidth() / 2 );
   LEAD2.setHeight( LEAD1.getHeight() / 2 );
   LEAD2.setTop( (LEAD1.getWidth() - LEAD2.getWidth() ) / 2 );
   LEAD2.setLeft( (LEAD1.getHeight() - LEAD2.getHeight() ) / 2 );

   LEAD3.setTop( 0 );
   LEAD3.setLeft( 0 );
   LEAD3.setWidth( LEAD2.getWidth() );
   LEAD3.setHeight( LEAD2.getHeight() );

   // We will be drawing into the bitmaps.
   LEAD2.setDrawPersistence( true );
   LEAD3.setDrawPersistence( true );
   LEAD2.CreateBitmap( LEAD2.getScaleWidth(), LEAD3.getScaleHeight(), (short) 24 );
   LEAD3.CreateBitmap( LEAD3.getScaleWidth(), LEAD3.getScaleHeight(), (short) 24 );

   // Fill them with black, which we will make transparent.
   LEAD2.Fill( new Color( 0, 0, 0 ) );
   LEAD3.Fill( new Color( 0, 0, 0 ) );
   LEAD2.setBitmapEnableTransparency( true );
   LEAD3.setBitmapEnableTransparency( true );
   LEAD2.setBitmapTransparentColor( new Color( 0, 0, 0 ) );
   LEAD3.setBitmapTransparentColor( new Color( 0, 0, 0 ) );

   // Draw a shape into LEAD2.
   // Shape background
   LEAD2.setShapeBackgroundStyle( (short) ltocx14n.EfxBackStyleConstants.EFX_BACKSTYLE_TRANSLUCENT );

   // Shape location
   LEAD2.setShapeTop( 0 );
   LEAD2.setShapeLeft( 0 );
   LEAD2.setShapeWidth( LEAD2.getBitmapWidth() );
   LEAD2.setShapeHeight( LEAD2.getBitmapHeight() );

   // Shape border
   LEAD2.setShapeBorderColor( new Color( 255, 0, 0 ) );
   LEAD2.setShapeBorderStyle( (short) ltocx14n.EfxBorderStyleConstants.EFX_BORDERSTYLE_SOLID );
   LEAD2.setShapeBorderThickness( 5 );

   LEAD2.setPatternStyle( (short) ltocx14n.PatternStyleEnum.EFX_PATTERN_TRANSPARENT );

   // Draw the shape
   LEAD2.DrawShape( (short) ltocx14n.EfxShapeConstants.EFX_SHAPE_STAR4, 0 );

   // Draw text into LEAD3.
   // Specify the text, font, and styles.
   String strTest = "Text";
   Font font = new Font( "Arial", 40, 0 );
   LEAD3.setFont( font );
   LEAD3.setTextAngle( (short) 450 );
   LEAD3.setDrawFontColor( new Color( 0, 0, 255 ) );  // Blue
   LEAD3.setTextStyle( (short) ltocx14n.EfxTextStyleConstants.EFX_TEXTSTYLE_NORMAL );
   LEAD3.setTextAlign( (short) ltocx14n.EfxTextAlignConstants.EFX_TEXTALIGN_HCENTER_VCENTER );

   // Set the location for the text.
   LEAD3.setTextTop( 0 );
   LEAD3.setTextLeft( 0 );
   LEAD3.setTextWidth( LEAD3.getBitmapWidth() );
   LEAD3.setTextHeight( LEAD3.getBitmapHeight() );

   // Set the properties for drawing a rectangle behind the text.
   LEAD3.setDrawPenStyle( (short) ltocx14n.DrawPenStyleConstants.DRAWPENSTYLE_SOLID );
   LEAD3.setDrawPenColor( new Color( 255, 255, 0 ) );
   LEAD3.setDrawMode( (short) ltocx14n.DrawModeConstants.DRAWMODE_COPY_PEN );

   // Draw the rectangle, then draw the text.
   LEAD3.DrawRectangle( 0, 0, LEAD3.getBitmapWidth(), LEAD3.getBitmapHeight() );
   LEAD3.DrawText( strTest, 0 );

   // Load an image into LEAD1.
   LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );
   LEAD1.setPaintSizeMode( (short) ltocx14n.PaintSizeModeConstants.PAINTSIZEMODE_ZOOM );
   LEAD1.setPaintZoomFactor( 150 );
   LEAD1.ForceRepaint();

   // Turn off the effects.
   LEAD1.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_NONE );
   LEAD2.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_NONE );
   LEAD3.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_NONE );
}

4.	Run your program to test it.


Drawing Simple Lines and Shapes (Visual J++)

Take the following steps to add code that lets you draw a line, rectangle and ellipse on the bitmap.

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

2.	Add the following private member variables to your main form:

private int m_nDrawObject = 0;  // The object we are drawing
private int m_nStartX = 0;  // Starting X position
private int m_nStartY = 0;  // Starting Y position
private int m_nEndX = 0;  // Ending X position
private int m_nEndY = 0;  // Ending Y position

3.	Code the LEAD control's mouseDown event as follows. This code selects a different drawing object each time the event occurs.

private void LEAD1_mouseDown(Object source, MouseEvent e)
{
   // Save the starting position.
   m_nStartX = e.x;
   m_nStartY = e.y;
   m_nEndX = e.x;
   m_nEndY = e.y;

   // Cycle through the types of drawing objects.
   switch( m_nDrawObject )
   {
      case 0 :
         m_nDrawObject = 1;  // Line
         break ;
      case 1 :
         m_nDrawObject = 2;  // Rectangle
         break ;
      case 3 :
         m_nDrawObject = 0;  // Ellipse
         break ;
      default :
         m_nDrawObject = 0;
         break ;
   }
}

4.	Code the LEAD control's mouseMove event as follows. This code uses DRAWMODE_INVERT for the DrawMode, which means that pixel colors are inverted. Thus, the drawing methods can erase the previous object and draw a new one.

private void LEAD1_mouseMove(Object source, MouseEvent e)

{
   // Set the drawing styles.
   LEAD1.setDrawPenStyle( (short) ltocx14n.DrawPenStyleConstants.DRAWPENSTYLE_SOLID );
   LEAD1.setDrawMode( (short) ltocx14n.DrawModeConstants.DRAWMODE_INVERT );
   LEAD1.setDrawFillStyle( (short) ltocx14n.DrawFillStyleConstants.DRAWFILLSTYLE_TRANSPARENT );
   LEAD1.setDrawPersistence( false );  // On the window, not the bitmap

   // Save the previous ending mouse position.
   int nOldEndX = m_nEndX;
   int nOldEndY = m_nEndY;

   // Get the current mouse position.
   m_nEndX = e.x;
   m_nEndY = e.y;

   // Calculate the origin of the current object.
   int nDrawX, nDrawY;
   if( m_nEndX > m_nStartX )
      nDrawX = m_nStartX;
   else
      nDrawX = m_nEndX;

   if( m_nEndY > m_nStartY )
      nDrawY = m_nStartY;
   else
      nDrawY = m_nEndY;

   // Calculate the origin of the previous object.
   int nOldDrawX, nOldDrawY;
   if( nOldEndX > m_nStartX )
      nOldDrawX = m_nStartX;
   else
      nOldDrawX = nOldEndX;

   if( nOldEndY > m_nStartY )
      nOldDrawY = m_nStartY;
   else
      nOldDrawY = nOldEndY;

   // Calculate the height and width of the current object.
   int nNewHeight = Math.abs( m_nStartY - m_nEndY );
   int nNewWidth = Math.abs( m_nStartX - m_nEndX );

   // Calculate the height and width of the previous object.
   int nOldHeight = Math.abs( m_nStartY - nOldEndY );
   int nOldWidth = Math.abs( m_nStartX - nOldEndX );

   // Erase the old object and draw the new one.
   switch( m_nDrawObject )
   {
      case 0 :  // Ellipse
         LEAD1.DrawEllipse( nOldDrawX, nOldDrawY, nOldWidth, nOldHeight );
         LEAD1.DrawEllipse( nDrawX, nDrawY, nNewWidth, nNewHeight );
         break;
      case 1 :  // Line
         LEAD1.DrawLine( m_nStartX, m_nStartY, nOldEndX, nOldEndY );
         LEAD1.DrawLine( m_nStartX, m_nStartY, m_nEndX, m_nEndY );
         break;
      case 2 :  // Rectangle
         LEAD1.DrawRectangle( nOldDrawX, nOldDrawY, nOldWidth, nOldHeight );
         LEAD1.DrawRectangle( nDrawX, nDrawY, nNewWidth, nNewHeight );
         break;
      default :
         break;
   }
}

5.	Code the LEAD control's mouseUp event as follows. This code sets the drawing style and draws the object on the bitmap.

private void LEAD1_mouseUp(Object source, MouseEvent e)
{
   // Set the drawing style.
   LEAD1.setDrawPenStyle( (short) ltocx14n.DrawPenStyleConstants.DRAWPENSTYLE_SOLID );
   LEAD1.setDrawPenWidth( (short) 2 );
   LEAD1.setDrawPenColor( new Color( 255, 0, 0 ) );  // Red
   LEAD1.setDrawMode( (short) ltocx14n.DrawModeConstants.DRAWMODE_COPY_PEN );
   LEAD1.setDrawFillColor( new Color( 0, 255, 0 ) );  // Green
   LEAD1.setDrawFillStyle( (short) ltocx14n.DrawFillStyleConstants.DRAWFILLSTYLE_HORIZONTAL_LINE );
   LEAD1.setDrawPersistence( true );  // On the bitmap

   // Get the current mouse position
   m_nEndX = e.x;
   m_nEndY = e.y;

   // Determine the origin of the object.
   int nDrawX, nDrawY;
   if( m_nEndX > m_nStartX )
      nDrawX = m_nStartX;
   else
      nDrawX = m_nEndX;

   if( m_nEndY > m_nStartY )
      nDrawY = m_nStartY;
   else
      nDrawY = m_nEndY;

   // Determine the height and width of the object.
   int nNewHeight = Math.abs( m_nStartY - m_nEndY );
   int nNewWidth = Math.abs( m_nStartX - m_nEndX );

   // Draw the object
   switch( m_nDrawObject )
   {
      case 0 :  // Ellipse
         LEAD1.DrawEllipse( nDrawX, nDrawY, nNewWidth, nNewHeight );
         break;
      case 1 :  // Line
         LEAD1.DrawLine( m_nStartX, m_nStartY, m_nEndX, m_nEndY );
         break;
      case 2 :  // Rectangle
         LEAD1.DrawRectangle( nDrawX, nDrawY, nNewWidth, nNewHeight );
         break;
      default :
         break;
   }
}

6.	Run your program to test it.


Cropping a Displayed Image and Copying It to a Bitmap (Visual J++)
Cropping a Bitmap (Visual J++)

Take the following steps to add code that lets you select an area with a mouse, crop the display to show only that area, and trim the bitmap to match the selected area. (This example uses both cropping and trimming, so that you can see the difference.)

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

2.	Add the following private member variables to your main form:

private boolean m_bCropping = false ;  // The state when the mouse is used for cropping
private int m_nStartX = 0 ;  // Starting X position in screen pixels
private int m_nStartY = 0 ;  // Starting Y position in screen pixels
private int m_nEndX = 0;  // Ending X position in screen pixels
private int m_nEndY = 0;  // Ending Y position in screen pixels

3.	 Select the CommandButton control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

4.	In the Properties box, change the Button control's Text property to Select Rectangle.

5.	Add the following code to the Button control's Click event. In online help, you can use the Edit pull-down menu to copy the block of code.

private void button1_click(Object source, Event e)
{
   // Initialize cropping so that you can do it more than once
   if( m_bCropping )
   {
      // Set the clipping area to match the image.
      LEAD1.SetDstClipRect( LEAD1.getDstLeft(), LEAD1.getDstTop(), LEAD1.getDstWidth(), LEAD1.getDstHeight() );

      // Display the image
      LEAD1.ForceRepaint();
   }

   // Set the member variable to let other events know that you are cropping
   m_bCropping = true;

   // Set the pointer to a crosshair
   LEAD1.setMousePointer( (short) 2 );
}

6.	In the LEAD1 control's mouseDown event, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

private void LEAD1_mouseDown(Object source, MouseEvent e)
{
   // Save the starting position
   m_nStartX = e.x;
   m_nStartY = e.y;

   // Make the rubberband invisible until the mouse moves
   LEAD1.setRubberBandVisible( false );
}

7.	In the LEAD1 control's mouseMove event, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

private void LEAD1_mouseMove(Object source, MouseEvent e)
{
   if( m_bCropping && e.button == 1 )
   {
      // Get the current mouse position
      m_nEndX = e.x;
      m_nEndY = e.y;

      // Determine the origin of the rubberband rectangle, regardless of which way the mouse moves.
      int rbX, rbY;
      if( m_nEndX > m_nStartX )
         rbX = m_nStartX;
      else
         rbX = m_nEndX;

      if( m_nEndY > m_nStartY )
         rbY = m_nStartY;
      else
         rbY = m_nEndY;

      // Determine the height and width of the rubberband rectangle
      int rbHeight = Math.abs( m_nStartY - m_nEndY );
      int rbWidth = Math.abs( m_nStartX - m_nEndX );

      // Set the rubberband rectangle
      LEAD1.SetRubberBandRect( rbX, rbY, rbWidth, rbHeight );

      // Alternatively, you could use the following methods to set the
      // rubberband rectangle.
      // LEAD1.setRubberBandHeight( rbHeight );
      // LEAD1.setRubberBandLeft( rbX );
      // LEAD1.setRubberBandTop( rbY );
      // LEAD1.setRubberBandWidth( rbWidth );

      // Make the rubberband rectangle visible
      LEAD1.setRubberBandVisible( true );
   }
}

8.	In the LEAD1 control's mouseUp event, add the following code. In online help, you can use the Edit pull-down menu to copy the block of code.

private void LEAD1_mouseUp(Object source, MouseEvent e)
{
   if( m_bCropping )
   {
      // Get the current mouse position
      m_nEndX = e.x;
      m_nEndY = e.y;

      // Get the origin of the clipping rectangle.
      // Allow for different mouse drag directions
      int nCropLeft, nCropTop;
      if( m_nStartX < m_nEndX )
         nCropLeft = m_nStartX;
      else
         nCropLeft = m_nEndX;

      if( m_nStartY < m_nEndY )
         nCropTop = m_nStartY;
      else
         nCropTop = m_nEndY;

      // Get the height and width of the cropped area
      int nCropWidth = Math.abs( m_nEndX - m_nStartX );
      int nCropHeight = Math.abs( m_nEndY - m_nStartY );

      // Crop and repaint the image
      LEAD1.SetDstClipRect( nCropLeft, nCropTop, nCropWidth, nCropHeight );
      LEAD1.ForceRepaint();
      LEAD1.setRubberBandVisible( false );
      LEAD1.setMousePointer( (short) 0 );  // Default
   }
}

9.	 Select the Button control; then add another control to your main form. Put the control at the top of the form to keep it away from the image.

10.	In the Properties box, change the Button control's Text property to Trim. This button will be used to trim the bitmap in memory and redisplay the bitmap.

11.	Add the following code to the Button control's Click event. In online help, you can use the Edit pull-down menu to copy the block of code.

private void button2_click(Object source, Event e)
{
   setCursor( Cursor.WAIT );  // hourglass

   // Use the clipping rectangle's percentage offsets in the image rectangle
   // to determine the trimmed rectangle in the bitmap.
   // Using percentages allows for the possibility that the image is zoomed.
   float fXFactor = LEAD1.getBitmapWidth() / LEAD1.getDstWidth();
   float fYFactor = LEAD1.getBitmapHeight() / LEAD1.getDstHeight();
   int nNewTop = (int) ( ( LEAD1.getDstClipTop() - LEAD1.getDstTop() ) * fYFactor );
   int nNewLeft = (int) ( ( LEAD1.getDstClipLeft() - LEAD1.getDstLeft() ) * fXFactor );
   int nNewWidth = (int) ( LEAD1.getDstClipWidth() * fXFactor );
   int nNewHeight = (int) ( LEAD1.getDstClipHeight() * fYFactor );

   // Make sure display rectangles are automatically adjusted.
   LEAD1.setAutoSetRects( true );

   // Trim the bitmap.
   LEAD1.Trim( nNewLeft, nNewTop, nNewWidth, nNewHeight );

   // Size and redisplay the control, using the new bitmap size.
   // Set the variables used for preserving the aspect ratio.
   // Allow for a border of 1/8 of the form size.
   // The units of measure do not matter, since we are calculating proportions.
   int nHeightFactor = (int) LEAD1.getBitmapHeight();
   int nWidthFactor = (int) LEAD1.getBitmapWidth();
   int nHeightAllowed = getSize().y - ( getSize().y / 4 );
   int nWidthAllowed = getSize().x - ( getSize().x / 4 );

   // Center the LEAD control on the form, preserving the aspect ratio.
   // Check to see if using the maximum width will make the image too tall.
   // Set the dimensions based on the result.
   if( ( ( nWidthAllowed * nHeightFactor ) / nWidthFactor ) < nHeightAllowed )
   {
      LEAD1.setLeft( getSize().x / 8 );
      LEAD1.setWidth( nWidthAllowed );
      LEAD1.setHeight( ( LEAD1.getWidth() * nHeightFactor) / nWidthFactor );
      LEAD1.setTop( ( getSize().y - LEAD1.getHeight() ) / 2 );
   }
   else
   {
      LEAD1.setTop( getSize().y / 8 );
      LEAD1.setHeight( nHeightAllowed );
      LEAD1.setWidth( ( LEAD1.getHeight() * nWidthFactor) / nHeightFactor );
      LEAD1.setLeft( ( getSize().x - LEAD1.getWidth() ) / 2 );
   }

   // Turn off scroll bars to make sure we use the full client area.
   LEAD1.setAutoScroll( false );

   // Set the image display size to match the LEAD control
   LEAD1.SetDstRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
   LEAD1.SetDstClipRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );

   // Display the image
   LEAD1.ForceRepaint();

   setCursor( Cursor.DEFAULT );  // Default
}

12.	Run your program to test it.


Creating, Viewing, and Merging Color Separations (Visual J++)

Take the following steps to add code that creates CMYK color separations, displays each of the color planes, merges the planes, and displays the result. The code increases the contrast of the K plane to demonstrate how you can manipulate the color separations.

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

2.	 Select the Button control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

3.	In the Properties box, change the Button control's Text property to Do Separations.

4.	Add the following code to the Button control's Click event. In online help, you can use the Edit pull-down menu to copy the block of code.

// Count the button clicks and take the next step with each click
private int m_nClickCount = 0;

private void button1_click(Object source, Event e)
{
   setCursor( Cursor.WAIT );  // hourglass

   // Turn off the automatic display rectangles.
   LEAD1.setAutoSetRects( false );

   switch( m_nClickCount )
   {
      case 0 :
         LEAD1.ColorSeparate( (short) ltocx14n.ColorSeparationConstants.COLORSEP_CMYK );

         // Just for fun, add contrast to the K plane
         LEAD1.setBitmap( LEAD1.getColorPlanes( (short) 3 ) );  // Copy the K plane
         LEAD1.Contrast( (short) 300 );  // Increase the contrast
         LEAD1.setColorPlanes( (short) 3, LEAD1.getBitmap() );  //Update the K plane

         MessageBox.show( "Separated. Keep clicking to see separations, then merge" );
         break ;

      case 1 :
         LEAD1.setBitmap( LEAD1.getColorPlanes( (short) 0 ) );  // Cyan
         LEAD1.ForceRepaint();
         break ;

      case 2 :
         LEAD1.setBitmap( LEAD1.getColorPlanes( (short) 1 ) );  // Magenta
         LEAD1.ForceRepaint();
         break ;

      case 3 :
         LEAD1.setBitmap( LEAD1.getColorPlanes( (short) 2 ) );  // Yellow
         LEAD1.ForceRepaint();
         break;

      case 4 :
         LEAD1.setBitmap( LEAD1.getColorPlanes( (short) 3 ) );  // K
         LEAD1.ForceRepaint();
         break;

      case 5 :
         LEAD1.ColorMerge( (short) ltocx14n.ColorSeparationConstants.COLORSEP_CMYK );
         LEAD1.ForceRepaint();
         LEAD1.setColorPlanes( (short) 0, 0 );
         LEAD1.setColorPlanes( (short) 1, 0 );
         LEAD1.setColorPlanes( (short) 2, 0 );
         LEAD1.setColorPlanes( (short) 3, 0 );
         MessageBox.show( "Merged, with more contrast in the K plane" );
         break ;

      default :
         m_nClickCount = -1;
         MessageBox.show( "Cycle is finished" );
   }

   m_nClickCount++;
   setCursor( Cursor.DEFAULT );  // default
}

5.	Run your program to test it. Notice that you can click the button several times to create the separations, view each of them, and merge them to recreate the original bitmap.


Updating a Progress Bar and Detecting a User Interrupt (Visual J++)

Take the following steps to update a progress bar during processing and detect a user interrupt:

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

2.	 Select the Button control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

3.	In the Properties box, change the Button control's Text property to Do Median.

4.	 Select the Button control; then add another control to your main form. Put the control at the top of the form to keep it away from the image.

5.	In the Properties box, change the Button control's Text property to Quit.

6.	Select the Progress Bar control then add it to your main form. Put the control at the top of the form next to the Quit button.

7.	Add the following private member variables:

private boolean m_bEscape = false;  // Use to indicate the user interrupt
private boolean m_bInProc = false;  // Use to avoid closing the form during processing

8.	Add the following code to the first Button control's Click event:

private void button1_click(Object source, Event e)
{
   // Enable the ProgressStatus event
   LEAD1.setEnableProgressEvent( true );

   // Initialize the indicators
   m_bEscape = false;  // The user does not want to quit
   m_bInProc = true;  // Processing is taking place

   // Perform a relatively slow median filter
   LEAD1.Median( (short) 4 );

   // Clean up
   m_bInProc = false;  // Processing is no longer taking place
   LEAD1.ForceRepaint();
}

9.	Add the following code to the Lead1 control's progressStatus event:

private void LEAD1_progressStatus(Object source, ltocx14n.LEAD.ProgressStatusEvent e)
{
   Application.doEvents();  // Detect Windows events

   if( !m_bEscape )  // Look for the Click on the Quit button
      progressBar1.setValue( e.iPercent );
   else
      LEAD1.setEnableProgressEvent( false );  // Cancel the task
}

10.	Add the following code to the second Button control's Click event:

private void button2_click(Object source, Event e)
{
   m_bEscape = true;  // The user wants to quit
   progressBar1.setValue( 0 );  // Set the progress bar back to the beginning
}

11.	Run your program to test it.


Using a PanWindow (Visual J++)

1.	Start Visual J++ 6.0.

2. 	Add the LEAD Main Control to your project.

On the Tools pull-down menu, use the Customize Toolbox option, chose the ActiveX Controls tab and select the LEAD Main Control (14).

3. 	Select the LEAD Main Control and add the control to your main form.  Size and position the control as you want it to appear at run time.  You may want to size it small so you can observe the changes that occur as you move the PanWin rect

4.	Add a ChechBox to the form and set the Name and Text properties as follows:

Name	Text

checkBox1	Pan Window

5.	Add a Button to the form and set the Name and Text properties as follows:

Name	Text

PanWindow	Show Pan Window

6. 	Code the Form1 constructor as follows:

public Form1()

{

   // Required for Visual J++ Form Designer support

   initForm();

   // TODO: Add any constructor code after initForm call

   // change the path and filename to something present on your system.

   LEAD1.Load( "v:\\images\\eagle.cmp", (short) 0, (short) 0, (short) 1 );

}

7.	Code the PanWindow_click() event as follows:

private void PanWindow_click(Object source, Event e)
{
   // set the location of the PanWindow
   LEAD1.setPanWinX( 100 );
   LEAD1.setPanWinY(100 );

   // set the size of the PanWindow
   // requested width
   LEAD1.setPanWinWidth( 150 );

   // requested height
   LEAD1.setPanWinHeight( 200 );

   // use the icon already being used for LEAD1LEAD1.set
   Icon icon = new Icon( "f:\\point04.ico" );
   LEAD1.setPanWinIcon( icon );

   // set custom pointer
   LEAD1.setPanWinPointer( (short) 99 );

   // use an ICO file present on your system
   LEAD1.setPanWinCursor( icon );
   LEAD1.setPanWinTitle( "PanWindow" );
   LEAD1.setPanWinRectColor( new Color( 0, 0, 255 ) );
   LEAD1.setPanWinSysMenu( true );

   // use the settings for LEAD1LEAD1.set
   LEAD1.setPanWinPaintPalette( LEAD1.getPaintPalette() );
   LEAD1.setPanWinBitonalScaling( LEAD1.getBitonalScaling() );
   LEAD1.setPanWinPaintDither( LEAD1.getPaintDither() );

   //show the Pan Window
   LEAD1.ShowPanWin( true);

   checkBox1.setChecked( true );
}

8. 	Code the LEAD1_panWin event as follows:

private void LEAD1_panWin(Object source, ltocx14n.LEAD.PanWinEvent e)
{
   if( e.iFlag == ltocx14n.PanWinFlagConstants.PANWIN_DESTROYED )
      checkBox1.setChecked( false );  // indicate no more Pan Window
}

9.	Run your program to test it.


Miscellaneous Examples (Visual J++)

You can test any of the following examples by adding a command button to one of the previous lessons in the tutorial, and pasting the sample code in the Click procedure.

In most cases, you can add the button after the first lesson Loading and Displaying an Image. In cases where you need to zoom in or zoom out, you must first finish Zooming Out and Zooming In. In cases where you need to use the Imaging Common Dialog Control, you must first finish Using Imaging Common Dialog.

AboutBox example for Visual J++

AddNoise example for Visual J++

Animate Event Example for Visual J++

AnimationEnable Example for Visual J++

AnnAutoDrawEnable Example for Visual J++

AnnAutomation Property Example for Visual J++

AnnAutoMenuEnable Example for Visual J++

AnnAutoRotate example for Visual J++

AnnChange Event Example for Visual J++

AnnDataPath example for Visual J++

AnnGetHyperlinkParam example for Visual J++

AnnGetHyperlinkString example for Visual J++

AnnGetHyperlinkType example for Visual J++

AnnGetPoint... example for Visual J++

AnnGetSelectList example for Visual J++

AnnHyperlink example for Visual J++

AnnHyperlinkMenu example for Visual J++

AnnHyperlinkMenuEnable example for Visual J++

AnnLock example for Visual J++

AnnLocked example for Visual J++

AnnMove example for Visual J++

AnnRotate example for Visual J++

AnnSaveMemory example for Visual J++

AnnSaveTag example for Visual J++

AnnSelect example for Visual J++

AnnSetAutoText Example for Visual J++

AnnSetHyperlinkString example for Visual J++

AnnShowLockedIcon Example for Visual J++

AnnUnlock Example for Visual J++

AnnUnlocked Example for Visual J++

AnnUnrealize Example for Visual J++

Appearance Example for Visual J++

AutoAnimate Example for Visual J++

AutoSize Example for Visual J++

AutoTrim example for Visual J++

Average example for Visual J++

BackColor example for Visual J++

BackErase example for Visual J++

BinaryFilter example for Visual J++

BitmapAlpha example for Visual J++

BitmapDataPath Example for Visual J++

BitmapXres and BitmapYres example for Visual J++

BitonalScaling example for Visual J++

BorderStyle example for Visual J++

Capture example for Visual J++

Change example for Visual J++

Click and MouseIcon example for Visual J++

ColorRes example for Visual J++

ColorResList Example for Visual J++

Combine example for Visual J++

Comment example for Visual J++

Contrast example for Visual J++

CreateBitmap, Size, and Combine example for Visual J++

dbCan... example for Visual J++

DblClick example for Visual J++

DDB example for Visual J++

DeleteBitmapListItems example for Visual J++

DeletePage example for Visual J++

Deskew example for Visual J++

Despeckle example for Visual J++

DIB example for Visual J++

DrawShape example for Visual J++

DrawText example for Visual J++

Dst... example for Visual J++

Emboss example for Visual J++

EnableMethodErrors example for Visual J++

EnableZoomInRect example for Visual J++

Exif example for Visual J++

FastRotate example for Visual J++

FeedLoad example for Visual J++

FileOpen example for Visual J++

FilePage Event Example for Visual J++

Fill example for Visual J++

Flip example for Visual J++

FloaterDstClip... example for Visual J++

Font example for Visual J++

Frame... example for Visual J++

GammaCorrect example for Visual J++

GetBitmapDC example for Visual J++

GetColorCount Example for Visual J++

GetFileInfo example for Visual J++

GetFloaterHandle example for Visual J++

GetHistogram example for Visual J++

GetMinMaxBits Example for Visual J++

GetMinMaxVal Example for Visual J++

GetPicture and SetPicture example for Visual J++

GetRgnHandle example for Visual J++

Grayscale example for Visual J++

Halftone example for Visual J++

HistoContrast example for Visual J++

HistoEqualize example for Visual J++

Hue example for Visual J++

IgnoreFilters example for Visual J++

InsertBitmapListItem Example for Visual J++

Intensity example for Visual J++

IntensityDetect example for Visual J++

Invert example for Visual J++

ISISAcquire example for Visual J++

ISISAcquireMulti example for Visual J++

IsISISAvailable example for Visual J++

ISISSelect example for Visual J++

ISISSetScanOptions example for Visual J++

IsSupportLocked (ISIS Control) example for Visual J++

KeyPress example for Visual J++

LevelLowBit example for Visual J++

LevelHighBit example for Visual J++

LevelLUT example for Visual J++

LevelLUTLength example for Visual J++

LoadInfo... example for Visual J++

LoadMemory example for Visual J++

LoadUseViewPerspective example for Visual J++

MaxFilter example for Visual J++

MaxVal example for Visual J++

Median example for Visual J++

MinFilter example for Visual J++

MinVal example for Visual J++

Mosaic example for Visual J++

ODBC Example for Visual J++

Oilify example for Visual J++

OLEDropAllowed example for Visual J++

Paint event example for Visual J++

PaintContrast example for Visual J++

PaintDither example for Visual J++

PaintEffect example for Visual J++

PaintGamma example for Visual J++

PaintIntensity example for Visual J++

PaintMaxPasses example for Visual J++

PaintPalette example for Visual J++

PaintROP3 example for Visual J++

PaintSizeMode Example for Visual J++

PaintSizeUseDPI example for Visual J++

PaintWhileLoad example for Visual J++

PaintZoomFactor Example for Visual J++

PatternStyle example for Visual J++

PCDRes example for Visual J++

Picturize example for Visual J++

Pixel example for Visual J++

Posterize example for Visual J++

PreLoadFilters Example for Visual J++

ProgressivePasses Example for Visual J++

ReadLoadResolutions Example for Visual J++

ReadyState Example for Visual J++

Resize event example for Visual J++

RgnChange example for Visual J++

Rotate example for Visual J++

Saturation example for Visual J++

Save example for Visual J++

SaveInterlaced example for Visual J++

SaveMemory example for Visual J++

SavePage example for Visual J++

SaveWithStamp example for Visual J++

Scroll event example for Visual J++

SetRgn... example for Visual J++

SetSrcClipRect example for Visual J++

SetSrcRect example for Visual J++

Sharpen example for Visual J++

Shear example for Visual J++

Solarize example for Visual J++

SpatialFilter example for Visual J++

Src... example for Visual J++

StretchIntensity example for Visual J++

TextWordWrap example for Visual J++

TransitionEffect example for Visual J++

TransparentColor example for Visual J++

Trim example for Visual J++

Underlay example for Visual J++

UnlockSupport (ISIS Control) example for Visual J++

UserPalette and BitmapPalette example for Visual J++

Version... example for Visual J++

WindowLevel example for Visual J++

ZoomIn example for Visual J++

ZoomInDone example for Visual J++


AboutBox example for Visual J++

This example displays the LEADTOOLS ActiveX information.

LEAD1.AboutBox();


AddNoise example for Visual J++

This example adds red noise and redisplays the bitmap.

LEAD1.AddNoise( (short) 500, (short) ltocx14n.ChannelConstants.CHANNEL_RED );
LEAD1.ForceRepaint();


Animate Event Example for Visual J++

This example shows how the Animate event can be used to toggle the use of a button to start and stop the animation.

private void LEAD1_animate(Object source, ltocx14n.LEAD.AnimateEvent e)
{
   if( e.bEnable )
      button1.setText( "&Stop Animation" );
   else
      button1.setText( "&Start animation" );
}

private void button1_click(Object source, Event e)
{
   if( LEAD1.getAnimationEnable() )
      LEAD1.setAnimationEnable( false );
   else
      LEAD1.setAnimationEnable( true ) ;
}


AnimationEnable Example for Visual J++

This example loads and plays an animated file. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

// Load all pages of an AVI file.
LEAD1.Load( "c:\\lead\\images\\sample1.avi", (short) 0, (short) 1, (short) -1 );

// Set properties for a scaled animation.
LEAD1.setAutoRepaint( true );
LEAD1.setAutoSetRects( false );

//  Set the image display size to match the LEAD control.
LEAD1.SetDstRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
LEAD1.SetDstClipRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );

//  Allow a continuous loop.
LEAD1.setAnimationLoop( true );

//  Start the animation.
LEAD1.setAnimationEnable( true );


AnnAutoDrawEnable Example for Visual J++

Note: This topic is for Document/Medical  only.

This example toggles the AnnAutoDrawEnable property.

if( LEAD1.getAnnAutoDrawEnable() )
   LEAD1.setAnnAutoDrawEnable( false );
else
   LEAD1.setAnnAutoDrawEnable( true );


AnnAutomation Property Example for Visual J++

Note: This topic is for Document/Medical  only.

This example shows how you can use the AnnAutomation property to access the automation object through DLL functions.

// Declare LEAD ltann14n.dll functions.
/** @dll.import("ltann14n") */
private static native int L_AnnGetFontBold( int hObject, boolean pfFontBold [] );
/** @dll.import("ltann14n") */
private static native int L_AnnSetFontBold( int hObject, boolean fFontBold, int uFlags );

private void button1_click(Object source, Event e)
{
   int hAnnObject = LEAD1.getAnnAutomation();

   // Set the default font to bold, unless it already is
   boolean bIsBold[] = { false };
   L_AnnGetFontBold( hAnnObject, bIsBold );
   if( bIsBold[ 0 ] )
      MessageBox.show( "Already bold", "Notice", MessageBox.OK ) ;
   else
      L_AnnSetFontBold( hAnnObject, true, 0 );
}


AnnAutoMenuEnable Example for Visual J++

Note: This topic is for Document/Medical  only.

This example toggles the AnnAutoMenuEnable property.

if( LEAD1.getAnnAutoMenuEnable() )
   LEAD1.setAnnAutoMenuEnable( false );
else
   LEAD1.setAnnAutoMenuEnable( true );


AnnAutoRotate example for Visual J++

Note: This topic is for Document/Medical  only.

This example enables automatic rotation of annotations, then rotates the bitmap 2222 hundredths of degrees to demonstrate the automation:

LEAD1.setAnnAutoRotate( true );
LEAD1.Rotate( 2222, ROTATE_RESIZE, new Color( 0, 0, 255 ) );


AnnChange Event Example for Visual J++

Note: This topic is for Document/Medical  only.

This example tests the AnnChange event.

private void LEAD1_annChange(Object source, ltocx14n.LEAD.AnnChangeEvent e)
{
   String str = "This is a change for the button tagged " + LEAD1.AnnGetTag( e.hObject );
   MessageBox.show( str, "NOTE", MessageBox.OK ) ;
}


AnnDataPath example for Visual J++

Note: This topic is for Document/Medical  only.

This example shows how to load an annotation file from the Internet.

LEAD1.setAnnDataPath( "ftp://ftp.leadtools.com/vbaward.ann" );


AnnGetHyperlinkParam example for Visual J++

Note: This topic is for Document/Medical  only.

This example retrieves parameters using AnnGetHyperlinkParam.

private void LEAD1_annChange(Object source, ltocx14n.LEAD.AnnChangeEvent e)
{
   String strMsg = new String();
   short sType = LEAD1.AnnGetHyperlinkType( e.hObject );
   if( sType == ltocx14n.AnnHyperlinkTypeConstants.ANNLINK_ANNEVENT5 )
   {
      strMsg = "Params are:\n";
      for( short sParamCount = 0 ; sParamCount < 5 ; sParamCount++ )
      {
         int nRet = LEAD1.AnnGetHyperlinkParam( e.hObject, sParamCount );
         strMsg += "   Param" + ( sParamCount + 1 ) + ": " + nRet + "\n";
      }
   }
   else
      strMsg = "Invalid Type";

   MessageBox.show( strMsg );
}


AnnGetHyperlinkString example for Visual J++

Note: This topic is for Document/Medical  only.

The following example places calls to both the AnnSetHyperlinkString method and the AnnGetHyperlinkString method.

private void LEAD1_annHyperlinkMenu(Object source, ltocx14n.LEAD.AnnHyperlinkMenuEvent e)
{
   // Set AnnHyperLink to a URL
   for( int x = 0 ; x < e.uCount ; x++ )
   {
      int hObject = e.aObjects.toSafeArray().getInt( x );
      LEAD1.AnnSetHyperlinkString( hObject, (short) ltocx14n.AnnHyperlinkTypeConstants.ANNLINK_WEBPAGE, "http://www.leadtools.com" );

      // get the string to see what got set
      String strLink = LEAD1.AnnGetHyperlinkString( hObject );
      MessageBox.show( strLink );
   }
}


AnnGetHyperlinkType example for Visual J++

Note: This topic is for Document/Medical  only.

The following is an example of AnnHyperlink event code which includes a call to AnnGetHyperlinkType.

private void LEAD1_annHyperlink(Object source, ltocx14n.LEAD.AnnHyperlinkEvent e)
{
   short sType = LEAD1.AnnGetHyperlinkType( e.hObject );

   String strMsg = new String();
   if( sType == ltocx14n.AnnHyperlinkTypeConstants.ANNLINK_ANNEVENT5 || sType ==ltocx14n.AnnHyperlinkTypeConstants.ANNLINK_ANNEVENT )
   {
      if( e.iParamCount >=0 ) strMsg = e.iParamCount + " params are valid\n";
      if( e.iParamCount >= 1 ) strMsg += "Param1: " + e.lParam1 + "\n";
      if( e.iParamCount >= 2 ) strMsg += "Param2: " + e.lParam2 + "\n";
      if( e.iParamCount >= 3 ) strMsg += "Param3: " + e.lParam3 + "\n";
      if( e.iParamCount >= 4 ) strMsg += "Param4: " + e.lParam4 + "\n";
      if( e.iParamCount == 5 ) strMsg += "Param5: " + e.lParam5 + "\n";
   }
   else
      strMsg = "Invalid Type";
   MessageBox.show( strMsg );
}


AnnGetPoint example for Visual J++
AnnGetPoint... example for Visual J++

Note: This topic is for Document/Medical  only.

In the AnnDrawn event, this example checks to see if the annotation object is a polygon. If it is a polygon, the example gets the number of points that define the object; then it gets the arrays of X and Y coordinates and displays the points in a message box.

private void LEAD1_annDrawn(Object source, ltocx14n.LEAD.AnnDrawnEvent e)
{
   short sType = LEAD1.AnnGetType( e.hObject );
   if( sType == ltocx14n.AnnObjectConstants.ANNOBJECT_POLYGON )  // Is the object a polygon?
   {
      MessageBox.show( "Object is a Polygon" );
      int nPoints = LEAD1.AnnGetPointCount( e.hObject );  // get the number of points
      SafeArray xPoints = LEAD1.AnnGetPointX( e.hObject ).toSafeArray();  // get the X coordinates
      SafeArray yPoints = LEAD1.AnnGetPointY( e.hObject ).toSafeArray();  // get the Y coordinates

      String strMsg = "(";
      for( int a = 0 ; a < nPoints ; a++ )
         strMsg += "{" + xPoints.getInt( a ) + "," + yPoints.getInt( a ) + "}";
      strMsg += ")";
      MessageBox.show( strMsg, "The Polygon's " + nPoints + " points are:", MessageBox.OK );
   }
}


AnnGetSelectList example for Visual J++

Note: This topic is for Document/Medical  only.

This example gets the number of selected annotation objects; then it gets an array of the selected object handles and checks to see if any of the objects in the array are polygons.

short sCount = LEAD1.AnnGetSelectCount();  // get number of selected objects
MessageBox.show( sCount + " objects were selected" );
Variant aObjects = LEAD1.AnnGetSelectList();  // get the handles of the selected objects
boolean bSelected = false;
for( int a = 0 ; a < sCount ; a++ )
{
   short sType = LEAD1.AnnGetType( aObjects.toSafeArray().getInt( a ) );
   if( sType == ltocx14n.AnnObjectConstants.ANNOBJECT_POLYGON )  // Is the object a
olygon?
      bSelected = true;
}

if( !bSelected )
   MessageBox.show( "No Polygon Objects were selected" );


AnnHyperlinkMenu example for Visual J++

Note: This topic is for Document/Medical  only.

The following is an example of AnnHyperlinkMenu event code, which includes a call to AnnSetHyperlinkMsg.

private void LEAD1_annHyperlinkMenu(Object source, ltocx14n.LEAD.AnnHyperlinkMenuEvent e)
{
   // set HyperLink to type ANNLINK_ANNEVENT5
   // and set the 5 params to some values.
   for( int x = 0 ; x < e.uCount ; x++ )
      LEAD1.AnnSetHyperlinkMsg( e.aObjects.toSafeArray().getInt( x ), (short) ltocx14n.AnnHyperlinkTypeConstants.ANNLINK_ANNEVENT5, 5, 4, 3, 2, 1 );
}


AnnHyperlinkMenuEnable example for Visual J++

Note: This topic is for Document/Medical  only.

This example toggles the AnnHyperlinkMenuEnable property .

// toggle AnnHyperLinkMenu item and event
if( LEAD1.getAnnHyperlinkMenuEnable() )
   LEAD1.setAnnHyperlinkMenuEnable( false );
else
   LEAD1.setAnnHyperlinkMenuEnable( true );


AnnLock example for Visual J++

Note: This topic is for Document/Medical  only.

This example locks objects of type ANNOBJECT_ELLIPSE using the key "IkeStarnes".

// lock only the ellipse objects that are selected

boolean bSelected = false;
short sCount = LEAD1.AnnGetSelectCount();  // get number of selected objects
Variant aObjects = LEAD1.AnnGetSelectList();  // get the handles of the selected objects
for( int a = 0 ; a < sCount ; a++ )
{
   int hObject = aObjects.toSafeArray().getInt( a );
   short sType = LEAD1.AnnGetType( hObject );
   if( sType == ltocx14n.AnnObjectConstants.ANNOBJECT_ELLIPSE )  // Is the object an ellipse?
   {
      bSelected = true;
      LEAD1.AnnLock( hObject, "IkeStarnes", false );
   }
}

if( !bSelected )
   MessageBox.show( "No Ellipse Objects were selected" );


AnnLocked example for Visual J++

Note: This topic is for Document/Medical  only.

The following is an example of an AnnLocked event.

private void LEAD1_annLocked(Object source, ltocx14n.LEAD.AnnLockedEvent e)
{
   MessageBox.show( "AnnObject: " + e.hObject + " was locked!" );
}


AnnMove example for Visual J++

Note: This topic is for Document/Medical  only.

This example moves one or more selected annotation objects.

// Specify arbitrary delta values.
int nDeltaX = +20;
int nDeltaY = -20;

// Move the selected annotations.
LEAD1.AnnMove( nDeltaX, nDeltaY, true );


AnnRotate example for Visual J++

Note: This topic is for Document/Medical  only.

This example uses the AnnFlip, AnnReverse, and AnnRotate methods. To code this example, add a command button named Test to the example you created in Loading and Displaying an Image. For best results when you run the example, draw two objects in opposite corners, and use the right mouse button to select all annotation objects. The command button then lets you cycle through the AnnFlip, AnnReverse, and AnnRotate methods.

private void Test_click(Object source, Event e)
{
   String strMyCaption = Test.getText();
   if( strMyCaption.equals( "Flip" ) )
   {
      // Flip using the center of the bitmap as the axis.
      LEAD1.AnnFlip( true, LEAD1.getBitmapHeight() / 2, true );
      Test.setText( "Reverse" );
   }
   else
      if( strMyCaption.equals( "Reverse" ) )
      {
         // Reverse using the center of the bitmap as the axis.
         LEAD1.AnnReverse( true, LEAD1.getBitmapWidth() / 2, true );
         Test.setText( "Rotate" );
      }
      else
      if( strMyCaption.equals( "Rotate" ) )
      {
         // Rotate 90 degrees using the center of the bitmap as the axis.
         LEAD1.AnnRotate( true, LEAD1.getBitmapWidth() / 2, LEAD1.getBitmapHeight() / 2, 90, true );
         Test.setText( "Flip" );
      }
   else
   {
      Test.setText( "Flip" );
      LEAD1.setAnnUserMode( (short) ltocx14n.AnnUserModeConstants.ANNUSERMODE_DESIGN );
      LEAD1.setAnnTool( (short) ltocx14n.AnnToolConstants.ANNTOOL_REDACT );
      MessageBox.show( "Draw two objects," + "use the right mouse button to select all, then click the command button" );
   }
}


AnnSaveMemory example for Visual J++

Note: This topic is for Document/Medical  only.

This example lets you save the current annotations to a file in memory, and lets you load the annotations that were saved.

1.	Start with the project that you created in Creating and Using Annotations.

2.	Add the following to the private section of your main form:

/** @dll.import("Kernel32") */
private static native int GlobalFree( int hMem );

private int m_hMem;
private int m_iSize;

3.	 At the top of your main form, add two buttons and name them as follows:

Name	Text

AnnSaveMem	Save In Memory

AnnLoadMem	Load From Memory

4.	Code the AnnSaveMem button's Click event as follows:

int nMem[]  = new Variant( new SafeArray( Variant.VariantInt, 1 ) ).toSafeArray().toIntArray();
int nSize[] = new Variant( new SafeArray( Variant.VariantInt, 1 ) ).toSafeArray().toIntArray();
nMem[0] = 0;
if( LEAD1.AnnSaveMemory( nMem, (short) ltocx14n.AnnFormatConstants.ANNFMT_NATIVE, false, nSize  ) != 0 )
   MessageBox.show( "Error calling AnnSaveMemory" );
else
{
   m_hMem = nMem[ 0 ];
   m_iSize = nSize[ 0 ];
}

5.	Code the AnnLoadMem button's Click event as follows:

// Load the annotations from the memory-resident file.
if( LEAD1.AnnLoadMemory( m_hMem, m_iSize ) != 0 )
   MessageBox.show( "Error calling AnnLoadMemory" );
else
   MessageBox.show( "AnnLoadMemory succeeded" );

GlobalFree( m_hMem );

6.	Run your program to test it.


AnnSaveTag example for Visual J++

Note: This topic is for Document/Medical only.

The following example saves selected objects as a Wang compatible TIFF tag.

// Save only selected objects in Wang TIFF tag
LEAD1.AnnSaveTag( true, true );

LEAD1.Save( "c:\\temp\\testwang.tif", (short) ltocx14n.FileConstants.FILE_CCITT_GROUP4, (short) 1, (short) 2, (short) ltocx14n.SaveModifyConstants.SAVE_OVERWRITE );


AnnSelect example for Visual J++

Note: This topic is for Document/Medical only.

This example for the AnnSelect event displays a message box showing the number of selected annotation objects. It then goes through the array of selected objects to see if any of them are polygons.

private void LEAD1_annSelect(Object source, ltocx14n.LEAD.AnnSelectEvent e)
{
   boolean bSelected = false;
   MessageBox.show( e.uCount + " objects were selected" );
   for( int x = 0 ; x < e.uCount ; x ++ )
   {
      short sType = LEAD1.AnnGetType( e.aObjects.toSafeArray().getInt( x ) );
      if( sType == ltocx14n.AnnObjectConstants.ANNOBJECT_POLYGON )
         bSelected = true;
   }
   if( !bSelected )
      MessageBox.show( "No Polygon Objects were selected" );
}


AnnSetAutoText Example for Visual J++

Note: This topic is for Document/Medical  only.

This example modifies the text string that is used for the undo option on the annotation pop-up menu.

String strText = LEAD1.AnnGetAutoText( (short) ltocx14n.AnnAutoTextConstants.ANNAUTOTEXT_MENU_UNDO );
strText += " - New";
LEAD1.AnnSetAutoText( (short) ltocx14n.AnnAutoTextConstants.ANNAUTOTEXT_MENU_UNDO, strText );


AnnShowLockedIcon Example for Visual J++

Note: This topic is for Document/Medical only.

This example toggles the AnnShowLockedIcon property.

// Toggle AnnShowLockedIcon
if( LEAD1.getAnnShowLockedIcon() )
   LEAD1.setAnnShowLockedIcon( false );
else
   LEAD1.setAnnShowLockedIcon( true );


AnnUnlock Example for Visual J++

Note: This topic is for Document/Medical  only.

This is also the example for AnnGetLocked method.

If an object is found to be locked, using AnnGetLocked method, the object is unlocked, by AnnUnlock, using the key "IkeStarnes".

boolean bLocked = LEAD1.AnnGetLocked( ghObject );
if( bLocked )
   LEAD1.AnnUnlock( ghObject, "IkeStarnes" );


AnnUnlocked Example for Visual J++

Note: This topic is for Document/Medical  only.

The following is an example of an AnnUnlocked event.

private void LEAD1_annUnlocked(Object source, ltocx14n.LEAD.AnnUnlockedEvent e)
{
   MessageBox.show( "AnnObject: " + e.hObject + " was unlocked!" );
}


AnnUnrealize Example for Visual J++

Note: This topic is for Document/Medical only.

The following example calls the AnnUnrealize method.

// Unrealize all redact objects in the container
LEAD1.AnnUnrealize( LEAD1.getAnnContainer(), false );


Appearance Example for Visual J++

This example toggles the Appearance property.

if( LEAD1.getAppearance() == ltocx14n.AppearanceConstants.APPEARANCE_FLAT )
   LEAD1.setAppearance( (short) ltocx14n.AppearanceConstants.APPEARANCE_THREED );
else
   LEAD1.setAppearance( (short) ltocx14n.AppearanceConstants.APPEARANCE_FLAT );


AutoAnimate Example for Visual J++

This example gets information about an animated file, uses the information to position the LEAD control, and plays the animation as it loads the file.

// Force continued looping after the file loads.
LEAD1.setAutoAnimationLoop( (short) ltocx14n.AutoAnimationLoopConstants.AUTOANIMATIONLOOP_INFINITE );

// Get information about the file we will load.
LEAD1.GetFileInfo( "c:\\lead\\images\\sample1.avi", (short) 0, 0 );

// Exit if this is not an animated file.
if( !LEAD1.getInfoAnimation() )
   MessageBox.show( "Not an animated file", "Error", MessageBox.OK );
else
{
   // Calculate information for centering the LEAD control.
   // Set the variables used for preserving the aspect ratio.
   // Allow for a border of 1/8 of the form size.
   // The units of measure do not matter, since we are calculating proportions.
   int nHeightFactor  = (int) LEAD1.getInfoHeight();
   int nWidthFactor   = (int) LEAD1.getInfoWidth();
   int nHeightAllowed = getWidth() * 3 / 4;
   int nWidthAllowed  = getHeight() * 3 / 4;

   // Center the LEAD control on the form, preserving the aspect ratio.
   // Check to see if using the maximum width will make the image too tall.
   // Set the dimensions based on the result.
   Rectangle rectLead = new Rectangle();
   if( ( ( nWidthAllowed * nHeightFactor ) / nWidthFactor ) < nHeightAllowed )
   {
      rectLead.x      = getWidth() / 8;
      rectLead.width  = nWidthAllowed;
      rectLead.height = ( LEAD1.getWidth() * nHeightFactor ) / nWidthFactor;
      rectLead.y      = ( getHeight()  - LEAD1.getHeight() ) / 2;
   }
   else
   {
      rectLead.y      = getHeight() / 8;
      rectLead.height = nHeightAllowed;
      rectLead.width  = ( LEAD1.getHeight() * nWidthFactor ) / nHeightFactor;
      rectLead.x      = ( getWidth() - LEAD1.getWidth() ) / 2;
   }

   LEAD1.setLocation( rectLead.x, rectLead.y );
   LEAD1.setSize( rectLead.width, rectLead.height );

   // Set properties for playing the animation as is loads.
   LEAD1.setAutoAnimate( true );
   LEAD1.setAutoRepaint( true );
   //  Load the animated file.
   LEAD1.Load( "c:\\lead\\images\\sample1.avi", (short) 0, (short) 0, (short) -1 );
}


AutoSize Example for Visual J++

This example shows how the AutoSize property works when loading and when rotating an image.

LEAD1.setAutoSize( true );
LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );
MessageBox.show( "Control is sized to fit the loaded bitmap" );
LEAD1.Rotate( 4500, ROTATE_RESIZE, new Color( 0, 0, 0 ) );
MessageBox.show( "Control is sized to fit the rotated bitmap" );


AutoTrim example for Visual J++

This example scans a document and trims the edges.

// Make sure display rectangles are reset when we acquire the image.
LEAD1.setAutoSetRects( true );

// Disable automatic repainting.
LEAD1.setAutoRepaint( false );

// Acquire the image, allowing for possible mistakes.
boolean bSavedSetting = LEAD1.getEnableMethodErrors();
LEAD1.setEnableMethodErrors( false );
short sRet = LEAD1.Load("d:\temp\test.tif", 0, 1, 1);
if( sRet != 0 )
{
   MessageBox.show( "image not loaded" );
   LEAD1.setEnableMethodErrors( bSavedSetting );
   return;
}
LEAD1.setEnableMethodErrors( bSavedSetting );

// Trim the edges of the acquired bitmap.
LEAD1.AutoTrim( (short) 64 );

// Use the whole window.
LEAD1.setLocation( 0, 0 );
LEAD1.setSize( getWidth(), getHeight() );

// Set up for good display of a typical scanned document.
LEAD1.setBitonalScaling( (short) ltocx14n.BitonalScalingConstants.BITONALSCALING_SCALETOGRAY );
LEAD1.setAutoScroll( true );
LEAD1.setDstWidth( LEAD1.getScaleWidth() ); // Use the full control width.
LEAD1.setDstClipWidth( LEAD1.getScaleWidth() );
int nCalcHeight = (int) ( ( LEAD1.getBitmapHeight() * LEAD1.getScaleWidth() ) / LEAD1.getBitmapWidth() );
LEAD1.setDstHeight( nCalcHeight );  // Use the proportional height.
LEAD1.setDstClipHeight( nCalcHeight );

// Enable automatic repainting.
LEAD1.setAutoRepaint( true );


Average example for Visual J++

This example applies an average filter with a 3x3 neighborhood and redisplays the bitmap.

LEAD1.Average( (short) 3 );
LEAD1.ForceRepaint();


BackColor example for Visual J++

This example sets the background color to red. You can zoom out to see the background color.

LEAD1.setBackColor( new Color( 255, 0, 0 ) );


BackErase example for Visual J++

This example turns off repainting of the background, then zooms out to show the effect when repainting.

LEAD1.setBackErase( false );
LEAD1.setAutoRepaint( false );
LEAD1.setAutoScroll( false );
// Calculate the values to zoom out by 10 percent and center the image.
LEAD1.setDstWidth( LEAD1.getDstWidth() * 0.9f );
LEAD1.setDstHeight( LEAD1.getDstHeight() * 0.9f );
LEAD1.setDstTop( (LEAD1.getScaleHeight() - LEAD1.getDstHeight() ) / 2 );
LEAD1.setDstLeft( (LEAD1.getScaleWidth() - LEAD1.getDstWidth() ) / 2 );
// Set the clipping area to the same as the destination rectangle
LEAD1.setDstClipWidth( LEAD1.getDstWidth() );
LEAD1.setDstClipHeight( LEAD1.getDstHeight() );
LEAD1.setDstClipTop( LEAD1.getDstTop() );
LEAD1.setDstClipLeft( LEAD1.getDstLeft() );

//Redisplay the image
LEAD1.ForceRepaint();


BinaryFilter example for Visual J++

This example does omni-directional erosion of black objects and repaints the image.

LEAD1.BinaryFilter( (short) ltocx14n.BinaryFilterConstants.BFLT_EROSION_OMNI );
LEAD1.ForceRepaint();


BitmapAlpha example for Visual J++

This example shows how to use the BitmapAlpha property to save a region in a file's alpha channel. It also shows how to use the region as a mask for transparency.

LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );
LEAD1.setAutoRepaint( false );
// Get an alpha channel bitmap, and fill it with white
LEAD2.setBitmap( LEAD1.getBitmapAlpha() );
LEAD2.Fill( new Color( 255, 255, 255 ) );
int nRgnTop = 0;
int nRgnLeft = 0;
int nRgnWidth = (int) LEAD1.getBitmapWidth();
int nRgnHeight = (int) LEAD1.getBitmapHeight();

// Create an elliptical region in the AlphaBitmap
LEAD2.SetRgnEllipse( nRgnTop, nRgnLeft, nRgnWidth, nRgnHeight, (short) ltocx14n.RgnCombineModeConstants.L_RGN_SET );
// Fill the region with black
LEAD2.Fill( new Color( 0, 0, 0 ) );
// Free the region
LEAD2.FreeRgn();
// Update the alpha channel in the main bitmap
LEAD1.setBitmapAlpha( LEAD2.getBitmap() );
// Save the bitmap as 32-bit TGA
LEAD1.Save( "test.tga", (short) ltocx14n.FileConstants.FILE_TGA, (short) 32, (short) 0, (short) ltocx14n.SaveModifyConstants.SAVE_OVERWRITE );
// Free the bitmaps
LEAD1.setBitmap( 0 );
LEAD2.setBitmap( 0 );

// Load the bitmap we just saved and get the alpha channel
LEAD1.Load( "test.tga", (short) 0, (short) 0, (short) 1 );
LEAD2.setBitmap( LEAD1.getBitmapAlpha() );
// Create a region in the AlphaBitmap that includes all of the black pixels
LEAD2.SetRgnColor( new Color( 0, 0, 0 ), (short) ltocx14n.RgnCombineModeConstants.L_RGN_SET );
// Get the region from the AlphaBitmap and set it into the main bitmap
int hRGN = LEAD2.GetRgnHandle();
LEAD1.SetRgnHandle( hRGN, 0, 0, (short) ltocx14n.RgnCombineModeConstants.L_RGN_SET );
LEAD1.setPaintRgnOnly( true );
LEAD1.ForceRepaint();


BitmapDataPath Example for Visual J++

This example shows how to load an image from the Internet. It uses the BitmapDataPath property to start the asynchronous load; then uses the ReadyStateChange event to paint the image when loading is complete.

private void button1_click(Object source, Event e)
{
   // Start the asynchronous load.
   LEAD1.setBitmapDataPath( "http://www.leadtools.com/images/vbaward.jpg" );
}

private void LEAD1_readyStateChange(Object source, ltocx14n.LEAD.ReadyStateChangeEvent e)
{
   // Paint the image when loading is complete.
   if( e.ReadyState == ltocx14n.ReadyStateConstants.READYSTATE_COMPLETE )
   {
      LEAD1.setAutoSetRects( true );
      LEAD1.setPaintSizeMode( (short) ltocx14n.PaintSizeModeConstants.PAINTSIZEMODE_FIT );
      LEAD1.ForceRepaint();
   }
}


BitmapXres and BitmapYres example for Visual J++

This example sets the bitmap's resolution to 300 x 600 DPI.

LEAD1.setBitmapXRes( (short) 300 );
LEAD1.setBitmapYRes( (short) 600 );


BitonalScaling example for Visual J++

This example sets the display to use scale-to-gray and repaints the image. This affects only 1-bit images.

if( LEAD1.IsSupportLocked( (short) ltocx14n.SupportLockConstants.L_SUPPORT_DOCUMENT ) )
   MessageBox.show( "No scale to gray - You need to unlock Document/Medical capabilities" );
else
{
   LEAD1.setBitonalScaling( (short) ltocx14n.BitonalScalingConstants.BITONALSCALING_SCALETOGRAY );
   LEAD1.ForceRepaint();
}


BorderStyle example for Visual J++

This example toggles the border style and repaints the image.

if( LEAD1.getBorderStyle() == 1 )
   LEAD1.setBorderStyle( (short) 0 );
else
   LEAD1.setBorderStyle( (short) 1 );
LEAD1.ForceRepaint();


Capture example for Visual J++

This example captures the current form and displays the captured image with scroll bars.

// Turn on the automatic display rectangles.
LEAD1.setAutoSetRects( true );
LEAD1.Capture( 0, getLeft(), getTop(), getWidth(), getHeight() );
LEAD1.setAutoScroll( true );
LEAD1.ForceRepaint();


Change example for Visual J++

Typically, you would use this event to flag changed image data and prompt the user to save the changes before closing a window or exiting an application.  That use of the event cannot be tested properly without writing a complete application; so this example just shows you a simple test of the event.

private void LEAD1_change(Object source, Event e)
{
   MessageBox.show( "Image data changed" );
}


Click and MouseIcon example for Visual J++

This example demonstrates the Click event and the MouseIcon property.

private void LEAD1_click(Object source, Event e)
{
   // This example, on a click event, toggles between the default
   // mouse pointer and a loaded icon.
   if( LEAD1.getMousePointer() == 0 )
   {
      LEAD1.setMouseIcon( new Icon( "f:\\vb\\icons\\arrows\\point04.ico" ) );
      LEAD1.setMousePointer( (short) 99 );
   }
   else
      LEAD1.setMousePointer( (short) 0 );
}


ColorRes example for Visual J++

This example checks to see if the bitmap is 8 bits per pixel and converts it if it is not.

if( LEAD1.getBitmapBits() != 8 )
{
   setCursor( Cursor.WAIT );  // hourglass
   LEAD1.ColorRes( (short) 8, (short) ltocx14n.ColorResPaletteConstants.CRP_OPTIMIZEDPALETTE, (short) ltocx14n.ColorResDitherConstants.CRD_FLOYDSTEINDITHERING, (short) 0 );
   LEAD1.ForceRepaint();
   setCursor( Cursor.ARROW );  // default
}


ColorResList Example for Visual J++

This example changes the hue of bitmaps in a list, then plays the list as an animation. When changing the hue, it preserves the transparent color.

// Save the current transparent color.
Color clrTransparent = LEAD1.getBitmapTransparentColor();

// Avoid repaints while we modify the bitmaps.
LEAD1.setAutoRepaint( false );

// Change the hue of each bitmap in the list,
// and restore the transparent color as the last color in the palette.
short sCount = LEAD1.getBitmapListCount();
for( short i = 0 ; i < sCount ; i ++ )
{
   LEAD1.setBitmapListIndex( i );
   LEAD1.Hue( (short) ( i * 10 ) );
   LEAD1.setBitmapPalette( (short) 255, clrTransparent );
}

// Get an optimized palette for the whole list.
LEAD1.ColorResList( (short) 8, (short) ltocx14n.ColorResPaletteConstants.CRP_OPTIMIZEDPALETTE, (short) ltocx14n.ColorResDitherConstants.CRD_NODITHERING, (short) 0 );

// Update the palette that is used for playback.
for( short i = 0 ; i < 256 ; i ++ )
   LEAD1.setAnimationPalette( i, LEAD1.getBitmapPalette( i ) );

// Start the animation.
LEAD1.setAutoRepaint( true );
LEAD1.setAnimationEnable( true );


Combine example for Visual J++

This example copies the Lead1 bitmap to Lead2, trims and filters the copied image, and combines the filtered image with the original Lead1 bitmap image. Trimming Lead2 lets you see the difference between filtered and nonfiltered regions.

setCursor( Cursor.WAIT );  // hourglass
LEAD2.setBitmap( LEAD1.getBitmap() );
int nTrimLeft   = (int) ( LEAD2.getBitmapWidth()  * 0.2f );
int nTrimTop    = (int) ( LEAD2.getBitmapHeight() * 0.2f );
int nTrimWidth  = (int) ( LEAD2.getBitmapWidth()  * 0.6f );
int nTrimHeight = (int) ( LEAD2.getBitmapHeight() * 0.6f );
LEAD2.Trim( nTrimLeft, nTrimTop, nTrimWidth, nTrimHeight );
LEAD2.SpatialFilter( (short) ltocx14n.SpatialFilterConstants.FLT_LINESEG_LTOR );
int nDstLeft   = nTrimLeft;
int nDstTop    = nTrimTop;
int nDstWidth  = nTrimWidth;
int nDstHeight = nTrimHeight;
int nSrcLeft = 0;
int nSrcTop  = 0;
LEAD1.Combine( nDstLeft, nDstTop, nDstWidth, nDstHeight, LEAD2.getBitmap(), nSrcLeft, nSrcTop, ltocx14n.CombineConstants.CB_OP_ADD );

LEAD1.ForceRepaint();
setCursor( Cursor.DEFAULT );  // default


Comment example for Visual J++

This example does the following:

1.	Loads an image from a TIFF file.

2.	Updates the current comment array by reading comments from the file.

3.	Modifies one of the comments.

4.	Modifies and saves the file.

5.	Reads the comment that was saved, and displays it in a message box.

This example handles only string comments. For more complex comments, refer to Exif Examples.

// Specify the file that we will update.
String strFilePath = "d:\\lead\\images\\testcmt.tif";

// Get all of the current comments from the file.
// Temporarily disable method errors so that we do not fail when comments are missing.
LEAD1.setEnableMethodErrors( false );
for( short i = 0 ; i < ltocx14n.CommentConstants.CMNT_LAST ; i ++ )
{
   LEAD1.setComment( i, new Variant() );
   LEAD1.setComment( i, LEAD1.ReadComment( strFilePath, (short) 0, i ) );
}
LEAD1.setEnableMethodErrors( true );

// Load and modify the image.
LEAD1.Load( strFilePath, (short) 0, (short) 0, (short) 1 );
LEAD1.Reverse();

// Update the CMNT_SZDESC comment.
String strMyComment = "This image has been reversed.";
String strOldComment = LEAD1.getComment( (short) ltocx14n.CommentConstants.CMNT_SZDESC ).toString() ;
String strTempComment = strOldComment + strMyComment;
LEAD1.setComment( (short) ltocx14n.CommentConstants.CMNT_SZDESC, new Variant( strTempComment ) );

// Save the file and read the comment that we saved.
LEAD1.Save( strFilePath, (short) ltocx14n.FileConstants.FILE_TIF, LEAD1.getBitmapBits(), (short) 0, (short) ltocx14n.SaveModifyConstants.SAVE_OVERWRITE );
String strNewComment = LEAD1.ReadComment( strFilePath, (short) 0, (short) ltocx14n.CommentConstants.CMNT_SZDESC ).toString();

// Display the message
MessageBox.show( strNewComment );

// Clear the comments from memory
for( short i = 0 ; i < ltocx14n.CommentConstants.CMNT_LAST ; i++ )
   LEAD1.setComment( i, new Variant() );


Contrast example for Visual J++

This example increases the contrast and repaints the image.

LEAD1.Contrast( (short) 50 );
LEAD1.ForceRepaint();


CreateBitmap, Size, and Combine example for Visual J++

This example creates a bitmap for Lead2 (same size and BPS as Lead 1) and fills it with green. It resizes the Lead1 bitmap, then uses a loop to do multiple combines with the Lead2 bitmap. It then copies the Lead2 bitmap to Lead1 and redisplays Lead1.

setCursor( Cursor.WAIT );  // hourglass

// Create the Lead2 bitmap. (The control must already be on the form).
int nMyWidth  = (int) LEAD1.getBitmapWidth();
int nMyHeight = (int) LEAD1.getBitmapHeight();
short sMyBPS = LEAD1.getBitmapBits();
LEAD2.CreateBitmap( nMyWidth, nMyHeight, sMyBPS );
LEAD2.Fill( new Color( 0, 255, 0 ) );  // fill with green

// Resize the Lead1 bitmap
int nImageWidth  = (int) ( nMyWidth  * 0.3f );
int nImageHeight = (int) ( nMyHeight * 0.3f );
LEAD1.Size( nImageWidth, nImageHeight, (short) ltocx14n.ResizeConstants.RESIZE_RESAMPLE );

// Initialize the variables used for multiple combines.
int nTestWidth  = nMyWidth;   // Used for horizontal positioning
int nTestHeight = nMyHeight;  // Used for vertical positioning

int nVFactor  = nMyHeight / nImageHeight + 1;  // Number spaces between images
int nVSpacing = ( nMyHeight % nImageHeight ) / nVFactor;  // Pixels between images
int nHFactor  = nMyWidth / nImageWidth + 1;  // Number spaces between images
int nHSpacing = ( nMyWidth % nImageWidth ) / nHFactor;  // Pixels between images
int nDstT = nVSpacing;  // Top coordinate of the destination rectangle
int nSrcL = 0;  // Left coordinate of the source rectangle
int nSrcT = 0;  // Top coordinate of the source rectangle
int nDstW = nImageWidth;   // Width of the destination rectangle
int nDstH = nImageHeight;  // Height of the destination rectangle
int nMyOp = ltocx14n.CombineConstants.CB_OP_ADD | ltocx14n.CombineConstants.CB_DST_0;  // Operation flags used when combining images

// Do the loop that does the multiple combines
while( nTestHeight > nImageHeight )  // Vertical loop
{
   nDstT = nMyHeight - nTestHeight + nVSpacing;
   nTestHeight -= nImageHeight - nVSpacing;
   while( nTestWidth > nImageWidth )  //Horizontal loop
   {
      int nDstL = nMyWidth - nTestWidth + nHSpacing;
      nTestWidth -= nImageWidth - nHSpacing;
      LEAD2.Combine( nDstL, nDstT, nDstW, nDstH, LEAD1.getBitmap(), nSrcL, nSrcT, nMyOp );
   }
   nTestWidth = nMyWidth;
}
// Copy the Lead2 bitmap to Lead1
LEAD1.setBitmap( LEAD2.getBitmap() );

// Set the image display size to match the LEAD control
LEAD1.SetDstRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
LEAD1.SetDstClipRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
LEAD1.ForceRepaint();
setCursor( Cursor.DEFAULT );  // default


dbCan... example for Visual J++

This example displays property values in a message box. You can implement this example by adding a button, with this code, to the project described in ODBC Example for Visual J++.

String strMsg = "dbCanAppend = " + LEAD1.getDbCanAppend() + ".";
strMsg += "\ndbCanRestart = " + LEAD1.getDbCanRestart() + ".";
strMsg += "\ndbCanScroll = " + LEAD1.getDbCanScroll() + ".";
strMsg += "\ndbCanUpdate = " + LEAD1.getDbCanUpdate() + ".";
// dbCurrentRecord is 0 based
strMsg += "\ndbCurrentRecord = " + LEAD1.getDbCurrentRecord() + ".";
strMsg += "\ndbEditMode = " + LEAD1.getDbEditMode() + ".";
strMsg += "\ndbIsBOF = " + LEAD1.getDbIsBOF() + ".";
strMsg += "\ndbIsDeleted = " + LEAD1.getDbIsDeleted() + ".";
strMsg += "\ndbIsEOF = " + LEAD1.getDbIsEOF() + ".";
strMsg += "\ndbIsOpen = " + LEAD1.getDbIsOpen() + ".";
strMsg += "\ndbLoadBits = " + LEAD1.getDbLoadBits() + ".";
strMsg += "\ndbLockingMode = " + LEAD1.getDbLockingMode() + ".";
strMsg += "\ndbRecordCount = " + LEAD1.getDbRecordCount() + ".";

MessageBox.show( strMsg, "LEADTOOLS ActiveX Database Properties", MessageBox.OK );


DblClick example for Visual J++

This example demonstrates the DblClick event.

private void LEAD1_doubleClick(Object source, Event e)
{
   LEAD1.Flip();  // Just test the event
   LEAD1.ForceRepaint();
}


DDB example for Visual J++

This example copies the Lead1 bitmap to the clipboard as a DDB. It pastes the DDB into Lead2 and reverses the image. It then gets a DDB from Lead2, sets the same DDB to Lead1, and repaints.

setCursor( Cursor.WAIT );  // hourglass
int nMyFlags = ltocx14n.CopyConstants.COPY_EMPTY | ltocx14n.CopyConstants.COPY_DDB | ltocx14n.CopyConstants.COPY_PALETTE;
LEAD1.Copy( (short) nMyFlags );
if( LEAD2.Paste( (short) ltocx14n.PasteConstants.PASTE_ISREADY ) == 0 )
   MessageBox.show( "Invalid data on the clipboard" );
else
   LEAD2.Paste( (short) 0 );

LEAD2.Reverse();
int hMyDC = LEAD2.GetClientDC();
int hMyDDB = LEAD2.GetDDB( hMyDC );
int hMyPalette = LEAD2.GetPalette( hMyDC );
LEAD1.SetDDB( hMyDC, hMyDDB, hMyPalette );
LEAD1.ForceRepaint();
LEAD2.ReleaseClientDC();
setCursor( Cursor.DEFAULT );  // default


DeleteBitmapListItems example for Visual J++

This example deletes the first five bitmaps from the control's bitmap list. Then, it plays the animation to show that the bitmaps are missing.

// Delete the first five bitmaps.
LEAD1.DeleteBitmapListItems( (short) 0, (short) 5 );

// Play the animation without looping.
LEAD1.setAnimationLoop( false );
LEAD1.setAnimationEnable( true );


DeletePage example for Visual J++

// delete page 1 from TEST.TIF
LEAD1.DeletePage( "TEST.TIF", (short) 1 );


Deskew example for Visual J++

This example automatically straightens the bitmap and repaints the image. The image to be straightened should be mainly text.

LEAD1.Deskew();
LEAD1.ForceRepaint();


Despeckle example for Visual J++

This example automatically removes specks from the bitmap and repaints the image. Use this on a 1-bit bitmap such as a scanned document.

LEAD1.Despeckle();
LEAD1.ForceRepaint();


DIB example for Visual J++

This example copies the Lead1 bitmap to the clipboard as a DIB. It pastes the DIB into Lead2 and reverses the image. It then gets a DIB from Lead2, sets the same DIB to Lead1, and repaints.

setCursor( Cursor.WAIT );  // hourglass
int nMyFlags = ltocx14n.CopyConstants.COPY_EMPTY | ltocx14n.CopyConstants.COPY_DIB | ltocx14n.CopyConstants.COPY_PALETTE;
LEAD1.Copy( (short) nMyFlags );
if( LEAD2.Paste( (short) ltocx14n.PasteConstants.PASTE_ISREADY ) == 0 )
   MessageBox.show( "Invalid data on the clipboard" );
else
   LEAD2.Paste( (short) 0 );
LEAD2.Reverse();
int hMyDib = LEAD2.GetDIB();
LEAD1.SetDIB( hMyDib );
LEAD1.ForceRepaint();
setCursor( Cursor.DEFAULT );  // default


DrawShape example for Visual J++

This example demonstrates most of the three-dimensional shape properties as it draws a rectangle on the current bitmap. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

LEAD1.setAutoRepaint( false );

// Load an image for the main control
LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );

// Load an image for the background of the shape
LEAD2.Load( "c:\\lead\\images\\ulay1.bmp", (short) 0, (short) 0, (short) 1 );

// Shape background
LEAD1.setShapeBackgroundStyle( (short)
ltocx14n.EfxBackStyleConstants.EFX_BACKSTYLE_TILED_IMAGE );
LEAD1.setBackgroundImageTop( 0 );
LEAD1.setBackgroundImageLeft( 0 );
LEAD1.setBackgroundImageWidth( LEAD2.getBitmapWidth() );
LEAD1.setBackgroundImageHeight( LEAD2.getBitmapHeight() );

// Shape location
LEAD1.setShapeTop( 50 );
LEAD1.setShapeLeft( 50 );
LEAD1.setShapeWidth( LEAD1.getDstWidth() - 50 );
LEAD1.setShapeHeight( LEAD1.getDstHeight() - 50 );

// Shape border
LEAD1.setShapeBorderColor( new Color( 255, 0, 0 ) );
LEAD1.setShapeBorderStyle( (short) ltocx14n.EfxBorderStyleConstants.EFX_BORDERSTYLE_SOLID );
LEAD1.setShapeBorderThickness( 10 );
LEAD1.setShapeInnerBandHiliteColor( new Color( 255, 255, 255 ) );
LEAD1.setShapeInnerBandShadowColor( new Color( 0 ) );
LEAD1.setShapeInnerBandStyle( (short)
ltocx14n.EfxFrameInnerStyleConstants.EFX_INNERSTYLE_RAISED );
LEAD1.setShapeInnerBandThickness( 2 );

LEAD1.setShapeOuterBandHiliteColor( new Color( 0, 255, 0 ) );
LEAD1.setShapeOuterBandShadowColor( new Color( 128, 128, 128 ) );
LEAD1.setShapeOuterBandStyle( (short)
ltocx14n.EfxFrameOuterStyleConstants.EFX_OUTERSTYLE_RAISED );
LEAD1.setShapeOuterBandThickness( 2 );

// Make the shape a permanent part of the bitmap
LEAD1.setDrawPersistence( true );

// Draw the shape
LEAD1.DrawShape( (short) ltocx14n.EfxShapeConstants.EFX_SHAPE_RECTANGLE, LEAD2.getBitmap() );

// Repaint
LEAD1.setAutoRepaint( true );


DrawText example for Visual J++

This example demonstrates most of the properties of a three-dimensional text object as it draws rotated text on the current bitmap.

LEAD1.setAutoRepaint( false );

// Load an image for the main control
LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );

// Load an image for the foreground of the text
LEAD2.Load( "c:\\lead\\images\\ulay1.bmp", (short) 0, (short) 0, (short) 1 );

// Text location
LEAD1.setTextTop( 50 );
LEAD1.setTextLeft( 50 );
LEAD1.setTextWidth( LEAD1.getDstWidth() - 50 );
LEAD1.setTextHeight( LEAD1.getDstHeight() - 50 );

// The foreground image needs to be the correct size.
LEAD2.Size( LEAD1.getTextWidth(), LEAD1.getTextHeight(), (short) 0 );

// Text alignment and angle
LEAD1.setTextAlign( (short)
ltocx14n.EfxTextAlignConstants.EFX_TEXTALIGN_HCENTER_VCENTER );
LEAD1.setTextAngle( (short) 450 );  // 45 degrees

// Text highlight color and style
LEAD1.setTextHiliteColor( new Color( 255, 255, 255 ) );
LEAD1.setTextStyle( (short) ltocx14n.EfxTextStyleConstants.EFX_TEXTSTYLE_DROPSHADOW );

// Text drop shadow
LEAD1.setShadowColor( new Color( 0, 0, 0 ) );
LEAD1.setShadowXDepth( 5 );
LEAD1.setShadowYDepth( 5 );

// Make the text a permanent part of the bitmap
LEAD1.setDrawPersistence( true );

// Draw the text
LEAD1.DrawText( "LEADTOOLS", LEAD2.getBitmap() );
LEAD1.ForceRepaint();


Dst... example for Visual J++

//  Set variables for the client area of the control.
int nClHeight = (int) LEAD1.getScaleHeight();
int nClWidth = (int) LEAD1.getScaleWidth();

// Calculate the values to zoom in by 10 percent and center the image.
LEAD1.setDstWidth( LEAD1.getDstWidth() * 1.1f );
LEAD1.setDstHeight( LEAD1.getDstHeight() * 1.1f );
LEAD1.setDstTop( ( nClHeight - LEAD1.getDstHeight() ) / 2 );
LEAD1.setDstLeft( ( nClWidth - LEAD1.getDstWidth() ) / 2 );

// Set the clipping area to the same as the destination rectangle
LEAD1.setDstClipWidth( LEAD1.getDstWidth() );
LEAD1.setDstClipHeight( LEAD1.getDstHeight() );
LEAD1.setDstClipTop( LEAD1.getDstTop() );
LEAD1.setDstClipLeft( LEAD1.getDstLeft() );

// Redisplay the image
LEAD1.ForceRepaint();


Emboss example for Visual J++

This example applies an emboss effect and repaints the image.

LEAD1.Emboss( (short) ltocx14n.EmbossConstants.EMBOSS_NE, (short) 500 );
LEAD1.ForceRepaint();


EnableMethodErrors example for Visual J++

This example disables method errors temporarily so that it can give the user guidance about a particular error (an out-of-range shear angle in this case).

short sShearAngle = 9000;  //This would be the user's input * 100
LEAD1.setEnableMethodErrors( false );
short sRet = LEAD1.Shear( sShearAngle, true, new Color( 0, 0, 255 ) );
if( sRet == 20013 )
   MessageBox.show( "The angle cannot be more than 45 degrees", "Error", MessageBox.OK );
else
   LEAD1.ForceRepaint();
LEAD1.setEnableMethodErrors( true );


EnableZoomInRect example for Visual J++

This example toggles the EnableZoomInRect property.

// Toggle the ZoomInRect setting
if( LEAD1.getEnableZoomInRect() )
   LEAD1.setEnableZoomInRect( false );
else
   LEAD1.setEnableZoomInRect( true );


ReadLoadResolutions Example for Visual J++

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

// Initialize the display
LEAD1.setAutoScroll( false );
LEAD1.setAutoSetRects( true );
LEAD1.setPaintSizeMode( (short) ltocx14n.PaintSizeModeConstants.PAINTSIZEMODE_FIT );
LEAD1.GetFileInfo( "v:\\images\\image5.fpx", (short) 0, 0 );

// Update information about the available resolutions.
LEAD1.ReadLoadResolutions( "v:\\images\\image5.fpx" );

// Display a message box that shows the available sizes.
String strInfo = "Available dimensions:\n";

for( int i = 0 ; i < LEAD1.GetLoadResolutionCount() ; i++ )
   strInfo += LEAD1.getLoadResolutionWidth( (short) i ) + " X " + LEAD1.getLoadResolutionWidth( (short) i ) + "\n";

MessageBox.show( strInfo );

// Set the size to load, the smallest size in this case.
LEAD1.SetLoadResolution( LEAD1.getInfoFormat(), LEAD1.getLoadResolutionWidth( (short) 0 ), LEAD1.getLoadResolutionHeight( (short) 0 ) );

// Get the dimensions that we just set and display them.
LEAD1.GetLoadResolution( LEAD1.getInfoFormat() );

strInfo = "Size that will be loaded:\n\n";
strInfo += LEAD1.getLoadResolutionWidth( (short) 0 ) + " X " + LEAD1.getLoadResolutionWidth( (short) 0 );
MessageBox.show( strInfo );

// Load the bitmap, keeping the bits per pixel of the file.
LEAD1.Load( "v:\\images\\image5.fpx", (short) 0, (short) 0, (short) 1 );


Exif example for Visual J++

Note: Also works with Access 95 and 97.

This example does the following:

1.	Reads all of the comments in an existing Exif file, updating the Comment array.

2.	Loads and modifies the file's image.

3.	Updates some of the comments in the comment array.

4.	Saves the file.

5.	Reads and displays the updated comments.

Note: Comments for GIF, TIFF, and DICOM files are simpler than the ones in this Exif example. With those file types, all of the comments are strings that you can get and set with simple assignments.

// Specify the file that we will update.
String strFilePath = "c:\\lead\\images\\exif1.tif";

// Get all of the current comments from an Exif file.
// Temporarily disable method errors so that we do not fail when comments are missing.
LEAD1.setEnableMethodErrors( false );
for( short i = 0 ; i <= ltocx14n.CommentConstants.CMNT_LAST ; i++ )
{
   LEAD1.setComment( i, new Variant() );
   LEAD1.setComment( i, LEAD1.ReadComment ( strFilePath, (short) 0, i ) );
}
LEAD1.setEnableMethodErrors( true );

// Load and modify the image.
LEAD1.Load( strFilePath, (short) 0, (short) 0, (short) 1 );
LEAD1.Reverse();

// Update the date when the file is generated.
String strThisDate = new Time().toString();
LEAD1.setComment( (short) ltocx14n.CommentConstants.CMNT_SZDATETIMEDIGITIZED, new Variant( strThisDate ) );
LEAD1.setComment( (short) ltocx14n.CommentConstants.CMNT_SZSUBSECTIMEDIGITIZED, new Variant() );

// Change the subject distance to 4 1/3 meters.
SafeArray aSubjectDistance = new SafeArray( Variant.VariantInt, 2 );
aSubjectDistance.setInt( 0, 13 );
aSubjectDistance.setInt( 1, 3 );
LEAD1.setComment( (short) ltocx14n.CommentConstants.CMNT_SUBJECTDISTANCE, new Variant( aSubjectDistance, true ) );

// Specify the user comment string.
String strMyCommentText = "This is my new comment.";
int nMyCommentSize = 8 + strMyCommentText.length();

// Define the array for the user comment.
char cMyComment[] = new char[ nMyCommentSize + 1 ];

// Fill in the ASCII prefix.
cMyComment[0] = 'A';
cMyComment[1] = 'S';
cMyComment[2] = 'C';
cMyComment[3] = 'I';
cMyComment[4] = 'I';
cMyComment[5] = 0;
cMyComment[6] = 0;
cMyComment[7] = 0;

// Fill in the rest of the comment, starting at the end.
cMyComment[ nMyCommentSize ] = 0;
for( int i = ( nMyCommentSize - 1 ) ; i >= 8 ; i-- )
   cMyComment[ i ] = strMyCommentText.charAt( nMyCommentSize - i - 1 );

SafeArray aMyComment = new SafeArray( Variant.VariantByte, nMyCommentSize + 1 );
aMyComment.fromCharArray( cMyComment );

// Update the user comment.
LEAD1.setComment( (short) ltocx14n.CommentConstants.CMNT_USERCOMMENT, new Variant() );
LEAD1.setComment( (short) ltocx14n.CommentConstants.CMNT_USERCOMMENT, new Variant( aMyComment, true ) );

// Save the file and read the comments that we saved.
LEAD1.Save( strFilePath, (short) ltocx14n.FileConstants.FILE_EXIF, (short) 24, (short) 0, (short) ltocx14n.SaveModifyConstants.SAVE_OVERWRITE );

String strNewDate = LEAD1.ReadComment( strFilePath, (short) 0, (short) ltocx14n.CommentConstants.CMNT_SZDATETIMEDIGITIZED ).toString();
SafeArray aNewSubjectDistance = LEAD1.ReadComment( strFilePath, (short) 0, (short) ltocx14n.CommentConstants.CMNT_SUBJECTDISTANCE ).toSafeArray();
String strNewComment = LEAD1.ReadComment( strFilePath, (short) 0, (short) ltocx14n.CommentConstants.CMNT_USERCOMMENT ).toString();

// Interpret the Subject-Distance RATIONAL.
// Initialize the string for the message box.
String strMyMsg = "Subject Distance = " + aNewSubjectDistance.getInt( 0 ) / aNewSubjectDistance.getInt( 1 ) + "\nDate/Time = " + strNewDate;

// Add the ASCII comment if it is there
if( strNewComment.charAt( 0 ) == 'A' )
{
   int nArraySize = strNewComment.length();
   String strMyNewComment = "";
   for( int i = 8 ; i <= nArraySize ; i ++ )
      strMyNewComment += strNewComment.charAt( i );
   strMyMsg += "\n\n" + strMyNewComment;
}

// Display the message
MessageBox.show( strMyMsg );

// Clear the comments from memory
for( int i = 0 ; i <= ltocx14n.CommentConstants.CMNT_LAST ; i++ )
   LEAD1.setComment( (short) i, new Variant() );


FastRotate example for Visual J++

Note: This topic is for Document/Medical only.

This example uses fast rotation to rotate an image 90 degrees:

LEAD1.FastRotate( (short) 90 );


FeedLoad example for Visual J++

This example uses StartFeedLoad, FeedLoad, and StopFeedLoad and loads a file through a buffer to simulate receiving a transmitted image.

private void FeedLoad_click(Object source, Event e)
{
   // Open an image file and get its length.
   File file = new File( "c:\\lead\\images\\image1.cmp", FileMode.OPEN, FileAccess.READ, FileShare.READ );
   int nFileLength = (int) file.getLength();

   // Set PaintWhileLoad so that we can watch the progress.
   LEAD1.setPaintWhileLoad( true );

   // Initialize the file-load process.
   // Specify the default bits per pixel and first page
   if( LEAD1.StartFeedLoad( (short) 0, (short) 0, (short) 1 ) != 0 )
   {
      MessageBox.show( "Error in StartFeedLoad !" );
      file.close();
      return;
   }

   // set the buffer size
   final int BUFFERSIZE = 1000;

   // Use FeedLoad in a loop to load the file into the bitmap.
   int nSizeLeft = nFileLength;
   while( nSizeLeft > 0 )
   {
      // get size
      int nReadSize = (int) Math.min( nSizeLeft, BUFFERSIZE );
      nSizeLeft -= nReadSize;

      // read from file
      byte byBuffer[] = file.readBytes( nReadSize );

      // set into a safe array
      SafeArray aMyArray = new SafeArray( Variant.VariantByte, BUFFERSIZE );
      aMyArray.setBytes( 0, nReadSize, byBuffer, 0 );

      // feed load
      if( LEAD1.FeedLoad( new Variant( aMyArray, false ), nReadSize ) != 0 )
      {
         MessageBox.show( "Error in FeedLoad !");
         file.close();
         return;
      }
   }

   // Finish the file-load process.
   if( LEAD1.StopFeedLoad() != 0 )
   {
      MessageBox.show( "Error in StopFeedLoad !" );
      file.close();
      return;
   }

   file.close();
}


FileOpen Example for Visual J++

private void button1_click(Object source, Event e)
{
   LEADDlg1.setFileDlgFlags( 0 );

   LEADDlg1.setPreviewEnabled( true );

   LEADDlg1.setDialogTitle( "Open A File" );

   LEADDlg1.setFilter( "All |*.*|CMP|*.cmp|JPEG|*.jpg" );

   LEADDlg1.setFilterIndex( 2 );  // look for *.cmp first

   LEADDlg1.setInitialDir( "c:\\lead\\images\\" );

   LEADDlg1.setLoadPasses( 0 );

   LEADDlg1.setLoadRotated( true );

   LEADDlg1.setLoadCompressed( false );

   // if LEAD1 has a bitmap, we will load on top of it

   // otherwise, we will load into the Common Dialog control, and copy later

   // NOTE: use CreateBitmap to create a 1x1 1-bit bitmap to avoid the copy

   if( LEAD1.getBitmap () > 0 )

      LEADDlg1.setBitmap( LEAD1.getBitmap() );

   else

      LEADDlg1.setBitmap( 0 );  // free any existing bitmap reference

LEADDlg1.setUIFlags(

ltdlg14n.tagFileOpenDlgConstants.DLG_FO_AUTOPROCESS |

                        ltdlg14n.tagFileOpenDlgConstants.DLG_FO_PROGRESSIVE |

                        ltdlg14n.tagFileOpenDlgConstants.DLG_FO_MULTIPAGE |

                        ltdlg14n.tagFileOpenDlgConstants.DLG_FO_LOADROTATED |

                        ltdlg14n.tagFileOpenDlgConstants.DLG_FO_LOADCOMPRESSED |

                        ltdlg14n.tagFileOpenDlgConstants.DLG_FO_FILEINFO |

                        ltdlg14n.tagFileOpenDlgConstants.DLG_FO_SHOWSTAMP |

                        ltdlg14n.tagFileOpenDlgConstants.DLG_FO_SHOWPREVIEW );

   LEADDlg1.FileOpen( getHandle() );

   // output the results

   LEAD1.setRefBitmap ( true );

   LEAD1.setBitmap( LEADDlg1.getBitmap() );  // copy image to LEAD OCX

   LEAD1.setRefBitmap ( false );

   LEAD2.setBitmap ( 0 );

   LEAD2.setBitmap( LEADDlg1.getThumbnail() );  // copy thumbnail image to LEAD OCX

   // output the results

   edit1.setText( LEADDlg1.getFileName() );

   edit2.setText( Integer.toString( LEADDlg1.getPageNumber() ) );

   edit3.setText( new Boolean( LEADDlg1.getLoadCompressed() ).toString() );

   edit4.setText( new Boolean( LEADDlg1.getLoadRotated() ).toString() );

   edit5.setText( Integer.toString( LEADDlg1.getLoadPasses() ) );

}


FilePage Event Example for Visual J++

This example shows how the FilePage event can be used to size and position a lead control when an image is loaded.

private void LEAD1_filePage(Object source, Event e)
{
   // Set the variables used for preserving the aspect ratio.
   // Allow for a border of 1/8 of the form size.
   // The units of measure do not matter, since we are calculating proportions.
   int nHeightFactor = (int) LEAD1.getInfoHeight();
   int nWidthFactor  = (int) LEAD1.getInfoWidth();
   int nHeightAllowed = getSize().y * 3 / 4;
   int nWidthAllowed  = getSize().x * 3 / 4;

   // Center the LEAD control on the form, preserving the aspect ratio.
   // Check to see if using the maximum width will make the image too tall.
   // Set the dimensions based on the result.
   Rectangle rectLead = new Rectangle();
   if( ( ( nWidthAllowed * nHeightFactor ) / nWidthFactor ) < nHeightAllowed )
   {
      rectLead.x      = getSize().x / 8;
      rectLead.width  = nWidthAllowed;
      rectLead.height = ( rectLead.width * nHeightFactor ) / nWidthFactor;
      rectLead.y      = ( getSize().y - rectLead.height ) / 2;
   }
   else
   {
      rectLead.y      = getSize().y / 8;
      rectLead.height = nHeightAllowed;
      rectLead.width  = ( rectLead.height * nWidthFactor) / nHeightFactor;
      rectLead.x      = ( getSize().x - rectLead.width ) / 2;
   }

   LEAD1.setLocation( rectLead.x, rectLead.y );
   LEAD1.setSize( rectLead.width, rectLead.height );

   // Set the image display size to match the LEAD control.
   LEAD1.setAutoScroll( false );
   LEAD1.setAutoSetRects( true );
   LEAD1.setAutoRepaint( true );
   LEAD1.setPaintSizeMode( (short) ltocx14n.PaintSizeModeConstants.PAINTSIZEMODE_FIT );
}


Fill example for Visual J++

This example fills the bitmap with blue and repaints the image.

LEAD1.Fill( new Color( 0, 0, 255 ) );
LEAD1.ForceRepaint();


Flip example for Visual J++

This example flips the bitmap and repaints the image.

LEAD1.Flip();
LEAD1.ForceRepaint();


FloaterDstClip... example for Visual J++

The following code adjusts the destination clipping rectangle of the floater. You can test it by adding it to a new command button for the lesson described in Outlining, Dragging, and Pasting a Region. By default, the destination clipping rectangle for the floater is the full client area. This code gets the current values and uses them to reduce the size of the clipping rectangle.

// Set variables to use for adjustment increments.
int nAdjustX = (int) LEAD1.getScaleWidth() / 20;
int nAdjustY = (int) LEAD1.getScaleHeight() / 20;

// Determine new values, based on adjustments of current values.
int nNewLeft   = (int) LEAD1.getFloaterDstClipLeft() + nAdjustX;
int nNewTop    = (int) LEAD1.getFloaterDstClipTop() + nAdjustY;
int nNewWidth  = (int) LEAD1.getFloaterDstClipWidth() - ( 2 * nNewLeft );
int nNewHeight = (int) LEAD1.getFloaterDstClipHeight() - ( 2 * nNewTop );

// Set the clipping rectangle to the new values.
LEAD1.SetFloaterDstClipRect( nNewLeft, nNewTop, nNewWidth, nNewHeight );


Font example for Visual J++

This example, in a MouseUp event, determines the size of a rectangle for a string in the specified font. It then draws the rectangle and draws the text on top of the rectangle.

private void LEAD1_mouseUp(Object source, MouseEvent e)
{
   // Specify the text, font, and styles
   String strTest = "This is my text.";
   Font font = new Font( "Times New Roman", 16, 0 );
   LEAD1.setFont( font );
   LEAD1.setDrawFontColor( new Color( 0, 0, 255 ) );  // Blue
   LEAD1.setTextStyle( (short) ltocx14n.EfxTextStyleConstants.EFX_TEXTSTYLE_NORMAL );
   LEAD1.setTextAlign( (short) ltocx14n.EfxTextAlignConstants.EFX_TEXTALIGN_HCENTER_VCENTER );

   // Get the width and height of the text to be drawn.
   int nTextWidth = (int) LEAD1.DrawTextWidth( strTest );
   int nTextHeight = (int) LEAD1.DrawTextHeight( strTest );

   // set the location for the text
   LEAD1.setTextTop( e.y );
   LEAD1.setTextLeft( e.x );
   LEAD1.setTextWidth( nTextWidth );
   LEAD1.setTextHeight( nTextHeight );

   // Set the properties for drawing a rectangle behind the text.
   LEAD1.setDrawPenStyle( (short) ltocx14n.DrawPenStyleConstants.DRAWPENSTYLE_SOLID );
   LEAD1.setDrawMode( (short) ltocx14n.DrawModeConstants.DRAWMODE_COPY_PEN );
   LEAD1.setDrawFillColor( new Color( 0, 255, 0 ) );  // Green

   // Draw on the screen, not on the bitmap.
   LEAD1.setDrawPersistence( false );

   // Draw the rectangle, then draw the text.
   LEAD1.DrawRectangle( e.x, e.y, nTextWidth, nTextHeight );
   LEAD1.DrawText( strTest, 0 );
}


Frame... example for Visual J++

This example sets the control's frame properties. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

LEAD1.setAutoRepaint( false );
LEAD1.setFrameThickness( 2 );
LEAD1.setFrameColor( new Color( 0, 0, 0 ) );
LEAD1.setFrameInnerStyle( (short) ltocx14n.EfxFrameInnerStyleConstants.EFX_INNERSTYLE_INSET );
LEAD1.setFrameOuterStyle( (short) ltocx14n.EfxFrameOuterStyleConstants.EFX_OUTERSTYLE_RAISED );
LEAD1.setFrameInnerHiliteColor( new Color( 255, 255, 0 ) );  // Yellow
LEAD1.setFrameInnerShadowColor( new Color( 128, 128, 128 ) );  // Dark Gray
LEAD1.setFrameOuterHiliteColor( new Color( 255, 0, 0 ) );  // Red
LEAD1.setFrameOuterShadowColor( new Color( 192, 192, 192 ) );  // Light Gray
LEAD1.setFrameInnerThickness( 3 );
LEAD1.setFrameOuterThickness( 3 );
LEAD1.setAutoRepaint( true );


GammaCorrect example for Visual J++

This example applies a 2.2 gamma correction and repaints the image.

LEAD1.GammaCorrect( (short) 220 );
LEAD1.ForceRepaint();


GetBitmapDC example for Visual J++

Take the following steps to demonstrate how GDI functions can be used to print text on the bitmap and on the control. The text printed on the bitmap is a permanent part of the bitmap and becomes permanent if the bitmap is saved; whereas the text on the control is superficial and does not affect the bitmap.

Note: For an easier way of drawing text, refer to the DrawText example.

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

2. 	2. 	In the private section of the main from add the following declarations:

/** @dll.import("GDI32") */
private static native int SetBkMode( int hDC, int nBkMode );
/** @dll.import("GDI32") */
private static native int SelectObject( int hDC, int hObject );
/** @dll.import("GDI32") */
private static native int TextOut( int hDC, int X, int Y, String lpString, int nCount );
/** @dll.import("GDI32") */
private static native int GetStockObject( int nIndex );

private static final int SYSTEM_FONT = 13;
private static final int TRANSPARENT = 1;

3.	Select the Button control; then add the control to your main form. Put the control at the top of the form to keep it away from the image.

4.	In the Properties box, change the Button control's Caption property to GDI for Text.

5.	Add the following code to the Button control's Click event. In online help, you can use the Edit pull-down menu to copy the block of code.

Notice that the code prints in two different places: the bitmap and the control. You can see the difference when you run the program.

private void button1_click(Object source, Event e)
{
   // Ensure that the Lead control is visible
   LEAD1.setVisible( true );

   // First, print text on the bitmap.
   // Create a device context for the bitmap that the GDI functions can access
   int hLeadDC = LEAD1.GetBitmapDC();

   // Get the system font and select it. The old font is saved.
   // Using other fonts is more complex. Refer to the Windows API documentation.
   int hFont = GetStockObject( SYSTEM_FONT );
   int hOldFont = SelectObject( hLeadDC, hFont );

   // Make the background transparent, so that the text will overlay the image
   SetBkMode( hLeadDC, TRANSPARENT );

   // Assign the string value
   String str = "Text on the bitmap";

   // Print the text on the bitmap. This is a permanent change in the bitmap
   TextOut( hLeadDC, 20, 40, str, str.length() );

   // Restore the previous font
   SelectObject( hLeadDC, hOldFont );

   // Remove the lock from the device control
   LEAD1.ReleaseBitmapDC();

   // Repaint the part of the image that has changed
   LEAD1.setBackErase( false );
   LEAD1.ForceRepaint();

   // Allow full repainting again
   LEAD1.setBackErase( true );

   // Next, print text on the control.
   // Create a device context for the control that the GDI functions can access
   int hLeadClientDC = LEAD1.GetClientDC();

   // Get the system font and select it. The old font is saved.
   // Using other fonts is more complex. Refer to the Windows API documentation.
   hFont = GetStockObject( SYSTEM_FONT );
   hOldFont = SelectObject( hLeadDC, hFont );

   // Make the background transparent, so that the text will overlay the image
   SetBkMode( hLeadClientDC, TRANSPARENT );

   // Assign the string value
   str = "Text on the LEAD control";

   // Print the text on the control.
   // This is an overlay that does not affect the bitmap.
   TextOut( hLeadClientDC, 20, 80, str, str.length() );

   // Restore the previous font
   SelectObject( hLeadClientDC, hOldFont );

   // Remove the lock from the device control
   LEAD1.ReleaseClientDC();
}


GetColorCount Example for Visual J++

This example displays a message box showing the number of unique colors in the control's current bitmap.

// Get the number of colors in the bitmap.
int nNumberOfColors = LEAD1.GetColorCount();

// Display the result in a message.
String strMessage = "The bitmap has " + nNumberOfColors + " colors";
MessageBox.show( strMessage, "Notice", MessageBox.OK );


GetFileInfo example for Visual J++

This example gets information about the specified file.

// Initialize variables
String strFileName = "c:\\lead\\images\\image2.cmp";
short sPage = 0;

//  Update the variables
LEAD1.GetFileInfo( strFileName, sPage, 0 );

// Read the updated properties
short sFormat = LEAD1.getInfoFormat();
int nLeadWidth = (int) LEAD1.getInfoWidth();
int nLeadHeight = (int) LEAD1.getInfoHeight();
short sBPS = LEAD1.getInfoBits();
sPage = LEAD1.getInfoPage();
int nSizeD = LEAD1.getInfoSizeDisk();
int nSizeM = LEAD1.getInfoSizeMem();
String strCmp = LEAD1.getInfoCompress();

// Translate the meaning of the format constant
String strFormat = "";
switch( sFormat )
{
   case ltocx14n.FileConstants.FILE_PCX :
      strFormat = "ZSoft PCX";
      break;
   case ltocx14n.FileConstants.FILE_GIF :
      strFormat ="CompuServe GIF";
      break;
   case ltocx14n.FileConstants.FILE_TGA :
      strFormat ="TARGA";
      break;
   case ltocx14n.FileConstants.FILE_PNG :
      strFormat ="Portable Network Graphics";
      break;
   case ltocx14n.FileConstants.FILE_PSD :
      strFormat ="Adobe Photoshop 3.0";
      break;
   case ltocx14n.FileConstants.FILE_BMP :
      strFormat ="Windows BMP";
      break;
   case ltocx14n.FileConstants.FILE_OS2 :
      strFormat ="OS/2 BMP version 1.x";
      break;
   case ltocx14n.FileConstants.FILE_OS2_2 :
      strFormat ="OS/2 BMP version 2.x";
      break;
   case ltocx14n.FileConstants.FILE_WMF :
      strFormat ="Windows Meta File";
      break;
   case ltocx14n.FileConstants.FILE_EPS :
      strFormat ="Encapsulated PostScript";
      break;
       .
       .
       .
   case ltocx14n.FileConstants.FILE_MAC :
      strFormat ="MacPaint";
      break;
   case ltocx14n.FileConstants.FILE_PCT :
      strFormat ="Macintosh Pict";
      break;
   case ltocx14n.FileConstants.FILE_MSP :
      strFormat ="Microsoft Paint";
      break;
   case ltocx14n.FileConstants.FILE_IMG :
      strFormat ="GEM Image";
      break;
   case ltocx14n.FileConstants.FILE_PCD :
      strFormat ="Kodak PhotoCD";
      break;
   case ltocx14n.FileConstants.FILE_EPSTIFF :
      strFormat ="Encapsulated PostScript with an embedded TIFF file";
      break;
   default :
      strFormat ="Unknown format";
}

// Create the message string
String strMsg = strFileName + "\nPage = " + sPage + " of " + LEAD1.getInfoTotalPages() + "\nFormat = " + strFormat;
strMsg += "\nWidth = " + nLeadWidth + "\nHeight = " + nLeadHeight;
strMsg += "\nSize in memory = " + nSizeM + "\nSize on disk = " + nSizeD;
strMsg += "\nBits per pixel = " + sBPS;

// Display the message box
MessageBox.show( strMsg, "File Info", MessageBox.OK );


GetFloaterHandle example for Visual J++

The following is an alternative way of coding the PasteFloaterBtn button's click event in  Outlining, Dragging, and Pasting a Region. This alternative uses the GetFloaterHandle and SetRgnHandle methods to specify the mask for the paste. It also shows how to use the HasRgn, FloaterWidth, and FloaterHeight properties.

// Exit this function if there is no region.
if( !LEAD1.getHasRgn() )
   return;

// Save the region that is in the floater.
int hSavedRgn = LEAD1.GetFloaterHandle();

// Get the floater into another bitmap
LEAD2.setScaleMode( LEAD1.getScaleMode() );
LEAD2.setBitmap( LEAD1.getFloater() );

// Get the floater's client coordinates into local variables.
int nLCRgnX = (int) LEAD1.getFloaterDstLeft();
int nLCRgnY = (int) LEAD1.getFloaterDstTop();
int nLCRgnWidth = (int) LEAD1.getFloaterDstWidth();
int nLCRgnHeight = (int) LEAD1.getFloaterDstHeight();

// Translate the client coordinates to bitmap coordinates.
int nZoomFactorX = 1;
int nZoomFactorY = 1;
int nLBRgnX = ( ( nLCRgnX - (int) LEAD1.getDstLeft() ) / nZoomFactorX ) + (int) LEAD1.getSrcLeft();
int nLBRgnY = ( ( nLCRgnY - (int) LEAD1.getDstTop() ) / nZoomFactorY ) + (int) LEAD1.getSrcTop();
int nLBRgnWidth = (int) LEAD1.getFloaterWidth();
int nLBRgnHeight = (int) LEAD1.getFloaterHeight();

// Delete the floater.
LEAD1.setFloaterVisible( false );
LEAD1.setFloater( 0 );

// Set the saved region to use as a mask for the Combine method.
LEAD1.SetRgnHandle( hSavedRgn, nLBRgnX, nLBRgnY, (short) ltocx14n.RgnCombineModeConstants.L_RGN_SET );

// Use the Combine method to paste the Lead2 bitmap into the Lead1 bitmap.
int nMyOp = ltocx14n.CombineConstants.CB_OP_ADD +   // Operation flags for a simple paste.
            ltocx14n.CombineConstants.CB_DST_0;
LEAD1.Combine( nLBRgnX, nLBRgnY, nLBRgnWidth, nLBRgnHeight, LEAD2.getBitmap(), 0, 0, nMyOp );

// Repaint the part of the client area that has changed.
LEAD1.RepaintRect( nLCRgnX, nLCRgnY, nLCRgnWidth, nLCRgnHeight, false );

// Free the region.
LEAD1.FreeRgn();

// Delete the region handle.
LEAD1.DeleteRgnHandle( hSavedRgn );


GetHistogram example for Visual J++

The following code does a CMYK separation and uses a histogram to find the brightest and darkest intensities in the K plane of the bitmap. It then remaps the intensities to use the full range and merges the color planes to recreate the bitmap:

private void button1_click(Object source, Event e)
{
   setCursor( Cursor.WAIT );  // hourglass

   // Do a CMYK color separation and copy the K plane to the bitmap
   LEAD1.ColorSeparate( ltocx14n.ColorSeparationConstants.COLORSEP_CMYK );
   LEAD1.setBitmap( 0 );  // Free the bitmap
   LEAD1.setBitmap( LEAD1.getColorPlanes( (short) 3 ) );  // Copy the K plane

   // Load the histogram
   LEAD1.GetHistogram( (short)ltocx14n.ChannelConstants.CHANNEL_MASTER );

   // Find the brightest and darkest intensities in the image
   int nMyIndex = 0;
   int nBrightest = 0;
   int nDarkest = -1;
   while( nMyIndex < 256 )
   {
      if( LEAD1.getHistogramTable( (short) nMyIndex ) > 0 )
     {
         nBrightest = nMyIndex;
         if( nDarkest == -1 )
         nDarkest = nMyIndex;
      }
      nMyIndex++;
   }

   // Remap the intensities to use the full range
   nMyIndex = nDarkest;
   int nCurrentRange = nBrightest - nDarkest;
   if( nCurrentRange > 0 )
   {
      while( nMyIndex <= nBrightest )
      {
         int nOffset = nMyIndex - nDarkest;
         LEAD1.setRemapTable( (short) nMyIndex, (short) ( ( 255 * nOffset ) / nCurrentRange ) );
         nMyIndex++;
      }
      LEAD1.RemapIntensity( (short) ltocx14n.ChannelConstants.CHANNEL_MASTER );
   }

   // Merge the color planes and free them from memory
   LEAD1.setColorPlanes( (short) 3, LEAD1.getBitmap() );  // Update the K plane
   LEAD1.ColorMerge( (short) ltocx14n.ColorSeparationConstants.COLORSEP_CMYK );
   LEAD1.setColorPlanes( (short) 0, 0 );
   LEAD1.setColorPlanes( (short) 1, 0 );
   LEAD1.setColorPlanes( (short) 2, 0 );
   LEAD1.setColorPlanes( (short) 3, 0 );

   // Set the image display size to match the LEAD control
   LEAD1.SetDstRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
   LEAD1.SetDstClipRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
   LEAD1.ForceRepaint();
   setCursor( Cursor.DEFAULT );  // default
}


GetMinMaxBits example for Visual J++

The following example retrieves the values for MinBit and MaxBit using GetMinMaxBits and writes the results.

LEAD1.GetMinMaxBits();
edit1.setText( Short.toString( LEAD1.getMinBit() ) );
edit2.setText( Short.toString( LEAD1.getMaxBit() ) );


GetMinMaxVal example for Visual J++

The following example retrieves the values for MinVal and MaxVal using GetMinMaxVal and writes the results.

// must call GetMinMaxVal first
LEAD1.GetMinMaxVal();
edit1.setText( Integer.toString( LEAD1.getMinVal() ) );
edit2.setText( Integer.toString( LEAD1.getMaxVal() ) );


GetPicture and SetPicture example for Visual J++

To use this code, you must first add a PictureBox control to your form, and make it invisible.

// Hide the LEAD control
LEAD1.setVisible( false );

// Assign the picture object to the PictureBox control
pictureBox1.setImage( LEAD1.GetPicture() );

// Give the PictureBox control the same size and position as the LEAD control
pictureBox1.setTop ( LEAD1.getTop() );
pictureBox1.setLeft( LEAD1.getLeft() );
pictureBox1.setHeight( LEAD1.getHeight() );
pictureBox1.setWidth( LEAD1.getWidth() );

// Interrupt with a message.
MessageBox.show( "This is the PictureBox. Click OK for the SetPicture method" );

// Get the picture object back to the LEAD control and repaint it
LEAD1.setAutoSetRects( false );  // Keep the previous display rectangles.
LEAD1.SetPicture( pictureBox1.getImage() );  // Load the bitmap from the PictureBox control.
pictureBox1.setVisible( false );  // Hide the PictureBox control.
LEAD1.setVisible( true );  // Make the LEAD control visible.
LEAD1.ForceRepaint();


GetRgnHandle example for Visual J++

The following code creates a region, saves its handle and adds the saved region beside the current region.

// Initialize the variables that we will manipulate to simulate mouse coordinates.
int nOffsetX = (int) LEAD1.getBitmapWidth() / 8;
int nOffsetY = (int) LEAD1.getBitmapHeight() / 6;

// Create an elliptical region.
LEAD1.SetRgnEllipse( nOffsetX, nOffsetY, nOffsetX, nOffsetY, (short) ltocx14n.RgnCombineModeConstants.L_RGN_SET );

// Save a copy of the region.
int hSavedRegion = LEAD1.GetRgnHandle();

// Add the saved region to the bitmap, offsetting it so that we can see it.
LEAD1.SetRgnHandle( hSavedRegion, nOffsetX, nOffsetY, (short) ltocx14n.RgnCombineModeConstants.L_RGN_OR );

// Delete the saved region.
LEAD1.DeleteRgnHandle( (short) hSavedRegion );

// Fill the bitmap region with blue.
LEAD1.Fill( new Color( 0, 0, 255 ) );

// Free the bitmap region.
LEAD1.FreeRgn();

// Repaint the image so that we can see how the image was updated.
LEAD1.ForceRepaint();


Grayscale example for Visual J++

This example converts the bitmap to 12-bit grayscale.

LEAD1.Grayscale( (short) 12 );  //Grayscale image to 12-bit


Halftone example for Visual J++

This example halftones the bitmap with a horizontal pattern and repaints the image.

LEAD1.Halftone( (short) ltocx14n.HalftoneConstants.HALFTONE_PRINT, 0 );
LEAD1.ForceRepaint();


HistoContrast example for Visual J++

This example applies a histogram contrast to the bitmap and repaints the image.

LEAD1.HistoContrast( (short) 300 );
LEAD1.ForceRepaint();


HistoEqualize example for Visual J++

This example equalizes the bitmap's histogram and repaints the image.

LEAD1.HistoEqualize();
LEAD1.ForceRepaint();


Hue example for Visual J++

This example rotates the hue 180 degrees and repaints the image.

LEAD1.Hue( (short) 180 );
LEAD1.ForceRepaint();


IgnoreFilters example for Visual J++

This example shows how to ignore filters so that certain files are not loaded.

// First, make sure PreLoaded Filters does not
// contain CMP, and that 0 filters can be cached
LEAD1.PreLoadFilters( (short) 3, (short) 0, "BMP,FAX,TIF" );

// now, ignore cmp filter (never load cmp files)
LEAD1.IgnoreFilters( "CMP" );


InsertBitmapListItem Example for Visual J++

This example loads an ordinary file and uses it to create and play an animation. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

int nMax = 160;
LEAD2.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );
int nBitmapWidth = (int) LEAD2.getBitmapWidth();
int nBitmapHeight = (int) LEAD2.getBitmapHeight();

// Reduce memory requirements, if necessary. Only small bitmaps play smoothly.
if( nBitmapWidth > nMax )
   LEAD2.Size( nMax, (nBitmapHeight * nMax) / nBitmapWidth, (short) ltocx14n.ResizeConstants.RESIZE_RESAMPLE );
else if( nBitmapHeight > nMax )
   LEAD2.Size( ( nBitmapWidth * nMax) / nBitmapHeight, nMax, (short) ltocx14n.ResizeConstants.RESIZE_RESAMPLE );

// Dither to an optimized palette, leaving the last color blank to use
// for transparency.
LEAD2.ColorRes( (short) 8, (short) ltocx14n.ColorResPaletteConstants.CRP_IDENTITYPALETTE,
                (short) ltocx14n.ColorResDitherConstants.CRD_FLOYDSTEINDITHERING,
                (short) 255 );

// Set an arbitrary transparent color in the last position of the bitmap palette.
LEAD2.setBitmapPalette( (short) 255, new Color( 212, 222, 202 ) );

// Set the playback values that will apply to all bitmaps in the list.
LEAD2.setBitmapDelay( 10 );
LEAD2.setBitmapTop( 0 );
LEAD2.setBitmapLeft( 0 );
LEAD2.setBitmapEnableTransparency( true );
LEAD2.setBitmapTransparentColor( new Color( 16777216 + 255 ) );  // Specified by palette index
LEAD2.setBitmapDisposalMethod( (short) ltocx14n.AnimationDisposalConstants.ANIMATIONDISPOSAL_RESTOREBACKGROUND );

// Free the Lead1 control's current bitmap list.
LEAD1.setBitmapList( 0 );

// Populate the bitmap list in the LEAD1 control.
for( short i = 0 ; i < 37 ; i++ )
{
   LEAD1.InsertBitmapListItem( i, LEAD2.getBitmap() );

   // Rotate, using the transparent color as the fill color.
   LEAD1.setBitmapListIndex( i );
   LEAD1.Rotate( 1000 * i, 0, new Color( 16777216 + 255 ) );
}

// Set the animation playback properties
LEAD1.setAnimationBackColor( new Color( 0, 0, 255 ) );
LEAD1.setAnimationBitsPerPixel( (short) 8 );
LEAD1.setAnimationHeight( LEAD1.getScaleHeight() );
LEAD1.setAnimationWidth( LEAD1.getScaleWidth() );
LEAD1.setAnimationLoop( false );
for( short i = 0 ; i < 256 ; i++ )
   LEAD1.setAnimationPalette( i, LEAD1.getBitmapPalette( i ) );

// Set properties for a scaled animation.
LEAD1.setAutoRepaint( true );
LEAD1.setAutoSetRects( false );

// Set the image display size to match the LEAD control.
LEAD1.SetDstRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
LEAD1.SetDstClipRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );

// Start the animation.
LEAD1.setAnimationEnable( true );

// Free the Lead2 control's bitmap.
LEAD2.setBitmapList( 0 );


Intensity example for Visual J++

This example lightens the bitmap and repaints the image.

LEAD1.Intensity( (short) 150 );
LEAD1.ForceRepaint();


IntensityDetect example for Visual J++

This example filters the bitmap to get the lightest intensities and repaints the image.

LEAD1.IntensityDetect( (short) 200, (short) 255 );
LEAD1.ForceRepaint();


Invert example for Visual J++

This example inverts the bitmap's colors and repaints the image.

LEAD1.Invert();
LEAD1.ForceRepaint();


ISISAcquire example for Visual J++

// The following example acquires a single image using ISISAcquire.
LEADISIS1.setEnableMethodErrors( false );
short sRet = LEADISIS1.ISISLoadDriver();
if( sRet == 0 )
{
   sRet = LEADISIS1.ISISAcquire( getHandle(), ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0001.ISIS_SHOWUI );
   LEADISIS1.ISISUnloadDriver();
}

if( sRet == 0 )
   LEAD1.setBitmap( LEADISIS1.getBitmap() );
else
   if( sRet != ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0003.ERROR_ISIS_CANCEL )
      MessageBox.show( "Error " + sRet + "during ISIS Scan!" );


ISISAcquireMulti example for Visual J++

'The following example prepares for scanning multiple images by setting tags and enabling the ISISPage event and then scans multiple images, using ISISAcquireMulti method.

int nMaxPages = 10;
LEADISIS1.setEnableMethodErrors( false );
LEADISIS1.setEnableISISEvent( true );
short sRet = LEADISIS1.ISISLoadDriver();
if( sRet == 0 )
{
   LEADISIS1.ISISSetTag( ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0002.TAG_SCANAHEAD,
                         ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0002.TAG_SCANAHEAD_YES );
   int [] plValue = new int [ 20 ];
   LEADISIS1.ISISGetTag( ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0002.TAG_MAXPAGES, plValue );
   nMaxPages = plValue[ 0 ];
   LEADISIS1.ISISSetTag( ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0002.TAG_SCANAHEAD_MAXPAGES, nMaxPages / 2 );

   LEADISIS1.ISISSetTag( ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0002.TAG_COMPRESSION,
                         ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0002.TAG_COMPRESSION_G4 );
   sRet = LEADISIS1.ISISAcquireMulti( getHandle(), "c:\\temp\\jtest.tif",
                                      ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0001.ISIS_SHOWUI, (short)
                                      ltocx14n.FileConstants.FILE_CCITT_GROUP4, (short) 1 );
   LEADISIS1.ISISUnloadDriver();
   if( sRet != 0 )
   {
      if( sRet == ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0003.ERROR_USER_ABORT )
         MessageBox.show( "Acquire canceled, " + LEADISIS1.getPagesDiscarded() + " pages were aborted!" );
      else
         if( sRet !=  ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0003.ERROR_ISIS_CANCEL )
            MessageBox.show( "Error " + sRet + "\nDuring ISIS Scan" );
   }
   else
      MessageBox.show( "Image(s) acquired to file(s)" + "c:\\temp\\jtest.tif" );
}

private void LEADISIS1_ISISPage(Object source, ltisi14n.LEADISIS.ISISPageEvent e)
{
   edit1.setText( Integer.toString( e.nPage ) );
   edit2.setText( e.pszFileName );
   Application.doEvents();
}


IsISISAvailable example for Visual J++

// The following example tests to see if ISIS is available.  If not, then a message is output in MsgBox.
if( !LEADISIS1.getIsISISAvailable() )
   MessageBox.show( "ISIS Support not installed!" );


ISISSelect example for Visual J++

// The following example displays the ISISSelect DialogBox and writes a message indicating which ISIS
// Scanner Driver was selected.
LEADISIS1.ISISSelect( getHandle() );
MessageBox.show( LEADISIS1.getDriverName() + " was selected! " );


ISISSetScanOptions example for Visual J++

LEADISIS1.ISISLoadDriver();
LEADISIS1.ISISSetScanOptions( getHandle() );
LEADISIS1.ISISUnloadDriver();


IsSupportLocked (ISIS Control) example for Visual J++

int nRet = LEADISIS1.IsSupportLocked( (short) ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0004.L_SUPPORT_DOCUMENT );
if( nRet != 0 )
   MessageBox.show( "GIF Support Locked" );


KeyPress example for Visual J++

This example demonstrates the KeyPress event.

private void LEAD1_keyPress(Object source, KeyEvent e)
{
   // This example uses the KeyPress event to implement a custom scale mode.
   // There is no particular reason to put this code in this event, except that
   // we needed examples of both the event and the scale mode.
   if( e.keyChar == 67 )  // Uppercase C
   {
      // This example sets an custom scale mode and uses it to crop the
      // display. Keep in mind that the actual height and width do not change.
      // Only the unit of measure changes.

      // Change the scale so that origin is moved one-third right and one-third down
      LEAD1.setScaleLeft( -1 );
      LEAD1.setScaleTop( -1 );
      LEAD1.setScaleWidth( 3 );
      LEAD1.setScaleHeight( 3 );

      // Crop the display so that it takes up the middle third of the height and width
      LEAD1.setDstClipLeft( 0 );
      LEAD1.setDstClipTop( 0 );
      LEAD1.setDstClipWidth( 1 );
      LEAD1.setDstClipHeight( 1 );

      LEAD1.ForceRepaint();
   }
}


LevelLowBit example for Visual J++

This is also the example for LevelHighBit.

This example sets LevelLowBit and LevelHighBit to display the image using only the eight least significant bits.

LEAD1.setAutoRepaint( false );

// use least significant 8 bits
LEAD1.setLevelLowBit( (short) 0 );
LEAD1.setLevelHighBit( (short) 7 );

LEAD1.setAutoRepaint( true );


LevelLUT example for Visual J++

This is also the example for MinVal property and MaxVal property.

The following example sets LevelLowBit and LevelHighBit to use all bits, gets the minimum and maximum bits and intensity values for the image, and then sets the LUT so that pixels with values in the minimum range are mapped to the color RED, while pixels with values in the maximum range are mapped to BLUE.

LEAD1.setAutoRepaint( false );

// use all bits
LEAD1.setLevelLowBit( (short) 0 );
LEAD1.setLevelHighBit( (short) ( LEAD1.getBitmapBits() - 1 ) );

LEAD1.GetMinMaxBits();
LEAD1.GetMinMaxVal();
int nMax = LEAD1.getMaxVal();
int nMin = LEAD1.getMinVal();

// set LUT so that min range maps to RED and max range maps to BLUE
for( int i = nMin ; i <= ( nMin + 100 ) ; i++ )
   LEAD1.setLevelLUT( i, new Color( 255, 0, 0 ) );
for( int i = nMax - 100 ; i <= nMax ; i++ )
   LEAD1.setLevelLUT( i, new Color( 0, 0, 255 ) );
LEAD1.setAutoRepaint( true );


LevelLUTLength example for Visual J++

This example writes out the number of entries in the LUT.

edit1.setText( Integer.toString( LEAD1.getLevelLUTLength() ) );


LoadInfo example for Visual J++
LoadInfo... example for Visual J++

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 private section of your main form:

// Declare variables for demonstrating raw FAX.
private int m_nMyInfoBits;
private int m_nMyInfoFlags;
private int m_nMyInfoFormat;
private int m_nMyInfoHeight;
private int m_nMyInfoOffset;
private int m_nMyInfoWidth;
private int m_nMyInfoXRes;
private int m_nMyInfoYRes;

3.	 Add a Button control and code its click procedure as follows:

private void button1_click(Object source, Event e)
{
   // Make the image look OK as a 1-bit image.
   LEAD1.Size( LEAD1.getScaleWidth(), LEAD1.getScaleHeight(), (short) ltocx14n.ResizeConstants.RESIZE_RESAMPLE );
   LEAD1.Halftone( (short) ltocx14n.HalftoneConstants.HALFTONE_VIEW, 45 );

   // Set the form-level variables to the values we will use when loading.
   m_nMyInfoBits = 1;
   m_nMyInfoFlags = ltocx14n.LoadInfoFlagConstants.LOADINFO_TOPLEFT;
   m_nMyInfoFormat = ltocx14n.FileConstants.FILE_FAX_G3_2D;
   m_nMyInfoHeight = (int) LEAD1.getBitmapHeight();
   m_nMyInfoOffset = 0;
   m_nMyInfoWidth = (int) LEAD1.getBitmapWidth();
   m_nMyInfoXRes = LEAD1.getBitmapXRes();
   m_nMyInfoYRes = LEAD1.getBitmapYRes();

   // Save the image as raw FAX; then load the saved file.
   // Format information will be supplied in the LoadInfo event.
   LEAD1.Save( "c:\\lead\\images\\tmp.tif", (short) ltocx14n.FileConstants.FILE_FAX_G3_2D, (short) 1,
               (short) 1, (short) ltocx14n.SaveModifyConstants.SAVE_OVERWRITE );
   LEAD1.Load( "c:\\lead\\images\\tmp.tif", (short) (short) 0, (short) 0, (short) 1 );

   // Repaint the newly loaded image.
   LEAD1.ForceRepaint();
}

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

private void LEAD1_loadInfo(Object source, Event e)
{
   // Use the form-level variables to supply format information.
   LEAD1.setLoadInfoBits( (short) m_nMyInfoBits );
   LEAD1.setLoadInfoFlags( m_nMyInfoFlags );
   LEAD1.setLoadInfoFormat( (short) m_nMyInfoFormat );
   LEAD1.setLoadInfoHeight( m_nMyInfoHeight );
   LEAD1.setLoadInfoOffset( m_nMyInfoOffset );
   LEAD1.setLoadInfoWidth( m_nMyInfoWidth );
   LEAD1.setLoadInfoXRes( (short) m_nMyInfoXRes );
   LEAD1.setLoadInfoYRes( (short) m_nMyInfoYRes );
}

5.	Run your program to test it.


LoadMemory example for Visual J++

This example uses WIN16 API calls to load a file into memory, then uses the LoadMemory method to load the memory-resident file into a bitmap.

// Declare WIN32 API constants and functions in the private section of  your main form.
private final int OF_READ = 0x0;
private final int OF_CREATE = 0x1000;
private final int SEEK_SET = 0;
private final int SEEK_END = 2;
private final int GMEM_MOVEABLE = 0x2;

/** @dll.struct() */
class OFSTRUCT
{
   byte cBytes;
   byte fFixedDisk;
   short nErrCode;
   short Reserved1;
   short Reserved2;
   /** @dll.structmap([type=TCHAR[128]]) */
   String szPathName;
}

static /** @dll.import("KERNEL32") */
class KernelAPIs
{
   public static native int OpenFile( String lpFileName, OFSTRUCT lpReOpenBuff, int wStyle );
   public static native int _hread( int hFile, int lpBuffer, int wBytes );
   public static native int _hwrite( int hFile, int lpBuffer, int lBytes );
   public static native int _lclose( int hFile );
   public static native int _llseek( int hFile, int lOffset, int iOrigin );
   public static native int GlobalAlloc( int wFlags, int dwBytes );
   public static native int GlobalFree( int hMem );
   public static native int GlobalLock ( int hMem );
   public static native int GlobalUnlock ( int hMem );
}

private void LoadMemory_click(Object source, Event e)
{
   // Load the file into memory.
   OFSTRUCT of = new OFSTRUCT();
   int hf = KernelAPIs.OpenFile("c:\\lead\\images\\image1.cmp", of, OF_READ );
   if( hf == -1 )
   {
      MessageBox.show( "Error opening file!" );
      return;
   }

   int iSize = KernelAPIs._llseek( hf, 0, SEEK_END );
   KernelAPIs._llseek( hf, 0, SEEK_SET );
   int hMem = KernelAPIs.GlobalAlloc( GMEM_MOVEABLE, iSize );
   if( hMem == -1 )
   {
      KernelAPIs._lclose( hf );
      MessageBox.show( "Not enough memory to hold the file in memory!" );
      return;
   }

   int lpMem = KernelAPIs.GlobalLock( hMem );
   if( lpMem == 0 )
   {
      KernelAPIs._lclose( hf );
      KernelAPIs.GlobalFree( hMem );
      MessageBox.show( "Not enough memory to hold the file in memory!" );
      return;
   }

   if( KernelAPIs._hread( hf, lpMem, iSize ) != iSize )
   {
      KernelAPIs._lclose( hf );
      KernelAPIs.GlobalUnlock( hMem );
      KernelAPIs.GlobalFree( hMem );
      MessageBox.show( "Error reading file" );
      return;
   }

   KernelAPIs._lclose( hf );
   KernelAPIs.GlobalUnlock( hMem );

   // Load the bitmap from the memory-resident file.
   if( LEAD1.LoadMemory( hMem, (short) 0, (short) 0, -1, iSize ) != 0 )
      MessageBox.show( "Error calling LoadMemory" );
   else
      MessageBox.show( "LoadMemory succeeded" );
   KernelAPIs.GlobalFree( hMem );
}


LoadUseViewPerspective example for Visual J++

Note: This topic is for Document/Medical  only.

This example times the loading of a bitmap with and without changing the internal view perspective.

// Do not include paints when measuring time.
LEAD1.setAutoRepaint( false );

// Time the load using the bitmap's view perspective.
LEAD1.setLoadUseViewPerspective( true );

Time timeStart = new Time();
LEAD1.Load( "c:\\lead\\images\\ocr1.tif", (short) 0, (short) 0, (short) 1 );
Time timeEnd = new Time();
MessageBox.show( timeEnd.getSecond() - timeStart.getSecond() + " seconds loaded as is" );

// Time the load that converts the bitmap's view perspective.
LEAD1.setLoadUseViewPerspective( false );
timeStart = new Time();
LEAD1.Load( "c:\\lead\\images\\ocr1.tif", (short) 0, (short) 0, (short) 1 );
timeEnd = new Time();
MessageBox.show( timeEnd.getSecond() - timeStart.getSecond() + " seconds converted on load" );


MaxFilter example for Visual J++

Note: This topic is for Document/Medical  only.

This example erodes dark objects and repaints the image.

LEAD1.setEnableProgressEvent( true );
LEAD1.MaxFilter( (short) 3 );
LEAD1.ForceRepaint();


Median example for Visual J++

This example applies a median filter with a 3x3 neighborhood and redisplays the bitmap.

LEAD1.Median( (short) 3 );
LEAD1.ForceRepaint();


MinFilter example for Visual J++

Note: This topic is for Document/Medical  only.

This example dilates dark objects and repaints the image.

LEAD1.setEnableProgressEvent( true );
LEAD1.MinFilter( (short) 3 );
LEAD1.ForceRepaint();


Mosaic example for Visual J++

This example applies a mosaic effect with 8x8 tiles and redisplays the bitmap.

LEAD1.Mosaic( (short) 8 );
LEAD1.ForceRepaint();


ODBC Example for Visual J++

Take the following steps to create and use a simple ODBC database, containing only images.

Note:	The LEADTOOLS ActiveX requires ODBC drivers that can properly handle long binary fields. Examples have been tested and will work with version 3.0 of the Microsoft ODBC Desktop Driver Pack. (This driver pack ships with Access 95 and works on 32-bit systems.) You can download drivers from the LEAD BBS, the CompuServe forum, or the Worldwide Web home page. The CompuServe forum is at GO LEADTECH. The web page is ftp://ftp.leadtools.com/pub/utils/ODBC32.zip.  The file to download is ODBC32.ZIP.

1.	Make a copy of the project that you created in Loading and Displaying an Image; then load the copied project.

2.	Create an Access database named c:\lead\lead.mdb.

3.	Create a table with one field as follows:

Name: 	ltvbpic
Field Name: 	photo
Data Type: 	long binary

4.	Open the ODBC administrator and click the Add button.

5.	Select Microsoft Access driver and click the OK button.

6.	Enter the name LEADACCESS.

7.	Click the Select directory button and select the LEAD directory.

8.	Click the OK button; click the next OK button; then click the Close button.

9. 	9. 	In Visual J++, replace the code in the main form's constructor as follows:

public Form1()
{
   // Required for Visual J++ Form Designer support
   initForm();

   // TODO: Add any constructor code after initForm call

   Rectangle r = SystemInformation.getWorkingArea();

   // Position and size the main form so that it takes up most of the screen.
   setWidth( (int) ( r.width * 0.9f ) );
   setHeight( (int) ( r.height * 0.8f ) );
   setLeft( ( r.width - getWidth() ) / 2 );
   setTop( ( r.height - getHeight() ) / 2 );

   // Set the position and size of the LEAD control.
   // Allow for a border of 1/8 of the form size.
   // The units of measure do not matter, since we are calculating proportions.
   int nHeightAllowed = getSize().y * 3 / 4;
   int nWidthAllowed = getSize().x * 3 / 4;

   LEAD1.setLeft( ( getSize().x - nWidthAllowed ) / 2 );
   LEAD1.setTop( ( getSize().y - nHeightAllowed) / 2 );
   LEAD1.setWidth( nWidthAllowed );
   LEAD1.setHeight( nHeightAllowed );
   // Turn off automatic repainting and turn on scroll bars.
   LEAD1.setAutoRepaint( false );
   LEAD1.setAutoScroll( true );
   // Set the image display size to match the LEAD control
   LEAD1.SetDstRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
   LEAD1.SetDstClipRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
   // Display the LEAD control.
   LEAD1.setBorderStyle( (short) 1 );

   // Open the database.
   String strDatabase = "ODBC;DSN=LEADACCESS";
   LEAD1.dbOpen( strDatabase, "ltvbpic", "photo", ltocx14n.dbOpenOptionsConstants.DB_OPENOPTIONS_NONE );
   LEAD1.setDbLoadBits( (short) 24 );
   LEAD1.setDbLockingMode( (short) ltocx14n.dbLockingModeConstants.DB_LOCKINGMODE_OPTIMISTIC );
   LEAD1.ForceRepaint();
   if( LEAD1.getDbIsBOF() && LEAD1.getDbIsEOF() )
   {
      MessageBox.show( "The database is empty.", "Notice", MessageBox.OK );
      Next.setEnabled( false );
      Prev.setEnabled( false );
   }
}

10.	Add a common dialog control to your main form.

11.	At the top of your main form, add seven Buttons and name them as follows: Add, Update, Delete, First, Next, Prev, and Last.

12.	For the Add button, add the following code to the click event:

if( !LEAD1.getDbCanAppend() )
{
   MessageBox.show( "You cannot add to this database.", "Error", MessageBox.OK );
   return;
}

LEAD1.dbAddNew();
openFileDialog1.setFilter( "All Files|*.*" );
openFileDialog1.setCheckFileExists( true );
openFileDialog1.setTitle( "Open File" );
openFileDialog1.showDialog();
String strFileName = openFileDialog1.getFileName();
LEAD1.Load( strFileName, (short) 0, (short) 0, (short) 1 );
short sRet = LEAD1.dbUpdate( (short) ltocx14n.FileConstants.FILE_CMP, (short) 0,
                             (short) ltocx14n.QFactorConstants.QFACTOR_QMS );
if( sRet != 0 )
{
   MessageBox.show( "You cannot update this database.", "Error", MessageBox.OK );
   return;
}

LEAD1.dbMoveLast();
LEAD1.ForceRepaint();
MessageBox.show( "Image added to the database.", "LEAD", MessageBox.OK );
if( LEAD1.getDbIsBOF() )
   Prev.setEnabled( false );
else
   Prev.setEnabled( true );
if( LEAD1.getDbIsEOF() )
   Next.setEnabled( false );
else
   Next.setEnabled( true );

13.	For the Update button, add the following code to the click event:

if( !LEAD1.getDbCanUpdate() )
{
   MessageBox.show( "You cannot update this database.", "Error", MessageBox.OK );
   return;
}

if( LEAD1.getDbIsBOF() || LEAD1.getDbIsEOF() )
{
   MessageBox.show( "There is no current record.", "Error", MessageBox.OK );
   return;
}

if( LEAD1.getDbEditMode() == ltocx14n.dbEditModeConstants.DB_EDITMODE_NONE )
{
   LEAD1.dbEdit();
   LEAD1.Flip();
   LEAD1.ForceRepaint();
}
LEAD1.dbUpdate( (short) ltocx14n.FileConstants.FILE_CMP, (short) 0, (short) ltocx14n.QFactorConstants.QFACTOR_QMS );

14.	For the Delete button, add the following code to the click event:

if( !LEAD1.getDbCanUpdate() )
{
   MessageBox.show( "You cannot update this database.", "Error", MessageBox.OK );
   return;
}

if( LEAD1.getDbIsBOF() || LEAD1.getDbIsEOF() )
{
   MessageBox.show( "There is no current record.", "Error", MessageBox.OK );
   return;
}

LEAD1.dbDelete();
LEAD1.dbRequery();
LEAD1.dbMoveFirst();
if( LEAD1.getDbIsBOF() && LEAD1.getDbIsEOF() )
{
   Next.setEnabled( false );
   Prev.setEnabled( false );
}
LEAD1.ForceRepaint();

15.	For the First button, add the following code to the click event:

if( LEAD1.getDbIsBOF() && LEAD1.getDbIsEOF() )
{
   MessageBox.show( "The database is empty.", "Notice", MessageBox.OK );
   Next.setEnabled( false );
   Prev.setEnabled( false );
}
else
{
   LEAD1.dbMoveFirst();
   Prev.setEnabled( false );
   Next.setEnabled( true );
   LEAD1.ForceRepaint();
}

16.	For the Next button, add the following code to the click event:

if( LEAD1.getDbIsBOF() && LEAD1.getDbIsEOF() )
{
   Prev.setEnabled( false );
   Next.setEnabled( false );
   MessageBox.show( "The database is empty.", "Notice", MessageBox.OK );
}
else
{
   LEAD1.dbMoveNext();
   if( LEAD1.getDbIsEOF() )
   {
      Next.setEnabled( false );
      LEAD1.dbMovePrev();
      MessageBox.show( "Already at last record.", "Notice", MessageBox.OK );
   }
   else
      Prev.setEnabled( true );
   LEAD1.ForceRepaint();
}

17.	For the Prev button, add the following code to the click event:

if( LEAD1.getDbIsBOF() && LEAD1.getDbIsEOF() )
{
   Prev.setEnabled( false );
   Next.setEnabled( false );
   MessageBox.show( "The database is empty.", "Notice", MessageBox.OK );
}
else
{
   LEAD1.dbMovePrev();
   if( LEAD1.getDbIsBOF() )
   {
      Prev.setEnabled( false );
      LEAD1.dbMoveNext();
      MessageBox.show( "Already at first record.", "Notice", MessageBox.OK );
   }
   else
      Next.setEnabled( true );
   LEAD1.ForceRepaint();
}

18.	For the Last button, add the following code to the click event:

if( LEAD1.getDbIsBOF() && LEAD1.getDbIsEOF() )
{
   MessageBox.show( "The database is empty.", "Notice", MessageBox.OK );
   Next.setEnabled( false );
   Prev.setEnabled( false );
}
else
{
   LEAD1.dbMoveLast();
   Next.setEnabled( false );
   Prev.setEnabled( true );
   LEAD1.ForceRepaint();
}

19.	Update the main form's closing method as follows:

private void Form1_closing(Object source, CancelEvent e)
{
   LEAD1.dbClose();
}

20.	Run your program to test it.


Oilify example for Visual J++

This example applies an oil-painting effect and repaints the image. The progress event is enabled because this the Oilify method, with a neighborhood of 10, is slow.

LEAD1.setEnableProgressEvent( true );
LEAD1.Oilify( (short) 10 );
LEAD1.ForceRepaint();


OLEDropAllowed example for Visual J++

This example toggles the OLEDropAllowed property.

if( !LEAD1.getOLEDropAllowed() )
   LEAD1.setOLEDropAllowed( true );
else
   LEAD1.setOLEDropAllowed( false );


Paint event example for Visual J++

This example uses some Windows API functions to demonstrate the following:

 Paint event

 Click event

 Enabled property

 hWnd property

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

2.	Add the following declarations to the private section of your main form.

/** @dll.struct() */
class RECT
{
   int left;
   int top;
   int right;
   int bottom;
}

private RECT m_MyRect;

/** @dll.struct() */
class POINT
{
   int x;
   int y;
}

/** @dll.import("USER32") */
private static native void InvalidateRect ( int hwnd, RECT lpRect, int bErase );
/** @dll.import("GDI32") */
private static native int LineTo ( int hdc, int x, int y );
/** @dll.import("GDI32") */
private static native int MoveToEx ( int hdc, int x, int y, POINT lppt );

3.	Return to Form1, add a button to the top of your main form, and in the properties box, change both its name and text to Toggle.

4.	Add an edit box to the top of your form, and in the properties box, change its name to Directions., and change its Text property to the following:

Use the Toggle button to turn on or turn off Click-Splat

5. 	5. 	Add the following code to the Toggle button's Click event. This code uses the Enabled property to toggle the LEAD control's ability to respond to click events.

if( !LEAD1.getEnabled() )
{
   LEAD1.setEnabled( true );
   Directions.setText( "Click on the image for a splat" );
   Toggle.setText( "Disable" );
}
else
{
   LEAD1.setEnabled( false );
   Directions.setText( "Click does nothing" );
   Toggle.setText( "Enable" );
}

6.	Add the following code to the LEAD1 Click event. When the Enabled property is true, this code uses a Windows API call to generate a paint event.

// Use InvalidateRect to generate a paint message
m_MyRect.left = 0;
m_MyRect.top = 0;
m_MyRect.bottom = (int) LEAD1.getScaleHeight();
m_MyRect.right = (int) LEAD1.getScaleWidth();
int hCtl = LEAD1.getHandle();
InvalidateRect( hCtl, m_MyRect, 1 );

7.	Add the following code to the Lead1 Paint event. It uses Windows GDI functions to draw random lines on the control whenever there is a paint event.

//  Create a device context for the control that the GDI functions can access
int hLeadClientDC = LEAD1.GetClientDC();

//  Draw random lines on the control. This overlay does not affect the bitmap.
int xStart = (int) ( ( Math.random() * LEAD1.getScaleWidth() ) + 1f ) ;
int yStart = (int) ( ( Math.random() * LEAD1.getScaleHeight() ) + 1f ) ;

POINT point = new POINT() ;
MoveToEx( hLeadClientDC, xStart, yStart, point );
for( int i = 0 ; i < 50 ; i++ )
{
   int xDelta = (int) ( ( 81 * Math.random() ) - 40f );
   int yDelta = (int) ( ( 81 * Math.random() ) - 40f );
   int xEnd = xStart + xDelta;
   int yEnd = yStart + yDelta;
   LineTo( hLeadClientDC, xEnd, yEnd );
   MoveToEx( hLeadClientDC, xStart, yStart, point );
}

//  Remove the lock from the device control
LEAD1.ReleaseClientDC();

8.	Run your program to test it.


PaintContrast example for Visual J++

This example increases the contrast for painting images.

LEAD1.setPaintContrast( (short) ( LEAD1.getPaintContrast() + 100 ) );
LEAD1.ForceRepaint();


PaintDither example for Visual J++

This example turns on error diffusion and redisplays the bitmap.

LEAD1.setPaintDither( (short) ltocx14n.PaintDitherConstants.PAINTDITHER_DIFFUSION );
LEAD1.ForceRepaint();


PaintEffect example for Visual J++

The following modules use the KeyDown and KeyUp events to repaint the image with effects.

private void LEAD1_keyDown(Object source, KeyEvent e)
{
   if( e.keyData == 116 )  // Code for F5
   {
      LEAD1.setAutoRepaint( false );
      LEAD1.setBackErase( true );
      LEAD1.setEffectGrain( (short) 20 );
      LEAD1.setEffectDelay( (short) 50 );
      LEAD1.setWandSize( (short) 5 );
      LEAD1.setWandColor( new Color( 255,255,0 ) );  // Yellow Wand
      LEAD1.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_INTER_IN_THEN_OUT );
      LEAD1.ForceRepaint();
   }
}

private void LEAD1_keyUp(Object source, KeyEvent e)
{
   if( e.keyData == 116 )  // Code for F5
   {
      LEAD1.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_INTER_OUT_THEN_IN );
      LEAD1.ForceRepaint();
      LEAD1.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_NONE );
   }
}


PaintGamma example for Visual J++

This example increases the gamma correction for painting images.

LEAD1.setPaintGamma( (short) ( LEAD1.getPaintGamma() + 100 ) );
LEAD1.ForceRepaint();


PaintIntensity example for Visual J++

This example increases the intensity for painting images.

LEAD1.setPaintIntensity( (short) ( LEAD1.getPaintIntensity() + 100 ) );
LEAD1.ForceRepaint();


PaintMaxPasses example for Visual J++

This example includes two procedures. First, a button click starts a multi-pass paint effect; then LEAD's PaintNotification event changes the direction of the effect on each pass.

private void button1_click(Object source, Event e)
{
   LEAD1.setAutoRepaint( false );
   LEAD1.setPaintEffect(short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_INTER_OUT_THEN_IN );  // Set the Effect
   LEAD1.setPaintMaxPasses( (short) 5 );  // 5 total passes
   LEAD1.setPaintPass( (short) 1 );  // Start with pass number 1
   LEAD1.setPaintNotificationDelay( (short) 200 );  // Delay 200 milliseconds between passes
   LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );  // Load the image
   LEAD1.setAutoRepaint( true );
}

private void LEAD1_paintNotification(Object source, ltocx14n.LEAD.PaintNotificationEvent e)
{
   // If the first pass is complete
   if( e.uType == ltocx14n.EfxNotifyConstants.EFX_NOTIFY_IMAGE && e.uPass > 0 )
   {
      // Toggle the effect from left_to_right to right_to_left
      if( LEAD1.getPaintEffect() == ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_INTER_OUT_THEN_IN )
         LEAD1.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_INTER_IN_THEN_OUT );
      else
         LEAD1.setPaintEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_INTER_OUT_THEN_IN );
   }
}


PaintPalette example for Visual J++

This example sets the paint palette to the palette of each Lead control. It then loads two images and dithers them to 8 bits per pixel with optimized palettes, and displays them side by side.  In 8-bit display mode, you can see the palette problems that result when you do not use a fixed palette.

LEAD1.setPaintPalette( (short) ltocx14n.PaintPaletteConstants.PAINTPALETTE_AUTO );
LEAD2.setPaintPalette( (short) ltocx14n.PaintPaletteConstants.PAINTPALETTE_AUTO );

// Disable automatic repainting of the image.
LEAD1.setAutoRepaint( false );
LEAD2.setAutoRepaint( false );

// Turn off scroll bars to make sure we use the full client area.
LEAD1.setAutoScroll( false );
LEAD2.setAutoScroll( false );

// Clear the bitmaps from memory
LEAD1.setBitmap( 0 );
LEAD2.setBitmap( 0 );
setCursor( Cursor.WAIT );  // Hourglass

// Load the bitmaps. These hard-coded path names may be different on your system.
LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );
LEAD2.Load( "c:\\lead\\images\\image2.cmp", (short) 0, (short) 0, (short) 1 );

// Change the bitmaps to 8 BPS with optimized palettes
LEAD1.ColorRes( (short) 8, (short) ltocx14n.ColorResPaletteConstants.CRP_OPTIMIZEDPALETTE,
                (short) ltocx14n.ColorResDitherConstants.CRD_FLOYDSTEINDITHERING, (short) 0 );
LEAD2.ColorRes( (short) 8, (short) ltocx14n.ColorResPaletteConstants.CRP_OPTIMIZEDPALETTE,
                (short) ltocx14n.ColorResDitherConstants.CRD_FLOYDSTEINDITHERING, (short) 0 );

// Make the controls visible so that we can size and position them.
// They will not really appear until we load an image and paint it.
LEAD1.setVisible( true );
LEAD2.setVisible( true );

// Set the variables used for preserving the aspect ratio.
int nHeightFactor1 = (int) LEAD1.getBitmapHeight();
int nWidthFactor1 = (int) LEAD1.getBitmapWidth();
int nHeightFactor2 = (int) LEAD2.getBitmapHeight();
int nWidthFactor2 = (int) LEAD2.getBitmapWidth();
int nHeightAllowed = (int) ( getSize().y * 0.8f );
int nWidthAllowed = (int)( getSize().x * 0.45f );

// Center each LEAD control on half of the form, preserving the aspect ratio.
// Check to see if using the maximum width will make the image too tall.
// Set the dimensions based on the result.
if( ( ( nWidthAllowed * nHeightFactor1 ) / nWidthFactor1 ) < nHeightAllowed )
{
   LEAD1.setLeft( ( getSize().x / 4 ) - ( nWidthAllowed / 2 ) );
   LEAD1.setWidth( nWidthAllowed );
   LEAD1.setHeight( ( LEAD1.getWidth() * nHeightFactor1 ) / nWidthFactor1 );
   LEAD1.setTop( ( getSize().y - LEAD1.getHeight () ) / 2 );
}
else
{
   LEAD1.setTop( ( getSize().y - nHeightAllowed ) / 2 );
   LEAD1.setHeight( nHeightAllowed );
   LEAD1.setWidth( ( LEAD1.getHeight() * nWidthFactor1 ) / nHeightFactor1 );
   LEAD1.setLeft( ( getSize().x / 4 ) - ( LEAD1.getWidth() / 2 ) );
}

if( ( ( nWidthAllowed * nHeightFactor2 ) / nWidthFactor2 ) < nHeightAllowed )
{
   LEAD2.setLeft( ( getSize().x * 3 / 4 ) - ( nWidthAllowed / 2 ) );
   LEAD2.setWidth( nWidthAllowed );
   LEAD2.setHeight( ( LEAD2.getWidth() * nHeightFactor2 ) / nWidthFactor2 );
   LEAD2.setTop( ( getSize().y - LEAD2.getHeight() ) / 2 );
}
else
{
   LEAD2.setTop( ( getSize().y - nHeightAllowed ) / 2 );
   LEAD2.setHeight( nHeightAllowed );
   LEAD2.setWidth( ( LEAD2.getHeight() * nWidthFactor2 ) / nHeightFactor2 );
   LEAD2.setLeft( ( getSize().x * 3 / 4 ) - ( LEAD2.getWidth() / 2 ) );
}

// Set the image display sizes to match the LEAD controls
LEAD1.SetDstRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
LEAD1.SetDstClipRect( 0, 0, LEAD1.getScaleWidth(), LEAD1.getScaleHeight() );
LEAD2.SetDstRect( 0, 0, LEAD2.getScaleWidth(), LEAD2.getScaleHeight() );
LEAD2.SetDstClipRect( 0, 0, LEAD2.getScaleWidth(), LEAD2.getScaleHeight() );

// Display the images
LEAD1.ForceRepaint();
LEAD2.ForceRepaint();
setCursor( Cursor.DEFAULT );  // Default


PaintROP3 example for Visual J++

This example demonstrates the PaintROP3 property.

final int SRCINVERT = 6684742;

// Use this code to paint an inverted image.
LEAD1.setPaintROP3( SRCINVERT );
LEAD1.ForceRepaint();


PaintSizeMode Example for Visual J++

This example shows how to set the PaintSizeMode property so that the control uses only a vertical scroll bar.

LEAD1.setAutoScroll( true );
LEAD1.setAutoSetRects( true );
LEAD1.setPaintSizeMode( (short) ltocx14n.PaintSizeModeConstants.PAINTSIZEMODE_FITSIDES );
LEAD1.ForceRepaint();


PaintSizeUseDPI example for Visual J++

This example toggles the PaintSizeUseDPI property.

if( !LEAD1.getPaintSizeUseDPI() )
   LEAD1.setPaintSizeUseDPI( true );
else
   LEAD1.setPaintSizeUseDPI( false );


PaintWhileLoad example for Visual J++

This example causes the LEAD control to paint the image as it loads.

LEAD1.setAutoRepaint( false );
LEAD1.setAutoSetRects( true );
LEAD1.setPaintSizeMode( (short) ltocx14n.PaintSizeModeConstants.PAINTSIZEMODE_FIT );
LEAD1.setPaintWhileLoad( true );
LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );


PaintZoomFactor Example for Visual J++

This example shows how to set the PaintZoomFactor property so that image is scaled 200 percent for display.

LEAD1.setAutoScroll( false );
LEAD1.setAutoSetRects( true );
LEAD1.setPaintSizeMode( (short) ltocx14n.PaintSizeModeConstants.PAINTSIZEMODE_ZOOM );
LEAD1.setPaintZoomFactor( 200 );
LEAD1.ForceRepaint();


PatternStyle example for Visual J++

This example paints a transition with a diagonal cross pattern.

LEAD1.setAutoRepaint( false );
LEAD1.setEffectDelay( (short) 50 );
LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );
LEAD1.setTransitionEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_OUT );
LEAD1.setTransitionStyle( (short) ltocx14n.TransitionStyleEnum.EFX_TRANSITION_PATTERN );
LEAD1.setPatternStyle( (short) ltocx14n.PatternStyleEnum.EFX_PATTERN_DIAG_CROSS );
LEAD1.setPatternBackColor( new Color( 255, 0, 0 ) );
LEAD1.setPatternForeColor( new Color( 0, 0, 255 ) );
LEAD1.setAutoRepaint( true );


PCDRes example for Visual J++

This example checks for a high resolution image and loads it if possible.

String strMyFile = "v:\\images\\img0024.pcd";  // No PCD sample image is included with LEADTOOLS
LEAD1.GetFileInfo( strMyFile, (short) 0, 0 );

String strMsg = "";
if( LEAD1.getInfoPCDRes( (short) ltocx14n.PCDResConstants.PCDRES_4BASE ) )
{
   LEAD1.setPCDRes( (short) ltocx14n.PCDResConstants.PCDRES_4BASE );
   strMsg = "Loading 1024 x 1536 resolution";
}
else
{
   LEAD1.setPCDRes( (short) ltocx14n.PCDResConstants.PCDRES_BASE );
   strMsg = "Loading 512 x 768 resolution";
}

MessageBox.show( strMsg );
setCursor( Cursor.WAIT );  // hourglass

// Turn on the automatic display rectangles and the scroll bars.
LEAD1.setAutoSetRects( true );
LEAD1.setAutoScroll( true );

// Load the file.
LEAD1.Load( strMyFile, (short) 0, (short) 0, (short) 1 );
LEAD1.ForceRepaint();
setCursor( Cursor.DEFAULT );  // default


Picturize example for Visual J++

// replace the current image in the main control with an image created
// from all the images present in c:\images. Resize all images present in that directory
// to 32x32 pixels and load them all in memory before proceeding

LEAD1.Picturize( "c:\\lead\\images",
                (short) ( ltocx14n.PicturizeFlags.PICTURIZE_LOADALL | ltocx14n.PicturizeFlags.PICTURIZE_RESIZE ),
                32f, 32f );


Pixel example for Visual J++

This example, using the MouseDown event, gets the value of the current pixel and sets all values in the line to that value. The example shows how to convert mouse coordinates to bitmap pixel coordinates, regardless of how the image is zoomed or scrolled.

private void LEAD1_mouseDown(Object source, MouseEvent e)
{
   // Translate mouse coordinates to fractions of the destination width and height.
   int xfraction = (int) ( ( e.x - LEAD1.getDstLeft() ) / LEAD1.getDstWidth() );
   int yfraction = (int) ( ( e.y - LEAD1.getDstTop() ) / LEAD1.getDstHeight() );

   // Convert fractions to bitmap pixel coordinates.
   int xPixel = (int) ( ( LEAD1.getSrcWidth() * xfraction) + LEAD1.getSrcLeft() );
   int yPixel = (int) ( ( LEAD1.getSrcHeight() * yfraction) + LEAD1.getSrcTop() );

   // Make the whole line the same color as the pixel.
   Color xyColor = LEAD1.getPixel( xPixel, yPixel );
   for( xPixel = 0 ; xPixel <= LEAD1.getBitmapWidth(); xPixel++ )
      LEAD1.setPixel( xPixel, yPixel, xyColor );
   LEAD1.ForceRepaint();
}


Posterize example for Visual J++

This example applies a six-color poster effect and redisplays the image.

LEAD1.Posterize( (short) 6 );
LEAD1.ForceRepaint();


PreLoadFilters Example for Visual J++

This example shows how to pre-load filters.

// preload the BMP, PCX, FAX, and TIFF filters,
// and allow 1 filter to be cached, while always
// keeping 3 loaded.
LEAD1.PreLoadFilters( (short) 3, (short) 1, "BMP,PCX,FAX,TIF" );


ProgressivePasses Example for Visual J++

This example shows how to save and load a progressive file.

// Save the current image as a progressive CMP file.
LEAD1.setProgressivePasses( (short) 8 );
LEAD1.Save( "c:\\lead\\images\\TMP.cmp", (short) ltocx14n.FileConstants.FILE_CMP, (short) 24,
            (short) ltocx14n.QFactorConstants.QFACTOR_PQ2,
            (short) ltocx14n.SaveModifyConstants.SAVE_OVERWRITE );

// Set properties to show progressive paints when we load.
LEAD1.setPaintWhileLoad( true );
LEAD1.setAutoSetRects( false );

//  Load the file we just saved.
LEAD1.setProgressivePasses( (short) ltocx14n.ProgressivePassesConstants.PROGRESSIVEPASSES_WHEN_MEANINGFUL );
LEAD1.Load( "c:\\lead\\images\\TMP.cmp", (short) 0, (short) 0, (short) 1 );

// Restore the default behavior.
LEAD1.setProgressivePasses( (short) 0 );


ReadyState Example for Visual J++

This example shows how to use the ReadyState property to test whether an asynchronous load is in progress.

if( LEAD1.getReadyState() == ltocx14n.ReadyStateConstants.READYSTATE_LOADING )
   MessageBox.show( "Still loading the image" );


Resize event example for Visual J++

This example demonstates the Resize event.

private void LEAD1_ctlResize(Object source, Event e)
{
   // Before using this example you must add an edit box to your form.
   // Then, you can exercise this example by coding a command button that
   // changes the width and height of the Lead1 control

   edit1.setText( "Control size: " + LEAD1.getWidth() + " x " + LEAD1.getHeight() );
}


RgnChange example for Visual J++

The following code for the RgnChange event updates a text box using the GetRgnArea method. You can test it by adding a text box for the lesson described in Outlining, Dragging, and Pasting a Region.

private void LEAD1_rgnChange(Object source, Event e)
{
   String strMyText = "Number of pixels in region: ";
   strMyText += LEAD1.GetRgnArea();
   edit1.setText( strMyText );
}


Rotate example for Visual J++

This example rotates the bitmap 45 degrees and redisplays the image. It resizes the bitmap to accommodate the rotation and uses blue as the fill color.

LEAD1.Rotate( 4500, ROTATE_RESIZE, new Color( 0,0,255 ) );
LEAD1.setAutoSetRects( true );  // Make sure the display rectangles are adjusted
LEAD1.ForceRepaint();


Saturation example for Visual J++

This example increases the saturation of colors in the bitmap and redisplays the image.

LEAD1.Saturation( (short) 1000 );
LEAD1.ForceRepaint();


Save example for Visual J++

This example saves the image as a PNG file, loads the new file, and redisplays the bitmap.

setCursor( Cursor.WAIT );  // Hourglass
LEAD1.Save( "c:\\lead\\images\\tmp.png", (short) ltocx14n.FileConstants.FILE_PNG, (short) 8, (short) 1,
            (short) ltocx14n.SaveModifyConstants.SAVE_OVERWRITE );
LEAD1.Load( "c:\\lead\\images\\tmp.png", (short) 0, (short) 0, (short) 1 );
LEAD1.ForceRepaint();
setCursor( Cursor.DEFAULT );  // default


SaveInterlaced example for Visual J++

This example saves the current image as an interlaced GIF file, then loads the saved image with a paint-while-load effect that shows the interlaced behavior.

// Save the current image as an interlaced GIF file.
LEAD1.setSaveInterlaced( true );
LEAD1.Save( "c:\\temp\\tmp.gif", (short) ltocx14n.FileConstants.FILE_GIF, (short) 8, (short) 1,
            (short) ltocx14n.SaveModifyConstants.SAVE_OVERWRITE );

// Clear the bitmap so that we can see the paint-while-load effect.
LEAD1.setBitmap( 0 );

// Paint the image while loading, showing that it is interlaced.
LEAD1.setPaintWhileLoad( true );
LEAD1.Load( "c:\\temp\\tmp.gif", (short) 0, (short) 0, (short) 1 );


SaveMemory example for Visual J++

This example uses SaveMemory to save a bitmap to a memory-resident file, uses GetMemoryInfo to examine the file size; then uses WIN16 API calls to save the file to disk and free the memory.

//  Declare WIN32 API constants and functions in the private section of your main form:

private final int OF_READ = 0x0;
private final int OF_CREATE = 0x1000;
private final int SEEK_SET = 0;
private final int SEEK_END = 2;
private final int GMEM_MOVEABLE = 0x2;

/** @dll.struct() */
class OFSTRUCT
{
   byte cBytes;
   byte fFixedDisk;
   short nErrCode;
   short Reserved1;
   short Reserved2;
   /** @dll.structmap([type=TCHAR[128]]) */
   String szPathName;
}

static /** @dll.import("KERNEL32") */
class KernelAPIs
{
   public static native int OpenFile( String lpFileName, OFSTRUCT lpReOpenBuff, int wStyle );
   public static native int _hread( int hFile, int lpBuffer, int wBytes );
   public static native int _hwrite( int hFile, int lpBuffer, int lBytes );
   public static native int _lclose( int hFile );
   public static native int _llseek( int hFile, int lOffset, int iOrigin );
   public static native int GlobalAlloc( int wFlags, int dwBytes );
   public static native int GlobalFree( int hMem );
   public static native int GlobalLock ( int hMem );
   public static native int GlobalUnlock ( int hMem );
}

private void button1_click(Object source, Event e)
{
   int phMem[] = { 0 } ;
   int piSize[] = { 0 } ;

   if( LEAD1.SaveMemory( phMem, (short) ltocx14n.FileConstants.FILE_LEAD, (short) 24, (short) 2, piSize ) != 0 )
   {
      MessageBox.show( "Error calling SaveMemory" );
      return;
   }

   int hMem = phMem[ 0 ];
   int iSize = piSize[ 0 ];

   if( LEAD1.GetMemoryInfo( hMem, (short) 0, iSize ) != 0 )
   {
      KernelAPIs.GlobalFree( hMem );
      return;
   }

   // Ask for a confirmation to save this file
   String strMsg = "File info:\n";
   strMsg += LEAD1.getInfoWidth() + " x " + LEAD1.getInfoHeight();
   strMsg += " x " + LEAD1.getInfoBits() + " BPP\n";
   strMsg += "Size in memory: " + LEAD1.getInfoSizeMem() + "\n";
   strMsg += "Size on disk : " + LEAD1.getInfoSizeDisk();

   if( MessageBox.show( strMsg, "Write this file on disk", MessageBox.YESNO ) == MessageBox.IDNO )
   {
      KernelAPIs.GlobalFree( hMem );
      return;
   }

   int lpMem = KernelAPIs.GlobalLock( hMem );
   if( lpMem == 0 )
   {
      KernelAPIs.GlobalFree( hMem );
      MessageBox.show( "Error calling GlobalLock" );
      return;
   }

   OFSTRUCT of = new OFSTRUCT();
   int hf = KernelAPIs.OpenFile( "c:\\lead\\images\\savemem.cmp", of, OF_CREATE );
   if( hf == -1 )
   {
      KernelAPIs.GlobalUnlock( hMem );
      KernelAPIs.GlobalFree( hMem );
      MessageBox.show( "Error calling GlobalLock" );
      return;
   }

   if( KernelAPIs._hwrite( hf, lpMem, iSize ) != iSize )
      MessageBox.show( "Error calling hwrite" );
   else
      MessageBox.show( "The file was saved successfully on disk." );
   KernelAPIs._lclose( hf );
   KernelAPIs.GlobalUnlock( hMem );
   KernelAPIs.GlobalFree( hMem );
}


SavePage example for Visual J++

// replace page 1 from TEST.TIF
LEAD1.setSavePage( (short) 1 );
LEAD1.Save( "TEST.TIF", (short) ltocx14n.FileConstants.FILE_TIF, (short) 8, (short) 0,
            (short) ltocx14n.SaveModifyConstants.SAVE_REPLACE );


SaveWithStamp example for Visual J++

This example saves the image in a JPEG file that includes a thumbnail (stamp) image. It then loads the thumbnail from the new file.

LEAD1.SaveWithStamp( "c:\\lead\\images\\stamp.jpg", (short) ltocx14n.FileConstants.FILE_JPEG,
                     (short) 24, (short) 30, (short) 150, (short) 100, (short) 24 );
LEAD1.LoadStamp( "c:\\lead\\images\\stamp.jpg" );
LEAD1.ForceRepaint();


Scroll event example for Visual J++

This example demonstrates the Scroll event.

private void LEAD1_scroll(Object source, Event e)
{
   // Add an edit box control to your form and use it for this test
   edit1.setText( "Image origin: " + LEAD1.getDstLeft() + ", " + LEAD1.getDstTop() );
}


SetRgn... example for Visual J++

This example demonstrates the SetRgnEllipse, SetRgnRect, SetRgnRoundRect, and SetRgnPolygon methods by simulating client area coordinates. Normally, you would get the coordinates interactively from mouse events and would use Windows GDI functions to outline the shape of each region before it is created.

To create the polygonal region, this example uses the PolygonSize, PolygonX, and PolygonY properties.

Also, to demonstrate the SetRgnColor method, it uses the Fill method to fill the region with a solid color, then uses the fill color to create a new region.

// Initialize the variables that we will manipulate to simulate mouse coordinates.
int nOffsetX = (int) LEAD1.getScaleWidth() / 15;
int nOffsetY = (int) LEAD1.getScaleHeight() / 15;
int nCurrentX = nOffsetX;
int nCurrentY = nOffsetY;

// Set the zoom factors.
float fZoomFactorX = LEAD1.getDstWidth() / LEAD1.getSrcWidth();
float fZoomFactorY = LEAD1.getDstHeight() / LEAD1.getSrcHeight();

// Start by simulating the drawing of a rectangle.
int nSimLeft = nCurrentX;
int nSimTop = nCurrentY;
int nSimWidth = nOffsetX * 2;
int nSimHeight = nOffsetY * 2;

// Translate the simulated client coordinates to bitmap coordinates.
int nLBRgnLeft = (int) ( ( nSimLeft / fZoomFactorX) - ( LEAD1.getDstLeft() / fZoomFactorX ) + LEAD1.getSrcLeft() );
int nLBRgnTop = (int) ( ( nSimTop / fZoomFactorY) - ( LEAD1.getDstTop() / fZoomFactorY ) + LEAD1.getSrcTop() );
int nLBRgnWidth = (int) ( nSimWidth / fZoomFactorX );
int nLBRgnHeight = (int) ( nSimHeight / fZoomFactorY );

// Create the rectangular region, outline it, and display a message so that we can see what happened.
LEAD1.SetRgnRect( nLBRgnLeft, nLBRgnTop, nLBRgnWidth, nLBRgnHeight, (short) ltocx14n.RgnCombineModeConstants.L_RGN_SET );
LEAD1.setRgnFrameType( (short) ltocx14n.RgnFrameTypeConstants.RGNFRAME_STATIC );
MessageBox.show( "Here is the rectangular region" );

// Move the current mouse position so that we overlap the existing region.
nCurrentX += nOffsetX;
nCurrentY += nOffsetY;

// Next, simulate the drawing of an ellipse.
nSimLeft = nCurrentX;
nSimTop = nCurrentY;
nSimWidth = nOffsetX * 3;
nSimHeight = nOffsetY * 2;

// Translate the simulated client coordinates to bitmap coordinates.
nLBRgnLeft = (int) ( ( nSimLeft / fZoomFactorX) - ( LEAD1.getDstLeft() / fZoomFactorX ) +LEAD1.getSrcLeft() );
nLBRgnTop = (int) ( ( nSimTop / fZoomFactorY) - ( LEAD1.getDstTop() / fZoomFactorY ) + LEAD1.getSrcTop() );
nLBRgnWidth = (int) ( nSimWidth / fZoomFactorX );
nLBRgnHeight = (int) ( nSimHeight / fZoomFactorY );

// Add the elliptical region, using a Boolean OR,
// and display a message so that we can see what happened.
LEAD1.SetRgnEllipse( nLBRgnLeft, nLBRgnTop, nLBRgnWidth, nLBRgnHeight, (short) ltocx14n.RgnCombineModeConstants.L_RGN_OR );
LEAD1.setRgnFrameType( (short) ltocx14n.RgnFrameTypeConstants.RGNFRAME_STATIC );
MessageBox.show( "Here is the added ellipse, with a Boolean OR" );

// Move the current mouse position so that we overlap the existing region.
nCurrentX += nOffsetX;
nCurrentY += nOffsetY;

// Next, simulate the drawing of a rounded rectangle.
nSimLeft = nCurrentX;
nSimTop = nCurrentY;
nSimWidth = nOffsetX * 3;
nSimHeight = nOffsetY * 2;

// Translate the simulated client coordinates to bitmap coordinates.
nLBRgnLeft = (int) ( ( nSimLeft / fZoomFactorX) - ( LEAD1.getDstLeft() / fZoomFactorX ) + LEAD1.getSrcLeft() );
nLBRgnTop = (int) ( ( nSimTop / fZoomFactorY) - ( LEAD1.getDstTop() / fZoomFactorY ) + LEAD1.getSrcTop() );
nLBRgnWidth = (int) ( nSimWidth / fZoomFactorX );
nLBRgnHeight = (int) ( nSimHeight / fZoomFactorY );

// Define an ellipse to use for the corners.
int eW = nLBRgnWidth / 4;
int eH = nLBRgnHeight / 4;

// Add the rounded rectangular region, using a Boolean exclusive OR,
// and display a message so that we can see what happened.
LEAD1.SetRgnRoundRect( nLBRgnLeft, nLBRgnTop, nLBRgnWidth, nLBRgnHeight, eW, eH, (short) ltocx14n.RgnCombineModeConstants.L_RGN_XOR );
MessageBox.show( "Here is the rounded rectangle, with a Boolean XOR" );

// Move the current mouse position so that we overlap the existing region.
nCurrentX += 2 * nOffsetX;
nCurrentY += 2 * nOffsetY;

// Set up some arrays to use as client area grid values.
// OffsetX and OffsetY set the grid sizes.
int [] xPoint = { 0, -1, 2, 1, 1, 2, -1, -2 };
int [] yPoint = { 0, -1, -1, 1, -1, 1, 1, 1 };

// Initialize the polygon size using an arbitrary number.
// This number will be increased dynamically.
LEAD1.setPolygonSize( (short) 5 );

// Fill in the array for the polygon. This simulates a user's mouse clicks.
short i;
for( i = 0 ; i < 8 ; i ++ )
{
   nCurrentX += xPoint[ i ] * nOffsetX;
   nCurrentY += yPoint[ i ] * nOffsetY;
   LEAD1.setPolygonX( i, (int) ( ( nCurrentX / fZoomFactorX ) - ( LEAD1.getDstLeft() / fZoomFactorX ) + LEAD1.getSrcLeft() ) );
   LEAD1.setPolygonY( i, (int) ( ( nCurrentY / fZoomFactorY ) - ( LEAD1.getDstTop() / fZoomFactorY ) + LEAD1.getSrcTop() ) );
   if( ( i + 1 ) == LEAD1.getPolygonSize() )
      LEAD1.setPolygonSize( (short) ( LEAD1.getPolygonSize() + 5 ) );
}

// Adjust the polygon size to the actual number of points.
LEAD1.setPolygonSize( i );

// Add the polygonal region, using a Boolean OR,
// and display a message so that we can see what happened.
LEAD1.SetRgnPolygon( (short) ltocx14n.RgnPolygonFillModeConstants.L_POLY_WINDING, (short) ltocx14n.RgnCombineModeConstants.L_RGN_OR );
MessageBox.show( "Here is the added polygon, with a Boolean OR" );

// Fill the resulting polygon with red, and display a message.
LEAD1.Fill( new Color( 255, 0, 0 ) );
LEAD1.setRgnFrameType( (short) ltocx14n.RgnFrameTypeConstants.RGNFRAME_NONE );
LEAD1.ForceRepaint();
MessageBox.show( "Using SetRgnColor and L_RGN_SETNOT, all else will become blue." );

// Clean up memory
LEAD1.FreeRgn();

// Do the final region.
LEAD1.SetRgnColor( new Color( 255, 0, 0 ), (short) ltocx14n.RgnCombineModeConstants.L_RGN_SETNOT );
LEAD1.Fill( new Color( 0, 0, 255 ) );
LEAD1.ForceRepaint();

// Clean up memory
LEAD1.FreeRgn();
LEAD1.setPolygonSize( (short) 0 );


SetSrcClipRect example for Visual J++

This example crops the image by reducing the source clipping area and repaints the image.

int nNewLeft = (int) ( LEAD1.getSrcClipLeft() + ( LEAD1.getSrcClipWidth() * 0.1f ) );
int nNewTop = (int) ( LEAD1.getSrcClipTop() + ( LEAD1.getSrcClipHeight() * 0.1f ) );
int nNewWidth = (int) ( LEAD1.getSrcClipWidth() * 0.8f );
int nNewHeight = (int) ( LEAD1.getSrcClipHeight() * 0.8f );
if( nNewWidth > 1 && nNewHeight >1 )
   LEAD1.SetSrcClipRect( nNewLeft, nNewTop, nNewWidth, nNewHeight );
LEAD1.ForceRepaint();


SetSrcRect example for Visual J++

This example zooms in on the image by reducing the source rectangle and repaints the image.

int nNewLeft = (int) ( LEAD1.getSrcLeft() + ( LEAD1.getSrcWidth() * 0.1f ) );
int nNewTop = (int) ( LEAD1.getSrcTop() + ( LEAD1.getSrcHeight() * 0.1f ) );
int nNewWidth = (int) ( LEAD1.getSrcWidth() * 0.8f );
int nNewHeight =(int) ( LEAD1.getSrcHeight() * 0.8f );
if( nNewWidth > 1 && nNewHeight > 1 )
   LEAD1.SetSrcRect( nNewLeft, nNewTop, nNewWidth, nNewHeight );
LEAD1.ForceRepaint();


Sharpen example for Visual J++

This example increases the sharpness of the bitmap and redisplays the image.

LEAD1.Sharpen( (short) 100 );
LEAD1.ForceRepaint();


Shear example for Visual J++

This example shears the bitmap 5 degrees horizontally and redisplays the image. It uses blue as the fill color.

LEAD1.Shear( (short) 500, true, new Color( 0,0,255 ) );
LEAD1.ForceRepaint();


Solarize example for Visual J++

This example applies a solarize effect and repaints the image.

LEAD1.Solarize( (short) 100 );
LEAD1.ForceRepaint();


SpatialFilter example for Visual J++

This example applies Laplacian line detection and redisplays the image.

LEAD1.SpatialFilter( (short) ltocx14n.SpatialFilterConstants.FLT_LAPLACE_1 );
LEAD1.ForceRepaint();


Src... example for Visual J++

This example uses the source rectangle properties to zoom in on the image.

// Calculate the values to zoom in by 10 percent and center the image.
if( LEAD1.getSrcWidth() > 1 && LEAD1.getSrcHeight() > 1 )
{
   LEAD1.setSrcWidth( LEAD1.getSrcWidth() * 0.9f );
   LEAD1.setSrcHeight( LEAD1.getSrcHeight() * 0.9f );
   LEAD1.setSrcTop( ( LEAD1.getBitmapHeight() - LEAD1.getSrcHeight() ) / 2 );
   LEAD1.setSrcLeft( ( LEAD1.getBitmapWidth() - LEAD1.getSrcWidth() ) / 2 );
}

// Set the clipping area to the same as the source rectangle
LEAD1.setSrcClipWidth( LEAD1.getSrcWidth() );
LEAD1.setSrcClipHeight( LEAD1.getSrcHeight() );
LEAD1.setSrcClipTop( LEAD1.getSrcTop() );
LEAD1.setSrcClipLeft( LEAD1.getSrcLeft() );

// Redisplay the image
LEAD1.ForceRepaint();


StretchIntensity example for Visual J++

This example stretches the intensity and redisplays the image.

LEAD1.StretchIntensity();
LEAD1.ForceRepaint();


TextWordWrap example for Visual J++

This example wraps text inside the rectangle that is specified for the text object.

// Text location
LEAD1.setTextTop( 10 );
LEAD1.setTextLeft( 10 );
LEAD1.setTextWidth( 150 );
LEAD1.setTextHeight( 150 );

// Text alignment and angle
LEAD1.setTextAlign( (short) ltocx14n.EfxTextAlignConstants.EFX_TEXTALIGN_LEFT_VCENTER );
LEAD1.setTextAngle( (short) 0 );

// Enable word wrap
LEAD1.setTextWordWrap( true );
LEAD1.DrawText( "LEADTOOLS 14 Supports WordWrap when drawing text.", 0 );


TransitionEffect example for Visual J++

This example paints a transition with a 255-step grayscale gradient.

LEAD1.setAutoRepaint( false );
LEAD1.setEffectDelay( (short) 50 );
LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );
LEAD1.setTransitionEffect( (short) ltocx14n.EfxPaintEffectConstants.EFX_EFFECT_WIPE_RECTANGLE_OUT );
LEAD1.setTransitionStyle( (short) ltocx14n.TransitionStyleEnum.EFX_TRANSITION_GRADIENT );
LEAD1.setGradientStyle( (short) ltocx14n.GradientStyleEnum.EFX_GRADIENT_ANGLE_TO_LT );
LEAD1.setGradientEndColor( new Color( 0, 0, 0 ) );
LEAD1.setGradientStartColor( new Color( 255, 255, 255 ) );
LEAD1.setGradientSteps( (short) 255 );
LEAD1.setAutoRepaint( true );


TransparentColor example for Visual J++

This example sets white as a transparent color; then loads a test image and paints it.

LEAD1.setAutoRepaint( false );

// Enable transparency
LEAD1.setBitmapEnableTransparency( true );

// Make white the transparent color
LEAD1.setBitmapTransparentColor( new Color( 255, 255, 255 ) );
LEAD1.Load( "c:\\lead\\images\\ulay5.bmp", (short) 0, (short) 0, (short) 1 );
LEAD1.ForceRepaint();


Trim example for Visual J++

This example trims one-tenth from the bitmap and repaints the image.

int nNewLeft = (int) ( LEAD1.getBitmapWidth() * 0.1f );
int nNewTop = (int) ( LEAD1.getBitmapHeight() * 0.1f );
int nNewWidth = (int) ( LEAD1.getBitmapWidth() * 0.8f );
int nNewHeight = (int) ( LEAD1.getBitmapHeight() * 0.8f );
LEAD1.Trim( nNewLeft, nNewTop, nNewWidth, nNewHeight );

// Set variables for the position and size of the display rectangle.
int nViewWidth = (int) LEAD1.getScaleWidth();
int nViewHeight = (int) LEAD1.getScaleHeight();

// Set the image display size to match the LEAD control
LEAD1.SetDstRect( 0, 0, nViewWidth, nViewHeight );
LEAD1.SetDstClipRect( 0, 0, nViewWidth, nViewHeight );
LEAD1.ForceRepaint();


Underlay example for Visual J++

This example loads a bitmap into Lead2 and uses it as a tiled underlay for Lead1.

LEAD2.setVisible( false );
LEAD2.Load( "c:\\lead\\images\\ulay1.bmp", (short) 0, (short) 0, (short) 1 );
LEAD1.Underlay( LEAD2.getBitmap(), (short) ltocx14n.UnderlayConstants.UNDERLAY_TILE );
LEAD1.ForceRepaint();


UnlockSupport (ISIS Control) example for Visual J++

// Unlock Document support.
// Note that this is a sample key, which will not work in your toolkit.
LEADISIS1.UnlockSupport( (short) ltisi14n.__MIDL___MIDL_itf_ltisis_0138_0004.L_SUPPORT_DOCUMENT, "TestKey" );


UserPalette and BitmapPalette example for Visual J++

This example demonstrates the UserPalette and BitmapPalette properties.

// Specify a blue and white user palette
LEAD1.setUserPalette( (short) 0, new Color( 0, 0, 255 ) );
LEAD1.setUserPalette( (short) 1, new Color( 255, 255, 255 ) );

// Implement the user palette
LEAD1.ColorRes( (short) 1, (short) ltocx14n.ColorResPaletteConstants.CRP_USERPALETTE, (short) ltocx14n.ColorResDitherConstants.CRD_ORDEREDDITHERING, (short) 2 );

// Display the blue and white image
LEAD1.ForceRepaint();
MessageBox.show( "This is the user palette. Click OK to change the bitmap palette." );

// Change the bitmap palette to red and white
LEAD1.setBitmapPalette( (short) 0, new Color( 255, 0, 0 ) );
LEAD1.setBitmapPalette( (short) 1, new Color( 255, 255, 255 ) );

// Display the red and white image
LEAD1.ForceRepaint();


Version... example for Visual J++

This example puts the version information into a string and displays the string in a message box.

String strLevel = "";
if( LEAD1.getVersionLevel() == ltocx14n.VersionLevelConstants.VERSIONLEVEL_EXP )
   strLevel = "Document/Medical";
else
   strLevel = "Professional Edition";

String strMsg = LEAD1.getVersionProduct() + "\n" + strLevel + "\n";
strMsg += "Version: " + LEAD1.getVersionMajor() + ".";
strMsg += LEAD1.getVersionMinor() + "\n";
strMsg += "Date produced: " + LEAD1.getVersionDate() + "\n";
strMsg += "Time produced: " + LEAD1.getVersionTime() + "\n";

// Display the message box
MessageBox.show( strMsg, "Version Info", MessageBox.OK );


WindowLevel example for Visual J++

This example converts a bitmap to 12-bit grayscale and then performs window leveling on the four most significant bits of the image.

LEAD1.Grayscale( (short) 12 );  // Grayscale image to 12-bit
LEAD1.setLevelLowBit( (short) 8 );  // use 4 most significant bits
LEAD1.setLevelHighBit( (short) 11 );
LEAD1.WindowLevel();


ZoomIn example for Visual J++

This example calls ZoomIn() method to zoom in on a captured image.

LEAD1.ZoomIn();


ZoomInDone example for Visual J++

This example triggers the ZoomInDone event and displays a message that the ZoomIn image has been captured.

private void LEAD1_zoomInDone(Object source, ltocx14n.LEAD.ZoomInDoneEvent e)
{
   MessageBox.show( "ZoomIn Captured: " + e.x + "," + e.y );
}


Bitmap property (ISIS Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	long Bitmap

Overview	Using ISIS to Scan Images

Remarks

(Document/Medical)  Gets the bitmap returned when the ISISAcquire method is used to scan an image.

When assigning from the Main Bitmap property to this property, a reference to the source bitmap is created.  A copy is NOT made.  To remove the reference, assign a value of 0.  If you assign from this property to a Main Control, a copy of the image will be made in the target Main Control, unless the Main Control's RefBitmap property is set to True.

See Also

Elements	RefBitmap property, ISISAcquire method

Topics	Raster Images: Scanning Images using ISIS


Bitmap property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE Bitmap

Overview	Refer to Bitmaps and Bitmap Lists.

Remarks

Is the handle to the bitmap.

There are four bitmap properties, one for each of the custom controls, Main, Imaging Common Dialog, ISIS, and OLEDB.  If you wish to use a Main Control bitmap in an Imaging Common Dialog dialog box, you must assign the Main Bitmap property to the Imaging Common Dialog Bitmap property.  If you scan an image into the ISIS Bitmap property and you want to use that bitmap in the Main Bitmap property, you must assign the ISIS Bitmap property to the Main Bitmap property.

Setting this property to 0 clears the bitmap from memory. You can assign its value to another Main Control's Bitmap property to create a copy.

If a region is defined for the bitmap, the region is also freed or copied.

When assigning from this property to one of the other custom controls, a reference is made to the Main Control's bitmap. For more information, refer to Imaging Common Dialog Bitmap, ISIS Bitmap or OLE DB Bitmap.

When assigning to this property, a copy of the source control's bitmap is made unless the Main Control's RefBitmap property is set to True.  Use the RefBitmap property to avoid having a second copy of the source image in memory.

If you assign a bitmap to the Bitmap property, the current bitmap in the bitmap list will be replaced. If you set the Bitmap property to 0, the current bitmap is removed from the bitmap list. For example, if you load a file that contains 4 images into a bitmap list, and then set the Bitmap property to 0, the current bitmap will be removed from the bitmap list and BitmapListCount property will be decreased by 1.

See Also

Elements:	RefBitmap property

Topics	Raster Images: Creating and Deleting Images
Raster Images: Creating and Maintaining Lists of Images
Raster Images: Copying Images
LEADTOOLS API Integration Functions


Bitmap property (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long Bitmap

Overview	Refer to Working with MRC Bitmap.

Remarks

Handle to the control's bitmap.

Assigning to this property from another Control's Bitmap (e.g. Main Control) creates a new copy of the bitmap.

Loading an MRC image updates this property.

The control should have a valid bitmap before either Auto or Manual Segmentation are attempted.

See Also

Elements	Load method, AutoSegment method, SetNewStripe method

Topics	MRC Bitmap Functions: General Segmentation


Bitmap property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long Bitmap

Overview	Refer to Using the OLE DB Control.

Remarks

Is the handle to the bitmap.

When assigning from the Main Bitmap property to this property, a reference to the source bitmap is created.  A copy is NOT made.  To remove the reference, assign a value of 0.  If you assign from this property to a Main Control, a copy of the image will be made in the target Main Control, unless the Main Control's RefBitmap property is set to True. Use the RefBitmap property to avoid having a second copy of the source image in memory.

When storing images to the database, you should assign the image to be saved from the Main control.  In the DataSaved event, you can release the reference to the Main Control's Bitmap by setting the OLE DB Control's Bitmap property to 0.

When loading images from the database, you can copy or send the image to a Main Control in the DataLoaded.  If you do not set the target Main Control's RefBitmap property to True before assigning the Bitmap property, a copy of the image will be made.  This is not recommended when you are dealing with large images.

See Also

Elements	RefBitmap property, AnnContainer property, DataDirty property, DataLoaded event, DataSaved event

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


BitmapAlpha property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE BitmapAlpha

Overview	Refer to Working with the Alpha Channel.

Remarks

Lets you get or set alpha-channel data in a bitmap.

Typically, an alpha channel contains a mask that is used for transparency. This property, used with the region processing methods, lets you implement transparency in saved images.

When you get the value of this property (assigning it to another Main Control) you get an 8-bit grayscale bitmap that matches the current alpha channel data. When you set the value from another Main Control, LEADTOOLS interprets the bitmap data, if necessary, to update the alpha channel data.

Only 16- and 32-bit images can have an alpha channel. If you set this property in a control that has any other color resolution, the bitmap is converted to 32-bit. (If you want 16-bit, you should change it using the ColorRes method, if necessary, before setting the property.)

See Also

Elements	SetRgnColor method, GetRgnHandle method, SetRgnHandle method

Topics	Implementing Transparency


BitmapBits property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short BitmapBits

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Read only) Is the number of bits per pixel for the bitmap.

See Also

Elements	BitmapHeight property, BitmapWidth property, BitmapXRes property, BitmapYRes property, GetColorCount method

Topics	Raster Images: Getting Current Information


BitmapCompression property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short BitmapCompression

Overview	Refer to Super Compressed Bitmaps

Remarks

Indicates the compression used in storing the bitmap in memory.

Reading the property gives the user the current compression used by the bitmap.

When the property is set, the bitmap's compression is changed to match the desired compression. An exception occurs if the compression type is invalid. For example, trying to compress a bitmap that is not 1-bit, or trying to super-compress a bitmap that is not 1-bit or 24-bit will result in an exception. For more information, refer to the LoadCompressed property.

See Also

Elements:	LoadCompressed property

Topics:	Raster Images: Getting Current Information


BitmapDataPath property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BSTR BitmapDataPath

Overview	Refer to Implementing Internet Features.

Remarks

(persistent property, available at design time) Loads the specified bitmap asynchronously. The value can be a local pathname or an Internet URL.

To manage the loading, you can use the ReadyState property and the ReadyStateChange event.

See Also

Elements	ReadyState property, ReadyStateChange event

Topics	Raster Images: Loading Files


BitmapDataPathClosed event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void BitmapDataPathClosed ();

Overview	Refer to Implementing Internet Features.

Remarks

Occurs when the bitmap has finished downloading from the Internet, or if the bitmap could not download from this path for any reason.

See Also

Elements	BitmapDataPath property, ReadyState property, ReadyStateChange event

Topics	Raster Images: Loading Files


BitmapDelay property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long BitmapDelay

Overview	Refer to Playing an Animation.

Remarks

Sets or gets the animation playback delay in milliseconds (ms).

The delay is the wait period before the bitmap is displayed during playback. It can be different for each bitmap in a list (but it is usually the same).

See Also

Elements	BitmapDisposalMethod property, BitmapEnableTransparency property, BitmapTransparentColor property

Topics	Raster Images: Playing Animated Images


BitmapDisposalMethod property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short BitmapDisposalMethod

Overview	Refer to Playing an Animation.

Remarks

Sets or gets the animation playback disposal method.

The disposal method can be different for each bitmap in a list (but it is usually the same). The following are constants for the disposal methods used after rendering an image in an animation playback:

Value	Meaning

ANIMATIONDISPOSAL_NONE	Do nothing.

ANIMATIONDISPOSAL_LEAVE	Leave the target bitmap as is.

ANIMATIONDISPOSAL_RESTOREBACKGROUND	Restore the background.

ANIMATIONDISPOSAL_RESTOREPREVIOUS	Restore the previous image.

See Also

Elements	BitmapDelay property, BitmapEnableTransparency property, BitmapTransparentColor property

Topics	Raster Images: Playing Animated Images


BitmapEnableTransparency property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL BitmapEnableTransparency

Overview	Refer to Playing an Animation.

Remarks

Enables or disables the use of a transparent color when playing an animation.

The color is specified by the BitmapTransparentColor property. The use of transparency can be different for each bitmap in a list (but it is usually the same).

Value	Meaning

TRUE	Enable transparency.

FALSE	Disable transparency.

See Also

Elements	BitmapDelay property, BitmapDisposalMethod property, BitmapTransparentColor property

Topics	Raster Images: Playing Animated Images
Implementing Transparency


BitmapHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float BitmapHeight

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Read only) Is the height of the bitmap. The unit of measure is determined by the ScaleMode property.

See Also

Elements	BitmapBits property, BitmapWidth property, BitmapXRes property, BitmapYRes property, GetColorCount method

Topics	Raster Images: Getting Current Information


BitmapLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float BitmapLeft

Overview	Refer to Playing an Animation.

Remarks

Specifies the X coordinate of the origin of the bitmap relative to the target bitmap during animation playback. The unit of measure is determined by the ScaleMode property.

See Also

Elements	BitmapTop property

Topics	Raster Images: Playing Animated Images


BitmapList property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE BitmapList

Overview	Refer to Bitmaps and Bitmap Lists.

Remarks

Is the handle to the bitmap list.

You can use this property to copy an entire list of bitmaps from one Main Control to another. You can also set this property to 0 to free all bitmaps in the list.

If you assign a bitmap to the Bitmap property, the current bitmap in the bitmap list will be replaced. If you set the Bitmap property to 0, the current bitmap is removed from the bitmap list. For example, if you load a file that contains 4 images into a bitmap list, and then set the Bitmap property to 0, the current bitmap will be removed from the bitmap list and BitmapListCount property will be decreased by 1.

See Also

Topics	Raster Images: Creating and Maintaining Lists of Images
Raster Images: Copying Images


BitmapListCount property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short BitmapListCount

Overview	Refer to Bitmaps and Bitmap Lists.

Remarks

(Read only) Is the number of bitmaps in the control's bitmap list.

See Also

Topics	Raster Images: Creating and Maintaining Lists of Images


BitmapListIndex property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short BitmapListIndex

Overview	Refer to Bitmaps and Bitmap Lists.

Remarks

Is the index of the current bitmap in the control's bitmap list.

You can set this property to specify the current bitmap. For example, if you wanted to resize all bitmaps in a list, you would use a loop that updates this property before calling the Size method.

See Also

Topics	Raster Images: Creating and Maintaining Lists of Images


BitmapPalette property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR BitmapPalette (short iIndex);

Overview	Refer to Managing Palettes

Remarks

Sets a color in the bitmap's palette.

The palette is an array of 256 elements. Each element is a long integer value containing the red, green and blue (RGB) components of the color. You can specify a color using the RGB function.

Palettes are used only for images that are 8 bits per pixel or less.

See Also

Topics	Raster Images: Palettes


iIndex Parameter For BitmapPalette
iIndex

Index into the array of colors.


BitmapSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long BitmapSize

Overview	Refer to Super Compressed Bitmaps

Remarks

(Read only) Gets the number of bytes used by the bitmap data.

See Also

Elements:	BitmapHeight property, BitmapWidth property, BitmapBits property, BitmapCompression property

Topics:	Raster Images: Getting Current Information


BitmapToClient method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short BitmapToClient (float X, float Y);

Overview	Refer to Displaying an Image.

Remarks

Converts the given bitmap coordinates to client coordinates.

The values passed should be in ScaleMode units.

Calling this method will update the ConvertX and ConvertY properties with the converted values.

SeeAlso

Elements	ScaleMode property, ClientToBitmap method, BitmapWidth property, BitmapHeight property, ScaleWidth property, ScaleHeight property, ConvertX property, ConvertY property

Topics	Working with the Control: Client Area Usage
Raster Images: Displaying Images


X Parameter For BitmapToClient
X

The bitmap X coordinate to be converted to a client X coordinate.


Y Parameter For BitmapToClient
Y

The bitmap Y coordinate to be converted to a client Y coordinate.


Return for BitmapToClient
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


BitmapTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float BitmapTop

Overview	Refer to Playing an Animation.

Remarks

Specifies the Y coordinate of the origin of the bitmap relative to the target bitmap during animation playback. The unit of measure is determined by the ScaleMode property.

See Also

Elements	BitmapLeft property

Topics	Raster Images: Playing Animated Images


BitmapTransparentColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR BitmapTransparentColor

Overview	Refer to Playing an Animation.

Remarks

Specifies the color to use for transparency in an animation playback.

You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes As Color Values.

See Also

Elements	BitmapDelay property, BitmapDisposalMethod property, BitmapEnableTransparency property

Topics	Raster Images: Playing Animated Images
Implementing Transparency


BitmapWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float BitmapWidth

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Read only) Is the width of the bitmap. The unit of measure is determined by the ScaleMode property.

See Also

Elements	BitmapBits property, BitmapHeight property, BitmapXRes property, BitmapYRes property, GetColorCount method

Topics	Raster Images: Getting Current Information


BitmapXRes property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short BitmapXRes

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Dots per inch in the width direction.

This value is commonly used for printing. Loading an image from a file updates this property, using the value stored in the file.

If the values of the BitmapXRes property and the BitmapYRes property are not equal, set the PaintSizeUseDPI property to TRUE to have LEAD's automated scaling properties account for the physical resolution of the bitmap. These automated scaling properties include:

AutoRepaint property

AutoScroll property

AutoSetRects property

AutoSize property

DstHeight property

DstLeft property

DstTop property

DstWidth property

PaintSizeMode property

PaintZoomFactor property

See Also

Elements	BitmapBits property, BitmapHeight property, BitmapWidth property, BitmapYRes property, GetColorCount method, AutoRepaint property, AutoScroll property, AutoSetRects property, AutoSize property, DstHeight property, DstLeft property, DstTop property, DstWidth property, PaintSizeMode property, PaintZoomFactor property

Topics	Raster Images: Getting Current Information


BitmapYRes property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short BitmapYRes

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Dots per inch in the height direction.

This value is commonly used for printing. Loading an image from a file updates this property, using the value stored in the file.

If the values of the BitmapXRes property and the BitmapYRes property are not equal, set the PaintSizeUseDPI property to TRUE to have LEAD's automated scaling properties account for the physical resolution of the bitmap. These automated scaling properties include:

AutoRepaint property

AutoScroll property

AutoSetRects property

AutoSize property

DstHeight property

DstLeft property

DstTop property

DstWidth property

PaintSizeMode property

PaintZoomFactor property

See Also

Elements	BitmapBits property, BitmapHeight property, BitmapWidth property, BitmapXRes property, GetColorCount method, AutoRepaint property, AutoScroll property, AutoSetRects property, AutoSize property, DstHeight property, DstLeft property, DstTop property, DstWidth property, PaintSizeMode property, PaintZoomFactor property

Topics	Raster Images: Getting Current Information


BitonalScaling property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short BitonalScaling

Overview	Refer to Using the Image List Control.

Remarks

(persistent property, available at design time) Sets options to improve the display of bitonal bitmaps in the ImageList Control.  The default is BITONALSCALING_NORMAL.

Setting	Description

BITONALSCALING_NORMAL	Causes bitonal images to be displayed normally when they are scaled.

BITONALSCALING_FAVORBLACK	Enables a bias in preserving black objects when displaying zoomed-out 1-bit images. This can prevent the disappearance of fine lines and details, but it slows down the display.

BITONALSCALING_SCALETOGRAY	Enables grayscaling of 1-bit images when they are displayed. This improves the readability of the images when they are zoomed in or zoomed out, but it slows down the display.

See Also

Elements	PaintDither property, PaintScaling property

Topics	Raster Images: Displaying Images


BitonalScaling property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short BitonalScaling

Overview	Refer to Displaying an Image.

Remarks

(Document/Medical only, persistent property, available at design time) Sets options to improve the display of bitonal bitmaps when they are scaled (zoomed in or zoomed out).

Setting	Description

BITONALSCALING_NORMAL	Causes bitonal images to be displayed normally when they are scaled.

BITONALSCALING_FAVORBLACK	Enables a bias in preserving black objects when displaying zoomed-out 1-bit images. This can prevent the disappearance of fine lines and details, but it slows down the display.

BITONALSCALING_SCALETOGRAY	Enables grayscaling of 1-bit images when they are displayed. This improves the readability of the images when they are zoomed in or zoomed out, but it slows down the display.

See Also

Elements	BackErase property, ForePalette property, PaintDither property, PaintEffect property, PaintPalette property, PaintROP3 property, PaintGamma property, PaintIntensity property, PaintContrast property

Topics	Raster Images: Displaying Images


BorderColor property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR BorderColor

Overview	Refer to Using the Image List Control.

Remarks

Sets the border color of the ImageList Control.

See Also

Elements	ForeColor property, ItemBackgroundColor property, BackColor property, BorderStyle property, Font property, Appearance property

Topics	Raster Images: Displaying Images


BorderRemove event (Main Control)
BorderRemoveEvent event (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	void BorderRemoveEvent (OLE_HANDLE hRgn, long uBorderToRemove, float fBoundingRectLeft, float fBoundingRectTop, float fBoundingRectWidth, float fBoundingRectHeight);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) This event is triggered once for each border found by the BorderRemove method. It is triggered a maximum of four times for each call to the BorderRemove method. Set the DocCleanSuccess property to SUCCESS_REMOVE to have the border removed. Set the DocCleanSuccess property to SUCCESS_NOREMOVE to leave the border unchanged. Set the DocCleanSuccess property to 0 to abort. If the uFlags parameter of the BorderRemove method is set to BORDER_IMAGE_UNCHANGED and BORDER_SINGLE_REGION, then the value of the DocCleanSuccess property affects only the internal single region that contains all the changes.

Note: hRgn is only valid during this event. To use the hRgn after the event has terminated, make a copy of it using the SetRgnHandle method.

See Also

Elements:	BorderRemove method, DocCleanSuccess property

Topics:	Raster Images: Cleaning - up 1-Bit Images


hRgn Parameter For BorderRemove
hRgn

Windows region representing the border to be removed.


uBorderToRemove Parameter For BorderRemove
uBorderToRemove

Flag that indicates which border is being processed. Possible values are:

Value	Meaning

BORDER_LEFT	The left border is being processed.

BORDER_TOP	The top border is being processed.

BORDER_RIGHT	The right border is being processed.

BORDER_BOTTOM	The bottom border is being processed.


fBoundingRectLeft Parameter For BorderRemove
fBoundingRectLeft

X coordinate of the origin of the bounding rectangle of the border being processed.


fBoundingRectTop Parameter For BorderRemove
fBoundingRectTop

Y coordinate of the origin of the bounding rectangle of the border being processed.


fBoundingRectWidth Parameter For BorderRemove
fBoundingRectWidth

Width of the bounding rectangle of the border being processed.


fBoundingRectHeight Parameter For BorderRemove
fBoundingRectHeight

Height of the bounding rectangle of the border being processed.


BorderRemove method (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	short BorderRemove (long uFlags, long uBorderToRemove, long iBorderPercent, long iWhiteNoiseLength, long iVariance);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) Removes borders from 1-bit images. To "fine-tune" the performance of this method, try modifying the values for iWhiteNoiseLength, iBorderPercent and iVariance.

This method triggers both the BorderRemoveEvent event and the ProgressStatus event.

See Also

Elements:	BorderRemoveEvent event

Topics:	Raster Images: Cleaning - up 1-Bit Images


uFlags Parameter For BorderRemove
uFlags

Flags that determine the behavior of the border removal process. Flags may be combined using a bitwise OR. Possible values are:

Value	Meaning

BORDER_SINGLE_REGION:	For each border found by the BorderRemove method, if the DocCleanSuccess property is set to SUCCESS_REMOVE in the BorderRemoveEvent event, the removed border is added to an internal single region. If the DocCleanSuccess property is set to SUCCESS_NOREMOVE, the border is not added to the single region. When the BorderRemove method returns, either the DocCleanBitmap property or the hDocCleanRgn property will be set to a region that contains all the removed borders. If BORDER_LEAD_REGION is also set, the DocCleanBitmap property will be set to a bitmap that has a LEAD region that contains all the removed borders. If BORDER_LEAD_REGION is not set, hDocCleanRgn is set to a Windows region that contains all the removed borders. When the region (either LEAD or Windows) is no longer needed, it must be destroyed.

BORDER_LEAD_REGION	When the BorderRemove method returns, the DocCleanBitmap property is set to a bitmap that also contains a region with all the removed lines. This flag must be used in conjunction with BORDER_SINGLE_REGION. Pass BORDER_SINGLE_REGION | BORDER_LEAD_REGION in the uFlags parameter of the BorderRemove method. The DocCleanBitmap property will be set when the BorderRemove method returns.

BORDER_IMAGE_UNCHANGED	The original image is unchanged.

BORDER_CALLBACK_REGION	The BorderRemoveEvent event receives a Windows region that contains the current border to be removed. Setting this flag lets the user create his or her own composite of removed borders by combining the regions received by the event, if the DocCleanSuccess property is set to SUCCESS_REMOVE in the event. The regions can be combined using a logical OR operator. Combining all regions received by the event, that are removed, results in a region identical to the region created when BORDER_SINGLE_REGION is set in uFlags. When the region received by the event is no longer needed, it must be destroyed.

BORDER_USE_VARIANCE	Consider border variance when performing border removal.  If this flag is passed, the iVariance parameter of this method is used. If this flag is not passed, the iVariance parameter is ignored.


uBorderToRemove Parameter For BorderRemove
uBorderToRemove

Flag that indicates which border to remove. These values can be combined using the OR operator (|). Possible values are:

Value	Meaning

BORDER_LEFT	Remove the left border.

BORDER_RIGHT	Remove the right border.

BORDER_TOP	Remove the top border.

BORDER_BOTTOM	Remove the bottom border.

BORDER_ALL	Remove all borders. This is the same as BORDER_LEFT | BORDER_RIGHT | BORDER_TOP | BORDER_BOTTOM.


iBorderPercent Parameter For BorderRemove
iBorderPercent

Percent of the image dimension in which the border will be found. For most images, use 20. For example, if an image is 200 pixels wide, iBorderPercent is set to 20 and uBorderToRemove is set to BORDER_LEFT, then the left border will be found in the area between the left edge of the image and a line 40 pixels from the left edge. If the border is closer to the edge of the image, use a smaller value. If the border is farther from the edge, use a larger value.


iWhiteNoiseLength Parameter For BorderRemove
iWhiteNoiseLength

Amount of white noise tolerated when determining the border. The units are in pixels. Values of 0 to 10 are sufficient for most images.


iVariance Parameter For BorderRemove
iVariance

Amount of variance tolerated in the border.  If the border varies significantly in thickness, you should use a higher value for iVariance. Range is 0 to 10.


Return for BorderRemove
Return Value

Value	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


BorderStyle property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	Long BorderStyle

Overview	Refer to Using the Image List Control.

Remarks

Sets the border style of the ImageList Control.

Value	Meaning

0	No border.

1	Place a single line border around the control.

See Also

Elements	ForeColor property, ItemBackgroundColor property, BackColor property, BorderColor property, Font property, Appearance property

Topics	Raster Images: Displaying Images


BorderStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short BorderStyle

Overview	Refer to Displaying an Image.

Remarks

Sets the border style of the Main Control.

Setting	Description

0	No border.

1	Place a single line border around the control.

See Also

Elements	Appearance property, BackColor property

Topics	Working with the Control: General Behavior
Raster Images: Displaying Images


BrowseDir method (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short BrowseDir (BSTR pszDirectory);

Overview	Refer to Thumbnail Browser.

Remarks

Browses the specified directory for supported images, and generates thumbnails for each image file that is found.

Each generated thumbnail can be processed in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, ContinueBrowse property, Filter property, ThumbnailWidth property, ThumbnailHeight property, ThumbnailBitsPerPixel property, MaintainAspect property, ForceSize property, ThumbnailBackgroundColor property, LoadStamp property, Resample property, StopOnError property, IncludeSubDirectories property, ExpandMultipage property, MaxSizeDisk property, MaxSizeMem property, DitherFlags property, PaletteFlags property

Topics	Raster Images: Using the Thumbnail Browser


pszDirecotry Parameter For BrowseDir
pszDirectory

The starting directory for the browse operation.

If the IncludeSubDirectories property is True, subdirectories will also be searched.


Return for BrowseDir
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ButtonBitmapDown property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE ButtonBitmapDown (short iButtonIndex);

Overview	Refer to Annotation Toolbar.

Remarks

Contains a handle to a bitmap used to paint the specified button when the button is pressed. If this property is NULL, the control will assume the same bitmap is used to paint the button when it is up or down.

See Also

Elements	AutoSetTool property, ButtonBitmapUp property, ButtonColumns property, ButtonCount property,ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iButtonIndex Parameter For ButtonBitmapDown
iButtonIndex

Index indicating a button in the AnnToolbar object. The array is zero-based.


ButtonBitmapUp property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE ButtonBitmapUp (short iButtonIndex);

Overview	Refer to Annotation Toolbar.

Remarks

Contains a handle to a bitmap used to paint the specified button when the button is up. If the ButtonBitmapDown property is NULL, the control will assume the same bitmap is used to paint the button when it is up or down.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonColumns property, ButtonCount property,ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iButtonIndex Parameter For ButtonBitmapUp
iButtonIndex

Index indicating a button in the AnnToolbar object. The array is zero-based.


ButtonColumns property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ButtonColumns

Overview	Refer to Annotation Toolbar.

Remarks

Number of columns in the toolbar. The buttons in the toolbar are ordered left to right and top to bottom.

If you change the number of columns, the number of rows is adjusted accordingly. The relationship between rows and columns is given by the following equation:

ButtonRows = (ButtonCount + ButtonColumns – 1) / ButtonColumns

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonCount property,ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


ButtonCount property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ButtonCount

Overview	Refer to Annotation Toolbar.

Remarks

Contains the number of buttons in the toolbar. To add another toolbar button to an existing toolbar, you should set the tool and the bitmaps for the new button in the ButtonTool property, and increment the number of buttons to make the button visible.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


ButtonMenuText property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	char * ButtonMenuText (short iButtonIndex, short iToolIndex);

Overview	Refer to Annotation Toolbar.

Remarks

String containing the menu text for the specified menu item of the specified button in the AnnToolbar object. For example, if ButtonMenuText(2,1) contains the string "Select", then when the user clicks the third button of the annotation toolbar (iButtonIndex is zero-based), a menu will be displayed. The second menu item will display the text Select.

This property is only valid if ButtonMenuTextID is -1.

The ButtonMenuXXX properties are only used for buttons that are associated with multiple tools.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iButtonIndex Parameter For ButtonMenuText
iButtonIndex

Index indicating a button in the AnnToolbar object. This is a zero-based index.


iToolIndex Parameter For ButtonMenuText
iToolIndex

Index into a list of menu items associated with the specified button in the annotation toolbar. This is a zero-based index.


ButtonMenuTextID property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ButtonMenuTextID (short iButtonIndex, short iToolIndex);

Overview	Refer to Annotation Toolbar.

Remarks

Contains an index into the annotation menu dialog strings (ANNAUTOTEXT_XXX). If this value is -1, the text for the tool tip is in the ButtonMenuText property. If this value is >= 0, this value is an index into the set of annotation menu dialog strings and the tool tip text will come from here.

The index stored in this property associates the corresponding menu text with the specified menu item of the specified menu button. For example, if ButtonMenuTextID(2, 1) contains the value ANNAUTOTEXT_MENU_PROTRACTOR, then the text associated with the second menu item of the third button of the annotation toolbar will be "&Protractor …". Therefore, when the user clicks on the third button of the annotation toolbar, a menu will be displayed. The second menu item will display Protractor.

Please note that a character following an ampersand will be underlined.

The ButtonMenuXXX properties are only used for buttons that are associated with multiple tools.

For a list of the available dialog strings, refer to Annotation Automation Strings.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iButtonIndex Parameter For ButtonMenuTextID
iButtonIndex

Index indicating a button in the AnnToolbar object. This is a zero-based index.


iToolIndex Parameter For ButtonMenuTextID
iToolIndex

Index into a list of menu items associated with the specified button in the annotation toolbar. This is a zero-based index.


ButtonMenuTool property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ButtonMenuTool (short iButtonIndex, short iToolIndex);

Overview	Refer to Annotation Toolbar.

Remarks

Contains the tool associated with the specified menu item of the specified annotation toolbar button.

For example, if ButtonMenuTool(2, 1) contains the value ANNTOOL_POINT, then the second menu item of the third button of the annotation toolbar will be associated with the Point Tool. Therefore, when the user clicks on the third button of the annotation toolbar a menu will be displayed with all the tools associated with that button. The second menu item will be the Point Tool.

You must use the ButtonMenuText and ButtonMenuTextID properties to set the text for the menu item.

The ButtonMenuXXX properties are only used for buttons that are associated with multiple tools.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iButtonIndex Parameter For ButtonMenuTool
iButtonIndex

Index indicating a button in the AnnToolbar object. This is a zero-based index.


iToolIndex Parameter For ButtonMenuTool
iToolIndex

Index into a list of menu items associated with the specified button in the annotation toolbar. This is a zero-based index.


ButtonRows property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ButtonRows

Overview	Refer to Annotation Toolbar.

Remarks

Number of rows in the toolbar. The buttons in the toolbar are ordered left to right and top to bottom.

If you change the number of rows, the number of columns is adjusted accordingly. The relationship between rows and columns is given by the following equation:

ButtonColumns = (ButtonCount + ButtonRows – 1) / ButtonRows

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


ButtonTool property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ButtonTool (short iButtonIndex);

Overview	Refer to Annotation Toolbar.

Remarks

Contains the tool associated with the specified button of the annotation toolbar. This is actually an array of values that indicate the tools associated with every button in the annotation toolbar.

If ButtonToolCount for the specified button is one, then the button has one tool associated with it, and the ButtonTool property and the Tool property contain the ANNTOOL_XXX constant corresponding to that tool.

If ButtonToolCount for the specified button is >1 then there are several tools associated with the specified button. In that case, ButtonTool() and the Tool property contain the ANNTOOL_XXX constant corresponding to the currently selected tool. When the user clicks on a button having more than one tool, a menu is displayed. The ButtonMenuXXX properties describe the menu items and the tools associated with the specified button.

For example, if ButtonToolCount(2) contains the value 1, then there is only one tool associated with the third button of the annotation toolbar. The constant for that tool is contained in ButtonTool(2).

If ButtonToolCount(2) contains the value 3, then there are three tools associated with the third button of the annotation toolbar. Clicking on this button will display a menu. The text for the menu is set in the ButtonMenuText and ButtonMenuTextID properties. The tools associated with the menu are set in the ButtonMenuTool property.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iButtonIndex Parameter For ButtonTool
iButtonIndex

Index indicating a button in the AnnToolbar object. This is a zero-based index.


ButtonToolCount property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ButtonToolCount (short iButtonIndex);

Overview	Refer to Annotation Toolbar.

Remarks

Contains the number of tools associated with the specified button in the AnnToolbar object. For example, if ButtonToolCount(2) contains the value 4, then there are four tools associated with the third button in the AnnToolbar object. (iButtonIndex is zero-based.)

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iButtonIndex Parameter For ButtonToolCount
iButtonIndex

Index indicating a button in the AnnToolbar object. This is a zero-based index.


ButtonToolTipText property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	char * ButtonToolTipText (short iButtonIndex);

Overview	Refer to Annotation Toolbar.

Remarks

String containing the tooltip text for the specified button in the AnnToolbar object. This text will be displayed when the user places the cursor over the associated button in the Annotation Toolbar. For example, if ButtonToolTipText(2) contains the string "Select", then when the user places the cursor over the third button of the annotation toolbar (iButtonIndex is zero-based), the text "Select" will be displayed.

This property is only valid if ButtonToolTipTextID is -1.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iButtonIndex Parameter For ButtonToolTipText
iButtonIndex

Index indicating a button in the AnnToolbar object. This is a zero-based index.


ButtonToolTipTextID property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ButtonToolTipTextID (short iButtonIndex);

Overview	Refer to Annotation Toolbar.

Remarks

Contains an index into the annotation menu dialog strings (ANNAUTOTEXT_XXX). If this value is -1, the text for the tool tip is in the ButtonToolTipText property. If this value is >= 0, this value is an index into the set of annotation menu dialog strings and the tool tip text will come from here.

For a list of the available dialog strings, refer to Annotation Automation Strings.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iButtonIndex Parameter For ButtonToolTipTextID
iButtonIndex

Index indicating a button in the AnnToolbar object. This is a zero-based index.


ButtonVisible property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL ButtonVisible (short iButtonIndex);

Overview	Refer to Annotation Toolbar.

Remarks

Contains a value that indicates whether the specified button is visible. This can be set to hide specific buttons on the toolbar.

If a button is hidden on the annotation toolbar, the remaining buttons are rearranged to take up the space left by the hidden button.

Possible values are:

Value	Meaning

TRUE	The specified button is visible.

FALSE	The specified button is invisible.

For example, if ButtonVisible(2) is set to FALSE, the third button in the annotation toolbar will be hidden and the remaining buttons will be rearranged to take up the space left by the hidden button.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iButtonIndex Parameter For ButtonVisible
iButtonIndex

Index indicating a button in the AnnToolbar object. This is a zero-based index.


Capture method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Capture (OLE_HANDLE hDC, float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Capturing an Image from the Screen.

Remarks

Loads a bitmap from the specified rectangle within a device context.

Normally, this method is used for capturing images displayed on the screen. The resulting bitmap will have the same bits per pixel as the display device.

See Also

Elements	ZoomIn method, ZoomInDone event, EnableZoomInRect property

Topics	Raster images: Capturing a screen image


hDC Parameter For Capture
hDC

Handle to the source device. The mapping mode of the device context must be MM_TEXT.


fLeft Parameter For Capture
fLeft

The X coordinate of the origin of the rectangle to capture, relative to the specified device context. The unit of measure is determined by the ScaleMode property.


fTop Parameter For Capture
fTop

The X coordinate of the origin of the rectangle to capture, relative to the specified device context. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For Capture
fWidth

The width of the rectangle to capture. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For Capture
fHeight

The height of the rectangle to capture. The unit of measure is determined by the ScaleMode property.


Return for Capture
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


CenterImage property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL CenterImage

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Enables or disables the automatic adjustment of display rectangles in order to center the image in the control's client area, when the width and/or height of the destination rectangle is smaller than the width and/or height of the client area.

For example, this can be used to center a small image when it is displayed in a control that is larger than the image's dimensions. This can also be used in conjunction with PaintSizeMode property and PaintZoomFactor property to center an image when the zoomed display dimensions are smaller than the control's dimensions.

See Also

Elements	AutoSetRects property, DstLeft property, DstTop property, DstWidth property, DstHeight property, DstClipLeft property, DstClipTop property, DstClipHeight property, DstClipWidth property, AutoScroll property, PaintSizeMode property, PaintZoomFactor property

Topics	Raster Images: Displaying Images


Change event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void Change ();

Overview	Refer to Detecting Events.

Remarks

Occurs when any change occurs in the Main Control's bitmap.

See Also

Elements	FilePage event

Topics	Raster Images: Loading Files


Clear method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void Clear (void);

Overview	Refer to Using the ImageList Control.

Remarks

Removes all items from the ImageList Control and frees the memory associated with the items.

See Also

Elements	Insert method, Remove method, Count property, Sort method

Topics	Raster Images: Displaying Images


Click event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void Click (void);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when the user presses and releases a mouse button over the ImageList Control.

This is one of three events that occur in the following order:

1. MouseDown event

2. MouseUp event

3. Click event

The first two events let you check which mouse button is pressed.

See Also

Elements	Resize event, DblClick event, KeyDown event, KeyPress event, KeyUp event, MouseMove event, MouseDown event, MouseUp event, Scroll event

Topics	Raster Images: Displaying Images


Click event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void Click ();

Overview	Refer to Detecting Events.

Remarks

Occurs when the user presses and releases a mouse button over the Main Control.

This is one of three events that occur in the following order:

1.	MouseDown event

2.	MouseUp event

3.	Click event

The first two events let you check which mouse button is pressed.

See Also

Elements	DblClick event, MouseDown event, MouseMove event, MouseUp event

Topics	Working with the Control: General Behavior
Working with the Control: Client Area Usage


ClientToBitmap method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ClientToBitmap (float X, float Y);

Overview	Refer to Displaying an Image.

Remarks

Converts the given client coordinates to bitmap coordinates.

The values passed should be in ScaleMode units.

Calling this method will update the ConvertX and ConvertY properties with the converted values.

SeeAlso

Elements	ScaleMode property, BitmapToClient method, BitmapWidth property, BitmapHeight property, ScaleWidth property, ScaleHeight property, ConvertX property, ConvertY property

Topics	Working with the Control: Client Area Usage
Raster Images: Displaying Images


X Parameter For ClientToBitmap
X

The client X coordinate to be converted to a bitmap X coordinate.


Y Parameter For ClientToBitmap
Y

The client Y coordinate to be converted to a bitmap Y coordinate.


Return for ClientToBitmap
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ColorMerge method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ColorMerge (long iFlags);

Overview	Refer to Managing Color Separations.

Remarks

Creates a color bitmap by merging grayscale bitmaps that were created as color separations. You can use this to recombine the bitmaps that the ColorSeparate method creates.

The supported color-space models are RGB, CMYK, CMY, HSV, and HLS.

If all the bitmaps are 16 bits grayscale bitmaps then the resulting bitmap is 48 bits per pixel, otherwise the resulting bitmap is 24 bits per pixel.

You can use the ColorPlanes property to access the grayscale bitmaps.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Topics	Raster Images: Doing Color Space Conversions
Examining and Altering Bitmaps
Changing Brightness and Contrast


iFlags Parameter For ColorMerge
iFlags

The type of separation that was used to create the grayscale bitmaps. Valid values are:

Value	Meaning

COLORSEP_RGB	Merge bitmaps from three RGB planes.

COLORSEP_CMYK	Merge bitmaps from four CMYK planes.

COLORSEP_CMY	Merge bitmaps from three CMY planes.

COLORSEP_HSV	Merge bitmaps from three HSV planes.

COLORSEP_HLS	Merge bitmaps from three HLS planes.


Return for ColorMerge
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ColorPlanes property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE ColorPlanes (short iIndex);

Overview	Refer to Managing Color Separations.

Remarks

Is the array of grayscale bitmaps created by the ColorSeparate method.

You can merge the bitmaps in the array by using the ColorMerge method. The separations follow the color order of the image data. In most cases, this is the same as the abbreviation of the color-plane model. For example, in a CMYK separation, ColorPlanes(0) is the cyan plane. The only exception is RGB, where the image data is usually stored as blue-green-red, and ColorPlanes(0) is the blue plane.

You can use the equals (=) operator to copy a separation bitmap to or from a Main Control. For example, in Visual Basic:

LEAD2.Bitmap = LEAD1.ColorPlanes(0)

You can also free a separation bitmap from memory by assigning it a value of 0.

See Also

Topics	Raster Images: Doing Color Space Conversions
Examining and Altering Bitmaps


iIndex Parameter For ColorPlanes
iIndex

The index into the array of grayscale bitmaps that are the color separations. The separations follow the color order of the image data. In most cases, this is the same as the abbreviation of the color-plane model. For example, in a CMYK separation, ColorPlanes(0) is the cyan plane. The only exception is RGB, where the image data is usually stored as blue-green-red, and ColorPlanes(0) is the blue plane.


ColorRes method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ColorRes (short iBitsPerPixel, short iPalette, short iDither, short iColors);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Converts the bitmap from any bits-per-pixel to any bits-per-pixel, letting you specify the palette to use.

Also, when converting to 16-bits per pixel or higher, you can specify RGB or BGR color order.

Support for 12 and 16-bit grayscale images is available only in the Document/Medical Toolkits .

See Also

Elements	GetColorRes method, UserPalette property

Topics	Raster Images: Doing Color Expansion or Reduction


iBitsPerPixel Parameter For ColorRes
iBitsPerPixel

The number of bits per pixel to increase or decrease the bitmap to. Valid values are 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, and 32.


iPalette Parameter For ColorRes
iPalette

Palette options.

The following are valid values:

Value	Meaning

CRP_FIXEDPALETTE	Use the LEAD fixed palette.

CRP_NETSCAPEPALETTE	Use the fixed palette that is employed by Netscape Navigator and by Microsoft Internet Explorer.

CRP_OPTIMIZEDPALETTE	Create an optimized palette.

CRP_IDENTITYPALETTE	Insert the Windows system palette, and optimize the remaining colors.

CRP_USERPALETTE	Use the palette specified in the UserPalette property.

CRP_BYTEORDERBGR	Use BGR color order. This flag only has meaning when going to 16 bits per pixel or higher.

CRP_BYTEORDERRGB	Use RGB color order. This flag only has meaning when going to 16 bits per pixel or higher.

CRP_BYTEORDERGRAY	Use grayscale. This flag is only valid for 12 or 16-bit grayscale images.  12 and 16-bit grayscale images are supported in the Document/Medical Toolkit only.


iDither Parameter For ColorRes
iDither

Dithering options. Note that the dithering options are useful only when the resulting bitmap requires a palette (when it is 8 bits per pixel or less).

The following are valid values:

Value	Meaning

CRD_NODITHERING	Use nearest color matching.

CRD_FLOYDSTEINDITHERING	Use Floyd-Steinberg dithering.

CRD_STUCKIDITHERING	Use Stucki dithering.

CRD_BURKESDITHERING	Use Burkes dithering.

CRD_SIERRADITHERING	Use Sierra dithering.

CRD_STEVENSONARCEDITHERING	Use Stevenson Arce dithering.

CRD_JARVISDITHERING	Use Jarvis dithering.

CRD_ORDEREDDITHERING	Use ordered dithering, which is faster but less accurate than other dithering methods.

CRD_CLUSTEREDDITHERING	Use clustered dithering.


iColors Parameter For ColorRes
iColors

The number of colors in the palette. Pass 0 for to get the default (such as 256 for 8 bits per pixel). Otherwise, do one of the following:

 If you specify CRP_USERPALETTE in the iPalette parameter, pass the number of entries in your palette.

 If you specify CRP_OPTIMIZEDPALETTE in the iPalette parameter, you can use this parameter to limit the number of colors that the method maps in the optimized palette.


Return for ColorRes
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ColorResList method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ColorResList (short iBitsPerPixel, short iPalette, short iDither, short iColors);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Converts all bitmaps in a list from any bits-per-pixel to any bits-per-pixel.

This method also updates the palette that is referenced by the AnimationPalette property.

See Also

Elements	ColorRes method, UserPalette property

Topics	Raster Images: Doing Color Expansion or Reduction


iBitsPerPixel Parameter For ColorResList
iBitsPerPixel

The number of bits per pixel to increase or decrease the bitmaps to. Valid values are 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, and 32.


iPalette Parameter For ColorResList
iPalette

Palette options.

The following are valid values:

Value	Meaning

CRP_FIXEDPALETTE	Use the LEAD fixed palette.

CRP_NETSCAPEPALETTE	Use the fixed palette that is employed by Netscape Navigator and by Microsoft Internet Explorer.

CRP_OPTIMIZEDPALETTE	Create an optimized palette.

CRP_IDENTITYPALETTE	Insert the Windows system palette, and optimize the remaining colors.

CRP_USERPALETTE	Use the palette specified in the UserPalette property.

CRP_BYTEORDERBGR	Use BGR color order. This flag only has meaning when going to 16 bits per pixel or higher.

CRP_BYTEORDERRGB	Use RGB color order. This flag only has meaning when going to 16 bits per pixel or higher.

CRP_BYTEORDERGRAY	Use grayscale. This flag is only valid for 12 or 16-bit grayscale images.  12 and 16-bit grayscale images are supported in the Document/Medical Toolkit only.


iDither Parameter For ColorResList
iDither

Dithering options. Note that the dithering options are useful only when the resulting bitmaps require a palette (when they are 8 bits per pixel or less).

The following are valid values:

Value	Meaning

CRD_NODITHERING	Use nearest color matching.

CRD_FLOYDSTEINDITHERING	Use Floyd-Steinberg dithering.

CRD_STUCKIDITHERING	Use Stucki dithering.

CRD_BURKESDITHERING	Use Burkes dithering.

CRD_SIERRADITHERING	Use Sierra dithering.

CRD_STEVENSONARCEDITHERING	Use Stevenson Arce dithering.

CRD_JARVISDITHERING	Use Jarvis dithering.

CRD_ORDEREDDITHERING	Use ordered dithering, which is faster but less accurate than other dithering methods.

CRD_CLUSTEREDDITHERING	Use clustered dithering.


iColors Parameter For ColorResList
iColors

The number of colors in the palette. Pass 0 for to get the default (such as 256 for 8 bits per pixel). Otherwise, do one of the following:

 If you specify CRP_USERPALETTE in the iPalette parameter, pass the number of entries in your palette.

 If you specify CRP_OPTIMIZEDPALETTE in the iPalette parameter, you can use this parameter to limit the number of colors that the method maps in the optimized palette.


Return for ColorResList
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ColorSeparate method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ColorSeparate (long iFlags);

Overview	Refer to Managing Color Separations.

Remarks

Separates the bitmap by color plane to produce one grayscale bitmap per plane. You can specify any of several color-space models.

The supported color-space models are RGB, CMYK, CMY, HSV, and HLS.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

If the bitmap is 48 or 64 bits bitmap then the created bitmaps are 16 bits grayscale bitmaps otherwise the created bitmaps are 8 bits grayscale bitmap.

You can use the ColorPlanes property to access the grayscale bitmaps.

See Also

Topics	Raster Images: Doing Color Space Conversions
Examining and Altering Bitmaps
Changing Brightness and Contrast


iFlags Parameter For ColorSeparate
iFlags

The type of separation. Valid values are:

Value	Meaning

COLORSEP_RGB	Create bitmaps for three RGB planes.

COLORSEP_CMYK	Create bitmaps for four CMYK planes.

COLORSEP_CMY	Create bitmaps for three CMY planes.

COLORSEP_HSV	Create bitmaps for three HSV planes.

COLORSEP_HLS	Create bitmaps for three HLS planes.


Return for ColorSeparate
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ColumnCount property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long ColumnCount

Overview	Refer to Using the Image List Control.

Remarks

(Read-only)(Runtime-only) Gets the current number of columns of items in the ImageList Control.

See Also

Elements	Insert method, Remove method, RowCount, Count property, Clear method, Item property

Topics	Raster Images: Displaying Images


Combine method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Combine (float fLeft, float fTop, float fWidth, float fHeight, OLE_HANDLE hBitmap, float fSrcLeft, float fSrcTop, long iFlags);

Overview	Refer to Combining Images.

Remarks

Combines image data from two bitmaps, letting you specify the areas to be combined and the operations to be performed when combining the data.

For example, suppose you use the SpatialFilter method to apply an edge detection filter. You can then use this method to combine the resulting bitmap with the original one to produce an image with hard edges.

This method combines the data byte-by-byte. Both images must have the same color resolution. Images that are 24 bits per pixel are the easiest to combine. For other color resolutions, you must ensure that the pixel and byte boundaries are aligned on the rectangle borders. Both images must use the same palette, if a palette is required.

For a simple paste, use CB_OP_ADD and CB_DST_0 as the flags.

If a region is defined for the either the source or destination bitmap, or both bitmaps, the combine applies only to the intersection of the regions.

See Also

Topics	Raster Images: Copying Images
Raster Images: Combining Images
Implementing Transparency
Examining and Altering Bitmaps
Removing Noise
Detecting and Enhancing Edges and Lines


fLeft Parameter For Combine
fLeft

The X coordinate of the origin of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fTop Parameter For Combine
fTop

The Y coordinate of the origin of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For Combine
fWidth

The width of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For Combine
fHeight

The height of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


hBitmap Parameter For Combine
hBitmap

The source Main Control's bitmap to be combined with the current Main Control's bitmap.


fSrcLeft Parameter For Combine
fSrcLeft

The X coordinate of the origin of the source rectangle, relative to the source control. The unit of measure is determined by the ScaleMode property.


fSrcTop Parameter For Combine
fSrcTop

The Y coordinate of the origin of the source rectangle, relative to the source control. The unit of measure is determined by the ScaleMode property.


iFlags Parameter For Combine
iFlags

The flags are in four groups that define treatment of the source, treatment of the destination, the operation to use when combining the data, and the treatment of the resulting image. The flags apply only to the defined rectangles (not necessarily the whole bitmap). You can use a bitwise OR ( | ) to specify one flag from each group. In high-level languages such as Visual Basic, you can use a plus (+) operator to specify more than one flag.

For a simple paste, use CB_OP_ADD and CB_DST_0 as the flags.

Refer to Flags for the Combine Method for the list of flags.


Return for Combine
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


CombineBitmapWarp method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short CombineBitmapWarp (VARIANT& vXDstArray, VARIANT& vYDstArray, long lDstPointCount, OLE_HANDLE hBitmap, long lXSrcPt, long lYSrcPt, long nSrcWidth, long nSrcHeight, long uFlags);

Overview	Refer to Combining Images.

Remarks

Combines image data from the source bitmap (the slave) into the destination bitmap (master) using a perspective warp.

See Also

Elements:	Combine method, CombineExt method

Topics:	Raster Images: Copying Images
Raster Images: Combining Images
Implementing Transparency
Examining and Altering Bitmaps
Removing Noise
Detecting and Enhancing Edges and Lines


vXDstArray Parameter For CombineBitmapWarp
vXDstArray

One dimensional array of float (single) values that specifies the X-coordinates of the polygon. The array size should be 4.


vYDstArray Parameter For CombineBitmapWarp
vYDstArray

One dimensional array of float (single) values that specifies the Y-coordinates of the polygon. The array size should be 4.


lDstPointCount Parameter For CombineBitmapWarp
lDstPointCount

Number of points in the array. The number of points should be 4.


hBitmap Parameter For CombineBitmapWarp
hBitmap

Source control bitmap that contains the slave bitmap.


lXSrcPt Parameter For CombineBitmapWarp
lXSrcPt

X coordinate of the origin of the area within the source that will be warped into the destination bitmap.


lXSrcPt Parameter For CombineBitmapWarp
lYSrcPt

Y coordinate of the origin of the area within the source that will be warped into the destination bitmap.


nSrcWidth Parameter For CombineBitmapWarp
nSrcWidth

Width of the area within the source bitmap that will be warped into the destination bitmap


nSrcHeight Parameter For CombineBitmapWarp
nSrcHeight

Height of the area within the source bitmap that will be warped into the destination bitmap.


uFlags Parameter For CombineBitmapWarp
uFlags

Flags that affect the warp process.  Possible values are:

Value	Meaning

0	No interpolation.

CBW_BILINEAR	Do a bilinear interpolation.  This generally gives a better result.


Return for CombineBitmapWarp
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


CombineExt method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short CombineExt (float fLeft, float fTop, float fWidth, float fHeight, OLE_HANDLE hBitmap, float fSrcLeft, float fSrcTop, long iFlags);

Overview	Refer to Combining Images.

Remarks

Combines image data from two bitmaps, letting you specify the areas to be combined and the operations to be performed when combining the data, and which color planes (R or G or B or R, G, and B) are used.

For example, suppose you use the SpatialFilter method to apply an edge detection filter. You can then use this method to combine the resulting bitmap with the original one to produce an image with hard edges.

This method combines the data pixel-by-pixel. The two images can be any color resolution. Images that are 24-bits per pixel are the easiest and fastest to combine. This method uses Windows-style coordinates (with a top-left origin) to specify the areas to be combined.

If the channel setting for one of the bitmaps is the master channel (CB_SRC_MASTER, CB_DST_MASTER, CB_RES_MASTER) the settings for all the bitmaps will be set to master.

For a simple paste, use CB_OP_ADD and CB_DST_0 as the flags.

If a region is defined for the either the source or destination bitmap, or both bitmaps, the combine applies only to the intersection of the regions.

For example, assume CB_SRC_RED is passed for the source bitmap, CB_DST_BLUE is passed for the destination bitmap and CB_RES_GREEN is passed for the resulting bitmap. In this case, the green channel of the resulting bitmap is calculated as the result of the operations applied to the red channel of the source bitmap and the blue channel of the destination bitmap. The other channels of the resulting bitmap are unchanged.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Underlay method, Combine method

Topics	Raster Images: Copying Images
Raster Images: Combining Images
Implementing Transparency
Examining and Altering Bitmaps
Removing Noise
Detecting and Enhancing Edges and Lines


fLeft Parameter For CombineExt
fLeft

The X coordinate of the origin of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fTop Parameter For CombineExt
fTop

The Y coordinate of the origin of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For CombineExt
fWidth

The width of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For CombineExt
fHeight

The height of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


hBitmap Parameter For CombineExt
hBitmap

The source Main Control's bitmap to be combined with the current Main Control's bitmap.


fSrcLeft Parameter For CombineExt
fSrcLeft

The X coordinate of the origin of the source rectangle, relative to the source control. The unit of measure is determined by the ScaleMode property.


fSrcTop Parameter For CombineExt
fSrcTop

The Y coordinate of the origin of the source rectangle, relative to the source control. The unit of measure is determined by the ScaleMode property.


iFlags Parameter For CombineExt
iFlags

The flags are in four groups that define treatment of the source, treatment of the destination, the operation to use when combining the data, treatment of the resulting image, and the color plan for the destination, source and resulting images. The flags apply only to the defined rectangles (not necessarily the whole bitmap). You can use a bitwise OR ( | ) to specify one flag from each group. In high-level languages such as Visual Basic, you can use a plus (+) operator to specify more than one flag.

For a simple paste, use CB_OP_ADD and CB_DST_0 as the flags.

Refer to Flags for the CombineExt Method for the list of flags.


Return for CombineExt
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Comment property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	VARIANT Comment(short iIndex);

Overview	Refer to Maintaining File Comments.

Remarks

Is the array of comments to be saved with the next call of the Save or SaveMemory method.

Some file formats can contain comments, and some cannot, and each file format has its own set of comment types. With the Comment property, you can get and set the value of any comment in the array. The index into the array (specified using a constant) determines the type of comment, as described in Types of File Comments.

There is only one array of comments for your application, regardless of how may Main Controls your application contains. You control the contents of the array; loading or saving a file does not initialize the array. You can clear the array by setting each element of the array to Empty.

If you want to preserve existing comments in a file when you save an image, you must use the ReadComment method to update the array.

See Also

Elements	ReadComment method


iIndex Parameter For Comment
iIndex

Index into the array of comments. For possible values, refer to Types of File Comments.


ContinueBrowse property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL ContinueBrowse

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only) If this property is set to True during the ThumbnailEvent event, thumbnail generation will continue.  If you wish to stop thumbnail generation, set this property to false in the ThumbnailEvent event.

See Also

Elements	EnableMethodErrors property, StopOnError property, ThumbnailEvent event, BrowseDir method

Topics	Raster Images: Using the Thumbnail Browser


ContourFilter method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ContourFilter (short nThreshold, short nDeltaDirection, short nMaximumError, short nOption);

Overview	Refer to Detecting and Enhancing Edges and Lines.

Remarks

(Medical only) Performs a contour segment filter on the bitmap.

This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Elements	GetContourFilter method

Topics	Raster Images: Filtering Images


nThreshold Parameter For ContourFilter
nThreshold

Threshold of the gradient magnitude. , Values below this will be considered as background, and will be set to 0. Values can be from 1 to 254.  A lower threshold provides a better quality image. Default is 15.


nDeltaDirerction Parameter For ContourFilter
nDeltaDirection

Maximum angle for the thinning algorithm. Values can be from 1 to 64. Default is 35.


nMaximumError Parameter For ContourFilter
nMaximumError

Maximum error for approximation algorithm. Values can be from 0 to 255. Default is 5. This parameter is only valid if nOption is CONTOUR_APPROX_COLOR.


nOption Parameter For ContourFilter
nOption

Flag that controls the resulting image. This value tells the method what process to complete before returning. Possible values are:

Value	Meaning

CONTOUR_THIN	[0] return after the thinning algorithm

CONTOUR_LINK_BLACKWHITE	[1] return after contour linking, using only black and white

CONTOUR_LINK_GRAY	[2] return after contour linking, using 256 grayscale

CONTOUR_LINK_COLOR	[3] return after contour linking, using colors

CONTOUR_APPROX_COLOR	[4] return after line segment approximation, using colors


Return for ContourFilter
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Contrast method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Contrast (short iChange);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Increases or decreases the contrast of the bitmap.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Intensity method, GammaCorrect method, HistoContrast method, HistoEqualize method, StretchIntensity method, GetChange method

Topics	Raster Images: Modifying Intensity Values
Raster Images: Where the Region Preempts the Bitmap


iChange Parameter For Contrast
iChange

Amount of contrast change. Valid values are -1000 to +1000.


Return for Contrast
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ControlWindow property (ImageList Control)

Syntax	long ControlWindow

Overview	Refer to Using the Image List Control.

Remarks

(Read only) Is the handle to the actual contained ImageList Control window. Use this instead of the Window property to use GDI functions such as GetDC to directly draw on or send messages to the ImageList Control's window.

See Also

Elements	Window property, BorderColor property, BackColor property, BorderStyle property, Appearance property

Topics	Raster Images: Displaying Images


ConvertSignedToUnsigned method
ConvertSignedToUnsigned method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ConvertSignedToUnsigned (short iShift);

Overview	Refer to Examining and Altering Bitmaps

Remarks

Converts a signed bitmap to unsigned.

To determine whether a bitmap is signed, check the IsSigned property. LEADTOOLS loads signed files only if the LoadSigned property is TRUE. If the LoadSigned property is FALSE, the signed images are automatically converted to signed during loading, by setting all negative pixels to 0.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	IsSigned property, LoadSigned property

Topics	Raster Images: Doing Color Expansion or Reduction


iShift Parameter For ConvertSignedToUnsigned
iShift

Flag that indicates how the shift will be done. Possible values are:

Value	Meaning

SHIFT_ZERO_TO_CENTER	[0] Shift by 32768 (16-bit images) or by 2048 (12-bit images)

SHIFT_MIN_TO_ZERO	[1] Shift all image data to make minimum value in the image 0 and the maximum value to the maximum possible value (65535 for 16-bit, 4095 for 12-bit).

SHIFT_NEG_TO_ZERO	[2] Set all the negative pixels to 0 and leave the positive pixels unchanged. (Default).


Return for ConvertSignedToUnsigned
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ConvertToColoredGray method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short ConvertToColoredGray(short iRedFact, short iGreenFact, short iBlueFact, short iRedGrayFact, short iGreenGrayFact, short iBlueGrayFact);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Document only) Converts a bitmap to a grayscale bitmap, then enhances the color components based on the specified parameters.

This method is more general than the GrayscaleExt method. ConvertToColoredGray can be used to give images a "sepia" look by adding a blue or brown color.

iRedFact + iGreenFact + iBlueFact must equal 1000. (Internally the values are divided by 1000).

For each pixel in the bitmap the red, green and blue values are modified by the iRedFact, iGreenFact and iBlueFact parameters, respectively. This allows the user to give more weight to one color, essentially enhancing that color, before the pixel is converted to grayscale.

For example, if this method is called with the iRedFact set to 500, the iGreenFact set to 250 and the iBlueFact set to 250, the red value of each pixel will get 50% of the weight when determining the grayscale value. The green value will get 25% of the weight and the blue value will get 25% of the weight when determining the grayscale value. This highlights or enhances the red in the bitmap, prior to conversion to grayscale. Upon conversion to grayscale, the red, green and blue components of the output pixel are the same. Call this value G. Therefore, the RGB values for the pixel would be (G, G, G).

Once the grayscale value for the pixel has been obtained, the red component of the output pixel can be further modified using the iRedGrayFact value. The equation for this can be seen below:

Goutput-red = G + G * iRedGrayFact / 1000

The green and blue components are found similarly, using the iGreenGrayFact and the iBlueGrayFact values, respectively.

Please note that the iRedGrayFact, iGreenGrayFact and iBlueGrayFact values can be negative. A negative value results in a decrease in pixel intensity. A positive value results in an increase in pixel intensity.

If iRedGrayFact = iGreenGrayFact = iBlueGrayFact = 0, then the output is the same as the output from the GrayScaleBitmapExt method.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	BalanceColors method, GrayScale method, GrayscaleExt method, IsGrayscale property

Topics	Raster Images: Doing Color Expansion or Reduction


iRedFact Parameter For ConvertToColoredGray
iRedFact

Value that represents the percentage or weight given to the red value of each pixel in the bitmap. Possible values are 0 to 1000.


iGreenFact Parameter For ConvertToColoredGray
iGreenFact

Value that represents the percentage or weight given to the green value of each pixel in the bitmap. Possible values are 0 to 1000.


iBlueFact Parameter For ConvertToColoredGray
iBlueFact

Value that represents the percentage or weight given to the blue value of each pixel in the bitmap. Possible values are 0 to 1000.


iRedGrayFact Parameter For ConvertToColoredGray
iRedGrayFact

Additional weighting factor (percentage) used to modify the red component in the output pixel. This value can be negative. Possible values are -1000 to 1000.


iGreenGrayFact Parameter For ConvertToColoredGray
iGreenGrayFact

Additional weighting factor (percentage) used to modify the green component in the output pixel. This value can be negative. Possible values are -1000 to 1000.


iBlueGrayFact Parameter For ConvertToColoredGray
iBlueGrayFact

Additional weighting factor (percentage) used to modify the blue component in the output pixel. This value can be negative. Possible values are -1000 to 1000.


Return for ConvertToColoredGray
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ConvertX property (Main Control)

Visual Basic example1   Visual C++ 4.0 example1
Visual Basic example2   Visual C++ 4.0 example2

Syntax	float ConvertX

Overview	Refer to Displaying an Image.

Remarks

(Read only, Runtime only) This property is updated with the X coordinate generated by calling the ClientToBitmap method or the BitmapToClient method. The unit of measure is determined by the ScaleMode property.

See Also

Elements	ConvertY property, ClientToBitmap method, BitmapToClient method, ScaleMode property

Topics	Working with the Control: Client Area Usage
Raster Images: Displaying Images


ConvertY property (Main Control)

Visual Basic example1   Visual C++ 4.0 example1
Visual Basic example2   Visual C++ 4.0 example2

Syntax	float ConvertY

Overview	Refer to Displaying an Image.

Remarks

(Read only, Runtime only) This property is updated with the Y coordinate generated by calling the ClientToBitmap method or the BitmapToClient method. The unit of measure is determined by the ScaleMode property.

See Also

Elements	ConvertX property, ClientToBitmap method, BitmapToClient method, ScaleMode property

Topics	Working with the Control: Client Area Usage
Raster Images: Displaying Images


Copy method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Copy (short iFlags);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

Copies the bitmap to the clipboard.

See Also

Topics	Raster Images: Exchanging Imgages with Other Objects
Raster Images: Using the Clipboard


iFlags Parameter For Copy
iFlags

Indicates how image data is placed on the clipboard. You can use a bitwise OR to pass more than one value. In high-level languages such as Visual Basic, you can use a plus (+) operator to specify more than one flag.

Valid values are:

Value	Meaning

COPY_EMPTY	Empty the clipboard before copying data to it.

COPY_DIB	Copy DIB data to the clipboard.

COPY_DDB	Copy DDB data to the clipboard.

COPY_PALETTE	Copy palette data to the clipboard.

COPY_RGN	Copy the bitmap's region to the clipboard.


Return for Copy
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Count property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long Count

Overview	Refer to Using the Image List Control.

Remarks

(Read-only)(Runtime-only) Gets the current number of items in the ImageList Control.

Note: Item indexing begins with 0 and continues to Count - 1.

See Also

Elements	Item property, RowCount property, ColumnCount property, PageCount property, Insert method, EnsureVisible method, Remove method, Clear method

Topics	Raster Images: Displaying Images


Count property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short Count

Overview	Refer to Annotation Menu

Remarks

(Read only) Gets the number of menu items in the menu object.

This property is associated with the AnnMenu object that is passed to the AnnMenu event.

See Also

Elements	AnnMenu event, ItemString property, ItemID property, ItemType property, ItemChecked property, ItemEnabled property, DeleteItem method, AddItem method, GetSubMenu Method

Topics	Annotations (Document/Medical only): Automation


Create method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short Create (float x, float y, short iAlign);

Overview	Refer to Annotation Toolbar.

Remarks

Creates the annotation toolbar. You must create the toolbar before using most of the properties associated with the AnnToolbar object. Only the Visible property can be used before creating the toolbar.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medicalonly): Automation


x Parameter For Create
x

X coordinate for the annotation toolbar. This coordinate is relative to the window of the LEAD control. Coordinates may be scaled using the ScaleMode.


y Parameter For Create
y

Y coordinate for the annotation toolbar. This coordinate is relative to the window of the LEAD control. Coordinates may be scaled using the ScaleMode.


iAlign Parameter For Create
iAlign

Flag that indicates how to align the annotation toolbar. Possible values are given below, and may be combined:

Value	Meaning

ANNTOOLALIGN_LEFT	[0x0000] Toolbar’s left margin will be at x.

ANNTOOLALIGN_RIGHT	[0x0001] Toolbar’s right margin will be at x.

ANNTOOLALIGN_TOP	[0x0002] Toolbar’s top margin will be at y.

ANNTOOLALIGN_BOTTOM	[0x0003] Toolbar’s bottom margin will be at y.


Return for Create
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


CreateBitmap method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short CreateBitmap (float fWidth, float fHeight, short iBitsPerPixel);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

Initializes and allocates the bitmap, without loading any data.

If you specify 8 bits per pixel or less, the bitmap is created with LEAD's fixed palette. If you specify 0 bits per pixel, for grayscale, the bitmap is created as an 8-bit image with a grayscale palette. If you need to change the palette, refer to the ColorRes method.

See Also

Topics	Raster Images: Creating and Deleting Images
Raster Images: Palettes


fWidth Parameter For CreateBitmap
fWidth

Width of the bitmap. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For CreateBitmap
fHeight

Height of the bitmap. The unit of measure is determined by the ScaleMode property.


iBitsPerPixel Parameter For CreateBitmap
iBitsPerPixel

The number of bits per pixel. Valid values are 1, 4, 8, 16, 24, and 32. Use 0 to create an 8-bit image with a grayscale palette.


Return for CreateBitmap
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


CreateFadedMask method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short CreateFadedMask(OLE_HANDLE hBitmap, short iLength, short iFadeRate, short iStepSize, short iInflate, short iFlag, short iMaxGray, OLE_COLOR crTransparent);

Overview	Refer to Combining Images.

Remarks

(DigitalPaint only) Creates a fade mask bitmap in which the color of each pixel is changed with respect to its position in the bitmap. This change depends on the fade rate. This method is only available in the DigitalPaint toolkits.

This method is concerned with the size and shape of the region, not the bitmap itself. Therefore, any bitmap with a region can be used to create a fade mask bitmap. The fade mask bitmap can be used by the FeatherAlphaBlend method to combine two bitmaps with feathering.

If the FADE_OUTER flag is not set, then the size of the fade mask bitmap is equal to the size of a region and the fade progresses toward the center of the region. If the FADE_OUTER flag is set, the size is equal to the size of region plus the iInflate value and the fade starts at the edge of the region and progresses toward the edge of the fade mask bitmap. (The iInflate parameter is used only with FADE_OUTER flag)

In order to use the fade mask bitmap in the FeatherAlphaBlend method the fade mask bitmap must contain three portions:

a)	A portion in which the output (from the blending function) will be the same as the destination bitmap. This is called the Transparency portion of the mask and it’s filled with black.

b)	A portion in which the output is a combination of the destination and source bitmap.

c)	A portion in which the output comes from the source bitmap. This is called the Dump portion of the mask and it’s filled with white.

See Also

Elements	Underlay method, Combine method, FeatherAlphaBlend method, AlphaBlend method

Topics	Raster Images: Combining Images
Image Processing


hBitmap Parameter For CreateFadedMask
hBitmap

Handle to a LEAD bitmap . This bitmap must have a region.


iLength Parameter For CreateFadedMask
iLength

Value that represents the extent of the fade, in pixels.


iFadeRate Parameter For CreateFadedMask
iFadeRate

Value that represents the rate at which the color will fade with each step. Values are between 0 and 255.


iStepSize Parameter For CreateFadedMask
iStepSize

Step size at which the color will change. This value is in pixels.


iInflate Parameter For CreateFadedMask
iInflate

Value that indicates the amount to expand resulting bitmap. This parameter is used only if FADE_OUTER is set in iFlag.


pp Parameter For CreateFadedMask
iFlag

Flags that indicate how the fade mask will be created.  Possible values are:

Value	Meaning

FADE_OUTER	[0x0001] If this flag is set, the fade will be outside the bitmap's region. If this flag is not set, the fade will be inside the bitmap's region.

FADE_DUMPFILL	[0x0002] If this flag is set, the dump part of the mask will be filled with the dump color. The FADE_FILLCOLOR_START and FADE_WHITETOBLACK flags determine the dump color. If this flag is not set, the dump part is filled with the crTransparent color.

FADE_FILLCOLOR_START	[0x0004] If this flag is set, the dump color is the color used at the start of the fade. The start color may be white or black, based on the FADE_WHITETOBLACK. If this flag is not set, the dump color is the color at the end of the fade. If the FADE_DUMPFILL flag is not set, this flag is ignored.

FADE_WHITETOBLACK	[0x0008] If this flag is set, the fade starts with white and changes toward black. If this flag is not set, the fade changes from black to white.

FADE_NOTRANSPARENCY	[0x0010] If this flag is set, fill the transparency part with a color other than crTransparency. The color is either the same as the dump color, or its opposite, depending on whether the FADE_TRANSPARENCY_DUMPCOLOR flag is set. If the FADE_NOTRANSPARENCY flag is not set, fill the transparency with crTransparency. If the FADE_DUMPFILL flag is not set, this flag is ignored.

FADE_TRANSPARENCY_DUMPCOLOR	[0x0020] If this flag is set, the transparency color is the same as the dump color. If this flag is not set, the transparency color is the opposite of the dump color. This flag is used only if FADE_NOTRANSPARENCY is set


iMaxGray Parameter For CreateFadedMask
iMaxGray

The maximum value of the fade color. Possible values are between 0 and 255.


crTransparent Parameter For CreateFadedMask
crTransparent

Transparency color.


Return for CreateFadedMask
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


CreateThumbnailFromFile method (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short CreateThumbnailFromFile (BSTR pszFilename, long nPage);

Overview	Refer to Thumbnail Browser.

Remarks

Generates a thumbnail from the specified image file.

The generated thumbnail can be processed in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, ContinueBrowse property, Filter property, ThumbnailWidth property, ThumbnailHeight property, ThumbnailBitsPerPixel property, MaintainAspect property, ForceSize property, ThumbnailBackgroundColor property, LoadStamp property, Resample property, StopOnError property, IncludeSubDirectories property, ExpandMultipage property, MaxSizeDisk property, MaxSizeMem property, DitherFlags property, PaletteFlags property

Topics	Raster Images: Using the Thumbnail Browser


pszFilename Parameter For CreateThumbnailFromFile
pszFilename

Character string containing the name of the image file to load.


nPage Parameter For CreateThumbnailFromFile
nPage

The page number (for multipage files) that contains the image to be loaded.

If the file is not a multipage file, pass 0.


Return for CreateThumbnailFromFile
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


CreateUserBitmap method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short CreateUserBitmap (float fWidth, float fHeight, short iBitsPerPixel, VARIANT vData, long lDataSize);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

This method creates a user bitmap. The user is responsible for allocating and managing the bitmap data pointer. The bitmap data pointer can be specified when the bitmap is created or it can be set later using SetBitmapDataPointer. Freeing this type of bitmap will not free the data pointer set by the SetBitmapDataPointer method.

If the bitmap is 8 bits/pixel or less, the bitmap’s palette should be set with the BitmapPalette property.

The data is not copied. The user is responsible for making sure the bitmap data is valid. This method is designed for high-speed bitmap manipulation.

Note that in LEADTOOLS, the bitmap data is allocated so every row contains a multiple of 4 bytes. The data that you pass to this method should follow the same convention.

See Also

Elements:	CreateBitmap method, SetBitmapDataPointer method

Topics	Raster Images: Creating and Deleting Images


fWidth Parameter For CreateUserBitmap
fWidth

Width of the bitmap. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For CreateUserBitmap
fHeight

Height of the bitmap. The unit of measure is determined by the ScaleMode property.


iBitsPerPixel Parameter For CreateUserBitmap
iBitsPerPixel

The number of bits per pixel. Valid values are 1, 4, 8, 12, 16, 24, 32, 48, and 64. Use 0 to create an 8-bit image with a grayscale palette.


vData Parameter For CreateUserBitmap
vData

Optional parameter that can specify the bitmap data. Can be an empty variant, in which case the bitmap data is undefined.


lDataSize Parameter For CreateUserBitmap
lDataSize

The size of the data from vData. If vData is empty, then this parameter is ignored. Should match the required size for the bitmap data.


Return for CreateUserBitmap
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


CurrentPage property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long CurrentPage

Overview	Refer to Using the Image List Control.

Remarks

(Read-only)(Runtime-only) Gets the number of the currently visible page of items in the ImageList Control.

This will return the highest visible page number in the ImageList Control.  Pages are calculated using the total number of rows or columns (depending on the scroll style) and the total number of rows or columns (depending on the scroll style) that are completely visible in the ImageList Control's client area.  A page is not visible unless its first row/column is completely visible.

See Also

Elements	PageCount property, Insert method, Remove method, RowCount property, ColumnCount property, Count property, Clear method, Item property, ScrollItems method

Topics	Raster Images: Displaying Images


CurveClose property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short CurveClose

Overview	Refer to Creating and Using a Bitmap Region

Remarks

Value that indicates how the curve is closed. This property is used only when the CurveType property is set to CURVE_STANDARD.  Possible values are:

Value	Meaning

CURVE_NO_CLOSE	[0x0] For n points, draw (n – 3) segments. For example, for points {P0, P1, P2, P3, P4}, draw segments P1P2 and P2P3.

CURVE_CLOSE	[0x1] For n points draw (n) segments. For example, for points {P0, P1, P2, P3, P4}, draw segments P0P1, P1P2, P2P3, P3P4, P4P0.

CURVE_PARTIAL_CLOSE	[0x2] For n points draw (n – 1) segments. For example, for points {P0, P1, P2, P3, P4}, draw segments P0P1, P1P2, P2P3, P3P4 (but not P4P0).

In the following diagram, the resulting region is shown in gray.

To create a curve region, first build an ordered array of points for the curve. Then create the region based on the array. The CurveSize property specifies the size of the array. Either specify a large array to start with, or increase the size of the array as needed, without losing existing points. For each point, update the following indexed properties:

 CurveX property

 CurveY property

and define the characteristics of the curve by setting the following properties:

 CurveType property

 CurveTension property

 CurveClose property

Then call the SetRgnCurve method to add the region to the bitmap.

See Also

Elements	CurveX property, CurveY property, SetRgnCurve method, CurveSize property, CurveToBezier method, CurveType property, CurveTension property

Topics	Raster Images: Creating and Using a Region


CurveSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long CurveSize

Overview	Refer to Creating and Using a Bitmap Region

Remarks

Indicates the size of the arrays (CurveX property and CurveY property) used to store the vertices of the curve.

This property is used by both the SetRgnCurve method and the CurveToBezier method.

The CurveType property can define two types of curves:

 If the CurveType property is set to CURVE_STANDARD, the points contained in the CurveX property and the CurveY property represent a smooth curve that goes through all of the points. In this case, the CurveSize property must be at least three.

 If the CurveType property is set to CURVE_BEZIER, the points contained in the CurveX property and the CurveY property represent a series of Bezier curves that use the points as control points. In this case, the CurveSize property must be 3n + 1, where n >= 1. For example, CurveSize can be 4, 7, 10, 13, and so on. The first four points define the first Bezier curve, and each subsequent group of three points defines the next Bezier curve, using the last point of the previous Bezier curve as the starting point.

To create a curve region, first build an ordered array of points for the curve. Then create the region based on the array. The CurveSize property specifies the size of the array. Either specify a large array to start with, or increase the size of the array as needed, without losing existing points. For each point, update the following indexed properties:

 CurveX property

 CurveY property

and define the characteristics of the curve by setting the following properties:

 CurveType property

 CurveTension property

 CurveClose property

Then call the SetRgnCurve method to add the region to the bitmap.

See Also

Elements	CurveX property, CurveY property, SetRgnCurve method, CurveTension property, CurveToBezier method, CurveType property, CurveClose property

Topics	Raster Images: Creating and Using a Region


CurveTension property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float CurveTension

Overview	Refer to Creating and Using a Bitmap Region

Remarks

Indicates the "straightness" of the curves that connect the points.

This property is used only when CurveType property is set to CURVE_STANDARD. Valid values are between 0.0 and 1.0, where 0.0 indicates straight lines, and 1.0 indicates lines with the highest curvature. A typical value is 0.5.

To create a curve region, first build an ordered array of points for the curve. Then create the region based on the array. The CurveSize property specifies the size of the array. Either specify a large array to start with, or increase the size of the array as needed, without losing existing points. For each point, update the following indexed properties:

 CurveX property

 CurveY property

and define the characteristics of the curve by setting the following properties:

 CurveType property

 CurveTension property

 CurveClose property

Then call the SetRgnCurve method to add the region to the bitmap.

See Also

Elements	CurveX property, CurveY property, SetRgnCurve method, CurveSize property, CurveToBezier method, CurveType property, CurveClose property

Topics	Raster Images: Creating and Using a Region


CurveToBezier method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short CurveToBezier ();

Overview	Refer to Creating and Using a Bitmap Region

Remarks

Converts a curve, defined by an array of points that the curve passes through, to an array of Bezier points. The resulting array can be used with the Windows API PolyBezier and PolyBezierTo procedures.

This method is used to convert a standard curve to an array of Bezier control points. A LEAD standard curve (CURVE_STANDARD) is defined by the array of points defined by the CurveX property, CurveY property and the CurveSize property. The standard curve passes through all of the points of the array, and is continuous at each point. This method can be used to draw this curve by converting it to an array of Bezier points.

At most, the resulting array holds (3n + 1) entries, where n is the number of points in the CURVE_STANDARD curve.

The curve to be converted is defined by the following properties:

 CurveSize property

 CurveX property

 CurveY property

 CurveType property

 CurveTension property

 CurveClose property

The resulting Bezier curve is defined by the following properties:

 BezierSize property

 BezierX property

 BezierY property

Please note that the BezierSize, BezierX and BezierY properties are read only and are updated by calling the CurveToBezier method.

See Also

Elements	CurveX property, CurveY property, SetRgnCurve method, CurveSize property, CurveToBezier method, CurveType property, CurveClose property, CurveTension property, BezierSize property, BezierX property, BezierY property

Topics	Raster Images: Creating and Using a Region


Return for CurveToBezier
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


CurveType property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long CurveType

Overview	Refer to Creating and Using a Bitmap Region

Remarks

Indicates the type of curve defined by the array of points specified in the CurveX property and the CurveY property. Possible values are:

Value	Meaning

CURVE_BEZIER	The points specified in the CurveX and CurveY properties define a Bezier curve.

CURVE_STANDARD	The points specified in the CurveX and CurveY properties define a standard curve.

This property must be set to CURVE_STANDARD to use the CurveX and CurveY arrays with the CurveToBezier method.

To create a curve region, first build an ordered array of points for the curve. Then create the region based on the array. The CurveSize property specifies the size of the array. Either specify a large array to start with, or increase the size of the array as needed, without losing existing points. For each point, update the following indexed properties:

 CurveX property

 CurveY property

and define the characteristics of the curve by setting the following properties:

 CurveType property

 CurveTension property

 CurveClose property

Then call the SetRgnCurve method to add the region to the bitmap.

See Also

Elements	CurveX property, CurveY property, SetRgnCurve method, CurveSize property, CurveToBezier method, CurveTension property, CurveClose property

Topics	Raster Images: Creating and Using a Region


CurveX property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float CurveX (long iIndex);

Overview	Refer to Creating and Using a Bitmap Region

Remarks

An array of float values that represent the X coordinates for the points that define the curve.

This property is used by both the SetRgnCurve method and the CurveToBezier method.

The position is relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

To create a curve region, first build an ordered array of points for the curve. Then create the region based on the array. The CurveSize property specifies the size of the array. Either specify a large array to start with, or increase the size of the array as needed, without losing existing points. For each point, update the following indexed properties:

 CurveX property

 CurveY property

and define the characteristics of the curve by setting the following properties:

 CurveType property

 CurveTension property

 CurveClose property

Then call the SetRgnCurve method to add the region to the bitmap.

See Also

Elements	CurveY property, SetRgnCurve method, CurveSize property, CurveToBezier method, CurveTension property, CurveClose property, CurveType property

Topics	Raster Images: Creating and Using a Region


iIndex Parameter For CurveX
iIndex

Index into the ordered array of X coordinates of the points that define the curve. This is a zero-based index.


CurveY property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float CurveY (long iIndex);

Overview	Refer to Creating and Using a Bitmap Region

Remarks

An array of float values that represent the Y coordinates for the points that define the curve.

This property is used by both the SetRgnCurve method and the CurveToBezier method.

The position is relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

To create a curve region, first build an ordered array of points for the curve. Then create the region based on the array. The CurveSize property specifies the size of the array. Either specify a large array to start with, or increase the size of the array as needed, without losing existing points. For each point, update the following indexed properties:

 CurveX property

 CurveY property

and define the characteristics of the curve by setting the following properties:

 CurveType property

 CurveTension property

 CurveClose property

Then call the SetRgnCurve method to add the region to the bitmap.

See Also

Elements	CurveX property, SetRgnCurve method, CurveSize property, CurveToBezier method, CurveTension property, CurveClose property, CurveType property

Topics	Raster Images: Creating and Using a Region


iIndex Parameter For CurveY
iIndex

Index into the ordered array of Y coordinates of the points that define the curve. This is a zero-based index.


DataChanged property (Main Control)

Visual Basic example   Other systems

Syntax	BOOL DataChanged

Overview	Refer to Using a Visual Basic Data Control.

Remarks

Indicates whether the bitmap is current with the database field.

Use this property when the Main Control is bound to a data control using the DataSource and DataField properties.

Setting	Description

TRUE	The bitmap in the control is not the same as in the current record.

FALSE	The bitmap in the control, if any, is the same as the data in the current record.

See Also

Topics	Databases: Visual Basic Data Binding


DataDirty property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL DataDirty

Overview	Refer to Using the OLE DB Control.

Remarks

(Persistent property, not available at design time) Specifies the data in the OLEDB Control is "dirty", and should be written to the database during the next update.  Use this after updating the bitmap or annotations when you wish the changes to be stored in the database.

See Also

Elements:	Bitmap property, AnnContainer property

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


DataField property (Main Control)

Visual Basic example   Other systems

Syntax	BSTR DataField

Overview	Refer to Using a Visual Basic Data Control.

Remarks

(Persistent property, available at design time)  Binds the Main Control to a database field.

The DataSource property of a bound Main Control specifies a valid data control name, and the DataField property specifies a valid field name in the data control's Recordset property. Together, these properties specify which bitmap appears in the Main Control.

See Also

Topics	Databases: Visual Basic Data Binding


DataField property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR DataField

Overview	Refer to Using the OLE DB Control.

Remarks

(Persistent property, available at design time)  Binds the OLE DB Control to a database field.

The DataSource property of a bound OLE DB Control specifies a valid data control name, and the DataField property specifies a valid field name in the data control's Recordset property. Together, these properties specify which bitmap is loaded into the OLE DB Control.

See Also

Elements:	DataMember property, DataSource property

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


DataLoadBits property (Main Control)

Visual Basic example   Other systems

Syntax	short DataLoadBits

Overview	Refer to Using a Visual Basic Data Control.

Remarks

(Persistent property, available at design time) Specifies the bits per pixel for the bitmap that is loaded into memory from a database field.

Support for 12 and 16-bit grayscale images is only available in the Document/Medical Toolkits .

Use this property when the Main Control is bound to a data control using the DataSource and DataField properties.

Value	Meaning

0	Keep the original field's pixel depth (Do not convert).

1	1 bit per pixel in the resultant bitmap

4	4 bits per pixel in the resultant bitmap

8	8 bits per pixel in the resultant bitmap

12	12 bits per pixel in the resultant bitmap

16	16 bits per pixel in the resultant bitmap

24	24 bits per pixel in the resultant bitmap

32	32 bits per pixel in the resultant bitmap

See Also

Topics	Databases: Visual Basic Data Binding


DataLoadBits property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short DataLoadBits

Overview	Refer to Using the OLE DB Control.

Remarks

(Persistent property, available at design time) Specifies the bits per pixel for the bitmap that is loaded into memory from a database field.

Support for 12 and 16-bit grayscale images is only available in the Document/Medical Toolkits.

Possible values are:

Value	Meaning

0	Keep the original field's pixel depth (Do not convert).

1	1 bit per pixel in the resultant bitmap

4	4 bits per pixel in the resultant bitmap

8	8 bits per pixel in the resultant bitmap

12	12 bits per pixel in the resultant bitmap

16	16 bits per pixel in the resultant bitmap

24	24 bits per pixel in the resultant bitmap

32	32 bits per pixel in the resultant bitmap

See Also

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


DataLoaded event (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void DataLoaded (short nStatus);

Overview	Refer to Using the OLE DB Control.

Remarks

Occurs after data is loaded from the record in the database.

Note: This event can occur with the nStatus = ERROR_FILENOTFOUND for records that have no image stored in the bound field. Also, this can occur after a record is first inserted, but before the image data is actually saved to the recordset.

See Also

Elements:	Bitmap property, AnnContainer property

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


nStatus Parameter For DataLoaded
nStatus

Refer to Error Codes.


DataMember property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR DataMember

Overview	Refer to Using the OLE DB Control.

Remarks

(Persistent property, available at design time) Returns or sets a specified data member from among several offered by the data provider.

A data provider can have multiple sets of data to which a data consumer can choose to bind. Each set of data is called a "data member," and is identified by a unique string.

For example, when using a Data Environment that contains several Command objects as a DataSource, the DataMember specifies which Command object to use.

See Also

Elements:	DataSource property, DataField property

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


DataSaveBits property (Main Control)

Visual Basic example   Other systems

Syntax	short DataSaveBits

Overview	Refer to Using a Visual Basic Data Control.

Remarks

(Persistent property, available at design time) Specifies the bits per pixel to use when adding or updating an image field in a database record.

Use this property when the Main Control is bound to a data control using the DataSource and DataField properties.

The format of the saved image, which is specified using the DataSaveFormat property, determines the valid bits per pixel. For valid values, refer to Formats of Output Files.

Support for 12 and 16-bit grayscale  images is available only in the Document/Medical Toolkits .

See Also

Topics	Databases: Visual Basic Data Binding


DataSaveBits property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short DataSaveBits

Overview	Refer to Using the OLE DB Control.

Remarks

(Persistent property, available at design time) Specifies the bits per pixel to use when adding or updating an image field in a database record.

The format of the saved image, which is specified using the DataSaveFormat property, determines the valid bits per pixel. For valid values, refer to Formats of Output Files.

Support for 12 and 16-bit grayscale  images is available only in the Document/Medical Toolkits.

See Also

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


DataSaved event (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void DataSaved (short nStatus);

Overview	Refer to Using the OLE DB Control.

Remarks

Occurs after data is saved to the record in the database.

See Also

Elements:	Bitmap property, AnnContainer property, DataDirty property

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


nStatus Parameter For DataSaved
nStatus

Refer to Error Codes.


DataSaveFormat property (Main Control)

Visual Basic example   Other systems

Syntax	short DataSaveFormat

Overview	Refer to Using a Visual Basic Data Control.

Remarks

(Persistent property, available at design time) Specifies the file format to use when adding or updating an image field in a database record.

Use this property when the Main Control is bound to a data control using the DataSource and DataField properties.

For valid values, refer to Formats of Output Files.

See Also

Topics	Databases: Visual Basic Data Binding, Using a Visual Basic Data Control


DataSaveFormat property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short DataSaveFormat

Overview	Refer to Using the OLE DB Control.

Remarks

(Persistent property, available at design time) Specifies the file format to use when adding or updating an image field in a database record.

For valid values, refer to Formats of Output Files.

See Also

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


DataSaveQuality property (Main Control)

Visual Basic example   Other systems

Syntax	short DataSaveQuality

Overview	Refer to Using a Visual Basic Data Control.

Remarks

(Persistent property, available at design time) Specifies the image quality, when using CMP or JPEG compression to add or update an image field in a database record.

Use this property when the Main Control is bound to a data control using the DataSource and DataField properties.

For possible values, refer to Compression Quality Factors.

See Also

Topics	Databases: Visual Basic Data Binding


DataSaveQuality property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short DataSaveQuality

Overview	Refer to Using the OLE DB Control.

Remarks

(Persistent property, available at design time) Specifies the image quality, when using CMP or JPEG compression, to add or update an image field in a database record.

For possible values, refer to Compression Quality Factors.

See Also

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


DataSource property (Main Control)

Visual Basic example   Other systems

Syntax	IRowCursor* DataSource

Overview	Refer to Using a Visual Basic Data Control.

Remarks

(Persistent property, available at design time) Sets the data control through which the Main Control is bound to the database.

To bind a control to a field in a database at run time, you must specify a data control in this property at design time. To complete the connection with a database, you must also provide the name of a Field object in the DataField property.

See Also

Topics	Databases: Visual Basic Data Binding


DataSource property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	IDataSource* DataSource

Overview	Refer to Using the OLE DB Control.

Remarks

(Persistent property, available at design time) Sets the OLE DB data control through which the OLE DB Control is bound to the database.

To bind a control to a field in a database at run time, you must specify a data control in this property at design time. To complete the connection with a database, you must also provide the name of a Field object in the DataField property.

See Also

Elements:	DataMember property, DataField property

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


dbAddNew method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void dbAddNew ();

Overview	Refer to Managing Images in a Database

Remarks

Prepares a new, empty record for the current the recordset.

After you call dbAddNew, you can set values in the record's fields. (You do not have to call the dbEdit method for this purpose; use dbEdit only for existing records.) When you subsequently call the dbUpdate method, changed values are saved in the data source.

You must call the dbRequery method to see the newly added record.

Note: If you move to a new record before you call the dbUpdate method, the new record is lost, and no warning is given.

See Also

Elements	dbEdit method, dbUpdate method, dbDelete method, dbLockingMode property

Topics	Databases: Using ODBC


Return for dbAddNew
Return Value

None.


dbCanAppend property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL dbCanAppend

Overview	Refer to Managing Images in a Database

Remarks

Indicates whether it is possible to add a record to the current recordset.

Value	Description

TRUE	You can use the dbAddNew method and the dbUpdate method to add a record to the recordset.

FALSE	Either the recordset is not opened for updating or the data source does not allow updating.

See Also

Elements	dbCanRestart property, dbCanScroll property, dbCanUpdate property, dbCurrentRecord property, dbEditMode property, dbIsBOF property, dbIsDeleted property, dbIsEOF property, dbIsOpen property, dbRecordCount property

Topics	Databases: Using ODBC


dbCanRestart property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL dbCanRestart

Overview	Refer to Managing Images in a Database

Remarks

Indicates whether it is possible to rebuild the recordset from the database.

Value	Description

TRUE	You can use the dbRequery method to refresh the recordset.

FALSE	The data source does not support the dbRequery method.

See Also

Elements	dbCanAppend property, dbCanScroll property, dbCanUpdate property, dbCurrentRecord property, dbEditMode property, dbIsBOF property, dbIsDeleted property, dbIsEOF property, dbIsOpen property, dbRecordCount property

Topics	Databases: Using ODBC


dbCanScroll property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL dbCanScroll

Overview	Refer to Managing Images in a Database

Remarks

Indicates whether the data source supports the dbMove... methods, which let you scroll through the recordset.

Value	Description

TRUE	You can use the dbMove... methods.

FALSE	The data source does not support all of the dbMove... methods, although it should support forward scrolling, as in the (dbMoveNext method).

See Also

Elements	dbCanAppend property, dbCanRestart property, dbCanUpdate property, dbCurrentRecord property, dbEditMode property, dbIsBOF property, dbIsDeleted property, dbIsEOF property, dbIsOpen property, dbRecordCount property

Topics	Databases: Using ODBC


dbCanUpdate property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL dbCanUpdate

Overview	Refer to Managing Images in a Database

Remarks

Indicates whether it is possible to add or update a record to the current recordset.

Value	Description

TRUE	You can use the dbAddNew method or the dbEdit method; then use the dbUpdate method to update the recordset.

FALSE	Either the recordset is not opened for updating or the data source does not allow updating.

See Also

Elements	dbCanAppend property, dbCanRestart property, dbCanScroll property, dbCurrentRecord property, dbEditMode property, dbIsBOF property, dbIsDeleted property, dbIsEOF property, dbIsOpen property, dbRecordCount property

Topics	Databases: Using ODBC


dbClose method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void dbClose ();

Overview	Refer to Managing Images in a Database

Remarks

Closes the current recordset and the database.

See Also

Elements	dbOpen method, dbRequery method, dbLoadBits property

Topics	Databases: Using ODBC


Return for dbClose
Return Value

None.


dbCurrentRecord property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long dbCurrentRecord

Overview	Refer to Managing Images in a Database

Remarks

Is the number of the current record in the recordset.

See Also

Elements	dbCanAppend property, dbCanRestart property, dbCanScroll property, dbCanUpdate property, dbEditMode property, dbIsBOF property, dbIsDeleted property, dbIsEOF property, dbIsOpen property, dbRecordCount property

Topics	Databases: Using ODBC


dbDelete method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void dbDelete ();

Overview	Refer to Managing Images in a Database

Remarks

Deletes data from the current record, effectively deleting the record.

After using this method, use one of the dbMove... methods to go to another record. Afterward, you cannot return to the deleted record.

See Also

Elements	dbAddNew method, dbEdit method, dbUpdate method, dbLockingMode property

Topics	Databases: Using ODBC


Return for dbDelete
Return Value

None.


dbEdit method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void dbEdit ();

Overview	Refer to Managing Images in a Database

Remarks

Prepares the current record to be updated.

When you call this method, current field values are saved in a buffer. You can then change values and call the dbUpdate method to update the database.

If before calling the dbUpdate method, you call one of the dbMove... methods or you call the dbEdit method again, the original values (saved in the buffer) are restored.

See Also

Elements	dbAddNew method, dbUpdate method, dbDelete method, dbLockingMode property

Topics	Databases: Using ODBC


Return for dbEdit
Return Value

None.


dbEditMode property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short dbEditMode

Overview	Refer to Managing Images in a Database

Remarks

Indicates the edit mode of the current record.

Value	Meaning

DB_EDITMODE_NONE	The current mode is read-only.

DB_EDITMODE_EDIT	The dbEdit method has been called, and calling the dbUpdate method will update the current record.

DB_EDITMODE_ADDNEW	The dbAddNew method has been called, and calling the dbUpdate method will add the current record to the database.

See Also

Elements	dbCanAppend property, dbCanRestart property, dbCanScroll property, dbCanUpdate property, dbCurrentRecord property, dbIsBOF property, dbIsDeleted property, dbIsEOF property, dbIsOpen property, dbRecordCount property

Topics	Databases: Using ODBC


dbIsBOF property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL dbIsBOF

Overview	Refer to Managing Images in a Database

Remarks

Indicates whether you have scrolled to a position before the first record in the recordset.

This helps you avoid errors when using the dbMove... methods. Also, you can use this method to determine whether a recordset contains any records. Immediately after calling the dbOpen method, the dbIsBOF method will return TRUE if the recordset is empty.

Value	Meaning

TRUE	You have scrolled before the first record (or the recordset is empty).

FALSE	You have not scrolled before the first record.

See Also

Elements	dbCanAppend property, dbCanRestart property, dbCanScroll property, dbCanUpdate property, dbCurrentRecord property, dbEditMode property, dbIsDeleted property, dbIsEOF property, dbIsOpen property, dbRecordCount property

Topics	Databases: Using ODBC


dbIsDeleted property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL dbIsDeleted

Overview	Refer to Managing Images in a Database

Remarks

Indicates whether the current record has been deleted.

Value	Meaning

TRUE	You have called the dbDelete method but have not yet moved to another record.

FALSE	The current record has not been deleted.

See Also

Elements	dbCanAppend property, dbCanRestart property, dbCanScroll property, dbCanUpdate property, dbCurrentRecord property, dbEditMode property, dbIsBOF property, dbIsEOF property, dbIsOpen property, dbRecordCount property

Topics	Databases: Using ODBC


dbIsEOF property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL dbIsEOF

Overview	Refer to Managing Images in a Database

Remarks

Indicates whether you have scrolled beyond the last record in the recordset.

This helps you avoid errors when using the dbMove... methods. Also, you can use this method to determine whether a recordset contains any records. Immediately after calling the dbOpen method, the dbIsEOF method will return TRUE if the recordset is empty.

Value	Meaning

TRUE	You have scrolled beyond the last record (or the recordset is empty).

FALSE	You have not scrolled beyond the first record.

See Also

Elements	dbCanAppend property, dbCanRestart property, dbCanScroll property, dbCanUpdate property, dbCurrentRecord property, dbEditMode property, dbIsBOF property, dbIsDeleted property, dbIsOpen property, dbRecordCount property

Topics	Databases: Using ODBC


dbIsOpen property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL dbIsOpen

Overview	Refer to Managing Images in a Database

Remarks

Indicates whether you are connected to a database.

Value	Meaning

TRUE	You are connected to a database.

FALSE	You are not connected to a database.

See Also

Elements	dbCanAppend property, dbCanRestart property, dbCanScroll property, dbCanUpdate property, dbCurrentRecord property, dbEditMode property, dbIsBOF property, dbIsDeleted property, dbIsEOF property, dbRecordCount property

Topics	Databases: Using ODBC


DblClick event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void DblClick (void);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when the user double-clicks a mouse button over the Main Control. This is one of four events that occur in the following order when the user double-clicks a mouse button:

1. MouseDown event

2. Click event

3. MouseUp event

4. DblClick event

The MouseDown and MouseUp events let you check which mouse button is pressed.

See Also

Elements	Resize event, Click event, KeyDown event, KeyPress event, KeyUp event, MouseMove event, MouseDown event, MouseUp event, Scroll event

Topics	Raster Images: Displaying Images


DblClick event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void DblClick ();

Overview	Refer to Detecting Events.

Remarks

Occurs when the user double-clicks a mouse button over the Main Control.

This is one of four events that occur in the following order when the user double-clicks a mouse button:

1.	MouseDown event

2.	Click event

3.	MouseUp event

4.	DblClick event

The MouseDown and MouseUp events let you check which mouse button is pressed.

See Also

Elements	Click event, MouseDown event, MouseMove event, MouseUp event

Topics	Working with the Control: General Behavior
Working with the Control: Client Area Usage


dbLoadBits property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short dbLoadBits

Overview	Refer to Managing Images in a Database

Remarks

Specifies the bits per pixel of the bitmap to be loaded from the database. Use 0 to keep the same bits per as the stored image.

Support for 12 and 16-bit grayscale images is available only in the Document/Medical Toolkits .

See Also

Elements	dbOpen method, dbClose method, dbRequery method

Topics	Databases: Using ODBC


dbLockingMode property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short dbLockingMode

Overview	Refer to Managing Images in a Database

Remarks

Specifies the record-locking strategy to use when updating an existing record in the database.

Setting	Meaning

DB_LOCKINGMODE_OPTIMISTIC	Locks the record being updated only during the call to the dbUpdate method.

DB_LOCKINGMODE_PESSIMISTIC	Locks the record as soon as dbEdit method is called and keeps it locked until the dbUpdate method call completes or you move to a new record.

See Also

Elements	dbAddNew method, dbEdit method, dbUpdate method, dbDelete method

Topics	Databases: Using ODBC


dbMove method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example

Syntax	void dbMove (long lRows);

Overview	Refer to Managing Images in a Database

Remarks

Selects the record that is the specified number of rows forward or backward from the current one.

To avoid errors, ensure that a record exists in the specified position before using this method.

This method cancels any record additions or edits that have not been completed using the dbUpdate method.

See Also

Elements	dbMoveFirst method, dbMoveLast method, dbMoveNext method, dbMovePrev method

Topics	Databases: Using ODBC


lRows Parameter For dbMove
lRows

The number of rows to move to select a record. Negative numbers move backward; positive numbers move forward.


Return for dbMove
Return Value

None.


dbMoveFirst method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void dbMoveFirst ();

Overview	Refer to Managing Images in a Database

Remarks

Selects the first record in the recordset.

To avoid errors, ensure that a record exists in the specified position before using this method.

This method cancels any record additions or edits that have not been completed using the dbUpdate method.

See Also

Elements	dbMove method, dbMoveLast method, dbMoveNext method, dbMovePrev method

Topics	Databases: Using ODBC


Return for dbMoveFirst
Return Value

None.


dbMoveLast method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void dbMoveLast ();

Overview	Refer to Managing Images in a Database

Remarks

Selects the last record in the recordset.

To avoid errors, ensure that a record exists in the specified position before using this method.

This method cancels any record additions or edits that have not been completed using the dbUpdate method.

See Also

Elements	dbMove method, dbMoveFirst method, dbMoveNext method, dbMovePrev method

Topics	Databases: Using ODBC


Return for dbMoveLast
Return Value

None.


dbMoveNext method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void dbMoveNext ();

Overview	Refer to Managing Images in a Database

Remarks

Selects the next record (forward) in the recordset.

To avoid errors, ensure that a record exists in the specified position before using this method.

This method cancels any record additions or edits that have not been completed using the dbUpdate method.

See Also

Elements	dbMove method, dbMoveFirst method, dbMoveLast method, dbMovePrev method

Topics	Databases: Using ODBC


Return for dbMoveNext
Return Value

None.


dbMovePrev method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void dbMovePrev ();

Overview	Refer to Managing Images in a Database

Remarks

Selects the previous record (backward) in the recordset.

To avoid errors, ensure that a record exists in the specified position before using this method.

This method cancels any record additions or edits that have not been completed using the dbUpdate method.

See Also

Elements	dbMove method, dbMoveFirst method, dbMoveLast method, dbMoveNext method

Topics	Databases: Using ODBC


Return for dbMovePrev
Return Value

None.


dbOpen method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL dbOpen (BSTR pszConnect, BSTR pszSQL, BSTR pszField, long iOptions);

Overview	Refer to Managing Images in a Database

Remarks

Opens a recordset in an ODBC-accessible database.

After the recordset is open, you can use other db... methods and properties to access and update images in the recordset. To close the database, use the dbClose method.

If you get the following error, the ODBC data source is not set up properly. Refer to Using ODBC for information on setting up a data source.

Error #61704 "OLE IDISPATCH error #61704 from LTKRN14N: Internal

See Also

Elements	dbClose method, dbRequery method, dbLoadBits property

Topics	Databases: Using ODBC


pszConnect Parameter For dbOpen
pszConnect

Specifies a connect string. The connect string concatenates information, possibly including a data source name, a user ID valid on the data source, a user authentication string (password, if the data source requires one), and other information.

The whole connect string must be prefixed by the string "ODBC;" (uppercase or lowercase). The "ODBC;" string is used to indicate that the connection is to an ODBC data source. If you do not supply pszConnect, its value defaults to "ODBC;".


pszSQL Parameter For dbOpen
pszSQL

Specifies the recordset to load as follows:

 A NULL pointer.

 The name of a table.

 An SQL SELECT statement (optionally with an SQL WHERE or ORDER BY clause).

 A CALL statement specifying the name of a predefined query (stored procedure).

In an SQL SELECT statement, the field containing the image must be specified first. For example, where photo is the image field and who is the sort field, the statement to select all records in the people table would be as follows:

SELECT photo,* FROM people ORDER BY who


pszField Parameter For dbOpen
pszField

The name of the field to be used for LEADTOOLS images. This must be a long binary field.


iOptions Parameter For dbOpen
iOptions

Setting	Description

DB_OPENOPTIONS_NONE	You can update the recordset by adding new records or by editing or deleting existing records (if the data source allows the update).

DB_OPENOPTIONS_READONLY	You cannot add, edit, or delete records.

DB_OPENOPTIONS_APPENDONLY	You can only add records (if the data source allows the update).


Return for dbOpen
Return Value

Value	Meaning

TRUE	The connection to the recordset was successful.

FALSE	The connection to the recordset failed.


dbRecordCount property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long dbRecordCount

Overview	Refer to Managing Images in a Database

Remarks

Is the number of records in the recordset.

See Also

Elements	dbCanAppend property, dbCanRestart property, dbCanScroll property, dbCanUpdate property, dbCurrentRecord property, dbEditMode property, dbIsBOF property, dbIsDeleted property, dbIsEOF property, dbIsOpen property

Topics	Databases: Using ODBC


dbRequery method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL dbRequery ();

Overview	Refer to Managing Images in a Database

Remarks

Rebuilds the recordset from the database.

This method uses the same recordset specified in the dbOpen method. The first record becomes the current record.

If the rebuild fails, the database is automatically closed.

See Also

Elements	dbOpen method, dbClose method, dbLoadBits property

Topics	Databases: Using ODBC


Return for dbRequery
Return Value

Value	Meaning

TRUE	The rebuild was successful.

FALSE	The rebuild failed. In this case, the database is automatically closed.


dbUpdate method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short dbUpdate (short iFormat, short iBitsPerPixel, short iQuality);

Overview	Refer to Managing Images in a Database

Remarks

Updates the database, implementing changes specified with the dbAddNew method or the dbEdit method.

This method's parameters specify how the image is saved. The image field is specified in the dbOpen method.

If the bitmap is 8 bits per pixel or greater, use the LEAD CMP format or one of the JPEG (JTIF or JFIF) formats to save disk space.

If the bitmap is 1-bit per pixel, use the LEAD 1-bit format or a CCITT Group 3 or 4 format to save disk space.

For CCITT Group 3 and 4 formats, the first RGBQUAD structure in the bitmap's palette determines the white component of the image. If the rgbRed field is 0, then all 0 bits in the image are assumed to be black. Otherwise, all zero (0) bits in the image are assumed white.

See Also

Elements	dbAddNew method, dbEdit method, dbDelete method, dbLockingMode property

Topics	Databases: Using ODBC


iFormat Parameter For dbUpdate
iFormat

Output format. This is a file format, although it is stored in a database field. For valid values, refer to Formats of Output Files.


iBitsPerPixel Parameter For dbUpdate
iBitsPerPixel

Pixel depth of the stored image.

Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files.


iQuality Parameter For dbUpdate
iQuality

This parameter is used when saving an image file to LEAD or JPEG formats. Qfactor is a number that determines the degree of loss in the compression process.

For possible values, refer to Compression Quality Factors.


Return for dbUpdate
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DeleteBitmapListItems method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short DeleteBitmapListItems (short iIndex, short iCount);

Overview	Refer to Bitmaps and Bitmap Lists.

Remarks

Deletes the specified bitmaps from a bitmap list, and frees the bitmaps from memory.

You cannot use this method to update a bitmap list while it is being used in an animation playback.

See Also

Topics	Raster Images: Creating and Maintaining Lists of Images
Raster Images: Creating and Deleting Images


iIndex Parameter For DeleteBitmapListItems
iIndex

Index of the first bitmap to delete.


iCount Parameter For DeleteBitmapListItems
iCount

The number of bitmaps to delete.


Return for DeleteBitmapListItems
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DeleteItem method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short DeleteItem (short iIndex);

Overview	Refer to Annotation Menu

Remarks

Deletes the specified menu item

This method is associated with the AnnMenu object that is passed to the AnnMenu event.

See Also

Elements	AnnMenu event, Count property, ItemString property, ItemType property, ItemID property, ItemEnabled property, ItemChecked property, AddItem method, GetSubMenu Method

Topics	Annotations (Document/Medical only): Automation


iIndex Parameter For DeleteItem
iIndex

Index into the menu items in the AnnMenu object. This is a zero-based index.


Return for DeleteItem
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DeletePage method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short DeletePage (BSTR pszName, long lPage);

Overview	Refer to Bitmaps and Bitmap Lists.

Remarks

Deletes the specified page from a multipage file that supports delete operations.

The following file formats support delete operations:

TIFF (most TIFF formats, including JTIF, but excluding EXIF)

PCX

Winfax

See Also

Topics:	Raster Images: Creating and Deleting Images


pszName Parameter For DeletePage
pszName

Name of the file from which to delete the page.


lPage Parameter For DeletePage
lPage

Number of the page to delete. Possible values are:

Value	Meaning

-1	Delete the last page.

>= 1	Delete page iPage, where 1 is the first page, 2 is the second page, etc.  The page indicated by iPage must exist, or an error will be returned.


Return for DeletePage
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DeleteRgnHandle method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL DeleteRgnHandle (OLE_HANDLE hRgn);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Deletes a stored region and frees the memory that was required for it.

To store a region, use either of the following methods:

 GetFloaterHandle method

 GetRgnHandle method

Keep in mind that the region data contains only positioning information, not the bitmap's pixel values.

See Also

Elements	GetFloaterHandle method, GetRgnHandle method, FreeRgn method, SetRgnHandle method

Topics	Raster Images: Creating and Using a Region


hRgn Parameter For DeleteRgnHandle
hRgn

Handle to the stored region. The handle is returned by the method that stores the region.


Return for DeleteRgnHandle
Return Value

Value	Meaning

TRUE	The stored region was successfully deleted.

FALSE	The deletion failed.


DeleteSegment method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short DeleteSegment (long nSegId);

Overview	Refer to Working with MRC Bitmap.

Remarks

Deletes a specific segment from the control. This method is valid with the auto and manual segmentation process.

In the manual segmentation process, segment IDs are returned by the SetStripeSegment method.

In the auto segmentation process the user may call the EnumSegments method to get the segment information and their IDs.

See Also

Elements	SetStripeSegment method, EnumSegments method, UpdateSegmentData method, SetNewStripe method

Topics	MRC Bitmap Functions: Manipulating Segments


nSegId Parameter For DeleteSegment (Mixed Raster Content Control)
nSegId

Target segment identifier to be deleted


Return for DeleteSegment
Return Value

Value	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Deskew method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Deskew (OLE_COLOR crBack, long lFlags);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Document/Medical  only) Rotates the bitmap to straighten it. This method typically is used to automatically straighten scanned images.

The calculated rotation is limited to 10 degrees in either direction. This method is intended for images, such as scanned documents, that are mainly horizontal lines of text. The results are unpredictable with other types of images.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Topics	Raster Images: Doing Geometric Transformations


crBack Parameter For Deskew
crBack

The background fill color.

If the image is 8 bits per pixel or less, the color comes from the current palette, and it may not exactly match the specified color.

You can specify a COLORREF value (the return value of the RGB macro), or you can specify a palette index as explained in Using Palette Indexes As Color ValuesPalColor.


lFlags Parameter For Deskew
lFlags

Flags for Deskew.

0	Normal Rotate

ROTATE_RESAMPLE	[0x0002] Perform bilinear interpolation when rotating.

ROTATE_BICUBIC	[0x0004] Perform bicubic interpolation when rotating.


Return for Deskew
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error CodesErrorCodes.


Despeckle method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Despeckle ();

Overview	Refer to Removing Noise.

Remarks

(Document/Medical only) Removes speckles from the bitmap. Typically, this method is used to clean up scanned images (such as FAX images).

This method removes 1-pixel speckles, and shrinks some larger speckles. Therefore, in some cases, larger speckles can be completely removed by running it more than once.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Topics	Raster Images: Filtering Images
Raster Images: Where the Region Preempts the Bitmap


Return for Despeckle
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DisplayItemText property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL DisplayItemText

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies whether or not each Item's Text attribute is to be displayed as a label for the item.

The default setting is True.

See Also

Elements	Font property, ItemBackgroundColor property, ItemWidth property, ItemHeight property, ItemVerticalSpacing property, ItemHorizontalSpacing property, Item property

Topics	Raster Images: Displaying Images


DitherFlags property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short DitherFlags

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Indicates the dithering options that should be used when both ForceSize and MaintainAspect are True and the source image is not 24-bit.  In this case, the thumbnail image is converted to 24-bit, then, combined with a "background" bitmap.  Then, the resulting bitmap is returned to the thumbnail image's original bit-depth using this setting.

Possible values are:

Setting	Description

CRD_NODITHERING	Use nearest color matching.

CRD_FLOYDSTEINDITHERING	Use Floyd-Steinberg dithering.

CRD_STUCKIDITHERING	Use Stucki dithering.

CRD_BURKESDITHERING	Use Burkes dithering.

CRD_SIERRADITHERING	Use Sierra dithering.

CRD_STEVENSONARCEDITHERING	Use Stevenson Arce dithering.

CRD_JARVISDITHERING	Use Jarvis dithering.

CRD_ORDEREDDITHERING	Use ordered dithering, which is faster but less accurate than other dithering methods.

CRD_CLUSTEREDDITHERING	Use clustered dithering.

See Also

Elements	BrowseDir method, PaletteFlags property, InfoBits property, ThumbnailBitsPerPixel property, ForceSize property, MaintainAspect property, ColorRes method (Main Control)

Topics	Raster Images: Using the Thumbnail Browser


DocCleanBitmap property (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	OLE_HANDLE DocCleanBitmap

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) LEAD bitmap that also contains a region that has the elements removed by one of the Document Cleanup methods listed below.

This property is updated only if XXX_SINGLE_REGION | XXX_LEAD_REGION is set in the uFlags parameter of one of the following methods:

BorderRemove method

DotRemove method

HolePunchRemove method

InvertedText method

LineRemove method

Smooth method

Set this property to 0 at any time to free the resources associated with it.

The purpose of this property is to copy this bitmap to another Main control in order to access the region information.

NOTE: This property should not be used in conjunction with the RefBitmap property (i.e. RefBitmap = TRUE).  Also, this property should only be used with the Main Control.

See Also

Elements:	hDocCleanRgn property

Topics:	Raster Images: Cleaning - up 1-Bit Images


DocCleanSuccess property (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	long DocCleanSuccess

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) Indicates the status or behavior of the one of the Document Cleanup events listed below.

Set this property during the following events:

BorderRemoveEvent event

DotRemoveEvent event

HolePunchRemoveEvent event

InvertedTextEvent event

LineRemoveEvent event

SmoothEvent event

Possible values are:

Value	Meaning

0	Abort the process.

SUCCESS_REMOVE	Remove the object (dot, line, inverted text, border, etc.).

SUCCESS_NOREMOVE	Do not remove the object (dot, line, inverted text, border, etc.).

See Also

Elements:	SmoothEvent event, InvertedTextEvent event, LineRemoveEvent event, DotRemoveEvent event, BorderRemoveEvent event, HolePunchRemoveEvent event

Topics:	Raster Images: Cleaning - up 1-Bit Images


DotRemove event (Main Control)
DotRemoveEvent event (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	void DotRemoveEvent (OLE_HANDLE hRgn, float fBoundingRectLeft, float fBoundingRectTop, float fBoundingRectWidth, float fBoundingRectHeight, long iWhiteCount, long iBlackCount);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) This event is triggered once for each dot, speck, or blob that is detected Set the DocCleanSuccess property to SUCCESS_REMOVE to have the dot removed. Set the DocCleanSuccess property to SUCCESS_NOREMOVE to leave the dot unchanged. Set the DocCleanSuccess property to 0 to abort. If the uFlags parameter of the BorderRemove method is set to DOT_IMAGE_UNCHANGED | DOT_SINGLE_REGION, then the value of the DocCleanSuccess property affects only the internal single region that contains all the changes.

Note: hRgn is only valid during this event. To use the hRgn after the event has terminated, make a copy of it using the SetBitmapRgnHandle method.

See Also

Elements:	DotRemove method

Topics:	Raster Images: Cleaning - up 1-Bit Images


hRgn Parameter For DotRemove
hRgn

Windows region representing the dot to be removed.


fBoundingRectLeft Parameter For DotRemove
fBoundingRectLeft

X coordinate of the origin of the bounding rectangle of the dot being processed.


fBoundingRectTop Parameter For DotRemove
fBoundingRectTop

Y coordinate of the origin of the bounding rectangle of the dot being processed.


fBoundingRectWidth Parameter For DotRemove
fBoundingRectWidth

Width of the bounding rectangle of the dot being processed.


fBoundingRectHeight Parameter For DotRemove
fBoundingRectHeight

Height of the bounding rectangle of the dot being processed.


iWhiteCount Parameter For DotRemove
iWhiteCount

Total number of white pixels in the dot being processed.


iBlackCount Parameter For DotRemove
iBlackCount

Total number of black pixels in the dot being processed.


DotRemove method (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	short DotRemove (long uFlags, long iMinDotWidth, long iMinDotHeight, long iMaxDotWidth, long iMaxDotHeight);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) This method finds and removes dots, specks, and blobs of various sizes in 1-bit documents. The dots, specks, and blobs may or may not be all black.

This method works only on 1-bit black and white images.

If a region is selected, only the selected region will be changed by this method.  If no region is selected, the whole image will be processed.

The behavior of this method can be modified by using the DotRemoveEvent event.

This method triggers both the DotRemoveEvent event and the ProgressStatus event.

See Also

Elements:	DotRemoveEvent event

Topics:	Raster Images: Cleaning - up 1-Bit Images


uFlags Parameter For DotRemove
uFlags

Flags that determine the behavior of the dot removal process. Flags may be combined using a bitwise OR. Possible values are:

Value	Meaning

DOT_SINGLE_REGION:	For each dot found by the DotRemove method, if the DocCleanSuccess property is set to SUCCESS_REMOVE in the DotRemoveEvent event, the removed dot is added to an internal single region. If the DocCleanSuccess property is set to SUCCESS_NOREMOVE, the dot is not added to the single region. When the DotRemove method returns, either the DocCleanBitmap property or the hDocCleanRgn property will reference a region that contains all the removed dots. If DOT_LEAD_REGION is also set, the DocCleanBitmap property will be set to a bitmap that has a LEAD region that contains all the removed dots. If DOT_LEAD_REGION is not set, hDocCleanRgn is set to a Windows region that contains all the removed borders. When the region (either LEAD or Windows) is no longer needed, it must be destroyed.

DOT_LEAD_REGION	When the DotRemove method returns, the DocCleanBitmap property is updated with a bitmap that also contains a region with all the removed dots. This flag must be used in conjunction with DOT_SINGLE_REGION. To use this flag set uFlags to DOT_SINGLE_REGION | DOT_LEAD_REGION. The DocCleanBitmap property will be updated when the DotRemove method returns.

DOT_IMAGE_UNCHANGED	The original image is unchanged.

DOT_USE_DPI	The unit of measure for all parameters of this method is thousandths of an inch. Use the image's DPI to convert to pixels. This allows the processing of many images with different DPI. If this flag is not set, the unit of measure is pixels.

DOT_CALLBACK_REGION	The DotRemoveEvent event receives a Windows region that contains the current dot to be removed. Setting this flag lets the user create his or her own composite of removed dots by combining the regions received by the event, if the DocCleanSuccess property was set to SUCCESS_REMOVE in the event. The regions can be combined using a logical OR operator. Combining all regions received by the event, that are removed, results in a region identical to the region created when DOT_SINGLE_REGION is set in uFlags.

DOT_USE_SIZE	Use the iMinDotWidth, iMinDotHeight, iMaxDotWidth, iMaxDotHeight parameters to indicate the size of the dots to remove. If this flag is not set, default values for the four sizes will be used. These defaults are as follows: iMinDotWidth = 1, iMinDotHeight = 1, iMaxDotWidth = 2 and iMaxDotHeight = 2.

DOT_USE_DIAGONALS	Considers pixels that are diagonal as part of the dot.  Consider the "speck" below consisting of nine pixels.

If DOT_USE_DIAGONALS is used, this speck is considered a single dot that is 5x5 pixels.  If DOT_USE_DIAGONALS is not used, the speck is considered three dots (2x2, 1x1, 2x2).


iMinDotWidth Parameter For DotRemove
iMinDotWidth

The minimum width of a dot to be removed. If DOT_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.


iMinDotHeight Parameter For DotRemove
iMinDotHeight

The minimum height of a dot to be removed. If DOT_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.


iMaxDotWidth Parameter For DotRemove
iMaxDotWidth

The maximum width of a dot to be removed. If DOT_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.


iMaxDotHeight Parameter For DotRemove
iMaxDotHeight

The maximum height of a dot to be removed. If DOT_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.


Return for DotRemove
Return Value

Value	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DrawEllipse method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short DrawEllipse (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Drawing Simple Objects.

Remarks

Draws an ellipse on the screen or on the bitmap. The DrawPersistence property determines whether the object is drawn on the screen or the bitmap.

Whether you draw to the screen or to the bitmap, drawing objects are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


fLeft Parameter For DrawEllipse
fLeft

The X coordinate of the origin of the bounding rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fTop Parameter For DrawEllipse
fTop

The Y coordinate of the origin of the bounding rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For DrawEllipse
fWidth

The width of the ellipse in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For DrawEllipse
fHeight

The height of the rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


Return for DrawEllipse
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DoubleBuffer property (Main Control)

Visual Basic example	Visual C++ example
Syntax	VARIANT_BOOL DoubleBuffer
Overview	Refer to Displaying an Image.
Remarks

(Document/Medical only) (Persistent property, available at design time) Gets or sets a value that enables or disables double buffered image display in the control.  Use this to avoid flicker when the control repaints invalidated areas. Possible values are:

Value	Meaning

TRUE	Enable double buffering

FALSE	Disable double buffering

This is especially useful when displaying annotations on the image.  Without enabling double buffered painting, the image is painted first, and then the annotations are rendered.  This can cause flicker, and, it allows the portion under the annotation objects, for example a Redact object, to be visible.

See Also

Elements:	BackErase property, AutoRepaint property , ForceRepaint method, EnablePaint property, RepaintRect method, PaintRgnOnly property
Topics:	Raster Images: Displaying Images  Implementing Annotations


DrawFillColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR DrawFillColor

Overview	Refer to Drawing Simple Objects.

Remarks

(Persistent property, available at design time) Specifies the interior color of a drawing object.

You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes As Color Values.

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


DrawFillStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short DrawFillStyle

Overview	Refer to Drawing Simple Objects.

Remarks

(Persistent property, available at design time) Specifies the fill pattern of a drawing object.

Value	Meaning

DRAWFILLSTYLE_SOLID	Solid color

DRAWFILLSTYLE_TRANSPARENT	Transparent

DRAWFILLSTYLE_HORIZONTAL_LINE	Horizontal lines

DRAWFILLSTYLE_VERTICAL_LINE	Vertical lines

DRAWFILLSTYLE_UPWARD_DIAGONAL	Upward diagonal lines

DRAWFILLSTYLE_DOWNWARD_DIAGONAL	Downward diagonal lines

DRAWFILLSTYLE_CROSS	Straight cross-hatch

DRAWFILLSTYLE_DIAGONAL_CROSS	Diagonal cross-hatch

DRAWFILLSTYLE_DIAGONAL_LAST	Last value (for testing a loop counter)

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


DrawFontColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR DrawFontColor

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the color of any text that you draw using the DrawText method.

You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes As Color Values.

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


DrawLine method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short DrawLine (float fX1, float fY1, float fX2, float fY2);

Overview	Refer to Drawing Simple Objects.

Remarks

Draws a line on the screen or on the bitmap. The DrawPersistence property determines whether the object is drawn on the screen or the bitmap.

Whether you draw to the screen or to the bitmap, drawing objects are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


fX1 parameter for DrawLine
fX1

The X coordinate of the beginning point of the line in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fY1 parameter for DrawLine
fY1

The Y coordinate of the beginning point of the line in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fX2 parameter for DrawLine
fX2

The X coordinate of the ending point of the line in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fY2 parameter for DrawLine
fY2

The Y coordinate of the ending point of the line in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


Return for DrawLine
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DrawMode property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short DrawMode

Overview	Refer to Drawing Simple Objects.

Remarks

(Persistent property, available at design time) Determines how each pixel of a drawing object is combined with the existing pixel on the target surface (the screen or bitmap, as specified by the DrawPersistence property).

For normal drawing, use DRAWMODE_COPY_PEN. The DrawPenColor property specifies the pen color. For rubberband-style interactive display, use DRAWMODE_INVERT (as shown in the code example).

Value	Description of the Resulting Pixel

DRAWMODE_BLACKNESS	Pixel is always black.

DRAWMODE_COPY_PEN	Pixel is the pen color.

DRAWMODE_MASK_NOT_PEN	Pixel is a combination of the colors common to both the target and the inverse of the pen.

DRAWMODE_MASK_PEN	Pixel is a combination of the colors common to both the pen and the target.

DRAWMODE_MASK_PEN_NOT	Pixel is a combination of the colors common to both the pen and the inverse of the target.

DRAWMODE_MERGE_NOT_PEN	Pixel is a combination of the target color and the inverse of the pen color.

DRAWMODE_MERGE_PEN	Pixel is a combination of the pen color and the target color.

DRAWMODE_MERGE_PEN_NOT	Pixel is a combination of the pen color and the inverse of the target color.

DRAWMODE_NOP	Pixel remains unchanged.

DRAWMODE_INVERT	Pixel is the inverse of the target color.

DRAWMODE_NOT_COPY_PEN	Pixel is the inverse of the pen color.

DRAWMODE_NOT_MASK_PEN	Pixel is the inverse of the DRAWMODE_MASK_PEN color.

DRAWMODE_NOT_MERGE_PEN	Pixel is the inverse of the DRAWMODE_MERGE_PEN color.

DRAWMODE_NOT_XOR_PEN	Pixel is the inverse of the DRAWMODE_XOR_PEN color.

DRAWMODE_WHITENESS	Pixel is always white.

DRAWMODE_XOR_PEN	Pixel is a combination of the colors in the pen and in the target, but not in both.

DRAWMODE_LAST	Last value (for testing a loop counter).

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


DrawPenColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR DrawPenColor

Overview	Refer to Drawing Simple Objects.

Remarks

(Persistent property, available at design time) Specifies the line color of the drawing object.

You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes As Color Values.

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


DrawPenStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short DrawPenStyle

Overview	Refer to Drawing Simple Objects.

Remarks

(Persistent property, available at design time) Specifies the line style of the drawing object. The following are valid values:

Value	Description

DRAWPENSTYLE_SOLID	Lines are solid.

DRAWPENSTYLE_DASH	Lines are dashed. This style is valid only when the DrawPenWidth property is 1.

DRAWPENSTYLE_DOT	Lines are dotted. This style is valid only when the DrawPenWidth property is 1.

DRAWPENSTYLE_DASH_DOT	Lines alternate dashes and dots. This style is valid only when the DrawPenWidth property is 1.

DRAWPENSTYLE_DASH_DOT_DOT	Lines alternate dashes and double dots. This style is valid only when the DrawPenWidth property is 1.

DRAWPENSTYLE_TRANSPARENT	Lines are invisible.

DRAWPENSTYLE_INSIDE_SOLID	Lines are solid, and are inside the bounds of the object.

DRAWPENSTYLE_LAST	Last value (for testing a loop counter).

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


DrawPenWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short DrawPenWidth

Overview	Refer to Drawing Simple Objects.

Remarks

(Persistent property, available at design time) Specifies the width, in pixels, of the lines of a drawing object.

If the target is the screen, the measurement is in screen pixels; if the target is the bitmap, it is in bitmap pixels. Therefore, if you draw to the bitmap, and the displayed image is scaled down (the destination rectangle is smaller than the source rectangle), thin lines may not appear on the displayed image. This happens because scaling down an image causes some pixels to be thrown out. In a bitonal (black and white) image, you can overcome this problem with favor-black setting of the BitonalScaling property, which is Document/Medical only.

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


DrawPersistence property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL DrawPersistence

Overview	Refer to Drawing Simple Objects and Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Determines whether drawing objects are drawn on the screen or on the bitmap. When drawing text to the bitmap, the best quality is achieved when the image is not scaled (when PaintSizeMode = PAINTSIZEMODE_NORMAL).

Whether you draw to the screen or to the bitmap, drawing objects are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

Value	Meaning

TRUE	Draw to the bitmap.

FALSE	Draw to the screen.

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap
Examining and Altering Bitmaps


DrawRectangle method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short DrawRectangle (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Drawing Simple Objects.

Remarks

Draws a rectangle on the screen or on the bitmap. The DrawPersistence property determines whether the object is drawn on the screen or the bitmap.

Whether you draw to the screen or to the bitmap, drawing objects are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


fLeft Parameter For DrawRectangle
fLeft

The X coordinate of the origin of the rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fTop Parameter For DrawRectangle
fTop

The Y coordinate of the origin of the rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For DrawRectangle
fWidth

The width of the rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For DrawRectangle
fHeight

The height of the rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


Return for DrawRectangle
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DrawShape method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short DrawShape (short uShape, OLE_HANDLE BackgroundImage);

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

Draws the specified three-dimensional shape in the control's client area or on the current bitmap. The size, position, and other aspects of the shape are determined by related properties, as explained in Drawing Three-Dimensional Shapes and Text.

For possible values of the uShape parameter, refer to Shapes.

See Also

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


uShape Parameter For DrawShape
uShape

Constant that specifies the shape.


BackgroundImage Parameter For DrawShape
BackgroundImage

LEAD bitmap used as the background image if the ShapeBackgroundStyle property requires one. To use a background image, the PatternStyle property must not be EFX_PATTERN_SOLID. Use 0 in this parameter if no background image is required.


Return for DrawShape
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DrawText method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short DrawText (BSTR szText, OLE_HANDLE ForegroundImage);

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

Draws a text object in the control's client area or on the current bitmap. Placement and other aspects of the text object are specified by related properties described in Drawing Three-Dimensional Shapes and Text.

You can create an image that consists of a pattern or gradient color to use as a foreground of the text. Refer to Gradients and Patterns for related properties.

The bitmap that you specify is positioned at the origin of the text object's rectangle, and it is not scaled. Therefore the bitmap that you use for this purpose should be sized accordingly. In most cases it should be the same size as the rectangle.

See Also

Elements	DrawTextOut method

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


szText Parameter For DrawText
szText

Text string to be drawn.


BackgroundImage Parameter For DrawText
ForegroundImage

LEAD control's bitmap to be used as the foreground of the text object (instead of the text color). Pass 0 if you do not want to use a bitmap as the foreground of the text object.

The bitmap that you specify is positioned at the origin of the text object's rectangle, and it is not scaled. Therefore the bitmap that you use for this purpose should be sized accordingly. In most cases it should be the same size as the rectangle.


Return for DrawText
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DrawTextHeight method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float DrawTextHeight (BSTR pszText);

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

Returns the height of the specified text string, using the current values of the Font property.

The scale is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property. You can use this method to position the text relative to another drawing object, such as a line or rectangle.

See Also

Elements	DrawText method

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


pszText Parameter For DrawTextHeight
pszText

Text string to be evaluated.


Return for DrawTextHeight
Return Value

Height of the specified string. The unit of measure is determined by the ScaleMode property.


DrawTextOut method (Main Control)

Access 2.0 example   Other systems

Syntax	short DrawTextOut (float fX, float fY, BSTR pszText);

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

Draws a text object in the control's client area or on the current bitmap. Use this method instead of DrawText in Access 2.0, which has limited support for text objects.

The DrawTextOut method recognizes only the following related text-object properties:

DrawPersistence property

Font property

DrawFontColor property

The DrawPersistence property determines whether the object is drawn on the screen or the bitmap. Whether you draw on the screen or the bitmap, the text is always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

See Also

Elements	DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


fX Parameter For DrawTextOut
fX

The X coordinate of the origin of the text object in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fY Parameter For DrawTextOut
fY

The Y coordinate of the origin of the text object in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


pszText Parameter For DrawTextOut
pszText

The text string to draw.


Return for DrawTextOut
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


DrawTextWidth method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float DrawTextWidth (BSTR pszText);

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

Returns the width of the specified text string, using the current values of the Font property.

The scale is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property. You can use this method to position the text relative to another drawing object, such as a line or rectangle.

See Also

Elements	DrawText method

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


pszText Parameter For DrawTextWidth
pszText

Text string to be evaluated.


Return for DrawTextWidth
Return Value

Width of the specified string. The unit of measure is determined by the ScaleMode property.


DriverName property (ISIS Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	BSTR DriverName

Overview	Using ISIS to Scan Images

Remarks

(Document/Medical)  Contains the string representing the currently selected driver.  It is filled by the ISISSelect method.  Set this property to change the default driver.

See Also

Elements	ISISSelect method

Topics	Raster Images: Scanning Images using ISIS


DstClipHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float DstClipHeight

Overview	Refer to Displaying an Image.

Remarks

The height of the destination clipping rectangle used when painting.

The initial value is the height of the bitmap. You can set this property or use the SetDstClipRect method to change the value. The position of the clipping rectangle is relative to the Main Control. The unit of measure is determined by the ScaleMode property.

See Also

Elements	DstClipLeft property, DstClipTop property, DstClipWidth property

Topics	Raster Images: Displaying Images


DstClipLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float DstClipLeft

Overview	Refer to Displaying an Image.

Remarks

The X coordinate of the origin of the destination clipping rectangle used when painting.

The initial value is 0. You can set this property or use the SetDstClipRect method to change the value. The position of the clipping rectangle is relative to the Main Control. The unit of measure is determined by the ScaleMode property.

See Also

Elements	DstClipHeight property, DstClipTop property, DstClipWidth property

Topics	Raster Images: Displaying Images


DstClipTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float DstClipTop

Overview	Refer to Displaying an Image.

Remarks

The Y coordinate of the origin of the destination clipping rectangle used when painting.

The initial value is 0. You can set this property or use the SetDstClipRect method to change the value. The position of the clipping rectangle is relative to the Main Control. The unit of measure is determined by the ScaleMode property.

See Also

Elements	DstClipHeight property, DstClipLeft property, DstClipWidth property

Topics	Raster Images: Displaying Images


DstClipWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float DstClipWidth

Overview	Refer to Displaying an Image.

Remarks

The width of the destination clipping rectangle used when painting.

The initial value is the width of the bitmap. You can set this property or use the SetDstClipRect method to change the value. The position of the clipping rectangle is relative to the Main Control. The unit of measure is determined by the ScaleMode property.

See Also

Elements	DstClipHeight property, DstClipLeft property, DstClipTop property

Topics	Raster Images: Displaying Images


DstHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float DstHeight

Overview	Refer to Displaying an Image.

Remarks

The height of the destination rectangle used when painting.

The initial value is the height of the bitmap. You can set this property or use the SetDstRect method to change the value. The position of the rectangle is relative to the Main Control. The unit of measure is determined by the ScaleMode property.

Because of a Windows limitation, destination rectangle measurements, when converted to pixels, cannot exceed the maximum value of an integer. On WIN32 systems, this is rarely a problem. LEADTOOLS returns an ERROR_INV_RANGE error if the problem occurs. An alternative for scaling large images is to make the source rectangle smaller, using the SetSrcRect method.

See Also

Elements	DstLeft property, DstTop property, DstWidth property

Topics	Raster Images: Displaying Images


DstLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float DstLeft

Overview	Refer to Displaying an Image.

Remarks

The X coordinate of the origin of the destination rectangle used when painting.

The initial value is 0. You can set this property or use the SetDstRect method to change the value. The position of the rectangle is relative to the Main Control. The unit of measure is determined by the ScaleMode property.

The AutoScroll property must be FALSE before setting DstLeft or DstTop.

See Also

Elements	DstHeight property, DstTop property, DstWidth property

Topics	Raster Images: Displaying Images


DstTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float DstTop

Overview	Refer to Displaying an Image.

Remarks

The Y coordinate of the origin of the destination rectangle used when painting.

The initial value is 0. You can set this property or use the SetDstRect method to change the value. The position of the rectangle is relative to the Main Control. The unit of measure is determined by the ScaleMode property.

The AutoScroll property must be FALSE before setting DstLeft or DstTop.

See Also

Elements	DstHeight property, DstLeft property, DstWidth property

Topics	Raster Images: Displaying Images


DstWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float DstWidth

Overview	Refer to Displaying an Image.

Remarks

The width of the destination rectangle used when painting.

The initial value is the width of the bitmap. You can set this property or use the SetDstRect method to change the value. The position of the rectangle is relative to the Main Control. The unit of measure is determined by the ScaleMode property.

Because of a Windows limitation, destination rectangle measurements, when converted to pixels, cannot exceed the maximum value of an integer. On WIN32 systems, this is rarely a problem. LEADTOOLS returns an ERROR_INV_RANGE error if the problem occurs. An alternative for scaling large images is to make the source rectangle smaller, using the SetSrcRect method.

See Also

Elements	DstHeight property, DstLeft property, DstTop property

Topics	Raster Images: Displaying Images


EdgeDetector method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short EdgeDetector(short iThreshold, short iFilter);

Overview	Refer to Detecting and Enhancing Edges and Lines.

Remarks

(Document only) Applies the specified edge filter to the bitmap.

Filters such as Sobel filter, Prewitt filter, Laplacian filter, and Gradient filter are used to determine the pixels belonging to edges in the bitmap.

This method can process the whole image or a region of the image.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

The threshold range for the 16, 48, and 64-bit bitmaps is from 0 to 65535 and for 12-bit bitmaps from 0 to 4095. Otherwise, it is from 0 to 255. The threshold is applied on channels separately.

See Also

Elements	Combine method, IntensityDetect method, Sharpen method, SpatialFilter method

Topics	Raster Images: Filtering Images


iThreshold Parameter For EdgeDetector
iThreshold

Threshold value used to determine which pixels are edge pixels. If the difference determined for a pixel is greater than this value, the pixel is an edge pixel.


iFilter Parameter For EdgeDetector
iFilter

Flag that indicates which edge detection filter to apply.  Possible values are:

Value	Meaning

EDG_SOBEL_VERT	[0x0101] Detect the vertical edges.

EDG_SOBEL_HORZ	[0x0102] Detect the horizontal edges.

EDG_SOBEL_ALL	[0x0103] Detect horizontal & vertical edges.

EDG_PREWITT_VERT	[0x0201] Detect the vertical edges.

EDG_PREWITT_HORZ	[0x0202] Detect the horizontal edges.

EDG_PREWITT_ALL	[0x0203] Detect horizontal & vertical edges.

EDG_LAPLACE_1	[0x0301] Detect vertical & horizontal edges.

EDG_LAPLACE_2	[0x0302] Detect general edges.

EDG_LAPLACE_3	[0x0303] Detect general edges. (The filter used for this option is different than the filter used for the EDG_LAPLACE_2 filter.).

EDG_LAPLACE_DIAG	[0x0304] Detect the diagonal edges.

EDG_LAPLACE_HORZ	[0x0305] Detect the horizontal edges.

EDG_LAPLACE_VERT	[0x0306] Detect the vertical edges.

EDG_GRADIENT_N	[0x0401] Detect north edges.

EDG_GRADIENT_NE	[0x0402] Detect north east edges.

EDG_GRADIENT_E	[0x0403] Detect east edges.

EDG_GRADIENT_SE	[0x0404] Detect south east edges.

EDG_GRADIENT_S	[0x0405] Detect south edges.

EDG_GRADIENT_SW	[0x0406] Detect south west edges.

EDG_GRADIENT_W	[0x0407] Detect west edges.

EDG_GRADIENT_NW	[0x0408] Detect north west edges.


Return for EdgeDetector
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


EffectDelay property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short EffectDelay

Overview	Refer to Using Special Effects When Painting.

Remarks

(Persistent property, available at design time) Delay between graining steps, in milliseconds.

This property affects both paint effects (specified by the PaintEffect property) and transition effects (specified by the TransitionEffect property).

Use the EffectGrain and EffectDelay properties to control the speed of the display. EffectGrain controls the size of the painting increment, and EffectDelay controls the time between increments.

See Also

Elements	PaintEffect property, TransitionEffect property

Topics	Raster Images: Implementing Special Effects


EffectGrain property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short EffectGrain

Overview	Refer to Using Special Effects When Painting.

Remarks

(Persistent property, available at design time) Graining size. This is the smallest size (pixel width or height) to be updated when painting an effect. Using a small grain makes the painting smoother, but takes longer to paint. Using a large grain makes the painting more coarse, but paints faster. Valid values are 1 to 256.

This property affects both paint effects (specified by the PaintEffect property) and transition effects (specified by the TransitionEffect property).

Use the EffectGrain and EffectDelay properties to control the speed of the display. EffectGrain controls the size of the painting increment, and EffectDelay controls the time between increments.

See Also

Elements	PaintEffect property, TransitionEffect property

Topics	Raster Images: Implementing Special Effects


Emboss method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Emboss (short iDirection, short iDepth);

Overview	Refer to Applying Artistic Effects.

Remarks

Applies an emboss effect to the bitmap, letting you specify the depth and direction of the effect.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	GetEmboss method

Topics	Raster Images: Filtering Images
Raster Images: Where the Region Preempts the Bitmap


iDirection Parameter For Emboss
iDirection

The direction of the apparent light source. Valid values are:

EMBOSS_N
EMBOSS_NE
EMBOSS_E
EMBOSS_SE
EMBOSS_S
EMBOSS_SW
EMBOSS_W
EMBOSS_NW


iDepth Parameter For Emboss
iDepth

The apparent depth of this three-dimensional effect. Valid values are 0 to 1000, with 500 as normal.


Return for Emboss
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Enabled property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL Enabled

Overview	Refer to Miscellaneous Methods and Properties.

Remarks

Enables the Main Control.

The setting takes effect at run time.

Setting	Description

TRUE	Allows the control to respond to events.

FALSE	Prevents the control from responding to events.

See Also

Topics	Working with the Control: General Behavior


EnableFastRender property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL EnableFastRender

Overview	Refer to Printing an Image.

Remarks

Gets or sets a value that indicates whether "Fast Printing" is enabled or disabled. Fast printing allows the OCX to print the bitmap without any preprocessing, thus speeding up the printing process. Possible values are:

Value	Meaning

TRUE	Enables Fast Printing.

FALSE	Disables Fast Printing.

See Also

Elements	Render method

Topics	Raster Images: Printing Images


EnableFilePageLoadedEvent property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL EnableFilePageLoadedEvent

Overview	Loading a Bitmap from a File

Remarks

Specifies whether LEADTOOLS generates a FilePageLoaded event, which is fired after each page of a multi-page file, is loaded.

If EnableFilePageLoadedEvent is TRUE, the FilePageLoaded event is can be used to store or get information about each page of a multi-page file, as it is loaded. Possible values are:

Value	Meaning

TRUE	Generate FilePageLoaded events.

FALSE	Do not generate FilePageLoaded events.

See Also

Elements	FilePageLoaded event, FilePage event

Topics	Raster Images: Loading Files
Controlling Events


EnableISISEvent property (ISIS Control)

Visual Basic example   Visual C++ 4.0 example
 Visual J++ example

Syntax	BOOL EnableISISEvent

Overview	Using ISIS to Scan Images

Remarks

(Document/Medical)  Indicates whether to enable the ISISPage event.  If EnableISISEvent is TRUE, ISISPage event is enabled for multipage scanning.  If it is FALSE, ISISPage event is disabled for multipage scanning.

Set EnableISISEvent property to FALSE in the ISISPage event to cancel multipage scanning.

See Also

Elements	ISISPage event, ISISAcquireMulti method, PagesDiscarded property

Topics	Raster Images: Scanning Images using ISIS


EnableKeyboard property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL EnableKeyboard

Overview	Refer to Using the Image List Control.

Remarks

(persistent property, available at design time) Enables or disables the ImageList control's automatic processing of the keyboard.

Setting	Meaning

TRUE	ImageList Control will process the keyboard

FALSE	ImageList Control will not process the keyboard

When automatic keyboard processing is enabled, the ImageList Control will process the following keys:

Key	Event
PageUp Up Arrow Left Arrow	scroll up/left one item (depends on scroll style)
PageDown Down Arrow Right Arrow	scroll down/right one item (depends on scroll style)
Ctrl + PageUp Ctrl + Up Ctlr + Left Home	scroll up/left to beginning of list (depends on scroll style)
Ctrl + PageDown Ctrl + Down Ctlr + Right End	scroll up/left to end of list (depends on scroll style)

Note: If the setting for AllowSelection is not ALLOWSELECTION_NONE, then the selected item will move up, down, left, or right, depending on the key(s) being processed.  If AllowSelection is set to ALLOWSELECTION_MULTI, multiple items can be selected using the CTRL and/or SHIFT keys in conjunction with the keys listed above.

The default setting is True.

See Also

Elements	ScrollStyle property, AllowSelection property

Topics	Raster Images: Displaying Images


EnableKeyboard property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL EnableKeyboard

Overview	Refer to Displaying an Image.

Remarks

(persistent property, available at design time) Enables or disables the Main control's automatic processing of the arrow and page-up/page-down keys as scroll messages, when an image is displayed larger than the control. In order to enable automatic keyboard processing, the EnableKeyboard property, the AutoScroll property and the EnableScroll property must all be set to True. Possible values for the EnableKeyboard property are:

Setting	Meaning

TRUE	Process the keys and scroll the image. (Default)

FALSE	Ignore the keys.

When automatic keyboard processing is enabled, the Main Control will process the following keys:

Key	Event
PageUp Up Arrow Left Arrow	scroll up/left one item (depends on scroll style)
PageDown Down Arrow Right Arrow	scroll down/right one item (depends on scroll style)
See Also

Elements	EnableScroll property, AutoScroll property

Topics	Raster Images: Displaying Images


EnableMagGlassEvent property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL EnableMagGlassEvent;

Overview	Refer to Using the Magnifying Glass

Remarks

(Persistent property, available at design time) enables the use of the MagGlass event. Possible values are:

Value	Meaning

TRUE	[0x0001] Enable the use of the MagGlass event.

FALSE	[0x0002] Disable the use of the MagGlass event.

After calling the StartMagGlass method, LEADTOOLS will monitor the window's messages, looking for mouse messages, and processing them by displaying a "Magnifying Glass". If the MagGlass event has been enabled by setting the EnableMagGlassEvent property to TRUE, information about the non-updated parts of the bitmap used for the Magnifying Glass's zoomed area can be obtained from the MagGlass event.  This event receives information when the left mouse button is pressed or released and when the mouse is moved while the left mouse button is pressed. This information can be used to get updated color information and pass that information to the UpdateMagGlass method.

If the MagGlass event has been enabled by setting the EnableMagGlassEvent property to TRUE, the UpdateMagGlass method must be called in order to paint the zoomed image in the Magnifying Glass display area.

To stop the generation of MagGlass events, set this property to FALSE.

See Also

Elements	MagGlass event,  StartMagGlass method, StopMagGlass method, UpdateMagGlass method

Topics:	Raster Images: Displaying Images


EnableMethodErrors property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL EnableMethodErrors

Overview	Refer to Using the ImageList Control

Remarks

Specifies whether LEADTOOLS generates runtime exceptions (in addition to method return values).  If EnableMethodErrors is TRUE, the runtime exceptions will be generated.  If FALSE, they will not be generated.

See Also

Topics	Raster Images: Displaying Images


EnableOLEDragMethod property (ImageList Control)

Visual Basic example	Visual C++ example
Syntax	bool EnableOLEDragMethod;
Overview	Refer to Drag and Drop.
Remarks

(Persistent property, available at design time) Enables or disables the OLE drag and drop operation in the ImageList Control. Possible values are:

Setting	Description
TRUE	Enables drag-and-drop operation.
FALSE	Disables drag-and-drop operation.
If EnableOLEDragMethod is TRUE:

 an OLEStartDrag event will occur when the drag process begins,

 an OLEDragOver event will occur repeatedly while the image is being dragged over the ImageList control, and

 an OLECompleteDrag event will occur when the dragging process is over and the image is dropped.

In addition, an OLEGiveFeedback event will be fired repeatedly while the image is being dragged over the ImageList control to determine the visual feedback for the drag-and-drop operation.

The drag-and-drop operation will paste the selected image to another ImageList control.

Note:	Set this property to FALSE before closing the window or the operating system may not release the window.
See Also

Elements	OLEDragCursor property, OLEStartDrag event, OLECompleteDrag event, OLEDragOver event, OLEGiveFeedback event, EnableUseDefaultCursor property
Topics	Raster Images: Copying Images


EnableUseDefaultCursor property (ImageList Control)

Visual Basic example	Visual C++ example
Syntax	bool EnableUseDefaultCursor;
Overview	Refer to Drag and Drop.
Remarks

(Persistent property, available at design time) Gets or sets a value that indicates whether to use the default cursor in the OLE drag and drop operation in the ImageList Control. Possible values are:

Setting	Description
TRUE	Use the default Drag and Drop cursor.
FALSE	Use the custom cursor specified in the OLEDragCursor property.
See Also

Elements	OLEDragCursor property, OLEStartDrag event, OLECompleteDrag event, OLEDragOver event, OLEGiveFeedback event, EnableUseDefaultCursor property
Topics	Raster Images: Copying Images


EnableMethodErrors property (ISIS Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	BOOL EnableMethodErrors

Overview	Refer to Using ISIS to Scan Images

Remarks

(Document/Medical)  Specifies whether LEADTOOLS generates runtime exceptions (in addition to method return values).  If EnableMethodErrors is TRUE, the runtime exceptions will be generated.  If FALSE, they will not be generated.

See Also

Elements	ISISAcquireMulti method, ISISAcquire method, ISISSelect method,
ISISGetTag method, ISISSetTag method, ISISLoadDriver method, ISISUnloadDriver method


EnableMethodErrors property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL EnableMethodErrors

Overview	Refer to Controlling Events.

Remarks

(Persistent property, available at design time) Specifies whether LEADTOOLS generates system error events (in addition to error return codes).

Setting	Description

TRUE 	Generate system error events.

FALSE	Do not generate system error events.

See Also

Topics	Working with the Control: General Behavior


EnableMethodErrors property (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	VARIANT_BOOL EnableMethodErrors

Overview	Refer to Working with MRC Bitmap.

Remarks

(persistent property, available at design time) Specifies whether LEADTOOLS generates runtime exceptions (in addition to method return values). If EnableMethodErrors is set to TRUE, the runtime exceptions will be generated. If it is set to FALSE, they will not be generated.

See Also

Elements	Load method, Save method, SaveT44 method, GetPagesCount method, EnumSegments method, AutoSegment method

Topics	MRC Bitmap Functions: Auxiliary Elements


EnableMethodErrors property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL EnableMethodErrors property

Overview	Refer to Using the OLE DB Control.

Remarks

(Persistent property, available at design time) Specifies whether LEADTOOLS generates system error events (in addition to error return codes). Possible values are:

Setting	Description

TRUE 	Generate system error events.

FALSE	Do not generate system error events.

See Also

Topics:	Databases: OLE DB, Using a Visual Basic Data Control


EnableMethodErrors property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL EnableMethodErrors

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Specifies whether LEADTOOLS generates runtime exceptions (in addition to method return values).  If EnableMethodErrors is TRUE, the runtime exceptions will be generated.  If FALSE, they will not be generated.

See Also

Elements	ContinueBrowse property, StopOnError property

Topics	Raster Images: Using the Thumbnail Browser


EnumSegments event (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void EnumSegments (long nSegId, long SegmentLeft, long SegmentTop, long SegmentRight, long SegmentBottom, MRCSegmentTypeConstants SegType, long TextForeColor, long TextBackColor);

Overview	Refer to Working with MRC Bitmap.

Remarks

Triggered during the enumeration process for either automatically generated or manually generated segments.

The AutoSegment event is fired once for each segment in all stripes.

See Also

Elements	EnumSegments method

Topics	MRC Bitmap Functions: Manipulating Segments


nSegId Parameter For EnumSegments (Mixed Raster Content Control)
nSegId

Segment Identifier


SegmentLeft Parameter For EnumSegments (Mixed Raster Content Control)
SegmentLeft

Left segment boundary from the original bitmap.


SegmentTop Parameter For EnumSegments (Mixed Raster Content Control)
SegmentTop

Top segment boundary from the original bitmap.


SegmentRight Parameter For EnumSegments (Mixed Raster Content Control)
SegmentRight

Right segment boundary from the original bitmap.


SegmentBottom Parameter For EnumSegments (Mixed Raster Content Control)
SegmentBottom

Bottom segment boundary from the original bitmap.


SegType Parameter For EnumSegments (Mixed Raster Content Control)
SegType

Flag that indicates the type of segment.  Possible values are:

Value	Meaning

SEGMENT_TEXT	[0x01] Segment type is text.

SEGMENT_PICTURE	[0x02] Segment type is picture.


TextForeColor Parameter For EnumSegments (Mixed Raster Content Control)
TextForeColor

Foreground color for the segment.  This parameter is only valid if SegType is SEGMENT_TEXT.


TextBackColor Parameter For EnumSegments (Mixed Raster Content Control)
TextBackColor

Background base color.  This parameter is only valid if SegType is SEGMENT_TEXT.


EnumSegments method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short EnumSegments ();

Overview	Refer to Working with MRC Bitmap.

Remarks

Enumerates the segments created by automatic and manual segmentation.

See Also

Elements	EnumSegments event, AutoSegment method

Topics	MRC Bitmap Functions: Manipulating Segments


ExpandMultipage property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL ExpandMultipage

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Flag indicating whether or not to expand multipage files.  If True, each page from a multipage file will be loaded.

If this property is set to True, the control will expand any multipage files it finds, and generate thumbnails for each page.

This defaults to False.

See Also

Elements	BrowseDir method

Topics	Raster Images: Using the Thumbnail Browser


EnableMouseWheel property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	VARIANT_BOOL EnableMouseWheel

Overview	Refer to Detecting Events.

Remarks

Gets or sets a value that indicates whether LEADTOOLS generates MouseWheel events. Possible values are:

Value	Meaning

TRUE	Generate MouseWheel events.

FALSE	Do not generate MouseWheel events.

See Also

See Also

Elements	MouseWheel event, Click event, DblClick event, MouseDown event, MouseUp event

Topics	Working with the Control: General Behavior
Working with the Control: Client Area Usage


EnableOLEDragMethod property (Main Control)

Visual Basic example	Visual C++ example
Syntax	BOOL EnableOLEDragMethod;
Overview	Refer to Drag and Drop.
Remarks

(Persistent property, available at design time) Enables or disables the OLE drag and drop operation in the Main Control. Possible values are:

Setting	Description
TRUE	Enables drag-and-drop operation.
FALSE	Disables drag-and-drop operation.
If EnableOLEDragMethod is TRUE:

 an OLEStartDrag event will occur when the drag process begins,

 an OLEDragOver event will occur repeatedly while the image is being dragged over the ImageList control, and

 an OLECompleteDrag event will occur when the dragging process is over and the image is dropped.

In addition, an OLEGiveFeedback event will be fired repeatedly while the image is being dragged over the ImageList control to determine the visual feedback for the drag-and-drop operation.

The drag-and-drop operation will paste the selected image to another ImageList control.

Note:	Set this property to FALSE before closing the window or the operating system may not release the window.
See Also

Elements	OLEDragCursor property, OLEStartDrag event, OLECompleteDrag event, OLEDragOver event, OLEGiveFeedback event, EnableUseDefaultCursor property
Topics	Raster Images: Copying Images


EnablePaint property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL EnablePaint

Overview	Refer to Displaying an Image.

Remarks

Enables or disables the painting of a window. Possible values are:

Value	Meaning

TRUE	The control will repaint when its window is invalidated.

FALSE	The control will not repaint, even if it has a bitmap and its window is invalidated.

The default value is TRUE (control will repaint its window).

Note that this should not be confused with AutoRepaint. AutoRepaint will not disable the paint when set to FALSE. When AutoRepaint is set to false, the control will not repaint automatically – it will repaint only when the window is invalidated or when you call ForceRepaint.

This can be illustrated like this:

EnablePaint = FALSE -> control will never paint its window.

EnablePaint = TRUE -> control will paint is window.

AutoRepaint = TRUE -> The control will repaint its window when:

1.	Its window is invalidated (when you move a window that covered the control.

2.	You scrolled its window (by clicking its scroll bars or using the pan window or setting AutoPan to TRUE and dragging the mouse).

3.	It detects that you changed its bitmap (you changed one or more pixels, or you called a method that changed the bitmap).

AutoRepaint = FALSE -> Control will repaint only in situation 1) or 2) from above. (In other words, it will disable its automatic repainting mechanism).

This property would be useful if you are going to change the control’s window size several times. In this case, you might want to disable the paint until you decide on the final size.

See Also

Elements:	AutoRepaint property, ForceRepaint method

Topics	Raster Images: Displaying Images


EnableProgressEvent property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL EnableProgressEvent

Overview	Refer to Controlling Events.

Remarks

(Persistent property, available at design time) Specifies whether LEADTOOLS generates a ProgressStatus event, to indicate the completion percentage of the current LEADTOOLS functionailty.

If this property is set to TRUE, you can use the ProgressStatus event to update a status bar or to detect a user interrupt.

This property can also be used to cancel a load process by setting it to FALSE during a load process.

Setting	Description

TRUE 	Generate progress status events.

FALSE	If this property is set to FALSE outside the load process, ProgressStatus events will not be generated.  If this property is set to FALSE during a load process, the load process is canceled.

See Also

Topics	Working with the Control: General Behavior


EnableProgressEvent property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL EnableProgressEvent

Overview	Refer to Controlling Events.

Remarks

(Persistent property, available at design time) Specifies whether LEADTOOLS generates a ProgressStatus event, to indicate the completion percentage of the current LEADTOOLS functionality.

If this property is set to TRUE, you can use the ProgressStatus event to update a status bar or to detect a user interrupt.

This property can also be used to cancel a load process by setting it to FALSE during a load process.

Setting	Description

TRUE 	Generate progress status events.

FALSE	If this property is set to FALSE outside the load process, ProgressStatus events will not be generated.  If this property is set to FALSE during a load process, the load process is canceled.

See Also

Topics	Working with the Control: General Behavior


EnableSaveBufferEvent property (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	BOOL EnableSaveBufferEvent

Overview	Refer to Using Memory-Resident Image Files.

Remarks

(Persistent property, available at design time) Specifies whether LEADTOOLS generates a SaveBuffer event. This event indicates to the user that the memory buffer referenced by the SaveBufferAddress property is too small to accommodate the bitmap to be saved by the SaveBuffer method. The user can reallocate memory of adequate size within the SaveBuffer event.

To abort a SaveBuffer process, set the EnableSaveBufferEvent property to FALSE in the SaveBuffer event.

This property must be set to TRUE in order to generate the SaveBuffer event.

If this property is set to TRUE, the SaveBuffer event can be used to reallocate the memory buffer to the size requested in the SaveBuffer event, and update the SaveBufferSize and SaveBufferAddress properties.

If this property is set to FALSE and the memory location referenced by the SaveBufferAddress property is not large enough to accommodate the save, the SaveBuffer method will fail.

For more information, refer to the SaveBuffer method.

Setting	Description

TRUE	Generate SaveBuffer events.

FALSE	Do not generate SaveBuffer events.

See Also

Elements	SaveBuffer method, SaveBufferSize property, SaveBufferAddress property, SaveBuffer event, LoadBuffer method

Topics	Raster Images: Saving Files
Controlling Events


EnableScroll property (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	BOOL EnableScroll

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Specifies whether LEADTOOLS will process scroll messages when an image is displayed larger than the control and the AutoScroll property has been set to True. Please note that setting this property to False will not remove the scroll bars, but will only disable the processing of the scroll messages.

Possible values are:

Value	Meaning

TRUE	Process scroll messages and scroll the image. (Default)

FALSE	Ignore scroll messages.

See Also

Elements:	EnableKeyboard property, AutoScroll property

Topics:	Raster Images: Displaying Images


EnableZoomInRect property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL EnableZoomInRect

Overview	Refer to Capturing an Image from the Screen.

Remarks

Shows or hides the ZoomIn rectangle for the ZoomIn method.  Possible values are:

Setting	Description

TRUE	Show the ZoomIn rectangle in addition to the mouse pointer.

FALSE	Show only the ZoomIn magnifying glass mouse pointer.

See Also

Elements	ZoomIn method

Topics	Raster images: Capturing a screen image


EnhanceQuality property (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	VARIANT_BOOL EnhanceQuality

Overview	Refer to Working with MRC Bitmap.

Remarks

(Persistent property, available at design time) Flag that indicates the quality to maintain in the saving process.  Possible values are:

Value	Meaning

TRUE	LEADTOOLS will enhance the quality when saving segments.

FALSE	LEADTOOLS will give quality a low priority when saving segments.

See Also

Elements	Save method, SaveT44 method

Topics	MRC Bitmap Functions: Saving a Page


EnsureVisible method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long EnsureVisible (long nIndex);

Overview	Refer to Using the ImageList Control.

Remarks

Scrolls the items in the ImageList Control such that the item specified is completely visible.

See Also

Elements	Item property, Scroll event, ScrollItems method, ScrollStyle property, Insert method

Topics	Raster Images: Displaying Images


nIndex Parameter For EnsureVisible
nIndex

0 based Index of item to ensure visibility of.


Return for EnsureVisible
Return Value

Return value is the actual number of lines scrolled to ensure visibility of the specified item.


ReadLoadResolutions method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ReadLoadResolutions (BSTR pszFile);

Overview	Refer to Implementing PhotoCD and FlashPix Features.

Remarks

Examines a FlashPix, PhotoCD, or JBIG file to determine which resolutions it contains.

A FlashPix, PhotoCD, or JBIG file can contain more than one copy of the same image, each at a different physical resolution (width and height in pixels). For PhotoCD files, the resolutions are fixed sizes, and you can use an older property (the InfoPCDRes property) to examine them. For FlashPix and JBIG files, which can contain images of various sizes, you must use this method to examine them.

This method updates an array of the available dimensions, which you can examine with the following properties:

 LoadResolutionCount property

 LoadResolutionHeight property

 LoadResolutionWidth property

To specify which physical resolution to load, use the SetLoadResolution method.

See Also

Elements	LoadResolutionCount property, LoadResolutionHeight property, LoadResolutionWidth property, PCDRes property, SetLoadResolution method, GetLoadResolution method, SaveResolutionCount property, SaveResolutionHeight property, SaveResolutionWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


pszFile Parameter For ReadLoadResolutions
pszFile

Character string containing the name of the file to examine.


Return for ReadLoadResolutions
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


FastRotate method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short FastRotate (short iAngle);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Document/Medical only) Rotates the bitmap in 90-degree increments, in a faster way than is possible with the Rotate method.

Valid rotations are +-90, +-180, +-270, or +-360. Positive values are clockwise; negative values are counterclockwise.

Please note that this is only a viewport rotation.  The "rotated" data is not saved.

See Also

Elements	Rotate method

Topics	Raster Images: Doing Geometric Transformations
Raster Images: Methods That Transform the Region and the Bitmap


iAngle Parameter For FastRotate
iAngle

Degrees of rotation. Valid values are +-90, +-180, +-270, or +-360. Positive values are clockwise; negative values are counterclockwise.


FeatherAlphaBlend method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short FeatherAlphaBlend(float fLeft, float fTop, float fWidth, float fHeight, OLE_HANDLE hBitmapSrc, float fSrcLeft, float fSrcTop, OLE_HANDLE hBitmapMask);

Overview	Refer to Combining Images.

Remarks

(DigitalPaint only) Combines image data from two bitmaps with feathering, by combining the two bitmaps with a variable opacity that depends on a fade mask. This method is only available in the DigitalPaint toolkits.

To combine two bitmaps with a fixed opacity, use the AlphaBlend method.

The FeatherAlphaBlend method achieves feathering between two bitmaps by using variable opacity values, obtained from the fade mask referenced by hBitmapMask.

To create a bitmap that contains a fade mask, use the CreateFadedMask method.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Underlay method, Combine method, AlphaBlend method, CreateFadedMask method

Topics	Raster Images: Combining Images
Image Processing


fLeft Parameter For FeatherAlphaBlend
fLeft

The X coordinate of the origin of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fTop Parameter For FeatherAlphaBlend
fTop

The Y coordinate of the origin of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For FeatherAlphaBlend
fWidth

The width of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For FeatherAlphaBlend
fHeight

The height of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


hBitmapSrc Parameter For FeatherAlphaBlend
hBitmapSrc

The source Main Control's bitmap to be combined with the current Main Control's bitmap.


fSrcLeft Parameter For FeatherAlphaBlend
fSrcLeft

The X coordinate of the origin of the source rectangle, relative to the source control. The unit of measure is determined by the ScaleMode property.


fSrcTop Parameter For FeatherAlphaBlend
fSrcTop

The Y coordinate of the origin of the source rectangle, relative to the source control. The unit of measure is determined by the ScaleMode property.


hBitmapMask Parameter For FeatherAlphaBlend
hBitmapMask

The Main Control's bitmap that contains the fade mask.


Return for FeatherAlphaBlend
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


FeedLoad method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short FeedLoad (VARIANT vBuffer, long iSize);

Overview	Refer to Loading a Bitmap from Your Own Buffer.

Remarks

Supplies image data to the file-load process from a buffer that you provide.

Support for 12 and 16-bit grayscale  images is available only in the Document/Medical Toolkit

Use this method with the StartFeedLoad method and the StopFeedLoad method. For a description of how the methods relate to each other, refer to the StartFeedLoad method.

See Also

Topics	Raster Images: Loading Files


vBuffer Parameter For FeedLoad
vBuffer

Your buffer, defined as an array of bytes.


iSize Parameter For FeedLoad
iSize

The size of your buffer.


Return for FeedLoad
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


FilePage event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void FilePage ();

Overview	Refer to Detecting Events.

Remarks

Occurs before loading each page of a file. For example, if you load all pages of a multipage file that contains three images, this event occurs three times.

See Also

Elements	Change event

Topics	Raster Images: Loading Files


FilePageLoaded event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void FilePageLoaded ();

Overview	Loading a Bitmap from a File

Remarks

Occurs after each page is loaded in a multi-page file.

Your code for this event must save the bitmap in a file or store it in memory, because the Main Control's bitmap is reused for the next page.

This event occurs only if the EnableFilePageLoadedEvent property is set to TRUE.

See Also

Elements	EnableFilePageLoadedEvent property, FilePage event

Topics	Raster Images: Loading Files
Detecting Events


FileSizeWritten property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long FileSizeWritten;

Overview	Refer to Saving a Bitmap to a File.

Remarks

(Read only) Is the length of a file written, in bytes, when using the SaveOffset method. This property is automatically updated with the correct length if the SaveOffset method is successful.

See Also

Elements:	SaveOffset method, SavePad4 property

Topics	Raster Images: Saving Files


Fill method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Fill (OLE_COLOR crFill);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Fills the bitmap with the specified color.

The standard Windows values for COLORREF represent either red, green, and blue color values, or an index into the bitmap's palette.  A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value.  If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette which holds the color value.You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes As Color Values.

In the Document/Medical Toolkits, the COLORREF value may represent a 16 bit grayscale value if the bitmap is a 12 or 16-bit grayscale.  So that the value is not confused with an RGB value, the COLORREF_GRAY16 mask (0x04000000) is set.  In this case (0x0400YYYY), the lower 16 bits (0xYYYY) of the COLORREF value represent the 16-bit grayscale value. (0x0400FFFF is 16-bit white and 0x04000000is 16-bit black.) This is not a standard Windows value.  Therefore, LEADTOOLS elements will recognize a COLORREF having this format, but Windows elements will not.  For information on converting from a 16-bit value, refer to Converting 16-bit Grayscale Values.

See Also

Topics	Raster Images: Creating and Deleting Images
Raster Images: Where the Region Preempts the Bitmap


crFill Parameter For Fill
crFill

The fill color.

You can specify a COLORREF value (the return value of the RGB macro), or you can specify a palette index as explained in Using Palette Indexes As Color Values.


KeyAscii Parameter For KeyPress
KeyAscii

The standard numeric ANSI keycode. KeyAscii is passed by reference; changing it sends a different character to the object.  Changing KeyAscii to 0 cancels the keystroke so that the object receives no character.


KeyUp event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void KeyUp (short KeyCode, short Shift);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when the user releases a key while an object has the focus. (To interpret ANSI characters, use the KeyPress event.)

See Also

Elements	Resize event, Click event, DblClick event, KeyPress event, KeyDown event, MouseMove event, MouseDown event, MouseUp event, Scroll event

Topics	Raster Images: Displaying Images


KeyCode Parameter For KeyUp
KeyCode

Each development system has its own way of handling key codes. The following topics provide a quick reference:

 Visual Basic Constants for Key Codes.

 Visual C++ Key Codes.

 Visual FoxPro Key Codes.

 Access Key Codes.


Shift Parameter For KeyUp
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. The following are possible values:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


KeyUp event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void KeyUp (short* KeyCode, short Shift);

Overview	Refer to Detecting Events.

Remarks

Occurs when the user releases a key while an object has the focus. (To interpret ANSI characters, use the KeyPress event.)

See Also

Elements	KeyDown event, KeyPress event

Topics	Working with the Control: General Behavior


KeyCode Parameter For KeyUp
KeyCode

Each development system has its own way of handling key codes. The following topics provide a quick reference:

 Visual Basic Constants for Key Codes.

 Visual C++ Key Codes.

 Visual FoxPro Key Codes.

 Access Key Codes.


Shift Parameter For KeyUp
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. The following are possible values:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


LayerBlendModeKey property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR LayerBlendModeKey (short iLayer);

Overview	Refer to Layers in Files

Remarks

Gets or sets the blend mode key, a four byte character array, for the layer(s).

Possible values are:

Value	Meaning

'norm'	Normal

'dark'	Darken

'lite'	Lighten

'hue'	Hue

'sat'	Saturation

'colr'	Color

'lum'	Luminosity

'mul'	Multiply

'scrn'	Screen

'diss'	Dissolve

'over'	Overlay

'hLit'	Hard light

'sLit'	Soft light

'diff'	Difference

'smud'	Exclusion

'div'	Color dodge

'idiv'	Color burn

For more information, refer to FILE FORMATS SPECIFICATION from Adobe.

See Also

Elements	LayerClipping property, LayerOpacity property, LayerLeft property, LayerMaskBitmap property, LayerTop property, Save method, SaveLayers property


iLayer Parameter For LayerBlendModeKey
iLayer

Index into the array of layer blend mode keys.


LayerClipping property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short LayerClipping (short iLayer);

Overview	Refer to Layers in Files

Remarks

Gets or sets the clipping value for the layer.

A value of 0 represents base and 1 represents non-base.

For more information, refer to FILE FORMATS SPECIFICATION from Adobe.

See Also

Elements	LayerBlendModeKey property, LayerOpacity property, LayerLeft property, LayerMaskBitmap property, LayerTop property, Save method, SaveLayers property


iLayer Parameter For LayerClipping
iLayer

Index into the array of layer clipping values.


LayerLeft property (Main Control)
LayerLeft property (Main Control) (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float LayerLeft (short iLayer);

Overview	Refer to Layers in Files

Remarks

When iLayer is 0, LayerLeft(0) is a read-only property and contains information that was last read from the file using the LoadLayer method.

When iLayer is > 0, then LayerLeft(iLayer) contains positioning information for the layers that will be saved in the file. In this case, LayerLeft(iLayer) contains the left offset for layer iLayer. It is the corresponding offset for element iLayer in the bitmap list.

This information will be used the next time the Save method is called to save a PSD file.

See Also

Elements	LayerTop property, Save method, SaveLayers property, LayerOpacity property, LayerClipping property, LayerBlendModeKey property, LayerMaskBitmap property

Topics	Raster Images: Saving Files


iLayer Parameter For LayerLeft
iLayer

If this value is 0, the property contains information that was last read from the file using the LoadLayer method.

If this value is > 0, this is an index into the array of layer left positions.


LayerMaskBitmap property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short LayerMaskBitmap (short iLayer);

Overview	Refer to Layers in Files

Remarks

Gets or sets the mask bitmap for the layer. The mask bitmap is an 8-bit grayscale bitmap. The value of each pixel in the mask layer bitmap determines the transparency of the corresponding layer bitmap. A value of 0 represents full transparency while a value of 0xFF represents complete opacity. Intermediate values represent translucency. If the mask bitmap does not exist, then the layer is considered to be visible (it is as if the mask bitmap contained only 0xFF pixels.

For more information, refer to FILE FORMATS SPECIFICATION from Adobe.

See Also

Elements	LayerBlendModeKey property, LayerOpacity property, LayerLeft property, LayerClipping property, LayerTop property, Save method, SaveLayers property


iLayer Parameter For LayerMaskBitmap
iLayer

Index into the array of layer mask bitmaps.


LayerOpacity property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short LayerOpacity (short iLayer);

Overview	Refer to Layers in Files

Remarks

Gets or sets the opacity value for the layer.

A value of 0 represents full transparency and 255 is completely opaque. Intermediate values represent translucency.

For more information, refer to FILE FORMATS SPECIFICATION from Adobe.

See Also

Elements	LayerBlendModeKey property, LayerClipping property, LayerLeft property, LayerMaskBitmap property, LayerTop property, Save method, SaveLayers property


iLayer Parameter For LayerOpacity
iLayer

Index into the array of layer opacity values.


LayerTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float LayerTop (short iLayer);

Overview	Refer to Layers in Files

Remarks

When iLayer is 0, LayerLeft(0) is a read-only property and contains information that was last read from the file using the LoadLayer method.

When iLayer is > 0, then LayerTop(iLayer) contains positioning information for the layers that will be saved in the file. In this case, LayerTop(iLayer) contains the top offset for layer iLayer. It is the corresponding offset for element iLayer in the bitmap list.

This information will be used the next time the Save method is called to save a PSD file.

See Also

Elements	LayerLeft property, Save method, SaveLayers property, LayerOpacity property, LayerClipping property, LayerBlendModeKey property, LayerMaskBitmap property

Topics	Raster Images: Saving Files


iLayer Parameter For LayerTop
iLayer

If this value is 0, the property contains information that was last read from the file using the LoadLayer method.

If this value is > 0, this is an index into the array of layer top positions.


LevelHighBit property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short LevelHighBit

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Medical Imaging only) Sets the value of the highest bit considered as image data when painting a 12 or 16-bit grayscale image.  Valid values are : 0 <= LevelHighBit <= BitmapBits property.  For example, to specify that only the high (most significant) 8 bits of a 16-bit grayscale image are considered part of the image, set Level LowBit property to 8 and LevelHighBit property to 15 (not 16!  15 - 8 + 1 = 8 bits).  To consider only the lowest 8 bits, set LevelLowBit to 0 and LevelHighBit to 7 (not 8!).

This property does not change the image data, only the way it is painted.  Set the WindowLevelBitmap property to TRUE and call WindowLevel method to change the image data to match the display image.

See Also

Elements	WindowLevel method, LevelLowBit property

Topics	Raster Images: Palettes


LevelLowBit property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short LevelLowBit

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Medical Imaging only) Sets the value of  the lowest bit considered as image data when painting a 12 or 16-bit grayscale image.  Valid values are : 0 <= LevelLowBit <= LevelHighBit property.  For example, to specify that only the high (most significant) 8 bits of a 16-bit grayscale image are considered part of the image, set Level LowBit property to 8 and LevelHighBit property to 15 (not 16!  15 - 8 + 1 = 8 bits).  To consider only the lowest 8 bits, set LevelLowBit to 0 and LevelHighBit to 7 (not 8!).

This property does not change the image data, only the way it is painted.  Set the WindowLevelBitmap property to TRUE and call WindowLevel method to change the image data to match the display image.

See Also

Elements	WindowLevel method, LevelHighBit property

Topics	Raster Images: Palettes


LevelLUT property (Main Control)

Visual Basic example    Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	COLORREF LevelLUT (short iIndex);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Document/Medical only) Gets or sets a color stored in the Window Level Look UP Table (LUT).  The LUT specifies a remapping palette that can be used to change the color of every pixel painted on the screen.  For each pixel, LevelLowBit property and LevelHighBit property are used to generate a value between 0 and LevelLUTLength - 1.  This value is used as an index into the LevelLUT palette to obtain the corresponding color.  By default the interval 0 to LevelLUTLength - 1 is remapped to 0 to 255 and the corresponding gray value is used.

See Also

Elements	LevelLowBit property, LevelHighBit property, LevelLUTLength property
LevelLUT property, WindowLevel method, GetWindowLevel method

Topics	Raster Images: Palettes


iIndex Parameter For LevelLUT
iIndex

Short value containing an index into the LevelLUT.
It is used to get or set a color stored in LevelLUT.


LevelLUTLength property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short LevelLUTLength

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Document/Medical only) (Read Only) Gets the length of  the LevelLUT remapping palette.  It is equal to 2 raised to the power of (LevelHighBit - LevelLowBit + 1).

See Also

Elements	LevelLUT property, LevelHighBit property, LevelLowBit property

Topics	Raster Images: Palettes


LineProfile method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short LineProfile(long xStart, long yStart, long xEnd, long yEnd);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Updates the LineProfileRed, LineProfileGreen and LineProfileBlue properties with the R, G and B profile for each pixel in the specified line.

This method supports 12 and 16-bit grayscale. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Elements	Pixel property, LineProfileRed property, LineProfileGreen property, LineProfileBlue property, LineProfileSize property

Topics	Raster Images: Getting Current Information


xStart Parameter For LineProfile
xStart

x-coordinate of the starting point for the line.


yStartParameter For LineProfile
yStart

y-coordinate of the starting point for the line.


xEnd Parameter For LineProfile
xEnd

x-coordinate of the end point for the line. Information for this point is included in the arrays.


yEnd Parameter For LineProfile
yEnd

y-coordinate of the end point for the line. Information for this point is included in the arrays.


Return for LineProfile
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


LineProfileBlue property (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	long LineProfileBlue(long iIndex);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Read only) Array that contains the blue values for the line that was specified in the LineProfile method.

The number of points in the array is contained in the LineProfileSize property.

This property is updated by the LineProfile method.

See Also

Elements	LineProfile method, LineProfileRed property, LineProfileGreen property, LineProfileSize property

Topics	Raster Images: Getting Current Information


iIndex Parameter For LineProfileBlue
iIndex

Index into the array of colors.


LineProfileGreen property (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	long LineProfileGreen(long iIndex);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Read only) Array that contains the green values for the line that was specified in the LineProfile method.

The number of points in the array is contained in the LineProfileSize property.

This property is updated by the LineProfile method.

See Also

Elements	LineProfile method, LineProfileRed property, LineProfileBlue property, LineProfileSize property

Topics	Raster Images: Getting Current Information


iIndex Parameter For LineProfileGreen
iIndex

Index into the array of colors.


LineProfileRed property (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	long LineProfileRed(long iIndex);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Read only) Array that contains the red values for the line that was specified in the LineProfile method.

The number of points in the array is contained in the LineProfileSize property.

This property is updated by the LineProfile method.

See Also

Elements	LineProfile method, LineProfileGreen property, LineProfileBlue property, LineProfileSize property

Topics	Raster Images: Getting Current Information


iIndex Parameter For LineProfileRed
iIndex

Index into the array of colors.


LineProfileSize property (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	long LineProfileSize();

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Read only) Indicates the size of the arrays (LineProfileRed, LineProfileGreen and LineProfileBlue properties) used to store the R, G and B profile for each pixel in a line.

This property is updated by the LineProfile method.

See Also

Elements	LineProfile method, LineProfileRed property, LineProfileGreen property, LineProfileBlue property

Topics	Raster Images: Getting Current Information


LineRemove event (Main Control)
LineRemoveEvent event (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	void LineRemoveEvent (long nStartRow, long nStartCol, long nLength, OLE_HANDLE hRgnLine);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) This event is triggered for each line found by the LineRemove method. Set the DocCleanSuccess property to SUCCESS_REMOVE to have the line removed. Set the DocCleanSuccess property to SUCCESS_NOREMOVE to leave the line unchanged. Set the DocCleanSuccess property to 0 to abort. If the uFlags parameter of the LineRemove method is set to LINE_IMAGE_UNCHANGED | LINE_SINGLE_REGION, then the value of the DocCleanSuccess property affects only the internal single region that contains all changes.

Note: hRgnLine is only valid during this event. To use the hRgnLine after the event has terminated, make a copy of it using the SetBitmapRgnHandle method.

See Also

Elements	LineRemove method

Topics	Raster Images: Cleaning - up 1-Bit Images


nStartRow Parameter For LineRemove
nStartRow

The starting row of the line. The rows are zero-based.


nStartCol Parameter For LineRemove
nStartCol

The starting column of the line. The columns are zero-based.


nLength Parameter For LineRemove
nLength

Length (in pixels) of the line.


hRgnLine Parameter For LineRemove
hRgnLine

Windows region representing a line to be removed. It is the programmer's responsibility to delete this region when it is no longer needed.


LineRemove method (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	short LineRemove (long uFlags, long iMinLineLength, long iMaxLineWidth, long iWall, long iMaxWallPercent, long iGapLength, long iVariance, long uRemoveFlags);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) Removes horizontal and vertical lines in a 1-bit black and white image.

This method removes horizontal and vertical lines from scanned text documents. If the lines pass through text, the parameters can be set to remove or preserve the text.

This method works only on 1-bit black and white images.

If a region is selected, only the selected region will be changed by this method. If no region is selected, the whole image will be processed.

The behavior of this method can be further modified by using the LineRemoveEvent event.

To "fine-tune" the performance of this method, try modifying the values for iWall, iGapLength and iVariance.

This method triggers both the LineRemoveEvent event and the ProgressStatus event.

See Also

Elements	LineRemoveEvent event

Topics	Raster Images: Cleaning - up 1-Bit Images


uFlags Parameter For LineRemove
uFlags

Flags that determine the behavior of the line removal process. Flags may be combined using a bitwise OR. Possible values are:

Value	Meaning

LINE_SINGLE_REGION:	For each line found by the LineRemove method, if the DocCleanSuccess property is set to SUCCESS_REMOVE in the LineRemoveEvent event, the removed line is added to an internal single region. If the DocCleanSuccess property is set to SUCCESS_NOREMOVE, the line is not added to the single region. When the LineRemove method returns, either the DocCleanBitmap property or the hDocCleanRgn property will reference a region that contains all the removed lines. If LINE_LEAD_REGION is also set, the DocCleanBitmap property will be updated with a bitmap that has a LEAD region that contains all the removed lines. If LINE_LEAD_REGION is not set, the hDocCleanRgn property is updated with a Windows region that contains all the removed lines. When the region (either LEAD or Windows) is no longer needed, it must be destroyed.

LINE_LEAD_REGION	When the LineRemove method returns, the DocCleanBitmap property is updated with a bitmap that also contains a region with all the removed lines. This flag must be used in conjunction with LINE_SINGLE_REGION. To use this flag set uFlags to LINE_SINGLE_REGION | LINE_LEAD_REGION. The DocCleanBitmap property will be updated when the LineRemove method returns.

LINE_IMAGE_UNCHANGED	The original image is unchanged.

LINE_USE_DPI	The unit of measure for all parameters of this method is thousandths of an inch. Use the image's DPI to convert to pixels. This allows the processing of many images with different DPI.  If this flag is not set, the unit of measure is pixels.

LINE_CALLBACK_REGION	The LineRemoveEvent event receives a Windows region that contains the current line to be removed. Setting this flag lets the user create his or her own composite of removed lines by combining the regions received by the event, if the DocCleanSuccess property was set to SUCCESS_REMOVE. The regions can be combined using a logical OR operator. Combining all regions received by the event, that are removed, results in a region identical to the region created when LINE_SINGLE_REGION is set in uFlags.

LINE_REMOVE_ENTIRE	Remove the entire line, even if the line passes through a character or a wall.  Consider the line below.

Setting iMaxWallPercent as 80 and passing LINE_REMOVE_ENTIRE will remove the red pixels as shown below.

LINE_USE_GAP	Consider "gaps" in lines when performing line removal. If this flag is passed, the iGapLength parameter is used. If this flag is not passed, the iGapLength parameter is ignored.

LINE_USE_VARIANCE	Consider line variance when performing line removal. If this flag is passed, the iVariance parameter is used. If this flag is not passed, the parameter is ignored.


iMinLineLength Parameter For LineRemove
iMinLineLength

Minimum length of a line considered for removal. Lines less than this length are not removed. If LINE_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.


iMaxLineWidth Parameter For LineRemove
iMaxLineWidth

Maximum average width of a line that is considered for removal. Lines that are greater in average width are not removed. If LINE_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.


iWall Parameter For LineRemove
iWall

Height of a wall. Walls are slices of a line that are too wide to be considered part of the line.  Examples of walls include a character that a line passes through or a perpendicular line. If the image contains lines that pass through characters, set iWall to be equal to or a little larger than iMaxLineWidth. If LINE_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.


iWallPercent Parameter For LineRemove
iWallPercent

The maximum number of wall slices (expressed as a percent of the total length of the line) that are allowed. A line consists of wall slices and non-wall slices (see description of iWall).  This field specifies that maximum number of wall slices (expressed as a percent of the total length of the line) that are allowed.  Lines that have a wall percent that is larger than iMaxWallPercent will not be removed.  For example, consider the line below that is 10 pixels in length, and 1 pixel in height in some places, and five pixels in height in other places.

Setting iMinLineLength to 10 pixels and iWall to four pixels will identify the line below as a candidate for removal.  Note that the wall percent for this line is 60% (because six of ten line slices are walls).  If iMaxWallPercent is 80 then the line will be removed (actually, the pixels marked as red will be removed).  If iMaxWallPercent is 30, then the line will not be removed.


iGapLength Parameter For LineRemove
iGapLength

Maximum length of a break or a hole in a line. This can be used to remove dotted lines, dashed lines, or lines that have breaks due to scanning. If LINE_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels. This parameter is valid only if LINE_USE_GAP is set in uFlags.


iVariance Parameter For LineRemove
iVariance

Amount of width change that is tolerated between adjacent line slices. If LINE_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels. This parameter is valid only if LINE_USE_VARIANCE is set in uFlags. For example, the following horizontal line is 30 pixels in length (X represents a pixel)

                             XXXXXXXXXX
                   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                             XXXXXXXXXX
                             XXXXXXXXXX

If iVariance is 2 pixels (i.e. tolerate width changes of 2 pixels or less), the first 10 columns and the last 10 columns of the line will be removed. The middle 10 columns will be unchanged. This helps preserve characters that intersect a line that is being removed.


uRemoveFlags Parameter For LineRemove
uRemoveFlags

Flag that indicates which lines to remove. Possible values are:

Value	Meaning

LINEREMOVE_HORIZONTAL	Remove horizontal lines

LINEREMOVE_VERTICAL	Remove vertical lines


Return for LineRemove
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Load method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Load (BSTR pszName, short iBitsPerPixel, long lPage, long lPages);

Overview	Refer to Loading a Bitmap from a File.

Remarks

Loads one or more images from a file into the Main Control. The file can be in any supported image file format and bits per pixel, whether compressed or uncompressed.

When loading an image from a file, LEADTOOLS normally determines the file format from the header.  If the format is unrecognized, or there is no header, an error is returned.  Raw Fax files do not have headers, therefore a LoadInfo event must be sent when loading raw Fax files.

For supported formats, refer to Summary of All Supported Image File Formats.

Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits.

For a list of available products, refer to Summary of LEADTOOLS Products.

See Also

Elements	LoadStamp method, BitmapDataPath property, LoadMemory method, StartFeedLoad method, FileOpen method, LoadInfo event, EnableProgressEvent property, SetLoadResolution method, PCDResolution property, WMFResolution property, LayerLeft property, LayerTop property

Topics	Raster Images: Loading Files
Raster Images: Creating and Maintaining Lists of Images


pszName Parameter For Load
pszName

Character string containing the name of the file to load.


iBitsPerPixel Parameter For Load
iBitsPerPixel

Resulting bitmap pixel depth. The following are valid values:

Value	Meaning

0	Keep the original file's pixel depth (Do not convert). A special note about loading 12 and 16-bit grayscale images.

1	1 bit per pixel in the resultant bitmap

4	4 bits per pixel in the resultant bitmap

8	8 bits per pixel in the resultant bitmap

12	12 bits per pixel in the resultant bitmap

16	16 bits per pixel in the resultant bitmap

24	24 bits per pixel in the resultant bitmap

32	32 bits per pixel in the resultant bitmap


lPage Parameter For Load
lPage

The page number (for multipage files) that contains the first image to be loaded.

If the file is not a multipage file, pass 0.


lPages Parameter For Load
lPages

The number of pages to load. To load all pages in a multipage file, pass -1. If the file is not a multipage file, pass 1.


Return for Load
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Load method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short Load (BSTR pszFileName, long nPageNo)

Overview	Refer to Working with MRC Bitmap.

Remarks

Loads MRC files that were saved using either LEAD Proprietary T44 Format or Standard T44 Format.

See Also

Elements	Save method, SaveT44 method, GetPagesCount method

Topics	MRC Bitmap Functions: Loading a Page


pszFileName Parameter For Load (Mixed Raster Content Control)
pszFileName

Character string containing the name of the image file to load.


nPageNo Parameter For Load (Mixed Raster Content Control)
nPageNo

The number of page to be loaded from the file.


Return for Load
Return Value

Value	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


LoadArray method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short LoadArray (VARIANT vMem, short iBitsPerPixel, long lPage, long lPages, long lSize);

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Loads an image from a file that is stored in memory. The file can be in any supported image file format and bits per pixel, whether compressed or uncompressed.

For supported formats, refer to Summary of All Supported Image File Formats.

To load an image from a file in memory, use one of the following methods:

LoadMemory—use this for a global handle to the file in memory

LoadArray—use this for a VARIANT byte array that contains the file in memory

LoadBuffer—use this for an address of a memory location that contains the file in memory

To save an image to a memory file, use one of the following methods:

SaveMemory—returns a global handle to a file in memory

SaveArray—returns a VARIANT byte array that contains the file in memory

SaveBuffer—saves a file into a memory location that the user allocates

Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

For a list of available products, refer to Summary of LEADTOOLS Products.

To save an image to a file in memory, refer to the SaveArray method.

Note: You cannot save a multipage file using the SaveArray method, but if you get a multipage file into memory in some other way, you can use the LoadArray method to load a specific page from the file.

See Also

Elements	LoadMemory method, SaveArray method, SaveMemory method

Topics	Raster Images: Loading Files


vMem Parameter For LoadArray
vMem

A VARIANT byte array that contains a file in memory.


iBitsPerPixel Parameter For LoadArray
iBitsPerPixel

Resulting bitmap pixel depth. The following are valid values:

Value	Meaning

0	Keep the original file's pixel depth (Do not convert). A special note about loading 12 and 16-bit grayscale images.

1	1 bit per pixel in the resultant bitmap

4	4 bits per pixel in the resultant bitmap

8	8 bits per pixel in the resultant bitmap

12	12 bits per pixel in the resultant bitmap

16	16 bits per pixel in the resultant bitmap

24	24 bits per pixel in the resultant bitmap

32	32 bits per pixel in the resultant bitmap


lPage Parameter For LoadArray
lPage

The page number of the image, if the file is in a multipage file.

GIF, TIFF (MPT), and PCX (DCX) files can be multipage files (containing more than one image). If you set the value to the page number of an image in the file, this method provides information about the specified image.

If the file is not a multi-page file, pass 0.


lPages Parameter For LoadArray
lPages

The number of pages to load. To load all pages in a multi-page file, pass -1. If the file is not a multi-page file, pass 1.


lSize Parameter For LoadArray
lSize

The size in bytes of the data stored in memory. If you use the SaveArray method to create the file in memory, you calculate the size using the following:

Size = UBound(variant) – LBound(variant) + 1


Return for LoadArray
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


LoadBuffer method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short LoadBuffer (long lBufferAddress, short iBitsPerPixel, long lPage, long lPages, long lSize);

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Loads an image from a file that is stored in memory. The ‘lBufferAddress’ is the address of the memory buffer.  The file can be in any supported image file format and bits per pixel, whether compressed or uncompressed.

For supported formats, refer to Summary of All Supported Image File Formats.

Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

For a list of available products, refer to Topic Selection.

To load an image from a file in memory, use one of the following methods:

LoadMemory—use this if you have a global handle to the file in memory

LoadArray—use this if you have a VARIANT byte array that contains the file in memory

LoadBuffer—use this if you have the address of a memory location that contains the file in memory

To save an image to a memory file, use one of the following methods:

SaveMemory—returns a global handle to a file in memory

SaveArray—returns a VARIANT byte array that contains the file in memory

SaveBuffer—saves a file into a memory location that the user allocates

See Also

Elements	SaveBuffer method, SaveBufferSize property, SaveBufferAddress property, EnableSaveBufferEvent property, SaveBuffer event, Load method, LoadStamp method, BitmapDataPath property, StartFeedLoad method, LoadInfo event, EnableProgressEvent property, SetLoadResolution method, PCDResolution property, WMFResolution property, LoadArray method, LoadMemory method, SaveArray method, SaveMemory method

Topics	Raster Images: Loading Files


lBufferAddress Parameter For LoadBuffer
lBufferAddress

Address of the memory location that contains the file in memory.


iBitsPerPixel Parameter For LoadBuffer
iBitsPerPixel

Resulting bitmap pixel depth. The following are valid values:

Value	Meaning

0	Keep the original file's pixel depth (Do not convert). A special note about loading 12 and 16-bit grayscale images.

1	1 bit per pixel in the resultant bitmap.

4	4 bits per pixel in the resultant bitmap.

8	8 bits per pixel in the resultant bitmap.

12	12 bits per pixel in the resultant bitmap.

16	16 bits per pixel in the resultant bitmap.

24	24 bits per pixel in the resultant bitmap.

32	32 bits per pixel in the resultant bitmap.


lPage Parameter For LoadBuffer
lPage

The page number (for multipage files) that contains the first image to be loaded.

If the file is not a multipage file, pass 0.


lPages Parameter For LoadBuffer
lPages

The number of pages to load. To load all pages in a multipage file, pass -1. If the file is not a multipage file, pass 1.


lSize Parameter For LoadBuffer
lSize

Size of the memory buffer in bytes.


LoadCompressed property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short LoadCompressed

Overview	Refer to Loading a Bitmap from a File.

Remarks

Indicates whether an image will be loaded compressed or uncompressed, and if compressed, what compression will be used. Possible values are:

Value	Meaning

COMP_NONE	[0] The bitmap will be loaded uncompressed. This is the equivalent of False in previous versions.

COMP_RLE	[1] The bitmap will be loaded in memory RLE compressed. This is the equivalent of True in previous versions.

COMP_SUPER	[2] The bitmap will be loaded in memory compressed. The compression used is LEAD CMP (for 24-bit bitmaps) or Fax G4 (for 1-bit bitmaps).

Bitmaps loaded with COMP_SUPER will take up the least amount of memory. Most operations on the bitmap will be slower than on compressed or uncompressed bitmaps. The use of super compressed bitmaps is recommended when the bitmaps being loaded are really large and it would make the operating system to swap the bitmap data to disk (if the bitmap was uncompressed). In these situations, the manipulation of super compressed bitmaps can be faster than the manipulation of compressed or uncompressed bitmaps.

Note that the super compression for 24-bit bitmaps is lossy, which means repeated modifications of the bitmap could cause image degradation. To avoid this, uncompress the bitmap using the BitmapCompression property, make any changes and then recompress the bitmap back using the BitmapCompression property again.

See Also

Elements	Load method, LoadArray method, LoadCompressed, LoadMemory method, BitmapCompression property

Topics	Raster Images: Loading Files


LoadDatabase method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short LoadDatabase (BSTR pszFilename);

Overview	Refer to Using the ImageList Control.

Remarks

Call this method to load items from a previously saved database (multipage TIFF file).

The text for each item will be read from the CMNT_SZNAMEOFPAGE comment.

See Also

Elements	SaveToFile method, SaveDatabase method, LoadFromFile method

Topics	Raster Images: Displaying Images


pszFilename Parameter For LoadDatabase
pszFilename

String that contains the name of the file from which to load the database.


Return for LoadDatabase
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


LoadFromFile method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short LoadFromFile (BSTR pszFile, short nBits, long nStart, long nItems);

Overview	Refer to Using the ImageList Control.

Remarks

Inserts new items into the ImageList Control from the specified file.  This method supports loading multiple pages from a multi-page file.  All items are inserted with the same Text attribute, which is the filename.  You can change this after the items are inserted using the Item collection property.

See Also

Elements	Item property, Insert method, InsertAt method, Remove method, Count property, Sort method, InsertFromBitmapList method, SaveToFile method, SetLoadResolution method, PCDResolution property, WMFResolution property

Topics	Raster Images: Displaying Images


pszFile Parameter For LoadFromFile
pszFile

Name of file from which items should be loaded.


nBits Parameter For LoadFromFile
nBits

Resulting bitmap pixel depth. The following are valid values:

Value	Meaning

0	Keep the original file's pixel depth (Do not convert). A special note about loading 12 and 16-bit grayscale images.

1	1 bit per pixel in the resultant bitmap

2	2 bit per pixel in the resultant bitmap

3	3 bit per pixel in the resultant bitmap

4	4 bits per pixel in the resultant bitmap

5	5 bit per pixel in the resultant bitmap

6	6 bit per pixel in the resultant bitmap

7	7 bit per pixel in the resultant bitmap

8	8 bits per pixel in the resultant bitmap

12	12 bits per pixel in the resultant bitmap

16	16 bits per pixel in the resultant bitmap

24	24 bits per pixel in the resultant bitmap

32	32 bits per pixel in the resultant bitmap


nStart Parameter For LoadFromFile
nStart

The number of the page, in a multi-page file, that contains the first image to be loaded.

If the file is not a multi-page file, pass 0.


nItems Parameter For LoadFromFile
nItems

The number of items to load. To load all pages in a multi-page file, pass -1. If the file is not a multi-page file, pass 1.


Return for LoadFromFile
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


LoadIFD property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long LoadIFD

Overview	Refer to Loading and Saving Large TIFF Files.

Remarks

Specifies the offset within the current file of the page to load.

The LoadIFD property can be used to speed up the loading of TIFF files with many pages.

If the value of this property is <= 7, the LoadXXX methods will ignore this property. This property is only valid for TIFF files. The default value is 0, which indicates that the file format does not support IFDs.

If the value of this property is >= 8, then when information about a TIF file is retrieved, the page at the offset given by this property will be page 1. The page after will be page 2, etc. When the current TIF file is no longer needed, this property must be reset to 0, otherwise the processing of any other TIF files will be incorrect.

See Also

Elements	InfoIFD property, SaveIFD property

Topics	Raster Images: Loading and Saving Large TIFF Files


LoadInfo event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void LoadInfo ();

Overview	Refer to Loading a Bitmap from a File.

Remarks

Occurs if LEADTOOLS attempts to load an image file, but does not find valid format information in the file header. You can use this event for loading input data (such as raw fax) that LEADTOOLS cannot recognize.

LEADTOOLS will only attempt to recognize fax files if you respond to this event and have filled the LoadInfoXXX properties listed below. If you want LEADTOOLS to automatically recognize any fax file, set the LoadInfoWidth and LoadInfoHeight properties to -1 once, at the beginning of the program. If you recognize the file and know the width and height of the file, set LoadInfoWidth and LoadInfoHeight to a positive value.

This event occurs before an error message is generated. You can set the following properties in this event to supply the missing header information:

 LoadInfoBits property

 LoadInfoFlags property

 LoadInfoFormat property

 LoadInfoHeight property

 LoadInfoOffset property

 LoadInfoWidth property

 LoadInfoXRes property

 LoadInfoYRes property

 UserPalette property

You can also set these properties elsewhere in your program. For example, you could set them at the time you identify the file that is to be loaded. But LEADTOOLS does not check the property values until after it has failed to find the header information and the LoadInfo event has occurred.

See Also

Topics	Raster Images: Loading Files


LoadInfoBits property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short LoadInfoBits

Overview	Refer to Loading a Bitmap from a File.

Remarks

Specifies the bits per pixel of the image data to be loaded. LEADTOOLS uses this value only if it fails to find the value in the file header. You can use this and the other LoadInfo... properties for loading raw FAX data (CCITT Group 3 or Group 4).

LEADTOOLS checks the LoadInfoFormat property first. If that property has a non-zero value, it uses the other LoadInfo... property values. Keep in mind that when these values are used, LEADTOOLS does not validate the data in the file. If you want LEADTOOLS to validate the data, you must set the LoadInfoFormat property to zero.

Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits.

See Also

Elements	LoadInfo event, LoadInfoFlags property, LoadInfoFormat property, LoadInfoHeight property, LoadInfoOffset property, LoadInfoWidth property, LoadInfoXRes property, LoadInfoYRes property

Topics	Raster Images: Loading Files


LoadInfoFlags property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long LoadInfoFlags

Overview	Refer to Loading a Bitmap from a File.

Remarks

Specifies format information about the image data to be loaded. LEADTOOLS uses these flags only if it fails to find the value in the file header. You can use this and the other LoadInfo... properties for loading raw FAX data (CCITT Group 3 or Group 4) and RAW uncompressed data.

LEADTOOLS checks the LoadInfoFormat property first. If that property has a non-zero value, it uses the other LoadInfo... property values. Keep in mind that when these values are used, LEADTOOLS does not validate the data in the file. If you want LEADTOOLS to validate the data, you must set the LoadInfoFormat property to zero.

The following are valid values. When it is appropriate, you can use a bitwise OR ( | ) to specify more than one value. In high-level languages, such as Visual Basic, use a plus (+) for a bitwise OR.

LOADINFO_TOPLEFT, LOADINFO_TOPLEFT90 and LOADINFO_TOPLEFT270 cannot be combined using the bitwise OR.

LOADINFO_REVERSE can be combined with LOADINFO_TOPLEFT, LOADINFO_TOPLEFT90 or LOADINFO_TOPLEFT270.  If LOADINFO_REVERSE is set, every line is reversed before being put into the bitmap.  LOADINFO_ORDERGRAY allows the CreateBitmap method to create a 16-bit grayscale image.

Flag 	Meaning

LOADINFO_TOPLEFT	[0x00000001] The image has a TOP_LEFT view perspective.

LOADINFO_ORDERRGB	[0x00000002] The color order is RGB.

LOADINFO_WHITEONBLACK	[0x00000004] The image is white-on-black.

LOADINFO_LSB	[0x00000008] The least significant bit is filled first.

LOADINFO_TOPLEFT90	[0x00000010] The image has a TOP_LEFT90 view perspective. (Document/Medical only).

LOADINFO_TOPLEFT270	[0x00000020] The image has a TOP_LEFT270 view perspective. (Document/Medical only).

LOADINFO_REVERSE	[0x00000040] The image is reversed (Mirrored.)

LOADINFO_TOPLEFT180	[0x00000080] The image has a TOP_LEFT180 view perspective. (Document/Medical only)

LOADINFO_BOTTOMLEFT90	[0x00000100] The image has a BOTTOM_LEFT90 view perspective. (Document/Medical only)

LOADINFO_BOTTOMLEFT180	[0x00000200] The image has a BOTTOM_LEFT180 view perspective. (Document/Medical only)

LOADINFO_BOTTOMLEFT270	[0x00000400] The image has a BOTTOM_LEFT270 view perspective. (Document/Medical only)

LOADINFO_PAD4	[0x00000800] Each line is padded to a multiple of 4 bytes. (raw data only)

LOADINFO_PALETTE	[0x00001000] A palette is supplied in the UserPalette property. (raw data only)

LOADINFO_BITFIELDS	[0x00002000] 3 color masks are specified in the rgbColorMask field. This is for raw Bitfield compressed data only.

LOADINFO_ORDERGRAY	[0x00004000] Image is grayscale.

LOADINFO_MOTOROLAORDER	[0x00008000] Image bytes are in Motorola byte order. Valid only for 16, 48 and 64-bit.)

0	Clear the flags, defaulting to their opposite meanings.

See Also

Elements	LoadInfo event, LoadInfoBits property, LoadInfoFormat property, LoadInfoHeight property, LoadInfoOffset property, LoadInfoWidth property, LoadInfoXRes property, LoadInfoYRes property

Topics	Raster Images: Loading Files


LoadInfoFormat property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short LoadInfoFormat

Overview	Refer to Loading a Bitmap from a File.

Remarks

Specifies format of the image data to be loaded. LEADTOOLS uses this value only if it fails to find the value in the file header. You can use this and the other LoadInfo... properties for loading raw FAX data (CCITT Group 3 or Group 4).

LEADTOOLS checks the LoadInfoFormat property first. If this property has a non-zero value, LEADTOOLS uses the other LoadInfo... property values. Keep in mind that when these values are used, LEADTOOLS does not validate the data in the file. If you want LEADTOOLS to validate the data, you must set the LoadInfoFormat property to zero.

The following are valid formats:

FILE_FAX_G3_1D	Raw FAX, compressed using CCITT group 3, 1 dimension.

FILE_FAX_G3_2D	Raw FAX, compressed using CCITT group 3, 2 dimensions.

FILE_FAX_G4 	Raw FAX, compressed using CCITT group 4.

FILE_RAW	Raw uncompressed data.

FILE_RAW_RLE4	Raw RLE4 compressed, 4 bit data. (Read only)

FILE_RAW_RLE8	Raw RLE8 compressed, 8 bit data. (Read only)

FILE_RAW_BITFIELDS	Raw BITFIELD data, 16 or 32-bit data. (Read only)

FILE_RAW_PACKBITS	Raw PackBits compression. (Read only)

See Also

Elements	LoadInfo event, LoadInfoBits property, LoadInfoFlags property, LoadInfoHeight property, LoadInfoOffset property, LoadInfoWidth property, LoadInfoXRes property, LoadInfoYRes property, Working with the RAW File Filter

Topics	Raster Images: Loading Files


LoadInfoHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float LoadInfoHeight

Overview	Refer to Loading a Bitmap from a File.

Remarks

Specifies the height, in pixels, of the image to be loaded. LEADTOOLS uses this value only if it fails to find format information in the file header. You can use this and the other LoadInfo... properties for loading raw FAX data (CCITT Group 3 or Group 4).

If you want LEADTOOLS to automatically recognize any fax file, set the LoadInfoWidth and LoadInfoHeight properties to -1 once, at the beginning of the program.

LEADTOOLS checks the LoadInfoFormat property first. If that property has a non-zero value, it uses the other LoadInfo... property values. Keep in mind that when these values are used, LEADTOOLS does not validate the data in the file. If you want LEADTOOLS to validate the data, you must set the LoadInfoFormat property to zero.

See Also

Elements	LoadInfo event, LoadInfoBits property, LoadInfoFlags property, LoadInfoFormat property, LoadInfoOffset property, LoadInfoWidth property, LoadInfoXRes property, LoadInfoYRes property

Topics	Raster Images: Loading Files


LoadInfoOffset property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long LoadInfoOffset

Overview	Refer to Loading a Bitmap from a File.

Remarks

Specifies the position of the first byte of image data to be loaded. This can be 0 if your file does not have a header. LEADTOOLS uses this value only if it fails to find format information in the file header. You can use this and the other LoadInfo... properties for loading raw FAX data (CCITT Group 3 or Group 4).

LEADTOOLS checks the LoadInfoFormat property first. If that property has a non-zero value, it uses the other LoadInfo... property values. Keep in mind that when these values are used, LEADTOOLS does not validate the data in the file. If you want LEADTOOLS to validate the data, you must set the LoadInfoFormat property to zero.

See Also

Elements	LoadInfo event, LoadInfoBits property, LoadInfoFlags property, LoadInfoFormat property, LoadInfoHeight property, LoadInfoWidth property, LoadInfoXRes property, LoadInfoYRes property

Topics	Raster Images: Loading Files


LoadInfoWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float LoadInfoWidth

Overview	Refer to Loading a Bitmap from a File.

Remarks

Specifies the width, in pixels, of the image to be loaded. LEADTOOLS uses this value only if it fails to find format information in the file header. You can use this and the other LoadInfo... properties for loading raw FAX data (CCITT Group 3 or Group 4).

If you want LEADTOOLS to automatically recognize any fax file, set the LoadInfoWidth and LoadInfoHeight properties to -1 once, at the beginning of the program.

LEADTOOLS checks the LoadInfoFormat property first. If that property has a non-zero value, it uses the other LoadInfo... property values. Keep in mind that when these values are used, LEADTOOLS does not validate the data in the file. If you want LEADTOOLS to validate the data, you must set the LoadInfoFormat property to zero.

See Also

Elements	LoadInfo event, LoadInfoBits property, LoadInfoFlags property, LoadInfoFormat property, LoadInfoHeight property, LoadInfoOffset property, LoadInfoXRes property, LoadInfoYRes property

Topics	Raster Images: Loading Files


LoadInfoXRes property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short LoadInfoXRes

Overview	Refer to Loading a Bitmap from a File.

Remarks

Specifies the horizontal resolution, in DPI (dots per inch), of the image to be loaded. LEADTOOLS uses this value only if it fails to find format information in the file header. You can use this and the other LoadInfo... properties for loading raw FAX data (CCITT Group 3 or Group 4).

LEADTOOLS checks the LoadInfoFormat property first. If that property has a non-zero value, it uses the other LoadInfo... property values. Keep in mind that when these values are used, LEADTOOLS does not validate the data in the file. If you want LEADTOOLS to validate the data, you must set the LoadInfoFormat property to zero.

See Also

Elements	LoadInfo event, LoadInfoBits property, LoadInfoFlags property, LoadInfoFormat property, LoadInfoHeight property, LoadInfoOffset property, LoadInfoWidth property, LoadInfoYRes property

Topics	Raster Images: Loading Files


LoadInfoYRes property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short LoadInfoYRes

Overview	Refer to Loading a Bitmap from a File.

Remarks

Specifies the vertical resolution, in DPI (dots per inch), of the image to be loaded. LEADTOOLS uses this value only if it fails to find format information in the file header. You can use this and the other LoadInfo... properties for loading raw FAX data (CCITT Group 3 or Group 4).

LEADTOOLS checks the LoadInfoFormat property first. If that property has a non-zero value, it uses the other LoadInfo... property values. Keep in mind that when these values are used, LEADTOOLS does not validate the data in the file. If you want LEADTOOLS to validate the data, you must set the LoadInfoFormat property to zero.

See Also

Elements	LoadInfo event, LoadInfoBits property, LoadInfoFlags property, LoadInfoFormat property, LoadInfoHeight property, LoadInfoOffset property, LoadInfoWidth property, LoadInfoXRes property

Topics	Raster Images: Loading Files


LoadLayer method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short LoadLayer (BSTR pszName, short iBitsPerPixel, short iLayer);

Overview	Refer to Layers in Files

Remarks

Loads a layer from a file that contains layers. To determine whether a file contains layers, check the InfoLayers property.

Currently, only PSD files support layers, but not all PSD files contain layers.

The layers are numbered starting with 0. The first layer is 0; the second layer is 1, etc. Call the GetFileInfo method to update the InfoLayers property. The last layer in the file is InfoLayers - 1.

After a layer is loaded, the LayerLeft(0) and LayerTop(0) properties can be examined for positioning information on this layer.

See Also

Elements	LayerLeft property, LayerTop property, Save method, SaveLayers property, GetFileInfo method, InfoLayers property

Topics	Raster Images: Loading Files


pszName Parameter For LoadLayer
pszName

String containing the name of the file from which to load the layer.


iBitsPerPixel Parameter For LoadLayer
iBitsPerPixel

Resulting bitmap pixel depth. The following are valid values:

Value	Meaning

0	Keep the original file's pixel depth (Do not convert). A special note about loading 12 and 16-bit grayscale images.

1 to 8	The specified bits per pixel in the resultant bitmap

12	12 bits per pixel in the resultant bitmap.

16	16 bits per pixel in the resultant bitmap

24	24 bits per pixel in the resultant bitmap

32	32 bits per pixel in the resultant bitmap

48	48 bits per pixel in the resultant bitmap

64	64 bits per pixel in the resultant bitmap


iLayer Parameter For LoadLayer
iLayer

Index of the layer to load. This index is zero-based. Pass 0 to load the first layer, 1 to load the second layer, etc.


Return for LoadLayer
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


LoadMemory method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short LoadMemory (OLE_HANDLE hMem, short iBitsPerPixel, long lPage, long lPages, long iSize);

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Loads an image from a file that is stored in memory. The file can be in any supported image file format and bits per pixel, whether compressed or uncompressed.

For supported formats, refer to Summary of All Supported Image File Formats.

To load an image from a file in memory, use one of the following methods:

LoadMemory—use this for a global handle to the file in memory

LoadArray—use this for a VARIANT byte array that contains the file in memory

LoadBuffer—use this for an address of a memory location that contains the file in memory

To save an image to a memory file, use one of the following methods:

SaveMemory—returns a global handle to a file in memory

SaveArray—returns a VARIANT byte array that contains the file in memory

SaveBuffer—saves a file into a memory location that the user allocates

Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

For a list of available products, refer to Summary of LEADTOOLS Products.

To get information about a file stored in memory, refer to the GetMemoryInfo method. To save an image to a file in memory, refer to the SaveMemory method.

Note: You cannot save a multipage file using the SaveMemory method, but if you get a multipage file into memory in some other way, you can use the LoadMemory method to load a specific page from the file.

See Also

Elements	Load method, LoadStamp method, BitmapDataPath property, StartFeedLoad method, LoadInfo event, EnableProgressEvent property, SetLoadResolution method, PCDResolution property, WMFResolution property

Topics	Raster Images: Loading Files


hMem Parameter For LoadMemory
hMem

A global handle (HGLOBAL) to the file in memory. If you use the SaveMemory method to create the file in memory, that method updates your handle and buffer size variables. Otherwise, your code must update and pass the appropriate variables.


iBitsPerPixel Parameter For LoadMemory
iBitsPerPixel

Resulting bitmap pixel depth. The following are valid values:

Value	Meaning

0	Keep the original file's pixel depth (Do not convert). A special note about loading 12 and 16-bit grayscale images.

1	1 bit per pixel in the resultant bitmap

4	4 bits per pixel in the resultant bitmap

8	8 bits per pixel in the resultant bitmap

12	12 bits per pixel in the resultant bitmap

16	16 bits per pixel in the resultant bitmap

24	24 bits per pixel in the resultant bitmap

32	32 bits per pixel in the resultant bitmap


lPage Parameter For LoadMemory
lPage

The page number of the image, if the file is in a multipage file.

GIF, TIFF (MPT), and PCX (DCX) files can be multipage files (containing more than one image). If you set the value to the page number of an image in the file, this method provides information about the specified image.

If the file is not a multipage file, pass 0.


lPages Parameter For LoadMemory
lPages

The number of pages to load. To load all pages in a multi-page file, pass -1. If the file is not a multi-page file, pass 1.


iSize Parameter For LoadMemory
iSize

The size in bytes of the file referenced by hMem. If you use the SaveMemory method to create the file in memory, that method updates your handle and buffer size variables. Otherwise, your code must update and pass the appropriate variables.


Return for LoadMemory
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


LoadResize method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short LoadResize (BSTR pszName, float fWidth, float fHeight, short iFlags, short iBitsPerPixel);

Overview	Refer to Loading a Bitmap from a File.

Remarks

Loads an image file into the LEAD control, resizing the bitmap as it loads, to the desired width, height, and bits per pixel. The file can be in any supported image file format and bits per pixel, whether compressed or uncompressed.

This method resizes a file as it loads, to the desired width, height, and bits per pixel. Note that the original file is not completely loaded into memory. This method is ideal for sampling large images (i.e. generating a thumbnail) without the memory overhead of loading the large file itself.

See Also

Elements	Load method

Topics	Raster Images: Loading Files


pszName Parameter For LoadResize
pszName

String containing the name of the file to load.


fWidth Parameter For LoadResize
fWidth

New width of the image. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For LoadResize
fHeight

New height of the image. The unit of measure is determined by the ScaleMode property.


iFlags Parameter For LoadResize
iFlags

Flag that indicates the type of resizing to use. Possible values are:

Value	Meaning

RESIZE_NORMAL	[0x0] Normal resizing.

RESIZE_RESAMPLE	[0x2] Linear interpolation resizing.

RESIZE_BICUBIC	[0x4] Bicubic interpolation resizing.


iBitsPerPixel Parameter For LoadResize
iBitsPerPixel

Resulting bitmap pixel depth. The following are valid values:

Value	Meaning

0	Keep the original file's pixel depth (Do not convert). A special note about loading 12 and 16-bit grayscale images.

1 to 8	The specified bits per pixel in the resultant bitmap

12	12 bits per pixel in the resultant bitmap.

16	16 bits per pixel in the resultant bitmap

24	24 bits per pixel in the resultant bitmap

32	32 bits per pixel in the resultant bitmap

48	48 bits per pixel in the resultant bitmap

64	64 bits per pixel in the resultant bitmap


Return for LoadResize
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


LoadResolutionCount property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short LoadResolutionCount

Overview	Refer to Implementing PhotoCD and FlashPix Features.

Remarks

The number of available resolutions in the specified PhotoCD, FlashPix, or JBIG file.

The ReadLoadResolutions method updates this property.

The GetLoadResolution method can also update this property, setting it to 1.

See Also

Elements	ReadLoadResolutions method, LoadResolutionHeight property, LoadResolutionWidth property, PCDRes property, SetLoadResolution method, GetLoadResolution method, SaveResolutionCount property, SaveResolutionHeight property, SaveResolutionWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


LoadResolutionHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float LoadResolutionHeight (short iIndex);

Overview	Refer to Implementing PhotoCD and FlashPix Features.

Remarks

Is the height component in an array that specifies the available dimensions in a PhotoCD, FlashPix, or JBIG file.

The ReadLoadResolutions method updates this property. The LoadResolutionCount property specifies the number of available dimensions.

The GetLoadResolution method can also update this property with the current value for loading a file.

See Also

Elements	ReadLoadResolutions method, LoadResolutionCount property, LoadResolutionWidth property, PCDRes property, SetLoadResolution method, GetLoadResolution method, SaveResolutionCount property, SaveResolutionHeight property, SaveResolutionWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


iIndex Parameter For LoadResolutionHeight
iIndex

The index into the array. The first element of the array is 0. The last element of the array is one less than the value of the LoadResolutionCount property.


LoadResolutionWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float LoadResolutionWidth (short iIndex);

Overview	Refer to Implementing PhotoCD and FlashPix Features.

Remarks

Is the height component in an array that specifies the available dimensions in a PhotoCD, FlashPix, or JBIG file.

The ReadLoadResolutions method updates this property. The LoadResolutionCount property specifies the number of available dimensions.

The GetLoadResolution method can also update this property with the current value for loading a file.

See Also

Elements	ReadLoadResolutions method, LoadResolutionCount property, LoadResolutionHeight property, PCDRes property, SetLoadResolution method, GetLoadResolution method, SaveResolutionCount property, SaveResolutionHeight property, SaveResolutionWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


iIndex Parameter For LoadResolutionWidth
iIndex

The index into the array. The first element of the array is 0. The last element of the array is one less than the value of the LoadResolutionCount property.


LoadStamp method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short LoadStamp (BSTR pszName);

Overview	Refer to Loading a Bitmap from a File.

Remarks

Loads a thumbnail image stored in a JFIF or LEAD CMP compressed file.

Note that not all CMP or JFIF compressed files contain thumbnail images.

See Also

Elements	SaveWithStamp method, FileOpen method, EnableProgressEvent property, PCDResolution property, SetLoadResolution method, WMFResolution property

Topics	Raster Images: Loading Files
Raster Images: Loading and Saving Stamp Images


pszName Parameter For LoadStamp
pszName

Character string containing the JPEG or LEAD CMP compressed file name.


Return for LoadStamp
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


LoadSigned property
LoadSigned property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL LoadSigned

Overview	Refer to Loading a Bitmap from a File

Remarks

Indicates how to load files with signed bitmap data. Possible values are:

Value	Meaning

TRUE	Do not automatically convert signed images before loading.

FALSE	Automatically convert signed images to unsigned at load time.

LEADTOOLS automatically converts signed images to unsigned by setting the negative pixels to 0.

If this property is TRUE, the signed image should be converted by calling the ConvertSignedToUnsigned method. If signed images are not converted, the images may not be painted properly and the image processing methods will not perform correctly.

To determine whether a bitmap is signed or not, check the IsSigned property.

See Also

Elements	IsSigned property, ConvertSignedToUnsigned method

Topics	Raster Images: Loading Images
Examining and Altering Bitmaps


LoadStamp property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL LoadStamp

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Flag indicating whether or not to attempt to load stamps from file formats that support preview images, such as JPEG and LEAD CMP.

Default setting is True.

See Also

Elements	BrowseDir method, ThumbnailWidth property, ThumbnailHeight property, MaintainAspect property, ThumbnailBackgroundColor property, ForceSize property, Resample property

Topics	Raster Images: Using the Thumbnail Browser


LoadUseViewPerspective property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL LoadUseViewPerspective

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Document/Medical only, persistent property, available at design time) Determines whether a bitmap with a rotated view perspective keeps its internal orientation when it is loaded.

Note: This property does not affect the orientation of the displayed image. You do not have to account for view perspective in the ActiveX unless you call certain LEADTOOLS DLL functions, which are noted in the LEADTOOLS API documentation.

This property is most useful if you want to retain the existing view perspective when loading TIFF images that are stored with a rotated view perspective. Setting this property to TRUE may speed the loading of a file that contains a rotated image. After an image is loaded, the rotated view perspective may slow down other operations.

Setting	Description

TRUE	Keep the bitmap's rotated view perspective when loading.

FALSE	If a bitmap in a file has a rotated view perspective, convert the internal data to a top-left orientation when loading.

See Also

Topics	Raster Images: Loading Files


MagGlass event (Main Control)

This event is now obsolete.  To achieve the same functionality, use the MagGlass event.


MagGlassCursor event (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	void MagGlassCursor ();

Overview	Refer to Using the Magnifying Glass

Remarks

Occurs when the left mouse button is not pressed when the magnifying glass is working in Manual Update mode (i.e. when the MAGGLASS_MANUAL_UPDATE flag is set in the MagGlassFlags property).

This event occurs to let the user set a Magnifying Glass cursor to the Main Control’s window while the left mouse button is not pressed.

See Also

Elements	MagGlassFlags property, StartMagGlass method, StopMagGlass method, ShowMagGlass method, SetMagGlassPos method

Topics	Raster Images: Displaying Images


MagGlassExt event (Main Control)
MagGlass event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void MagGlass (long nMaskPlaneStart, long nMaskPlaneEnd, VARIANT vMaskPlane);

Overview	Refer to Using the Magnifying Glass

Remarks

This event is triggered for each WM_LBUTTONDOWN, WM_MOUSEMOVE and WM_LBUTTONUP message received by the window to which the magnifying glass is attached. This event is triggered only if the EnableMagGlassEvent property is set to TRUE.

After calling the StartMagGlass method, LEADTOOLS will monitor the window's messages, looking for mouse messages, and processing them by displaying a "Magnifying Glass". If the MagGlass event has been enabled by setting the EnableMagGlassEvent property to TRUE, information about the non-updated parts of the bitmap can be obtained from the vMaskPlane parameter passed to this event. This event receives information when the left mouse button is pressed or released and when the mouse is moved while the left mouse button is pressed. This information can be used with LEADTOOLS Internet methods, available only in the Multimedia/Internet toolkits, to get pixel values for the non-updated parts of the bitmap. Once this information is received, it can be passed to the UpdateMagGlass method to update the Magnifying Glass's zoomed display area.

If the MagGlassExt event has been enabled by setting the EnableMagGlassEvent property to TRUE, the UpdateMagGlass method must be called in order to paint the zoomed image in the Magnifying Glass display area.

See Also

Elements	EnableMagGlassEvent property, StartMagGlass method, StopMagGlass method, UpdateMagGlass method

Topics	Raster Images: Displaying Images


nMaskPlaneStart Parameter For MagGlassExt
nMaskPlaneStart

The start position of the mask plane array.


nMaskPlaneEnd Parameter For MagGlassExt
iMaskPlaneEnd

The end position of the mask plane array.


hMaskPlane Parameter For MagGlassExt
vMaskPlane

An array of bit flags which represent a mask plane. This array works as a plane for the parts of the bitmap that are not yet updated.


MagGlassFlags property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short MagGlassFlags

Overview	Refer to Using the Magnifying Glass

Remarks

Flags that controls two behaviors of the Magnifying Glass:

1.	Flags that indicate which colors in the zoomed image will be displayed and which colors will be masked. Possible values are:

Value	Meaning

MAGGLASS_MASK_NORMAL	[0x0000] Works in two ways:

1. When this flag is set without setting MAGGLASS_MASK_FROM_REGION flag, then only those colors present in the MagGlassMask property will be masked in the Magnifying Glass display area. All other colors will be displayed.

2. When this flag is set in combination with setting MAGGLASS_MASK_FROM_REGION flag, then the colors present in the MagGlassMask property will be ignored and only the bitmap region colors will be masked in the Magnifying Glass display area. All other colors will be displayed.

MAGGLASS_MASK_INVERT	[0x0001] Works in two ways:

1. When this flag is set without setting MAGGLASS_MASK_FROM_REGION flag, then only those colors present in the MagGlassMask property will be displayed in the Magnifying Glass display area. All other colors will be masked.

2. When this flag is set in combination with setting MAGGLASS_MASK_FROM_REGION flag, then the colors present in the MagGlassMask property will be ignored and only the bitmap region colors will be displayed in the Magnifying Glass display area. All other colors will be masked.

MAGGLASS_MASK_FROM_REGION	[0x0004] Works only if the Bitmap has a region, LEADTOOLS will get all colors from this region and either masks or displays these colors according to MAGGLASS_MASK_NORMAL and MAGGLASS_MASK_INVERT flags.

Note:	This feature that is provided by this flag works ideally with rectangle regions since LEADTOOLS gets the bounding rectangle of the Bitmap region then gets all the colors of this rectangle.

2.	Flags that enable/disable the manual update of the Magnifying Glass. The only possible value:

Value	Meaning

MAGGLASS_MANUAL_UPDATE	[0x0002] When this flag is set, LEADTOOLS will not handle the mouse events in order to manipulate the Magnifying Glass, it becomes the user’s responsibility to control the Magnifying Glass by using the ShowMagGlass and SetMagGlassPos methods.

See Also

Elements	MagGlassMask property, MagGlassMaskCount property, MagGlassCursor event, StartMagGlass method, StopMagGlass method, ShowMagGlass method, SetMagGlassPos method

Topics	Raster Images: Displaying Images


MagGlassMask property (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	OLE_COLOR MagGlassMask (short iIndex);

Overview	Refer to Using the Magnifying Glass

Remarks

Array that specifies the color(s) to mask out of the zoomed magnifying glass display.

Allocate this array by setting the MagGlassMaskCount property.

See Also

Elements	MagGlassMaskCount property

Topics	Raster Images: Displaying Images


iIndex Parameter For MagGlassMask
iIndex

Position within the array.


MagGlassMaskCount property (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short MagGlassMaskCount

Overview	Refer to Using the Magnifying Glass

Remarks

The number of entries in the MagGlassMask property array.

Allocate the MagGlassMask property array by setting this property.

See Also

Elements	MagGlassMask property

Topics	Raster Images: Displaying Images


MagGlassPaintContrast property (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short MagGlassPaintContrast

Overview	Refer to Using the Magnifying Glass

Remarks

(Persistent property, available at design time) Contrast correction value used by Magnifying Glass when it paints the zoomed display area.

Setting the Magnifying Glass contrast value that is used by the Magnifying Glass lets you adjust the displayed contrast of the zoomed display area without changing the bitmap data.

Possible values range from -1000 to +1000. A positive value increases the contrast of the zoomed display area. A negative value decreases the contrast of the zoomed display area.

See Also

Elements	MagGlassPaintGamma property, MagGlassPaintIntensity property, StartMagGlass method, StopMagGlass method

Topics	Raster Images: Displaying Images


MagGlassPaintGamma property (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short MagGlassPaintGamma

Overview	Refer to Using the Magnifying Glass

Remarks

(Persistent property, available at design time) Gamma correction value used by Magnifying Glass when it paints the zoomed display area.

Setting the Magnifying Glass gamma correction that is used by the Magnifying Glass lets you adjust the displayed brightness of the zoomed display area without changing the bitmap data.

Intensity values ideally follow a logarithmic progression, because the eye perceives changes in intensity as being equal when the ratio of change is equal. For example, we would see a change from 0.1 to 0.2 as being equal to a change from 0.2 to 0.4.

Gamma is a standard constant that is used to calculate the progression. For most CRTs the gamma constant is in the range of 2.2 to 2.5.

Because this property is an unsigned integer, it is 100 times the actual gamma value. For example, use 235 to set a gamma value of 2.35.

See Also

Elements	MagGlassPaintContrast property, MagGlassPaintIntensity property, StartMagGlass method, StopMagGlass method

Topics	Raster Images: Displaying Images


MagGlassPaintIntensity property (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short MagGlassPaintIntensity

Overview	Refer to Using the Magnifying Glass

Remarks

(Persistent property, available at design time) Intensity correction value used by Magnifying Glass when it paints the zoomed display area.

Setting the Magnifying Glass intensity value that is used by the Magnifying Glass lets you adjust the displayed brightness of the zoomed display area without changing the bitmap data.

Possible values range from -1000 to +1000. A positive value lightens the zoomed display area. A negative value darkens the zoomed display area.

See Also

Elements	MagGlassPaintContrast property, MagGlassPaintGamma property, StartMagGlass method, StopMagGlass method

Topics	Raster Images: Displaying Images


MaintainAspect property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL MaintainAspect

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Flag indicating if aspect ratio of the image should be maintained when generating thumbnails.  When set to TRUE, the generated thumbnail's width and height will not match both ThumbnailWidth and ThumbnailHeight if the original aspect ratio was not the same as the ratio between ThumbnailWidth and ThumbnailHeight.  If you desire the thumbnail be generated with exactly the requested width and height while still maintaining, aspect ratio of the actual image, set both MaintainAspect and ForceSize to True.

Default setting is True.

See Also

Elements	BrowseDir method, ThumbnailWidth property, ThumbnailHeight property, ForceSize property, ThumbnailBackgroundColor property, Resample property

Topics	Raster Images: Using the Thumbnail Browser


MaskCoder property (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	MRCMaskCoderConstants MaskCoder

Overview	Refer to Working with MRC Bitmap.

Remarks

(persistent property, available at design time) Indicates the mask compression used when saving a T44 file.  Possible values are:

Value	Meaning

MRC_MASK_COMPRESSION_FAX_G4	[0x01] Fax group 4 compression.

MRC_MASK_COMPRESSION_FAX_G3_1D	[0x02] Fax group 3 (1D) compression.

MRC_MASK_COMPRESSION_FAX_G3_2D	[0x03]. Fax group 3 (2D) compression.

MRC_MASK_COMPRESSION_JBIG	[0x04] JBIG compression.

See Also

Elements	Save method, SaveT44 method

Topics	MRC Bitmap Functions: Saving a Page


MaskTable property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short MaskTable (short iIndex);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Lookup table that identifies the valid values in the HTable. This is one of the four tables that the RemapHue method uses to change the bitmap's hue, saturation and value. Hue, Saturation, and Value levels range from 0 to 255.  Therefore, the lookup tables each have 256 entries. The current hue, saturation and value of a pixel correspond to the table indexes. If the bUseMaskTable parameter is set to TRUE when the RemapHue method is called, then this table is used to identify which values in the HTable property are valid. If MaskTable(i) is non-zero, then HTable(i) is to be used. If MaskTable(i) is 0 then HTable(i) is ignored.

See Also

Elements	RemapHue method, HTable property, STable property, VTable property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Modifying Intensity Values


iIndex Parameter For MaskTable
iIndex

The index into the array. The first element of the array is 0. The values present in this array identify which values in the HTable property are valid.


MaskTableL property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short MaskTable (long lIndex);

Overview	Refer to Changing Brightness and Contrast.

Remarks

(Document/Medical only) Lookup table that identifies the valid values in the HTableL property. This is one of the four tables that the RemapHue method uses to change the bitmap's hue, saturation and value. Hue, Saturation, and Value levels range from 0 to 255.  The current hue, saturation and value of a pixel correspond to the table indexes. If the bUseMaskTable parameter is set to TRUE when the RemapHue method is called and the RemapHueTablesSize property is set to 65536, then this table is used to identify which values in the HTableL property are valid. If MaskTableL(i) is non-zero, then HTableL(i) is to be used. If MaskTableL(i) is 0 then HTableL(i) is ignored.

This property provides support for 16-bit grayscale and 48-bit color images. Support for 16-bit grayscale and 48-bit color images is provided only in Document/Medical toolkits.

See Also

Elements	RemapHue method, HTableL property, STableL property, VTableL property, HTable property, STable property, VTable property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Modifying Intensity Values


lIndex Parameter For MaskTableL
lIndex

The index into the array. The first element of the array is 0. The values present in this array identify which values in the HTableL property are valid.


MaxBit property (Main Control)

Visual Basic example    Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short MaxBit

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Medical Imaging only) (Read Only) Gets the maximum bit value of the pixels in the image.  For example, in a 12-bit grayscale image MaxBit would be <= 11 and MinBit would be >= 0.  This value is not affected by LevelLowBit property or LevelHighBit property.

This value is only valid after calling GetMinMaxBits method.

The MinBit, MaxBit, MinVal and MaxVal values are useful for setting up the LevelLUT property for remapping to a user palette.

See Also

Elements	GetMinMaxBits method, MinBit property, LevelLowBit property, LevelHighBit property, WindowLevel method, MinVal, MaxVal

Topics	Raster Images: Palettes


MaxFilter method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short MaxFilter (short iDim);

Overview	Refer to Removing Noise.

Remarks

(Document/Medical only) Erodes dark objects by the amount that you specify.

This is a more controlled version of the omni-directional erosion filter that you can set with the BinaryFilter method.

You control the effect by specifying the size of the neighborhood that is used for calculating each pixel value. For example, for 8x8, pass 8 in the iDim parameter. Each pixel is replaced with the maximum value of its neighborhood.

See Also

Elements	MinFilter method, BinaryFilter method , GetChange method

Topics	Raster Images: Filtering Images


iDim Parameter For MaxFilter
iDim

Dimensions of the neighborhood used for filtering (iDim x iDim), in pixels.


Return for MaxFilter
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


MaxSizeDisk property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long MaxSizeDisk

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) This value specifies the filesize limit of files for which the thumbnail browser will attempt to load.

Set this to 0 to indicate there should be no filesize limit.

This defaults to 0.

See Also

Elements	BrowseDir method, MaxSizeMem property, InfoSizeDisk property, InfoSizeMem property

Topics	Raster Images: Using the Thumbnail Browser


MaxSizeMem property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long MaxSizeMem

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) This value specifies the limit of the required memory to load an image for images that the thumbnail browser will attempt to load.

Set this to 0 to indicate there should be no memory size limit.

This defaults to 0.

See Also

Elements	BrowseDir method, MaxSizeMem property, InfoSizeDisk property, InfoSizeMem property

Topics	Raster Images: Using the Thumbnail Browser


MaxVal property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long MaxVal

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Document/Medical only) (Read Only) Gets the maximum intensity value of the pixels in the image.  This value is not affected by LevelLowBit property or LevelHighBit property.

This value is only valid after calling GetMinMaxVal method.

The MinBit, MaxBit, MinVal and MaxVal values are useful for setting up the LevelLUT property for remapping to a user palette.

See Also

Elements	GetMinMaxVal method, MinVal property, LevelLowBit property, LevelHighBit property, WindowLevel method, MinBit, MaxBit

Topics	Raster Images: Palettes


Median method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Median (short iDim);

Overview	Refer to Removing Noise.

Remarks

Changes the color of each pixel in the bitmap to the median color of pixels in its neighborhood. This is similar to the Average method, but it is used for noise reduction, rather than a blur effect.

You control the effect by specifying the size of the neighborhood that is used for calculating the median value. For 8x8, pass 8 in the iDim parameter.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

If the bitmap has a region, this method works only on the region. If the bitmap does not have a region, this method works on the entire bitmap.

See Also

Elements	GetChange method

Topics	Raster Images: Filtering Images
Raster Images: Where the Region Preempts the Bitmap


iDim Parameter For Median
iDim

Dimensions of the neighborhood used for filtering (iDim x iDim), in pixels.


Return for Median
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


MinBit property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short MinBit

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Medical Imaging only) (Read Only) Gets the minimum bit value of the pixels in the image.  For example, in a 12-bit grayscale image MaxBit would be <= 11 and MinBit would be >= 0.  This value is not affected by LevelLowBit property or LevelHighBit property.

This value is only valid after calling GetMinMaxBits method.

The MinBit, MaxBit, MinVal and MaxVal values are useful for setting up the LevelLUT property for remapping to a user palette.

See Also

Elements	GetMinMaxBits method, MaxBit property, LevelLowBit property, LevelHighBit property, WindowLevel method, MinVal, MaxVal

Topics	Raster Images: Palettes


MinFilter method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short MinFilter (short iDim);

Overview	Refer to Removing Noise.

Remarks

(Document/Medical only) Dilates dark objects by the amount that you specify.

This is a more controlled version of the omni-directional dilation filter that you can set with the BinaryFilter method.

You control the effect by specifying the size of the neighborhood that is used for calculating each pixel value. For example, for 8x8, pass 8 in the iDim parameter. Each pixel is replaced with the minimum value of its neighborhood.

This method can process the whole image or a region of the image.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	MaxFilter method, BinaryFilter method , GetChange method

Topics	Raster Images: Filtering Images


iDim Parameter For MinFilter
iDim

Dimensions of the neighborhood used for filtering (iDim x iDim), in pixels.


Return for MinFilter
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


MinVal property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long MinVal

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Document/Medical only) (Read Only) Gets the minimum intensity value of the pixels in the image.  This value is not affected by LevelLowBit property or LevelHighBit property.

This value is only valid after calling GetMinMaxVal method.

The MinBit, MaxBit, MinVal and MaxVal values are useful for setting up the LevelLUT property for remapping to a user palette.

See Also

Elements	GetMinMaxVal method, MaxVal property, LevelLowBit property, LevelHighBit property, WindowLevel method, MinBit, MaxBit

Topics	Raster Images: Palettes


Mosaic method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Mosaic (short iDim);

Overview	Refer to Applying Artistic Effects.

Remarks

Imposes a mosaic effect on the bitmap by dividing the bitmap into tiles of a specified size and changing the color of all pixels in each tile to the average color of pixels within the tile.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	GetChange method

Topics	Raster Images: Filtering Images
Raster Images: Where the Region Preempts the Bitmap


iDim Parameter For Mosaic
iDim

Dimensions of the tiles (iDim x iDim), in pixels.


Return for Mosaic
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


MotionBlur method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short MotionBlur(short iDim, long lAngle, BOOL bUnidirectional);

Overview	Refer to Applying Artistic Effects.

Remarks

Applies a filter, which creates the illusion of movement in an image.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Sharpen method, Posterize method, Mosaic method, Emboss method, Median method, AddNoise method, IntensityDetect method, SpatialFilter method, BinaryFilter method, MaxFilter method, MinFilter method, Oilify method, Solarize method, WindowLevel method

Topics	Raster Images: Filtering Images


iDim Parameter For MotionBlur
iDim

Size of the blur effect, in pixels.


lAngle Parameter For MotionBlur
lAngle

Value that represents the direction of the motion, in hundredths of a degree (+/-) This value can be a number from 1 to 36000. If the value is positive, the motion will be clockwise. If the value is negative, the motion is counter-clockwise.


bUnidirectional Parameter For MotionBlur
bUnidirectional

Flag that indicates whether the motion extends only in one direction. Possible values are:

Value	Meaning

TRUE	The motion blur effect is only in the direction specified in lAngle.

FALSE	The motion blur effect is along the line with that angle. For example, if lAngle is 0, the blur effect will occur in the 0 degree direction and the 180 degree direction.


Return for MotionBlur
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


MouseDown event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void MouseDown (short Button, short Shift, float x, float y);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when the user presses a mouse button.

See Also

Elements	Resize event, Click event, DblClick event, KeyPress event, KeyDown event, KeyUp event, MouseMove event, MouseUp event, Scroll event

Topics	Raster Images: Displaying Images


Button Parameter For MouseDown
Button

An integer that identifies the button that was pressed to cause the event. The following are possible values:

Value	Meaning

1	left button

2	right button


Shift Parameter For MouseDown
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. The following are possible values:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


x Parameter For MouseDown
x

The X coordinate of the mouse pointer relative to the origin of the ImageList Control. The unit of measure is determined by the ScaleMode.


x Parameter For MouseDown
y

The Y coordinate of the mouse pointer relative to the origin of the ImageList Control. The unit of measure is determined by the ScaleMode.


MouseDown event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void MouseDown (short Button, short Shift, OLE_XPOS_PIXELS X, OLE_YPOS_PIXELS Y);

Overview	Refer to Detecting Events.

Remarks

Occurs when the user presses a mouse button.

See Also

Elements	Click event, DblClick event, MouseMove event, MouseUp event

Topics	Working with the Control: General Behavior
Working with the Control: Client Area Usage


Button Parameter For MouseDown
Button

An integer that identifies the button that was pressed to cause the event. The following are possible values:

Value	Meaning

1	left button

2	right button


Shift Parameter For MouseDown
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. The following are possible values:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


X Parameter For MouseDown
X

The X coordinate of the mouse pointer relative to the origin of the Main Control. The unit of measure is determined by the form that contains the Main Control.


Y Parameter For MouseDown
Y

The Y coordinate of the mouse pointer relative to the origin of the Main Control. The unit of measure is determined by the form that contains the Main Control.


MouseIcon property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	IPictureDisp* MouseIcon

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Sets a custom mouse icon.

You can set this property to a cursor or icon file. Then, you can set the MousePointer property to 99 to implement the custom mouse icon.

See Also

Elements	MousePointer property

Topics	Raster Images: Displaying Images


MouseIcon property (Main Control)

Visual Basic example   Other systems   Visual J++ example

Syntax	IPictureDisp* MouseIcon

Overview	Refer to Miscellaneous Methods and Properties.

Remarks

(Persistent property, available at design time) Sets a custom mouse icon.

You can set this property to a cursor or icon file. Then, you can set the MousePointer property to 99 to implement the custom mouse icon.

See Also

Elements	MousePointer property

Topics	Working with the Control: General Behavior
Working with the Control: Client Area Usage


MouseMove event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void MouseMove (short Button, short Shift, float x, float y);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when the user moves the mouse over the ImageList Control.

See Also

Elements	Resize event, Click event, DblClick event, KeyPress event, KeyDown event, KeyUp event, MouseDown event, MouseUp event, Scroll event

Topics	Raster Images: Displaying Images


Button Parameter For MouseMove
Button

An integer that identifies any buttons that were pressed when the user moved the mouse. The following are possible values:

Value	Meaning

1	left button

2	right button


Shift Parameter For MouseMove
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. The following are possible values:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


x Parameter For MouseMove
x

The X coordinate of the mouse pointer relative to the origin of the ImageList Control. The unit of measure is determined by the ScaleMode.


x Parameter For MouseMove
y

The Y coordinate of the mouse pointer relative to the origin of the ImageList Control. The unit of measure is determined by the ScaleMode.


MouseMove event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void MouseMove (short Button, short Shift, OLE_XPOS_PIXELS X, OLE_YPOS_PIXELS Y);

Overview	Refer to Detecting Events.

Remarks

Occurs when the user moves the mouse over the Main Control.

See Also

Elements	Click event, DblClick event, MouseDown event, MouseUp event

Topics	Working with the Control: General Behavior
Working with the Control: Client Area Usage


Button Parameter For MouseMove
Button

An integer that identifies any buttons that were pressed when the user moved the mouse. The following are possible values:

Value	Meaning

1	left button

2	right button


Shift Parameter For MouseMove
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. The following are possible values:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


X Parameter For MouseMove
X

The X coordinate of the mouse pointer relative to the origin of the Main Control. The unit of measure is determined by the form that contains the Main Control.


Y Parameter For MouseMove
Y

The Y coordinate of the mouse pointer relative to the origin of the Main Control. The unit of measure is determined by the form that contains the Main Control.


MousePointer property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short MousePointer

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Sets or returns the value that indicates the type of mouse pointer for the ImageList Control.

Setting	Meaning

0	(Default) Shape determined by the object

1	Arrow

2	Cross-hair

3	I-Beam

4	Small square within a square

5	Four-pointed arrow pointing north, south, east, and west

6	Double arrow pointing northeast and southwest

7	Double arrow pointing north and south

8	Double arrow pointing northwest and southeast

9	Double arrow pointing west and east

10	Up Arrow

11	Hourglass (wait)

12	No Drop

13	Arrow and hourglass

14	Arrow and question mark

15	Size all

99	Custom icon specified by the MouseIcon property

See Also

Elements	MouseIcon property

Topics	Raster Images: Displaying Images


OLEDragCursor property (ImageList Control)

Visual Basic example	Visual C++ example
Syntax	IPictureDisp* OLEDragCursor;
Overview	Refer to Drag and Drop.
Remarks

(Persistent property, available at design time) Gets or sets a custom mouse icon for the OLE drag-and-drop operation.

To use a custom mouse icon for the Drag and Drop operation, set this property to the desired icon and set the EnableUseDefaultCursor property to FALSE.

See Also

Elements	EnableUseDefaultCursor property, EnableOLEDragMethod property, OLEStartDrag event, OLECompleteDrag event, OLEDragOver event, OLEGiveFeedback event
Topics	Raster Images: Copying Images


MousePointer property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short MousePointer

Overview	Refer to Miscellaneous Methods and Properties.

Remarks

(Persistent property, available at design time) Sets or returns the value that indicates the type of mouse pointer for the Main Control.

Setting	Meaning

0	(Default) Shape determined by the object

1	Arrow

2	Cross-hair

3	I-Beam

4	Small square within a square

5	Four-pointed arrow pointing north, south, east, and west

6	Double arrow pointing northeast and southwest

7	Double arrow pointing north and south

8	Double arrow pointing northwest and southeast

9	Double arrow pointing west and east

10	Up Arrow

11	Hourglass (wait)

12	No Drop

13	Arrow and hourglass

14	Arrow and question mark

15	Size all

99	Custom icon specified by the MouseIcon property

See Also

Elements	MouseIcon property

Topics	Working with the Control: General Behavior
Working with the Control: Client Area Usage


MouseUp event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void MouseUp (short Button, short Shift, float x, float y);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when the user releases a mouse button.

See Also

Elements	Resize event, Click event, DblClick event, KeyPress event, KeyDown event, KeyUp event, MouseMove event, MouseDown event, Scroll event

Topics	Raster Images: Displaying Images


Button Parameter For MouseUp
Button

An integer that identifies the button that was pressed to cause the event. The following are possible values:

Value	Meaning

1	left button

2	right button


Shift Parameter For MouseUp
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. The following are possible values:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


x Parameter For MouseUp
x

The X coordinate of the mouse pointer relative to the origin of the ImageList Control. The unit of measure is determined by the ScaleMode property.


x Parameter For MouseUp
y

The Y coordinate of the mouse pointer relative to the origin of the ImageList Control. The unit of measure is determined by the ScaleMode property.


OLECompleteDrag event (ImageList Control)

Visual Basic example	Visual C++ example
Syntax	void OLECompleteDrag (short Button, short Shift, long X, long Y);
Overview	Refer to Drag and Drop
Remarks

Occurs when the dragging operation is complete and the image is dropped.

See Also

Elements	EnableOLEDragMethod property, OLEDragCursor property, OLEStartDrag event, OLEDragOver event, OLEGiveFeedback event, EnableUseDefaultCursor property
Topics	Raster Images: Copying Images


Button Parameter For OLECompleteDrag
Button

Value that represents the button that caused the event. Possible values are:

Value	Meaning

1	Left mouse button


Shift Parameter For OLECompleteDrag
Shift

Value that indicates which of the ALT, CTRL, and SHIFT keys are down when the button specified in the Button parameter causes the event. Possible values are:

Value	Meaning

1	SHIFT key

2.	CTRL key

3	CTRL/SHIFT keys

4	ALT key

5	ALT/SHIFT keys

6	CTRL/ALT keys

7	CTRL/ALT/SHIFT keys


X Parameter For OLECompleteDrag
X

X coordinate of the mouse pointer relative to the origin of the ImageList control. The unit of measure is determined by the ScaleMode property.


Y Parameter For OLECompleteDrag
Y

Y coordinate of the mouse pointer relative to the origin of the ImageList control. The unit of measure is determined by the ScaleMode property.


OLEDragOver event (ImageList Control)

Visual Basic example	Visual C++ example
Syntax	void OLEDragOver (short Button, short Shift, long X, long Y);
Overview	Refer to Drag and Drop
Remarks

Occurs repeatedly while dragging an image over the ImageList control. It also provides the ImageList control with feedback pertaining to the cursor position and the button used in the drag and drop process.

See Also

Elements	EnableOLEDragMethod property, OLEDragCursor property, OLEStartDrag event, OLECompleteDrag event, OLEGiveFeedback event, EnableUseDefaultCursor property
Topics	Raster Images: Copying Images


Button Parameter For OLEDragOver
Button

Value that represents the button used in the dragging process, which causes the event. Possible values are:

Value	Meaning

1	Left mouse button


Shift Parameter For OLEDragOver
Shift

Value that indicates which of the ALT, CTRL, and SHIFT keys are down when the button specified in the Button parameter is pressed. Possible values are:

Value	Meaning

1	SHIFT key

2.	CTRL key

3	CTRL/SHIFT keys

4	ALT key

5	ALT/SHIFT keys

6	CTRL/ALT keys

7	CTRL/ALT/SHIFT keys


X Parameter For OLEDragOver
X

X coordinate of the mouse pointer relative to the origin of the ImageList Control. The unit of measure is determined by the ScaleMode property.


Y Parameter For OLEDragOver
Y

Y coordinate of the mouse pointer relative to the origin of the ImageList Control. The unit of measure is determined by the ScaleMode property.


OLEGiveFeedback event (ImageList Control)

Visual Basic example	Visual C++ example
Syntax	void OLEGiveFeedback ();
Overview	Refer to Drag and Drop
Remarks

Occurs repeatedly while an image is being dragged over the ImageList control to determine the visual feedback for the drag-and-drop operation.

Note:	To use a custom cursor during the drag and drop process, set the OLEDragCursor property to the custom cursor and set the EnableUseDefaultCursor property to FALSE. Specify whether to use the default cursor or a custom cursor by setting the EnableUseDefaultCursor property within the OLEGiveFeedback event.
See Also

Elements	EnableOLEDragMethod property, OLEDragCursor property, OLEStartDrag event, OLECompleteDrag event, OLEDragOver event, EnableUseDefaultCursor property
Topics	Raster Images: Copying Images


OLEStartDrag event (ImageList Control)

Visual Basic example	Visual C++ example
Syntax	void OLEStartDrag (short Button, short Shift, long X, long Y);
Overview	Refer to Drag and Drop
Remarks

Occurs when the drag-and-drop operation starts, if a drop can be accepted. A drag and drop can be accepted if the EnableOLEDragMethod property has been set to TRUE. If the drag and drop operation fails, this event will not be generated.

To start the drag-and-drop operation:

1.	Set the EnableOLEDragMethod property to TRUE.
3.	Select an image in this Image List control.
4.	Press the left mouse button down on the same Image List Control and drag the selected image. The OLEStartDrag event will occur.
See Also

Elements	EnableOLEDragMethod property, OLEDragCursor property, OLECompleteDrag event, OLEDragOver event, OLEGiveFeedback event, EnableUseDefaultCursor property
Topics	Raster Images: Copying Images


Button Parameter For OLEStartDrag
Button

Value that represents the button that was pressed to cause the event. Possible values are:

Value	Meaning

1	Left mouse button


Shift Parameter For OLEStartDrag
Shift

Value that indicates which of the ALT, CTRL, and SHIFT keys are down when the button specified in the Button parameter is pressed. Possible values are:

Value	Meaning

1	SHIFT key

2.	CTRL key

3	CTRL/SHIFT keys

4	ALT key

5	ALT/SHIFT keys

6	CTRL/ALT keys

7	CTRL/ALT/SHIFT keys


X Parameter For OLEStartDrag
X

X coordinate of the mouse pointer relative to the origin of the ImageList control. The unit of measure is determined by the ScaleMode property.


Y Parameter For OLEStartDrag
Y

Y coordinate of the mouse pointer relative to the origin of the ImageList control. The unit of measure is determined by the ScaleMode property.


MouseUp event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void MouseUp (short Button, short Shift, OLE_XPOS_PIXELS X, OLE_YPOS_PIXELS Y);

Overview	Refer to Detecting Events.

Remarks

Occurs when the user releases a mouse button.

See Also

Elements	Click event, DblClick event, MouseDown event, MouseMove event

Topics	Working with the Control: General Behavior
Working with the Control: Client Area Usage


Button Parameter For MouseUp
Button

An integer that identifies the button that was released to cause the event. The following are possible values:

Value	Meaning

1	left button

2	right button


Shift Parameter For MouseUp
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is released. The following are possible values:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


X Parameter For MouseUp
X

The X coordinate of the mouse pointer relative to the origin of the Main Control. The unit of measure is determined by the form that contains the Main Control.


Y Parameter For MouseUp
Y

The Y coordinate of the mouse pointer relative to the origin of the Main Control. The unit of measure is determined by the form that contains the Main Control.


MouseWheel event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void MouseWheel (short nDelta, short Shift, long x, long y);

Overview	Refer to Detecting Events.

Remarks

Occurs when the user rotates or clicks the mouse wheel over the Raster View Control, if the EnableMouseWheel property has been set to TRUE.

See Also

Elements	EnableMouseWheel property, Click event, DblClick event, MouseDown event

Topics	Working with the Control: General Behavior
Working with the Control: Client Area Usage


nDelta Parameter For MouseWheel
nDelta

Value that indicates whether the mouse wheel rotated forward or backward. If this value is –120, the mouse wheel was rotated backward. If this value is 120, the Mouse Wheel was rotated forward.


Shift Parameter For MouseWheel
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is released. Possible values are:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


X Parameter For MouseWheel
X

The X coordinate of the mouse pointer relative to the origin of the Main Control. The unit of measure is determined by the form that contains the Main Control.


Y Parameter For MouseWheel
Y

The Y coordinate of the mouse pointer relative to the origin of the Main Control. The unit of measure is determined by the form that contains the Main Control.


OffsetRgn method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short OffsetRgn (float fDx, float fDy);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Moves the bitmap region a specified distance. The move does not affect the pixels in the region.

The distances are relative to the LEAD bitmap in memory, not to the Main Control's client area. The unit of measure is determined by the ScaleMode property.

See Also

Elements	SetRgnEllipse method, SetRgnRect method, SetRgnRoundRect method, SetRgnColor method, PolygonSize property

Topics	Raster Images: Creating and Using a Region


fDx Parameter For OffsetRgn
fDx

The distance left (negative) or right (positive) to shift the region.


fDy Parameter For OffsetRgn
fDy

The distance up (negative) or down (positive) to shift the region.


Return for OffsetRgn
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Oilify method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Oilify (short iDim);

Overview	Refer to Applying Artistic Effects.

Remarks

Applies an oil-painting effect to the bitmap.

You control the effect by specifying the size of the neighborhood that is used for calculating the pixel value. For example, for 8x8, pass 8 in the iDim parameter. You increase the size of the neighborhood in order to decrease the amount of detail in the resulting image.

This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Elements	GetChange method

Topics	Raster Images: Filtering Images


iDim Parameter For Oilify
iDim

Dimensions of the neighborhood used for filtering (iDim x iDim), in pixels.


Return for Oilify
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


OLEDragCursor property (Main Control)

Visual Basic example	Visual C++ example
Syntax	IPictureDisp* OLEDragCursor;
Overview	Refer to Drag and Drop.
Remarks

(Persistent property, available at design time) Gets or sets a custom mouse icon for the OLE drag-and-drop operation.

To use a custom mouse icon for the Drag and Drop operation, set this property to the desired icon and set the pbUseDefaultCursor parameter of the OLEGiveFeedback event to FALSE, within the event.

See Also

Elements	EnableOLEDragMethod property, OLEStartDrag event, OLECompleteDrag event, OLEDragOver event, OLEGiveFeedback event
Topics	Raster Images: Copying Images


OLEDropAllowed property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL OLEDropAllowed

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Persistent property, available at design time) Determines whether the Main Control  will attempt to load an image file that is dropped onto it in a drag-and-drop operation.

If OLEDropAllowed is TRUE, an OLEDropFile event will occur for each file dropped.

The drag-and-drop operation loads the image at its own bits per pixel. If it is a multipage file, only the first page is loaded.

Note: You should set this property to FALSE (0) before closing your window. Otherwise the operating system may not release the window.

Note: When using the LEAD ActiveX control on a web page, you should set this property to False on the Unload Event.  For example, in VBScript this is done as follows:

Sub Window_OnUnload
     LEAD1.OLEDropAllowed = False
end Sub

Value	Meaning

TRUE	Loading an image through an OLE drag-and-drop operation is enabled.

FALSE	Loading an image through an OLE drag-and-drop operation is disabled.

See Also

Elements	OLEDropAutoLoad property, OLEDropFile event

Topics	Working with the Control: General Behavior
Raster Images: Loading Files


OLEDropAutoLoad property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL OLEDropAutoLoad

Overview	Refer to Loading a Bitmap from a File.

Remarks

Determines whether the Main Control will automatically load an image file that is dropped onto it in a drag-and-drop operation.

If this property is set to TRUE and the OLEDropAllowed property is set to TRUE, any files dropped onto the LEAD control will be loaded automatically. The default value is TRUE.

Value	Meaning

TRUE	If OLEDropAllowed is also TRUE, then dropped files are loaded automatically.

FALSE	Dropped files are not loaded automatically.

See Also

Elements	OLEDropAllowed property, OLEDropFile event

Topics	Working with the Control: General Behavior
Raster Images: Loading Files


OLECompleteDrag event (Main Control)

Visual Basic example	Visual C++ example
Syntax	void OLECompleteDrag (short Button, short Shift, long X, long Y);
Overview	Refer to Drag and Drop
Remarks

Occurs when the dragging operation is complete and the image is dropped.

See Also

Elements	EnableOLEDragMethod property, OLEDragCursor property, OLEStartDrag event, OLEDragOver event, OLEGiveFeedback event
Topics	Raster Images: Copying Images


Button Parameter For OLECompleteDrag
Button

Value that represents the button that caused the event. Possible values are:

Value	Meaning

1	Left mouse button


Shift Parameter For OLECompleteDrag
Shift

Value that indicates which of the ALT, CTRL, and SHIFT keys are down when the button specified in the Button parameter caused the event. Possible values are:

Value	Meaning

1	SHIFT key

2.	CTRL key

3	CTRL/SHIFT keys

4	ALT key

5	ALT/SHIFT keys

6	CTRL/ALT keys

7	CTRL/ALT/SHIFT keys


X Parameter For OLECompleteDrag
X

X coordinate of the mouse pointer relative to the origin of the Main control. The unit of measure is determined by the ScaleMode property.


Y Parameter For OLECompleteDrag
Y

Y coordinate of the mouse pointer relative to the origin of the Main control. The unit of measure is determined by the ScaleMode property.


OLEDragOver event (Main Control)

Visual Basic example	Visual C++ example
Syntax	void OLEDragOver (short Button, short Shift, long X, long Y);
Overview	Refer to Drag and Drop
Remarks

Occurs repeatedly while dragging an image over the Main control. It also provides the Main control with feedback pertaining to the cursor position and the button used in the drag and drop process.

See Also

Elements	EnableOLEDragMethod property, OLEDragCursor property, OLEStartDrag event, OLECompleteDrag event, OLEGiveFeedback event
Topics	Raster Images: Copying Images


Button Parameter For OLEDragOver
Button

Value that represents the button used in the dragging process, which causes the event. Possible values are:

Value	Meaning

1	Left mouse button


Shift Parameter For OLEDragOver
Shift

Value that indicates which of the ALT, CTRL, and SHIFT keys are down when the button specified in the Button parameter is pressed. Possible values are:

Value	Meaning

1	SHIFT key

2.	CTRL key

3	CTRL/SHIFT keys

4	ALT key

5	ALT/SHIFT keys

6	CTRL/ALT keys

7	CTRL/ALT/SHIFT keys


X Parameter For OLEDragOver
X

X coordinate of the mouse pointer relative to the origin of the Main Control. The unit of measure is determined by the ScaleMode property.


Y Parameter For OLEDragOver
Y

Y coordinate of the mouse pointer relative to the origin of the Main Control. The unit of measure is determined by the ScaleMode property.


OLEDropFile event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void OLEDropFile (BSTR pszName);

Overview	Refer to Loading a Bitmap from a File.

Remarks

OLEDropFile event occurs each time a file is dropped in a drag and drop operation, if OLEDropAllowed is set to TRUE. The event takes the name of the file being dropped as a parameter.

To avoid loading the dropped file, set OLEDropAutoLoad to FALSE in the event.

After returning from the event, the Main control determines whether the OLEDropAutoLoad is TRUE. If it is TRUE, the file is loaded. If it is FALSE, no further action is taken.

See Also

Elements	OLEDropAutoLoad, OLEDropAllowed

Topics	Working with the Control: General Behavior
Raster Images: Loading Files


pszName Parameter For OLEDropFile
pszName

Name of the file being dropped.


OLEGiveFeedback event (Main Control)

Visual Basic example	Visual C++ example
Syntax	void OLEGiveFeedback (BOOL *pbUseDefaultCursor);
Overview	Refer to Drag and Drop
Remarks

Occurs repeatedly while an image is being dragged over the ImageList control to determine the visual feedback for the drag-and-drop operation.

Note:	To use a custom cursor during the drag and drop process, set the OLEDragCursor property to the custom cursor and set the pbUseDefaultCursor parameter of the OLEGiveFeedback event to FALSE, within the event.
See Also

Elements	EnableOLEDragMethod property, OLEDragCursor property, OLEStartDrag event, OLECompleteDrag event, OLEDragOver event
Topics	Raster Images: Copying Images


pbUseDefaultCursor Parameter For OLEGiveFeedback
pbUseDefaultCursor

Pointer to a variable to be updated with a value that indicates whether to use default or custom cursors. In C++, declare the variable and pass its address. In most other languages, pass the variable by reference. Possible values are:

Value	Meaning

TRUE	Use the default Drag and Drop cursors

FALSE	Use the custom cursor set in the OLEDragCursor property.


OLEStartDrag event (Main Control)

Visual Basic example	Visual C++ example
Syntax	void OLEStartDrag (short Button, short Shift, long X, long Y);
Overview	Refer to Drag and Drop
Remarks

Occurs when the drag-and-drop operation starts, if a drop can be accepted. A drag and drop can be accepted if the EnableOLEDragMethod property has been set to TRUE. If the drag and drop operation fails, this event will not be generated.

To start the drag-and-drop operation:

1.	Set the EnableOLEDragMethod property to TRUE.
3.	Select an image in this Main control.
4.	Press the left mouse button down on the same Main Control and drag the selected image. The OLEStartDrag event will occur.
See Also

Elements	EnableOLEDragMethod property, OLEDragCursor property, OLECompleteDrag event, OLEDragOver event, OLEGiveFeedback event,
Topics	Raster Images: Copying Images


Button Parameter For OLEStartDrag
Button

Value that represents the button that was pressed to cause the event. Possible values are:

Value	Meaning

1	Left mouse button


Shift Parameter For OLEStartDrag
Shift

Value that indicates which of the ALT, CTRL, and SHIFT keys are down when the button specified in the Button parameter is pressed. Possible values are:

Value	Meaning

1	SHIFT key

2.	CTRL key

3	CTRL/SHIFT keys

4	ALT key

5	ALT/SHIFT keys

6	CTRL/ALT keys

7	CTRL/ALT/SHIFT keys


X Parameter For OLEStartDrag
X

X coordinate of the mouse pointer relative to the origin of the Main control. The unit of measure is determined by the ScaleMode property.


Y Parameter For OLEStartDrag
Y

Y coordinate of the mouse pointer relative to the origin of the Main control. The unit of measure is determined by the ScaleMode property.


OwnerDrawItems property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL OwnerDrawItems

Overview	Refer to Using the Image List Control.

Remarks

Enables or disables custom/user-defined painting of the ImageList Control's items. Possible values are:

Setting	Description

TRUE	The user is responsible for drawing each ImageList Control item when the OwnerDrawItem event occurs.

FALSE	The toolkit is responsible for drawing each ImageList Control item.

This property must be set to TRUE in order for the OwnerDrawItem event to occur.

See Also

Elements	OwnerDrawItem event, Item property

Topics	Raster Images: Displaying Images


OwnerDrawItem event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void OwnerDrawItem (long Index, long hDC, float ItemLeft, float ItemTop, float ItemRight, float ItemBottom, float ItemBackLeft, float ItemBackTop, float ItemBackRight, float ItemBackBottom);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when an item in the ImageList Control needs to be repainted. This event occurs only if the OwnerDrawItems property has been set to TRUE.

This event must be used for custom/user-defined painting of ImageList items.

See Also

Elements	OwnerDrawItems property, Item property

Topics	Raster Images: Displaying Images


Index Parameter For OwnerDrawItem
Index

Index of the item that needs to be painted. This is a 0-based index.


hDC Parameter For OwnerDrawItem
hDC

Handle to a device context. This is the device context on which the ImageList items will be drawn/painted.


ItemLeft Parameter For OwnerDrawItem
ItemLeft

This is the X coordinate of the origin of the ImageList item to be drawn/painted. The unit of measure is determined by the ScaleMode property.


ItemTop Parameter For OwnerDrawItem
ItemTop

This is the Y coordinate of the origin of the ImageList item to be drawn/painted. The unit of measure is determined by the ScaleMode property.


ItemRight Parameter For OwnerDrawItem
ItemRight

This is the X coordinate of the right boundary of the ImageList item to be drawn/painted. The unit of measure is determined by the ScaleMode property.


ItemBottom Parameter For OwnerDrawItem
ItemBottom

This is the Y coordinate of the bottom boundary of the ImageList item to be drawn/painted. The unit of measure is determined by the ScaleMode property.


ItemBackLeft Parameter For OwnerDrawItem
ItemBackLeft

This is the X coordinate of the origin of the background of the ImageList item to be drawn/painted. The unit of measure is determined by the ScaleMode property.


ItemBackTop Parameter For OwnerDrawItem
ItemBackTop

This is the Y coordinate of the origin of the background of the ImageList item to be drawn/painted. The unit of measure is determined by the ScaleMode property.


ItemBackRight Parameter For OwnerDrawItem
ItemBackRight

This is the X coordinate of the right boundary of the background of the ImageList item to be drawn/painted. The unit of measure is determined by the ScaleMode property.


ItemBackBottom Parameter For OwnerDrawItem
ItemBackBottom

This is the Y coordinate of the bottom boundary of the background of the ImageList item to be drawn/painted. The unit of measure is determined by the ScaleMode property.


PageCount property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long PageCount

Overview	Refer to Using the Image List Control.

Remarks

(Read-only)(Runtime-only) Gets the current number of pages of items in the ImageList Control.

This will return the total number of pages of items in the ImageList Control.  Pages are calculated using the total number of rows or columns (depending on the scroll style) and the total number of rows or columns (depending on the scroll style) that are completely visible in the ImageList Control's client area.

See Also

Elements	CurrentPage property, Insert method, Remove method, RowCount property, ColumnCount property, Count property, Clear method, Item property, ScrollItems method

Topics	Raster Images: Displaying Images


PagesDiscarded property (ISIS Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short PagesDiscarded

Overview	Using ISIS to Scan Images

Remarks

(Document/Medical)  Gets the number of ScanAhead pages that are discarded if the ISISAcquireMulti method is canceled and the ScanAhead tag has been set.  For more information on tags, refer to the ISISSetTag method and the ISISGetTag method.

To cancel multipage scanning, set the EnableISISEvent property to FALSE in the ISISPage event.

See Also

Elements	ISISAcquireMulti method, ISISSetTag method, ISISGetTag method, ISISPage event, EnableISISEvent property

Topics	Raster Images: Scanning Images using ISIS


Paint event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void Paint ();

Overview	Refer to Detecting Events.

Remarks

Occurs when part or all of the Main Control is exposed after it has been moved or enlarged, or after a window that was covering the control has been moved.

If the AutoRepaint property is set to TRUE, you do not have to write code for this event.

See Also

Elements	Scroll event

Topics	Working with the Control: Client Area Usage


PaintContrast property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PaintContrast

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Contrast correction value used by painting operations.

Setting the contrast value that is used for painting lets you adjust the displayed contrast of all images without changing the bitmap data.

Possible values range from -1000 to +1000. A positive value increases the contrast of the displayed image. A negative value decreases the contrast of the image.

See Also

Elements	BackErase property, BitonalScaling property, ForePalette property, PaintDither property, PaintEffect property, PaintPalette property, PaintROP3 property, PaintGamma property, PaintIntensity property

Topics	Raster Images: Displaying Images
Changing Brightness and Contrast


Return for FastRotate
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


PaintDither property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short PaintDither

Overview	Refer to Using the Image List Control.

Remarks

(persistent property, available at design time) Specifies the type of dithering to use when painting an image on a device with 256 colors or less in the ImageList Control.  The default is PAINTDITHER_ORDERED.

Setting	Description

PAINTDITHER_ORDERED	Use ordered dithering.

PAINTDITHER_DIFFUSION	Use error diffusion.

See Also

Elements	BitonalScaling

Topics	Raster Images: Displaying Images


PaintDither property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PaintDither

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Specifies the type of dithering to use when painting an image on a device with 256 colors or less.

Ordered dithering is faster than error diffusion, but the quality of the image is not as good.

Setting	Description

PAINTDITHER_ORDERED	Use ordered dithering.

PAINTDITHER_DIFFUSION	Use error diffusion.

See Also

Elements	BackErase property, BitonalScaling property, ForePalette property, PaintEffect property, PaintPalette property, PaintROP3 property, PaintGamma property, PaintIntensity property, PaintContrast property

Topics	Raster Images: Displaying Images
Raster Images: Doing Color Expansion or Reduction


PaintEffect property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PaintEffect

Overview	Refer to Using Special Effects When Painting.

Remarks

(Persistent property, available at design time) Sets the effect to be used when painting the image.

LEADTOOLS provides over 2000 defined constant identifiers for effects. Visual Basic users must include L_OCXEFX.BAS in order to use the defined constant identifiers. This file can be found in the lead\include directory.

For possible values for this property, refer to Effects.

Multipass painting for the EFX_EFFECT_PUSH_CLASS is disabled.

See Also

Elements	BackErase property, BitonalScaling property, ForePalette property, PaintDither property, PaintPalette property, PaintROP3 property, PaintGamma property, PaintIntensity property, PaintContrast property

Topics	Raster Images: Displaying Images


PaintGamma property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PaintGamma

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Gamma correction value used by painting operations.

Setting the gamma correction that is used for painting lets you adjust the displayed brightness of all images without changing the bitmap data.

Intensity values ideally follow a logarithmic progression, because the eye perceives changes in intensity as being equal when the ratio of change is equal. For example, we would see a change from 0.1 to 0.2 as being equal to a change from 0.2 to 0.4.

Gamma is a standard constant that is used to calculate the progression. For most CRTs the gamma constant is in the range of 2.2 to 2.5.

Because this property is an unsigned integer, it is 100 times the actual gamma value. For example, use 235 to set a gamma value of 2.35.

See Also

Elements	BackErase property, BitonalScaling property, ForePalette property, PaintDither property, PaintEffect property, PaintPalette property, PaintROP3 property, PaintIntensity property, PaintContrast property

Topics	Raster Images: Displaying Images
Changing Brightness and Contrast


PaintIntensity property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PaintIntensity

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Intensity correction value used by painting operations.

Setting the intensity value that is used for painting lets you adjust the displayed brightness of all images without changing the bitmap data.

Possible values range from -1000 to +1000. A positive value lightens the displayed image. A negative value darkens the image.

See Also

Elements	BackErase property, BitonalScaling property, ForePalette property, PaintDither property, PaintEffect property, PaintPalette property, PaintROP3 property, PaintGamma property, PaintContrast property

Topics	Raster Images: Displaying Images
Changing Brightness and Contrast


PaintMaxPasses property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PaintMaxPasses

Overview	Refer to Using Special Effects When Painting.

Remarks

(Persistent property, available at design time) Maximum passes for a pattern brush when implementing a paint effect or transition effect. Use 1 for painting in one pass. Multipass painting for the EFX_EFFECT_PUSH_CLASS is disabled.

If you specify more than one pass, a pattern brush paints some of the pixels on each pass, and the painting is complete when you finish all of the passes. The PaintNotification event, which occurs before painting and after each pass, lets you change the behavior of the effect before it finishes.

See Also

Elements	PaintEffect property, TransitionEffect property, PaintPass property, PaintNotification event, PaintNotificationDelay property

Topics	Raster Images: Implementing Special Effects


PaintNotification event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void PaintNotification (short uPass, short uType);

Overview	Refer to Using Special Effects When Painting.

Remarks

Occurs before painting and after each pass when implementing a paint effect or transition effect.

This event lets you change the behavior of the effect before it finishes. The uType parameter lets you know whether a transition or an image is being painted. The uPass parameter works as follows:

Value	Meaning

0	No passes have painted. The first pass is next.

1	One pass has painted. The second pass is next.

2	The second pass has painted. The third pass is next.

And so forth....

The PaintMaxPasses property specifies the number of passes to complete the image or transition. You can set the PaintPass property in this event if you want to skip or repeat a pass (for example, if you want to end with a blend of old and new images).

See Also

Elements	PaintEffect property, TransitionEffect property, PaintPass property, PaintMaxPasses property, PaintNotificationDelay property

Topics	Raster Images: Implementing Special Effects


uPass Parameter For PaintNotification
uPass

The number of completed passes.


uType Parameter For PaintNotification
uType

The type of effect. The following are possible values:

Value	Meaning

EFX_NOTIFY_TRANSITION	Painting a transition.

EFX_NOTIFY_IMAGE	Painting an image.


PaintNotificationDelay property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PaintNotificationDelay

Overview	Refer to Using Special Effects When Painting.

Remarks

(Persistent property, available at design time) Delay between paint passes, in milliseconds.

If you specify more than one pass when painting a special effect, a pattern brush paints some of the pixels on each pass, and the painting is complete when you finish all of the passes. The PaintNotification event occurs before painting and after each pass. The PaintNotificationDelay property specifies the delay in that event.

See Also

Elements	PaintEffect property, TransitionEffect property, PaintMaxPasses property, PaintPass property, PaintNotification event

Topics	Raster Images: Implementing Special Effects


PaintPalette property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PaintPalette

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Specifies whether to force use of a fixed palette when painting images on a device that displays 256 colors or less.

Using the fixed palette improves the overall display of multiple images. You can specify either the LEAD fixed palette or the Netscape fixed palette. The Netscape fixed palette is the same palette used by Netscape Navigator and Microsoft Internet Explorer.

Setting	Description

PAINTPALETTE_AUTO	Use the bitmap's own palette if available; otherwise use the LEAD fixed palette.

PAINTPALETTE_FIXED	Always use the LEAD fixed palette.

PAINTPALETTE_AUTONETSCAPE	Use the bitmap's own palette if available; otherwise use the Netscape fixed palette.

PAINTPALETTE_FIXEDNETSCAPE	Always use the Netscape fixed palette.

See Also

Elements	BackErase property, BitonalScaling property, ForePalette property, PaintDither property, PaintEffect property, PaintROP3 property, PaintGamma property, PaintIntensity property, PaintContrast property

Topics	Raster Images: Displaying Images


PaintPass property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PaintPass

Overview	Refer to Using Special Effects When Painting.

Remarks

(Persistent property, available at design time) The current pass during a paint effect or transition effect.

You can set this value in the PaintNotification event if you want to skip or repeat a pass (for example, if you want to end with a blend of old and new images).

See Also

Elements	PaintEffect property, TransitionEffect property, PaintMaxPasses property, PaintNotification event, PaintNotificationDelay property

Topics	Raster Images: Implementing Special Effects


PaintRgnOnly property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL PaintRgnOnly

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Determines whether only the current region of the bitmap paints. Painting can be automated with the AutoRepaint property or forced with the ForceRepaint method.

Value	Meaning

TRUE	Paint only the current region.

FALSE	Paint any part of the bitmap that is within the display rectangles.

See Also

Elements	AutoRepaint property, ForceRepaint method, RepaintRect method, Transparent property

Topics	Raster Images: Displaying Images
Implementing Transparency


PaintROP3 property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long PaintROP3

Overview	Refer to Displaying an Image.

Remarks

Specifies the Windows ROP3 code to use when painting.

The default (for normal painting) is SRCCOPY. You can specify any of the ROP3 codes that the Windows BitBlt function uses.

See Also

Elements	BackErase property, BitonalScaling property, ForePalette property, PaintDither property, PaintEffect property, PaintPalette property, PaintGamma property, PaintIntensity property, PaintContrast property

Topics	Raster Images: Displaying Images


PaintScaling property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short PaintScaling

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Type of resizing to use when painting in the ImageList control.

Default is PAINTSCALING_NORMAL, which is the fastest.

Possible values are:

Value	Meaning

PAINTSCALING_NORMAL	[0] normal resize (fastest)

PAINTSCALING_RESAMPLE	[1] bilinear interpolation (slower than  PAINTSCALING_NORMAL, but produces better looking results)

PAINTSCALING_BICUBIC	[2] bicubic interpolation (slowest, best quality)

For 1-bit images, the PaintScaling is considered only if BitonalScaling is BITONALSCALING_NORMAL. Otherwise, the FavorBlack and ScaleToGray options take precedence over PaintScaling.

PAINTSCALING_BICUBIC produces the same result as PAINTSCALING_RESAMPLE when zooming out on an image.

See Also

Elements	BitonalScaling property

Topics	Raster Images: Displaying Images


PaintScaling property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short PaintScaling

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Type of resizing to use during painting.

Default is PAINTSCALING_NORMAL, which is the fastest.

Possible values are:

Value	Meaning

PAINTSCALING_NORMAL	[0] normal resize (fastest)

PAINTSCALING_RESAMPLE	[1] bilinear interpolation (slower than  PAINTSCALING_NORMAL, but produces better looking results)

PAINTSCALING_BICUBIC	[2] bicubic interpolation (slowest, best quality)

For 1-bit images, the PaintScaling is considered only if BitonalScaling is BITONALSCALING_NORMAL. Otherwise, the FavorBlack and ScaleToGray options take precedence over PaintScaling.

PAINTSCALING_BICUBIC produces the same result as PAINTSCALING_RESAMPLE when zooming out on an image.

See Also

Elements	BitonalScaling property

Topics	Raster Images: Displaying Images


PaintSizeMode property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PaintSizeMode

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Determines the behavior of the AutoSetRects property, which automatically adjusts the display rectangles. It adjusts the destination rectangle as follows:

Setting	Description

PAINTSIZEMODE_NORMAL	Width is the bitmap width. Height is the bitmap height.

PAINTSIZEMODE_STRETCH	Width is the control's client area width. Height is the client area height. The aspect ratio is not preserved.

PAINTSIZEMODE_FITSIDES	Width is the control's client area width. Height is set proportionally to maintain the aspect ratio. The AutoScroll property implements the vertical scroll bar.

PAINTSIZEMODE_FIT	The largest possible width or height is set to the control's client area width or height. The remaining dimension is set proportionally to maintain the aspect ratio.

PAINTSIZEMODE_ZOOM	The width and height are set to the bitmap width and height multiplied by the PaintZoomFactor property.

See Also

Elements	AutoRepaint property, AutoSetRects property, PaintZoomFactor property, AutoScroll property, AutoSize property

Topics	Raster Images: Displaying Images


PaintSizeUseDPI property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL PaintSizeUseDPI

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Gets or sets a value that indicates whether LEAD's automated scaling properties are used to account for the physical resolution of the bitmap. Possible values are:

Value	Meaning

TRUE	Account for the physical resolution.

FALSE	Do not account for the physical resolution.

The physical resolution of a bitmap is measured in dots per inch (DPI). When you load an image, the BitmapXRes and BitmapYRes properties are updated with the DPI values for the horizontal and vertical resolution. Some images have different horizontal and vertical resolutions (for example: 300 by 600). In such cases, the displayed images will appear elongated if you do not account for the resolution.

If the values of the BitmapXRes property and the BitmapYRes property are not equal, set the PaintSizeUseDPI property to TRUE to have LEAD's automated scaling properties account for the physical resolution of the bitmap. These automated scaling properties include:

AutoRepaint property

AutoScroll property

AutoSetRects property

AutoSize property

DstHeight property

DstLeft property

DstTop property

DstWidth property

PaintSizeMode property

PaintZoomFactor property

See Also

Elements	AutoRepaint property, AutoScroll property, AutoSetRects property, AutoSize property, BitmapXRes property, BitmapYRes property, DstHeight property, DstLeft property, DstTop property, DstWidth property, PaintSizeMode property, PaintZoomFactor property

Topics	Raster Images: Displaying Images


PaintWhileLoad property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL PaintWhileLoad

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Persistent property, available at design time) Causes the bitmap to paint while the image file is loading. This lets the user see the progress of the load.

This property works only when the display mode is 32K colors (16-bit) or higher.

Setting	Description

TRUE 	Paint the bitmap while the image is loading.

FALSE	Paint the bitmap when the image is finished loading.

See Also

Topics	Raster Images: Loading Files


PaintZoomFactor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float PaintZoomFactor

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Is the zoom factor that is used when the AutoSetRects property is TRUE.

You can read and write this property when the PaintSizeMode property is PAINTSIZEMODE_ZOOM.

This property is read only when the PaintSizeMode property is set to another value. When it is set to PAINTSIZEMODE_STRETCH, the zoom factor is the smallest of the width or height zoom factors (the aspect ratio is not preserved).

If the AutoSetRects property is FALSE, this property is not valid.

See Also

Elements	AutoRepaint property, AutoSetRects property, PaintSizeMode property, AutoScroll property, AutoSize property

Topics	Raster Images: Displaying Images


PaletteFlags property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short PaletteFlags

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Indicates the palette option or color order that should be used when both ForceSize and MaintainAspect are True and the source image is not 24-bit.  In this case, the thumbnail image is converted to 24-bit, then, combined with a "background" bitmap.  Then, the resulting bitmap is returned to the thumbnail image's original bit-depth using this setting.

Possible values are:

Setting	Description

CRP_FIXEDPALETTE	Use the LEAD fixed palette.

CRP_NETSCAPEPALETTE	Use the fixed palette that is employed by Netscape Navigator and by Microsoft Internet Explorer.

CRP_OPTIMIZEDPALETTE	Create an optimized palette.

CRP_IDENTITYPALETTE	Insert the Windows system palette, and optimize the remaining colors.

CRP_BYTEORDERBGR	Use BGR color order. This flag only has meaning when going to 16 bits per pixel or higher.

CRP_BYTEORDERRGB	Use RGB color order. This flag only has meaning when going to 16 bits per pixel or higher.

CRP_BYTEORDERGRAY	Use grayscale. This flag is only valid for 12 or 16-bit grayscale images.  12 and 16-bit grayscale images are supported in the Document/Medical toolkits  only.

See Also

Elements	BrowseDir method, DitherFlags property, InfoBits property, ThumbnailBitsPerPixel property, ForceSize property, MaintainAspect property, ColorRes method (Main Control)

Topics	Raster Images: Using the Thumbnail Browser


PanWin event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	void PanWin (OLE_HANDLE hPanWin, short iFlag);

Overview	Refer to Using a PanWindow.

Remarks

This event is generated when the PanWindow is created, updated, destroyed, or moved.

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


hPanWin Parameter For PanWin
hPanWin

Handle to the Pan Window.


iFlag Parameter For PanWin
iFlag

The reason for the callback notification.  Possible values are:

Value	Meaning

PANWIN_CREATED	[0] Pan Window was created.

PANWIN_UPDATED	[1] Pan Window was updated/repainted.

PANWIN_DESTROYED	[2] Pan Window was destroyed.

PANWIN_MOVED	[3] Pan Window was moved.

PANWIN_REPAINTED	[4] Pan Window image has been painted.(This occurs before the pan rect is painted.)


PanWinBitonalScaling property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short PanWinBitonalScaling

Overview	Refer to Using a PanWindow.

Remarks

(Document/Medical only, persistent property, available at design time) Sets options to improve the display of bitonal bitmaps in the PanWindow.  The default is BITONALSCALING_NORMAL.

Setting	Description

BITONALSCALING_NORMAL	Causes bitonal images to be displayed normally when they are scaled.

BITONALSCALING_FAVORBLACK	Enables a bias in preserving black objects when displaying zoomed-out 1-bit images. This can prevent the disappearance of fine lines and details, but it slows down the display.

BITONALSCALING_SCALETOGRAY	Enables grayscaling of 1-bit images when they are displayed. This improves the readability of the images when they are zoomed in or zoomed out, but it slows down the display.

See Also

Elements	PanWin event, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinCursor property (Main Control)

Visual Basic example   Other Systems   Visual J++ example

Syntax	IPictureDisp*PanWinCursor

Overview	Refer to Using a PanWindow.

Remarks

(Persistent property, available at design time.) Sets a custom mouse icon for the PanWindow.

You can set this property to a cursor or icon file. Then, you can set the PanWinPointer property to 99 to implement the custom PanWindow mouse icon.

See Also

Elements	PanWinBitonalScaling property, PanWinevent, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short PanWinHeight

Overview	Refer to Using a PanWindow.

Remarks

(Persistent and available at design time.) Sets the requested height of the PanWindow (the default is 150) or gets the current height of the Pan Window, when the Pan Window is visible. A "get" performed on an invisible window returns the height of the last active PanWindow, or, if a PanWindow has not been created, 150.

Note: the actual size of the PanWindow will depend on the aspect ratio of the image

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWin event, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinIcon property (Main Control)

Visual Basic example   Other Systems    Visual J++ example

Syntax	IPictureDisp* PanWinIcon

Overview	Refer to Using a PanWindow.

Remarks

(Persistent property, available at design time.) Sets a custom PanWindow icon.  This is the icon that will appear in the corner of the Pan Window's title bar if the PanWinSysMenu property is TRUE.  This defaults to none, which means Windows will choose the icon.

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWin event, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinPaintDither property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short PanWinPaintDither

Overview	Refer to Using a PanWindow.

Remarks

(Persistent property, available at design time) Specifies the type of dithering to use when painting an image on a device with 256 colors or less in the PanWindow.  The default is PAINTDITHER_ORDERED.

Ordered dithering is faster than error diffusion, but the quality of the image is not as good.

Setting	Description

PAINTDITHER_ORDERED	Use ordered dithering.

PAINTDITHER_DIFFUSION	Use error diffusion.

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWin event, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinPaintPalette property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short PanWinPaintPalette

Overview	Refer to Using a PanWindow.

Remarks

(Persistent property, available at design time) Specifies whether to force the use of a fixed palette when painting images on a device that displays 256 colors or less in the PanWindow.

Using the fixed palette improves the overall display of multiple images. You can specify either the LEAD fixed palette or the Netscape fixed palette. The Netscape fixed palette is the same palette used by Netscape Navigator and Microsoft Internet Explorer.  The default is PAINTPALETTE_AUTO.

Setting	Description

PAINTPALETTE_AUTO	Use the bitmap's own palette if available; otherwise use the LEAD fixed palette.

PAINTPALETTE_FIXED	Always use the LEAD fixed palette.

PAINTPALETTE_AUTONETSCAPE	Use the bitmap's own palette if available; otherwise use the Netscape fixed palette.

PAINTPALETTE_FIXEDNETSCAPE	Always use the Netscape fixed palette.

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWin event, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinPaintScaling property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short PaintScaling

Overview	Refer to Using a PanWindow.

Remarks

(Persistent property, available at design time) Type of resizing to use when painting the PanWindow.

Default is PAINTSCALING_NORMAL, which is the fastest.

Possible values are:

Value	Meaning

PAINTSCALING_NORMAL	[0] normal resize (fastest)

PAINTSCALING_RESAMPLE	[1] bilinear interpolation (slower than  PAINTSCALING_NORMAL, but produces better looking results)

PAINTSCALING_BICUBIC	[2] bicubic interpolation (slowest, best quality)

For 1-bit images, the PanWinPaintScaling is considered only if PanWinBitonalScaling is BITONALSCALING_NORMAL. Otherwise, the FavorBlack and ScaleToGray options take precedence over PanWinPaintScaling.

PAINTSCALING_BICUBIC produces the same result as PAINTSCALING_RESAMPLE when zooming out on an image.

See Also

Elements	PanWinBitonalScaling property,PanWin event, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinPointer property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short PanWinPointer

Overview	Refer to Using a PanWindow.

Remarks

(Persistent property, available at design time.) Sets or gets the value that indicates the type of mouse pointer used in the Pan Window.

Setting	Meaning

0	(Default) Shape determined by the object

1	Arrow

2	Cross-hair

3	I-Beam

4	Small square within a square

5	Four-pointed arrow pointing north, south, east, and west

6	Double arrow pointing northeast and southwest

7	Double arrow pointing north and south

8	Double arrow pointing northwest and southeast

9	Double arrow pointing west and east

10	Up Arrow

11	Hourglass (wait)

12	No Drop

13	Arrow and hourglass

14	Arrow and question mark

15	Size all

99	Custom icon specified by the PanWinCursor property

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWin event, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinRectColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	OLE_COLOR PanWinRectColor

Overview	Refer to Using a PanWindow.

Remarks

(Persistent property, available at design time.) Gets or sets the color used to draw the Pan Window's Pan Rect.  The default color is RED.

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWin event, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinSysMenu property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	BOOL PanWinSysMenu

Overview	Refer to Using a PanWindow.

Remarks

(Persistent property, available at design time.) Indicates whether or not to include the system menu on the PanWindow.  If PanWinSysMenu is TRUE, the system menu will be included on the PanWindow.  If it is FALSE, the menu will not be included.  The default is TRUE.

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWin event, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinTitle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	BSTR PanWinTitle

Overview	Refer to Using a PanWindow.

Remarks

(Persistent property, available at design time.) Gets or sets the string for the title bar of the PanWindow.  The default is NULL.

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWin event, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short PanWinWidth

Overview	Refer to Using a PanWindow.

Remarks

 (Persistent and available at design time.) Sets the requested width of the PanWindow (the default is 150) or gets the current width of the Pan Window, when the Pan Window is visible.  A "get" performed on an invisible window returns the width of the last active PanWindow, or, if a PanWindow has not been created, 150.

Note: the actual size of the PanWindow will depend on the aspect ratio of the image

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWin event, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinX property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short PanWinX

Overview	Refer to Using a PanWindow.

Remarks

(Persistent and available at design time.) Get or sets the X coordinate used to locate the PanWindow.  The default is 0.

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWin event, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


PanWinY property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short PanWinY

Overview	Refer to Using a PanWindow.

Remarks

(Persistent and available at design time.) Get or sets the Y coordinate used to locate the PanWindow.  The default is 0.

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWin event, ShowPanWin method

Topics	Raster Images: Displaying and Printing


Paste method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Paste (short iFlags);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

Pastes image data from the clipboard to a specified bitmap. The image on the clipboard must be a DIB or DDB raster image.

Before attempting to paste the data, you can test to see if the clipboard contains valid image data by calling this method with the iFlags parameter set to PASTE_ISREADY. If the method does not return 0, the data is valid. You can then paste the image data into the Main Control by calling this method with the iFlags parameter set to 0.

The bitmap will contain the same width, height, and bits per pixel as the image on the clipboard.

See Also

Topics	Raster Images: Exchanging Imgages with Other Objects
Raster Images: Using the Clipboard


iFlags Parameter For Paste
iFlags

Determines whether the method tests the data on the clipboard or completes the paste.

Valid values are:

Value	Meaning

PASTE_ISREADY	Test to see if the clipboard contains data that can be pasted.

0	Paste the data.


Return for Paste
Return Value

Return	Meaning

0	If the iFlags parameter is set to PASTE_ISREADY, this means that the clipboard does not contain a valid image. Otherwise, this means that the function was successful.

<>0	If the iFlags parameter is set to PASTE_ISREADY, this means that the clipboard contains a valid image. Otherwise, this means that an error occurred. Refer to Error Codes.


PatternBackColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR PatternBackColor

Overview	Refer to Gradients and Patterns.

Remarks

(Persistent property, available at design time) Works with related properties to specify a solid color or pattern for use when you implement a transitional paint effect or when you draw a three-dimensional shape.

Related properties work together as follows:

 PatternStyle specifies the style, which can be solid, transparent (for three-dimensional shapes only), or any of several line patterns.

 PatternBackColor specifies the background color of the pattern.

 PatternForeColor property specifies the foreground color of the pattern.

See Also

Topics	Raster Images: Implementing Special Effects
Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


PatternForeColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR PatternForeColor

Overview	Refer to Gradients and Patterns.

Remarks

(Persistent property, available at design time) Works with related properties to specify a solid color or pattern for use when you implement a transitional paint effect or when you draw a three-dimensional shape.

Related properties work together as follows:

 PatternStyle specifies the style, which can be solid, transparent (for three-dimensional shapes only), or any of several line patterns.

 PatternBackColor specifies the background color of the pattern.

 PatternForeColor property specifies the foreground color of the pattern.

See Also

Topics	Raster Images: Implementing Special Effects
Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


PatternStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PatternStyle

Overview	Refer to Gradients and Patterns.

Remarks

(Persistent property, available at design time) Works with related properties to specify a solid color or pattern for use when you implement a transitional paint effect or when you draw a three-dimensional shape.

Related properties work together as follows:

 PatternStyle specifies the style, which can be solid, transparent (for three-dimensional shapes only), or any of several line patterns.

 PatternBackColor specifies the background color of the pattern.

 PatternForeColor propertyspecifies the foreground color of the pattern.

For a list of possible values, refer to PatternStyles.

See Also

Topics	Raster Images: Implementing Special Effects
Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


PCDRes property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access example   Visual FoxPro example
Visual J++ example

Syntax	short PCDRes

Overview	Refer to Loading a Bitmap from a File.

Remarks

Sets the resolution to be used for loading or converting a PhotoCD file.

Use the InfoPCDRes property to see which resolutions are available in a PhotoCD file.

Setting	Description

PCDRES_BASE_OVER_64	64 x 96

PCDRES_BASE_OVER_16	128 x 192

PCDRES_BASE_OVER_4	256 x 384

PCDRES_BASE 	(Default) 512 x 768

PCDRES_4BASE 	1024 x 1536

PCDRES_16BASE	2048 x 3072

See Also

Elements	ReadLoadResolutions method, LoadResolutionCount property, LoadResolutionHeight property, LoadResolutionWidth property, SetLoadResolution method, GetLoadResolution method, Load method, LoadFromFile method, LoadMemory method, LoadStamp method

Topics	Raster Images: Loading Files


PDFDisplayDepth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long PDFDisplayDepth

Overview	Refer to Implementing PDF Plug in Features.

Remarks

(Persistent property, available at design time) Sets the pixel depth value that LEADTOOLS uses when loading PDF, PS or EPS files.

Value	Meaning

1	1 bit per pixel in the resultant bitmap

4	4 bits per pixel in the resultant bitmap

8	8 bits per pixel in the resultant bitmap

24	24 bits per pixel in the resultant bitmap

The default setting is 24.

See Also

Elements	PDFXResolution property, PDFYResolution property, PDFTextAlpha property, PDFGraphicsAlpha property, PDFUseLibFonts propety

Topics	Raster Images: Loading Files


PDFGraphicsAlpha property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long PDFGraphicsAlpha

Overview	Refer to Implementing PDF Plug in Features.

Remarks

(Persistent property, available at design time) Sets the flag that indicates what type of graphics anti-aliasing that LEADTOOLS uses when loading PDF, PS or EPS files.

Value	Meaning

1	Do not use graphics anti-aliasing.

2	Use 2-bit graphics anti-aliasing.

4	Use 4-bit graphics anti-aliasing.

The default setting is 1.

Graphics anti-aliasing slows down the drawing of the resulting bitmap.

Graphics anti-aliasing can only be used if PDFDisplayDepth property is set to 8 or greater.

See Also

Elements	PDFXResolution property, PDFYResolution property, PDFDisplayDepth property, PDFTextAlpha property, PDFUseLibFonts property

Topics	Raster Images: Loading Files


PDFTextAlpha property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long PDFTextAlpha

Overview	Refer to Implementing PDF Plug in Features.

Remarks

(Persistent property, available at design time) Sets the flag that indicates what type of font anti-aliasing that LEADTOOLS uses when loading PDF, PS or EPS files.

Value	Meaning

1	Do not use font anti-aliasing.

2	Use 2-bit font anti-aliasing.

4	Use 4-bit font anti-aliasing.

The default setting is 4.

Aliasing is the effect on all pixel devices where diagonal and curved lines have a zigzag appearance. As pixels get larger, this effect becomes more noticeable. Anti-aliasing refers to methods designed to decrease or eliminate this effect. This is done by shading the pixels along the borders of the affected lines.

Font anti-aliasing slows down the drawing of the resulting bitmap.

Font anti-aliasing can only be used if PDFDisplayDepth property is set to 8 or greater.

See Also

Elements	PDFXResolution property, PDFYResolution property, PDFDisplayDepth property, PDFGraphicsAlpha property, PDFUseLibFonts property

Topics	Raster Images: Loading Files


PDFSaveLowMemory property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL PDFSaveLowMemory

Overview	Refer to Implementing PDF Plug in Features.

Remarks

Indicates whether to try to use less memory when creating a PDF file with JPEG or Fax compression.  Possible values are:

Setting	Description

TRUE	Try to use less memory when creating a PDF file with JPEG or Fax compression.

FALSE	Do not try to use less memory when creating a PDF file with JPEG or Fax compression.  This is the default value.

See Also

Elements:	PDFDisplayDepth property, PDFGraphicsAlpha property, PDFTextAlpha property, PDFUseLibFonts property, PDFXResolution property, PDFYResolution property

Topics	Raster Images: Saving Files


PDFSaveUseDPI property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL PDFSaveUseDPI

Overview	Refer to Implementing PDF Plug in Features.

Remarks

Indicates whether to use the bitmap's DPI in calculating page dimensions when saving a PDF file. The BitmapXRes property and the BitmapYRes property are updated with the bitmap's DPI when a bitmap is loaded. If this property is TRUE, the values in the BitmapXRes and BitmapYRes properties will be used to calculate the page dimensions when a PDF file is saved.

Possible values are:

Value	Meaning

TRUE	Use the bitmap's DPI in calculating page dimensions when saving a PDF file.

FALSE	Ignore bitmap DPI when saving a PDF file.

The default setting is FALSE.

See Also

Elements	PDFDisplayDepth property, PDFGraphicsAlpha property, PDFTextAlpha property, PDFUseLibFonts property, PDFXResolution property, PDFYResolution property

Topics	Raster Images: Saving Files


PDFUseLibFonts property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean PDFUseLibFonts

Overview	Refer to Implementing PDF Plug in Features.

Remarks

(Persistent property, available at design time) Sets the flag that indicates whether to use fonts installed by the PDF module or system fonts when loading PDF, PS or EPS files.

Value	Meaning

TRUE	Use the PDF module installed fonts.

FALSE	Use the system fonts.

The default setting is TRUE.

See Also

Elements	PDFXResolution property, PDFYResolution property, PDFDisplayDepth property, PDFTextAlpha property, PDFGraphicsAlpha property

Topics	Raster Images: Loading Files


PDFXResolution property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long PDFXResolution

Overview	Refer to Implementing PDF Plug in Features.

Remarks

(Persistent property, available at design time) Sets the horizontal DPI (dots per inch) value that LEADTOOLS uses when loading PDF, PS or EPS files.

The default for this property is 96.

See Also

Elements	PDFYResolution property, PDFDisplayDepth property, PDFTextAlpha property, PDFGraphicsAlpha property, PDFUseLibFonts property

Topics	Raster Images: Loading Files


PDFYResolution property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long  PDFYResolution

Overview	Refer to Implementing PDF Plug in Features.

Remarks

(Persistent property, available at design time) Sets the vertical DPI (dots per inch) value that LEADTOOLS uses when loading PDF, PS or EPS files.

The default for this property is 96.

See Also

Elements	PDFXResolution property, PDFDisplayDepthproperty , PDFTextAlpha property, PDFGraphicsAlpha property, PDFUseLibFonts property

Topics	Raster Images: Loading Files


Picturize method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short Picturize (BSTR pszDirectory, short iFlags. float fCellWidth, float fCellHeight);

Overview	Refer to Combining Images.

Remarks

Replaces the current image with an image created from images contained in the specified directory.  The image, or selected region, is broken down into rectangles of size fCellWidth x fCellHeight.  For each rectangle, the image in the directory that is best suited to replace that rectangle is inserted into the original image.

The quality of the result is controlled by three factors:

1. the number of images present in the directory (the more images, the better).

2. the size of the rectangles.  Smaller rectangles create an image that more closely resembles the original.

3. the type of image being replaced. If you are replacing a small image with lots of detail, then you will need lots of images in the directory in order to create an image that closely resembles the original.

PICTURIZE_ONCE and PICTURIZE_EQUALUSAGE flags cannot be combined in the iFlags parameter.

If PICTURIZE_BESTFIT is set, then fCellWidth and fCellHeight are used as a starting point for the actual cell size. The cell sizes are modified so that the size of the last rectangle in a row or column differs from the other rectangles by one. Note that the cell width and height are chosen to be smaller than fCellWidth and fCellHeight. For example, if the bitmap is 101x131 and you pass 32 for the cell width and height and set PICTURIZE_BESTFIT, then the actual cell size will be 25x32. The widths of the cells will be 26, 25, 25, 25 (for a total of 101). The heights of the rows will be 33, 33, 33, 32 (for a total of 131). This option should be used if the bitmap width and height are not multiples of fCellWidth and fCellHeight.

If the bitmap width and height are not multiples of fCellWidth and fCellHeight and PICTURIZE_BESTFIT is not passed, then the last rectangle in a row or column might be very small. Using the example given above, if PICTURIZE_BESTFIT is not set, the widths of the cells would be 32, 32, 32, 5 and the heights would be 32, 32, 32, 32, 3.

PICTURIZE_EQUALUSAGE and PICTURIZE_ONCE will reduce the number of times a bitmap is used by this method.

 When PICTURIZE_ONCE is set, the method will try not to use the same bitmap twice. Note that if there aren’t enough images, the method will return the ERROR_NOT_ENOUGH_IMAGES code if this flag is set.

 When PICTURIZE_EQUALUSAGE is set, the method will use the same image more than once only if it is necessary to successfully complete the picturize process. If PICTURIZE_EQUALUSAGE is set, then for any bitmap, the number of times it is used differs from the number of times another bitmap is used by at most one. Therefore, most bitmaps will be used ‘n’ times, but some bitmaps will be used ‘n+1’ times.

This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Topics	Raster Images: Combining Images
Examining and Altering Bitmaps


pszDirectory Parameter For Picturize
pszDirectory

String containing the name of the directory containing the images. Only the images in the specified directory are used.  Images from subdirectories are NOT used.


iFlags Parameter For Picturize
iFlags

Flags that control the behavior of the process. Possible values are given below.  These values can be combined using OR (|) or +.

Value	Meaning

PICTURIZE_LOADALL	[0x0001] Load all files in memory.

PICTURIZE_RESIZE	[0x0002] Resize all images that are not the required size (fCellWidth x fCellHeight).

PICTURIZE_RESAMPLE	[0x0004] Resample the images that are not the required size (fCellWidth x fCellHeight). (slower process, better quality)

PICTURIZE_ONCE	[0x0010] Use an image only once throughout the process.

PICTURIZE_EQUALUSAGE	[0x0020] Use all images equally. That is, before an image will be used twice, all other images must be used at least once.

PICTURIZE_BESTFIT	[0x0040] Images will be resized to fit the image if the bitmap width or height is not a multiple of nCellWidth/nCellHeight.

0	The picturize process will not use any of the above flags. It will: reload all the files each time you look for a rectangle to substitute and ignore all the images present in pszDirectory if their size is not fCellWidth x fCellHeight


fCellWidth Parameter For Picturize
fCellWidth

The width of the images used to reconstruct the image.  The units depend on the ScaleMode property.


fCellHeight Parameter For Picturize
fCellHeight

The height of the images used to reconstruct the image.  The units depend on the ScaleMode property.


Return for Picturize
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


PicturizeBitmapList method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short PicturizeBitmapList(short iCellWidth, short iCellHeight, short iLightnessFact, OLE_HANDLE hList);

Overview	Refer to Combining Images.

Remarks

Picturizes the bitmap using thumbnail images created from the specified bitmap list.

The image, or selected region, is broken down into rectangles of size iCellWidth x iCellHeight. For each rectangle, the image in the list that best approximates that rectangle is inserted in the original image. The thumbnail image may be corrected, to approximate a rectangle.

The iLightnessFact parameter can be used to change the lightness of the big image by changing the lightness of each rectangle.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Picturize method, PicturizeSingle method

Topics	Raster Images: Combining Images
Examining and Altering Bitmaps


iCellWidth Parameter For PicturizeBitmapList
iCellWidth

Width of the thumbnail bitmap.


iCellHeight Parameter For PicturizeBitmapList
iCellHeight

Height of the thumbnail bitmap.


iLightnessFact Parameter For PicturizeBitmapList
iLightnessFact

Value that represents how much to lighten the thumbnail bitmap. Valid values are between 0 and 1000. This value is divided internally by 1000. Values between 0 and 499 darken the image. Values between 500 and 1000 lighten the image.


hList Parameter For PicturizeBitmapList
hList

Handle to the LEAD BitmapList used to create the thumbnail images which are in turn used to picturize the specified image.


Return for PicturizeBitmapList
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


PicturizeSingle method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short PicturizeSingle(OLE_HANDLE hBitmap, short iCellWidth, short iCellHeight, short iLightnessFact);

Overview	Refer to Combining Images.

Remarks

Picturizes the bitmap using the specified thumbnail image.

The image, or selected region, is broken down into rectangles of size iCellWidth x iCellHeight. For each rectangle, the thumbnail image is corrected to approximate that rectangle, and inserted in the original image. Note that every rectangle is replaced by the same image.

The iLightnessFact parameter can be used to change the lightness of the big image by changing the lightness of each rectangle.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Picturize method, PicturizeBitmapList method

Topics	Raster Images: Combining Images
Examining and Altering Bitmaps


hBitmap Parameter For PicturizeSingle
hBitmap

The Main Control's bitmap used to create the thumbnail.


iCellWidth Parameter For PicturizeSingle
iCellWidth

Width of the thumbnail bitmap.


iCellHeight Parameter For PicturizeSingle
iCellHeight

Height of the thumbnail bitmap.


iLightnessFact Parameter For PicturizeSingle
iLightnessFact

Value that represents how much to lighten the thumbnail bitmap. Valid values are between 0 and 1000. This value is divided internally by 1000. Values between 0 and 499 darken the image. Values between 500 and 1000 lighten the image.


Return for PicturizeSingle
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Pixel property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR Pixel (float x, float y);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Sets or gets the value of the specified pixel in the current bitmap.

The position is relative to the bitmap in the control. The unit of measure is determined by the ScaleMode property, although the value is always that of a pixel.

The standard Windows values for COLORREF(OLE_COLOR) represent either red, green, and blue color values, or an index into the bitmap's palette.  A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value.  If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette which holds the color value.You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes As Color Values. Please note that just because an image has a palette, that does not mean the value returned by this property is a palette index.

In the Document/Medical toolkits, the COLORREF value may represent a 16 bit grayscale value if the bBitmap is a 12 or 16-bit grayscale.  So that the value is not confused with an RGB value, the COLORREF_GRAY16 mask (0x04000000) is set.  In this case (0x0400YYYY), the lower 16 bits (0xYYYY) of the COLORREF value represent the 16-bit grayscale value. (0x0400FFFF is 16-bit white and 0x04000000is 16-bit black.) This is not a standard Windows value.  Therefore, LEADTOOLS elements will recognize a COLORREF having this format, but Windows elements will not.

If a 12 or 16-bit grayscale bitmap contains a LUT (as is the case when loading a DICOM file), the Pixel property will get the corresponding LUT value. In this situation, the original 12 or 16-bit grayscale value can be obtained by using the PixelData property.

For information on converting from a 16-bit value, refer to Converting 16-bit Grayscale Values.

See Also

Topics	Raster Images: Getting Current Information


x Parameter For Pixel
x

X coordinate of the pixel. This is a zero-based value.


y Parameter For Pixel
y

Y coordinate of the pixel. This is a zero-based value.


PixelData property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	VARIANT PixelData (float x, float y);

Overview	Refer to Examining and Altering Bitmaps

Remarks

Gets or sets the value of the specified pixel in the current bitmap. This property is similar to the Pixel property.

The position specified by x and y is relative to the bitmap in the control. The unit of measure is determined by the ScaleMode property.

This property differs from the Pixel property in that the pixel data contained in this property is not converted to a color. The data contained in this property is exactly as it is in the bitmap, with no conversions made. This is designed to preserve all the data associated with a pixel. For example, for bitmaps those contain alpha channel information, that information is preserved in this property.

In addition, this property actually manipulates 48 and 64-bit data for 48 or 64-bit bitmaps. The Pixel property however, performs conversions to 24-bit data, which causes some data loss.

See Also

Elements	Pixel property

Topics	Raster Images: Getting Current Information


x Parameter For PixelData
x

X coordinate of the pixel. This is a zero-based value.


y Parameter For PixelData
y

Y coordinate of the pixel. This is a zero-based value.


PolygonSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PolygonSize

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Specifies the size of the array used to store the vertices when creating a polygonal region.

To create a polygonal region, you must first build an ordered array of points for the vertices of the polygon; then create the region based on the array. The PolygonSize property specifies the size of the array. You can either specify a large array to start with, or you can increase the size of the array when necessary (without losing the existing points). For each vertex, you update the array by setting the following indexed properties:

 PolygonX property

 PolygonY property

You can then call the SetRgnPolygon method to add the region to the bitmap.

See Also

Elements	SetRgnEllipse method, SetRgnRect method, SetRgnRoundRect method, SetRgnColor method, OffsetRgn method

Topics	Raster Images: Creating and Using a Region


PolygonX property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float PolygonX (short iIndex);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Specifies the X coordinate of a vertex of a polygonal region.

The position is relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

To create a polygonal region, you must first build an ordered array of points for the vertices of the polygon; then create the region based on the array. The PolygonSize property specifies the size of the array. You can either specify a large array to start with, or you can increase the size of the array when necessary (without losing the existing points). For each vertex, you update the array by setting the following indexed properties:

 PolygonX property

 PolygonY property

You can then call the SetRgnPolygon method to add the region to the bitmap.

See Also

Topics	Raster Images: Creating and Using a Region


iIndex Parameter For PolygonX
iIndex

The index into the ordered array of points.


PolygonY property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float PolygonY (short iIndex);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Specifies the Y coordinate of a vertex a polygonal region.

The position is relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

To create a polygonal region, you must first build an ordered array of points for the vertices of the polygon; then create the region based on the array. The PolygonSize property specifies the size of the array. You can either specify a large array to start with, or you can increase the size of the array when necessary (without losing the existing points). For each vertex, you update the array by setting the following indexed properties:

 PolygonX property

 PolygonY property

You can then call the SetRgnPolygon method to add the region to the bitmap.

See Also

Topics	Raster Images: Creating and Using a Region


iIndex Parameter For PolygonY
iIndex

The index into the ordered array of points.


Posterize method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Posterize (short iLevels);

Overview	Refer to Applying Artistic Effects.

Remarks

Imposes a poster effect on the bitmap by quantizing the bitmap's colors to a specified number of color levels per plane. For example, two levels means two of red, two of green, and two of blue.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	GetChange method

Topics	Raster Images: Filtering Images
Raster Images: Where the Region Preempts the Bitmap


iLevels Parameter For Posterize
iLevels

The number of color levels to use. Valid values are 2 through 64.


Return for Posterize
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


PreferredLoadFormat property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long PreferredLoadFormat

Overview	Refer to Loading a Bitmap from a File

Remarks

Contains the file format to try first when recognizing files for loading or getting file information, etc. For a list of possible values, refer to Formats of Input Files. For example, if your application is going to work with lots of PNG files, you can set this to FILE_PNG. Then, when a file is loaded, LEADTOOLS will test to see if the file is a PNG first. If it is not, then LEADTOOLS will continue with its normal process for recognizing a file.

Set this property to - 1 for normal behavior.


PreLoadFilters method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short PreLoadFilters (short iFixedFilters, short iCachedFilters, BSTR pszFilters);

Overview	Refer to Loading Filters

Remarks

Specifies the file format filters to be loaded. Some operating systems (like Windows 95) have a limit for the number of DLLs that can be loaded at a time and that limit can be quickly reached, especially if there are several different controls on the same page/form or if the programming environments themselves load many DLLs. You can use this method to restrict the number of DLLs that LEADTOOLS ActiveX will load. Note that the fewer file import/export DLLs the ActiveX loads, the slower the loading/saving of files will be, since there will be more loading/unloading of DLLs.

pszFilters is in the form xyz, yuv... where XYZ are the 3 letters describing the file filter as in LFxyz14W.DLL or LFxyz14N.DLL. For instance, if pszFilter is PCX, TIF, CMP then LFPCX14N.DLL will be loaded then LFTIF14N.DLL and then LFCMP14N.DLL, in that order. The first iFixedFilters will stay in memory at all times, then the next iCachedFilters will be loaded.  However, if other filters will be needed, the cached filters might be unloaded to make room for the new DLLs. It is recommended that the most commonly used DLLs be loaded as fixed to minimize the time required to load/unload file filters. Also, some DLLs may require additional DLLs (like the LFAVI14N.DLL or LFFPX14N.DLL) so the exact number of DLLs loaded is not necessarily iFixedFilters+iCachedFilters.  For more information on available DLLs, refer to Files To Be Included With Your Application.

Note that PreLoadFilters has effect only if called before the first time you try to load, save or get information about a file. Calling this method after that will have no effect.

See Also

Elements	IgnoreFilters method

Topics	Working with the Control: General Behavior


iFixedFilters Parameter For PreLoadFilters
iFixedFilters

Number of filters that should stay loaded in memory at all times.


iCachedFilters Parameter For PreLoadFilters
iCachedFilters

Number of filters that should be loaded, but can be unloaded later to make room for other filters.


pszFilters Parameter For PreLoadFilters
pszFilters

String containing the filters which should be loaded.  If pszFilters is NULL, all file filters LEADTOOLS can find will be loaded and LEADTOOLS will determine the order in which the files will be used.


Return for PreLoadFilters
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


PrintEnd method (Main Control)

Visual Basic example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void PrintEnd (OLE_HANDLE hDC);

Overview	Refer to Printing an Image.

Remarks

Ejects the page and ends the print job.

Use the PrintStart method to begin a print job; use the Render method to print an image; then use the PrintEnd method to eject the page and end the print job.

See Also

Elements	Render method, PrintStart method

Topics	Raster Images: Printing Images


hDC Parameter For PrintEnd
hDC

The handle to the device context, which was returned by the PrintStart method.


Return for PrintEnd
Return Value

None.


PrinterScaleHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float PrinterScaleHeight

Overview	Refer to Printing an Image.

Remarks

(Read only) Gets the printable height of the default printer.

The unit of measure is determined by the ScaleMode property.

This property can be used with the Render method to print images.

See Also

Elements	PrinterScaleWidth property, ScaleMode property

Topics	Raster Images: Printing Images


PrinterScaleWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float PrinterScaleWidth

Overview	Refer to Printing an Image.

Remarks

(Read only) Gets the printable width of the default printer.

The unit of measure is determined by the ScaleMode property.

This property can be used with the Render method to print images.

See Also

Elements	PrinterScaleHeight property, ScaleMode property

Topics	Raster Images: Printing Images


PrintNewPage method (Main Control)

Visual Basic example

Syntax	void PrintNewPage (OLE_HANDLE hDC);

Overview	Refer to Printing an Image.

Remarks

(Visual Basic only) Ejects the page and starts the next page without ending the print job.

Use the PrintStart method to begin a print job; use the Render method to print an image; use the PrintEnd method to eject the page and end the print job.

Please note that this method is only for Visual Basic. It is not required in other languages.

See Also

Elements	PrintEnd method, Render method, PrintStart method

Topics	Raster Images: Printing Images


hDC Parameter For PrintNewPage
hDC

The handle to the device context, which was returned by the PrintStart method.


Return for PrintNewPage
Return Value

None.


PrintStart method (Main Control)

Visual Basic example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE PrintStart ();

Overview	Refer to Printing an Image.

Remarks

Starts a print job on the default printer.

This method returns an hDC that you can use when calling the Render method to print an image.

To eject the page and end the print job, call the PrintEnd method.

See Also

Elements	Render method, PrintEnd method

Topics	Raster Images: Printing Images


Return for PrintStart
Return Value

The device handle (hDC) for the default printer.


ProgressivePasses property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ProgressivePasses

Overview	Refer to Loading a Bitmap from a File.

Remarks

Specifies the number of paint-while-load passes when the file is a progressive LEAD or JPEG file.

This property is also valid when reading (but not when writing) interlaced PNG files.

When the PaintWhileLoad property is TRUE, the full dimensions of the image can paint quickly on the first pass. Then, the image becomes progressively clearer on subsequent passes.

You can set this property before saving a LEAD or JPEG file to specify the possible number of passes. You can set it before loading a progressive LEAD or JPEG file (or an interlaced PNG file) to determine how many passes are actually used.

Technically, only files with more than three passes are progressive files. They include full color in the low-resolution first pass; subsequent passes improve the resolution. Files that contain two or three passes are multiscan files. They include grayscale information in the first pass, and color information in the subsequent pass or passes.

For information on progressive loading of JBIG files, refer to Implementing JBIG Features.

Setting	Description

0	(When saving) Save as an ordinary CMP or JPEG file, not a progressive file.

Any positive number	(When saving or loading) Use the specified number of passes.

PROGRESSIVEPASSES_WHEN_MEANINGFUL	(Only when loading) Stop painting when full clarity is achieved.

PROGRESSIVEPASSES_ALWAYS	(Only when loading) Use the number of passes specified in the file being loaded.

PROGRESSIVEPASSES_ONCE	(Only when loading) Paint once with full clarity.

See Also

Elements	LoadPasses property

Topics	Raster Images: Loading Files
Raster Images: Saving Files
Raster Images: Getting and Setting File Information


ProgressStatus event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void ProgressStatus (short iPercent);

Overview	Refer to Detecting Events.

Remarks

Occurs repeatedly as LEADTOOLS processes data, so that you can update a status bar or detect a user interrupt.

This event is generated only if the EnableProgressEvent property is set to TRUE.

To interrupt a process, set the EnableProgressEvent property to FALSE.

The following methods generate ProgressStatus events:

AddNoise method
Average method
BinaryFilter method
ColorMerge method
ColorRes method
ColorSeparate method
Combine method
Contrast method
Deskew method
Despeckle method
Emboss method
Fill method
Flip method
GammaCorrect method
GetHistogram method
Grayscale method
Halftone method
HistoContrast method
HistoEqualize method
Hue method
Intensity method
IntensityDetect method
Invert method
Load method
Median method
Mosaic method
Posterize method
RemapIntensity method
Reverse method
Rotate method
Saturation method
Save method
Sharpen method
Shear method
Size method
SpatialFilter method
StretchIntensity method
Underlay method

See Also

Topics	Working with the Control: General Behavior


iPercent Parameter For ProgressStatus
iPercent

The completion percentage of the current LEADTOOLS functionality.


ProgressStatus event (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void ProgressStatus (short iPercent);

Overview	Refer to Detecting Events.

Remarks

Occurs repeatedly as LEADTOOLS processes data, so that you can update a status bar or detect a user interrupt.

This event is generated only if the EnableProgressEvent property is set to TRUE.

To interrupt a process, set the EnableProgressEvent property to FALSE.

See Also

Topics	Working with the Control: General Behavior


iPercent Parameter For ProgressStatus
iPercent

The completion percentage of the current LEADTOOLS functionality.


RasterizeViewMode property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short RasterizeViewMode

Overview	Refer to Loading Vector Files.

Remarks

(Persistent property, available at design time) Sets the viewport mode value that LEADTOOLS uses when loading the following Vector file formats: DXF, DWF, DWG, WMF, EMF, PCT, CGM, DRW, PLT, TIF (with a DXF saved internally) and Intergraph Vector.

Value	Meaning

L2D_USE_BEST	Fit the drawing into the current viewport width and height. Final image size is less than or equal to viewport size.

L2D_USE_WIDTH	Use the current viewport width. Calculate new height, preserving the aspect ratio. Final image size has the same width as the current viewport width, with the height less than or equal to the current viewport height.

L2D_USE_HEIGHT	Use the current viewport height. Calculate the new width, preserving the aspect ratio. Final image size has the same height as the current viewport height, with the width less than or equal to the current viewport width.

L2D_USE_WIDTH_HEIGHT	Use both the width and the height (stretch image if necessary). Final image size has the same width and height as the current viewport size.

Please note that read and write support for the file formats listed above requires a LEADTOOLS Vector toolkit. Read support for the file formats listed above requires an additional file format plug in. In addition, support for these files formats must be unlocked. For information about unlocking support, refer to Unlocking Vector File Format Support. For more information on available File Format Plug ins, refer to Topic Selection and click on LEAD Products.

See Also

Elements	RasterizeViewportWidth property,RasterizeViewportHeight property

Topics	Raster Images: Loading Files


RasterizeViewportHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short RasterizeViewportHeight

Overview	Refer to Loading Vector Files.

Remarks

(Persistent property, available at design time) Sets the viewport height value that LEADTOOLS uses when loading the following Vector file formats:  DXF, DWF, DWG, WMF, EMF, PCT, CGM, DRW, PLT, TIF (with a DXF saved internally) and Intergraph Vector.

A 3D file format usually doesn't have a physical size. The user can specify a viewport (physical size up to which the drawing can be rendered) by using the RasterizeViewportHeight property and the RasterizeViewportWidth property. How the drawing is to be rendered inside this viewport depends on the current viewport mode set with the RasterizeViewMode property.

The default for this property is 480.

Please note that read and write support for the file formats listed above requires a LEADTOOLS Vector toolkit. Read support for the file formats listed above requires an additional file format plug in. In addition, support for these files formats must be unlocked. For information about unlocking support, refer to Unlocking Vector File Format Support. For more information on available File Format Plug ins, refer to Topic Selection and click on LEAD Products.

See Also

Elements	RasterizeViewportWidth property, RasterizeViewMode property

Topics	Raster Images: Loading Files


RasterizeViewportlWidth property (Main Control)
RasterizeViewportWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short RasterizeViewportWidth

Overview	Refer to Loading Vector Files.

Remarks

(Persistent property, available at design time) Sets the viewport width value that LEADTOOLS uses when loading the following Vector file formats:  DXF, DWF, DWG, WMF, EMF, PCT, CGM, DRW, PLT, TIF (with a DXF saved internally) and Intergraph Vector.

A 3D file format usually doesn't have a physical size. The user can specify a viewport (physical size up to which the drawing can be rendered) by using the RasterizeViewportWidth property and the RasterizeViewportHeight property. How the drawing is to be rendered inside this viewport depends on the current viewport mode set with the RasterizeViewMode property.

The default for this property is 640.

Please note that read and write support for the file formats listed above requires a LEADTOOLS Vector toolkit. Read support for the file formats listed above requires an additional file format plug in. In addition, support for these files formats must be unlocked. For information about unlocking support, refer to Unlocking Vector File Format Support. For more information on available File Format Plug ins, refer to Topic Selection and click on LEAD Products.

See Also

Elements	RasterizeViewportHeight property, RasterizeViewMode property

Topics	Raster Images: Loading Files


ReadComment method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	VARIANT ReadComment (BSTR pszFile, long lPage, short iIndex);

Overview	Refer to Maintaining File Comments.

Remarks

Returns the value of the specified comment in an image file.

Some file formats can contain comments, and some cannot, and each file format has its own set of comment types. With the ReadComment method, you can get the value of any comment in the file. The index into the array of comments determines the type of comment, as described in Types of File Comments.

The Comment property specifies the comments to be saved when you save an image in a file. If you want to preserve existing comments in the file when you save the image, you must use the ReadComment method to update the Comment property array.

See Also

Elements	Comment property


pszFile Parameter For ReadComment
pszFile

Character string containing the name of the file.


lPage Parameter For ReadComment
lPage

The page number (for multipage files) that contains the image.

If the file is not a multipage file, pass 0.


iIndex Parameter For ReadComment
iIndex

Index into the array of comments. For possible values, refer to Types of File Comments.


Return for ReadComment
Return Value

Value of the specified comment in an image file. For the data types of various comments, refer to Types of File Comments.


ReadTag method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short ReadTag (LPCTSTR pszFile, long lPage, long lTag);

Overview	Refer to Implementing TIFF Tags

Remarks

Reads the specified tag from the specified file. The tag will be set as tag 0 in the control’s internal tag list. Once read, the type, number of data values and actual data values can be retrieved using the GetTagType method, the GetTagCount method and the GetTagData method.

For more information on setting tags, refer to the SetTag method.

See Also

Functions:	SetTag method, GetTagType method, GetTagCount method, GetTagData method, WriteTag method, Save method, Comment property

Topics	Raster Images: Getting and Setting File Information


pszFile Parameter For ReadTag
pszFile

String that contains the name of the file from which to read the specified tag. Please note that this file must exist.


iPage Parameter For ReadTag
iPage

Number of the page within the specified file from which to read the specified tag. The first page is page 1. The specified page must exist. If the page does not exist, an error will be returned.


lTag Parameter For ReadTag
lTag

The tag to read from the specified file. For more information on tags available in the TIFF format, refer to the SetTag method.


Return for ReadTag
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ReadyState property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long ReadyState

Overview	Refer to Implementing Internet Features.

Remarks

Indicates the current state of an image that is loaded asynchronously using the BitmapDataPath property.

Value	Description

READYSTATE_LOADING	Currently loading

READYSTATE_COMPLETE	Finished loading

See Also

Elements	BitmapDataPath property, ReadyStateChange event

Topics	Raster Images: Loading Files


ReadyStateChange event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void ReadyStateChange (long ReadyState);

Overview	Refer to Implementing Internet Features.

Remarks

Occurs when there is a change in the ReadyState property.

The ready state is the state of an image that is loaded asynchronously using the BitmapDataPath property.

See Also

Elements	BitmapDataPath property, ReadyState property

Topics	Raster Images: Loading Files


ReadyState Parameter For ReadyStateChange
ReadyState

The new value of the ReadyState property. The following are possible values:

Value	Description

READYSTATE_LOADING	Currently loading

READYSTATE_COMPLETE	Finished loading


RefBitmap property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	BOOL RefBitmap

Overview	Refer to Bitmaps and Bitmap Lists.

Remarks

Indicates whether an assignment to the Bitmap property should do a copy or simply reference the source control's Bitmap property.

This is used mainly to communicate between the Main control and a Common Dialog, ISIS, or OLE DB Control.  When this property is TRUE, any assignments to the Main Control's Bitmap property will cause the Main Control to reference the source control's Bitmap, instead of making a copy.  This can be used to reduce memory load when dealing with large images.

When this property is FALSE, an assignment to the Main Control's Bitmap proprety will create a copy of the source control's Bitmap in memory.

Note: When this property is set to True, any assignment to the Main Control's Bitmap property will invalidate the bitmap in the source control.

Use this property with the FileOpen method when you want to use the DLG_FO_AUTOPROCESS flag.

You should set this property back to False after making an assignment if you do not always wish to make references. For example:

LEAD1.RefBitmap = True
LEAD1.Bitmap = LEADDlg1.Bitmap
 LEAD1.RefBitmap = False

See Also

Elements	Imaging Common Dialog Bitmap property, ISIS Bitmap property, Main Bitmap property, OLE DB Bitmap property, FileOpen method


ReleaseBitmapDC method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ReleaseBitmapDC ();

Overview	Refer to Using the Windows API.

Remarks

Reverses the action of the GetBitmapDC method.

You should use this method when the bitmap no longer needs to be available for drawing functions.

See Also

Topics	Raster Images: Creating and Deleting Images
Raster Images: Drawing on a Bitmap


Return for ReleaseBitmapDC
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


RefBitmapList property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL RefBitmapList

Overview	Refer to Bitmaps and Bitmap Lists.

Remarks

Indicates whether an assignment to the BitmapList property should do a copy or simply move the source control's BitmapList to the destination control's BitmapList. Possible values are:

Value	Meaning

TRUE	Move the source control's bitmap list to the bitmap list of the destination control.

FALSE	Copy the source control's bitmap list into the bitmap list of the destination control.

This property is taken into account when setting the BitmapList property of the main control. If RefBitmapList is true, then the destination control will ‘steal’ the bitmaps from the source control. The source control will eventually detect that its bitmap list is empty, but you should notify the source control that its list has been freed by setting its bitmap list to NULL. If RefBitmapList is False, then the destination control makes a copy of the source control’s bitmap list. That means that two copies of the list exist in memory. Many times, we are trying to move the list from one control to the other with code like this:

LEAD1.BitmapList = LEAD2.BitmapList
LEAD2.BitmapList = 0

In this case, it is much faster to set RefBitmapList to TRUE before assigning the bitmap list. By doing that, you don’t have two copies of the bitmap list. (Which is what you have if you do "LEAD2.BitmapList = 0").

See Also

Elements	BitmapList property

Topics	Raster Images: Creating and Maintaining Lists of Images


ReleaseClientDC method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ReleaseClientDC ();

Overview	Refer to Using the Windows API.

Remarks

Reverses the action of the GetClientDC method.

You should use this method when the Main Control's client area no longer needs to be available for Windows API functions.

See Also

Elements	GetClientDC method

Topics	Working with the Control: Client Area Usage


Return for ReleaseClientDC
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


RemapHue method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short RemapHue (BOOL bUseMaskTable, BOOL bUseHTable, BOOL bUseSTable, BOOL bUseVTable);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Uses a lookup table to change a bitmap's hue values. The saturation and value tables change S and V values only if a particular hue value is marked as non-zero in the MaskTable property.

This method can be used to change a range of colors to another range of colors.  For example, it could be used to change all red pixels to any color, where a red pixel can have any brightness (V) and any amount of white (saturation).  A red pixel in this case would be

RGB(x,y,y) where:

0<=x<255 and

0<=y<x

or in the HSV color space

HSV(0,x,x) where:

0<=x<=255

The MaskTable(i) lookup table identifies which values in the HTable(i) are valid. If a MaskTable(i) value is 0, then the corresponding value in the HTable(i) is ignored.  If a MaskTable(i) value is non-zero, then the corresponding value in the HTable(i) is used.  For example, if a pixel has a hue value of 240 and MaskTable(240)] is nonzero, then the hue value of 240 is replaced with HTable(240). Traditionally, hue ranges from 0 to 359. For the lookup table, the range of 0 to 359 is remapped to a range of 0..255. For example,

Color	Hue(0..359)	Hue(0..255)
Red	0	0
Green	120	85
Blue	240	170
Use HSV_HfromRGB, HSV_SfromRGB, HSV_VfromRGB, and RGBfromHSV methods to convert between RGB and HSV color space.

Calling this method with bUseMaskTable set to FALSE and bUseSTable set to TRUE will let you change the Saturation of each color. Similarly, calling this method with nUseMaskTable set to FALSE and bUseVTable set to TRUE will let you change the Value of each color.

This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Elements	MaskTable property, HTable property, STable property, VTable property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Modifying Intensity Values


bUseMaskTable Parameter For RemapHue
bUseMaskTable

Flag that indicates whether to use the MaskTable property to identify valid values within the HTable property. Possible values are:

Value	Meaning

TRUE	Use the MaskTable property to identify which values in the HTable property are valid. If MaskTable(i) is not 0, then HTable(i) is to be used. If MaskTable(i) is 0, then HTable(i) is ignored.

FALSE	All entries in the HTable are marked as valid.


bUseHTable Parameter For RemapHue
bUseHTable

Flag that indicates whether to use the HTable property. Possible values are:

Value	Meaning

TRUE	Use the HTable property, which is the Hue lookup table. If MaskTable(i) for a particular hue is not 0, then the hue is changed to the corresponding entry in HTable(i). For example, if a pixel has a hue of 85 and MaskTable(85) is NOT 0, then the hue of the pixel is changed to the the hue in HTable(85).

FALSE	The hue of each pixel is unchanged.


bUseSTable Parameter For RemapHue
bUseSTable

Flag that indicates whether to use the STable property. Possible values are:

Value	Meaning

TRUE	Use the STable property, which is the Saturation lookup table. If MaskTable(i) for a particular hue is not 0, then the saturation is changed to the corresponding entry in STable(i). For example, if a pixel has a hue of 85 and MaskTable(85) is NOT 0, then the saturation of the pixel is changed to the saturation in STable(85). If bUseHTable is FALSE, the saturation is changed to STable(85).

FALSE	The saturation of each pixel is unchanged.


bUseVTable Parameter For RemapHue
bUseVTable

Flag that indicates whether to use the VTable property. Possible values are:

Value	Meaning

TRUE	Use the VTable property, which is the Value lookup table. If MaskTable(i) for a particular hue is not 0, then the Value is changed to the corresponding entry in VTable(i). For example, if a pixel has a hue of 85 and MaskTable(85) is NOT 0, then the Value of the pixel is changed to the Value in VTable(85). If bUseHTable is FALSE, the Value is changed to VTable(85).

FALSE	The Value of each pixel is unchanged.


Return for RemapHue
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


RemapHueTablesSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long RemapHueTablesSize;

Overview	Refer to Changing Brightness and Contrast.

Remarks

(Document/Medical only). Gets or sets the number of entries in the HTableL, MaskTableL, STableL and VTableL properties or the HTable, MaskTable, STable and VTable properties. Possible values are:

Value	Meaning

65536	16-bit grayscale or 48-bit color image

4096	12-bit images

256	Image with any other bits per pixel

For 16-bit grayscale and 48-bit color images the MaskTableL, HTableL, STableL and VTableL properties must be used for the mask, hue, saturation and value information.

For images of any other bits per pixel the MaskTable, HTable, STable and VTable properties must be used for the mask, hue, saturation and value information.

See Also

Elements	RemapHue method, MaskTableL property, HTable property, STableL property, VTableL property, MaskTable property, HTable property, STable property, VTable property

Topics	Raster Images: Modifying Intensity Values


RemapIntensity method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short RemapIntensity (short iChannel);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Uses a lookup table to change the bitmap's intensity values. You can apply the change to red, green, blue, or all color channels.

Use the RemapTable and RemapTableSize properties to maintain the lookup table. Intensity levels range from 0 to the value of RemapTableSize property - 1. The current intensity values correspond to the table indexes. The values of the entries are the new values to be applied.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	RemapTable property

Topics	Raster Images: Modifying Intensity Values
Raster Images: Where the Region Preempts the Bitmap


iChannel Parameter For RemapIntensity
iChannel

Possible values are:

Value	Meaning

CHANNEL_MASTER	All channels.

CHANNEL_RED	Red channel only.

CHANNEL_GREEN	Green channel only.

CHANNEL_BLUE	Blue channel only.


Return for RemapIntensity
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


RemapTable property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long RemapTable (long iIndex);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Is the lookup table that the RemapIntensity method uses to change the bitmap's intensity values.

Intensity levels range from:

0 to 255	for bitmaps other than 12 or 16-bit grayscale.

0 to 4095	for 12-bit bitmaps.

0 to 65535	for 16-bit bitmaps.

The current intensity values correspond to the table indexes. The values of the entries are the new values to be applied.

See Also

Elements	RemapIntensity method, RemapTableSize property

Topics	Raster Images: Modifying Intensity Values


iIndex Parameter For RemapTable
iIndex

The index into the lookup table. The index corresponds to the current intensity value, and the value of the entry is the intensity value to be applied.


RemapTableSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long RemapTableSize;

Overview	Refer to Changing Brightness and Contrast.

Remarks

Specifies the number of entries in the RemapTable property.

This value that must be set for this property depends on the color resolution (bits per pixel) of the image, as follows:

BPP	Table Size

Color 64, 48 or grayscale 16	65536

Grayscale 12	4096

Any other value	256

See Also

Elements	RemapIntensity method, RemapTable property

Topics	Raster Images: Modifying Intensity Values


Remove method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short Remove (long nIndex);

Overview	Refer to Using the ImageList Control.

Remarks

Removes the specified item from the ImageList Control and frees the memory associated with the item.

See Also

Elements	Item property, Insert method, InsertAt method, Count property, Sort method, InsertFromBitmapList method, LoadFromFile method, SaveToFile method

Topics	Raster Images: Displaying Images


nIndex Parameter For Remove
nIndex

Index of the item to be removed.


Return for Remove
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


RemoveRedeye method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short RemoveRedeye(OLE_COLOR rcNewColor, short iThreshold, short iLightness);

Overview	Refer to Applying Artistic Effects.

Remarks

Removes the "red eye" effect in color images by converting the red color in the eye to the new specified color.

This method has no effect on grayscale images, since there is no "red eye" problem in grayscale images.

To use this method the user should select a small region around the eye. Otherwise, the method will change all the red color in the image. This method also allows the user to replace the red color with a new color for the eyes that is nearest to the original color.

This method supports 48 and 64-bit color images. Support for 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Topics	Correcting Colors
Raster Images: Modifying Intensity Values
Raster Images: Modifying Individual Pixels


rcNewColor Parameter For RemoveRedeye
rcNewColor

New color value used to replace the red color in the eyes.


iThreshold Parameter For RemoveRedeye
iThreshold

Threshold value that indicates which pixels will be changed by this method. All pixels with a red component value greater than this value will be changed. Pixels with a red component value less than this value will not be changed. This value is between 0 and 255.


iLightness Parameter For RemoveRedeye
iLightness

"Percentage" value that indicates whether the pixels that are replaced are lightened or darkened. If this value is greater than 100, the replaced pixels will be lightened. If this value is less than 100, the replaced pixels will be darkened. This method preserves the lightness of the original pixels and substitutes the red color with the new color.


Return for RemoveRedeye
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Render method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example

Syntax	short Render (OLE_HANDLE hDC, float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Printing an Image.

Remarks

Prints an image or displays the image in any device context.

You must specify the device context, and the position and dimensions of the printed image. The measurements use the scale mode of the device context.

The source rectangle, normally used for displaying an image, can also be used to limit which part of the bitmap is printed. For an illustration of how the source rectangle works, refer to Specifying Both the Source and Destination Rectangles. To specify the source rectangle, you can use the SetSrcRect method. (You can also use the source clipping rectangle, but that is usually unnecessary, and the code is more complex.)

If the fLeft parameter is 0, the fTop parameter is 0, or both the fLeft and the fTop parameters are 0, the RenderCenter property can be used to determine whether the image is centered, or rendered at the point specified by fLeft and fTop.

See Also

Elements	PrintEnd method, PrintStart method

Topics	Raster Images: Printing Images


hDC Parameter For Render
hDC

Handle to the device context (DC) where the bitmap is to print. The mapping mode of the device context must be MM_TEXT.


fLeft Parameter For Render
fLeft

X position to start the print. The value is in dots, and the actual position depends on the dots per inch (DPI) of the printer.Pass a 0 to center the image horizontally on the page.


fTop Parameter For Render
fTop

Y position to start the print. The value is in dots, and the actual position depends on the dots per inch (DPI) of the printer. Pass a 0 to center the image vertically on the page.


fWidth Parameter For Render
fWidth

The printed width. The value is in dots, and the actual width depends on the dots per inch (DPI) of the printer. Pass a 0 to let the method calculate the width. If only the width or only the height is specified, the method will calculate the remaining dimension. If 0 is passed for both the width and the height, the method calculates the maximum dimensions that fit on the page while preserving the aspect ratio.


fHeight Parameter For Render
fHeight

The printed height. The value is in dots, and the actual height depends on the dots per inch (DPI) of the printer. Pass a 0 to let the method calculate the width. If only the width or only the height is specified, the method will calculate the remaining dimension. If 0 is passed for both the width and the height, the method calculates the maximum dimensions that fit on the page while preserving the aspect ratio.


Return for Render
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


RenderCenter property (Main Control)

Visual Basic example   Visual C++ example

Syntax	BOOL RenderCenter;

Overview	Refer to Printing an Image.

Remarks

Gets or sets a value that indicates whether an image is centered when it is printed or displayed in any device context, using the Render method. This property is only used if one of the following is true:

 the fLeft parameter of the Render method is 0,

 the fTop parameter of the Render method is 0,

 both the fLeft and the fTop parameters of the Render method are 0.

Possible values are:

Setting	Description
TRUE	If only the fLeft parameter of the Render method is 0, the image will be centered horizontally; if only the fTop parameter of the Render method is 0, the image will be centered vertically; if both the fLeft and the fTop parameters of the Render method are 0, the image will be centered horizontally and vertically.
FALSE	The image will not be centered, but will be rendered at position fLeft, fTop on the DC.
See Also

Elements	Render method, PrintEnd method, PrintStart method

Topics	Raster Images: Printing Images


RepaintRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short RepaintRect (float fLeft, float fTop, float fWidth, float fHeight, BOOL bErase);

Overview	Refer to Displaying an Image.

Remarks

Repaints the specified rectangular area in the Main Control's client area.

See Also

Elements	AutoRepaint property, ForceRepaint method, PaintRgnOnly property

Topics	Raster Images: Displaying Images
Raster Images: Creating and Using a Region


fLeft Parameter For RepaintRect
fLeft

The X coordinate of the origin of the rectangle to paint.

The position is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fTop Parameter For RepaintRect
fTop

The Y coordinate of the origin of the rectangle to paint.

The position is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For RepaintRect
fWidth

The width of the rectangle to paint.

The measurement is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For RepaintRect
fHeight

The height of the rectangle to paint.

The measurement is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


bErase Parameter For RepaintRect
bErase

Specifies whether to erase the background before painting.

Setting	Description

TRUE	Erase the background.

FALSE	Do not erase the background.


Return for RepaintRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Resample property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL Resample

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Flag indicating whether or not to use interpolated resize when generating thumbnails.

Interpolated resize is slower, but produces better quality thumbnails.

Default setting is True.

See Also

Elements	BrowseDir method, ThumbnailWidth property, ThumbnailHeight property, MaintainAspect property, ThumbnailBackgroundColor property, ForceSize property, LoadStamp property

Topics	Raster Images: Using the Thumbnail Browser


Resize event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void Resize (void);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when the ImageList Control first appears and whenever the size of the control changes.

See Also

Elements	Click event, DblClick event, KeyDown event, KeyPress event, KeyUp event, MouseMove event, MouseDown event, MouseUp event, Scroll event

Topics	Raster Images: Displaying Images


Resize event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void Resize ();

Overview	Refer to Detecting Events.

Remarks

Occurs when the Main Control first appears and whenever the size of the control changes.

See Also

Elements	GetSize method

Topics	Raster Images: Doing Geometric Transformations


ResizeRgn method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short ResizeRgn(short iDim, short iFlag, BOOL bAsFrame);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Resizes the bitmap region by the specified number of pixels.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Size method

Topics	Raster Images: Creating and Using a Region


iDim Parameter For ResizeRgn
iDim

Number of pixels by which to resize the region.


iFlag Parameter For ResizeRgn
iFlag

Flag that indicates whether to contract or expand the bitmap region.  Possible values are:

Value	Meaning

RGN_EXPAND	[0x0001] Expand the region.

RGN_CONTRACT	[0x0002] Contract the region.


bAsFrame Parameter For ResizeRgn
bAsFrame

Flag that indicates whether to create a frame associated with the resized bitmap region. Possible values are:

Value	Meaning

TRUE	Create a frame of thickness iDim for the resized region. If iFlag is RGN_EXPAND, the frame created will exist outside the boundaries of the resized region. If iFlag is RGN_CONTRACT, the frame will be within the boundaries of the resized region.

FALSE	Resize the region only. Do not create a frame.


Return for ResizeRgn
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Reverse method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Reverse ();

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Reverses the bitmap (left to right) to produce a mirror image.

See Also

Topics	Raster Images: Doing Geometric Transformations
Raster Images: Methods That Transform the Region and the Bitmap (Document/Medical only)


Return for Reverse
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


RGBfromHSV method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR RGBfromHSV (short nH, short nS, short nV);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Returns a COLORREF that is equivalent to the color represented by the HSV values.  Each HSV value ranges from 0..255.  Traditionally, hue ranges from 0 to 359.  For HSV_HfromRGB, the range of 0 to 359 is remapped to a range of 0..255.  For example,

Color	Hue(0..359)	Hue(0..255)
Red	0	0
Green	120	85
Blue	240	170
Saturation entries range from 0 to 255 where

0:	Contains the "most" white

255	Contains no white

Value entries range from 0 to 255 where

0:	Contains the "most" black

255	Contains the least black

The standard Windows values for COLORREF(OLE_COLOR) represent either red, green, and blue color values, or an index into the bitmap's palette.  A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value.  If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette which holds the color value. You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes As Color Values. Please note that just because an image has a palette, that does not mean the value returned by this property is a palette index.

See Also

Elements	HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Doing Color Space Conversions
Creating and Using a Bitmap Region


nH Parameter For RGBfromHSV
nH

Hue of the color for which to return the RGB equivalent.


nS Parameter For RGBfromHSV
nS

Saturation of the color for which to return the RGB equivalent.


nV Parameter For RGBfromHSV
nV

Value of the color for which to return the RGB equivalent.


Return for RGBfromHSV
Return Value

The OLE_COLOR equivalent of the color specified by nH, nS and nV.


RgnChange event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void RgnChange ();

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Occurs each time the bitmap region is created or updated.

This event is especially useful with the RgnMarkingMode property, which automates the creation of regions.

See Also

Elements	RgnMarkingMode property, RgnFrameType property

Topics	Raster Images: Creating and Using a Region


RgnFrameColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR RgnFrameColor

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Color used to highlight a reigion by displaying a filled color representation of the region.  This property is only valid when the RgnFrameType property is set to RGNFRAME_COLOR.

This color will be XORed with colors within a region to determine the new colors for displaying the region. The color corresponding to a particular part of the region is determined as follows:

Region Color Displayed = (color of pixel in region) XOR (crRgnColor)

This is particularly useful when displaying regions with black and white images. All black pixels in a region are displayed with color RgnFrameColor, and all white pixels are displayed ~(RgnFrameColor). For example, suppose that RgnFrameColor is light green (BGR 0x80FF40). All black pixels in the region are displayed as RgnFrameColor. All white pixels in the region are displayed as 0xFFFFFF XOR 0x80FF40 = 0x7F00BF, which is purple.

See Also

Elements	RgnFrameType property

Topics	Raster Images: Creating and Using a Region


RgnFrameType property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short RgnFrameType

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Displays or hides an outline of the current region.

Value	Meaning

RGNFRAME_NONE	Hide the frame.

RGNFRAME_STATIC	Display a static frame. The frame, itself, is inside the region.

RGNFRAME_ANIMATED	Display an animated frame. The frame, itself, is inside the region.

RGNFRAME_COLOR	Display the region with the color indicated in the RgnFrameColor property.

See Also

Elements	RgnMarkingMode property, RgnChange event

Topics	Raster Images: Creating and Using a Region


RgnHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float RgnHeight

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The height of the bounding rectangle of the bitmap region.

The size is unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

See Also

Elements	HasRgn property, IsPtInRgn method, GetRgnArea method, RgnLeft property, RgnTop property, RgnWidth property

Topics	Raster Images: Creating and Using a Region


RgnLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float RgnLeft

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The X coordinate of the origin of the bounding rectangle of the bitmap region.

The position is unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

See Also

Elements	HasRgn property, IsPtInRgn method, GetRgnArea method, RgnHeight property, RgnTop property, RgnWidth property

Topics	Raster Images: Creating and Using a Region


RgnMarkingMode property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short RgnMarkingMode

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Enables automatic creation of a bitmap region, based on MouseDown, MouseMove, and MouseUp events.

This method supports creation of a rectangle, rounded rectangle, ellipse, or freehand region. It automatically handles scaling differences between the displayed image and the bitmap. On the MouseDown event, it begins outlining where the region will appear on the screen. It updates the outline on each MouseMove event. Then, on the MouseUp event, it deletes the displayed outline and creates the bitmap region. To make an outline of the region visible at that point, you must set the RgnFrameType property.

Value	Meaning

RGNMARK_NONE	Disable automatic creation of a bitmap region.

RGNMARK_RECT	Enable creation of a rectangular region.

RGNMARK_ROUNDRECT	Enable creation of a rounded rectangular region.

RGNMARK_ELLIPSE	Enable creation of an elliptical region.

RGNMARK_FREEHAND	Enable creation of a freehand region, which is actually a polygonal region, with one vertex for each MouseMove event.

See Also

Elements	RgnChange event, RgnFrameType property

Topics	Raster Images: Creating and Using a Region


RgnTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float RgnTop

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The Y coordinate of the origin of the bounding rectangle of the bitmap region.

The position is unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

See Also

Elements	HasRgn property, IsPtInRgn method, GetRgnArea method, RgnHeight property, RgnLeft property, RgnWidth property

Topics	Raster Images: Creating and Using a Region


RgnWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float RgnWidth

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The width of the bounding rectangle of the bitmap region.

The size is unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

See Also

Elements	HasRgn property, IsPtInRgn method, GetRgnArea method, RgnHeight property, RgnLeft property, RgnTop property

Topics	Raster Images: Creating and Using a Region


Rotate method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Rotate (long iAngle, short iFlags, OLE_COLOR crFill);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Rotates the bitmap by the hundredths of degrees specified, and lets you specify the background color to be uncovered.

This method has the following features:

 It uses the center of the bitmap as the center of rotation.

 It can rotate the bitmap clockwise or counterclockwise up to 360 degrees in hundredth-of-a-degree increments.

 It can resize the bitmap to accommodate the rotated height and width, or it can retain the original height and width, cropping the bitmap as necessary.

 It lets you specify the background color to fill any new area created by the rotation.

The only images that are interpolated are:

 8-bit grayscale images (for best results, all gray values should be in the bitmap’s palette). If the rotation doesn’t give the expected results, you can call Grayscale (8) to change the bitmap into a proper grayscale bitmap.

 12-bit and 16-bit grayscale bitmaps that don’t have a palette. Grayscale bitmaps can have a palette if they have been loaded from certain DICOM images or if the control’s bitmap has been changed by setting the LowBit, HighBit properties, or if GetWindowLevel method has been called. Call Grayscale(12) or Grayscale(16) if Rotate doesn’t seem to do any interpolation during the rotation.

 16-bit color images

 24-bit, 32-bit, 48-bit and 64-bit color images

For the other images, the Rotate method ignores the interpolation flags and the rotate is performed without interpolation.

ROTATE_RESAMPLE and ROTATE_BICUBIC can be combined with ROTATE_RESIZE, but not with each other. So you can pass ROTATE_RESAMPLE|ROTATE_RESIZE, but not ROTATE_RESAMPLE|ROTATE_BICUBIC.

If ROTATE_RESIZE is set, then the image is resized. Otherwise, the image is cropped.

See Also

Elements	FastRotate method , GetAngle method

Topics	Raster Images: Doing Geometric Transformations
Raster Images: Methods That Transform the Region and the Bitmap (Document/Medical only)


iAngle Parameter For Rotate
iAngle

Hundredths of degrees to rotate (+/-). This can be a number from 1 to 36,000. A positive value will rotate the bitmap in a clockwise rotation, while a negative value will rotate the bitmap in a counter-clockwise rotation.


iFlags Parameter For Rotate
iFlags

Flag to keep the resulting bitmap the same size as the original bitmap or to resize according to the rotation specified. Valid values are:

Value	Meaning

ROTATE_RESIZE	[0x0001] Size resulting bitmap as needed.

ROTATE_RESAMPLE	[0x0002] Perform bilinear interpolation when rotating.

ROTATE_BICUBIC	[0x0004] Perform bicubic interpolation when rotating.

0	Do not resize the bitmap. Crop it.


crFill Parameter For Rotate
crFill

The background fill color.

If the image is 8 bits per pixel or less, the color comes from the current palette, and it may not exactly match the specified color.

You can specify a COLORREF value (the return value of the RGB macro), or you can specify a palette index as explained in Using Palette Indexes As Color Values.


Return for Rotate
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


RowCount property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long RowCount

Overview	Refer to Using the Image List Control.

Remarks

(Read-only)(Runtime-only) Gets the current number of rows of items in the ImageList Control.

See Also

Elements	Insert method, Remove method, ColumnCount property, Count property, Clear method, Item property

Topics	Raster Images: Displaying Images


RubberBand event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void RubberBand ();

Overview	Refer to Marking a Selection with a Rubberband.

Remarks

Occurs before the MouseUp event, when the AutoRubberBand property is set to TRUE.

See Also

Topics	Working with the Control: Client Area Usage


RubberBandHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float RubberBandHeight

Overview	Refer to Marking a Selection with a Rubberband

Remarks

Sets or gets the current height of the rubberband, which is a one-pixel outline of a rectangle on the display surface.

You can also use the SetRubberBandRect method to change the rectangle. Use the RubberbandVisible property to turn the rubberband on or off.

See Also

Elements	RubberBandLeft property, RubberBandTop property, RubberBandVisible property, RubberBandWidth property, SetRubberBandRect method

Topics	Working with the Control: Client Area Usage


RubberBandLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float RubberBandLeft

Overview	Refer to Marking a Selection with a Rubberband

Remarks

Sets or gets the current X coordinate of the origin of the rubberband, which is a one-pixel outline of a rectangle on the display surface.

You can also use the SetRubberBandRect method to change the rectangle. Use the RubberbandVisible property to turn the rubberband on or off.

See Also

Elements	RubberBandHeight property, RubberBandTop property, RubberBandVisible property, RubberBandWidth property, SetRubberBandRect method

Topics	Working with the Control: Client Area Usage


RubberBandTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float RubberBandTop

Overview	Refer to Marking a Selection with a Rubberband

Remarks

Sets or gets the current Y coordinate of the origin of the rubberband, which is a one-pixel outline of a rectangle on the display surface.

You can also use the SetRubberBandRect method to change the rectangle. Use the RubberbandVisible property to turn the rubberband on or off.

See Also

Elements	RubberBandHeight property, RubberBandLeft property, RubberBandVisible property, RubberBandWidth property, SetRubberBandRect method

Topics	Working with the Control: Client Area Usage


RubberBandVisible property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL RubberBandVisible

Overview	Refer to Marking a Selection with a Rubberband

Remarks

Controls the visibility of the rubberband, which is a one-pixel outline of a rectangle on the display surface.

Typically, you would use this method to display an area that the user selects with a mouse. This method works with the following method and properties:

 The SetRubberBandRect method sets the size and position of the rectangle.

 The RubberbandHeight property is the current height.

 The RubberbandLeft property is the current X coordinate of the origin of the rubberband.

 The RubberbandTop property is the current Y coordinate of the origin of the rubberband..

 The RubberbandWidth property is the current width.

Setting	Description

TRUE	Makes the rubberband visible (turning it on).

FALSE	Makes the rubberband invisible (turning it off).

See Also

Elements	RubberBandHeight property, RubberBandLeft property, RubberBandTop property, RubberBandWidth property, SetRubberBandRect method

Topics	Working with the Control: Client Area Usage


RubberBandWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float RubberBandWidth

Overview	Refer to Marking a Selection with a Rubberband

Remarks

Sets or gets the current width of the rubberband, which is a one-pixel outline of a rectangle on the display surface.

You can also use the SetRubberBandRect method to change the rectangle. Use the RubberbandVisible property to turn the rubberband on or off.

See Also

Elements	RubberBandHeight property, RubberBandLeft property, RubberBandTop property, RubberBandVisible property, SetRubberBandRect method

Topics	Working with the Control: Client Area Usage


Saturation method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Saturation (short iChange);

Overview	Refer to Correcting Colors.

Remarks

Increases or decreases the saturation of colors in the bitmap.

Negative values decrease the saturation of colors. Positive values increase the saturation. The saturation level is increased or decreased by a percentage of its present saturation level.  For example, an increase of 20% of the current saturation level "L" will raise the new saturation level "L1" to a value of L + 0.20 * L.  Likewise, increasing the saturation level 100% doubles the saturation level (L1 = L + 1.0 * L).  Decreasing the saturation level 100% will set the new saturation level to 0.  This process is carried out for every pixel.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Hue method, Invert method

Topics	Raster Images: Modifying Intensity Values
Raster Images: Where the Region Preempts the Bitmap


iChange Parameter For Saturation
iChange

Amount to change saturation. Values are percentages between -1000 and 1000.


Return for Saturation
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Save method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Save (BSTR pszName, short iFormat, short iBitsPerPixel, short iQuality, short iModify);

Overview	Refer to Saving a Bitmap to a File.

Remarks

Saves the bitmap to a file in any of the supported compressed or uncompressed formats.

Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits .

For a list of available products, refer to Summary of LEADTOOLS Products.

If the bitmap is 8 bits per pixel or greater, use the LEAD CMP format or one of the JPEG (JTIF or JFIF) formats to save disk space. You can set the ProgressivePasses property if you want to save a CMP or JFIF file as a progressive file.

If the bitmap is 1-bit per pixel, use the LEAD 1-bit format or a CCITT Group 3 or 4 format to save disk space.

For CCITT Group 3 and 4 formats, the first RGBQUAD structure in the bitmap's palette determines the white component of the image. If the rgbRed field is 0, then all 0 bits in the image are assumed to be black. Otherwise, all zero (0) bits in the image are assumed white.

If you save an animated GIF file, all bitmaps in the bitmap list are saved. Also, the following properties update global fields in the file:

AnimationPalette property

AnimationBackColor property

AnimationHeight property

AnimationWidth property

AnimationLoop property

See Also

Elements	SaveWithStamp method, SaveMemory method, FileSave method, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files
Raster Images: Creating and Maintaining Lists of Images


pszName Parameter For Save
pszName

Character string containing the output file name.


iFormat Parameter For Save
iFormat

Output file format. For valid values, refer to Formats of Output Files.


iBitsPerPixel Parameter For Save
iBitsPerPixel

Resulting file's pixel depth.

The output file pixel depth. Note that not all bits per pixel are available to all file formats.  Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits .  For valid values, refer to Formats of Output Files.


iQuality Parameter For Save
iQuality

This parameter is used when saving an image file to LEAD, JPEG, or PNG formats. Qfactor is a number that determines the degree of loss in the compression process.

For possible values, refer to Compression Quality Factors.


iModify Parameter For Save
iModify

Indicates how to save a new page in a multipage file that supports insert and replace operations.

Value	Meaning

SAVE_OVERWRITE	[0] No insert/replace/append is performed. An existing file is overwritten. This is comparable to bMultipage being FALSE in earlier versions.

SAVE_APPEND	[1] or [-1] The page is appended if the file exists. This is comparable to bMultipage being TRUE in earlier versions.

SAVE_REPLACE	[2] Replace the page specified in the SavePage property.

SAVE_INSERT	[3] Insert the new page before the page specified in the SavePage property

The following file formats support append operations:

TIFF (most TIFF formats, including JTIF but excluding EXIF)

PCX

FlashPix

AWD

Winfax

GIF

The following file formats support replace operations:

TIFF (most TIFF formats, including JTIF but excluding EXIF)

PCX

The following file formats support insert operations:

TIFF (most TIFF formats, including JTIF but excluding EXIF)

PCX


Return for Save
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Save method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short Save (BSTR pszFileName, VARIANT_BOOL bUseBitmap);

Overview	Refer to Working with MRC Bitmap.

Remarks

Saves the bitmap in the LEAD Proprietary T44 Format. If bUseBitmap is set to TRUE, the method will automatically segment the bitmap then create the MRC file.

Before saving, you must either have performed successful segmentation (either auto or manual) or provide a valid bitmap to the control.

The save method will map the text and picture segments found with auto-segmentation and manual segmentation processes into layers (mask, background and foreground layer) as defined in the NLS* model in T.44 standard.

*NLS (N-Layer stripe) means that each stripe may contains one or more mask layers, foreground layers, and background layers.

See Also

Elements	MaskCoder property, BackgroundCoder property, BackgroundQFactor property, EnhanceQuality property, Bitmap property, SaveT44 method, SaveTileHeight property, SaveTileWidth property

Topics	MRC Bitmap Functions: Saving a Page


pszFileName Parameter For Save (Mixed Raster Content Control)
pszFileName

Character string that contains the output file name.


bUseBitmap Parameter For Save (Mixed Raster Content Control)
bUseBitmap

Flag that indicates whether to save the image contained in the Bitmap property.  Possible values are:

Value	Meaning

TRUE	Auto-segment the image of the Bitmap property and save it.

FALSE	Do not auto-segment the bitmap. In this case, the control must have valid segmentation, either auto or manual.


SaveArray method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	VARIANT SaveArray (short iFormat, short iBitsPerPixel, short iQuality);

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Saves a bitmap to a file in memory. The output can be in any of the supported compressed or uncompressed file formats.

To see the correct data types, refer to the code example for your development system.

To load an image from a file in memory, refer to the LoadArray method.

To load an image from a file in memory, use one of the following methods:

LoadMemory—use this for a global handle to the file in memory

LoadArray—use this for a VARIANT byte array that contains the file in memory

LoadBuffer—use this for an address of a memory location that contains the file in memory

To save an image to a memory file, use one of the following methods:

SaveMemory—returns a global handle to a file in memory

SaveArray—returns a VARIANT byte array that contains the file in memory

SaveBuffer—saves a file into a memory location that the user allocates

Support for 12 and 16-bit grayscale  images is available only in the Document/Medical  toolkits.

For a list of available products, refer to Summary of LEADTOOLS Products.

Note: You cannot save a multipage file using the SaveArray method, but if you get a multipage file into memory in some other way, you can use the LoadArray method to load a specific page from the file.

You can calculate the size using the following:

Size = UBound(variant) – LBound(variant) + 1

See Also

Elements	LoadArray method, LoadMemory method, Save method, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files


iFormat Parameter For SaveArray
iFormat

Output file format. For valid values, refer to Formats of Output Files.


iBitsPerPixel Parameter For SaveArray
iBitsPerPixel

Resulting file's pixel depth.

The output file pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files. Support for 12 and 16-bit grayscale  images is available only in the Document/Medical  toolkits.


iQuality Parameter For SaveArray
iQuality

This parameter is used when saving an image file to LEAD or JPEG formats. Qfactor is a number that determines the degree of loss in the compression process.

For possible values, refer to Compression Quality Factors.


Return for SaveArray
Return Value

VARIANT byte array that contains the image data


SaveBuffer method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	VARIANT SaveBuffer (short iFormat, short iBitsPerPixel, short iQuality, short iModify);

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Saves a bitmap to a file in memory.  It is up to the user to allocate the memory that will hold the bitmap file.  If the memory allocated by the user is not large enough to accommodate the image, the SaveBuffer event will be fired so that the memory location can be reallocated.

It is advisable to set the EnableSaveBufferEvent property to TRUE so that the SaveBuffer event can be fired.  If the EnableSaveBufferEvent property is set to FALSE and the allocated memory is not large enough to accommodate the image, the SaveBuffer event will not be fired and the method will fail.

Note that this method is different from the SaveArray method and SaveMemory methods in that the user is completely responsible for allocating the memory to hold the bitmap file.  To avoid having to handle the allocating/deallocatingof the memory, use either the SaveArray method or the SaveMemory method.

An overview of the process follows:

1.	Set the EnableSaveBufferEvent property to TRUE.

2.	Allocate a section of memory.

3.	Set the SaveBufferAddress property to the address of the allocated memory.

4.	Set the SaveBufferSize property equal to the size of the allocated memory.

5.	Call the SaveBuffer method.

6.	In the SaveBuffer event, reallocate the memory to be AT LEAST as large as the size requested by the event.  Then set the SaveBufferAddress property to the address of the memory location (if it has changed), and set the SaveBufferSize to the size of the reallocated memory buffer.  If you cannot reallocate the required memory size, set the EnableSaveBufferEvent property to FALSE to cause the SaveBuffer method to abort.

7.	When you are finished using the file in memory, free the memory that you have allocated.

The output can be in any of the supported compressed or uncompressed file formats.

To see the correct data types, refer to the code example for your development system.

To load an image from a file in memory, use one of the following methods:

LoadMemory—use this for a global handle to the file in memory

LoadArray—use this for a VARIANT byte array that contains the file in memory

LoadBuffer—use this for an address of a memory location that contains the file in memory

To save an image to a memory file, use one of the following methods:

SaveMemory—returns a global handle to a file in memory

SaveArray—returns a VARIANT byte array that contains the file in memory

SaveBuffer—saves a file into a memory location that the user allocates

Support for 12 and 16-bit grayscale images is available only in the Document/Medical  toolkits.

For a list of available products, refer to Summary of LEADTOOLS Products.

See Also

Elements	SaveBufferSize property, SaveBufferAddress property, EnableSaveBufferEvent property, LoadArray method, LoadMemory method, LoadBuffer method, SaveArray method, SaveMemory method, Save method, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files


iFormat Parameter For SaveBuffer
iFormat

Output file format. For valid values, refer to Formats of Output Files.


iBitsPerPixel Parameter For SaveBuffer
iBitsPerPixel

Resulting file's pixel depth.

The output file pixel depth. Note that not all bits per pixel are available to all file formats.  Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits .  For valid values, refer to Formats of Output Files.


iQuality Parameter For SaveBuffer
iQuality

This parameter is used when saving an image file to LEAD or JPEG formats. Qfactor is a number that determines the degree of loss in the compression process.

For possible values, refer to Compression Quality Factors.


iModify Parameter For SaveBuffer
iModify

Indicates how to save a new page in a multipage file that supports insert and replace operations.

Value	Meaning

SAVE_OVERWRITE	[0] No insert/replace/append is performed. An existing file is overwritten. This is comparable to bMultipage being FALSE in earlier versions.

SAVE_APPEND	[1] or [-1] The page is appended if the file exists. This is comparable to bMultipage being TRUE in earlier versions.

SAVE_REPLACE	[2] Replace the page specified in the SavePage property.

SAVE_INSERT	[3] Insert the new page before the page specified in the SavePage property

The following file formats support append operations:

TIFF (most TIFF formats, including JTIF but excluding EXIF)

PCX

FlashPix

AWD

Winfax

GIF

The following file formats support replace operations:

TIFF (most TIFF formats, including JTIF but excluding EXIF)

PCX

The following file formats support insert operations:

TIFF (most TIFF formats, including JTIF but excluding EXIF)

PCX


SaveBuffer event (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	void SaveBuffer(long uRequiredSize);

Overview	Refer to Using Memory-Resident Image Files.

Remarks

This event is generated in a SaveBuffer process to tell the user that the allocated memory buffer is not large enough.  This allows the user to reallocate the memory buffer so that it is at least ‘uRequiredSize’ bytes.  The user should also set the SaveBufferAddress property to the address of the newly allocated buffer (if it has changed since last allocated), and the SaveBufferSize property to the size of the newly allocated buffer.  Note that ‘uRequiredSize’ is the minimum required size of the buffer.  The user can allocate a chunk of memory that is larger than ‘uRequiredSize’ if desired.

This event is generated only if the EnableSaveBufferEvent property is set to TRUE prior to calling the SaveBufferMethod.

To abort the SaveBuffer process (if for example ‘uRequiredSize’ bytes cannot be reallocated), set the EnableSaveBufferEvent property to FALSE in the SaveBuffer event.

To summarize, when processing the SaveBuffer event you must

1.	Reallocate the memory buffer to be at least ‘uRequiredSize’ bytes

2.	Set the SaveBufferAddress property to be the address of the reallocated memory buffer

3.	Set the SaveBufferSize property to be the size of the reallocated memory buffer

4.	If at least ‘uRequiredSize’ bytes cannot be reallocated, set the EnableSaveBufferEvent property to FALSE to abort the SaveBuffer process.

For more information, refer to the SaveBuffer method.

See Also

Elements	SaveBuffer method, SaveBufferSize property, SaveBufferAddress property, EnableSaveBufferEvent property, LoadBuffer method, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files


uRequiredSize Parameter For SaveBuffer
uRequiredSize

The minimum required size (in bytes) of the user allocated buffer.


SaveBufferAddress property (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	long SaveBufferAddress

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Holds the address of the memory buffer that the user allocates in a SaveBuffer process.

Prior to calling the SaveBuffer method, the user must allocate a memory buffer and set the SaveBufferAddress property to the address of the memory buffer.  For more information, refer to the SaveBuffer method.

See Also

Elements	SaveBuffer method, SaveBufferSize property, EnableSaveBufferEvent property, SaveBuffer event, LoadBuffer method, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files


SaveBufferSize property (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	long SaveBufferSize

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Holds the size of the memory buffer that the user allocates in a SaveBuffer process.

Prior to calling the SaveBuffer method, the user must allocate a memory buffer and set the SaveBufferSize property to the size of the memory buffer. For more information, refer to the SaveBuffer method.

See Also

Elements	SaveBuffer method, SaveBufferAddress property, EnableSaveBufferEvent property, SaveBuffer event, LoadBuffer method, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files


SaveDatabase method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SaveDatabase (BSTR pszFilename , VARIANT_BOOL bSelected);

Overview	Refer to Using the ImageList Control.

Remarks

Call this method to save the ImageList's contents as a database (multipage TIFF file).

The items will be saved as pages in a multipage TIFF file.

The format of the pages will be as follows:

BitsPerPixel	Format

1	FILE_CCITT_GROUP4

8	FILE_TIF_PACKBITS

24	FILE_TIF_JPEG

other	FILE_TIF

The text for each item will be saved in the CMNT_SZNAMEOFPAGE comment.

See Also

Elements	SaveToFile method, LoadDatabase method, LoadFromFile method, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Displaying Images


bSelected Parameter For SaveDatabase
bSelected

Flag that indicates which items in the database to save. Possible values are:

Value	Meaning

TRUE	Save only selected items within the database.

FALSE	Save all items in the database.


pszFilename Parameter For SaveDatabase
pszFilename

String that contains the name of the file in which to save the database.


Return for SaveDatabase
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SaveIFD property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long SaveIFD

Overview	Refer to Loading and Saving Large TIFF Files.

Remarks

Specifies the offset within the current file of the reference page used when saving a page in a TIFF file. If this property is 0, then page 1 is the first page in the file. If this property is not 0, then page 1 is the page that starts at the offset.

The SaveIFD property can be used to speed up the process of appending, replacing or deleting a page inside a TIFF file with many pages.

The page starting at the offset given by this property is treated as page 1. The next page can be replaced by setting the SavePage property to 2 and calling the Save method. To delete the page after the one indicated by SaveIFD, call DeletePage("test.tif", 2).

Due to the organization of TIFF files, SaveIFD can be used to speed up the replacement, deletion and insertion of pages after the offset indicated by SaveIFD. However, to delete the page indicated by SaveIFD, by calling DeletePage("test.tif", 1), LEADTOOLS will have to go through all the pages from the beginning of the file, to get to the page to delete. Consequently, there will be no speed improvement in this situation.

When the current TIF file is no longer needed, this property must be reset to 0, otherwise the processing of any other TIF files will be incorrect.

See Also

Elements	InfoIFD property, LoadIFD property, DeletePage method , SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Loading and Saving Large TIFF Files


SaveInterlaced property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL SaveInterlaced

Overview	Refer to Saving a Bitmap to a File.

Remarks

Determines whether GIF files are saved as interlaced files.

Value	Meaning

TRUE	Whenever a GIF file is saved, make it an interlaced file.

FALSE	Whenever a GIF file is saved, make it non-interlaced.

See Also

Elements	SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files


SaveLayers property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	bool SaveLayers

Overview	Refer to Layers in Files

Remarks

Indicates whether PSD files are saved with or without layers. Possible values are:

Value	Meaning

TRUE	When a PSD file is saved, all the bitmaps in the list are saved as layers. The LayerLeft and LayerTop properties contain positioning information for each layer.

FALSE	PSD files are saved without layers. The layer information is ignored.

See Also

Elements	Save method, LayerLeft property, LayerTop property, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files


SaveLSB property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL SaveLSB

Overview	Refer to Saving a Bitmap to a File.

Remarks

Indicates whether to save TIFF 1-bit images or RAW uncompressed data least significant bit first or most significant bit first. Possible values are:

Value	Meaning

TRUE	Save TIFF 1-bit or RAW uncompressed images least significant bit first.

FALSE	Save TIFF 1-bit or RAW uncompressed images most significant bit first.

When saving RAW uncompressed data, the bits in each byte can be reversed by setting this property to TRUE.

Saving TIFF 1-bit images least significant bit first is used only when saving uncompressed and fax compressed images.

The default is FALSE (most significant bit first).

To save Class F compatible images, it is recommended that you save files with SaveLSB set to TRUE. In addition, the image’s BitmapXRes should be 204, 300 or 400, and the BitmapYRes should be 98, 196, 300 or 400.

See Also

Elements	BitmapXRes property, BitmapYRes property, ScaleMode property, Save method, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files


SaveMemory method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SaveMemory (OLE_HANDLE* phMem, short iFormat, short iBitsPerPixel, short iQuality, long* piSize);

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Saves a bitmap to a file in memory. The output can be in any of the supported compressed or uncompressed file formats.

To use this method, do the following:

1.	Declare a variable of the appropriate data type to reference the file in memory. You can then pass its address (pass the variable by reference) in this method, which will allocate the memory, save the bitmap, and unlock the memory.

2.	Declare a long integer variable for the file-size. You can then pass its address in this method, which will update its value with the size of the file.

3.	Call this method to save the bitmap in the specified memory handle.

To see the correct data types, refer to the code example for your development system.

To get information about a file stored in memory, refer to the GetMemoryInfo method. To load an image from a file in memory, refer to the LoadMemory method.

To load an image from a file in memory, use one of the following methods:

LoadMemory—use this for a global handle to the file in memory

LoadArray—use this for a VARIANT byte array that contains the file in memory

LoadBuffer—use this for an address of a memory location that contains the file in memory

To save an image to a memory file, use one of the following methods:

SaveMemory—returns a global handle to a file in memory

SaveArray—returns a VARIANT byte array that contains the file in memory

SaveBuffer—saves a file into a memory location that the user allocates

Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits .

For a list of available products, refer to Summary of LEADTOOLS Products.

Note: You cannot save a multipage file using the SaveMemory method, but if you get a multipage file into memory in some other way, you can use the LoadMemory method to load a specific page from the file.

See Also

Elements	Save method, SaveWithStamp method, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files


SaveOffset method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SaveOffset (BSTR pszName, long iOffsetBegin, short iFormat, short iBitsPerPixel, short iQuality, short iModify);

Overview	Refer to Saving a Bitmap to a File.

Remarks

Saves a bitmap to a file, in any supported format, starting at the specified offset. This enables you to embed an image file in another file.

This method is similar to the Save method, with the following differences:

 the file can be saved starting at any file offset.

 when saving an animated GIF, only the first bitmap in the list is saved.

 the FileSizeWritten property is updated with the total file size, in bytes.

Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits .

For a list of available products, refer to Summary of LEADTOOLS Products.

See Also

Elements	SaveWithStamp method, SaveMemory method, FileSave method , SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files
Raster Images: Creating and Maintaining Lists of Images


pszString Parameter For AddItem
pszName

Character string containing the output file name.


iOffsetBegin Parameter For SaveOffset
iOffsetBegin

Offset within the file at which to begin saving


iFormat Parameter For SaveOffset
iFormat

Output file format. For valid values, refer to Formats of Output Files.


iBitsPerPixel Parameter For SaveOffset
iBitsPerPixel

Resulting file's pixel depth.

The output file pixel depth. Note that not all bits per pixel are available to all file formats.  Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits .  For valid values, refer to Formats of Output Files.


iQuality Parameter For SaveOffset
iQuality

This parameter is used when saving an image file to LEAD or JPEG formats. Qfactor is a number that determines the degree of loss in the compression process.

For possible values, refer to Compression Quality Factors.


iModify Parameter For SaveOffset
iModify

Indicates how to save a new page in a multipage file that supports insert and replace operations.

Value	Meaning

SAVE_OVERWRITE	[0] No insert/replace/append is performed. An existing file is overwritten. This is comparable to bMultipage being FALSE in earlier versions.

SAVE_APPEND	[1] or [-1] The page is appended if the file exists. This is comparable to bMultipage being TRUE in earlier versions.

SAVE_REPLACE	[2] Replace the page specified in the SavePage property.

SAVE_INSERT	[3] Insert the new page before the page specified in the SavePage property

The following file formats support append operations:

TIFF (most TIFF formats, including JTIF but excluding EXIF)

PCX

FlashPix

AWD

Winfax

GIF

The following file formats support replace operations:

TIFF (most TIFF formats, including JTIF but excluding EXIF)

PCX

The following file formats support insert operations:

TIFF (most TIFF formats, including JTIF but excluding EXIF)

PCX


Return for SaveOffset
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SavePad4 property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL SavePad4

Overview	Refer to Saving a Bitmap to a File.

Remarks

Indicates whether to save RAW uncompressed data with each line padded so that the length is a multiple of 4 bytes. Possible values are:

Value	Meaning

TRUE	Save RAW uncompressed images with each line padded to a multiple of four bytes.

FALSE	Save RAW uncompressed images with no padding at the end of each line.

When saving RAW uncompressed data, each row of data can be saved as is, or padded so that the byte-length is a multiple of four.

See Also

Elements	SaveOffset method, FileSizeWritten property, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files


phMem Parameter For SaveMemory
phMem

Address of the OLE_HANDLE variable that you use to reference the file in memory. In C++, you declare the variable and pass its address. In most other languages, you pass the variable by reference. The method updates the value of the variable. The variable must be a global handle (HGLOBAL) and must be declared with the appropriate data type. To see the correct data type, refer to the code example for your development system.


iFormat Parameter For SaveMemory
iFormat

Output file format. For valid values, refer to Formats of Output Files.


iBitsPerPixel Parameter For SaveMemory
iBitsPerPixel

Resulting file's pixel depth.

The output file pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files. Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits .


iQuality Parameter For SaveMemory
iQuality

This parameter is used when saving an image file to LEAD or JPEG formats. Qfactor is a number that determines the degree of loss in the compression process.

For possible values, refer to Compression Quality Factors.


piSize Parameter For SaveMemory
piSize

Address of the long integer variable that you use to track the size of the file in memory. In C++, you declare the variable and pass its address. In most other languages, you pass the variable by reference. The method updates the value of the variable. The variable must be declared with the appropriate data type. To see the correct data type, refer to the code example for your development system.


Return for SaveMemory
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SavePage property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short SavePage

Overview	Refer to Saving a Bitmap to a File.

Remarks

Represents a page number in a multipage file.  This property is used only if the iModify parameter of the Save method is SAVE_REPLACE or SAVE_INSERT.  If iModify is SAVE_REPLACE, SavePage represents the number of the page to replace (the first page is page 1).  If iModify is SAVE_INSERT, SavePage represents the number of the page in front of which the new page will be inserted.  For example, if SavePage is 1 and iModify is SAVE_INSERT, then the page you save will become the first page in the file.

If this property is set to SAVE_REPLACE, the page is not actually replaced. The IFDs just point to the new page instead of the old page. Therefore, the file size will grow for each page "replaced" because the page being "replaced" is not deleted.

See Also

Elements	SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files
Raster Images: Getting and Setting File Information


SavePageNumberTag property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL SavePageNumberTag

Overview	Refer to Saving a Bitmap to a File.

Remarks

Indicates whether or not to update and save the PageNumber tag associated with the pages of a multi-page TIFF file. Possible values are:

Value	Meaning

TRUE	Update and save the PageNumber tag associated with each page of a TIFF file.

FALSE	Do not update and save the PageNumber tag associated with each page of a TIFF file.

By default, this property is TRUE. Therefore, whenever TIFF files are saved, or pages are deleted from a TIFF file, the PageNumber tag for each page is updated and saved. For files having many pages, this may be time consuming.

Note: This property must be set to TRUE in order to save Class-F compatible TIFF files.

See Also

Elements	SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files
Raster Images: Getting and Setting File Information


SaveResolutionCount property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SaveResolutionCount

Overview	Refer to Implementing JBIG Features

Remarks

Specifies the number of resolutions to write.

When you set this property, you should also fill the SaveResolutionWidth and SaveResolutionHeight array properties with the desired resolutions to save.  The arrays should be filled from SaveResolutionWidth(0) to SaveResolutionWidth(SaveResolutionCount-1) and SaveResolutionHeight(0) to SaveResolutionHeight(SaveResolutionCount-1).

Currently, only the JBIG format uses these properties.

Note that for a JBIG save, only the first resolution is used.  Each subsequent dimension up to SaveResolutionCount will actually be calculated as 1/2 the previous dimension.

Ex.

SaveResolutionCount = 3
SaveResolutionWidth(0) = 800
SaveResolutionWidth(0) = 400

If you then save an image that is 1600 x 800, the resolutions that are stored in the file would be:

800 x 400
400 x 200
200 x 100

By default, the control will save images using the default of the file format.  For JBIG only one resolution which has the size of the bitmap being saved will be saved.

See Also

Elements	Save method, SaveResolutionWidth property, SaveResolutionHeight property, LoadResolutionCount property, LoadResolutionHeight property, LoadResolutionWidth property, PCDRes property, SetLoadResolution method, GetLoadResolution method, SaveTileHeight property, SaveTileWidth property


SaveResolutionHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float SaveResolutionHeight(short nIndex)

Overview	Refer to Implementing JBIG Features

Remarks

Specifies the height component of the resolution to write.

The array range is SaveResolutionWidth(0) to SaveResolutionWidth(SaveResolutionCount-1).

Currently, only the JBIG format uses these properties.

Note that for a JBIG save, only the first resolution is used.  Each subsequent dimension up to SaveResolutionCount will actually be calculated as 1/2 the previous dimension. You can set this to 0 to use the default or, you can set this to 0 and set a value for the height component, and the width component will be automatically calculated for you based on the aspect ratio of the image being saved.

Ex.

SaveResolutionCount = 3
SaveResolutionWidth(0) = 800
SaveResolutionWidth(0) = 400

If you then save an image that is 1600 x 800, the resolutions that are stored in the file would be:

800 x 400
400 x 200
200 x 100

By default, the control will save images using the default of the file format.  For JBIG only one resolution which has the size of the bitmap being saved will be saved.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	Save method, SaveResolutionCount property, SaveResolutionWidth property, LoadResolutionCount property, LoadResolutionHeight property, LoadResolutionWidth property, PCDRes property, SetLoadResolution method, GetLoadResolution method, SaveTileHeight property, SaveTileWidth property


nIndex Parameter For SaveResolutionHeight
iIndex

Index into the array of heights.


SaveResolutionWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float SaveResolutionWidth(short nIndex)

Overview	Refer to Implementing JBIG Features

Remarks

Specifies the width component of the resolution to write.

The array range is SaveResolutionWidth(0) to SaveResolutionWidth(SaveResolutionCount-1).

Currently, only the JBIG format uses these properties.

Note that for a JBIG save, only the first resolution is used.  Each subsequent dimension up to SaveResolutionCount will actually be calculated as 1/2 the previous dimension. You can set this to 0 to use the default or, you can set this to 0 and set a value for the height component, and the width component will be automatically calculated for you base on the aspect ratio of the image being saved.

Ex.

SaveResolutionCount = 3
SaveResolutionWidth(0) = 800
SaveResolutionWidth(0) = 400

If you then save an image that is 1600 x 800, the resolutions that are stored in the file would be:

800 x 400
400 x 200
200 x 100

By default, the control will save images using the default of the file format.  For JBIG only one resolution which has the size of the bitmap being saved will be saved.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	Save method, SaveResolutionCount property, SaveResolutionHeight property, LoadResolutionCount property, LoadResolutionHeight property, LoadResolutionWidth property, PCDRes property, SetLoadResolution method, GetLoadResolution method, SaveTileHeight property, SaveTileWidth property


nIndex Parameter For SaveResolutionWidth
iIndex

Index into the array of widths.


SaveT44 method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SaveT44 (BSTR pszFileName, VARIANT_BOOL bUseBitmap);

Overview	Refer to Working with MRC Bitmap.

Remarks

Saves the bitmap in the standard T44 Format. If bUseBitmap is set to TRUE, the method will automatically segment the bitmap then create the MRC file.

Before saving, you must either have performed successful segmentation (either auto or manual) or provide a valid bitmap to the control.

See Also

Elements	MaskCoder property, BackgroundCoder property, BackgroundQFactor property, EnhanceQuality property, Bitmap property, Save method, SaveTileHeight property, SaveTileWidth property

Topics	MRC Bitmap Functions: Saving a Page


pszFileName Parameter For SaveT44 (Mixed Raster Content Control)
pszFileName

Character string that contains the output file name.


bUseBitmap Parameter For SaveT44 (Mixed Raster Content Control)
bUseBitmap

Flag that indicates whether to save the image contained in the Bitmap property.  Possible values are:

Value	Meaning

TRUE	Auto-segment the image of the Bitmap property and save it.

FALSE	Do not auto-segment the bitmap. In this case, the control must have valid segmentation, either auto or manual.


SaveTileHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float SaveTileHeight

Overview	Refer to Saving a Bitmap to a File

Remarks

This property indicates the strip height or tile height to use when saving TIF files.

If this property is 0, the default height is used when saving TIF files.

The SaveTileWidth property determines whether the bitmap will be saved in strips or tiles.

See Also

Elements	Save method, SaveTileWidth property

Topics	Raster Images: Saving Files


SaveTileWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float SaveTileWidth

Overview	Refer to Saving a Bitmap to a File

Remarks

This property influences the way TIF files are saved, based on the following:

 If SaveTileWidth is 0, TIF files will be saved in strips (default). This is recommended, since not all programs read tiled files.

 If SaveTileWidth is greater than the bitmap width, the file will be saved as strips.

 If SaveTileWidth is less than the bitmap width, the file will be saved as tiles. Please note that files saved in this way may not be read by all software packages. However, LEADTOOLS will still read these files.

If TIF files are saved as tiles, the tile size might be rounded to the closest available size. The following restrictions apply when saving TIF files as tiles:

 1, 2, 3, 5, 6, and 7-bit images must have a tile width that is a multiple of 8.

 4-bit and 12-bit images must have a tile width that is a multiple of 2.

 Other bits per pixel have no restrictions.

See Also

Elements	Save method, SaveTileHeight property

Topics	Raster Images: Saving Files


SaveToFile method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SaveToFile (BSTR pszFile, short nFormat, short nBits, short nQFactor, BOOL bSelected);

Overview	Refer to Using the ImageList Control.

Remarks

Saves the items from the ImageList Control into the specified file.  This method supports saving into any of the multi-page file formats supported by LEADTOOLS.  If bSelected is True, only the items with the Selected attribute of True are saved.

See Also

Elements	Item property, Insert method, InsertAt method, Remove method, Count property, Sort method, InsertFromBitmapList method, LoadFromFile method, SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Displaying Images


pszFile Parameter For SaveToFile
pszFile

Name of the file into which items should be saved.

Note: If you specify an existing file, and the format supports the append operation, the items will be appended to the existing file.


AboutBox method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AboutBox();

Overview	Refer to Getting LEADTOOLS Toolkit Information.

Remarks

Displays information about the LEADTOOLS ActiveX.

See Also

Topics	Support: Version and License Information


Return for AboutBox
Return Value

None.


AddBitmaps method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short AddBitmaps(short iFlags);

Overview	Refer to Combining Images.

Remarks

Adds or averages the bitmaps in the BitmapList property.

This operation can be used to add several images of the same view to improve the lightness or brightness of the image. It can also eliminate the random noise contained in these images by doing an average of all bitmaps.

This method performs operations between data byte-by-byte. An image can be any color resolution. The resulting image of this operation will be stored in the first bitmap in the list. The operations are performed based on the smallest width and height of the input images.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	BitmapList property, Underlay method, Combine method

Topics	Raster Images: Modifying Intensity Values
Image Processing
Changing Brightness and Contrast
Removing Noise


iFlags Parameter For AddBitmaps
iFlags

Flag that indicates the operation to perform.  Possible values are:

Value	Meaning

BC_ADD	Add the bitmaps in the specified list.

BC_AVE	Average the bitmaps in the specified list.


Return for AddBitmaps
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AddBorder method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short AddBorder(float fLeftThickness, float fTopThickness, float fRightThickness, float fBottomThickness, short nLocation, short nStyle, short nEffectStyle, OLE_HANDLE hTileBitmap, short nGradientStyle, OLE_COLOR crGradientStart, OLE_COLOR crGradientEnd, short nCurveIntensity, BOOL bSoftCurve, BOOL bShadow, short nShadowSize, short nShadowDirection, BOOL bBumpyShadow);

Overview	Refer to Combining Images.

Remarks

(DigitalPaint only) Adds a border to the bitmap. The border is specified by the method's parameters.

This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Elements	AddFrame method

Topics	Image Processing


fLeftThickness Parameter For AddBorder
fLeftThickness

The thickness of the left side of the border. The unit of measure is determined by the ScaleMode property.


fTopThickness Parameter For AddBorder
fTopThickness

The thickness of the top side of the border. The unit of measure is determined by the ScaleMode property.


fRightThickness Parameter For AddBorder
fRightThickness

The thickness of the right side of the border. The unit of measure is determined by the ScaleMode property.


fBottomThickness Parameter For AddBorder
fBottomThickness

The thickness of the bottom side of the border. The unit of measure is determined by the ScaleMode property.


nLocation Parameter For AddBorder
nLocation

Flag that indicates the position of the border. Possible values are:

Value	Meaning

BORDER_INSIDE	[0] The border will be within the bitmap.

BORDER_OUTSIDE	[1] The border will be outside the bitmap.


nStyle Parameter For AddBorder
nStyle

Flag that indicates the style of the border. Possible values are:

Value	Meaning

BORDER_STYLE_TRANSPARENT	[0] The border is transparent. Therefore, the bitmap itself shows through as the border.

BORDER_STYLE_OPAQUE	[1] Use a single color to create the border. The color used is crGradientStart.

BORDER_STYLE_GRADIENT	[2] The border contains a color gradient from crGradientStart to crGradientEnd.

BORDER_STYLE_TILES	[3] The border is taken from the bitmap referenced by the hTileBitmap parameter.


nEffectStyle Parameter For AddBorder
nEffectStyle

Flag that indicates the change in the appearance of the border. By default there are no changes. The change also depends on the value of nCurveIntensity. If nCurveIntensity is zero, there are no changes. Possible values are:

Value	Meaning

BORDER_EFFECT_CURVEDIN	[1] Add a 3D appearance to the border by adding a high intensity color to the inner side of the border and a lower intensity color to the outer side of the border.

BORDER_EFFECT_CURVEDOUT	[2] Add a 3D appearance to the border by adding a high intensity color to the outer side of the border and a lower intensity color to the inner side of the border.

BORDER_EFFECT_RAISED	[3] Add a curved appearance to the border.


hTileBitmap Parameter For AddBorder
hTileBitmap

A LEAD bitmap handle that references the tile bitmap. This is the bitmap the border is taken from when nStyle is BORDER_STYLE_TILES.


nGradientStyle Parameter For AddBorder
nGradientStyle

Flag that indicates the gradient style. This flag is used only when the nStyle parameter is BORDER_STYLE_GRADIENT. Possible values are:

Value	Meaning

BORDER_GRAD_INSIDEOUT	[0] The gradient starts from the inside of the border and progresses toward the outside of the border.

BORDER_GRAD_CENTEROUT	[1] The gradient starts from the center of the border and progresses toward both the inside and outside of the border.

BORDER_GRAD_CORNEROUT	[2] The gradient starts from the corners of the border.


crGradientStart Parameter For AddBorder
crGradientStart

The starting color when nStyle is BORDER_STYLE_GRADIENT. This is also the color used when nStyle is BORDER_STYLE_OPAQUE.


crGradientEnd Parameter For AddBorder
crGradientEnd

The ending color when nStyle is BORDER_STYLE_GRADIENT.


nCurveIntensity Parameter For AddBorder
nCurveIntensity

Value that indicates the degree to which to change the appearance of the border. This value is used only when the nEffectStyle flag is set. The range is from –1000 to 1000.


bSoftCurve Parameter For AddBorder
bSoftCurve

Boolean flag that indicates whether to give the border a soft curve appearance. This flag is used only when nEffectStyle is BORDER_EFFECT_RAISED. Possible values are:

Value	Meaning

TRUE	Make the border more homogeneous in intensity, giving the appearance of a smoother curve.

FALSE	Do not make the border more homogeneous in intensity.


bShadow Parameter For AddBorder
bShadow

Boolean flag that indicates whether to add a shadow to the border. Possible values are:

Value	Meaning

TRUE	Add a shadow to the border.

FALSE	Do not add a shadow to the border.


nShadowSize Parameter For AddBorder
nShadowSize

Value that indicates the width of the shadow, in pixels. This value is used only when bShadow is TRUE.


nShadowDirection Parameter For AddBorder
nShadowDirection

Flag that indicates the direction of the shadow. This value is used only when bShadow is TRUE. Possible values are:

Value	Meaning

BORDER_SHADOW_LEFT	[0] The shadow is on the left top side of the image.

BORDER_SHADOW_RIGHT	[1] The shadow is on the right bottom side of the image.

BORDER_SHADOW_SURROUND	[2] The shadow surrounds the border.


bBumpyShadow Parameter For AddBorder
bBumpyShadow

Boolean flag that indicates whether to increase the intensity near the far edge of the shadow. This flag is used only when bShadow is TRUE. Setting this flag to TRUE produces a good appearance for the shadow if nShadowSize is a value between 4 and 7. Possible values are:

Value	Meaning

TRUE	Increase the intensity near the far edge of the shadow.

FALSE	Do not increase the intensity near the far edge of the shadow.


Return for AddBorder
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AddFrame method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short AddFrame(OLE_HANDLE hBitmapFrame, BOOL bKeepFrameState, BOOL bUseMask, OLE_COLOR crMask, short SmoothEdge, short nLocation, short nQuality);

Overview	Refer to Combining Images.

Remarks

(DigitalPaint only) Adds a frame to the bitmap. The frame is specified by the method's parameters.

This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Elements	AddBorder method

Topics	Image Processing


nShadowDirection Parameter For AddFrame
hBitmapFrame

A LEAD bitmap handle that references the frame bitmap.


bKeepFrameState Parameter For AddFrame
bKeepFrameState

Boolean flag that indicates the state of the frame bitmap. Possible values are:

Value	Meaning

TRUE	Keep the state of the frame bitmap and operate on a copy of the frame bitmap.

FALSE	Work on the original frame bitmap so this bitmap may be resized during the AddFrame method.


bUseMask Parameter For AddFrame
bUseMask

Boolean flag that indicates whether to force the bitmap to be put on a specific region of the frame bitmap. Possible values are:

Value	Meaning

TRUE	Select a region on the frame bitmap with the same color specified in crMask and place the bitmap in this region.

FALSE	Put the bitmap in the center of the frame bitmap.


crMask Parameter For AddFrame
crMask

Color used to specify the region on the frame bitmap, in which to put the bitmap. This value is used only if the bUseMask parameter is TRUE.


SmoothEdge Parameter For AddFrame
SmoothEdge

Value that indicates the amount to smooth the edge between the frame and the original bitmap. In most cases, useful values are 30 and 50. This value is used only when the bUseMask parameter is FALSE.


nLocation Parameter For AddFrame
nLocation

Flag that indicates the location of the frame with respect to the bitmap. Possible values are:

Value	Meaning

FRAME_INSIDE	[0] The frame will be within the original bitmap.

FRAME_OUTSIDE	[1] The frame will be outside the original bitmap.


nQuality Parameter For AddFrame
nQuality

Flag that specifies the quality of the resulting bitmap. Possible values are:

Value	Meaning

FRAME_QUALITY_LOW	[0] Give the resulting bitmap normal quality.

FRAME_QUALITY_HIGH	[1] Give the resulting bitmap high quality.


Return for AddFrame
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AddItem method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AddItem (BSTR pszString, short iType, long nID, short iIndexBefore);

Overview	Refer to Annotation Menu.

Remarks

Adds a menu item with the specified string, type and id, before the item specified in iIndexBefore.

When the user selects an item added using this method, the AnnUserMenu event will be fired. The nID value passed to the AnnUserMenu event is the same nID passed to this method.

This method is associated with the AnnMenu object that is passed to the AnnMenu event.

See Also

Elements	AnnMenu event, Count property, ItemString property, ItemType property, ItemID property, ItemEnabled property, ItemChecked property, DeleteItem method, GetSubMenu Method, AnnUserMenu event

Topics	Annotations (Document/Medical only): Automation


pszString Parameter For AddItem
pszString

String that contains the text for the new menu item. This parameter is not valid if iType is ANNMENUITEMTYPE_SEPARATOR.


iType Parameter For AddItem
iType

Type of menu item to add. Possible values are:

Value	Meaning

ANNMENUITEMTYPE_NORMAL	[0] Normal menu item.

ANNMENUITEMTYPE_SEPARATOR	[1] Menu item is a separator.

ANNMENUITEMTYPE_SUBMENU	[2] Menu item is a popup menu.


nID Parameter For AddItem
nID

The command ID for the new menu item. The ID value must be in the range LTANNEVENT_MENUFIRST [0x0100] to LTANNEVENT_MENULAST [0x01FF]. This parameter is not valid if iType is ANNMENUITEMTYPE_SEPARATOR.


iIndex Parameter For AddItem
iIndexBefore

Index of the item before which the new item should be inserted.


Return for AddItem
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AddNoise method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AddNoise (short iRange, short iChannel);

Overview	Refer to Applying Artistic Effects.

Remarks

Adds random pixels to the bitmap, letting you specify the percentage of coverage and the color plane.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	GetNoise method

Topics	Raster Images: Where the Region Preempts the Bitmap
Raster Images: Filtering Images


iRange Parameter For AddNoise
iRange

Percentage of coverage, expressed in tenths of a percent. Valid values are 0 to 1000.


iChannel Parameter For AddNoise
iChannel

Possible values are:

Value	Meaning

CHANNEL_MASTER	All channels.

CHANNEL_RED	Red channel only.

CHANNEL_GREEN	Green channel only.

CHANNEL_BLUE	Blue channel only.


Return for AddNoise
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AllowSelection property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AllowSelection

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies whether or not automatic item selection is allowed.

If automatic item selection is enabled, items are automatically selected and de-selected when the user clicks on them using the mouse.

Value	Meaning

ALLOWSELECTION_NONE	Automatic selection is disabled, selection is manual

ALLOWSELECTION_SINGLE	Automatic selection of single items is enabled

ALLOWSELECTION_MULTI	Automatic selection of multiple items is enabled

The default setting is ALLOWSELECTION_NONE.

Note:	when ALLOWSELECTION_MULTI is enabled, the user can select multiple items using the mouse and the CTRL and SHIFT keys.

See Also

Elements	SelectionStyle property, SelectionColor property, ItemSelected event, Item property, SelectAll method, HitTest method

Topics	Raster Images: Displaying Images


AlphaBlend method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short AlphaBlend(float fLeft, float fTop, float fWidth, float fHeight, OLE_HANDLE hBitmap, float fSrcLeft, float fSrcTop, short iOpacity);

Overview	Refer to Combining Images.

Remarks

Combines image data from two bitmaps, using the specified opacity value.

The opacity determines how much the destination bitmap will show through the source bitmap. For example, if the opacity is 255 (completely opaque) then the source image will appear and the destination image will not show through the source image at all. If the opacity is 128 (half opacity), then the pixels for that area will consist of 50 percent from the source image and 50 percent from the destination image.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Underlay method, Combine method, FeatherAlphaBlend method, CreateFadedMask method

Topics	Raster Images: Combining Images
Image Processing


fLeft Parameter For AlphaBlend
fLeft

The X coordinate of the origin of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fTop Parameter For AlphaBlend
fTop

The Y coordinate of the origin of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For AlphaBlend
fWidth

The width of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For AlphaBlend
fHeight

The height of the rectangle to update, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


hBitmap Parameter For AlphaBlend
hBitmap

The source Main Control's bitmap to be combined with the current Main Control's bitmap.


fSrcLeft Parameter For AlphaBlend
fSrcLeft

The X coordinate of the origin of the source rectangle, relative to the source control. The unit of measure is determined by the ScaleMode property.


fSrcTop Parameter For AlphaBlend
fSrcTop

The Y coordinate of the origin of the source rectangle, relative to the source control. The unit of measure is determined by the ScaleMode property.


iOpacity Parameter For AlphaBlend
iOpacity

Opacity value used when combining the areas from the source and destination bitmaps. This value is between 0 and 255.


Return for AlphaBlend
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Animate event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void Animate (BOOL bEnable);

Overview	Refer to Playing an Animation.

Remarks

Occurs when an animation playback is started or stopped.

On a playback start, you can use this event to ensure that the AutoRepaint property is set to TRUE.

See Also

Elements	AutoAnimate property, AutoAnimationLoop property, AnimationLoop property, AnimationEnable property

Topics	Raster Images: Playing Animated Images


bEnable Parameter For Animate
bEnable

One of the following values:

TRUE	Animation playback is about to start.

FALSE	Animation playback has stopped.


AnimationBackColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR AnimationBackColor

Overview	Refer to Playing an Animation.

Remarks

Background color for animation playback.

This property applies to the temporary target bitmap that LEADTOOLS creates for animation playback.

This property is initialized when you take any of the following actions which create or replace the control's bitmap list:

 Load an image file.

 Capture an image from the screen.

 Copy another control's bitmap list by assigning the BitmapList property.

When you load an animated GIF file, the initial value is based on the global background color specified in the file. Otherwise, the default is black.

When you save an animated GIF file, this value is saved as a global value in the file.

When setting this property, you can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index (based on the AnimationPalette property) as explained in Using Palette Indexes As Color Values.

See Also

Elements	AnimationBitsPerPixel property, AnimationPalette property, AnimationWidth property, AnimationHeight property

Topics	Raster Images: Saving Files
Raster Images: Getting and Setting File Information
Raster Images: Playing Animated Images


AnimationBitsPerPixel property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnimationBitsPerPixel

Overview	Refer to Playing an Animation.

Remarks

Specifies the bits per pixel of the target bitmap that is used for animation playback.

This property applies to the temporary target bitmap that LEADTOOLS creates for animation playback.

This property is initialized when you take any of the following actions which create or replace the control's bitmap list:

 Load an image file.

 Capture an image from the screen.

 Copy another control's bitmap list by assigning the BitmapList property.

If you make any subsequent changes in the color resolution of the loaded bitmaps, you should update this property before playing the list as an animation.

See Also

Elements	AnimationBackColor property, AnimationPalette property, AnimationWidth property, AnimationHeight property

Topics	Raster Images: Saving Files
Raster Images: Getting and Setting File Information
Raster Images: Playing Animated Images


AnimationEnable property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AnimationEnable

Overview	Refer to Playing an Animation.

Remarks

Starts or stops an animation playback.

Setting	Description

TRUE	Starts an animation playback.

FALSE	Stops an animation playback.

See Also

Elements	AutoAnimate property, AutoAnimationLoop property, AnimationLoop property, Animate event

Topics	Raster Images: Playing Animated Images


AnimationFrameIndex property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnimationFrameIndex

Overview	Refer to Playing an Animation

Remarks

Gets or sets the index of the current frame in the animated list.

This property is 0 based, and should not be greater than (BitmapListCount –1).

See Also

Elements	BitmapListCount Property, AnimationBackColor property, AnimationPalette property, AnimationWidth property, AnimationHeight property, AnimationPause property.

Topics	Raster Images: Playing Animated Images


AnimationHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float AnimationHeight

Overview	Refer to Playing an Animation.

Remarks

Specifies the height of the target bitmap that is used for animation playback. The unit of measure is determined by the ScaleMode property.

This property applies to the temporary target bitmap that LEADTOOLS creates for animation playback.

This property is initialized when you take any of the following actions which create or replace the control's bitmap list:

 Load an image file.

 Capture an image from the screen.

 Copy another control's bitmap list by assigning the BitmapList property.

If you resize the loaded bitmaps, this property is not updated, and you may need to update this property before playing the list as an animation.

When you load an animated GIF file, the initial value is based on the global height specified in the file. Otherwise, the default is the same as the first bitmap in the list.

When you save an animated GIF file, this value is saved as a global value in the file.

See Also

Elements	AnimationBackColor property, AnimationBitsPerPixel property, AnimationPalette property, AnimationWidth property

Topics	Raster Images: Saving Files
Raster Images: Getting and Setting File Information
Raster Images: Playing Animated Images


AnimationLoop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AnimationLoop

Overview	Refer to Playing an Animation.

Remarks

Controls whether an animation plays continuously.

Setting	Description

TRUE	After the last bitmap in the list, the playback begins again with the first bitmap.

FALSE	After the last bitmap in the list, the playback stops.

When you save an animated GIF file, this value is saved as a global value in the file.

See Also

Elements	AutoAnimate property, AutoAnimationLoop property, AnimationEnable property, Animate event

Topics	Raster Images: Playing Animated Images


AnimationPalette property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR AnimationPalette (short iIndex);

Overview	Refer to Playing an Animation.

Remarks

Sets a color in the palette used for animation playback. This is a property of the temporary target bitmap.

The palette is an array of 256 elements. Each element is a long integer value containing the red, green and blue (RGB) components of the color. You can specify a color using the RGB function.

Palettes are used only for images that are 8 bits per pixel or less.

This property is initialized when you take any of the following actions which create or replace the control's bitmap list:

 Load an image file.

 Capture an image from the screen.

 Copy another control's bitmap list by assigning the BitmapList property.

When you load an animated GIF file, the initial value is based on the global palette specified in the file. Otherwise, the default is the same as the first bitmap in the list.

When you save an animated GIF file, this value is saved as a global value in the file.

See Also

Elements	AnimationBackColor property, AnimationBitsPerPixel property, AnimationWidth property, AnimationHeight property

Topics	Raster Images: Saving Files
Raster Images: Getting and Setting File Information
Raster Images: Playing Animated Images


iIndex Parameter For AnimationPalette
iIndex

Index into the array of colors.


AnimationPause property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnimationEnable

Overview	Refer to Playing an Animation

Remarks

Pauses/Continues an animation playback.

Setting	Description

TRUE	Pause an animation playback.

FALSE	Continue an animation playback.

See Also

Elements	AutoAnimate property, AutoAnimationLoop property, AnimationLoop property, Animate event, AnimationFrameIndex property.

Topics	Raster Images: Playing Animated Images


AnimationWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float AnimationWidth

Overview	Refer to Playing an Animation.

Remarks

Specifies the width of the target bitmap that is used for animation playback. The unit of measure is determined by the ScaleMode property.

This property applies to the temporary target bitmap that LEADTOOLS creates for animation playback.

This property is initialized when you take any of the following actions which create or replace the control's bitmap list:

 Load an image file.

 Capture an image from the screen.

 Copy another control's bitmap list by assigning the BitmapList property.

If you resize the loaded bitmaps, this property is not updated, and you may need to update this property before playing the list as an animation.

When you load an animated GIF file, the initial value is based on the global width specified in the file. Otherwise, the default is the same as the first bitmap in the list.

When you save an animated GIF file, this value is saved as a global value in the file.

See Also

Elements	AnimationBackColor property, AnimationBitsPerPixel property, AnimationPalette property, AnimationHeight property

Topics	Raster Images: Saving Files
Raster Images: Getting and Setting File Information
Raster Images: Playing Animated Images


AnnAddUndoNode method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnAddUndoNode ();

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Manually adds a node to the undo stack.

The automation object automatically does this when changing, adding or deleting annotation objects. This method should be called before making changes programmatically to the annotation objects. Calling this method insures that the changes can be undone using the Undo menu item.

The number of operations that can be undone should be set in the AnnUndoDepth property before calling this method. If the AnnUndoDepth property is not set, a default of 5 is used.

This method adds an undo node to the automation object. When used with the AnnUndoEnable property, a lengthy operation, consisting of multiple steps, can be combined into one undo call to the AnnUndo method. To accomplish this, use the following steps:

1.	Set the number of operations that can be undone in the AnnUndoDepth property. (The default for this property is 5.)

2.	Call the AddUndoNode method to add an undo node to the container.

3.	Disable the undo feature by setting the AnnUndoEnable property to FALSE.

4.	Perform the operations to be combined into one undo.

5.	Re-enable the undo feature by setting the AnnUndoEnable property to TRUE.

Now, all the operations can be undone with one call to the AnnUndo method instead of several calls to the AnnUndo method.

See Also

Elements	AnnUndoEnable property, AnnUndoDepth property, AnnUndo method

Topics	Annotations Automation
Undoing Automation Operations


Return for AnnAddUndoNode
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnAutoDialogFontSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnAutoDialogFontSize;

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Contains the font size, in points, used to display the automation dialog boxes.

This property should be set when the font name is set. The font name can be set by calling AnnSetAutoText(ANNAUTOTEXT_DIALOG_FONT, "New font name").

This property may be used to convert the annotation automation dialogs to another language. For more information, refer to Converting Annotation Automation Dialogs to Other Languages.

See Also

Elements	AnnSetAutoText method

Topics	Annotations Automation


AnnAutoDrawEnable property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AnnAutoDrawEnable

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Enables or disables the default use of the left mouse button to draw an annotation object in design mode.

To implement the automated design mode for annotations, this property must be set to TRUE, and the AnnUserMode property must be set to ANNUSERMODE_DESIGN.

Setting	Description

TRUE	The left mouse button can be used to draw objects in design mode.

FALSE	The automated functions of the left mouse button are disabled.

See Also

Elements	AnnAutoMenuEnable property, AnnUserMode property

Topics	Annotations (Document/Medical only): Automation


AnnAutomation property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE AnnAutomation

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Is the handle to the annotation automation object in the current window.

This is the object that you can use with LEADTOOLS DLL functionality to implement automation and to set default properties.

See Also

Elements	AnnContainer property

Topics	Annotations (Document/Medical only): Automation


AnnAutoMenuEnable property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AnnAutoMenuEnable

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Enables or disables the pop-up menus that appear when you click the right mouse button on an annotation object.

Setting	Description

TRUE	Enables the pop-up menus.

FALSE	Disables the pop-up menus.

See Also

Elements	AnnAutoDrawEnable property, AnnUserMode property

Topics	Annotations (Document/Medicalonly): Automation


AnnAutoResize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnnAutoResize

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only, persistent property, available at design time) Determines whether annotations are resized automatically when you resize the bitmap.

Setting	Description

TRUE	Annotations are automatically resized any time the bitmap is resized.

FALSE	Annotations keep their same size when the bitmap is resized.

The default is TRUE.

See Also

Elements	AnnAutoRotate property, Size method

Topics	Annotations: Object Manipulation


AnnAutoRotate property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AnnAutoRotate

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only, persistent property, available at design time) Determines whether annotations are rotated automatically when you rotate the bitmap.

You cannot rotate a note, hot spot, button, or audio clip. These objects will move to new positions, but will retain their orientation.

Setting	Description

TRUE	Annotations are automatically rotated any time the bitmap is rotated.

FALSE	Annotations keep their same positions and orientation when the bitmap is rotated.

See Also

Elements	AnnRotate method

Topics	Annotations (Document/Medicalonly): Object Manipulation


AnnBoundingRectHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnBoundingRectHeight(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Read only) (Document/Medical only) Gets the height of the bounding rectangle of the specified annotation object. This is the rectangle in which the object is displayed. The unit of measure is determined by the ScaleMode property.

The bounding rectangle is different from the defining rectangle as follows:

The defining rectangle intersects the outermost points that define the object. If a line is more than one pixel wide, its defining points are in the middle of the line. Refer to the AnnRectXXX properties.

The bounding rectangle accounts for line width and is used as the rectangle to be invalidated when displaying an object. If the line width is an even number, the bounding rectangle is enlarged slightly to allow for variations in how the center of the line is defined on different systems.

Half the width of an object's outer line is outside its defining rectangle, as shown in the following diagram:

See Also

Elements	AnnRectHeight property, AnnRectLeft property, AnnBoundingRectLeft property, AnnRectTop property, AnnBoundingRectTop property, AnnRectWidth property, AnnBoundingRectWidth property

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnBoundingRectHeight
hObject

Handle to the annotation object.


AnnBoundingRectLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnBoundingRectLeft(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Read only) (Document/Medical only) Gets the left boundary of the bounding rectangle of the specified annotation object. This is the rectangle in which the object is displayed. The unit of measure is determined by the ScaleMode property.

The bounding rectangle is different from the defining rectangle as follows:

The defining rectangle intersects the outermost points that define the object. If a line is more than one pixel wide, its defining points are in the middle of the line. Refer to the AnnRectXXX properties.

The bounding rectangle accounts for line width and is used as the rectangle to be invalidated when displaying an object. If the line width is an even number, the bounding rectangle is enlarged slightly to allow for variations in how the center of the line is defined on different systems.

Half the width of an object's outer line is outside its defining rectangle, as shown in the following diagram:

See Also

Elements	AnnRectHeight property, AnnBoundingRectHeight property, AnnRectLeft property, AnnRectTop property, AnnBoundingRectTop property, AnnRectWidth property, AnnBoundingRectWidth property

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnBoundingRectLeft
hObject

Handle to the annotation object.


AnnBoundingRectTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnBoundingRectTop(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Read only) (Document/Medical only) Gets the top boundary of the bounding rectangle of the specified annotation object. This is the rectangle in which the object is displayed. The unit of measure is determined by the ScaleMode property.

The bounding rectangle is different from the defining rectangle as follows:

The defining rectangle intersects the outermost points that define the object. If a line is more than one pixel wide, its defining points are in the middle of the line. Refer to the AnnRectXXX properties.

The bounding rectangle accounts for line width and is used as the rectangle to be invalidated when displaying an object. If the line width is an even number, the bounding rectangle is enlarged slightly to allow for variations in how the center of the line is defined on different systems.

Half the width of an object's outer line is outside its defining rectangle, as shown in the following diagram:

See Also

Elements	AnnRectHeight property, AnnBoundingRectHeight property, AnnRectLeft property, AnnBoundingRectLeft property, AnnRectTop property, AnnRectWidth property, AnnBoundingRectWidth property

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnBoundingRectTop
hObject

Handle to the annotation object.


AnnBoundingRectWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnBoundingRectWidth(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Read only) (Document/Medical only) Gets the width of the bounding rectangle of the specified annotation object. This is the rectangle in which the object is displayed. The unit of measure is determined by the ScaleMode property.

The bounding rectangle is different from the defining rectangle as follows:

The defining rectangle intersects the outermost points that define the object. If a line is more than one pixel wide, its defining points are in the middle of the line. Refer to the AnnRectXXX properties.

The bounding rectangle accounts for line width and is used as the rectangle to be invalidated when displaying an object. If the line width is an even number, the bounding rectangle is enlarged slightly to allow for variations in how the center of the line is defined on different systems.

Half the width of an object's outer line is outside its defining rectangle, as shown in the following diagram:

See Also

Elements	AnnRectHeight property, AnnBoundingRectHeight property, AnnRectLeft property, AnnBoundingRectLeft property, AnnRectTop property, AnnBoundingRectTop property, AnnRectWidth property

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnBoundingRectWidth
hObject

Handle to the annotation object.


AnnBringToFront method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnBringToFront(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Reorders the specified annotation object so that it is displayed on top of other objects in the same container.

This method moves the object to the end of the enumeration order for objects in the same container. When the container is displayed, this object is displayed last.

See Also

Elements	AnnSendToBack method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnBringToFront
hObject

Handle to the annotation object.


Return for AnnBringToFront
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnChange event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AnnChange (OLE_HANDLE hObject, long uType);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Occurs when any property of an annotation object changes.

When an action affects more than one object, this event occurs once for each affected object. This happens, for example, if a user changes the font for a group of selected objects.

See Also

Topics	Annotations (Document/Medicalonly): Annotation Events


uType Parameter For AnnChange
uType

This parameter is reserved and should be ignored


hObject Parameter For AnnChange
hObject

Handle to the annotation object.


AnnClicked event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AnnClicked (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Occurs when the user clicks on a button or hot spot annotation object.

The object handle that this event provides can be used to immediately identify the object, but it should not be used as a unique identifier over time. (The annotation undo feature can cause object handles to change.)

Therefore, to keep track of particular objects over time, you should use the AnnSetTag method and the AnnGetTag method.

See Also

Topics	Annotations (Document/Medical only): Annotation Events


hObject Parameter For AnnClicked
hObject

Handle to the annotation object.


AnnContainer property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE AnnContainer

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Is the handle to the annotation container for objects in the current window.

This is the root container, which you may need to specify when using LEADTOOLS DLL functions for annotations.

The value of this property is 0 if the Main Control has no annotations. Therefore, you can use it to check for the existence of annotations.

See Also

Elements	AnnAutomation property

Topics	Annotations (Document/Medical only): Automation


AnnContainer property (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long AnnContainer

Overview	Refer to Using the OLE DB Control.

Remarks

(Document/Medical only) Is the handle to the annotation container for objects loaded from the database or to be saved to the database.

To delete any existing annotation objects, set this property to 0.

After the DataLoaded event, if annotations were loaded from the database, you can copy them to the Main Control using this property.

To save annotations to the database, assign the Main Control's AnnContainer property to the OLE DB Control's AnnContainer property, and set the DataDirty property to True before changing the recordset.

See Also

Elements	DataDirty property, Bitmap property

Topics	Databases: OLE DB, Using a Visual Basic Data Control


AnnCopy method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnCopy (short iFormat, BOOL fSelected, BOOL fEmpty);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Copies the specified annotation objects to the Windows clipboard in either the native format or WMF format.

Use the WMF format only for copying for use in another application. LEADTOOLS reads annotations only in the native format.

See Also

Topics	Annotations (Document/Medical only): Using the Clipboard


iFormat Parameter For AnnCopy
iFormat

One of the following values:

Value	Meaning

ANNFMT_NATIVE	Use LEAD's own format for annotations.

ANNFMT_WMF	Use the Windows WMF format.


fSelected Parameter For AnnCopy
fSelected

One of the following values:

TRUE	Copy only the selected objects.

FALSE	Copy all of the annotation objects.


fEmpty Parameter For AnnCopy
fEmpty

One of the following values:

TRUE	Empty the clipboard before copying data to it.

FALSE	Add to the existing data on the clipboard.


Return for AnnCopy
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnCreate event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AnnCreate (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Occurs whenever an annotation object is added by any means, including loading from a file, pasting from the clipboard, or drawing with an annotation tool selection.

The object handle that this event provides can be used to immediately identify the object, but it should not be used as a unique identifier over time. (The annotation undo feature can cause object handles to change.)

Therefore, to keep track of particular objects such as buttons or hot spots over time, you should use the AnnSetTag method and the AnnGetTag method.

When you load a file, an AnnCreate event is generated for each annotation object. You can add code in this event to see which tags are already used in a file.

See Also

Topics	Annotations (Document/Medical only): Annotation Events


hObject Parameter For AnnCreate
hObject

Handle to the annotation object that is created.


AnnCreate method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnCreate (short iType, BOOL bAutoInsert, BOOL bVisible);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Creates an annotation object of the specified type.

If you set bAutoInsert to FALSE, the object is not inserted in any container. You must insert the object yourself, or destroy the object using AnnDestroy, to avoid memory leaks.

See Also

Elements	AnnDefine, AnnDestroy method, AnnGetVisible method, AnnInsert method, AnnSetAutoDefaults method, AnnSetSelected method, AnnSetVisible method

Topics	Annotations (Document/Medical only): Object Manipulation


iType Parameter For AnnCreate
iType

The type of annotation object to create. For descriptions of object types, refer to Types of Annotations.


bAutoInsert Parameter For AnnCreate
bAutoInsert

Flag that indicates whether to insert the created annotation object in AnnContainer. Possible values are:

Value	Meaning

TRUE	Automatically insert the annotation object in AnnContainer.

FALSE	Do not automatically insert the annotation object in AnnContainer.


bVisible Parameter For AnnCreate
bVisible

Flag that indicates whether the object will be visible. Possible values are:

Value	Meaning

TRUE	The annotation object will be visible with default properties.

FALSE	The annotation object will not be visible.


Return for AnnCreate
Return Value

Return	Meaning

! NULL	Handle to the newly created annotation object.

NULL	An error occurred. Refer to Error Codes.


AnnCreateItem method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnCreateItem(OLE_HANDLE hContainer, short iType, boolean bVisible);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Creates an annotation object in a container.

You must use the AnnSet... methods to initialize the object after it is created.

See Also

Elements	AnnCreate method, AnnDefine method, AnnInsert method, AnnRemove method, AnnDestroy method

Topics	Annotations (Document/Medical only): Object Manipulation


hContainer Parameter For AnnCreateItem
hContainer

Handle to the annotation object that is the container for the object to be created.


iType Parameter For AnnCreateItem
iType

The type of annotation object to create. For descriptions of object types, refer to Types of Annotations.


bVisible Parameter For AnnCreateItem
bVisible

Flag that indicates whether the object will be visible. Possible values are:

Value	Meaning

TRUE	The annotation object will be visible with default properties.

FALSE	The annotation object will not be visible.


Return for AnnCreateItem
Return Value

Return	Meaning

! NULL	Handle to the newly created annotation object.

NULL	An error occurred. Refer to Error Codes.


AnnCut method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnCut(OLE_HANDLE hObject, short iFormat, BOOL fSelected, BOOL fEmpty);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Cuts the specified annotation objects to the Windows clipboard in either the native format or WMF format.

Use the WMF format only for copying for use in another application. LEADTOOLS reads annotations only in the native format.

Use the hObject and fSelected parameters as follows:

1.	To copy the specified object, set hObject to that object and set fSelected to FALSE.

2.	To copy only selected objects in a container, set hObject to the container and set fSelected to TRUE.

3.	To copy all objects in a container, set hObject to the container and set fSelected to FALSE.

See Also

Elements	AnnCopy method, AnnPaste method

Topics	Annotations (Document/Medical only): Using the Clipboard


hObject Parameter For AnnCut
hObject

Handle to the annotation object.


iFormat Parameter For AnnCut
iFormat

Format for the annotation data. Possible values are:

Value	Meaning

ANNFMT_NATIVE	Use LEAD's own format for annotations.

ANNFMT_WMF	Use the Windows WMF format.


fSelected Parameter For AnnCut
fSelected

Flag that indicates which objects to copy. Possible values are:

Value	Meaning

TRUE	Copy only the selected objects.

FALSE	Copy all of the annotation objects.


fEmpty Parameter For AnnCut
fEmpty

Flag that indicates whether to empty the clipboard prior to copying the annotation data to it. Possible values are:

Value	Meaning

TRUE	Empty the clipboard before copying data to it.

FALSE	Add to the existing data on the clipboard.


Return for AnnCut
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnDataPath property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BSTR AnnDataPath

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only, persistent property, available at design time) Loads the specified annotation file asynchronously. The value can be a local pathname or an Internet URL.

To manage the loading, you can use the ReadyState property and the ReadyStateChange event.

See Also

Elements	BitmapDataPath property

Topics	Annotations (Document/Medical only): Input and Output


AnnDeletePage method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnDeletePage(BSTR pszName, long lPage);

Overview	Refer to Annotation Files.

Remarks

(Document/Medical only)  Deletes a page from a multi-page annotation file. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, and so on.

This method is valid only for annotation files that contain at least two pages.  If an annotation file contains only one page, calling this method will return an error.

See Also

Elements	AnnDeletePageMemory method, AnnDeletePageArray method, AnnLoadArray method, AnnLoadMemory method, AnnLoad method, AnnSaveMemory method, AnnSave method, AnnSaveArray method

Topics	Annotations (Document/Medical only): Input and Output


pszName Parameter For AnnDeletePage
pszName

String containing the annotation file from which to delete the specified page.


lPage Parameter For AnnDeletePage
lPage

Number of the page to be deleted. The page number is 1-based. Therefore, the first page is page 1; the second page is page 2, etc.


Return for AnnDeletePage
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnDeletePageArray method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnDeletePageArray(VARIANT *pvMem, long lPage);

Overview	Refer to Annotation Files.

Remarks

(Document/Medical only)  Deletes a page from a multi-page annotation file in memory. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, and so on. Deleting a page from an annotation file will cause the size of the annotation file to change.   To obtain the new size, use the following:

Size = UpperBound of the VARIANT – LowerBound of the VARIANT + 1;

This method is valid only for annotation files that contain at least two pages.  If an annotation file contains only one page, calling this method will return an error.

See Also

Elements	AnnDeletePageMemory method, AnnDeletePage method, AnnLoadArray method, AnnLoadMemory method, AnnSaveMemory method, AnnLoad method, AnnSave method, AnnSaveArray method

Topics	Annotations (Document/Medical only): Input and Output


pvMem Parameter For AnnDeletePageArray
pvMem

Address of a variant containing the annotation file in memory.


lPage Parameter For AnnDeletePageArray
lPage

Number of the page to be deleted. The page number is 1-based. Therefore, the first page is page 1; the second page is page 2, etc.


Return for AnnDeletePageArray
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnDeletePageMemory method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnDeletePageMemory(OLE_HANDLE hMem, long* plSize, long lPage);

Overview	Refer to Annotation Files.

Remarks

(Document/Medical only)  Deletes a page from a multi-page annotation file in memory.  The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, and so on.  Deleting a page from an annotation file will cause the size of the annotation file to change.   The argument plSize will contain the new size of the annotation file in memory.  (For VC, pass the address of a long variable.  For VB, just pass the long variable).  This method is valid only for annotation files that contain at least two pages.  If an annotation file contains only one page, calling this method will return an error.

See Also

Elements	AnnDeletePage method, AnnDeletePageArray method, AnnLoadArray method, AnnLoadMemory method, AnnSaveMemory method, AnnLoad method, AnnSave method, AnnSaveArray method

Topics	Annotations (Document/Medical only): Input and Output


hMem Parameter For AnnDeletePageMemory
hMem

A global handle (HGLOBAL) to the annotation file in memory.  If the AnnSaveMemory method is used to create the file in memory, that method updates the handle and buffer size variables.


plSize Parameter For AnnDeletePageMemory
plSize

Address of the long integer variable that you use to track the size of the file in memory.  In C++, declare the variable and pass its address.  In most other languages, pass the variable by reference.  The method updates the value of the variable.  The variable must be declared with the appropriate data type.  To see the correct data type, refer to the code example for your development system.


lPage Parameter For AnnDeletePageMemory
lPage

Number of the page to be deleted. The page number is 1-based. Therefore, the first page is page 1; the second page is page 2, etc.


Return for AnnDeletePageMemory
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnDefine method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnDefine (OLE_HANDLE hObject, float x, float y, short iState);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Specifies the shape when creating or transforming an annotation object. This method specifies one point in the current window each time it is called.

See Also

Elements	AnnCreate method, AnnDestroy method, AnnGetVisible method, AnnInsert method, AnnSetAutoDefaults method, AnnSetSelected method, AnnSetVisible method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnDefine
hObject

Handle to the annotation object.


x Parameter For AnnDefine
x

X coordinate of a point. This coordinate is relative to the window of the LEAD control. Coordinates may be scaled using the ScaleMode.


y Parameter For AnnDefine
y

Y coordinate of a point. This coordinate is relative to the window of the LEAD control. Coordinates may be scaled using the ScaleMode.


iState Parameter For AnnDefine
iState

Flag that indicates how to align the annotation toolbar. Possible values are given below, and may be combined:

Value	Meaning

ANNDEFINE_BEGINSET	[0] This is the first point to define a new object.

ANNDEFINE_BEGINMOVE	[1] This is the point from which to move the object.

ANNDEFINE_BEGINROTATE	[2] This is the starting point for calculating the angle of rotation.

ANNDEFINE_BEGINRESIZE	[3] This is the starting point for calculating how to resize the object.

ANNDEFINE_BEGINSELECT	[4] This is the first corner of the rectangle used to select objects.

ANNDEFINE_APPEND	[5] This is the next point when defining an object that requires more than two points.

ANNDEFINE_UPDATE	[6] This is the current mouse position during creation of the object. Use this on a mouse move event to reflect the current shape of the object.

ANNDEFINE_END	[7] This is the last point.

ANNDEFINE_BEGINMOVESELECTED	[8] This is the point from which to move all selected objects.

ANNDEFINE_BEGINROTATESELECTED	[9] This is the starting point for calculating the angle of rotation for all selected objects.

ANNDEFINE_BEGINRESIZESELECTED	[10] This is the starting point for calculating the how to resize all selected objects.

ANNDEFINE_BEGINMOVENAME	[12] This is the starting point from which to move the object name.


Return for AnnDefine
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnDestroy event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AnnDestroy (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Occurs when an annotation object is deleted. If the user deletes several objects at the same time, a separate event occurs for each object.

Do not call the AnnEnumerate, AnnDestroy, or AnnCreate methods inside this AnnDestroy event. The annotation objects are stored as a linked list and should not be accessed or modified within this event.

See Also

Topics	Annotations (Document/Medical only): Annotation Events


hObject Parameter For AnnDestroy
hObject

Handle to the annotation object that is deleted.


AnnDestroy method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnDestroy (OLE_HANDLE hObject, short iFlags);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Deletes an annotation object and frees the memory that was used to store the object.

See Also

Elements	AnnCreate method, AnnDefine, AnnGetVisible method, AnnInsert method, AnnSetAutoDefaults method, AnnSetSelected method, AnnSetVisible method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnDestroy
hObject

Handle to the annotation object to be destroyed. If hObject is a container, then iFlags indicates which objects within the container to destroy.


iFlags Parameter For AnnDestroy
iFlags

Flag that indicates the objects to process. Use 0 if hObject is not a container.

If hObject is a container, you can use 0 (process only hObject), or you can combine some of the values given below, using a bitwise OR. For example, ANNFLAG_SELECTED | ANNFLAG_RECURSE processes only the selected objects.

Value	Meaning

ANNFLAG_SELECTED	[0x0001] Enumerate only the selected objects.

ANNFLAG_NOTCONTAINER	[0x0002] Enumerate all objects that are not containers.

ANNFLAG_NOTTHIS	[0x0003] Enumerate all objects except hObject.

ANNFLAG_RECURSE	[0x0004] Enumerate all objects contained in hObject and any contained in any sub-containers.

ANNFLAG_CHECKMENU	[0x0020] Process objects only if the ANNAUTOTEXT_MENU_DELETE menu item has not been disabled.


Return for AnnDestroy
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnDrawn event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AnnDrawn (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Occurs after the user finishes drawing an annotation object.

This is different from the AnnCreate event, which occurs whenever an object is added by any means, including loading from a file or pasting from the clipboard.

This event is useful for setting the annotation tool selection for the next operation. For example, it is common to change the tool to a selection pointer after an object is drawn.

See Also

Topics	Annotations (Document/Medical only): Annotation Events


hObject Parameter For AnnDrawn
hObject

Handle to the annotation object.


AnnEnumerate event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void AnnEnumerate (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Occurs for each object enumerated in the AnnEnumerate method.

Do not insert or destroy annotations within this event.

See Also

Elements	AnnEnumerate method

Topics	Annotations (Document/Medical only): Annotation Events


hObject Parameter For AnnEnumerate
hObject

Handle to the object.


AnnEnumerate method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnEnumerate (OLE_HANDLE hObject, short iFlags, LPCTSTR pszUserList);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Enumerates all objects contained in hObject.

See Also

Elements	AnnEnumerate event


hObject Parameter For AnnEnumerate
hObject

The object being enumerated, most often a Container object.


iFlags Parameter For AnnEnumerate
iFlags

Flag that indicates the objects to process. Possible values are:

Value	Meaning

ANNFLAG_SELECTED	[0x0001] Enumerate only the selected objects.

ANNFLAG_NOTCONTAINER	[0x0002] Enumerate all objects that are not containers.

ANNFLAG_NOTTHIS	[0x0003] Enumerate all objects except hObject.

ANNFLAG_RECURSE	[0x0004] Enumerate all objects contained in hObject and any contained in any sub-containers,

ANNFLAG_USER	[0x0040] Process only those objects with users listed in pszUserList.


pszUserList Parameter For AnnEnumerate
pszUserList

String that contains the users.


Return for AnnEnumerate
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnFileInfo method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnFileInfo(BSTR pszName );

Overview	Refer to Annotation Files.

Remarks

Gets information about the specified annotation file.

The AnnFileInfo method updates the following properties:

AnnInfoVersion property

AnnInfoFormat property

AnnInfoTotalPages property

See Also

Elements	AnnFileInfoMemory method, AnnFileInfoArray method, AnnInfoFormat property, AnnInfoTotalPages property, AnnInfoVersion property, AnnLoadArray method, AnnLoadMemory method, AnnLoad method

Topics	Annotations (Document/Medical only): Input and Output


pszName Parameter For AnnFileInfo
pszName

String containing the annotation file from which to obtain information.


Return for AnnFileInfo
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnFileInfoArray method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnFileInfoArray(VARIANT vMem);

Overview	Refer to Annotation Files.

Remarks

Gets information about an annotation file in memory.

The AnnFileInfoArray method updates the following properties:

AnnInfoVersion property

AnnInfoFormat property

AnnInfoTotalPages property

See Also

Elements	AnnFileInfo method, AnnFileInfoMemory method, AnnInfoFormat property, AnnInfoTotalPages property, AnnInfoVersion property, AnnLoadArray method, AnnLoadMemory method, AnnLoad method

Topics	Annotations (Document/Medical only): Input and Output


vMem Parameter For AnnFileInfoArray
vMem

A variant containing a byte-array that  represents the annotation file in memory.


Return for AnnFileInfoArray
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnFileInfoMemory (Main Control)
AnnFileInfoMemory method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnFileInfoMemory (OLE_HANDLE hMem, long iSize);

Overview	Refer to Annotation Files.

Remarks

Gets information about an annotation file in memory.

The AnnFileInfoMemory method updates the following properties:

AnnInfoVersion property

AnnInfoFormat property

AnnInfoTotalPages property

See Also

Elements	AnnFileInfo method, AnnFileInfoArray method, AnnInfoFormat property, AnnInfoTotalPages property, AnnInfoVersion property, AnnLoadArray method, AnnLoadMemory method, AnnLoad method

Topics	Annotations (Document/Medical only): Input and Output


hMem Parameter For AnnFileInfoMemory
hMem

A global handle (HGLOBAL) to the annotation file in memory.  If the AnnSaveMemory method is used to create the file in memory, that method updates the handle and buffer size variables.


plSize Parameter For AnnFileInfoMemory
plSize

The size in bytes, of the file referenced by hMem.  If the AnnSaveMemory method is used to create the file in memory, that method updates the handle and buffer size variables.


Return for AnnFileInfoMemory
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnFlip method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnFlip (BOOL bUseHorz, float fHorz, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Flips one or more annotation objects, top to bottom.

If you pass TRUE in the bSelected parameter, this method affects only the currently selected objects. Otherwise, it affects all objects.

If you pass TRUE in the bUseHorz parameter, this method flips all affected objects on the axis specified in the fHorz parameter. Otherwise, it flips each affected object on its own center.

You cannot flip or reverse an object that contains text. If you flip or reverse a group of objects on a common axis, the text will move to the new position, but will retain its orientation.

See Also

Topics	Annotations (Document/Medical only): Object Manipulation


bUseHorz Parameter For AnnFlip
bUseHorz

One of the following values:

TRUE	Flip all objects on the axis specified by the fHorz parameter.

FALSE	Flip each object on its own center.


fHorz Parameter For AnnFlip
fHorz

The horizontal axis (Y value) on which the objects are flipped. This value is used only if the bUseHorz parameter is TRUE.

The position is relative to the bitmap in the control. The unit of measure is determined by the ScaleMode property.


bSelected Parameter For AnnFlip
bSelected

One of the following values:

TRUE	Flip only the selected objects.

FALSE	Flip all of the annotation objects.


Return for AnnFlip
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnGetAngle method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetAngle(OLE_HANDLE hObject);

Overview	Refer to Protractor Annotation Object.

Remarks

(Document/Medical only) Gets the angle of the Protractor object in the object's unit of measurement, set by the AnnSetProtractorOptions method.

This method is only valid for Protractor annotation objects.

See Also

Elements	AnnSetProtractorOptions method, AnnGetProtractorOptions method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetAngle
hObject

Handle to the annotation object.


Return for AnnGetAngle
Return Value

Angle of the protractor object specified in hObject.


AnnGetArea method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long AnnGetArea(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the pixel count of the specified annotation object.

The pixel count is the number of pixels contained in a region extracted from the annotation object, without resizing. It is equivalent to calling AnnGetRgnHandle method and then getting a pixel count of the resulting region.

See Also

Elements	AnnGetRgnHandle method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetArea
hObject

Handle to the annotation object from which to get the pixel count.


Return for AnnGetArea
Return Value

Object's pixel count.


AnnGetAutoBackColor method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR AnnGetAutoBackColor(OLE_HANDLE hObject, short iType);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the background color of one or more annotation objects.

Please note the following:

if uObjectType is:	then the background color retrieved is:
ANNOBJECT_NOTE or ANNOBJECT_PUSHPIN	the background color used for Note objects and push pin objects created by the automation object
ANNOBJECT_HILITE	the background color used for Hilite objects created by the automation object.
ANNOBJECT_REDACT	the background color used for Redact objects created by the automation object.
any other object such as ANNOBJECT_TEXT, ANNOBJECT_RECT, etc.	the background color used for all other objects, created by the automation object, which have a background color property.
See Also

Elements	AnnSetAutoBackColor method, AnnGetBackColor method, AnnSetBackColor method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnGetAutoBackColor
hObject

Handle to the annotation object.


iType Parameter For AnnGetAutoBackColor
iType

Type of object for which to get the background color. For descriptions of object types, refer to Types of Annotations.


Return for AnnGetAutoBackColor
Return Value

Background color of the specified object type.


AnnGetAutoMenuItemEnable method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnGetAutoMenuItemEnable (OLE_HANDLE hObject, short iType, short iItem);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Returns a value that indicates whether the specified menu item is enabled or disabled.

If for the specified object, the menu item’s enable state is ANNMENU_DEFAULT, the method determines whether the enable state has been set for objects of the specified type. If the enable state for objects of the specified type is also ANNMENU_DEFAULT, the method determines whether the enable state has been set for ANNOBJECT_ALL. If this is also ANNMENU_DEFAULT, the method determines whether the menu item text is NULL or not NULL. If it is NULL, the method returns ANNMENU_DISABLE. If the menu item is not NULL, the method returns ANNMENU_ENABLE.

See Also

Elements	AnnSetAutoMenuItemEnable, AnnAutoMenuEnable property

Topics	Annotations (Document/Medicalonly): Automation


hObject Parameter For AnnGetAutoMenuItemEnable
hObject

Handle to an annotation or automation object.


iType Parameter For AnnGetAutoMenuItemEnable
iType

Constant that specifies an object's type. For descriptions of possible object types, refer to Types of Annotations. This parameter is valid only if hObject is an automation object.


iItem Parameter For AnnGetAutoMenuItemEnable
iItem

Constant that specifies the menu or dialog box item to enable or disable. For lists of constants and their default values, refer to the following:

Annotation Automation Menu Strings

Annotation Automation Line Dialog Strings

Annotation Automation Fill Dialog Strings

Annotation Automation Text Dialog Strings

Annotation Automation Audio Dialog Strings

Annotation Automation Stamp Dialog Strings

Annotation Automation ROP2 Dialog Strings

Annotation Automation Lock/Unlock Dialog Strings

Annotation Automation Miscellaneous Dialog Strings

Annotation Automation Ruler Dialog Strings

Annotation Automation Point Dialog Strings

Annotation Automation Video Dialog Strings

Annotation Automation Push Pin Dialog Strings

Annotation Automation Nodes Dialog Strings

Annotation Automation Protractor Dialog Strings

Annotation Automation Name Dialog Strings

Annotation Automation Play Video Dialog Strings

Annotation Automation Stamp Metafile Dialog Strings

Annotation Automation ToolTip Dialog Strings

Annotation Automation Transparent Color Dialog Strings

Annotation Automation Capture Dialog Strings


Return for AnnGetAutoMenuItemEnable
Return Value

Returns a value that indicates whether the specified menu item has been enabled or disabled for the object. Possible values are:

Value	Meaning

ANNMENU_ENABLED	Enable the menu item.

ANNMENU_DISABLED	Disable the menu item.

ANNMENU_DEFAULT	Enable or disable the menu item, based on the setting for the object type.


AnnGetAutoText method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BSTR AnnGetAutoText (short iItem);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Returns the current text string that is used for the specified menu item or other element that LEADTOOLS provides for automated annotations.

To modify the text strings you can use the AnnSetAutoText method.

See Also

Elements	AnnSetAutoText method

Topics	Annotations (Document/Medical only): Automation


iItem Parameter For AnnGetAutoText
iItem

Constant that specifies the menu or dialog box item, which appears when the user presses the right mouse button. For lists of constants and their default values, refer to the following:

Annotation Automation Menu Strings

Annotation Automation Line Dialog Strings

Annotation Automation Fill Dialog Strings

Annotation Automation Text Dialog Strings

Annotation Automation Audio Dialog Strings

Annotation Automation Stamp Dialog Strings

Annotation Automation Lock/Unlock Dialog Strings

Annotation Automation Miscellaneous Dialog Strings

Annotation Automation ROP2 Dialog Strings

Annotation Automation Ruler Dialog Strings


Return for AnnGetAutoText
Return Value

The current text string for the specified item.


AnnGetBackColor method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR AnnGetBackColor(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the background color of the annotation object.

To see how the background color relates to the fill modes, refer to Illustration of Fill Options for Annotations.

See Also

Elements	AnnSetForeColor method, AnnGetForeColor method, AnnSetBackColor method, AnnGetAutoBackColor method, AnnSetAutoBackColor method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetBackColor
hObject

Handle to the annotation object.


Return for AnnGetBackColor
Return Value

Object's background color.


AnnGetBitmap method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnGetBitmap(OLE_HANDLE hObject);

Overview	Refer to PushPin Annotation Object.

Remarks

(Document/Medical only) Gets the bitmap handle to the specified annotation object.

Only the Stamp object uses this property. The specified bitmap is a LEAD bitmap.

See Also

Elements	AnnSetBitmap method

Topics	Annotations (Document/Medical only): Bitmap


hObject Parameter For AnnGetBitmap
hObject

Handle to the annotation object.


Return for AnnGetBitmap
Return Value

Return	Meaning

! NULL	Handle to the annotation object's bitmap.

NULL	An error occurred. Refer to Error Codes.


AnnGetBitmapDpiX method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetBitmapDpiX(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the horizontal Bitmap DPI (dots per inch) that is used to translate the horizontal distance for the Ruler object.

The Bitmap DPI properties apply only to Automation and Ruler objects.  Refer to AnnAutomation property.

See Also

Elements	AnnSetBitmapDpiX method, AnnSetBitmapDpiY method, AnnGetBitmapDpiY method, AnnSetUnit method, AnnGetUnit method, AnnGetDistance method, AnnSetGaugeLength method, AnnGetGaugeLength method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetBitmapDpiX
hObject

Handle to the annotation automation object.


Return for AnnGetBitmapDpiX
Return Value

Current horizontal Bitmap DPI value.


AnnGetBitmapDpiY method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetBitmapDpiY(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the vertical Bitmap DPI (dots per inch) that is used to translate the vertical distance for the Ruler object.

The Bitmap DPI properties apply only to Automation and Ruler objects. Refer to AnnAutomation property.

See Also

Elements	AnnSetBitmapDpiX method, AnnSetBitmapDpiY method, AnnGetBitmapDpiX method, AnnSetUnit method, AnnGetUnit method, AnnGetDistance method, AnnSetGaugeLength method, AnnGetGaugeLength method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetBitmapDpiY
hObject

Handle to the annotation automation object.


Return for AnnGetBitmapDpiY
Return Value

Current vertical Bitmap DPI value.


AnnGetContainer method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnGetContainer(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the handle to the container of the specified annotation object.

See Also

Elements	AnnInsert method, AnnRemove method, AnnGetTopContainer method, AnnEnumerate method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnGetContainer
hObject

Handle to the annotation object.


Return for AnnGetContainer
Return Value

Return	Meaning

! NULL	Handle to the container.

NULL	The object does not have a container. An error occurred. Refer to Error Codes.


AnnGetDistance method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetDistance(OLE_HANDLE hObject, float *Distance2);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the distance of the Ruler object in the object's unit of measurement, set by AnnSetUnit method.

See Also

Elements	AnnSetBitmapDpiX method, AnnGetBitmapDpiX method, AnnGetBitmapDpiY method, AnnSetBitmapDpiY method, AnnSetUnit method, AnnGetUnit method, AnnSetGaugeLength method, AnnGetGaugeLength method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetDistance
hObject

Handle to the annotation automation object.


Distance2 Parameter For AnnGetDistance
Distance2

Address of the float variable to be updated with the distance of the ruler object. For cross products and protractors, which have two rulers, this variable will be updated with the length of the secondary ruler.

In C++, declare the variable and pass its address. In most other languages, pass the variable by reference.


Return for AnnGetDistance
Return Value

Distance of the ruler object. For objects having only one ruler, the return value will be the length. For cross products, which have two rulers, the return value will be length of the primary ruler.


AnnGetFillMode method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnGetFillMode(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the fill mode of the specified annotation object.

To see the possible fill modes and patterns, refer to Illustration of Fill Options for Annotations.

See Also

Elements	AnnSetFillPattern method, AnnGetFillPattern method, AnnSetFillMode method, AnnGetPolyFillMode method, AnnSetPolyFillMode method, AnnGetROP2 method, AnnSetROP2 method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetFillMode
hObject

Handle to the annotation object.


Return for AnnGetFillMode
Return Value

Object's fill mode constant. Possible fill mode values are:

Value	Meaning

ANNFILLMODE_TRANSPARENT	[0] Transparent

ANNFILLMODE_TRANSLUCENT	[1] Translucent

ANNFILLMODE_OPAQUE	[2] Opaque


AnnGetFillPattern method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnGetFillPattern(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the fill pattern of the specified annotation object.

To see the possible fill modes and patterns, refer to Illustration of Fill Options for Annotations.

See Also

Elements	AnnSetFillPattern method, AnnSetFillMode method, AnnGetFillMode method, AnnGetPolyFillMode method, AnnSetPolyFillMode method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetFillPattern
hObject

Handle to the annotation object.


Return for AnnGetFillPattern
Return Value

Object's fill pattern constant. Possible fill pattern values are:

Value	Meaning

ANNFILLPATTERN_SOLID	[0] Solid

ANNFILLPATTERN_BDIAGONAL	[1] Backward diagonal

ANNFILLPATTERN_CROSS	[2] Cross

ANNFILLPATTERN_DIAGCROSS	[3] Diagonal cross

ANNFILLPATTERN_FDIAGONAL	[4] Forward diagonal

ANNFILLPATTERN_HORIZONTAL	[5] Horizontal

ANNFILLPATTERN_VERTICAL	[6] Vertical


AnnGetFontBold method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnnGetFontBold(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets a value that indicates whether the font of the specified annotation object is bold.

See Also

Elements	AnnSetFontBold method, AnnSetFontName method, AnnGetFontName method, AnnSetFontSize method, AnnGetFontSize method, AnnSetFontUnderline method, AnnGetFontUnderline method, AnnSetFontStrikeThrough method, AnnGetFontStrikeThrough method, AnnSetFontItalic method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetFontBold
hObject

Handle to the annotation object.


Return for AnnGetFontBold
Return Value

Value indicating whether the font is bold.  Possible values are:

Value	Meaning

TRUE	The font is bold

FALSE	The font is not bold.


AnnGetFontItalic method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnnGetFontItalic(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets a value that indicates whether the font of the specified annotation object is italic.

See Also

Elements	AnnGetFontBold method, AnnSetFontBold method, AnnSetFontName method, AnnGetFontName method, AnnSetFontSize method, AnnGetFontSize method, AnnSetFontUnderline method, AnnGetFontUnderline method, AnnSetFontStrikeThrough method, AnnGetFontStrikeThrough method, AnnSetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetFontItalic
hObject

Handle to the annotation object.


Return for AnnGetFontItalic
Return Value

Value indicating whether the font is italic.  Possible values are:

Value	Meaning

TRUE	The font is italic

FALSE	The font is not italic.


AnnGetFontName method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR AnnGetFontName(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the font name (character string) for the text in the specified annotation object.

See Also

Elements	AnnGetFontBold method, AnnSetFontBold method, AnnSetFontName method, AnnSetFontSize method, AnnGetFontSize method, AnnSetFontUnderline method, AnnGetFontUnderline method, AnnSetFontStrikeThrough method, AnnGetFontStrikeThrough method, AnnSetFontItalic method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetFontName
hObject

Handle to the annotation object.


Return for AnnGetFontName
Return Value

A character string that contains the name of the font used by the annotation object.


AnnGetFontSize method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetFontSize(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the current unscaled value of the font size of the specified annotation object.

See Also

Elements	AnnGetFontBold method, AnnSetFontBold method, AnnSetFontName method, AnnGetFontName method, AnnSetFontSize method, AnnSetFontUnderline method, AnnGetFontUnderline method, AnnSetFontStrikeThrough method, AnnGetFontStrikeThrough method, AnnSetFontItalic method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetFontSize
hObject

Handle to the annotation object.


Return for AnnGetFontSize
Return Value

The current unscaled font size of the annotation object.


AnnGetFontStrikeThrough method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnnGetFontStrikeThrough(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets a value that indicates whether the font of the specified annotation object has a strike-through (a line through the middle of the text).

See Also

Elements	AnnGetFontBold method, AnnSetFontBold method, AnnSetFontName method , AnnGetFontName method, AnnSetFontSize method, AnnGetFontSize method, AnnSetFontUnderline method, AnnGetFontUnderline method, AnnSetFontStrikeThrough method, AnnSetFontItalic method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetFontStrikeThrough
hObject

Handle to the annotation object.


Return for AnnGetFontStrikeThrough
Return Value

Value indicating whether the font has a strike-through. Possible values are:

Value	Meaning

TRUE	The font has a strike-through.

FALSE	The font does not have a strike-through.


AnnGetFontUnderline method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnnGetFontUnderline(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets a value that indicates whether the font of the specified annotation object has an underline.

See Also

Elements	AnnGetFontBold method, AnnSetFontBold method, AnnSetFontName method, AnnGetFontName method, AnnSetFontSize method, AnnGetFontSize method, AnnSetFontUnderline method, AnnSetFontStrikeThrough method, AnnGetFontStrikeThrough method, AnnSetFontItalic method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetFontUnderline
hObject

Handle to the annotation object.


Return for AnnGetFontUnderline
Return Value

Value indicating whether the font has an underline. Possible values are:

Value	Meaning

TRUE	The font has an underline.

FALSE	The font does not have an underline.


AnnGetForeColor method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR AnnGetForeColor(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the current value of the specified annotation object's foreground color.

To see how the foreground color relates to the fill modes, refer to Illustration of Fill Options for Annotations.

See Also

Elements	AnnSetForeColor method, AnnSetBackColor method, AnnGetBackColor method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetForeColor
hObject

Handle to the annotation object.


Return for AnnGetForeColor
Return Value

The annotation object's current foreground color.


AnnGetGaugeLength method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetGaugeLength(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the length of the gauge (the perpendicular lines at the ends of the Ruler object).

The gauge length applies only to Automation and Ruler objects. For more information, refer to Annotation Automation Object and Ruler Annotation Object.

See Also

Elements	AnnSetGaugeLength method, AnnSetBitmapDpiX method, AnnGetBitmapDpiX method, AnnGetBitmapDpiY method, AnnSetBitmapDpiY method, AnnSetUnit method, AnnGetUnit method, AnnGetDistance method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetGaugeLength
hObject

Handle to the annotation object.


Return for AnnGetGaugeLength
Return Value

The annotation object's gauge length.

Length is expressed in pixels, not in points. The length is for the whole line, not just from the end point of the ruler to the end point of the gauge - it is from one end of the gauge to the other end of the gauge.


AnnGetGrouping method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnGetGrouping (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the status of the grouping feature of the objects within the specified container.

This method is valid only for container objects.

Each container contains a "grouping" feature, which indicates whether the objects in the container should be treated as a group.

Typically, container handles are obtained by enumerating all the objects with the AnnEnumerate method and checking the object type with the AnnGetType method.

See Also

Elements	AnnSetGrouping method, AnnGroup method, AnnUngroup method

Topics	Annotations (Document/Medical only): Object Manipulation
Grouping and Ungrouping Annotation Objects


hObject Parameter For AnnGetGrouping
hObject

Handle to a container object.


Return for AnnGetGrouping
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnGetHyperlinkParam method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long AnnGetHyperlinkParam (OLE_HANDLE hObject, short iParamIndex);

Overview	Refer to Implementing Annotation Hyperlinks.

Remarks

(Document/Medical only) Returns the value of the parameter indicated by iParamIndex, for annotation objects with hyperlinks of type ANNLINK_EVENT5.  Using this method with annotation objects having any other type of hyperlink will result in an error.

See Also

Elements	AnnGetHyperlinkType method, AnnSetHyperlinkMsg method, AnnHyperlink event

Topics	Annotations (Document/Medical only): Annotation Hyperlinks


hObject Parameter For AnnGetHyperlinkParam
hObject

Handle to the annotation object.


iParamIndex Parameter For AnnGetHyperlinkParam
iParamIndex

Index value indicating the parameter to get.  Valid values are 1, 2, 3, 4, 5.


Return for AnnGetHyperlinkParam
Return Value

Return	Meaning

>0	Value of the first parameter.

< 0	An error occurred. Refer to Error Codes.


AnnGetHyperlinkString method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BSTR AnnGetHyperlinkString (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotation Hyperlinks.

Remarks

(Document/Medical only) Returns the string containing the program name or the web page address, for an annotation object with a hyperlink of type ANNLINK_RUN or ANNLINK_WEBPAGE.

See Also

Elements	AnnSetHyperlinkString method, AnnGetHyperlinkType method

Topics	Annotations (Document/Medical only): Annotation Hyperlinks


hObject Parameter For AnnGetHyperlinkString
hObject

Handle to the annotation object.


Return for AnnGetHyperlinkString
Return Value

Return	Meaning

If the hyperlink type for hObject is ANNLINK_RUN or ANNLINK_WEBPAGE, then this method will return a string containing a program name or a Web page address.  Otherwise it will return a NULL string.


AnnGetHyperlinkType method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnGetHyperlinkType (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotation Hyperlinks.

Remarks

(Document/Medical only) Returns the hyperlink type for a given object.

See Also

Elements	AnnHyperlink event, AnnSetHyperlinkMsg method, AnnSetHyperlinkString method

Topics	Annotations (Document/Medical only): Annotation Hyperlinks


hObject Parameter For AnnGetHyperlinkType
hObject

Handle to the annotation object.


Return for AnnGetHyperlinkType
Return Value

Return	Meaning

ANNLINK_NONE 	(0) means that the object has no hyperlink

ANNLINK_ANNEVENT	(1) means that AnnHyperlink event will be sent with no parameters

ANNLINK_ANNEVENT5	(2) means that AnnHyperlink event will be sent with 2 parameters

ANNLINK_RUN	(3) that a program will be run

ANNLINK_WEBPAGE	(4) that the default browser will be instructed to go to the specified web page.


AnnGetLineStyle method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnGetLineStyle(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the line style of the specified annotation object.

Note:	Windows displays all lines greater than 1 pixel as solid.

To see the possible line styles, refer to Illustration of Line Styles for Annotations.

See Also

Elements	AnnSetLineWidth method, AnnGetLineWidth method, AnnSetLineStyle method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetLineStyle
hObject

Handle to the annotation object.


Return for AnnGetLineStyle
Return Value

The annotation object's current line style. Possible line style values are:

Value	Meaning

ANNLINE_SOLID	[0] Solid line

ANNLINE_DASH	[1] Dashed line

ANNLINE_DOT	[2] Dotted line

ANNLINE_DASHDOT	[3] Dash dot line

ANNLINE_DASHDOTDOT	[4] Dash dot dot line

ANNLINE_NULL	[5] No line


AnnGetLineWidth method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetLineWidth(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the current unscaled value of the line width of the specified annotation object.

The line width is scaled using an average of the horizontal and vertical scaling factors of the container object. For more information, refer to Low-Level Coordinate System for Annotations.

See Also

Elements	AnnSetLineWidth method, AnnSetLineStyle method, AnnGetLineStyle method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetLineWidth
hObject

Handle to the annotation object.


Return for AnnGetLineWidth
Return Value

The annotation object's current line width.


AnnGetLocked method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AnnGetLocked (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotation Security.

Remarks

(Document/Medical only) Returns TRUE if the object is locked, FALSE if it is unlocked.

See Also

Elements	AnnLock method, AnnUnlock method, AnnShowLockedIcon property

Topics	Annotations (Document/Medical only): Annotation Security


hObject Parameter For AnnGetLocked
hObject

Handle to the annotation object.


Return for AnnGetLocked
Return Value

Return	Meaning

TRUE	Object is locked.

FALSE	Object is not locked.


AnnGetMetafile method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnGetMetafile(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Retrieves the metafile handle associated with a stamp object, hotspot object, or freehand hotspot object.

See Also

Elements	AnnSetMetafile method, AnnSetPredefinedMetafile method, AnnGetPredefinedMetafile method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetMetafile
hObject

Handle to the annotation object.


Return for AnnGetMetafile
Return Value

Return	Meaning

! NULL	Handle to a metafile.

NULL	An error occurred. Refer to Error Codes.


AnnGetNameOffsetX method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long AnnGetNameOffsetX (OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Document/Medical only) Gets the X-coordinate of the name offset of the specified annotation object.

The name offset of an annotation object is an offset that is relative to the upper left corner of the bounding box of the annotation.  The name offset coordinates are in pixels, where the image is viewed at 100%.  The name offset can be changed by:

1.	Calling the AnnSetNameOffsetX or AnnSetNameOffsetY methods

2.	Right-clicking the object in design-mode, selecting Name Properties, setting the NameOffset using the text box, and clicking "Apply.

3.	Clicking on the object name in design-mode and dragging it to a new location

When an object is created in automation mode, the newly created object will have the same name restrictions that the automation object had. That is, if the name of the automation object is restricted, the name of the newly created object is restricted. If the name of the automation object was not restricted, then the name of the newly created object will not be restricted.

See Also

Elements	AnnSetName method, AnnGetName method, AnnGetNameRestrict method, AnnSetNameRestrict method, AnnGetNameOffsetY method, AnnSetNameOffsetX method, AnnSetNameOffsetY method

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnGetNameOffsetX
hObject

Handle to the annotation object.


Return for AnnGetNameOffsetX
Return Value

X-offset of the name of the annotation object specified in hObject.


AnnGetNameOffsetY method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long AnnGetNameOffsetY (OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Document/Medical only) Gets the Y-coordinate of the name offset of the specified annotation object.

The name offset of an annotation object is an offset that is relative to the upper left corner of the bounding box of the annotation.  The name offset coordinates are in pixels, where the image is viewed at 100%.  The name offset can be changed by:

1.	Calling the AnnSetNameOffsetX or AnnSetNameOffsetY methods.

2.	Right-clicking the object in design-mode, selecting Name Properties, setting the NameOffset using the text box, and clicking "Apply.

3.	Clicking on the object name in design-mode and dragging it to a new location.

When an object is created in automation mode, the newly created object will have the same name restrictions that the automation object had. That is, if the name of the automation object is restricted, the name of the newly created object is restricted. If the name of the automation object was not restricted, then the name of the newly created object will not be restricted.

See Also

Elements	AnnSetName method, AnnGetName method, AnnGetNameRestrict method, AnnSetNameRestrict method, AnnGetNameOffsetX method, AnnSetNameOffsetX method, AnnSetNameOffsetY method

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnGetNameOffsetY
hObject

Handle to the annotation object.


Return for AnnGetNameOffsetY
Return Value

Y- offset of the name of the annotation object specified in hObject.


AnnGetNameRestrict method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnnGetNameRestrict (OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Document/Medical only) Gets a value that indicates whether the name of the specified annotation object is restricted. If the name of an annotation object is restricted, the name will fully appear on the bitmap. If the name is not restricted, part of the name may appear on the bitmap while other parts do not.

For example, if the name of an annotation object has been restricted by calling the AnnSetNameRestrict method with the bNameRestrict parameter set to TRUE, the name offset cannot be set so that the object name is outside the bitmap (annotation container). The name offset is set by calling the AnnSetNameOffsetX method and the AnnSetNameOffsetY method. To determine the current offset, call the AnnGetNameOffsetX method and the AnnGetNameOffsetY method.

For example, consider a 200 x 200 bitmap that has a 100 x 100 button in the lower right corner and the name of the button is "Button". Attempting to set the name offset to anything larger than (43,100) will result in the name offset being set to (43,100) anyway.  In addition, dragging the annotation object itself in such a way that would cause the object name to be moved outside the bitmap will cause the name offset to change.

The restriction on an object name can be changed by:

1.	Calling the AnnSetNameRestrict method.

2.	Right-clicking the object in design-mode, selecting Name Properties, setting the NameRestrict check box, and clicking "Apply".

When an object is created in automation mode, the newly created object will have the same name restrictions that the automation object had. That is, if the name of the automation object is restricted, the name of the newly created object is restricted. If the name of the automation object was not restricted, then the name of the newly created object will not be restricted.

See Also

Elements	AnnSetName method, AnnGetName method, AnnSetNameRestrict method, AnnGetNameOffsetX method, AnnGetNameOffsetY method, AnnSetNameOffsetX method, AnnSetNameOffsetY method

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnGetNameRestrict
hObject

Handle to the annotation object.


Return for AnnGetNameRestrict
Return Value

Return	Meaning

TRUE	The name of the specified annotation object is restricted.

FALSE	The name of the specified annotation object is not restricted.


AnnGetName method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR AnnGetName(OLE_HANDLE hObject, BOOL * bShowName);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the name of the specified object.

When you create an object in the automation mode, the value for bShowName is taken from the automation object. The name of the object is also taken from the automation object, specifically from the ANNAUTOTEXT_ITEM_DEFAULTNAME item. This is just like the annotation text, which is by default "AaBbYyZz" and is taken from ANNAUTOTEXT_ITEM_DEFAULTTEXT item.

The default name is "", which means that the objects will not show a name when you create them. To set a default name, call AnnSetAutoText method with iItem set to ANNAUTOTEXT_ITEM_DEFAULTNAME, and pszText set to your desired default string. For example:

LEAD1.AnnSetAutoText ANNAUTOTEXT_ITEM_DEFAULTNAME, "Default_name"

See Also

Elements	AnnSetName method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetName
hObject

Handle to the annotation object.


bShowName Parameter For AnnGetName
bShowName

Address of the Boolean variable to be updated with a value that indicates whether the annotation object is shown. Pass NULL if you do not wish to retrieve this information.

In C++, declare the variable and pass its address. In most other languages, pass the variable by reference.


Return for AnnGetName
Return Value

A character string containing the name of the annotation.


AnnGetNodes method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnGetNodes(OLE_HANDLE hObject, BOOL * bShowNodes);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets information on how to display the nodes of the annotation object in design mode.

This method is valid for the following annotation objects:

Freehand

Polygon

Polyline

See Also

Elements	AnnSetNodes method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetNodes
hObject

Handle to the annotation object.


bShowNodes Parameter For AnnGetNodes
bShowNodes

Address of the Boolean variable to be updated with a value that indicates whether to show the nodes. NULL if you do not wish to retrieve this information.

In C++, declare the variable and pass its address. In most other languages, pass the variable by reference.


Return for AnnGetNodes
Return Value

A value that indicates the distance between nodes

This value does not represent the distance in pixels. Instead, it refers to the number of nodes to skip before displaying another node. Possible values are:

Value	Meaning

0	Show every node.

1	Show a node, skip a node, show a node …

.

.

.

.

9	Show a node, skip the next nine, …


AnnGetObjectFromTag method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnGetObjectFromTag (OLE_HANDLE hObject, long lTag, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Returns a handle to the object that has the specified tag.

For more information on getting and setting tags, refer to AnnGetTag method and AnnSetTag method.

See Also

Elements	AnnGetTag method, AnnSetTag method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetObjectFromTag
hObject

Handle to a container object.


lTag Parameter For AnnGetObjectFromTag
lTag

The long value used as the object's tag.


bSelected Parameter For AnnGetObjectFromTag
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnGetObjectFromTag
Return Value

NULL	An object with the specified tag was not found.

! NULL	Handle to the annotation object that has the tag specified in lTag. If an object with the specified tag is not found, the method will return NULL.


AnnGetOffsetX method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetOffsetX(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the X offset of the annotation object. Typically, this value is used to match the root container's offset to the offset of the associated bitmap's display rectangle.

The offset values are applied after the scalar properties, which are set by the AnnSetScalarX and AnnSetScalarY methods. For more information, refer to Low-Level Coordinate System for Annotations.

See Also

Elements	AnnSetScalarX method, AnnSetScalarY method, AnnGetScalarX method, AnnGetScalarY method, AnnSetOffsetY method, AnnGetOffsetY method, AnnSetOffsetX method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnGetOffsetX
hObject

Handle to the annotation object.


Return for AnnGetOffsetX
Return Value

The annotation object's X offset.


AnnGetOffsetY method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetOffsetY(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the Y offset of the annotation object. Typically, this value is used to match the root container's offset to the offset of the associated bitmap's display rectangle.

The offset values are applied after the scalar properties, which are set by the AnnSetScalarX and AnnSetScalarY methods. For more information, refer to Low-Level Coordinate System for Annotations.

See Also

Elements	AnnSetScalarX method, AnnSetScalarY method, AnnGetScalarX method, AnnGetScalarY method, AnnSetOffsetX method, AnnSetOffsetY method, AnnGetOffsetX method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnGetOffsetY
hObject

Handle to the annotation object.


Return for AnnGetOffsetY
Return Value

The annotation object's Y offset.


AnnGetPointCount method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long AnnGetPointCount (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Returns the number of vertices (corner points) in an annotation object.

AnnGetPointCount works only with the following types of objects:

ANNOBJECT_POINTER
ANNOBJECT_FREEHAND
ANNOBJECT_LINE
ANNOBJECT_POLYGON
ANNOBJECT_POLYLINE

You can use the AnnGetType method to identify the object type.

See Also

Elements	AnnGetPointX method, AnnGetPointY method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnGetPointCount
hObject

Handle to the annotation object.


Return for AnnGetPointCount
Return Value

The number of vertices (corner points) in the annotation object.


AnnGetPointX method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	VARIANT AnnGetPointX (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Returns an array of floating-point numbers for the X coordinates of the vertices (corner points) of the specified annotation object. You can use this method with the AnnGetPointY method to get the vertices of the object. The points that define the vertices are relative to the bitmap in the control. The unit of measure is determined by the ScaleMode property.

AnnGetPointX works only with the following types of objects:

ANNOBJECT_POINTER
ANNOBJECT_FREEHAND
ANNOBJECT_LINE
ANNOBJECT_POLYGON
ANNOBJECT_POLYLINE

You can use the AnnGetType method to identify the object type. You can use the AnnGetPointCount method to find out how many vertices are in the object.

See Also

Elements	AnnGetPointCount method, AnnGetPointY method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnGetPointX
hObject

Handle to the annotation object.


Return for AnnGetPointX
Return Value

Array of floating-point numbers for the X coordinates of the vertices (corner points) of the specified annotation object.


AnnGetPointY method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	VARIANT AnnGetPointY (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Returns an array of floating-point numbers for the Y coordinates of the vertices (corner points) of the specified annotation object. You can use this method with the AnnGetPointX method to get the vertices of the object. The points that define the vertices are relative to the bitmap in the control. The unit of measure is determined by the ScaleMode property.

AnnGetPointX works only with the following types of objects:

ANNOBJECT_POINTER
ANNOBJECT_FREEHAND
ANNOBJECT_LINE
ANNOBJECT_POLYGON
ANNOBJECT_POLYLINE

You can use the AnnGetType method to identify the object type. You can use the AnnGetPointCount method to find out how many vertices are in the object.

See Also

Elements	AnnGetPointCount method, AnnGetPointX method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnGetPointY
hObject

Handle to the annotation object.


Return for AnnGetPointY
Return Value

Array of floating-point numbers for the Y coordinates of the vertices (corner points) of the specified annotation object.


AnnGetPolyFillMode method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnGetPolyFillMode(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets a value that indicates how a polygonal annotation with crossing lines is filled.

See Also

Elements	AnnSetFillPattern method, AnnGetFillPattern method, AnnSetFillMode method, AnnGetFillMode method, AnnSetPolyFillMode method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetPolyFillMode
hObject

Handle to the annotation object.


Return for AnnGetOffsetY
Return Value

Value of the polygonal fill-mode constant. Possible fill mode values are:

Value	Meaning

ANNPOLYFILL_WINDING	[0] All pixels that are inside the resulting exterior lines are filled.

ANNPOLYFILL_ALTERNATE	[1] The filled area includes the area between odd-numbered and even-numbered polygon sides on each scan line.


AnnGetPredefinedMetafile method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnGetPredefinedMetafile(short nType , BOOL * bEnhanced);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Retrieves a copy of the specified predefined metafile.

When the metafile handle is no longer needed, it must be freed using either DeleteMetaFile or DeleteEnhMetaFile Windows API functions.

See Also

Elements	AnnSetPredefinedMetafile method, AnnGetMetafile method, AnnSetMetafile method

Topics	Annotations (Document/Medical only): Object Manipulation


nType Parameter For AnnGetPredefinedMetafile
nType

Constant that indicates the metafile to retrieve. Possible values are:

Value	Meaning

ANNMETAFILE_APPROVED	[0] Predefined metafile - APPROVED

ANNMETAFILE_ASSIGNED	[1] Predefined metafile - ASSIGNED

ANNMETAFILE_CHECKED	[2] Predefined metafile -CHECKED

ANNMETAFILE_CLATPRV	[3] Predefined metafile - CLIENT ATTORNEY PRIVILEGE

ANNMETAFILE_COPY	[4] Predefined metafile - COPY

ANNMETAFILE_DRAFT	[5] Predefined metafile - DRAFT

ANNMETAFILE_EXTENDED	[6] Predefined metafile - EXTENDED

ANNMETAFILE_FAX	[7] Predefined metafile - FAX

ANNMETAFILE_FAXED	[8] Predefined metafile - FAXED

ANNMETAFILE_IMPORTANT	[9] Predefined metafile - IMPORTANT

ANNMETAFILE_INVOICE	[10] Predefined metafile - INVOICE

ANNMETAFILE_NOTICE	[11] Predefined metafile - NOTICE

ANNMETAFILE_OFFICIAL	[12] Predefined metafile - OFFICIAL

ANNMETAFILE_ONFILE	[13] Predefined metafile - ON FILE

ANNMETAFILE_PAID	[14] Predefined metafile - PAID

ANNMETAFILE_PASSED	[15] Predefined metafile - PASSED

ANNMETAFILE_PENDING	[16] Predefined metafile - PENDING

ANNMETAFILE_PROCESSED	[17] Predefined metafile - PROCESSED

ANNMETAFILE_RECEIVED	[18] Predefined metafile - RECEIVED

ANNMETAFILE_REJECTED	[19] Predefined metafile - REJECTED

ANNMETAFILE_RELEASE	[20] Predefined metafile - RELEASE

ANNMETAFILE_SENT	[21] Predefined metafile - SENT

ANNMETAFILE_SHIPPED	[22] Predefined metafile - SHIPPED

ANNMETAFILE_TOPSECRET	[23] Predefined metafile - TOP SECRET

ANNMETAFILE_URGENT	[24] Predefined metafile - URGENT

ANNMETAFILE_VOID	[25] Predefined metafile – VOID

ANNMETAFILE_HOTSPOT	[26] Predefined metafile for Hotspot and Freehand


bEnhanced Parameter For AnnGetPredefinedMetafile
bEnhanced

Address of the Boolean variable to be updated with a flag that indicates whether the retrieved metafile is enhanced or not. Possible values are:

Value	Meaning

TRUE	The retrieved metafile is an enhanced metafile.

FALSE	The retrieved metafile is a windows metafile.

In C++, declare the variable and pass its address. In most other languages, pass the variable by reference.


Return for AnnGetPredefinedMetafile
Return Value

Return	Meaning

! NULL	Handle to the retrieved metafile.

NULL	An error occurred. Refer to Error Codes.


AnnGetProtractorOptions method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR AnnGetProtractorOptions(OLE_HANDLE hObject, BOOL * bAcute, short * nUnit, short * nPrecision, float * ArcRadius);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the options for the specified Protractor object.

See Also

Elements	AnnSetProtractorOptions method, AnnGetAngle method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetProtractorOptions
hObject

Handle to the annotation object.


bAcute Parameter For AnnGetProtractorOptions
bAcute

Address of the Boolean variable to be updated with a value that indicates whether the angle is acute or obtuse. Pass NULL if you do not wish to retrieve this information.


nUnit Parameter For AnnGetProtractorOptions
nUnit

Address of the short integer variable to be updated with a value that indicates whether the units of the angle are degrees or radians. Pass NULL if you do not wish to retrieve this information.


nPrecision Parameter For AnnGetProtractorOptions
nPrecision

Address of the short integer variable to be updated with the number of digits after the decimal. ( "." )


ArcRadius Parameter For AnnGetProtractorOptions
ArcRadius

Address of the float variable to be updated with the length of the arc radius.

In C++, declare the variable and pass its address. In most other languages, pass the variable by reference.


Return for AnnGetProtractorOptions
Return Value

A character string containing the abbreviation string that follows the angle.


AnnGetRgnHandle method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnGetRgnHandle(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Creates a region from the specified annotation object and retrieves a handle to that region.

Regions can be created from the following annotation objects:

ANNOBJECT_FREEHAND
ANNOBJECT_POLYLINE
ANNOBJECT_POLYGON
ANNOBJECT_RECT
ANNOBJECT_ELLIPSE
ANNOBJECT_FREEHANDHOTSPOT
ANNOBJECT_HOTSPOT
ANNOBJECT_STAMP
ANNOBJECT_NOTE
ANNOBJECT_TEXT
ANNOBJECT_HILITE
ANNOBJECT_BUTTON
ANNOBJECT_REDACT

See Also

Elements	AnnGetArea method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetRgnHandle
hObject

Handle to the annotation object from which the region will be created.


Return for AnnGetRgnHandle
Return Value

Return	Meaning

! NULL	Handle to the region.

NULL	An error occurred. Refer to Error Codes.


AnnGetROP2 method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnGetROP2(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the ROP code of one or more annotation objects.

See Also

Elements	AnnSetROP2 method, AnnGetFillMode method, AnnSetFillMode method, AnnGetTransparent method, AnnSetTransparent method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetROP2
hObject

Handle to the annotation object.


Return for AnnGetROP2
Return Value

ROP code. Possible ROP code values are:

Value	Meaning

ANNROP2_COPY	[0x0000] Draw the object using the object's color.

ANNROP2_AND	[0x0001] Draw the object, performing an AND between the object's color and the background color. This creates a highlight effect. White objects become transparent.

ANNROP2_XOR	[0x0002] Draw the object, performing an XOR between the object's color and the background color. This creates an inverted effect. Black objects become transparent.


AnnGetScalarX method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetScalarX(OLE_HANDLE hContainer);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the horizontal scaling factor that is applied to the annotation object. Typically, the scaling factors are applied to a root container so that the annotations will match the displayed image.

Offset values, which are set by the AnnSetOffsetX and AnnSetOffsetY methods, are applied after the scalar properties. For more information, refer to Low-Level Coordinate System for Annotations.

See Also

Elements	AnnSetScalarX method, AnnSetScalarY method, AnnGetScalarY method, AnnSetOffsetX method, AnnSetOffsetY method, AnnGetOffsetY method, AnnGetOffsetX method

Topics	Annotations (Document/Medical only): Automation


hContainer Parameter For AnnGetScalarX
hContainer

Handle to the annotation object.


Return for AnnGetScalarX
Return Value

Horizontal scaling factor.


AnnGetScalarY method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnGetScalarY(OLE_HANDLE hContainer);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the vertical scaling factor that is applied to the annotation object. Typically, the scaling factors are applied to a root container so that the annotations will match the displayed image.

Offset values, which are set by the AnnSetOffsetX and AnnSetOffsetY methods, are applied after the scalar properties. For more information, refer to Low-Level Coordinate System for Annotations.

See Also

Elements	AnnSetScalarX method, AnnSetScalarY method, AnnGetScalarX method, AnnSetOffsetX method, AnnSetOffsetY method, AnnGetOffsetY method, AnnGetOffsetX method

Topics	Annotations (Document/Medical only): Automation


hContainer Parameter For AnnGetScalarY
hContainer

Handle to the annotation object.


Return for AnnGetScalarY
Return Value

Vertical scaling factor.


AnnGetSecondaryBitmap method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnGetSecondaryBitmap(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Retrieves the secondary bitmap of the specified object.

Only PushPin objects use a secondary bitmap.

A pushpin object has a primary bitmap, (manipulated using AnnSetBitmap /AnnGetBitmap) when the text is shown, and a secondary bitmap, changed using AnnSetSecondaryBitmap method. The primary bitmap is shown with the note text. The secondary bitmap is shown by itself when the note is minimized.

In design mode, the PushPin object shows the text and displays the primary bitmap. In run mode, the object shows/hides the text when clicked. The pushpin object has the active mode property. When the mode is ANNACTIVE_ENABLED, the text is shown and the primary bitmap is painted in the top-left corner of the note.

When the mode is ANNACTIVE_DISABLED, the text is hidden and the secondary bitmap is displayed.

See Also

Elements	AnnSetSecondaryBitmap method

Topics	Annotations (Document/Medical only): Bitmap


hObject Parameter For AnnGetSecondaryBitmap
hObject

Handle to the annotation object.


Return for AnnGetSecondaryBitmap
Return Value

Return	Meaning

! NULL	Bitmap handle to the secondary bitmap.

NULL	An error occurred. Refer to Error Codes.


AnnGetSelectCount method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnGetSelectCount ();

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Returns the number of currently selected annotation objects.

See Also

Elements	AnnGetSelectList method, AnnSelect event

Topics	Annotations (Document/Medical only): Automation


Return for AnnGetSelectCount
Return Value

The number of currently selected annotation objects.


AnnGetSelected method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnnGetSelected(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets a value that indicates whether the specified annotation object is selected.

The AnnSet... methods can be used to set the properties of all objects that have the selected property set to TRUE.

See Also

Elements	AnnSelectRect method, AnnSelectRectLeft property, AnnSelectRectTop property, AnnGetType method, AnnHitTest method, AnnSelectRectWidth property, AnnSelectRectHeight property, AnnShowLockedIcon property, AnnSelectPoint method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetSelected
hObject

Handle to the annotation object.


Return for AnnGetSelected
Return Value

Value indicating whether the annotation object is selected. Possible values are:

Value	Meaning

TRUE	The object is selected.

FALSE	The object is not selected.


AnnGetSelectList method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	VARIANT AnnGetSelectList ();

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Returns an array of object handles for the currently selected annotation objects.

You can use the AnnGetSelectCount method to see how many handles will be in the array.

See Also

Elements	AnnGetSelectCount method, AnnSelect event

Topics	Annotations (Document/Medical only): Automation


Return for AnnGetSelectList
Return Value

An array of object handles for the currently selected annotation objects. If no objects are selected, this is an Empty VARIANT.


AnnGetShowFlags method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnGetShowFlags(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets a value that indicates how the rulers, cross-products, and protractors will be displayed.

This method can only be used for Ruler, Cross-Product, Protractor and Automation objects.

See Also

Elements	AnnSetShowFlags method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetShowFlags
hObject

Handle to the annotation object.


Return for AnnGetShowFlags
Return Value

Value that indicates how the rulers, cross-products, and protractors will be shown. Possible values are:

Value	Meaning

ANNSHOW_NONE	Do not display the ruler length or the ruler gauge. In this case, the ruler looks like a line.

ANNSHOW_LENGTH	Display the ruler length.

ANNSHOW_GAUGE	Display the ruler gauge.


AnnGetTag method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long AnnGetTag (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Returns the numeric tag that you assigned to the specified annotation object using the AnnSetTag method.

You can use these two methods to keep track of particular objects such as buttons or hot spots over time.

When you load a file, an AnnCreate event is generated for each annotation object. You can add code in this event to see which tags are already used in a file.

See Also

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetTag
hObject

Handle to the annotation object.


Return for AnnGetTag
Return Value

Tag that identifies the particular object.


AnnGetText method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR AnnGetText(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the text (character string) of the specified annotation object.

Note:	The text of the ruler object (which can be retrieved through AnnGetText method is the length + unit abbrev. The distance is reset every time the object is changed.

See Also

Elements	AnnSetText method, AnnGetAutoText method, AnnSetAutoText method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetText
hObject

Handle to the annotation object.


Return for AnnGetText
Return Value

A character string containing the annotation object's character string.


AnnGetTopContainer method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnGetTopContainer(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the handle to the root container of the specified annotation object.

See Also

Elements	AnnInsert method, AnnRemove method, AnnGetContainer method, AnnEnumerate method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnGetTopContainer
hObject

Handle to the annotation object.


Return for AnnGetTopContainer
Return Value

Return	Meaning

! NULL	Handle to the root container.

NULL	An error occurred. Refer to Error Codes.


AnnGetTransparent method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnnGetTransparent(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets a value indicating whether the bitmap stamp is transparent.

Only bitmap stamps can be transparent.

See Also

Elements	AnnSetTransparent method, AnnGetROP2 method, AnnSetROP2 method

Topics	Annotations (Document/Medical only): Bitmap


hObject Parameter For AnnGetTransparent
hObject

Handle to the annotation object


Return for AnnGetTransparent
Return Value

Value indicating whether the bitmap stamp is transparent. Possible values are:

Value	Meaning

TRUE	The bitmap stamp is transparent.

FALSE	The bitmap stamp is not transparent.


AnnGetTransparentColor method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR AnnGetTransparentColor(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Retrieves the transparent color set by AnnSetTransparentColor.

The standard Windows values for COLORREF (OLE_COLOR) represent either red, green, and blue color values, or an index into the bitmap's palette.  A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value.  If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette which holds the color value.  These COLORREF values can be used with any Windows function and macro that takes a COLORREF parameter.

In the Document/Medical editions, the COLORREF value may represent a 16 bit grayscale value if pBitmap is a 12 or 16-bit grayscale bitmap.  So that the value is not confused with an RGB value, the COLORREF_GRAY16 mask (0x04000000) is set.  In this case (0x0400YYYY), the lower 16 bits (0xYYYY) of the COLORREF value represent the 16-bit grayscale value. (0x0400FFFF is 16-bit white and 0x04000000is 16-bit black.) This is not a standard Windows value.  Therefore, LEADTOOLS functionality will recognize a COLORREF having this format, but Windows functions will not. For information on how to use a 16-bit grayscale COLORREF in a non-LEADTOOLS functionality, refer to Converting 16-bit Grayscale Values.

See Also

Elements	AnnSetTransparentColor method, AnnSetTransparent method

Topics	Annotations (Document/Medical only): Bitmap


hObject Parameter For AnnGetTransparentColor
hObject

Handle to the annotation object.


Return for AnnGetTransparentColor
Return Value

COLORREF value of the transparent color.


AnnGetType method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnGetType (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Returns a value that identifies the type of annotation object.

The following are the possible values:

Value	Meaning

ANNOBJECT_CONTAINER	Container object

ANNOBJECT_LINE	Line

ANNOBJECT_RECT	Rectangle

ANNOBJECT_ELLIPSE	Ellipse

ANNOBJECT_POLYLINE	Polyline

ANNOBJECT_POLYGON	Polygon

ANNOBJECT_POINTER	Pointer

ANNOBJECT_FREEHAND	Freehand Line

ANNOBJECT_HILITE	Highlight

ANNOBJECT_REDACT	Redaction

ANNOBJECT_TEXT	Text

ANNOBJECT_NOTE	Note

ANNOBJECT_STAMP	Stamp

ANNOBJECT_HOTSPOT	Hot spot

ANNOBJECT_BUTTON	Button

ANNOBJECT_AUDIO	Audio Clip

ANNOBJECT_RULER	Ruler Tool

ANNOBJECT_CROSSPRODUCT	Cross product Tool

ANNOBJECT_POINT	Point Tool

ANNOBJECT_PROTRACTOR	Protractor Tool

ANNOBJECT_VIDEO	Video Tool

ANNOBJECT_PUSHPIN	PushPin Tool

ANNOBJECT_FREEHANDHOTSPOT	Freehand Hot Spot Tool

See Also

Elements	AnnTool property

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnGetType
hObject

Handle to the annotation object.


Return for AnnGetType
Return Value

One of the following constants:

ANNOBJECT_CONTAINER for the container object
ANNOBJECT_LINE for a line
ANNOBJECT_RECT for a rectangle
ANNOBJECT_ELLIPSE for an ellipse
ANNOBJECT_POLYLINE for a polyline
ANNOBJECT_POLYGON for a polygon
ANNOBJECT_POINTER for a pointer
ANNOBJECT_FREEHAND for a freehand line
ANNOBJECT_HILITE for a highlight
ANNOBJECT_REDACT for a redaction object
ANNOBJECT_TEXT for a text object
ANNOBJECT_NOTE for a note
ANNOBJECT_STAMP for a stamp
ANNOBJECT_BUTTON for a button
ANNOBJECT_HOTSPOT for a hot spot
ANNOBJECT_AUDIO for an audio clip
ANNOBJECT_RULER for a ruler
ANNOBJECT_CROSSPRODUCT for a cross-product
ANNOBJECT_POINT for a point
ANNOBJECT_PROTRACTOR for a protractor
ANNOBJECT_VIDEO for a video clip
ANNOBJECT_PUSHPIN for a pushpin
ANNOBJECT_FREEHANDHOTSPOT for a freehand hotspot


AnnGetUnit method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR AnnGetUnit(OLE_HANDLE hObject, short * nUnit, short * nPrecision);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the current unit of measurement values set by AnnSetUnit method

See Also

Elements	AnnSetGaugeLength method, AnnSetBitmapDpiX method, AnnGetBitmapDpiX method, AnnGetBitmapDpiY method, AnnSetBitmapDpiY method, AnnSetUnit method, AnnGetDistance method, AnnGetGaugeLength method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetUnit
hObject

Handle to the annotation automation object.


nUnit Parameter For AnnGetUnit
nUnit

Address of the short integer variable to be updated with the object's unit of measurement.  Possible values are:

Value	Meaning

ANNUNIT_INCHES	[0x0000] inches

ANNUNIT_FEET	[0x0001] feet

ANNUNIT_YARDS	[0x0002] yards

ANNUNIT_MICROMETERS	[0x0003] micrometers

ANNUNIT_MILIMETERS	[0x0004] millimeters

ANNUNIT_CENTIMETERS	[0x0005] centimeters

ANNUNIT_METERS	[0x0006] meters

ANNUNIT_TWIPS	[0x0007] twips

ANNUNIT_POINTS	[0x0008] points

ANNUNIT_PIXELS	[0x0009] pixels

In C++, declare the variable and pass its address. In most other languages, pass the variable by reference.


nPrecision Parameter For AnnGetUnit
nPrecision

Address of the short integer variable to be updated with the number of digits to be displayed after the decimal place.

In C++, declare the variable and pass its address. In most other languages, pass the variable by reference.


Return for AnnGetUnit
Return Value

A character string containing the unit abbreviation string to be displayed after the distance.


AnnGetVisible method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnnGetVisible (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Returns a value that indicates whether the specified object is visible.

See Also

Elements	AnnCreate method, AnnDefine, AnnDestroy method, AnnInsert method, AnnSetAutoDefaults method, AnnSetSelected method, AnnSetVisible method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGetVisible
hObject

Handle to an annotation object.


Return for AnnGetVisible
Return Value

Return	Meaning

TRUE	The specified object is visible.

FALSE	The specified object is not visible.


AnnGetWnd method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE AnnGetWnd(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the window handle to the specified annotation object.

See Also

Elements	AnnSetWnd method

Topics	Annotations (Document/Medical only): Object Automation


hObject Parameter For AnnGetWnd
hObject

Handle to the annotation object.


Return for AnnGetWnd
Return Value

The annotation object's window handle.


AnnGroup method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnGroup (OLE_HANDLE hObject, short iFlags, BSTR pUserList);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Groups a number of objects within a container.

The Group automation menu item operates like AnnGroup(hObject, ANNFLAG_RECURSE|ANNFLAG_SELECTED|ANNFLAG_CHECKMENU, NULL).

If ANNFLAG_USER is included in iFlags, any user associated with an object to be "grouped" must be included in pUserList. The method checks pUserList before grouping the objects and any object that has a user not in pUserList will not be included in the group.

If ANNFLAG_USER is not included in iFlags, the user list is ignored.

Please note that if you include ANNFLAG_SELECTED|ANNFLAG_USER, for example, in iFlags, the grouped objects must have a user in pUserList AND must also be selected.

See Also

Elements	AnnUngroup method, AnnGetgrouping method, AnnSetGrouping method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnGroup
hObject

Handle to a container object.


iFlags Parameter For AnnGroup
iFlags

Flags that determine which objects to process. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR ( | ). The following are valid values:

Value	Meaning

0	Process only the specified object.

ANNFLAG_SELECTED	[0x0001] Process only objects that have the selected property set to TRUE. To get a list of selected objects, use the AnnGetSelectList method.

ANNFLAG_NOTTHIS	[0x0004] Process only one level of objects within the specified container, not the container itself. If there are containers within the container, they are modified, but the objects within them are not.

ANNFLAG_RECURSE	[0x0008] Process objects within a container, and within any subcontainers, down to any level.

ANNFLAG_NOTCONTAINER	[0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves.

ANNFLAG_NOINVALIDATE	[0x0010] Do not invalidate the affected rectangle in the window. Use this to avoid generating unwanted paint messages.

ANNFLAG_CHECKMENU	[0x0020] Process objects only if the ANNAUTOTEXT_MENU_GROUP menu item has been selected.

ANNFLAG_USER	[0x0040] Group only those objects with users listed in pUserList.


pUserList Parameter For AnnGroup
pUserList

String that contains the list of users associated with the specified object. pUserList has the form "User1,User2,…,UserN". This must be a NULL terminated string with user names separated by a comma. This parameter is valid only if ANNFLAG_USER is set in iFlags.


Return for AnnGroup
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnHitTest method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnHitTest(OLE_HANDLE hContainer, float x, float y, OLE_HANDLE * hObjectHit);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets the handle to the annotation object that is located at a specified point. If objects overlap, this method gets the front object.

See Also

Elements	AnnSelectRect method, AnnSelectRectLeft property, AnnSelectRectTop property, AnnSelectRectWidth property, AnnSelectRectHeight property, AnnSelectPoint method

Topics	Annotations (Document/Medical only): Automation


hContainer For AnnHitTest
hContainer

Handle to the container object that sets the scope of the search.


x Parameter For AnnHitTest
x

X-coordinate of the point to test. The unit of measure is determined by the ScaleMode property.


y Parameter For AnnHitTest
y

Y-coordinate of the point to test. The unit of measure is determined by the ScaleMode property.


hObjectHit Parameter For AnnHitTest
hObjectHit

Address of the OLE_HANDLE variable to be updated with the handle to the annotation object that is found at the specified point.

In C++, declare the variable and pass its address. In most other languages, pass the variable by reference.


Return for AnnHitTest
Return Value

The position on the annotation object that was found at the specified point. The following are possible values:

Point	Meaning

[0]	ANNHIT_NONE

[1]	ANNHIT_BODY

[2]	ANNHIT_HANDLE

[3]	ANNHIT_NAME


AnnHyperlink event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AnnHyperlink (OLE_HANDLE hObject, short iParamCount, long lParam1, long lParam2, long lParam3, long lParam4, long lParam5);

Overview	Refer to Implementing Annotation Hyperlinks.

Remarks

(Document/Medical only) This event occurs when AnnUserMode property is set to ANNUSERMODE_RUN and an object with an ANNLINK_EVENT or ANNLINK_EVENT5 hyperlink type is clicked.

See Also

Elements	AnnHyperlinkMenuEnable property, AnnGetHyperlinkType method, AnnUserMode property, AnnGetHyperlinkParam method

Topics	Annotations (Document/Medical only): Annotation Hyperlinks


hObject Parameter For AnnHyperlink
hObject

Handle to the annotation object.


iParamCount Parameter For AnnHyperlink
iParamCount

Number of valid parameters.  Possible values are 0 or 5.  If iParamCount is 5, then lParam1, lParam2, lParam3, lParam4 and lParam5 are valid, otherwise they are undefined and should be ignored.


lParam1 Parameter For AnnHyperlink
lParam1

First parameter.  This parameter is only valid if iParamCount is set to 5.


lParam2 Parameter For AnnHyperlink
lParam2

Second parameter.  This parameter is only valid if iParamCount is set to 5.


lParam3 Parameter For AnnHyperlink
lParam3

Third parameter.  This parameter is only valid if iParamCount is set to 5.


lParam4 Parameter For AnnHyperlink
lParam4

Fourth parameter.  This parameter is only valid if iParamCount is set to 5.


lParam5 Parameter For AnnHyperlink
lParam5

Fifth parameter.  This parameter is only valid if iParamCount is set to 5.


AnnHyperlinkMenu event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AnnHyperlinkMenu (VARIANT aObjects, short uCount);

Overview	Refer to Implementing Annotation Hyperlinks.

Remarks

(Document/Medical only) This event occurs whenever the user clicks on the Hyperlink menu item provided for automated annotations.  The menu item is enabled and disabled using AnnHyperlinkMenuEnable property.

See Also

Elements	AnnHyperlinkMenuEnable property

Topics	Annotations (Document/Medical only): Annotation Hyperlinks


aObjects Parameter For AnnHyperlinkMenu
aObjects

Pointer to an array of selected objects.


uCount Parameter For AnnHyperlinkMenu
uCount

Number of objects in aObjects.


AnnHyperlinkMenuEnable property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AnnHyperlinkMenuEnable

Overview	Refer to Implementing Annotation Hyperlinks.

Remarks

(Document/Medical only) (Persistent property, available at design time) Enables or disables a hyperlink menu item provided for automated annotations.  If AnnHyperlinkMenuEnable is TRUE, then the menu provided for automated annotations will contain an extra menu item when the right mouse button is clicked.  If the user clicks on the extra menu item, the AcviteX will send an AnnHyperlinkMenu event.

See Also

Elements	AnnHyperlinkMenu event, AnnHyperlink event

Topics	Annotations (Document/Medical only): Annotation Hyperlinks


AnnInfoFormat property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long AnnInfoFormat

Overview	Refer to Annotation Files.

Remarks

(Read only) This property is updated with the annotation file type. Possible values are:

Value	Meaning

ANNFMT_NATIVE	LEAD text-based format for annotations.

ANNFMT_WMF	Windows WMF format.

ANNFMT_ENCODED	LEAD binary format. This file size is smaller and is upward compatible. It also provides better security.

Use the AnnFileInfo method, the AnnFileInfoArray method or the AnnFileInfoMemory method to update this property.

See Also

Elements	AnnInfoVersion property, AnnInfoTotalPages property, AnnFileInfo method, AnnFileInfoArray method, AnnFileInfoMemory method, AnnLoadArray method, AnnLoadMemory method, AnnLoad method

Topics	Annotations (Document/Medical only): Input and Output


AnnInfoTotalPages property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long AnnInfoTotalPages

Overview	Refer to Annotation Files.

Remarks

(Read only) This property is updated with the total number of pages in the annotation file.

Use the AnnFileInfo method, the AnnFileInfoArray method or the AnnFileInfoMemory method to update this property.

See Also

Elements	AnnInfoVersion property, AnnInfoFormat property, AnnFileInfo method, AnnFileInfoArray method, AnnFileInfoMemory method, AnnLoadArray method, AnnLoadMemory method, AnnLoad method

Topics	Annotations (Document/Medical only): Input and Output


AnnInfoVersion property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long AnnInfoVersion

Overview	Refer to Annotation Files.

Remarks

(Read only) This property is updated with the version of the annotation file.  If ‘12’ is returned, this refers to version 12 or earlier (which could not be multi-page).  There is support for multi-page annotation files beginning with version 13.

Use the AnnFileInfo method, the AnnFileInfoArray method or the AnnFileInfoMemory method to update this property.

See Also

Elements	AnnInfoFormat property, AnnInfoTotalPages property, AnnFileInfo method, AnnFileInfoArray method, AnnFileInfoMemory method, AnnLoadArray method, AnnLoadMemory method, AnnLoad method

Topics	Annotations (Document/Medical only): Input and Output


AnnInsert method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnInsert (OLE_HANDLE hContainer, OLE_HANDLE hObject, BOOL bStripContainer);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Inserts the specified annotation object into the specified container.

If hObject is a single annotation object, set bStripContainer to FALSE. That way the object itself is inserted.

If hObject is a container, setting bStripContainer to TRUE will insert only the objects within the container, not the container itself.

If hObject is a container, setting bStripContainer to FALSE will insert the container and all objects within the container.

See Also

Elements	AnnCreate method, AnnDefine, AnnDestroy method, AnnGetVisible method, AnnSetAutoDefaults method, AnnSetSelected method, AnnSetVisible method

Topics	Annotations (Document/Medical only): Object Manipulation


hContainer Parameter For AnnInsert
hContainer

Handle to the container object.


hObject Parameter For AnnInsert
hObject

Handle to the annotation object to insert.


bStripContainer Parameter For AnnInsert
bStripContainer

Flag that indicates whether to insert a container. Possible values are:

Value	Meaning

TRUE	If the hObject parameter specifies a container, only the objects in the container will be inserted into the new container. In this case, the container specified in hObject is destroyed.

FALSE	If the hObject parameter specifies a container, the container and all objects within the container (objects and other containers ) will be inserted into the new container.
If the hObject parameter specifies an object, that object will be inserted into the new container.


Return for AnnInsert
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnLoad method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnLoad (BSTR pszFile, long lPage);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Loads the annotations from the designated file and page.

The argument pszFile can be either an annotation file (single page or multipage) or a TIF file (single or multipage).  In either case, the argument lPage refers to the page number.

The annotations are sized to fit their original size and position relative to the bitmap in the control. If the Main Control does not have a bitmap image, an error occurs.  AnnLoad will load annotations stored in LEAD files.  It will also load annotations stored in a Wang compatible TIFF tag in a TIF file.

See Also

Elements	AnnSave method

Topics	Annotations (Document/Medical only): Input and Output


pszFile Parameter For AnnLoad
pszFile

Character string containing the name of the file from which to load the annotations.


lPage Parameter For AnnLoad
lPage

Page number.  If pszFile is a multipage-TIF file, lPage refers to the page in the TIF file from which to load the annotations.  If pszFile is an annotation file, lPage refers to one of the pages in the annotation file.


Return for AnnLoad
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnLoadArray method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnLoadArray (VARIANT vMem, long iSize, long iPage);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Loads annotations from a file that is stored in memory.

The argument vMem can refer to either an annotation file (single page or multipage) or a TIF file (single or multipage).  In either case, the argument lPage refers to the page number.

The annotations are sized to fit their original size and position relative to the bitmap in the control. If the Main Control does not have a bitmap image, an error occurs.

This method operates like AnnLoadMemory, except it loads the data from a byte array variant instead of a memory handle.

See Also

Elements	AnnSaveArray method, AnnLoadMemory method, AnnSaveMemory method, AnnLoad method, AnnSave method

Topics	Annotations (Document/Medical only): Input and Output


vMem Parameter For AnnLoadArray
vMem

A byte array variant that contains the annotations to be loaded.


iSize Parameter For AnnLoadArray
iSize

Size of the data stored in vMem.


lPage Parameter For AnnLoadArray
lPage

Page number.  If vMem refers to a multipage-TIF file, lPage refers to the page in the TIF file from which to load the annotations.  If vMem refers to an annotation file, lPage refers to one of the pages in the annotation file.


Return for AnnLoadArray
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnLoadMemory method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnLoadMemory (OLE_HANDLE hMem, long iSize, long iPage);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Loads annotations from a file that is stored in memory.

The argument hMem can refer to either an annotation file (single page or multipage) or a TIF file (single or multipage).  In either case, the argument lPage refers to the page number.

The annotations are sized to fit their original size and position relative to the bitmap in the control. If the Main Control does not have a bitmap image, an error occurs.

See Also

Topics	Annotations (Document/Medical only): Input and Output


hMem Parameter For AnnLoadMemory
hMem

A global handle (HGLOBAL) to the file in memory. If you use the AnnSaveMemory method to create the file in memory, that method updates your handle and buffer size variables. Otherwise, your code must update and pass the appropriate variables.


iSize Parameter For AnnLoadMemory
iSize

The size in bytes of the file referenced by hMem. If you use the AnnSaveMemory method to create the file in memory, that method updates your handle and buffer size variables. Otherwise, your code must update and pass the appropriate variables.


IPage Parameter For AnnLoadMemory
lPage

Page number.  If hMem refers to a multipage-TIF file, lPage refers to the page in the TIF file from which to load the annotations.  If hMem refers to an annotation file, lPage refers to one of the pages in the annotation file.


Return for AnnLoadMemory
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnLock method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnLock (OLE_HANDLE hObject, BSTR pszKey, BOOL fSelected);

Overview	Refer to Implementing Annotation Security

Remarks

(Document/Medical only) Locks annotations with the specified key.  Annotations cannot be modified through the automated mode unless they are unlocked with the same key either using AnnUnlock method, or through the automated mode unlock menu item.  The key is case sensitive!  If the AnnShowLockedIcon property is TRUE, the locked objects are drawn with a padlock icon on top of them.  If a redact object is locked, AnnUnrealize method will fail on that object.

There is one property associated with this method.  The AnnShowLockedIcon property determines how locked objects are drawn.

See Also

Elements	AnnUnlock method, AnnUnrealize method, AnnShowLockedIcon property, AnnLocked event, AnnRealize method, AnnUnlocked event

Topics	Annotations (Document/Medical only): Annotation Security


hObject Parameter For AnnLock
hObject

Handle to the annotation object.


pszKey Parameter For AnnLock
pszKey

String containing the key used to lock the annotation objects.


fSelected Parameter For AnnLock
fSelected

If hObject is a container object, fSelected indicates whether all or only selected annotation objects will be locked.  If fSelected is TRUE, only selected annotation objects will be locked.  If fSelected is FALSE, all annotation objects will be locked.


Return for AnnLock
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnLocked event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AnnLocked (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotation Security.

Remarks

(Document/Medical only) This event occurs whenever the user locks an object.  The event will occur once for each object if a group of objects is locked.

See Also

Elements	AnnLock method, AnnUnlocked event, AnnUnlock method

Topics	Annotations (Document/Medical only): Annotation Security


hObject Parameter For AnnLocked
hObject

Handle to the annotation object.


AnnMenu event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void AnnMenu (IAnnMenu *AnnMenu);

Overview	Refer to Annotation Menu

Remarks

(Document/Medical only)  Occurs just before an annotation automation menu is displayed.

The AnnMenu parameter is an object that references the menu that will be displayed. You can use this AnnMenu object to modify the menu prior to displaying it.

The following properties and methods are associated with the AnnMenu object:

Count property

ItemString property

ItemID property

ItemType property

ItemChecked property

ItemEnabled property

DeleteItem method

AddItem method

GetSubMenu Method

See Also

Elements	Count property, ItemString property, ItemID property, ItemType property, ItemChecked property, ItemEnabled property, DeleteItem method, AddItem method, GetSubMenu Method, AnnUserMenu event

Topics	Annotations (Document/Medical only): Automation


AnnMenu Parameter For AnnMenu
AnnMenu

Pointer to an object the references the menu that will be displayed.


AnnMouseDown event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void AnnMouseDown (short Button, short Shift, long x, long y);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Occurs when the user presses a mouse button in design mode.

See Also

Elements	AnnMouseMove event, AnnMouseUp event

Topics	Annotations (Document/Medical only): Annotation Events


Button Parameter For AnnMouseDown
Button

An integer that identifies the button that was pressed to cause the event. Possible values are:

Value	Meaning

1	left button


Shift Parameter For AnnMouseDown
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. Possible values are:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


x Parameter For AnnMouseDown
x

The X coordinate of the mouse pointer. This is a client coordinate and it depends on the ScaleMode property. If scroll bars are present, they are not taken into consideration.


y Parameter For AnnMouseDown
y

The Y coordinate of the mouse pointer. This is a client coordinate and it depends on the ScaleMode property. If scroll bars are present, they are not taken into consideration.


AnnMouseMove event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void AnnMouseMove (short Button, short Shift, long x, long y);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Occurs when the user moves the mouse over the Main Control in design mode.

See Also

Elements	AnnMouseDown event, AnnMouseUp event

Topics	Annotations (Document/Medical only): Annotation Events


Button Parameter For AnnMouseMove
Button

An integer that identifies any buttons pressed when the user moved the mouse. Possible values are:

Value	Meaning

0	no button was pressed

1	left button

2	right button


Shift Parameter For AnnMouseMove
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. Possible values are:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


x Parameter For AnnMouseMove
x

The X coordinate of the mouse pointer. This is a client coordinate and it depends on the ScaleMode property. If scroll bars are present, they are not taken into consideration.


y Parameter For AnnMouseMove
y

The Y coordinate of the mouse pointer. This is a client coordinate and it depends on the ScaleMode property. If scroll bars are present, they are not taken into consideration.


AnnMouseUp event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void AnnMouseUp (short Button, short Shift, long x, long y);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Occurs when the user releases a mouse button in design mode.

See Also

Elements	AnnMouseMove event, AnnMouseDown event

Topics	Annotations (Document/Medical only): Annotation Events


Button Parameter For AnnMouseUp
Button

An integer that identifies the button that was released to cause the event. Possible values are:

Value	Meaning

1	left button


Shift Parameter For AnnMouseUp
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is released. Possible values are:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


x Parameter For AnnMouseUp
x

The X coordinate of the mouse pointer. This is a client coordinate and it depends on the ScaleMode property. If scroll bars are present, they are not taken into consideration.


y Parameter For AnnMouseUp
y

The Y coordinate of the mouse pointer. This is a client coordinate and it depends on the ScaleMode property. If scroll bars are present, they are not taken into consideration.


AnnMove method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnMove (float dxOffset, float dyOffset, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Moves annotation objects, using delta values that are relative to the bitmap.

The unit of measure is determined by the ScaleMode property. If you pass TRUE in the bSelected parameter, this method affects only the currently selected objects. Otherwise, it affects all objects.

See Also

Topics	Annotations (Document/Medical only): Object Manipulation


dxOffset Parameter For AnnMove
dxOffset

Amount to move the annotation objects horizontally (in the X direction).


dyOffset Parameter For AnnMove
dyOffset

Amount to move the annotation objects vertically (in the Y direction).


bSelected Parameter For AnnMove
bSelected

One of the following values:

TRUE	Move only the selected object or objects.

FALSE	Move all annotation objects.


Return for AnnMove
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnNameBoundingRectHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnNameBoundingRectHeight(OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Read only) (Document/Medical only) Gets the width of the bounding rectangle of the name of the specified annotation object. This is the rectangle in which the object name is displayed. The unit of measure is determined by the ScaleMode property.

The bounding rectangle is different from the defining rectangle as follows:

The defining rectangle intersects the outermost points that define the object. If a line is more than one pixel wide, its defining points are in the middle of the line. Refer to the AnnRectXXX properties.

The bounding rectangle accounts for line width and is used as the rectangle to be invalidated when displaying an object. If the line width is an even number, the bounding rectangle is enlarged slightly to allow for variations in how the center of the line is defined on different systems.

Half the width of an object's outer line is outside its defining rectangle, as shown in the following diagram:

See Also

Elements	AnnNameBoundingRectLeft property, AnnNameBoundingRectTop property, AnnNameBoundingRectWidth property, AnnNameRectLeft property, AnnNameRectTop property, AnnNameRectWidth property, AnnNameRectHeight property, AnnBoundingRectLeft property, AnnBoundingRectTop property, AnnBoundingRectWidth property, AnnBoundingRectHeight property, AnnRectLeft property, AnnRectTop property, AnnRectWidth property, AnnRectHeight property

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnNameBoundingRectHeight
hObject

Handle to the annotation object.


AnnNameBoundingRectLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnNameBoundingRectLeft(OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Read only) (Document/Medical only) Gets the left boundary of the bounding rectangle of the name of the specified annotation object. This is the rectangle in which the object name is displayed. The unit of measure is determined by the ScaleMode property.

The bounding rectangle is different from the defining rectangle as follows:

The defining rectangle intersects the outermost points that define the object. If a line is more than one pixel wide, its defining points are in the middle of the line. Refer to the AnnRectXXX properties.

The bounding rectangle accounts for line width and is used as the rectangle to be invalidated when displaying an object. If the line width is an even number, the bounding rectangle is enlarged slightly to allow for variations in how the center of the line is defined on different systems.

Half the width of an object's outer line is outside its defining rectangle, as shown in the following diagram:

See Also

Elements	AnnNameBoundingRectTop property, AnnNameBoundingRectWidth property, AnnNameBoundingRectHeight property, AnnNameRectLeft property, AnnNameRectTop property, AnnNameRectWidth property, AnnNameRectHeight property, AnnBoundingRectLeft property, AnnBoundingRectTop property, AnnBoundingRectWidth property, AnnBoundingRectHeight property, AnnRectLeft property, AnnRectTop property, AnnRectWidth property, AnnRectHeight property

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnNameBoundingRectLeft
hObject

Handle to the annotation object.


AnnNameBoundingRectTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnNameBoundingRectTop (OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Read only) (Document/Medical only) Gets the top boundary of the bounding rectangle of the name of the specified annotation object. This is the rectangle in which the object name is displayed. The unit of measure is determined by the ScaleMode property.

The bounding rectangle is different from the defining rectangle as follows:

The defining rectangle intersects the outermost points that define the object. If a line is more than one pixel wide, its defining points are in the middle of the line. Refer to the AnnRectXXX properties.

The bounding rectangle accounts for line width and is used as the rectangle to be invalidated when displaying an object. If the line width is an even number, the bounding rectangle is enlarged slightly to allow for variations in how the center of the line is defined on different systems.

Half the width of an object's outer line is outside its defining rectangle, as shown in the following diagram:

See Also

Elements	AnnNameBoundingRectLeft property, AnnNameBoundingRectWidth property, AnnNameBoundingRectHeight property, AnnNameRectLeft property, AnnNameRectTop property, AnnNameRectWidth property, AnnNameRectHeight property, AnnBoundingRectLeft property, AnnBoundingRectTop property, AnnBoundingRectWidth property, AnnBoundingRectHeight property, AnnRectLeft property, AnnRectTop property, AnnRectWidth property, AnnRectHeight property

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnNameBoundingRectTop
hObject

Handle to the annotation object.


AnnNameBoundingRectWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnNameBoundingRectWidth (OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Read only) (Document/Medical only) Gets the width of the bounding rectangle of the name of the specified annotation object. This is the rectangle in which the object name is displayed. The unit of measure is determined by the ScaleMode property.

The bounding rectangle is different from the defining rectangle as follows:

The defining rectangle intersects the outermost points that define the object. If a line is more than one pixel wide, its defining points are in the middle of the line. Refer to the AnnRectXXX properties.

The bounding rectangle accounts for line width and is used as the rectangle to be invalidated when displaying an object. If the line width is an even number, the bounding rectangle is enlarged slightly to allow for variations in how the center of the line is defined on different systems.

Half the width of an object's outer line is outside its defining rectangle, as shown in the following diagram:

See Also

Elements	AnnNameBoundingRectLeft property, AnnNameBoundingRectTop property, AnnNameBoundingRectHeight property, AnnNameRectLeft property, AnnNameRectTop property, AnnNameRectWidth property, AnnNameRectHeight property, AnnBoundingRectLeft property, AnnBoundingRectTop property, AnnBoundingRectWidth property, AnnBoundingRectHeight property, AnnRectLeft property, AnnRectTop property, AnnRectWidth property, AnnRectHeight property

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnNameBoundingRectWidth
hObject

Handle to the annotation object.


AnnNameRectHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnNameRectHeight (OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Read Only) (Document/Medical only) Contains the height of the name of the specified annotation object.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnNameBoundingRectLeft property, AnnNameBoundingRectTop property, AnnNameBoundingRectWidth property, AnnNameBoundingRectHeight property, AnnNameRectLeft property, AnnNameRectTop property, AnnNameRectWidth property, AnnBoundingRectLeft property, AnnBoundingRectTop property, AnnBoundingRectWidth property, AnnBoundingRectHeight property, AnnRectLeft property, AnnRectTop property, AnnRectWidth property, AnnRectHeight property

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnNameRectHeight
hObject

Handle to the annotation object.


AnnNameRectLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnNameRectLeft (OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Read Only) (Document/Medical only) Contains the left boundary of the name of the specified annotation object.  The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnNameBoundingRectLeft property, AnnNameBoundingRectTop property, AnnNameBoundingRectWidth property, AnnNameBoundingRectHeight property, AnnNameRectTop property, AnnNameRectWidth property, AnnNameRectHeight property, AnnBoundingRectLeft property, AnnBoundingRectTop property, AnnBoundingRectWidth property, AnnBoundingRectHeight property, AnnRectLeft property, AnnRectTop property, AnnRectWidth property, AnnRectHeight property

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnNameRectLeft
hObject

Handle to the annotation object.


AnnNameRectTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnNameRectTop (OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Read Only) (Document/Medical only) Contains the top boundary of the name of the specified annotation object.  The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnNameBoundingRectLeft property, AnnNameBoundingRectTop property, AnnNameBoundingRectWidth property, AnnNameBoundingRectHeight property, AnnNameRectLeft property, AnnNameRectWidth property, AnnNameRectHeight property, AnnBoundingRectLeft property, AnnBoundingRectTop property, AnnBoundingRectWidth property, AnnBoundingRectHeight property, AnnRectLeft property, AnnRectTop property, AnnRectWidth property, AnnRectHeight property

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnNameRectTop
hObject

Handle to the annotation object.


AnnNameRectWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnNameRectWidth (OLE_HANDLE hObject);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Read Only) (Document/Medical only) Contains the width of the name of the specified annotation object.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnNameBoundingRectLeft property, AnnNameBoundingRectTop property, AnnNameBoundingRectWidth property, AnnNameBoundingRectHeight property, AnnNameRectLeft property, AnnNameRectTop property, AnnNameRectHeight property, AnnBoundingRectLeft property, AnnBoundingRectTop property, AnnBoundingRectWidth property, AnnBoundingRectHeight property, AnnRectLeft property, AnnRectTop property, AnnRectWidth property, AnnRectHeight property

Topics	Annotations (Document/Medical only):Object Manipulation


hObjectParameter For AnnNameRectWidth
hObject

Handle to the annotation object.


AnnPaste method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnPaste ();

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Pastes annotation objects from the clipboard to the Main Control. The data on the clipboard must be a LEAD annotation in native format.

Before calling this method, you can use the AnnPasteReady property to test the validity of data on the clipboard.

See Also

Topics	Annotations (Document/Medical only): Using the Clipboard


Return for AnnPaste
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnPasteReady property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AnnPasteReady

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Indicates whether the Windows clipboard contains annotation data that you can paste into the Main Control.

Value	Meaning

TRUE	The clipboard contains annotations that can be pasted.

FALSE	The clipboard does not contain annotations that can be pasted.

See Also

Topics	Annotations (Document/Medical only): Using the Clipboard


AnnRealize method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnRealize (BOOL fRedactOnly);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Renders the annotation objects to the bitmap, altering the bitmap, itself.

If you realize a redact object, moving the redact object will leave the original location of the redact object hidden. To restore the image under the redact object (so that when you move the redact object, the underlying image is not hidden), you must unrealized the redact object by calling the AnnUnrealize method.

When you call AnnRealize, for every Redact object, the background of the image behind is saved inside the object.  You can restore that background by calling AnnUnrealize.

This method works only for 1, 4, 8, 16, and 24-bit images. When using an image that has some other number of bits per pixel, call the ColorRes method to change the image to a supported bits per pixel before calling the AnnRealize method.

See Also

Elements	AnnUnrealize method

Topics	Annotations (Document/Medical only): Object Manipulation


fRedactOnly Parameter For AnnRealize
fRedactOnly

Flag that indicates which objects to realize. Possible values are:

Value	Meaning

TRUE	Realize only redaction objects.

FALSE	Realize all annotation objects.


Return for AnnRealize
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnRectHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnRectHeight (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Contains the height of the specified annotation object.

This property lets you resize an annotation object.

Point objects cannot be resized.

Objects with a height of zero (horizontal lines or pointers, or freehand objects for which all points are on a horizontal line) cannot have their height changed.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnRectLeft property. AnnRectTop property, AnnRectWidth property

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnRectHeight
hObject

Handle to the annotation object.


AnnRectLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnRectLeft (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Contains the left boundary for the specified annotation object.

This property lets you reposition an annotation object.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnRectHeight property. AnnRectTop property, AnnRectWidth property

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnRectLeft
hObject

Handle to the annotation object.


AnnRectTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnRectTop (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Contains the top boundary for the specified annotation object.

This property lets you reposition an annotation object.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnRectHeight property. AnnRectLeft property, AnnRectWidth property

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnRectTop
hObject

Handle to the annotation object.


AnnRectWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnRectWidth (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Contains the width of the specified annotation object.

This property lets you resize an annotation object.

Point objects cannot be resized.

Objects with a width of zero (vertical lines or pointers, or freehand objects for which all points are on a vertical line) cannot have their width changed.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnRectHeight property. AnnRectLeft property, AnnRectTop property

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnRectWidth
hObject

Handle to the annotation object.


AnnRemove method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnRemove(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Removes the specified annotation object from its current container, leaving the object with no container.

To insert the object into another container, such as the main container of the display, use the AnnInsert method.

See Also

Elements	AnnInsert method, AnnGetContainer method, AnnGetTopContainer method, AnnEnumerate method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnRemove
hObject

Handle to the annotation object.


Return for AnnRemove
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnReverse method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnReverse (BOOL bUseVert, float fVert, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Reverses one or more annotation objects, left to right.

If you pass TRUE in the bSelected parameter, this method affects only the currently selected objects. Otherwise, it affects all objects.

If you pass TRUE in the bUseVert parameter, this method reverses all affected objects on the axis specified in the fVert parameter. Otherwise, it reverses each affected object on its own center.

You cannot flip or reverse an object that contains text. If you flip or reverse a group of objects on a common axis, the text will move to the new position, but will retain its orientation.

See Also

Topics	Annotations (Document/Medical only): Object Manipulation


bUseVert Parameter For AnnReverse
bUseVert

One of the following values:

Value	Meaning

TRUE	Reverse all objects on the axis specified by the fVert parameter.

FALSE	Reverse each object on its own center.


fVert Parameter For AnnReverse
fVert

The vertical axis (X value) on which the objects are reversed. This value is used only if the bUseVert parameter is TRUE.

The position is relative to the bitmap in the control. The unit of measure is determined by the ScaleMode property.


bSelected Parameter For AnnReverse
bSelected

One of the following values:

TRUE	Reverse only the selected objects.

FALSE	Reverse all of the annotation objects.


Return for AnnReverse
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnRotate method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnRotate (BOOL bUseCenter, float fCenterX, float fCenterY, float fAngle, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Rotates one or more annotation objects.

If you pass TRUE in the bSelected parameter, this method affects only the currently selected objects. Otherwise, it affects all objects.

If you pass TRUE in the bUseCenter parameter, this method rotates all affected objects around the point specified by the fCenterX and fCenterY parameters. Otherwise, it rotates each affected object on its own center.

You cannot rotate a note, hot spot, button, or audio clip. If you rotate a group of objects around a common center, these objects will move to new positions, but will retain their orientation.

See Also

Elements	AnnAutoRotate property

Topics	Annotations (Document/Medical only): Object Manipulation


bUseCenter Parameter For AnnRotate
bUseCenter

One of the following values:

TRUE	Rotate all objects around the point specified by the fCenterX and fCenterY parameters.

FALSE	Rotate each object on its own center.


fCenterX Parameter For AnnRotate
fCenterX

The X coordinate of the point around which the objects are rotated. This value is used only if the bUseCenter parameter is TRUE.

The position is relative to the bitmap in the control. The unit of measure is determined by the ScaleMode property.


fCenterY Parameter For AnnRotate
fCenterY

The Y coordinate of the point around which the objects are rotated. This value is used only if the bUseCenter parameter is TRUE.

The position is relative to the bitmap in the control. The unit of measure is determined by the ScaleMode property.


fAngle Parameter For AnnRotate
fAngle

The number of degrees to rotate the objects, expressed as a floating point value.


bSelected Parameter For AnnRotate
bSelected

One of the following values:

TRUE	Rotate only the selected objects.

FALSE	Rotate all of the annotation objects.


Return for AnnRotate
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSave method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnSave (BSTR pszFile, short iFormat, BOOL fSelected, short iModify, short iSavePage);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Saves the specified annotations in a file.

Annotation Files can store multiple pages.  This method saves annotations to an annotation file.  It can also append, replace, or overwrite pages in an existing annotation file.

To overwrite an existing annotation file, pass SAVE_OVERWRITE for the iModify parameter (iSavePage will be ignored).

To add a page to the end of an annotation file, pass SAVE_APPEND for the iModify argument (iSavePage will be ignored).

To replace a page in an annotation file, pass SAVE_REPLACE and set iSavePage to the page number to be replaced.  Note that page numbers are 1-based. Therefore, the first page is page 1, the second page is page 2, etc.

To insert a new page, pass SAVE_INSERT and set iSavePage.  The new page will be inserted BEFORE the page specified in iSavePage.

You can also save annotations in a Wang-compatible TIFF tag.  For more information concerning this option, refer to AnnSaveTag method.

See Also

Elements	AnnSaveArray method, AnnSaveMemory method, AnnLoad method, AnnSaveTag method

Topics	Annotations (Document/Medical only): Input and Output


pszFile Parameter For AnnSave
pszFile

A character string that specifies the file to save.


iFormat Parameter For AnnSave
iFormat

One of the following values:

Value	Meaning

ANNFMT_NATIVE	Use LEAD's own format for annotations.

ANNFMT_WMF	Use the Windows WMF format.


fSelected Parameter For AnnSave
fSelected

One of the following values:

TRUE	Save only the selected objects.

FALSE	Save all of the annotation objects.


iModify Parameter For AnnSave
iModify

Flag that indicates how to save a new page in a multipage annotation file.  Possible values are:

Value	Meaning

SAVE_OVERWRITE	[0] No insert/replace/append is performed.  An existing file is overwritten.

SAVE_APPEND	[1] The page is appended if the file exists.

SAVE_REPLACE	[2] Replace the page specified in the iSavePage parameter.

SAVE_INSERT	[3] Insert the new page before the page specified in the iSavePage parameter.


iSavePage Parameter For AnnSave
iSavePage

Number of the page to overwrite, append, replace, or insert, based on the iModify parameter. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, etc.


Return for AnnSave
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSaveArray method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSaveArray(VARIANT *pvMem, short iFormat, BOOL bSelected, short iModify, long iSavePage);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Saves the specified annotations to a file in memory.

Annotation Files can store multiple pages.  This method saves annotations to an annotation file.  It can also append, replace, or overwrite pages in an existing annotation file.

To overwrite an existing annotation file, pass SAVE_OVERWRITE for the iModify parameter (iSavePage will be ignored).

To add a page to the end of an annotation file, pass SAVE_APPEND for the iModify argument (iSavePage will be ignored).

To replace a page in an annotation file, pass SAVE_REPLACE and set iSavePage to the page number to be replaced.  Note that page numbers are 1-based. Therefore, the first page is page 1, the second page is page 2, etc.

To insert a new page, pass SAVE_INSERT and set iSavePage.  The new page will be inserted BEFORE the page specified in iSavePage.

To see the correct data types, refer to the code example for your development system.

To load annotations from a file in memory, refer to the AnnLoadArray method.

This method can also be used in ASP.

To determine the size, use the following:

Size = UpperBound of the VARIANT – LowerBound of the VARIANT + 1;

See Also

Elements	AnnLoadArray method, AnnLoadMemory method, AnnSaveMemory method, AnnLoad method, AnnSave method, AnnSaveMemory method

Topics	Annotations (Document/Medical only): Input and Output


pvMem Parameter For AnnSaveArray
pvMem

Address of a VARIANT variable.  In C++, declare the variable and pass its address.  In most other languages, pass the variable by reference.


iFormat Parameter For AnnSaveArray
iFormat

Value that indicates the format to use when saving the annotations.

Value	Meaning

ANNFMT_NATIVE	Use LEAD's own format for annotations.

ANNFMT_ENCODED	Use a binary format for saving annotations. The file size is smaller, and it provides greater security.

ANNFMT_WMF	Use the Windows WMF format.

ANNFMT_TIFFTAG	Save all annotation properties, including those not supported by the Wang specification as an ANNTAG_TIFF tag.

ANNFMT_WANGTAG	Save only the annotation properties supported by the Wang specification as an ANNTAG_TIFF tag.


bSelected Parameter For AnnSaveArray
bSelected

Flag that indicates which objects to save. Possible values are:

TRUE	Save only the selected objects.

FALSE	Save all of the annotation objects.


iModify Parameter For AnnSaveArray
iModify

Flag that indicates how to save a new page in a multipage annotation file.  Possible values are:

Value	Meaning

SAVE_OVERWRITE	[0] No insert/replace/append is performed.  An existing file is overwritten.

SAVE_APPEND	[1] The page is appended if the file exists.

SAVE_REPLACE	[2] Replace the page specified in the iSavePage parameter.

SAVE_INSERT	[3] Insert the new page before the page specified in the iSavePage parameter.


iSavePage Parameter For AnnSaveArray
iSavePage

Number of the page to overwrite, append, replace, or insert, based on the iModify parameter. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, etc.


AnnSaveMemory method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnSaveMemory (OLE_HANDLE* phMem, short iFormat, BOOL bSelected, long* piSize, short iModify, short iSavePage);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Saves the specified annotations to a file in memory.

Annotation Files can store multiple pages.  This method saves annotations to an annotation file.  It can also append, replace, or overwrite pages in an existing annotation file.

To overwrite an existing annotation file, pass SAVE_OVERWRITE for the iModify parameter (iSavePage will be ignored).

To add a page to the end of an annotation file, pass SAVE_APPEND for the iModify argument (iSavePage will be ignored).

To replace a page in an annotation file, pass SAVE_REPLACE and set iSavePage to the page number to be replaced.  Note that page numbers are 1-based. Therefore, the first page is page 1, the second page is page 2, etc.

To insert a new page, pass SAVE_INSERT and set iSavePage.  The new page will be inserted BEFORE the page specified in iSavePage.

To use this method, do the following:

1.	To create a new annotation memory file, declare a variable of the appropriate data type to reference the file in memory, and set the value to NULL (or 0). You can then pass its address (pass the variable by reference) in this method, which will allocate the memory, save the bitmap, and unlock the memory.  To add a page to an existing annotation memory file, pass the address of the existing memory handle (which must be non-zero).

2.	Declare a long integer variable for the file-size. You can then pass its address in this method, which will update its value with the size of the file.

3.	Pass the appropriate value for iModify  (SAVE_OVERWRITE, SAVE_APPEND, SAVE_REPLACE or SAVE_INSERT).

4.	If iModify is SAVE_REPLACE or SAVE_INSERT, pass the appropriate page number for iSavePage.  If iModify is SAVE_OVERWRITE or SAVE_APPEND then iSavePage is ignored.

5.	Call this method to save the bitmap in the specified memory handle.

To see the correct data types, refer to the code example for your development system.

To load annotations from a file in memory, refer to the AnnLoadMemory method.

See Also

Elements	AnnSave method, AnnSaveArray method

Topics	Annotations (Document/Medical only): Input and Output


phMem Parameter For AnnSaveMemory
phMem

Address of the OLE_HANDLE variable that you use to reference the file in memory. In C++, you declare the variable and pass its address. In most other languages, you pass the variable by reference. The method updates the value of the variable. The variable must be a global handle (HGLOBAL) and must be declared with the appropriate data type. To see the correct data type, refer to the code example for your development system.


iFormat Parameter For AnnSaveMemory
iFormat

One of the following values:

Value	Meaning

ANNFMT_NATIVE	Use LEAD's own format for annotations.

ANNFMT_WMF	Use the Windows WMF format.

ANNFMT_TIFFTAG	Save all annotation properties, including those not supported by the Wang specification as an ANNTAG_TIFF tag.

ANNFMT_WANGTAG	Save only the annotation properties supported by the Wang specification as an ANNTAG_TIFF tag.


bSelected Parameter For AnnSaveMemory
bSelected

One of the following values:

TRUE	Save only the selected objects.

FALSE	Save all of the annotation objects.


piSize Parameter For AnnSaveMemory
piSize

Address of the long integer variable that you use to track the size of the file in memory. In C++, you declare the variable and pass its address. In most other languages, you pass the variable by reference. The method updates the value of the variable. The variable must be declared with the appropriate data type. To see the correct data type, refer to the code example for your development system.


iModify Parameter For AnnSaveMemory
iModify

Flag that indicates how to save a new page in a multipage annotation file.  Possible values are:

Value	Meaning

SAVE_OVERWRITE	[0] No insert/replace/append is performed.  An existing file is overwritten.

SAVE_APPEND	[1] The page is appended if the file exists.

SAVE_REPLACE	[2] Replace the page specified in the iSavePage parameter.

SAVE_INSERT	[3] Insert the new page before the page specified in the iSavePage parameter.


iSavePage Parameter For AnnSaveMemory
iSavePage

Number of the page to overwrite, append, replace, or insert, based on the iModify parameter. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, etc.


Return for AnnSaveMemory
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSaveOffset method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long AnnSaveOffset(long fd, long nOffset, OLE_HANDLE hObject, short iFormat, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Saves the specified annotations at a specified position in an existing file.

To retain scaling and positioning information, this method always saves the root container, along with the specified object or selected objects. Use the hObject and bSelected parameters as follows:

1.	To save the specified object, set hObject to that object and set bSelected to FALSE.

2.	To save only selected objects in a container, set hObject to the container and set bSelected to TRUE.

3.	To save all objects in a container, set hObject to the container and set bSelected to FALSE.

This method overwrites existing data at the specified location in the file. The offset is specified in bytes. You must open the file and get a Windows file handle before calling this method.

See Also

Elements	AnnSave method, AnnSaveArray method

Topics	Annotations (Document/Medical only):Input and Output


fd Parameter For AnnSaveOffset
fd

The Windows file handle to the file to save.


nOffset Parameter For AnnSaveOffset
nOffset

The offset within the specified file to embed the saved annotation file. For example, if you specify 5, then 5 bytes of other data will precede the embedded file.


hObject Parameter For AnnSaveOffset
hObject

Handle to the annotation object.


iFormat Parameter For AnnSaveOffset
iFormat

Format for saving annotation data. Possible values are:

Value	Meaning

ANNFMT_NATIVE	Use LEAD's own format for annotations.

ANNFMT_WMF	Use the Windows WMF format.

ANNFMT_ENCODED	Save as a binary format. This file size is smaller and upward compatible. It also provides better security.


bSelected Parameter For AnnSaveOffset
bSelected

Flag that indicates which objects to save. Possible values are:

Value	Meaning

TRUE	Save all objects that have the selected property set to TRUE. For getting and setting the selected property, use the AnnGetSelected and AnnSetSelected methods.

FALSE	Save only the specified object.

Save annotations in the WMF format only for use in another application. LEADTOOLS reads annotations only in the native format.


Return for AnnSaveOffset
Return Value

Size of the embedded file.


AnnSaveTag method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnSaveTag (BOOL fWangMode, BOOL fSelected);

Overview	Refer to Implementing Annotations

Remarks

(Document/Medical only) Saves all or selected annotation objects in a Wang-compatible TIFF tag.  The next time a file is saved as one of the TIFF formats, the file will contain these annotations.  To clear the annotation tag, call SetTag(0, 0, 0, "").  For more information on TIFF formats, refer to Summary of All Supported Image File Formats.

See Also

Elements	AnnSave method

Topics	Annotations (Document/Medical only): Input and Output


fWangMode Parameter For AnnSaveTag
fWangMode

Boolean value indicating whether to save annotations in a WANG compatible TIFF tag, or in the LEAD format.


fSelected Parameter For AnnSaveTag
fSelected

Boolean value indicating whether to save all objects within a container or only selected objects.  If fSelected is TRUE, only selected annotation objects will be saved.  If fSelected is FALSE, all annotation objects are saved.


Return for AnnSaveTag
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSelect event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AnnSelect (VARIANT aObjects, short uCount);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Occurs when annotation objects are selected or deselected. If uCount is 0, then no objects are selected. If you click outside all the annotation objects, this event will still be fired and uCount will be 0.

See Also

Elements	AnnGetSelectCount method, AnnGetSelectList method

Topics	Annotations (Document/Medical only): Automation, Annotations (Document/Medical only): Annotation Events


aObjects Parameter For AnnSelect
aObjects

Array of annotation object handles.


uCount Parameter For AnnSelect
uCount

Number of selected annotation objects.


AnnSelectPoint method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSelectPoint(OLE_HANDLE hContainer, float x, float y);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Selects the annotation object at the specified point, relative to the window. If objects overlap, this method selects the front object.

Selecting an object sets its selected property to TRUE.

See Also

Elements	AnnSelectRect method, AnnSelectRectLeft property, AnnSelectRectTop property, AnnHitTest method, AnnSelectRectWidth property, AnnSelectRectHeight property

Topics	Annotations (Document/Medical only): Automation


hContainer Parameter For AnnSelectPoint
hContainer

Handle to the annotation container object.


x Parameter For AnnSelectPoint
x

X Coordinate of point. The unit of measure is determined by the ScaleMode property.


y Parameter For AnnSelectPoint
y

Y Coordinate of point. The unit of measure is determined by the ScaleMode property.


Return for AnnSelectPoint
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSelectRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSelectRect(OLE_HANDLE hContainer, float left, float top, float right, float bottom);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Selects all objects within the specified rectangle, relative to the window.

Selecting an object sets its selected property to TRUE.

See Also

Elements	AnnSelectRectLeft property, AnnSelectRectTop property, AnnSelectRectWidth property, AnnSelectRectHeight property

Topics	Annotations (Document/Medical only): Automation


hContainer Parameter For AnnSelectRect
hContainer

Handle to the annotation object.


left Parameter For AnnSelectRect
left

Left boundary of selection rectangle. The unit of measure is determined by the ScaleMode property.


top Parameter For AnnSelectRect
top

Top boundary of selection rectangle. The unit of measure is determined by the ScaleMode property.


right Parameter For AnnSelectRect
right

Right boundary of selection rectangle. The unit of measure is determined by the ScaleMode property.


bottom Parameter For AnnSelectRect
bottom

Bottom boundary of selection rectangle. The unit of measure is determined by the ScaleMode property.


Return for AnnSelectRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSelectRectHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnSelectRectHeight(OLE_HANDLE hContainer);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) (Read Only) Contains the height of the rectangle in the current window that surrounds all selected annotation objects.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnSelectRect method, AnnSelectRectLeft property, AnnSelectRectTop property, AnnSelectRectWidth property

Topics	Annotations (Document/Medical only): Automation


hContainer Parameter For AnnSelectRectHeight
hContainer

Handle to the annotation container object.


AnnSelectRectLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnSelectRectLeft(OLE_HANDLE hContainer);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) (Read Only) Contains the left boundary for the rectangle in the current window that surrounds all selected annotation objects.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnSelectRect method, AnnSelectRectTop property, AnnSelectRectWidth property, AnnSelectRectHeight property

Topics	Annotations (Document/Medical only): Automation


hContainer Parameter For AnnSelectRectLeft
hContainer

Handle to the annotation container object.


AnnSelectRectTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnSelectRectTop(OLE_HANDLE hContainer);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) (Read Only) Contains the top boundary for the rectangle in the current window that surrounds all selected annotation objects.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnSelectRect method, AnnSelectRectLeft property, AnnSelectRectWidth property, AnnSelectRectHeight property

Topics	Annotations (Document/Medical only): Automation


hConatiner Parameter For AnnSelectRectTop
hContainer

Handle to the annotation container object.


AnnSelectRectWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float AnnSelectRectWidth(OLE_HANDLE hContainer);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) (Read Only) Contains the width of the rectangle in the current window that surrounds all selected annotation objects.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	AnnSelectRect method, AnnSelectRectLeft property, AnnSelectRectTop property, AnnSelectRectHeight property

Topics	Annotations (Document/Medical only): Automation


hContainer Parameter For AnnSelectRectWidth
hContainer

Handle to the annotation container object.


AnnSendToBack method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSendToBack(OLE_HANDLE hObject);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Reorders the specified annotation object so that it is displayed behind other objects in the same container.

This method moves the object to the beginning of the enumeration order for objects in the same container. When the container is displayed, this object is displayed first.

See Also

Elements	AnnBringToFront method, AnnBoundingRectTop property, AnnBoundingRectLeft property, AnnBoundingRectHeight property, AnnBoundingRectWidth property

Topics	Annotations (Document/Medical only): Automation


Return for AnnSendToBack
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


hObject Parameter For AnnSendToBack
hObject

Handle to the annotation object.


AnnSetAutoBackColor method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetAutoBackColor(OLE_HANDLE hObject, short iType, OLE_COLOR crBack);

Overview	Refer to Implementing Annotations.

Remarks

Sets the background color of one or more annotation objects.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations. Please note the following:

If iType is:	Then the background color is changed for:
ANNOBJECT_NOTE or ANNOBJECT_PUSHPIN	Note objects and push pin objects created by the automation object
ANNOBJECT_HILITE	Hilite objects created by the automation object.
ANNOBJECT_REDACT	Redact objects created by the automation object.
any other object such as ANNOBJECT_TEXT, ANNOBJECT_RECT, etc.	All other objects, created by the automation object, which Have a background color property.
See Also

Topics	AnnGetAutoBackColor method, AnnGetBackColor method, AnnSetBackColor method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnSetAutoBackColor
hObject

Handle to the annotation object.


iType Parameter For AnnSetAutoBackColor
iType

Type of object for which to change the background color. For a list of possible values, refer to Types of Annotations.


crBack Parameter For AnnSetAutoBackColor
crBack

The COLORREF value that specifies the background color.


Return for AnnSetAutoBackColor
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetAutoDefaults method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetAutoDefaults (OLE_HANDLE hObject, short iFlags);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Assigns all the automation default properties to the specified annotation object.

This method simulates the action that takes place when an annotation object is created using the automated mode. An annotation object created in automated mode receives the same default properties as the automation object, such as foreground color, line width, etc. This lets you assign the same default properties in the automation object to the specified annotation object.

See Also

Elements	AnnCreate method, AnnDefine, AnnDestroy method, AnnGetVisible method, AnnInsert method, AnnSetSelected method, AnnSetVisible method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetAutoDefaults
hObject

Handle to the annotation object.


iFlags Parameter For AnnSetAutoDefaults
iFlags

Flag that indicates the objects to process. Use 0 if hObject is not a container.

If hObject is a container, you can use 0 (process only hObject), or you can combine some of the values given below, using a bitwise OR. For example, ANNFLAG_SELECTED | ANNFLAG_RECURSE processes only the selected objects.

Value	Meaning

ANNFLAG_SELECTED	[0x0001] Enumerate only the selected objects.

ANNFLAG_NOTCONTAINER	[0x0002] Enumerate all objects that are not containers.

ANNFLAG_NOTTHIS	[0x0003] Enumerate all objects except hObject.

ANNFLAG_RECURSE	[0x0004] Enumerate all objects contained in hObject and any contained in any sub-containers.


Return for AnnSetAutoDefaults
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetAutoMenuItemEnable method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetAutoMenuItemEnable (OLE_HANDLE hObject, short iType, short iItem, short iEnable, short iFlags, BSTR pszUserList);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Enables or disables a menu item for one or more annotation objects.

By default, all automation menu items that are not NULL are displayed.

If an automation menu item is NULL, that menu item will not be displayed, even if the menu item has been enabled using this method.

The menu item strings are changed using the AnnSetAutoText method.

Menu items can be enabled or disabled for one or more than one object, depending on the object passed in the hObject parameter. The following table indicates the possible options:

Menu Item String	Status	hObject	iType	Result
NULL	Enabled	Annotation or automation	Any type	Menu item is not displayed.
NULL	Disabled	Annotation or automation	Any type	Menu item is not displayed.
Not NULL	Disabled	Automation object	ANNOBJECT_XXX	Menu item is not displayed for all objects of type ANNOBJECT_XXX.
Not NULL	Disabled	Automation object	ANNOBJECT_ALL	Menu item is not displayed for all objects.
Not NULL	Enabled	Automation object	ANNOBJECT_XXX	Menu item is displayed for all objects of type ANNOBJECT_XXX.
Not NULL	Enabled	Automation object	ANNOBJECT_ALL	Menu item is displayed for all objects.
Not NULL	Disabled	Annotation object	Ignored	Menu item is not displayed for the specified object, based on the value of uFlags.
Not NULL	Enabled	Annotation object	Ignored	Menu item is displayed for the specified object, based on the value of uFlags.
See Also

Elements	AnnGetAutoMenuItemEnable, AnnAutoMenuEnable property

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnSetAutoMenuItemEnable
hObject

Handle to the annotation object.


iType Parameter For AnnSetAutoMenuItemEnable
iType

Constant that specifies an object's type. If hObject is an automation object, the specified menu item for all objects of type iType will be enabled or disabled. For descriptions of possible object types, refer to Types of Annotations.


iItem Parameter For AnnSetAutoMenuItemEnable
iItem

Constant that specifies the menu or dialog box item to enable or disable. For lists of constants and their default values, refer to the following:

Annotation Automation Menu Strings

Annotation Automation Line Dialog Strings

Annotation Automation Fill Dialog Strings

Annotation Automation Text Dialog Strings

Annotation Automation Audio Dialog Strings

Annotation Automation Stamp Dialog Strings

Annotation Automation ROP2 Dialog Strings

Annotation Automation Lock/Unlock Dialog Strings

Annotation Automation Miscellaneous Dialog Strings

Annotation Automation Ruler Dialog Strings

Annotation Automation Point Dialog Strings

Annotation Automation Video Dialog Strings

Annotation Automation Push Pin Dialog Strings

Annotation Automation Nodes Dialog Strings

Annotation Automation Protractor Dialog Strings

Annotation Automation Name Dialog Strings

Annotation Automation Play Video Dialog Strings

Annotation Automation Stamp Metafile Dialog Strings

Annotation Automation ToolTip Dialog Strings

Annotation Automation Transparent Color Dialog Strings

Annotation Automation Capture Dialog Strings


iEnable Parameter For AnnSetAutoMenuItemEnable
iEnable

Flag that indicates whether to enable or disable the specified item. Possible values are:

Value	Meaning

ANNMENU_ENABLED	Enable the menu item.

ANNMENU_DISABLED	Disable the menu item.

ANNMENU_DEFAULT	Enable or disable the menu item, based on the setting for the object type.


iFlags Parameter For AnnSetAutoMenuItemEnable
iFlags

Flag that indicates the objects to process. Use 0 if hObject is not a container.

If hObject is a container, you can use 0 (process only hObject), or you can combine some of the values given below, using a bitwise OR. For example, ANNFLAG_SELECTED | ANNFLAG_RECURSE processes only the selected objects.

Value	Meaning

ANNFLAG_SELECTED	[0x0001] Process only the selected objects.

ANNFLAG_NOTCONTAINER	[0x0002] Process all objects that are not containers.

ANNFLAG_NOTTHIS	[0x0003] Process all objects except hObject.

ANNFLAG_RECURSE	[0x0004] Process all objects contained in hObject and any contained in any sub-containers.

ANNFLAG_USER	[0x0040] Process only those objects with users listed in pszUserList.


pszUserList Parameter For AnnSetAutoMenuItemEnable
pszUserList

String that contains the list of users associated with the specified object. pUserList has the form "User1,User2,…,UserN". This must be a NULL terminated string with user names separated by a comma. This parameter is valid only if ANNFLAG_USER is set in iFlags.


Return for AnnSetAutoMenuItemEnable
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetAutoText method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnSetAutoText (short iItem, BSTR pszText);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the character string that is used for the specified menu item or other element that LEADTOOLS provides for automated annotations.

To get the current value of a text string, you can use the AnnGetAutoText method.

When you call this method with an empty string for pszText, the menu item defined by iItem will be disabled and removed from the automation menu.  To re-enable the menu item, call this method again and pass a valid string.

See Also

Elements	AnnGetAutoText method

Topics	Annotations (Document/Medical only): Automation


iItem Parameter For AnnSetAutoText
iItem

Constant that specifies the menu or dialog box item, which appears when the user presses the right mouse button. For lists of constants and their default values, refer to the following:

Annotation Automation Menu Strings

Annotation Automation Line Dialog Strings

Annotation Automation Fill Dialog Strings

Annotation Automation Text Dialog Strings

Annotation Automation Audio Dialog Strings

Annotation Automation Stamp Dialog Strings

Annotation Automation Lock/Unlock Dialog Strings

Annotation Automation Miscellaneous Dialog Strings

Annotation Automation ROP2 Dialog Strings

Annotation Automation Ruler Dialog Strings


pszText Parameter For AnnSetAutoText
pszText

The text string to use for the specified item.


Return for AnnSetAutoText
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetBackColor method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetBackColor(OLE_HANDLE hObject, OLE_COLOR crBack, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the background color of one or more annotation objects.

Use the Windows COLORREF data type to specify the color. For example, use the Pixel property or the Windows RGB macro to get a color value.

To see how the background color relates to the fill modes, refer to Illustration of Fill Options for Annotations.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnSetForeColor method, AnnGetForeColor method, AnnGetBackColor method, AnnSetROP2 method, AnnGetROP2 method, AnnGetAutoBackColor method, AnnSetAutoBackColor method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetBackColor
hObject

Handle to the annotation object.


crBack Parameter For AnnSetBackColor
crBack

The COLORREF value that specifies the background color.


bSelected Parameter For AnnSetBackColor
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetBackColor
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetBitmap method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetBitmap(OLE_HANDLE hObject, OLE_HANDLE hBitmap, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the bitmap of one or more annotation objects.

Only the Stamp object uses this property. The specified bitmap is a LEAD bitmap. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnGetBitmap method

Topics	Annotations (Document/Medical only): Object Bitmap


hObject Parameter For AnnSetBitmap
hObject

Handle to the annotation object.


hBitmap Parameter For AnnSetBitmap
hBitmap

Bitmap handle to the bitmap to assign to the specified object.


bSelected Parameter For AnnSetBitmap
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetBitmap
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetBitmapDpiX method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetBitmapDpiX(OLE_HANDLE hObject, float fBitmapDpix, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the horizontal Bitmap DPI (dots per inch) value that is used to translate the horizontal distance for the Ruler object or Annotation Automation Object.

The value of the AnnContainer property must not be passed for the hObject parameter.

Only Automation and Ruler objects are affected. For more information, refer to Annotation Automation Object and Ruler Annotation Object.

Set this value to the bitmap’s XResolution. This method should be called when loading objects or pasting them from the clipboard to containers other than the Main Control's AnnContainer.  Otherwise, the distances shown by the ruler objects will not be accurate.

See Also

Elements	AnnGetUnit method, AnnSetGaugeLength method, AnnGetBitmapDpiX method, AnnGetBitmapDpiY method, AnnSetBitmapDpiY method, AnnSetUnit method, AnnGetDistance method, AnnGetGaugeLength method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetBitmapDpiX
hObject

Handle to the annotation object.


fBitmapDpix Parameter For AnnSetBitmapDpiX
fBitmapDpix

The horizontal DPI value to set. Valid values are greater than or equal to 1.

If 0 or a positive value less than 1 is passed, the value will default to 150. If a negative value is passed, the method will return an error.


bSelected Parameter For AnnSetBitmapDpiX
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetBitmapDpiX
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetBitmapDpiY method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetBitmapDpiY(OLE_HANDLE hObject, float fBitmapDpiY, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the vertical Bitmap DPI (dots per inch) value that is used to translate the vertical distance for the Ruler object.

The value of the AnnContainer property must not be passed for the hObject parameter.

Only Automation and Ruler objects are affected. For more information, refer to Annotation Automation Object and Ruler Annotation Object.

Set this value to the bitmap’s YResolution. This method should be called when loading objects or pasting them from the clipboard to containers other than the Main Control's AnnContainer.  Otherwise, the distances shown by the ruler objects will not be accurate.

See Also

Elements	AnnGetUnit method, AnnSetGaugeLength method, AnnSetBitmapDpiX method, AnnGetBitmapDpiX method, AnnGetBitmapDpiY method, AnnSetUnit method, AnnGetDistance method, AnnGetGaugeLength method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetBitmapDpiY
hObject

Handle to the annotation object.


fBitmapDpiY Parameter For AnnSetBitmapDpiY
fBitmapDpiY

The vertical DPI value to set. Valid values are greater than or equal to 1.

If 0 or a positive value less than 1 is passed, the value will default to 150. If a negative value is passed, the method will return an error.


bSelected Parameter For AnnSetBitmapDpiY
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetBitmapDpiY
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetFillMode method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetFillMode(OLE_HANDLE hObject, short nFillMode, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the fill mode of one or more annotation objects.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnSetFillPattern method, AnnGetFillPattern method, AnnGetFillMode method, AnnGetPolyFillMode method, AnnSetPolyFillMode method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetFillMode
hObject

Handle to the annotation object.


nFillMode Parameter For AnnSetFillMode
nFillMode

The constant that specifies the object's fill mode. Possible fill mode values are:

Value	Meaning

ANNFILLMODE_TRANSPARENT	[0] Transparent

ANNFILLMODE_TRANSLUCENT	[1] Translucent

ANNFILLMODE_OPAQUE	[2] Opaque

To see the possible fill modes and patterns, refer to Illustration of Fill Options for Annotations.


bSelected Parameter For AnnSetFillMode
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetFillMode
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetFillPattern method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetFillPattern(OLE_HANDLE hObject, short nFillPattern, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the fill pattern of one or more annotation objects.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnGetFillPattern method, AnnSetFillMode method, AnnGetFillMode method, AnnGetPolyFillMode method, AnnSetPolyFillMode method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetFillPattern
hObject

Handle to the annotation object.


nFillPattern Parameter For AnnSetFillPattern
nFillPattern

The constant that specifies the fill pattern. Possible fill pattern values are:

Value	Meaning

ANNFILLPATTERN_SOLID	[0] Solid

ANNFILLPATTERN_BDIAGONAL	[1] Backward diagonal

ANNFILLPATTERN_CROSS	[2] Cross

ANNFILLPATTERN_DIAGCROSS	[3] Diagonal cross

ANNFILLPATTERN_FDIAGONAL	[4] Forward diagonal

ANNFILLPATTERN_HORIZONTAL	[5] Horizontal

ANNFILLPATTERN_VERTICAL	[6] Vertical

To see the possible fill modes and patterns, refer to Illustration of Fill Options for Annotations.


bSelected Parameter For AnnSetFillPattern
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetFillPattern
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetFontBold method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetFontBold(OLE_HANDLE hObject, BOOL bFontBold, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the bold-font property of one or more annotation objects.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnGetFontBold method, AnnSetFontName method, AnnGetFontName method, AnnSetFontSize method, AnnGetFontSize method, AnnSetFontUnderline method, AnnGetFontUnderline metho, AnnSetFontStrikeThrough method, AnnGetFontStrikeThrough method, AnnSetFontItalic method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetFontBold
hObject

Handle to the annotation object.


bFontBold Parameter For AnnSetFontBold
bFontBold

Flag that indicates whether to make the font bold. Possible values are:

Value	Meaning

TRUE	Make the font bold

FALSE	Make the font not bold.


bSelected Parameter For AnnSetFontBold
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetFontBold
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetFontItalic method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetFontItalic(OLE_HANDLE hObject, BOOL bFontItalic, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the italic-font property of one or more annotation objects.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elments	AnnGetFontBold method, AnnSetFontBold method, AnnSetFontName method, AnnGetFontName method, AnnSetFontSize method, AnnGetFontSize method, AnnSetFontUnderline method, AnnGetFontUnderline method, AnnSetFontStrikeThrough method, AnnGetFontStrikeThrough method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetFontItalic
hObject

Handle to the annotation object.


bFontItalic Parameter For AnnSetFontItalic
bFontItalic

Flag that indicates whether to make the font italic. Possible values are:

Value	Meaning

TRUE	Make the font italic

FALSE	Make the font not italic.


bSelected Parameter For AnnSetFontItalic
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetFontItalic
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetFontName method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetFontName(OLE_HANDLE hObject, LPCTSTR pszFontName, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the font of one or more annotation objects. The name of the font is specified in a character string.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnGetFontBold method, AnnSetFontBold method, AnnGetFontName method, AnnSetFontSize method, AnnGetFontSize method, AnnSetFontUnderline method, AnnGetFontUnderline method, AnnSetFontStrikeThrough method, AnnGetFontStrikeThrough method, AnnSetFontItalic method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetFontName
hObject

Handle to the annotation object.


pszFontName Parameter For AnnSetFontName
pszFontName

The character string containing the name of the font to assign.


bSelected Parameter For AnnSetFontName
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetFontName
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetFontSize method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetFontSize(OLE_HANDLE hObject, float fFontSize, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the font size of one or more annotation objects.

The font size of an object is relative to its container object. The height of a font is interpreted using the container's vertical scaling factor. For example, suppose you want the font to appear as a 10-point font on your screen using the current scaling factor. You would use the following calculation, where A is the pixel height of a 10-point font, B is the value that you get from the AnnGetScalarX method, and C is the value that you get from the AnnGetScalarY method:

fFontSize = A / sqrt( B * C )

For more information, refer to Low-Level Coordinate System for Annotations.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnGetFontBold method, AnnSetFontBold method, AnnSetFontName method, AnnGetFontName method, AnnGetFontSize method, AnnSetFontUnderline method, AnnGetFontUnderline method, AnnSetFontStrikeThrough method, AnnGetFontStrikeThrough method, AnnSetFontItalic method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetFontSize
hObject

Handle to the annotation object.


fFontSize Parameter For AnnSetFontSize
fFontSize

The font size to set, expressed as an unscaled value relative to the container.


bSelected Parameter For AnnSetFontSize
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetFontSize
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetFontStrikeThrough method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetFontStrikeThrough(OLE_HANDLE hObject, BOOL bFontStrikeThrough, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Applies or removes the strike-through (a line through the middle of the text), of one or more annotation objects.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnGetFontBold method, AnnSetFontBold method, AnnSetFontName method, AnnGetFontName method, AnnSetFontSize method, AnnGetFontSize method, AnnSetFontUnderline method, AnnGetFontUnderline method, AnnGetFontStrikeThrough method, AnnSetFontItalic method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetFontStrikeThrough
hObject

Handle to the annotation object.


bFontStrikeThrough Parameter For AnnSetFontStrikeThrough
bFontStrikeThrough

Flag that indicates whether to apply or remove the strike-through. Possible values are:

Value	Meaning

TRUE	Apply a strike-through

FALSE	Remove the strike-through.


bSelected Parameter For AnnSetFontStrikeThrough
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetFontStrikeThrough
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetFontUnderline method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetFontUnderline(OLE_HANDLE hObject, BOOL bFontUnderline, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Applies or removes the underline of one or more annotation objects.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnGetFontBold method, AnnSetFontBold method, AnnSetFontName method, AnnGetFontName method, AnnSetFontSize method, AnnGetFontSize method, AnnGetFontUnderline method, AnnSetFontStrikeThrough method, AnnGetFontStrikeThrough method, AnnSetFontItalic method, AnnGetFontItalic method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetFontUnderLine
hObject

Handle to the annotation object.


bFontUnderline Parameter For AnnSetFontUnderLine
bFontUnderline

Flag that indicates whether to apply or remove an underline. Possible values are:

Value	Meaning

TRUE	Underline the text.

FALSE	Remove the underline from the text.


bSelected Parameter For AnnSetFontUnderLine
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetFontUnderLine
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetForeColor method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetForeColor(OLE_HANDLE hObject, OLE_COLOR ForeColor, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the foreground color of one or more annotation objects.

Use the Windows COLORREF data type to specify the color. For example, use the Pixel property or the Windows RGB macro to get a color value.

To see how the foreground color relates to the fill modes, refer to Illustration of Fill Options for Annotations.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnGetForeColor method, AnnSetBackColor method, AnnGetBackColor method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetForeColor
hObject

Handle to the annotation object.


ForeColor Parameter For AnnSetForeColor
ForeColor

The COLORREF value that specifies the foreground color.


bSelected Parameter For AnnSetForeColor
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetForeColor
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetGaugeLength method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetGaugeLength(OLE_HANDLE hObject, float fGaugeLength, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the length of the gauge (the perpendicular lines at the ends of the Ruler object).

The gauge length property applies only to Automation and Ruler objects. For more information, refer to Annotation Automation Object and Ruler Annotation Object.

fGaugeLength is expressed in pixels, not in points. The length is for the whole line, not just from the end point of the ruler to the end point of the gauge - it is from one end of the gauge to the other end of the gauge.

See Also

Elements	AnnGetUnit method, AnnSetBitmapDpiX method, AnnGetBitmapDpiX method, AnnGetBitmapDpiY method, AnnSetBitmapDpiY method, AnnSetUnit method, AnnGetDistance method, AnnGetGaugeLength method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetGaugeLength
hObject

Handle to the annotation automation object.


fGaugeLength Parameter For AnnSetGaugeLength
fGaugeLength

The new length of the ruler object's gauge.


bSelected Parameter For AnnSetGaugeLength
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetGaugeLength
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetGrouping method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetGrouping (OLE_HANDLE hObject, BOOL bAutoGroup, short iFlags);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the grouping of the objects within the specified container.

This method is valid only for container objects.

Each container contains a "grouping" property, which indicates whether the objects in the container should be treated as a group.

See Also

Elements	AnnGetGrouping method, AnnGroup method, AnnUngroup method

Topics	Annotations (Document/Medical only): Object Manipulation
Grouping and Ungrouping Annotation Objects


hObject Parameter For AnnSetGrouping
hObject

Handle to a container object.


iFlags Parameter For AnnSetGrouping
iFlags

Flags that determine which objects to process. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR ( | ). The following are valid values:

Value	Meaning

0	Process only the specified object.

ANNFLAG_SELECTED	[0x0001] Process only objects that have the selected property set to TRUE. To get a list of selected objects, use the AnnGetSelectList method.

ANNFLAG_NOTTHIS	[0x0004] Process only one level of objects within the specified container, not the container itself. If there are containers within the container, they are modified, but the objects within them are not.

ANNFLAG_RECURSE	[0x0008] Process objects within a container, and within any subcontainers, down to any level.

ANNFLAG_NOTCONTAINER	[0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves.


bAutoGroup Parameter For AnnSetGrouping
bAutoGroup

Flag that indicates whether or not to group the objects in a container.  Possible values are:

Value	Meaning

TRUE	All objects in the container are to be grouped.

FALSE	Each object in the container can be modified and selected independently.


Return for AnnSetGrouping
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetHyperlinkMsg method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnSetHyperlinkMsg (OLE_HANDLE hObject, short uType, long lParam1, long lParam2, long lParam3, long lParam4, long lParam5);

Overview	Refer to Implementing Annotation Hyperlinks.

Remarks

(Document/Medical only) Annotations may be hyperlinked to run a program, access a Web page, or send a user defined message to the AnnHyperlink event.  This method creates a hyperlink from an annotation to the AnnHyperlink event with either no parameters or five parameters, depending on uType.

See Also

Elements	AnnSetHyperlinkString method

Topics	Annotations (Document/Medical only): Annotation Hyperlinks


hObject Parameter For AnnSetHyperlinkMsg
hObject

Handle to the annotation object.


uType Parameter For AnnSetHyperlinkMsg
uType

Value indicating the type of hyperlink.  Possible values are:

ANNLINK_NONE	(0) means that the object has no hyperlink

ANNLINK_ANNEVENT	(1) means that AnnHyperlink event will be sent with no parameters

ANNLINK_ANNEVENT5	(2) means that AnnHyperlink event will be sent with 5 parameters


lParam1 Parameter For AnnSetHyperlinkMsg
lParam1

First parameter to AnnHyperlink event.


lParam2 Parameter For AnnSetHyperlinkMsg
lParam2

Second parameter to AnnHyperlink event.


lParam3 Parameter For AnnSetHyperlinkMsg
lParam3

Third parameter to AnnHyperlink event.


lParam4 Parameter For AnnSetHyperlinkMsg
lParam4

Fourth parameter to AnnHyperlink event.


lParam5 Parameter For AnnSetHyperlinkMsg
lParam5

Fifth parameter to AnnHyperlink event.


Return for AnnSetHyperlinkMsg
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetHyperlinkString method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnSetHyperlinkString (OLE_HANDLE hObject, short uType, BSTR pszHyperlink);

Overview	Refer to Implementing Annotation Hyperlinks.

Remarks

(Document/Medical only) Annotations may be hyperlinked to run a program, access a Web page, or send a user defined message to the AnnHyperlink event.  This method sets the string containing the name of the program, with all required command line parameters, or the URL of the Web page.

See Also

Elements	AnnSetHyperlinkMsg method, AnnGetHyperlinkString method, AnnGetHyperlinkType method

Topics	Annotations (Document/Medical only): Annotation Hyperlinks


hObject Parameter For AnnSetHyperlinkString
hObject

Handle to the annotation object.


uType Parameter For AnnSetHyperlinkString
uType

Value indicating the type of hyperlink set.  Possible values are:

ANNLINK_NONE	(0) means that the object has no hyperlink

ANNLINK_RUN	(3) that a program will be run

ANNLINK_WEBPAGE	(4) that the default browser will be instructed to go to the specified web page.


pszHyperlink Parameter For AnnSetHyperlinkString
pszHyperlink

String containing the name of a program, with all required command line parameters, or the URL of a web page.  For uType 3, pszHyperlink is the program to run with its command line parameters.  For uType 4, pszHyperlink is the web URL. If you have a web page link, the default web browser will be run and instructed to go to that web page.


Return for AnnSetHyperlinkString
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetLineStyle method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetLineStyle(OLE_HANDLE hObject, short nLineStyle, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the line style of one or more annotation objects.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnSetLineWidth method, AnnGetLineWidth method, AnnGetLineStyle method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetLineStyle
hObject

Handle to the annotation object.


nLineStyle Parameter For AnnSetLineStyle
nLineStyle

The constant that specifies the line style. Possible line style values are:

Value	Meaning

ANNLINE_SOLID	[0] Solid line

ANNLINE_DASH	[1] Dashed line

ANNLINE_DOT	[2] Dotted line

ANNLINE_DASHDOT	[3] Dash dot line

ANNLINE_DASHDOTDOT	[4] Dash dot dot line

ANNLINE_NULL	[5] No line

Note:	Windows displays all lines greater than 1 pixel as solid.

To see the possible line styles, refer to Illustration of Line Styles for Annotations.


bSelected Parameter For AnnSetLineStyle
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetLineStyle
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetLineWidth method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetLineWidth(OLE_HANDLE hObject, float fLineWidth, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the unscaled line width of one or more annotation objects.

The line width of an object is relative to its container object, and the value is interpreted using the container's scaling factors. For example, suppose you want the line to be three pixels wide on your screen using the current scaling factors. You would use the following calculation, where A is the desired width of three pixels, B is the value that you get from the AnnGetScalarX method, and C is the value that you get from the AnnGetScalarY method:

fLineWidth = A / sqrt( B * C )

For more information, refer to Low-Level Coordinate System for Annotations.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnGetLineWidth method, AnnSetLineStyle method, AnnGetLineStyle method

Topics	Annotations (Document/Medical only): Object Manipulation


Return for AnnSetLineWidth
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


hObject Parameter For AnnSetLineWidth
hObject

Handle to the annotation object.


fLineWidth Parameter For AnnSetLineWidth
fLineWidth

The unscaled line width of an object, relative to its container object. The width is interpreted using the container's scaling factors, which are described in Low-Level Coordinate System for Annotations.


bSelected Parameter For AnnSetLineWidth
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


AnnSetMetafile method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetMetafile(OLE_HANDLE hObject, OLE_HANDLE hMetafile, short nType, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the metafile for a stamp object.

Only stamp objects, hotspot objects, and freehand hotspot objects can have metafiles. Note that for stamps, setting the metafile destroys the stamp object’s bitmap and text. Also, setting a bitmap or text destroys the metafile associated with the stamp object. (The stamp object can have Text, Bitmap or Metafile and each of these cancels the other two).

If nType == ANNMETAFILE_USER, then hMetafile is the metafile handle. Any of the windows functions may be used to create a metafile.

If nType is one of the ANNMETAFILE_XXX values, then hMetafile is ignored and the default metafiles are used instead. The annotation DLL has 25 predefined metafiles.  Change the predefined metafiles by using AnnSetPredefinedMetafile method.

See Also

Elements	AnnGetMetafile method, AnnSetPredefinedMetafile method, AnnGetPredefinedMetafile method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetMetafile
hObject

Handle to the annotation object.


hMetafile Parameter For AnnSetLineWidth
hMetafile

Handle to a metafile.


nType Parameter For AnnSetMetafile
nType

Constant that indicates the metafile to set. Possible values are:

Value	Meaning

ANNMETAFILE_USER	[0x7FFF] User-defined metafiles

ANNMETAFILE_APPROVED	[0] Predefined metafiles - APPROVED

ANNMETAFILE_ASSIGNED	[1] Predefined metafile - ASSIGNED

ANNMETAFILE_CHECKED	[2] Predefined metafile -CHECKED

ANNMETAFILE_CLATPRV	[3] Predefined metafile - CLIENT ATTORNEY PRIVILEGE

ANNMETAFILE_COPY	[4] Predefined metafile - COPY

ANNMETAFILE_DRAFT	[5] Predefined metafile - DRAFT

ANNMETAFILE_EXTENDED	[6] Predefined metafile - EXTENDED

ANNMETAFILE_FAX	[7] Predefined metafile - FAX

ANNMETAFILE_FAXED	[8] Predefined metafile - FAXED

ANNMETAFILE_IMPORTANT	[9] Predefined metafile - IMPORTANT

ANNMETAFILE_INVOICE	[10] Predefined metafile - INVOICE

ANNMETAFILE_NOTICE	[11] Predefined metafile - NOTICE

ANNMETAFILE_OFFICIAL	[12] Predefined metafile - OFFICIAL

ANNMETAFILE_ONFILE	[13] Predefined metafile - ON FILE

ANNMETAFILE_PAID	[14] Predefined metafile - PAID

ANNMETAFILE_PASSED	[15] Predefined metafile - PASSED

ANNMETAFILE_PENDING	[16] Predefined metafile - PENDING

ANNMETAFILE_PROCESSED	[17] Predefined metafile - PROCESSED

ANNMETAFILE_RECEIVED	[18] Predefined metafile - RECEIVED

ANNMETAFILE_REJECTED	[19] Predefined metafile - REJECTED

ANNMETAFILE_RELEASE	[20] Predefined metafile - RELEASE

ANNMETAFILE_SENT	[21] Predefined metafile - SENT

ANNMETAFILE_SHIPPED	[22] Predefined metafile - SHIPPED

ANNMETAFILE_TOPSECRET	[23] Predefined metafile - TOP SECRET

ANNMETAFILE_URGENT	[24] Predefined metafile - URGENT

ANNMETAFILE_VOID	[25] Predefined metafile – VOID

ANNMETAFILE_HOTSPOT	[26] Predefined metafile for Hotspot and Freehand Hotspot


bSelected Parameter For AnnSetMetafile
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetMetafile
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetNameOffsetX method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetNameOffsetX (OLE_HANDLE hObject, long NameOffsetX, boolean bSelected);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Document/Medical only) Sets the X-coordinate of the name offset of the specified annotation object.

The name offset of an annotation object is an offset that is relative to the upper left corner of the bounding box of the annotation.  The name offset coordinates are in pixels, where the image is viewed at 100%.  The name offset can be changed by:

1.	Calling the AnnSetNameOffsetX or AnnSetNameOffsetY methods.

2.	Right-clicking the object in design-mode, selecting Name Properties, setting the NameOffset using the text box, and clicking "Apply.

3.	Clicking on the object name in design-mode and dragging it to a new location.

When an object is created in automation mode, the newly created object will have the same name restrictions that the automation object had. That is, if the name of the automation object is restricted, the name of the newly created object is restricted. If the name of the automation object was not restricted, then the name of the newly created object will not be restricted.

See Also

Elements	AnnSetName method, AnnGetName method, AnnGetNameRestrict method, AnnSetNameRestrict method, AnnGetNameOffsetX method, AnnGetNameOffsetY method, AnnSetNameOffsetY method

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnSetNameOffsetX
hObject

Handle to the annotation object.


NameOffsetX Parameter For AnnSetNameOffsetX
NameOffsetX

X-offset to set for the name of the annotation object specified in hObject.


bSelected Parameter For AnnSetNameOffsetX
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetNameOffsetX
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetNameOffsetY method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetNameOffsetY (OLE_HANDLE hObject, long NameOffsetY, boolean bSelected);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Document/Medical only) Sets the Y-coordinate of the name offset of the specified annotation object.

The name offset of an annotation object is an offset that is relative to the upper left corner of the bounding box of the annotation.  The name offset coordinates are in pixels, where the image is viewed at 100%.  The name offset can be changed by:

1.	Calling the AnnSetNameOffsetX or AnnSetNameOffsetY methods.

2.	Right-clicking the object in design-mode, selecting Name Properties, setting the NameOffset using the text box, and clicking "Apply.

3.	Clicking on the object name in design-mode and dragging it to a new location.

When an object is created in automation mode, the newly created object will have the same name restrictions that the automation object had. That is, if the name of the automation object is restricted, the name of the newly created object is restricted. If the name of the automation object was not restricted, then the name of the newly created object will not be restricted.

See Also

Elements	AnnSetName method, AnnGetName method, AnnGetNameRestrict method, AnnSetNameRestrict method, AnnGetNameOffsetX method, AnnGetNameOffsetY method, AnnSetNameOffsetX method

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnSetNameOffsetY
hObject

Handle to the annotation object.


NameOffsetY Parameter For AnnSetNameOffsetY
NameOffsetY

Y- offset to set for the name of the annotation object specified in hObject.


bSelected Parameter For AnnSetNameOffsetY
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetNameOffsetY
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetNameRestrict method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetNameRestrict (OLE_HANDLE hObject, boolean bNameRestrict, boolean bSelected);

Overview	Refer to Moving the Name of an Annotation.

Remarks

(Document/Medical only) Sets a value that determines whether the name of the specified annotation object is restricted. If the name of an annotation object is restricted, the name will fully appear on the bitmap. If the name is not restricted, part of the name may appear on the bitmap while other parts do not.

For example, if the name of an annotation object has been restricted by calling the AnnSetNameRestrict method with the bNameRestrict parameter set to TRUE, the name offset cannot be set so that the object name is outside the bitmap (annotation container). The name offset is set by calling the AnnSetNameOffsetX method and the AnnSetNameOffsetY method. To determine the current offset, call the AnnGetNameOffsetX method and the AnnGetNameOffsetY method.

For example, consider a 200 x 200 bitmap that has a 100 x 100 button in the lower right corner and the name of the button is "Button". Attempting to set the name offset to anything larger than (43,100) will result in the name offset being set to (43,100) anyway.  In addition, dragging the annotation object itself in such a way that would cause the object name to be moved outside the bitmap will cause the name offset to change.

The restriction on an object name can be changed by:

1.	Calling the AnnSetNameRestrict method.

2.	Right-clicking the object in design-mode, selecting Name Properties, setting the NameRestrict check box, and clicking "Apply.

When an object is created in automation mode, the newly created object will have the same name restrictions that the automation object had. That is, if the name of the automation object is restricted, the name of the newly created object is restricted. If the name of the automation object was not restricted, then the name of the newly created object will not be restricted.

See Also

Elements	AnnSetName method, AnnGetName method, AnnGetNameRestrict method, AnnGetNameOffsetX method, AnnGetNameOffsetY method, AnnSetNameOffsetX method, AnnSetNameOffsetY method

Topics	Annotations (Document/Medical only):Object Manipulation


hObject Parameter For AnnSetNameRestrict
hObject

Handle to the annotation object.


bNameRestrict Parameter For AnnSetNameRestrict
bNameRestrict

Flag that indicates whether to restrict the name of the specified annotation object. Possible values are:

Value	Meaning

TRUE	Restrict the name of the specified annotation object so that it fully appears on the bitmap.

FALSE	Do not restrict the name of the specified annotation object.


bSelected Parameter For AnnSetNameRestrict
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetNameRestrict
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetName method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetName(OLE_HANDLE hObject, BOOL bShowName, LPCTSTR pszName, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the name of the annotation.

See Also

Elements	AnnGetName method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetName
hObject

Handle to the annotation object.


bShowName Parameter For AnnSetName
bShowName

Flag that indicates whether to show the name. Possible values are:

Value	Meaning

TRUE	Show the name of the annotation.

FALSE	Do not show the name of the annotation.


pszName Parameter For AnnSetName
pszName

Character string that contains the name of the annotation.


bSelected Parameter For AnnSetName
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetName
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetNodes method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetNodes(OLE_HANDLE hObject, BOOL bShowNodes, short nGapNodes, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Determines which nodes will be shown for a Polygon, Polyline or Freehand object.

This method can be called only for Polygon, Polyline, Freehand, Freehand Hot Spot, Automation, or Container objects.

If hObject is a Polygon, Polyline, Freehand Hot Spot, or Freehand object, This method determines how the nodes for the object will be displayed in design mode.

If hObject is an Automation object, This method determines how the nodes will be displayed for the next Polygon, Polyline, Freehand Hot Spot, or Freehand object created in automated mode.

If hObject is a Container object, This method determines how the nodes of the Polygons, Polylines, Freehand Hot Spot, or Freehand objects within the container will be displayed.

If bShowNodes is FALSE, nGapNodes will be ignored since the nodes will not be shown anyway.

Note:	The last node is always shown. Therefore, using a large value for nGapNodes will probably result in only the first and last nodes being shown.

See Also

Elements	AnnGetNodes method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetNodes
hObject

Handle to the annotation object.


bShowNodes Parameter For AnnSetNodes
bShowNodes

Flag that indicates whether to show the nodes. Possible values are:

Value	Meaning

TRUE	Show the nodes.

FALSE	Do not show the nodes.


nGapNodes Parameter For AnnSetNodes
nGapNodes

The distance between nodes. Use 0 to display all nodes. This value does not represent the distance in pixels. Instead, it refers to the number of nodes to skip before displaying another node. Possible values are:

Value	Meaning

0	Show every node.

1	Show a node, skip a node, show a node …

.

.

.

9	Show a node, skip the next nine, …

.

.

and so on.


bSelected Parameter For AnnSetName
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetNodes
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetOffsetX method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetOffsetX(OLE_HANDLE hObject, float OffsetX, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the X offset of the annotation object. Typically, this value is used to match the root container's offset to the offset of the associated bitmap's display rectangle.

The offset values are applied after the scalar properties, which are set by the AnnSetScalarX and AnnSetScalarY methods. For more information, refer to Low-Level Coordinate System for Annotations.

The value of the AnnContainer property cannot be passed for the hObject parameter.

See Also

Elements	AnnSetScalarX method, AnnSetScalarY method, AnnGetScalarX method, AnnGetScalarY method, AnnSetOffsetY method, AnnGetOffsetY method, AnnGetOffsetX method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnSetOffsetX
hObject

Handle to the annotation object.


OffsetX Parameter For AnnSetOffsetX
OffsetX

The new value of the X offset.


bSelected Parameter For AnnSetOffsetX
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.

Note:	Normally, you set this property only on the root container. The flag is included only to provide the same level of control as with other properties.


Return for AnnSetOffsetX
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetOffsetY method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetOffsetY(OLE_HANDLE hObject, float OffsetY, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the Y offset of the annotation object. Typically, this value is used to match the root container's offset to the offset of the associated bitmap's display rectangle.

The offset values are applied after the scalar properties, which are set by the AnnSetScalarX and AnnSetScalarY methods. For more information, refer to Low-Level Coordinate System for Annotations.

The value of the AnnContainer property cannot be passed for the hObject parameter.

See Also

Elements	AnnSetScalarX method, AnnSetScalarY method, AnnGetScalarX method, AnnGetScalarY method, AnnSetOffsetX method, AnnGetOffsetY method, AnnGetOffsetX method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnSetOffsetY
hObject

Handle to the annotation object.


AnnSetOffsetY Parameter For AnnSetOffsetY
OffsetY

The new value of the Y offset.


bSelected Parameter For AnnSetOffsetY
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.

Note:	Normally, you set this property only on the root container. The flag is included only to provide the same level of control as with other properties.


Return for AnnSetOffsetY
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetPoints method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetPoints(OLE_HANDLE hObject, const VARIANT FAR& vXArray, const VARIANT FAR& vYArray, long lPointCount);

Overview	Refer to Point Annotation Object.

Remarks

(Document/Medical only) Defines the shape of an annotation object, such as a polygon, that requires multiple points.

Coordinates of an object's points are relative to its container object. The coordinates are interpreted using the container's scaling factors and offsets, which are described in Low-Level Coordinate System for Annotations.

For annotation objects that are defined by a rectangle, use the AnnRect... properties.

You can position a Point object using the following (VB):

   ReDim x(1) As Single, y(1) As Single
   x(1) = 100
   y(1) = 200
   LEAD1.AnnSetPoints hPoint, x, y, 1
   ' where x,y contain the desired position.

To set the points of a cross-product object, do the following:

   ReDim x(5) As Single, y(5) As Single
   ' Assign values for x and y from 1 through 5
   LEAD1.AnnSetPoints hXproduct, x, y, 5

hXproduct is the handle to the cross-product object. x(1),y(1) and x(2),y(2) are the points for the primary ruler. x(3),y(3) is the intersection point. x(4),y(4) and x(5),y(5) are the points for the secondary ruler.

To set the points of a protractor object, do the following:

   ReDim x(3) As Single, y(3) As Single
   ' Assign values for x and y from 1 through 3
   LEAD1.AnnSetPoints hProtractor, x, y, 3

hProtractor is the handle to the protractor object. x(1),y(1) and x(3),y(3) are the endpoints for the two rulers. x(2),y(2) is the intersection point. This is shown below:

See Also

Elements	AnnBringToFront method, AnnSendToBack method, AnnRectHeight property, AnnRectLeft property, AnnRectTop property, AnnRectWidth property, AnnBoundingRectTop property, AnnBoundingRectLeft property, AnnBoundingRectHeight property, AnnBoundingRectWidth property, AnnGetPointCount method, AnnGetPointX method, AnnGetPointY method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnSetPoints
hObject

Handle to the annotation object.


vXArray Parameter For AnnSetPoints
vXArray

1 dimensional array of float (Single) values that specifies the X-coordinates of the shape of the annotation.


vYArray Parameter For AnnSetPoints
vYArray

1 dimensional array of float (Single) values that specifies the Y-coordinates of the shape of the annotation.


IPointCount Parameter For AnnSetPoints
lPointCount

The number of points in the array that you specify in the vXArray and vYArray parameters.

Call this method once, passing 2 arrays of point coordinates, which must be in the order in which the vertices are connected. To define the line that closes a polygon, the last point in the array is connected to the first point of the array.

Alternatively, use the AnnDefine method to specify the array of points interactively.

AnnSetPoints works only with the following types of objects:

ANNOBJECT_POINTER
ANNOBJECT_FREEHAND
ANNOBJECT_LINE
ANNOBJECT_POLYGON
ANNOBJECT_POLYLINE
ANNOBJECT_POINT
ANNOBJECT_PROTRACTOR
ANNOBJECT_FREEHANDHOTSPOT


Return for AnnSetPoints
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetPolyFillMode method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetPolyFillMode(OLE_HANDLE hObject, short nPolyFillMode, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the value that determines how a polygonal annotation with crossing lines is filled.

This method affects only polygon objects. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnSetFillPattern method, AnnGetFillPattern method, AnnSetFillMode method, AnnGetFillMode method, AnnGetPolyFillMode method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetPolyFillMode
hObject

Handle to the annotation object.


nPolyFillMode Parameter For AnnSetPolyFillMode
nPolyFillMode

The constant that specifies the polygon fill mode. Possible polygon fill mode values are:

Value	Meaning

ANNPOLYFILL_WINDING	[0] All pixels that are inside the resulting exterior lines are filled.

ANNPOLYFILL_ALTERNATE	[1] The filled area includes the area between odd-numbered and even-numbered polygon sides on each scan line.


bSelected Parameter For AnnSetPolyFillMode
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetPolyFillMode
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetPredefinedMetafile method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetPredefinedMetafile(short nType, OLE_HANDLE hMetafile);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Changes a predefined metafile.

This method affects the rubber stamp objects, the hotspot objects and the freehand hotspot objects, created by the automation object. For example, if you replace the ANNMETAFILE_APPROVED default metafile with another metafile, then objects created by the automation mode when the ANNTOOL_STAMP_APPROVED tool is set will look like the new metafile.

A predefined metafile can be reset to it’s original metafile by passing NULL for hMetafile.  For example, to reset the Hotspot and freehand hotspot predefined metafiles to the original value, you would do the following:

AnnSetPredefinedMetafile(ANNMETAFILE_HOTSPOT, 0);

See Also

Elements	AnnGetPredefinedMetafile method, AnnGetMetafile method, AnnSetMetafile method

Topics	Annotations (Document/Medical only): Object Manipulation


nType Parameter For AnnSetPredefinedMetafile
nType

Constant that indicates the metafile to change. Possible values are:

Value	Meaning

ANNMETAFILE_APPROVED	[0] Predefined metafiles - APPROVED

ANNMETAFILE_ASSIGNED	[1] Predefined metafile - ASSIGNED

ANNMETAFILE_CHECKED	[2] Predefined metafile -CHECKED

ANNMETAFILE_CLATPRV	[3] Predefined metafile - CLIENT ATTORNEY PRIVILEGE

ANNMETAFILE_COPY	[4] Predefined metafile - COPY

ANNMETAFILE_DRAFT	[5] Predefined metafile - DRAFT

ANNMETAFILE_EXTENDED	[6] Predefined metafile - EXTENDED

ANNMETAFILE_FAX	[7] Predefined metafile - FAX

ANNMETAFILE_FAXED	[8] Predefined metafile - FAXED

ANNMETAFILE_IMPORTANT	[9] Predefined metafile - IMPORTANT

ANNMETAFILE_INVOICE	[10] Predefined metafile - INVOICE

ANNMETAFILE_NOTICE	[11] Predefined metafile - NOTICE

ANNMETAFILE_OFFICIAL	[12] Predefined metafile - OFFICIAL

ANNMETAFILE_ONFILE	[13] Predefined metafile - ON FILE

ANNMETAFILE_PAID	[14] Predefined metafile - PAID

ANNMETAFILE_PASSED	[15] Predefined metafile - PASSED

ANNMETAFILE_PENDING	[16] Predefined metafile - PENDING

ANNMETAFILE_PROCESSED	[17] Predefined metafile – PROCESSED

ANNMETAFILE_RECEIVED	[18] Predefined metafile - RECEIVED

ANNMETAFILE_REJECTED	[19] Predefined metafile - REJECTED

ANNMETAFILE_RELEASE	[20] Predefined metafile - RELEASE

ANNMETAFILE_SENT	[21] Predefined metafile - SENT

ANNMETAFILE_SHIPPED	[22] Predefined metafile - SHIPPED

ANNMETAFILE_TOPSECRET	[23] Predefined metafile - TOP SECRET

ANNMETAFILE_URGENT	[24] Predefined metafile - URGENT

ANNMETAFILE_VOID	[25] Predefined metafile – VOID

ANNMETAFILE_HOTSPOT	[26] Predefined metafile for Hotspot and Freehand Hotspot


hMetafile Parameter For AnnSetPredefinedMetafile
hMetafile

Handle to the metafile used to replace the specified predefined metafile.  Passing 0 will reset the predefined metafile specified by nType  to its original metafile.


Return for AnnSetPredefinedMetafile
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetProtractorOptions method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetProtractorOptions(OLE_HANDLE hObject, BOOL bAcute, short nUnit, LPCTSTR pszAbbrev, short nPrecision, float fArcRadius, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets various options for a Protractor object.

Note:	This method can be called for Container objects, allowing you to change Protractor objects within the container. The objects to change are determined by the settings in bSelected.

See Also

Elements	AnnGetProtractorOptions method, AnnGetAngle method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetProtractorOptions
hObject

Handle to the annotation object.


bAcute Parameter For AnnSetProtractorOptions
bAcute

Flag that indicates which angle to set. Possible values are:

Value	Meaning

TRUE	Set the acute angle. (<180 degrees)

FALSE	Set the obtuse angle. (>180 degrees)


nUnit Parameter For AnnSetNodes
nUnit

Flag that indicates the units of the angle. Possible values are:

Value	Meaning

ANNANGLE_DEGREES	Measure the angle in degrees.

ANNANGLE_RADIANS	Measure the angle in radians.

Either of the above values can be combined with ANNANGLE_DEF_ABBR [0x4000] to restore the default unit abbreviation.


pszAbbrev Parameter For AnnSetProtractorOptions
pszAbbrev

Character string that contains the abbreviation to be put after the angle. Use NULL to set the default abbreviation for the specified unit.

To get the default abbreviations for the current angle unit, add ANNANGLE_DEF_ABBR [0x4000] to the unit value passed in nUnit. In this case, pszAbbrev will be ignored.


nPrecesion Parameter For AnnSetProtractorOptions
nPrecision

The number of digits after the decimal. ( "." ) Valid values are 0 – 200.


fArcRadius Parameter For AnnSetProtractorOptions
fArcRadius

The arc radius.


bSelected Parameter For AnnSetProtractorOptions
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetProtractorOptions
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetROP2 method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetROP2(OLE_HANDLE hObject, short nROP2, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the ROP code of one or more annotation objects.

AnnSetROP2 can turn a simple rectangle into a hilite-type object. This is the only way to have a hilite object that has different colors for border and interior. To do that, draw a rectangle with a thick border, choose different foreground and background colors (AnnSetForeColor method and AnnSetBackColor method), and call this method with uROP2 set to ANNROP2_AND.

AnnSetROP2 is valid only for the following object types:

ANNOBJECT_POINTER,
ANNOBJECT_ELLIPSE,
ANNOBJECT_FREEHAND,
ANNOBJECT_LINE,
ANNOBJECT_POLYGON,
ANNOBJECT_POLYLINE,
ANNOBJECT_RECT,
ANNOBJECT_AUTOMATION,
ANNOBJECT_STAMP,

Note that AnnSetROP2 and AnnSetFillMode affect each other. If you set nFillMode to ANNMODE_OPAQUE, then nROP2 cannot be ANNROP2_AND. If you set nFillMode to ANNMODE_TRANSLUCENT, then nROP2 has to be ANNROP2_AND. If you set nFillMode to ANNMODE_TRANSPARENT, nROP2 can be anything.

See Also

Elements	AnnGetROP2 method, AnnGetFillMode method, AnnSetFillMode method, AnnSetBackColor method, AnnSetForeColor method, AnnGetSelected method, AnnSetSelected method, AnnGetTransparent method, AnnSetTransparent method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetROP2
hObject

Handle to the annotation object.


nROP2 Parameter For AnnSetROP2
nROP2

Constant that specifies the ROP code for one or more objects.  Possible ROP code values are:

Value	Meaning

ANNROP2_COPY	[0x0000] Draw the object using the object's color.

ANNROP2_AND	[0x0001] Draw the object, performing an AND between the object's color and the background color. This creates a highlight effect. White objects become transparent.

ANNROP2_XOR	[0x0002] Draw the object, performing an XOR between the object's color and the background color. This creates an inverted effect. Black objects become transparent.

Default is ANNROP2_COPY.


bSelected Parameter For AnnSetROP2
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetROP2
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetScalarX method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetScalarX(OLE_HANDLE hObject, float fScalarX, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the horizontal scaling factor that is applied to the annotation object. Typically, the scaling factors are applied to a root container so that the annotations will match the displayed image.

Offset values, which are set by the AnnSetOffsetX and AnnSetOffsetY methods, are applied after the scalar properties. For more information, refer to Low-Level Coordinate System for Annotations.

The value of the AnnContainer property cannot be passed for the hObject parameter.

See Also

Elements	AnnSetScalarY method, AnnGetScalarX method, AnnGetScalarY method, AnnSetOffsetX method, AnnSetOffsetY method, AnnGetOffsetY method, AnnGetOffsetX method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnSetScalarX
hObject

Handle to the annotation object.


fScalarX Parameter For AnnSetScalarX
fScalarX

The horizontal scaling factor to apply.


bSelected Parameter For AnnSetScalarX
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.

Note:	Normally, you set this property only on the root container. The flag is included only to provide the same level of control as with other properties.


Return for AnnSetScalarX
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetScalarY method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetScalarY(OLE_HANDLE hObject, float fScalarY, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the vertical scaling factor that is applied to the annotation object. Typically, the scaling factors are applied to a root container so that the annotations will match the displayed image.

Offset values, which are set by the AnnSetOffsetX and AnnSetOffsetY methods, are applied after the scalar properties. For more information, refer to Low-Level Coordinate System for Annotations.

The value of the AnnContainer property cannot be passed for the hObject parameter.

See Also

Elements	AnnSetScalarX method, AnnGetScalarX method, AnnGetScalarY method, AnnSetOffsetX method, AnnSetOffsetY method, AnnGetOffsetY method, AnnGetOffsetX method

Topics	Annotations (Document/Medical only): Automation


hObject Parameter For AnnSetScalarY
hObject

Handle to the annotation object.


fScalarY Parameter For AnnSetScalarY
fScalarY

The vertical scaling factor to apply.


bSelected Parameter For AnnSetScalarY
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.

Note:	Normally, you set this property only on the root container. The flag is included only to provide the same level of control as with other properties.


Return for AnnSetScalarY
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetSecondaryBitmap method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetSecondaryBitmap(OLE_HANDLE hObject, OLE_HANDLE hBitmap, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the secondary bitmap used by the specified annotation object.

Only PushPin objects use a secondary bitmap.

A pushpin object has a primary bitmap, (manipulated using AnnSetBitmap method/AnnGetBitmap method) when the text is shown, and a secondary bitmap, changed using AnnSetSecondaryBitmap. The primary bitmap is shown with the note text. The secondary bitmap is shown by itself when the note is minimized.

In design mode, the PushPin object shows the text and displays the primary bitmap. In run mode, the object shows/hides the text when clicked. The pushpin object has the active mode property. When the mode is ANNACTIVE_ENABLED, the text is shown and the primary bitmap is painted in the top-left corner of the note.

When the mode is ANNACTIVE_DISABLED, the text is hidden and the secondary bitmap is displayed.

See Also

Elements	AnnGetSecondaryBitmap method

Topics	Annotations (Document/Medical only): Object Bitmap


hObject Parameter For AnnSetSecondaryBitmap
hObject

Handle to the annotation object.


hBitmap Parameter For AnnSetSecondaryBitmap
hBitmap

Handle to the bitmap to be set as the secondary bitmap.


bSelected Parameter For AnnSetSecondaryBitmap
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetSecondaryBitmap
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetSelected method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetSelected (OLE_HANDLE hObject, BOOL bValue, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Sets the Selected property for one or more annotation objects.

See Also

Elements	AnnCreate method, AnnDefine, AnnDestroy method, AnnGetVisible method, AnnInsert method, AnnSetAutoDefaults method, AnnSetVisible method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetSelected
hObject

Handle to an annotation object.


bValue Parameter For AnnSetSelected
bValue

Flag that indicates whether to select or deselect hObject. Possible values are:

Value	Meaning

TRUE	Select the specified object and all objects that it contains.

FALSE	Deselect the object and all objects that it contains.


bSelected Parameter For AnnSetSelected
bSelected

Flag that indicates whether to change the selection status for the selected objects only, or for all objects. This value is valid only if hObject is a container object. Possible values are:

Value	Meaning

TRUE	Change the selection status of those objects within the container that have their Selected property set.

FALSE	Change the selection status for all objects. This is comparable to setting iFlags to ANNFLAG_NOTCONTAINER|ANNFLAG_RECURSE.


Return for AnnSetSelected
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetShowFlags method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetShowFlags(OLE_HANDLE hObject, short nShowFlags, BOOL bSelected);

Overview	Refer to Crossproduct Annotation Object.

Remarks

(Document/Medical only) Determines how the rulers will be displayed.

This method can be called for Ruler, Cross-Product, Protractor and Automation objects.

For Protractor objects, the default value for nShowFlags is 0. For Ruler and Cross-Product objects. The default value for nShowFlags is ANNSHOW_LENGTH | ANNSHOW_GAUGE.

See Also

Elements	AnnGetShowFlags method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetShowFlags
hObject

Handle to the annotation object.


nShowFlags Parameter For AnnSetShowFlags
nShowFlags

Flag that indicates how to display the rulers. Possible values are:

Value	Meaning

0	Display neither the ruler length or the ruler gauge.

ANNSHOW_LENGTH	Display the ruler length.

ANNSHOW_GAUGE	Display the ruler gauge.


bSelected Parameter For AnnSetShowFlags
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetShowFlags
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetTag method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnSetTag (OLE_HANDLE hObject, long iTag);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Assigns a numeric tag to identify an annotation object. You can use the AnnGetTag method to get the tag.

You can use these two methods to keep track of particular objects such as buttons or hot spots over time.

When you load a file, an AnnCreate event is generated for each annotation object. You can add code in this event to see which tags are already used in a file.

See Also

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetTag
hObject

Handle to the annotation object.


iTag Parameter For AnnSetTag
iTag

The numeric tag to be assigned to the object.


Return for AnnSetTag
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetText method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetText(OLE_HANDLE hObject, LPCTSTR pszText, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the text (character string) of one or more annotation objects.

This method does not affect objects that do not have this property or that do not let you change the property. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

See Also

Elements	AnnGetText method, AnnGetAutoText method, AnnSetAutoText method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetText
hObject

Handle to the annotation object.


pszText Parameter For AnnSetText
pszText

The character string to assign to the annotation object.


bSelected Parameter For AnnSetText
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetText
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetTransparent method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetTransparent(OLE_HANDLE hObject, BOOL bTransparent, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets one or more bitmap stamp objects to use white as a transparent color.

Only bitmap stamps can be transparent.  In transparent stamps, all the white pixels are considered transparent.  In order for the transparent bitmaps to be painted properly the LTEFX14N.DLL needs to be present for WIN32. If the appropriate DLL is not present, the transparent bitmap stamps will be painted as non-transparent bitmap stamps.

When this method is applied to an automation object, it indicates whether the next stamp created will be transparent.

When an object has a bitmap with a region and the object is transparent, the inside of the region is considered non-transparent. If the bitmap has no region, and the object is transparent, a region is created from all non-white pixels, so the white pixels are considered transparent.

See Also

Elements	AnnGetTransparent method, AnnGetSelected method, AnnSetSelected method, AnnGetROP2 method, AnnSetROP2 method

Topics	Annotations (Document/Medical only): Object Bitmap


hObject Parameter For AnnSetTransparent
hObject

Handle to the annotation object.


bTransparent Parameter For AnnSetTransparent
bTransparent

Flag that indicates whether to make the bitmap transparent. Possible values are:

Value	Meaning

TRUE	Make the bitmap transparent

FALSE	Do not make the bitmap transparent. This is the default.


bSelected Parameter For AnnSetTransparent
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetTransparent
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetTransparentColor method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetTransparentColor(OLE_HANDLE hObject, OLE_COLOR crTransparent, BOOL bSelected);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets the transparent color.

The standard Windows values for COLORREF represent either red, green, and blue color values, or an index into the bitmap's palette.  A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value.  If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette which holds the color value.  These COLORREF values can be used with any Windows function and macro that takes a COLORREF parameter.

In the Document/Medical Imaging editions, the COLORREF value may represent a 16 bit grayscale value if pBitmap is a 12 or 16-bit grayscale bitmap.  So that the value is not confused with an RGB value, the COLORREF_GRAY16 mask (0x04000000) is set.  In this case (0x0400YYYY), the lower 16 bits (0xYYYY) of the COLORREF value represent the 16-bit grayscale value. (0x0400FFFF is 16-bit white and 0x04000000is 16-bit black.) This is not a standard Windows value.  Therefore, LEADTOOLS functionality will recognize a COLORREF having this format, but Windows functions will not. For information on how to use a 16-bit grayscale COLORREF in a non-LEADTOOLS functionality, refer to Converting 16-bit Grayscale Values.

Only stamp objects and point objects that have a bitmap will use the transparent color.

This transparent color is used only if the object is set to transparent using AnnSetTransparent method.

By default, the transparent color is white (0x00FFFFFF).

If hObject is a container object, then bSelected indicates which objects to process. If hObject is an automation object, all objects created by this automation object will have this transparent color.

In design mode, the transparent color can be picked by selecting the Transparent color from the properties menu. If the object’s bitmap has a palette, a dialog box will come up allowing you to select a color from the palette colors. If the object’s bitmap does not have a palette, the standard Windows color pick dialog box is used to select a transparent color.

See Also

Elements	AnnGetTransparentColor method, AnnSetTransparent method

Topics	Annotations (Document/Medical only): Object Bitmap


hObject Parameter For AnnSetTransparentColor
hObject

Handle to the annotation object.


crTransparent Parameter For AnnSetTransparentColor
crTransparent

The fill color.


bSelected Parameter For AnnSetTransparentColor
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetTransparentColor
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetUnit method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetUnit(OLE_HANDLE hObject, short nUnit, LPCTSTR pszUnitAbbrev, short nPrecision, BOOL bSelected);

Overview	Refer to Ruler Annotation Object.

Remarks

(Document/Medical only) Sets the unit of measurement for the Ruler object.

Only Automation and Ruler objects are affected. For more information, refer to Annotation Automation Object or Ruler Annotation Object.

See Also

Elements	AnnGetUnit method, AnnSetGaugeLength method, AnnSetBitmapDpiX method, AnnGetBitmapDpiX method, AnnGetBitmapDpiY method, AnnSetBitmapDpiY method, AnnGetDistance method, AnnGetGaugeLength method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetUnit
hObject

Handle to the annotation automation object.


nUnit Parameter For AnnSetUnit
nUnit

The unit of measure of the ruler. Possible values are:

Value	Meaning

ANNUNIT_INCHES	[0x0000] inches

ANNUNIT_FEET	[0x0001] feet

ANNUNIT_YARDS	[0x0002] yards

ANNUNIT_MICROMETERS	[0x0003] micrometers

ANNUNIT_MILIMETERS	[0x0004] millimeters

ANNUNIT_CENTIMETERS	[0x0005] centimeters

ANNUNIT_METERS	[0x0006] meters

ANNUNIT_TWIPS	[0x0007] twips

ANNUNIT_POINTS	[0x0008] points

ANNUNIT_PIXELS	[0x0009] pixels

Any of the above values can be combined with ANNUNIT_DEF_ABBR [0x4000] to restore the default unit abbreviation.


pszUnitAbbrev Parameter For AnnSetUnit
pszUnitAbbrev

Address of the character string containing the unit abbreviation string to be displayed after the distance.  To get the default abbreviations for the current unit of measurement, add ANNUNIT_DEF_ABBR [0x4000] to unit value passed in nUnit. In this case, pszUnitAbbrev will be ignored.


nPrecision Parameter For AnnSetUnit
nPrecision

Number of digits to be displayed after the decimal place. Valid values are 0 – 200.


bSelected Parameter For AnnSetUnit
bSelected

Flag that indicates whether to process only the selected objects or all objects. Possible values are:

Value	Meaning

TRUE	Process only the selected objects.

FALSE	Process all objects.


Return for AnnSetUnit
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetUser method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetUser (OLE_HANDLE hObject, BSTR pOldUser, BSTR pNewUser, BOOL bSelected);

Overview	Refer to Implementing Annotation Security.

Remarks

(Document/Medical only)  Sets the user string for the specified object.

If the specified object does not have a specified user, set pOldUser to NULL and set pNewUser to the new user string.

To change an object’s user, set pOldUser to the old user string and set pNewUser to the new user string. For any object having a specified user, you must know the old user string in order to change the user.

You can change an object from having a specified user to having no user by setting pOldUser to the old user string and setting pNewUser to NULL.

Please note that when using bSelected to change the user on more than one object, only those objects with a user set to pOldUser will be changed. For example, if you set pOldUser to "YourObject" and set pNewUser to "MyObject", and set bSelected to TRUE, only those objects having user "YourObject" will be changed. Objects with other users, or with NULL users will not be modified.

See Also

Elements	AnnLock method, AnnLocked event, AnnUnlocked event, AnnUnlock method

Topics	Annotations (Document/Medical only): Annotation Security


hObject Parameter For AnnSetUser
hObject

Handle to the annotation object.


pOldUser Parameter For AnnSetUser
pOldUser

String that contains the old user string.


pNewUser Parameter For AnnSetUser
pNewUser

String that contains the new user string.


bSelected Parameter For AnnSetUser
bSelected

Flag that indicates whether to process only objects with their Selected property set, or process all objects within the container. This value is valid only for container objects. Possible values are:

Value	Meaning

TRUE	Process only those objects in the container with the Selected property set.

FALSE	Process all objects within the container.


Return for AnnSetUser
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetVisible method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetVisible (OLE_HANDLE hObject, BOOL bVisible, short iFlags, BSTR pUserList);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  When an object is not visible, it cannot be displayed. Some objects (notably containers) may be transparent, but if their visible-object property is TRUE, a user can select them with a mouse.

This method applies to multiple and selected objects based on values of the iFlags parameter.

To make objects belonging to a user visible, you must set ANNFLAG_USER in iFlags, pass the user name in pUserList, and set bVisible to TRUE.

See Also

Elements	AnnCreate method, AnnDefine, AnnDestroy method, AnnGetVisible method, AnnInsert method, AnnSetAutoDefaults method, AnnSetSelected method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnSetVisible
hObject

Handle to the annotation object.


bVisible Parameter For AnnSetVisible
bVisible

Flag that indicates whether to make the object or objects visible or invisible. Possible values are:

Value	Meaning

TRUE	Make the object or objects visible.

FALSE	Make the object or objects invisible.


iFlags Parameter For AnnSetVisible
iFlags

Flag that indicates the objects to process. Use 0 if hObject is not a container.

If hObject is a container, you can use 0 (process only hObject), or you can combine some of the values given below, using a bitwise OR. For example, ANNFLAG_SELECTED | ANNFLAG_RECURSE processes only the selected objects.

Value	Meaning

0	Process only the specified object.

ANNFLAG_SELECTED	[0x0001] Process only objects that have the selected property set to TRUE. To get a list of selected objects, use the AnnGetSelectList method.

ANNFLAG_NOTTHIS	[0x0004] Process only one level of objects within the specified container, not the container itself. If there are containers within the container, they are modified, but the objects within them are not.

ANNFLAG_RECURSE	[0x0008] Process objects within a container, and within any subcontainers, down to any level.

ANNFLAG_NOTCONTAINER	[0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves.

ANNFLAG_NOINVALIDATE	[0x0010] Do not invalidate the affected rectangle in the window. Use this to avoid generating unwanted paint messages.

ANNFLAG_USER	[0x0040] Process only those objects that have a user included in pUserList. If pUserList is NULL, process only those objects that do not have an associated user.


pUserList Parameter For AnnSetVisible
pUserList

String that contains the list of users associated with the specified object. pUserList has the form "User1,User2,…,UserN". This must be a NULL terminated string with user names separated by a comma. This parameter is valid only if ANNFLAG_USER is set in iFlags.


Return for AnnSetVisible
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnSetWnd method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnSetWnd(OLE_HANDLE hObject, OLE_HANDLE hWnd);

Overview	Refer to Container Annotation Object.

Remarks

(Document/Medical only) Sets the window handle for all objects.

Set this property on the root container, and all objects in the container inherit the property.

The value of the AnnContainer property cannot be passed for the hObject parameter.

See Also

Elements	AnnGetWnd method

Topics	Annotations (Document/Medical only): Object Automation


hObject Parameter For AnnSetWnd
hObject

Handle to the root container.


hWnd Parameter For AnnSetWnd
hWnd

The window handle to assign to the object.


Return for AnnSetWnd
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnShowLockedIcon property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AnnShowLockedIcon

Overview	Refer to Implementing Annotation Security.

Remarks

(Document/Medical only) (Persistent property, available at design time) Indicates how locked objects should be drawn.  If this property is TRUE, then all locked objects are drawn with a padlock icon on top.  If this property is FALSE, the locked objects are drawn the same way as the unlocked objects.

See Also

Elements	AnnLock method, AnnUnlock method

Topics	Annotations (Document/Medical only): Annotation Security


AnnTool property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnTool

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Is the currently selected annotation tool. For a list of available values, refer to Annotation Toolbar Buttons.

See Also

Elements	AnnGetType method

Topics	Annotations (Document/Medical only): Automation


AnnToolbar property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	IAnnToolbar *AnnToolbar

Overview	Refer to Annotation Toolbar.

Remarks

(Document/Medical only)  Gets the object that references the annotation toolbar.

The following properties and methods are associated with this property:

AutoSetTool property

ButtonBitmapDown property

ButtonBitmapUp property

ButtonCount property

ButtonColumns property

ButtonMenuTool property

ButtonMenuText property

ButtonMenuTextID property

ButtonRows property

ButtonTool property

ButtonToolCount property

ButtonToolTipText property

ButtonToolTipTextID property

ButtonVisible property

Create method

hWnd property

Tool property

Visible property

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


AnnToolChecked event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void AnnToolChecked (short iTool);

Overview	Refer to Annotation Toolbar

Remarks

(Document/Medical only)  This event is fired when the user clicks on an annotation toolbar button. In this case, iTool contains the ANNTOOL_XXX value that indicates the selected tool.

If the AutoSetTool of AnnToolbar is set to TRUE, the AnnTool of the Main control has already been set to iTool.

Note:	iTool contains the same value as the Tool property of AnnToolbar.

See Also

Elements	AutoSetTool property, ButtonBitmapUp property, ButtonBitmapDown property, ButtonColumns property, ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


iTool Parameter For AnnToolChecked
iTool

Value that indicates the selected tool. For a list of possible values, refer to Annotation Toolbar Buttons.


AnnToolDestroy event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void AnnToolDestroy ();

Overview	Refer to Annotation Toolbar

Remarks

(Document/Medical only)  This event is fired when the user closes the annotation toolbar by clicking on the close button at the top of the annotation toolbar.

See Also

Elements	AutoSetTool property, ButtonBitmapUp property, ButtonBitmapDown property, ButtonColumns property, ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property, AnnToolChecked event

Topics	Annotations (Document/Medical only): Automation


AnnUndoDepth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnUndoDepth;

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Gets or sets the undo level for the container object. It contains the length of the undo stack.

The undo level determines the number of automation operations that can be undone. The default value is 5.

This property should be set before calling the AnnAddUndoNode  method.

See Also

Elements	AnnUndoEnable property, AnnAddUndoNode method, AnnUndo method

Topics	Annotations Automation
Undoing Automation Operations


AnnUndoEnable property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AnnUndoEnable;

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Enables or disables the undo mechanism for an automation object. Possible values are:

Value	Meaning

TRUE	Enable the undo mechanism for the specified automation object.

FALSE	Disable the undo mechanism for the specified automation object.

Please note that the undo stack is not changed. This is intended to temporarily disable the undo mechanism.

This property, along with the AnnAddUndoNode method can be used to combine multiple changes into a single undo call. For more information of this process, refer to the AnnAddUndoNode method.

See Also

Elements	AnnUndoDepth property, AnnAddUndoNode method, AnnUndo method

Topics	Annotations Automation
Undoing Automation Operations


AnnUndo method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnUndo ();

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Reverses the last change that was made using automated annotations.

The number of automation operations that can be undone is contained in the AnnUndoDepth property.

For information about grouping multiple operations into a single undo process, refer to the AnnAddUndoNode method.

Calling this method is the same as selecting Undo on the automation menu.

See Also

Elements	AnnUndoEnable property, AnnUndoDepth property, AnnAddUndoNode method

Topics	Annotations Automation
Undoing Automation Operations


Return for AnnUndo
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnUngroup method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AnnUngroup (OLE_HANDLE hObject, short iFlags, BSTR pUserList);

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only)  Ungroups a group of objects.

See Also

Elements	AnnGroup method, AnnGetGrouping method, Ann

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnUngroup
hObject

Handle to the annotation object.


iFlags Parameter For AnnUngroup
iFlags

Flags that determine which objects to process. Most of the flags apply only to container objects. The following are valid values:

Value	Meaning

0	Process only the specified object.

ANNFLAG_SELECTED	[0x0001] Process only objects that have the selected property set to TRUE. To get a list of selected objects, use the AnnGetSelectList method.

ANNFLAG_NOTTHIS	[0x0004] Process only one level of objects within the specified container, not the container itself. If there are containers within the container, they are modified, but the objects within them are not.

ANNFLAG_RECURSE	[0x0008] Process objects within a container, and within any subcontainers, down to any level.

ANNFLAG_NOTCONTAINER	[0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves.

ANNFLAG_NOINVALIDATE	[0x0010] Do not invalidate the affected rectangle in the window. Use this to avoid generating unwanted paint messages.

ANNFLAG_CHECKMENU	[0x0020] Process objects only if the ANNAUTOTEXT_MENU_UNGROUP menu item has been selected.

ANNFLAG_USER	[0x0040] Ungroup only those objects with users listed in pUserList.


pUserList Parameter For AnnUngroup
pUserList

String that contains the list of users associated with the specified object. pUserList has the form "User1,User2,…,UserN". This must be a NULL terminated string with user names separated by a comma. This parameter is valid only if ANNFLAG_USER is set in iFlags.


Return for AnnUngroup
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnUnlock method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnUnlock (OLE_HANDLE hObject, BSTR pszKey);

Overview	Refer to Implementing Annotation Security.

Remarks

(Document/Medical only) Unlocks annotations with the specified key.  Use the same key used in AnnLock method.  The key is case sensitive!

See Also

Elements	AnnLock method, AnnUnlocked event, AnnLocked event

Topics	Annotations (Document/Medical only): Annotation Security


hObject Parameter For AnnUnlock
hObject

Handle to the annotation object.


pszKey Parameter For AnnUnlock
pszKey

String containing the key used to unlock the annotation objects.


Return for AnnUnlock
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnUnlocked event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void AnnUnlocked (OLE_HANDLE hObject);

Overview	Refer to Implementing Annotation Security.

Remarks

(Document/Medical only) This event occurs whenever the user unlocks an object.  The event will occur once for each object if a group of objects is unlocked.

See Also

Elements	AnnUnlock method, AnnLocked event, AnnLock method

Topics	Annotations (Document/Medical only): Annotation Security


hObject Parameter For AnnUnlocked
hObject

Handle to the annotation object.


AnnUnrealize method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnUnrealize (OLE_HANDLE hObject, BOOL fSelected);

Overview	Refer to Implementing Annotations

Remarks

(Document/Medical only) Restores the background of a redact object.  This method is valid only for redact or container objects.  When you call AnnRealize and specify RedactOnly, for every Redact object, the background of the image behind is saved inside the object.  You can restore that background by calling AnnUnrealize.  AnnUnrealize will restore the background from a redact object that contains a background bitmap.  The background of a locked object cannot be restored until the object is unlocked.  If hObject is a container, then fSelected indicates whether all the Redact objects included in the container should be restored, or if only selected objects should be restored.  If hObject is a Redact object, fSelected is ignored.

Note:	When AnnRealize method is called, if all objects are realized, any Redact objects that are realized cannot be unrealized.

See Also

Elements	AnnRealize method, AnnUnlock method

Topics	Annotations (Document/Medical only): Object Manipulation


hObject Parameter For AnnUnrealize
hObject

Handle to the annotation object.


fSelected Parameter For AnnUnrealize
fSelected

Boolean value indicating whether to restore all objects within a container or only selected objects.


Return for AnnUnrealize
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AnnUserMenu event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void AnnUserMenu (long nID);

Overview	Refer to Annotation Menu

Remarks

(Document/Medical only)  This event is fired when a user-defined menu item has been clicked in an annotation automation menu. The user-defined menu items can be added to the annotation automation menu by processing the AnnMenu event and adding user-defined items with AddItem method.

When a user selects a menu item added with the AddItem method, the AnnUserMenu event is fired. The nID parameter passed to this event is the same nID passed to the AddItem method when the item was added to the menu.

See Also

Elements	AnnMenu event, AddItem method

Topics	Annotations (Document/Medical only): Automation


nID Parameter For AnnUserMenu
nID

Identified the user-defined menu item that has been clicked. This is the same nID that was passed to the AddItem method.


AnnUserMode property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AnnUserMode

Overview	Refer to Implementing Annotations.

Remarks

(Document/Medical only) Sets or gets the current annotation mode.

The following are possible values:

Value	Meaning

ANNUSERMODE_DESIGN	The user can create annotations. In this mode, the toolbar is present, hot spots are visible, and popup menus can be activated with the right mouse button.

ANNUSERMODE_RUN	The user can view annotations and can activate hot spots, buttons, and audio clips. In this mode, hot spots are transparent.

ANNUSERMODE_NONE	Annotations are invisible.

See Also

Elements	AnnAutoMenuEnable property, AnnAutoDrawEnable property

Topics	Annotations (Document/Medical only): Automation


AntiAlias method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short AntiAlias(short iThreshold, short iDim, short iFilter);

Overview	Refer to Correcting Colors.

Remarks

(Document only) Applies an anti-aliasing filter to the bitmap.

The best results for anti-aliasing text can be obtained with the filter ANTIALIAS_2.

The value of the iDim parameter determines the extent of the anti-aliasing.

The threshold range for 16, 48 and 64-bit bitmaps is from 0 to 65535 and for 12-bit bitmaps the threshold range is from 0 to 4095. Otherwise, it is from 0 to 255. The threshold is applied on channels separately.

This method also supports 12 and 16 - bit grayscale bitmaps and can process the whole image or a region of the image. Support for 12 and 16 - bit grayscale images is available only in the Document/Medical Toolkits.

See Also

Topics	Raster Images: Filtering Images


iThreshold Parameter For AntiAlias
iThreshold

Threshold value that indicates which pixels to smooth. The application of the anti-aliasing filter on the image associates a value with each pixel. Only pixels with values above this threshold are smoothed.


iDim Parameter For AntiAlias
iDim

Value that indicates the size of the anti-aliasing mask. For example, a value of three indicates an anti-aliasing mask of 3 X 3.


iFilter Parameter For AntiAlias
iFilter

Flag that indicates the type of anti-aliasing filter to use. Possible values are:

Value	Meaning

ANTIALIAS_1	[0x0000] Anti-alias the bitmap vertically and horizontally.

ANTIALIAS_2	[0x0001] Anti-alias the bitmap in all directions.

ANTIALIAS_3	[0x0002] Anti-alias the bitmap in all directions. The filter used for this option is different from the filter used for the ANTIALIAS_2 option.

ANTIALIAS_DIAG	[0x0003] Anti-alias the bitmap diagonally.

ANTIALIAS_HORZ	[0x0004] Anti-alias the bitmap horizontally.

ANTIALIAS_VERT	[0x0005] Anti-alias the bitmap vertically.


Return for AntiAlias
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Appearance property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short Appearance

Overview	Refer to Using the Image List Control.

Remarks

(persistent property, available at design time) Determines whether the ImageList Control has a flat or three-dimensional appearance.

Value	Meaning

APPEARANCE_FLAT	Flat appearance

APPEARANCE_THREED	Three-dimensional appearance

See Also

Elements	ForeColor, ItemBackgroundColor property, BackColor, BorderColor, Font, BorderStyle

Topics	Raster Images: Displaying Images


Appearance property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 95, 97 example   Visual FoxPro example
Visual J++ example

Syntax	short Appearance

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Determines whether the Main Control has a flat or three-dimensional appearance.

Setting	Description

APPEARANCE_FLAT	Flat appearance

APPEARANCE_THREED	Three-dimensional appearance

See Also

Elements	BackColor property, BorderStyle property

Topics	Working with the Control: General Behavior
Raster Images: Displaying Images


ArraySize method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long ArraySize (VARIANT *vMem);

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Returns the size of the specified byte array.

To save a bitmap to a byte array in memory, refer to the SaveArray method.

See Also

Elements	LoadMemory method, SaveArray method, SaveMemory method, LoadArray method


vMem Parameter For ArraySize
vMem

A VARIANT byte array that contains a bitmap in memory.


Return for ArraySize
Return Value

The size of the specified byte array.


AutoAnimate property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AutoAnimate

Overview	Refer to Playing an Animation.

Remarks

(Persistent property, available at design time) Causes an animation to begin playing as the file containing an animation is loaded.

Animation may be slower while a file is loading. An alternative for more reliable playback speed is to set the AnimationEnable property after the file is loaded.

Setting	Description

TRUE	Enables the play-while-load feature.

FALSE	Disables the play-while-load feature.

See Also

Elements	AutoAnimationLoop property, AnimationLoop property, AnimationEnable property, Animate event

Topics	Raster Images: Playing Animated Images


AutoAnimationLoop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AutoAnimationLoop

Overview	Refer to Playing an Animation.

Remarks

(Persistent property, available at design time) Lets you force continued looping of an animation after it is loaded if the AutoAnimate property is TRUE.

Animated GIF files may continue looping by default, but for AVI files, you must set this property if you want continuous looping after the file is loaded.

Setting	Description

AUTOANIMATIONLOOP_DEFAULT	Use the files default value for continuous looping after loading.

AUTOANIMATIONLOOP_INFINITE	Force continuous looping after loading.

See Also

Elements	AutoAnimate property, AnimationLoop property, AnimationEnable property, Animate event

Topics	Raster Images: Playing Animated Images


AutoPan property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AutoPan;

Overview	Refer to Using a PanWindow.

Remarks

Contains a value that indicates whether you can pan an image. Possible values are:

Value	Meaning

TRUE	Panning the image is enabled.

FALSE	Panning the image is disabled.

To pan the image, click the mouse inside the image and then drag the mouse to pan.

This is very similar to using the PanWindow, without the extra window.

See Also

Elements	PanWin event, PanWinHeight property, PanWinIcon property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, ShowPanWin method

Topics	Raster Images: Displaying and Printing


AutoRepaint property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AutoRepaint

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Enables automatic repainting of the bitmap.

When this property is TRUE, any change in the bitmap causes the bitmap to repaint. At run time, you can set the property to FALSE temporarily to change more than one property before repainting. Alternatively, you can use the ForceRepaint method to control repainting.

Setting	Description

TRUE	Enables automatic repainting of the bitmap.

FALSE	Disables automatic repainting of the bitmap.

See Also

Elements	ForceRepaint method, PaintRgnOnly property, RepaintRect method, EnablePaint property

Topics	Raster Images: Displaying Images


AutoRubberBand property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AutoRubberBand

Overview	Refer to Marking a Selection with a Rubberband.

Remarks

Automates the rubberband so that it appears whenever the mouse is moved with the left button down.

The rubberband is a one-pixel outline of a rectangle on the display surface. It is automatically resized with each mouse movement.

Value	Meaning

TRUE	Enable automation of the rubberband.

FALSE	Disable automation of the rubberband.

See Also

Elements	RubberBand event

Topics	Working with the Control: Client Area Usage


AutoSegment event (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void AutoSegment (long nStripeNo, long nStripeStartRow, long nStripeEndRow, long nSegmentNo, long SegmentLeft, long SegmentTop, long SegmentRight, long SegmentBottom, MRCSegmentTypeConstants SegType, long TextForeColor, long TextBackColor);

Overview	Refer to Working with MRC Bitmap.

Remarks

Triggered during automatic segmentation of the control's bitmap.

The AutoSegment event is fired once for each segment in all stripes.

See Also

Elements	Bitmap property, StripeMaxHeight property, AutoSegment method

Topics	MRC Bitmap Functions: Automatic Segmentation, General Segmentation, Auto-Segmentation


nStripeNo Parameter For AutoSegment (Mixed Raster Content Control)
nStripeNo

Index of the stripe. This is a zero-based index.


nStripeStartRow Parameter For AutoSegment (Mixed Raster Content Control)
nStripeStartRow

The number of the row at which the stripe starts. This row is included in the stripe.


nStripeEndRow Parameter For AutoSegment (Mixed Raster Content Control)
nStripeEndRow

The number of the row at which the stripe ends. This row is included in the stripe.


nSegmentNo Parameter For AutoSegment (Mixed Raster Content Control)
nSegmentNo

Index of the segment. This is a zero-based index.


SegmentLeft Parameter For AutoSegment (Mixed Raster Content Control)
SegmentLeft

Left segment boundary from the original bitmap.


SegmentTop Parameter For AutoSegment (Mixed Raster Content Control)
SegmentTop

Top segment boundary from the original bitmap.


SegmentRight Parameter For AutoSegment (Mixed Raster Content Control)
SegmentRight

Right segment boundary from the original bitmap.


SegmentBottom Parameter For AutoSegment (Mixed Raster Content Control)
SegmentBottom

Bottom segment boundary from the original bitmap.


SegType Parameter For AutoSegment (Mixed Raster Content Control)
SegType

Flag that indicates the type of segment. Possible values are:

Value	Meaning

SEGMENT_TEXT	[0x01] Segment type is text.

SEGMENT_PICTURE	[0x02] Segment type is picture.


TextForeColor Parameter For AutoSegment (Mixed Raster Content Control)
TextForeColor

Foreground color for the segment.  This parameter is only valid if SegType is set to SEGMENT_TEXT.


TextBackColor Parameter For AutoSegment (Mixed Raster Content Control)
TextBackColor

Background base color.  This parameter is only valid if SegType is set to SEGMENT_TEXT.


AutoSegment method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short AutoSegment (long nMinWidth, long nMinHeight, long nSegFactor);

Overview	Refer to Working with MRC Bitmap.

Remarks

Automatically segments the control's bitmap.

Call this method to segment the bitmap automatically. LEADTOOLS will process the bitmap and break it into appropriate Picture and Text segments. The AutoSegment event is triggered for each segment.

See Also

Elements	Bitmap property, StripeMaxHeight property, AutoSegment event

Topics	MRC Bitmap Functions: Automatic Segmentation, General Segmentation, Auto-Segmentation


nMinWidth Parameter For AutoSegment (Mixed Raster Content Control)
nMinWidth

Minimum segment width.  This should be at least 2.


nMinHeight Parameter For AutoSegment (Mixed Raster Content Control)
nMinHeight

Minimum segment height.  This should be at least 2.


nSegFactor Parameter For AutoSegment (Mixed Raster Content Control)
nSegFactor

Threshold value that determines the segments type.  Possible values are between 1 and 100. This is a control parameter used by the OCR engine to determine whether a certain segment should be considered text or image.The higher the value, the more segments are considered text. The lower the value, the more segments are considered images.


Return for AutoSegment
Return Value

Value	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


AutoScroll property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AutoScroll

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Enables automatic implementation of scroll bars.

Setting	Description

TRUE	Enables automatic implementation of scroll bars if the image display is bigger than the control.

FALSE	Disables automatic implementation of scroll bars.

See Also

Elements	AutoRepaint property, AutoSetRects property, PaintSizeMode property, PaintZoomFactor property, AutoSize property

Topics	Raster Images: Displaying Images


AutoSetRects property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AutoSetRects

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Enables or disables the automatic adjustment of display rectangles when bitmap dimensions change.

Setting	Description

TRUE	The source and destination display rectangles change when the bitmap changes. This occurs, for example, when loading a bitmap. The top and left values change to 0. The width and height values change according to the settings of the PaintSizeMode property and the PaintZoomFactor property.

FALSE	Disables automatic adjustment of rectangles.

Note:	If you disable automatic adjustment of rects, you must update all four rects in order for the display to be correct when the size of the image is changed.

See Also

Elements	AutoRepaint property, PaintSizeMode property, PaintZoomFactor property, AutoScroll property, AutoSize property

Topics	Raster Images: Displaying Images


AutoSetTool property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL AutoSetTool

Overview	Refer to Annotation Toolbar.

Remarks

Contains a value that indicates whether the toolbar will automatically set the automation tool. Possible values are:

Value	Meaning

TRUE	Setting the AnnTool property of the LEAD control will also set the Tool property of the AnnTool object and will update the annotation toolbar, if the bar has been created.

FALSE	The AnnTool property property of the LEAD control and the Tool property of the AnnTool object are independent.

If you want to synchronize the AnnTool property property of the LEAD main control and the Tool property of the AnnTool object, you should set AutoSetTool to TRUE, or keep track of the currently selected tool by intercepting the AnnToolChecked event of the main control.

See Also

Elements	ButtonBitmapDown property, ButtonBitmapUp property, ButtonColumns property, ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property, Visible property

Topics	Annotations (Document/Medical only): Automation


AutoSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL AutoSize

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Automatically sizes the Main Control to the size of the bitmap, if possible.

If the bitmap is larger than the current window, the control is resized to fit the image, regardless of the size of its container.

This property is effective when loading a bitmap and when taking any action (such as rotating a bitmap) that changes the dimensions of the bitmap.

Setting	Description

TRUE	Automatically size of the LEAD control to the size of the bitmap, if possible.

FALSE	The size of the bitmap does not affect the size of the LEAD control.

See Also

Elements	AutoRepaint property, AutoSetRects property, PaintSizeMode property, PaintZoomFactor property, AutoScroll property

Topics	Raster Images: Displaying Images


AutoTrim method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short AutoTrim (short iThreshold);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Trims the current bitmap, removing blank space (usually white space) around the edges.

The threshold is a delta value for detecting blank space. Starting at each edge of the bitmap and evaluating toward the center, any change in intensity that is less than or equal to iThreshold is considered blank space. Valid values are 0 to 244.

This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Topics	Raster Images: Doing Geometric Transformations


iThreshold Parameter For AutoTrim
iThreshold

Delta value for detecting blank space. Starting at each edge of the bitmap and evaluating toward the center, any change in intensity that is less than or equal to iThreshold is considered blank space. Valid values are 0 to 244.


Return for AutoTrim
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Average method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Average (short iDim);

Overview	Refer to Removing Noise.

Remarks

Changes the color of each pixel in the bitmap to the average color of pixels in its neighborhood. This results in a blur effect.

You control the amount of blur by specifying the size of the neighborhood that is used for averaging.

This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Elements	GetChange method

Topics	Raster Images: Filtering Images
Raster Images: Where the Region Preempts the Bitmap


iDim Parameter For Average
iDim

Size of the averaging neighborhood. It is the length, in pixels, of one side of a square.


Return for Average
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


BackColor property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR BackColor

Overview	Refer to Using the Image List Control.

Remarks

Sets the background color of the ImageList Control.

See Also

Elements	ForeColor property, ItemBackgroundColor property, BorderColor property, BorderStyle property, Font property, Appearance property

Topics	Raster Images: Displaying Images


BackColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR BackColor

Overview	Refer to Displaying an Image.

Remarks

Sets the background color of the bitmap.

See Also

Elements	Appearance property, BorderStyle property

Topics	Working with the Control: General Behavior
Raster Images: Displaying Images


BackErase property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL BackErase

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Causes the bitmap to erase the background before painting. This erases the previous image before displaying the next image. Otherwise, the next image overlaps the previous image.

Setting	Description

TRUE	Erase the background of the control.

FALSE	Do not erase the background of the control.

See Also

Elements	BitonalScaling property, ForePalette property, PaintDither property, PaintEffect property, PaintPalette property, PaintROP3 property, PaintGamma property, PaintIntensity property, PaintContrast property

Topics	Raster Images: Displaying Images


BackgroundCoder property (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	MRCBackgroundCoderConstants BackgroundCoder

Overview	Refer to Working with MRC Bitmap.

Remarks

(Persistent property, available at design time) Indicates the background (picture) compression type used when saving a T44 file.  Possible values are:

Value	Meaning

MRC_BACKGROUND_COMPRESSION_JPEG	[0x05] JPEG compression.

MRC_BACKGROUND_COMPRESSION_CMP	[0x006] LEAD CMP compression.

MRC_BACKGROUND_COMPRESSION_CMW	[0x007] LEAD Wavelet (CMW) compression

The MRC_BACKGROUND_COMPRESSION_CMP and MRC_BACKGROUND_COMPRESSION_CMW compression types are valid only when saving in LEAD Proprietary T44 Format using the Save method.

See Also

Elements	Save method, SaveT44 method

Topics	MRC Bitmap Functions: Saving a Page


BackgroundImageHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float BackgroundImageHeight

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the height of the source rectangle that defines which part of a bitmap to use for the background of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	DrawShape method, ShapeBackgroundStyle property, BackgroundImageLeft property, BackgroundImageTop property, BackgroundImageWidth property

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


BackgroundImageLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float BackgroundImageLeft

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the X coordinate of the origin of the source rectangle that defines which part of a bitmap to use for the background of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	DrawShape method, ShapeBackgroundStyle property, BackgroundImageTop property, BackgroundImageWidth property, BackgroundImageHeight property

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


BackgroundImageTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float BackgroundImageTop

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the Y coordinate of the origin of the source rectangle that defines which part of a bitmap to use for the background of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	DrawShape method, ShapeBackgroundStyle property, BackgroundImageLeft property, BackgroundImageWidth property, BackgroundImageHeight property

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


BackgroundImageWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float BackgroundImageWidth

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the width of the source rectangle that defines which part of a bitmap to use for the background of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	DrawShape method, ShapeBackgroundStyle property, BackgroundImageLeft property, BackgroundImageTop property, BackgroundImageHeight property

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


BackgroundQFactor property (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short BackgroundQFactor

Overview	Refer to Working with MRC Bitmap.

Remarks

(Persistent property, available at design time) Compression quality for JPEG, CMP and CMW compression used when saving a T44 file.

Possible values are between 2 and 255, where 2 is the highest quality and 255 is the most compression.

See Also

Elements	Save method, SaveT44 method

Topics	MRC Bitmap Functions: Saving a Page


BalanceColors method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short BalanceColors(float fRedToRed, float fRedToGreen, float fRedToBlue, float fGreenToRed, float fGreenToGreen, float fGreenToBlue, float fBlueToRed, float fBlueToGreen, float fBlueToBlue);

Overview	Refer to Correcting Colors.

Remarks

Redistributes the RGB values of the specified bitmap, using the values stored in the specified structures.

For each pixel in the bitmap, the red value is modified using the values of the fRedToXXX parameters. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

For each pixel in the bitmap the green value is modified using the values of the fGreenToXXX parameters. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

For each pixel in the bitmap the blue value is modified using the values of the fBlueToXXX parameters. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

The intermediate red values are added to generate the new red value for the pixel. The intermediate green values are added to generate the new green value for the pixel and the intermediate blue values are added to generate the new blue value for the pixel. This triplet forms the new RGB value for the pixel.

For example, if a the following parameter values are used to redistribute the red value of a pixel:

fRedToRed = 0.50
fRedToGreen = 0.50
fRedToBlue = 0.0

Then 50% of the current red value of the pixel will be added to the new red value for the pixel and 50% of the current red value of the pixel will be added to the new green value for the pixel.

This method supports 48 and 64-bit color images. Support for 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	ConvertToColoredGray method, GrayScale method, GrayscaleExt method, IsGrayscale property

Topics	Raster Images: Modifying Intensity Values


fRedToRed Parameter For BalanceColors
fRedToRed

Value that represents the percentage of the red color value that should be distributed to the red component. Possible values are 0.0 to 1.0.


fRedToGreen Parameter For BalanceColors
fRedToGreen

Value that represents the percentage of the green color value that should be distributed to the green component. Possible values are 0.0 to 1.0.


fRedToBlue Parameter For BalanceColors
fRedToBlue

Value that represents the percentage of the blue color value that should be distributed to the blue component. Possible values are 0.0 to 1.0.


fGreenToRed Parameter For BalanceColors
fGreenToRed

Value that represents the percentage of the red color value that should be distributed to the red component. Possible values are 0.0 to 1.0.


fGreenToGreen Parameter For BalanceColors
fGreenToGreen

Value that represents the percentage of the green color value that should be distributed to the green component. Possible values are 0.0 to 1.0.


fGreenToBlue Parameter For BalanceColors
fGreenToBlue

Value that represents the percentage of the blue color value that should be distributed to the blue component. Possible values are 0.0 to 1.0.


fBlueToRed Parameter For BalanceColors
fBlueToRed

Value that represents the percentage of the red color value that should be distributed to the red component. Possible values are 0.0 to 1.0.


fBlueToGreen Parameter For BalanceColors
fBlueToGreen

Value that represents the percentage of the green color value that should be distributed to the green component. Possible values are 0.0 to 1.0.


fBlueToBlue Parameter For BalanceColors
fBlueToBlue

Value that represents the percentage of the blue color value that should be distributed to the blue component. Possible values are 0.0 to 1.0.


Return for BalanceColors
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


BaseBackColor property (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR BaseBackColor

Overview	Refer to Working with MRC Bitmap.

Remarks

(Persistent property, available at design time) Default base background color for the MRC bitmap.

See Also

Elements	BaseForeColor property

Topics	MRC Bitmap Functions: General Segmentation


BaseForeColor property (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR BaseForeColor

Overview	Refer to Working with MRC Bitmap.

Remarks

(Persistent property, available at design time) Default base foreground color for the MRC bitmap.

See Also

Elements	BaseBackColor proprety

Topics	MRC Bitmap Functions: General Segmentation


BezierSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long BezierSize

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

(Read only) Indicates the size of the arrays (BezierX property and BezierY property) used to store the vertices of the Bezier curve.

This property is updated by the CurveToBezier method.

See Also

Elements	BezierX property, BezierY property, CurveToBezier method, CurveX property, CurveY property, CurveSize property, CurveTension property, CurveType property, SetRgnCurve method

Topics	Raster Images: Creating and Using a Region


BezierX property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long BezierX (long iIndex);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

(Read only) Gets an array of long values that represent the X coordinates for the control points of the Bezier curve.

The number of points in the array is contained in the BezierSize property.

This property is updated by the CurveToBezier method.

See Also

Elements	BezierSize property, BezierY property, CurveToBezier method, CurveX property, CurveY property, CurveSize property, CurveTension property, CurveType property, SetRgnCurve method

Topics	Raster Images: Creating and Using a Region


iIndex Parameter For BezierX
iIndex

Index into the ordered array of X coordinates for the control points.  This is a zero-based index.


BezierY property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long BezierY (long iIndex);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

(Read only) Gets an array of long values that represent the Y coordinates for the control points of the Bezier curve.

The number of points in the array is contained in the BezierSize property.

This property is updated by the CurveToBezier method.

See Also

Elements	BezierSize property, BezierX property, CurveToBezier method, CurveX property, CurveY property, CurveSize property, CurveTension property, CurveType property, SetRgnCurve method

Topics	Raster Images: Creating and Using a Region


iIndex Parameter For BezierY
iIndex

Index into the ordered array of Y coordinates for the control points. This is a zero-based index.


BinaryFilter method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short BinaryFilter (short iType);

Overview	Refer to Removing Noise.

Remarks

(Document/Medical only) Imposes one of the predefined binary filters for erosion or dilation of black objects.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	MaxFilter method, MinFilter method, GetFilter method

Topics	Raster Images: Filtering Images
Raster Images: Where the Region Preempts the Bitmap


iType Parameter For BinaryFilter
iType

Pointer to the binary filter to use. You can use one of the following predefined filters:

Value	Meaning
BFLT_EROSION_OMNI  BFLT_EROSION_HORZ  BFLT_EROSION_VERT  BFLT_EROSION_DIAG	Shrinks black objects in the bitmap. The effect is biased in the specified direction.
BFLT_DILATION_OMNI  BFLT_DILATION_HORZ  BFLT_DILATION_VERT  BFLT_DILATION_DIAG	Enlarges black objects in the bitmap. The effect is biased in the specified direction.


Return for BinaryFilter
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


nFormat Parameter For SaveToFile
nFormat

Output file format. The following are valid values:

Value	Meaning

FILE_PCX	ZSoft PCX

FILE_GIF	CompuServe GIF

FILE_TIF	Tagged Image File Format

FILE_TIF_JPEG	Jpeg Tag Image File Format

FILE_TIFLZW	TIF Format with LZW compression

FILE_TIF_JPEG_411	JPEG  4:1:1

FILE_TIF_JPEG_422	JPEG  4:2:2

FILE_CCITT	TIFF  CCITT

FILE_CCITT_GROUP3_1DIM	CCITT Group3 one dimension

FILE_CCITT_GROUP3_2DIM	CCITT Group3 two dimensions

FILE_CCITT_GROUP4	CCITT Group4 two dimensions

FILE_FPX	FlashPix, no compression

FILE_FPX_SINGLE_COLOR	FlashPix, compression 'single color' method

FILE_FPX_JPEG	FlashPix, compression JPEG

FILE_FPX_JPEG_QFACTOR	FlashPix, compression JPEG, specify qFactor

FILE_TIF_CMYK	TIFF no compression,      CMYK data

FILE_TIFLZW_CMYK	TIFF LZW compression,     CMYK data

FILE_TIF_PACKBITS	TIFF PackBits compression, RGB data

FILE_TIF_PACKBITS_CMYK	TIFF PackBits compression, CMYK data

FILE_TIF_YCC	TIFF YCbCr color space, no compression

FILE_TIFLZW_YCC	TIFF YCbCr color space, LZW compression

FILE_TIF_PACKBITS_YCC	TIFF YCbCr color space, PackBits compression

FILE_EXIF	uncompressed RGB Exif file

FILE_EXIF_YCC	uncompressed YCbCr Exif file

FILE_EXIF_JPEG	JPEG 4:2:2 compressed Exif file

FILE_AWD	Microsoft Fax format

FILE_EXIF_JPEG_411	JPEG 4:1:1 compressed Exif file


nBits Parameter For SaveToFile
nBits

Resulting file's pixel depth.

The output file pixel depth. Note that not all bits per pixel are available to all file formats.  Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.  For valid values, refer to Formats of Output Files.


nQFactor Parameter For SaveToFile
nQFactor

This parameter is used when saving an image file to LEAD or JPEG formats. Qfactor is a number that determines the degree of loss in the compression process.

For possible values, refer to Compression Quality Factors.


bSelected Parameter For SaveToFile
bSelected

Indicates which items to save.

Value	Meaning

True	Save only items that have the Selected attribute equal to True

False	Save all items


Return for SaveToFile
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SaveWithStamp method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SaveWithStamp (BSTR pszName, short iFormat, short iBitsPerPixel, short iQuality, float fStampWidth, float fStampHeight, short iStampBits);

Overview	Refer to Saving a Bitmap to a File.

Remarks

Saves the specified bitmap to create a JPEG or LEAD CMP output file that includes a thumbnail (stamp) image.

Neither the width nor the height of the stamp can exceed 255 pixels. In addition, the following overall size limitations apply:

 If you save an 8-bit stamp, the following calculation cannot exceed 65,535: (width * height) + 778.

 If you save a 24-bit stamp, the following calculation cannot exceed 65,535: (width * height * 3) + 10.

The method will return an error (ERROR_INV_RANGE) if you exceed any of these size limitations. Because the limitations are in pixels, it is best to work with the ScaleMode property set to pixels.

If you are working with compressed (JPEG) Exif  files, the stamp size has been restricted to 160x120x24. When you call SaveWithStamp method and specify that you want to save a compressed Exif file, the StampWidth, StampHeight and StampBits parameters are ignored. They are assumed to be 160 (StampWidth), 120 (StampHeight) and 24 (StampBits). That limitation has been imposed in order to conform with the ExifR98 interoperability rules imposed by japanese digital camera manufacturers.

If you are working with uncompressed (TIFF) Exif files, the stamp size is (width x height x 24 bpp), with no limitations on width and height.

The stamp image can be retrieved by calling the LoadStamp method.

See Also

Elements	LoadStamp method , FileSave method , SaveTileHeight property, SaveTileWidth property

Topics	Raster Images: Saving Files
Raster Images: Loading and Saving Stamp Images


pszName Parameter For SaveWithStamp
pszName

Character string containing the output file name.


iFormat Parameter For SaveWithStamp
iFormat

Type of compression to use. Valid values are:

Value	Meaning

FILE_CMP	LEAD CMP compression format.

FILE_JPEG	JPEG File Interchange Format using YUV 4:4:4 color spacing.

FILE_JPEG_422	JPEG File Interchange Format using YUV 4:2:2 color spacing.

FILE_JPEG_411	JPEG File Interchange Format using YUV 4:1:1 color spacing.

FILE_EXIF_JPEG_411	Exif 2.0 file containing a JPEG compressed image. uses 4:1:1 subsampling (called 4:2:0 sampling in other places).


iBitsPerPixel Parameter For SaveWithStamp
iBitsPerPixel

Pixel depth of the main image in the file. Valid values are:

Value	Meaning

8	For grayscale.

24	For True color.


iQuality Parameter For SaveWithStamp
iQuality

Compression quality factor to use for the specified compression format. This value can be any integer ranging from 2 to 255 for all the supported compression methods. In addition, the LEAD CMP compression format can use any one of the following enhanced options:

Value	Meaning

QFACTOR_PQ1	Perfect Quality compression Option 1.

QFACTOR_PQ2	Perfect Quality compression Option 2.

QFACTOR_QFS	Quality Far more important than Size.

QFACTOR_QMS	Quality More important than Size.

QFACTOR_QS	Quality and Size are equally important.

QFACTOR_SQS	Size more important than Quality - Sharp.

QFACTOR_SQT	Size more important than Quality - less Tiling.

QFACTOR_MCQ	Maximum Compression, keeping quality as good as possible.

QFACTOR_MC	Maximum Compression.


fStampWidth Parameter For SaveWithStamp
fStampWidth

Width of the stamp to store within the compressed image. Maximum width of the stamp is 255 pixels. The unit of measure is determined by the ScaleMode property.


fStampHeight Parameter For SaveWithStamp
fStampHeight

Height of the stamp to store within the compressed image. Maximum height of the stamp is 255 pixels. The unit of measure is determined by the ScaleMode property.


iStampBits Parameter For SaveWithStamp
iStampBits

Pixel depth of the stamp. Valid values are:

Value	Meaning

8	For 8-bit stamp image.

24	For 24-bit stamp image.


Return for SaveWithStamp
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ScaleHeight property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float ScaleHeight

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Is the height of the client area of the ImageList Control.

This is the true client area. The unit of measure is determined by the ScaleMode property.

If you write this property, the actual height of the control does not change, but the current height is expressed using the value that you provide. This lets you use a custom coordinate system. For example, you could set the ScaleWidth and ScaleHeight both to 100; then express all coordinates as percentage offsets.

See Also

Elements	ScaleMode property, ScaleTop property, ScaleLeft property, ScaleWidth property, ScaleHeight property(Main Control)

Topics	Raster Images: Displaying Images


ScaleHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ScaleHeight

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Is the height of the client area of the Main Control.

This is the true client area, which you can use when painting to fit a destination rectangle to the bitmap. The unit of measure is determined by the ScaleMode property.

If you write this property, the actual height of the control does not change, but the current height is expressed using the value that you provide. This lets you use a custom coordinate system. For example, you could set the ScaleWidth and ScaleHeight both to 100; then express all coordinates as percentage offsets. For examples of a custom coordinate system, refer to the ScaleTop property.

See Also

Elements	ScaleMode property, ScaleLeft property, ScaleTop property, ScaleWidth property

Topics	Working with the Control: Client Area Usage
Raster Images: Displaying Images


ScaleLeft property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float ScaleLeft

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Is the X coordinate of the origin, in a custom coordinate system, for the client area.

This value is always 0, unless you change it to implement a custom coordinate system.

See Also

Elements	ScaleMode property, ScaleTop property, ScaleHeight property, ScaleWidth property, ScaleLeft property(Main Control)

Topics	Raster Images: Displaying Images


ScaleLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ScaleLeft

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Is the X coordinate of the origin in a custom coordinate system for the client area.

This value is always 0, unless you change it to implement a custom coordinate system, as shown in the examples.

See Also

Elements	ScaleMode property, ScaleHeight property, ScaleTop property, ScaleWidth property

Topics	Working with the Control: Client Area Usage
Raster Images: Displaying Images


ScaleMode property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ScaleMode

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies the unit of measure for the Main Control.

You can change the unit of measure at any time without affecting measurements that the ImageList Control maintains. The control accepts floating point values and converts them to pixels internally. This means, for example, that if you set a property value in twips, the value that you get back may be slightly different, since it is rounded to the nearest pixel.

Value	Meaning

0	Indicates that one or more of the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties are set to custom values.

1	Twips (1440 twips per logical inch; 567 twips per logical centimeter).

2	Points (72 points per logical inch).

3	Pixels (smallest unit of monitor or printer resolution).

4	Characters (horizontal = 120 twips per unit; vertical = 240 twips per unit).

5	Inches.

6	Millimeters.

7	Centimeters.

See Also

Elements	ScaleTop property, ScaleLeft property, ScaleHeight property, ScaleWidth property

Topics	Raster Images: Displaying Images


ScaleMode property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example

Syntax	short ScaleMode

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Specifies the unit of measure for the Main Control.

You can change the unit of measure at any time without affecting measurements that the Main Control maintains. The control accepts floating point values and converts them to pixels internally. This means, for example, that if you set a property value in twips, the value that you get back may be slightly different, since it is rounded to the nearest pixel.

Setting	Description

0	Indicates that one or more of the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties are set to custom values.

1	Twips (1440 twips per logical inch; 567 twips per logical centimeter).

2	Points (72 points per logical inch).

3	Pixels (smallest unit of monitor or printer resolution).

4	Characters (horizontal = 120 twips per unit; vertical = 240 twips per unit).

5	Inches.

6	Millimeters.

7	Centimeters.

See Also

Elements	ScaleHeight property, ScaleLeft property, ScaleTop property, ScaleWidth property

Topics	Working with the Control: Client Area Usage
Raster Images: Displaying Images


ScaleTop property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float ScaleTop

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Is the Y coordinate of the origin, in a custom coordinate system, for the client area.

This value is always 0, unless you change it to implement a custom coordinate system.

See Also

Elements	ScaleMode property, ScaleLeft property, ScaleHeight property, ScaleWidth property, ScaleTop property (Main Control)

Topics	Raster Images: Displaying Images


ScaleTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ScaleTop

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Is the Y coordinate of the origin in a custom coordinate system for the client area.

This value is always 0, unless you change it to implement a custom coordinate system, as shown in the examples.

See Also

Elements	ScaleMode property, ScaleHeight property, ScaleLeft property, ScaleWidth property

Topics	Working with the Control: Client Area Usage
Raster Images: Displaying Images


ScaleWidth property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float ScaleWidth

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Is the width of the client area of the ImageList Control.

This is the true client area. The unit of measure is determined by the ScaleMode property.

If you write to this property, the actual width of the control does not change, but the current width is expressed using the value that you provide. This lets you use a custom coordinate system. For example, you could set the ScaleWidth and ScaleHeight both to 100; then express all coordinates as percentage offsets.

See Also

Elements	ScaleMode property, ScaleTop property, ScaleLeft property, ScaleHeight property, ScaleWidth property (Main Control)

Topics	Raster Images: Displaying Images


ScaleWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ScaleWidth

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Is the width of the client area of the Main Control.

This is the true client area, which you can use when painting to fit a destination rectangle to the bitmap. The unit of measure is determined by the ScaleMode property.

If you write this property, the actual width of the control does not change, but the current width is expressed using the value that you provide. This lets you use a custom coordinate system. For example, you could set the ScaleWidth and ScaleHeight both to 100; then express all coordinates as percentage offsets. For examples of a custom coordinate system, refer to the ScaleTop property.

See Also

Elements	ScaleMode property, ScaleHeight property, ScaleLeft property, ScaleTop property

Topics	Working with the Control: Client Area Usage
Raster Images: Displaying Images


Scroll event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void Scroll (void);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when a user scrolls the items using the scrollbar.

See Also

Elements	Resize event, DblClick event, KeyDown event, KeyPress event, KeyUp event, MouseMove event, MouseDown event, MouseUp event, Click event

Topics	Raster Images: Displaying Images


Scroll event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void Scroll ();

Overview	Refer to Detecting Events.

Remarks

Occurs when a user drags the box on a Main Control's scrollbar.

This event occurs only if the AutoScroll property is set to TRUE.

See Also

Elements	Paint event

Topics	Working with the Control: Client Area Usage


ScrollItems method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long ScrollItems (long nAmount);

Overview	Refer to Using the ImageList Control.

Remarks

Scrolls the items in the ImageList Control by the specified amount.  The direction of the scroll depends on the current setting for ScrollStyle.

See Also

Elements	Item property, Scroll event, EnsureVisible method, ScrollStyle property, Insert method

Topics	Raster Images: Displaying Images


nAmount Parameter For ScrollItems
nAmount

The amount to scroll. Positive values scroll forward in the list, while negative values scroll backwards. The direction (either horizontal or vertical) of the scroll depends on the current setting for ScrollStyle.


Return for ScrollItems
Return Value

Return value is the actual number of lines scrolled.


ScrollStyle property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ScrollStyle

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies the direction the ImageList Control scrolls the displayed items.

Value	Meaning

SCROLLSTYLE_VERTICAL	Control has vertical scrollbar

SCROLLSTYLE_HORIZONTAL	Control has horizontal scrollbar

The default setting is SCROLLSTYLE_VERTICAL.

See Also

Elements	Scroll event, ScrollItems method, EnsureVisible method

Topics	Raster Images: Displaying Images


SelectAll method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SelectAll (BOOL bFlag);

Overview	Refer to Using the ImageList Control.

Remarks

Selects or deselects all items in the ImageList Control.

Use this method to set the Selected attribute for all items to bFlag.

See Also

Elements	Item property, Clear method

Topics	Raster Images: Displaying Images


bFlag Parameter For SelectAll
bFlag

Flag that indicates the new status of the Selected attribute for all items in the ImageList Control.


Return for SelectAll
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SelectedCount property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long SelectedCount

Overview	Refer to Using the Image List Control.

Remarks

(Read only) (Runtime only) Gets the number of currently selected items in the ImageList control

See Also

Elements	Count property, SelectedItems property, Item property

Topics	Raster Images: Displaying Images


SelectedItems property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	LEADImageListItem SelectedItems (long Index)

Overview	Refer to Using the Image List Control.

Remarks

(Runtime only) This property contains an array of the ImageList items that are currently selected in the ImageList Control.

For more information on the LEADImageListItem data type, refer to the Item property.

See Also

Elements	Count property, SelectedItems property, Item property

Topics	Raster Images: Displaying Images


Index Parameter For SelectedItems
Index

Index into the array of selected ImageList items. This is a 0-based index. This value must be between 0 and SelectedCount - 1.


SelectionColor property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR SelectionColor

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies the color to use to display items that have the selected attribute when the SelectionStyle property is set to SELECTIONSTYLE_SELECTCOLOR.

The default setting is RGB(0,0,255).

See Also

Elements	AllowSelection property, SelectionStyle property, ItemSelected event, Item property, SelectAll method, HitTest method

Topics	Raster Images: Displaying Images


SelectionStyle property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SelectionStyle

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies the style used to display items that have the selected attribute.

Setting	Description

SELECTIONSTYLE_SELECTCOLOR	show selected items using the SelectionColor

SELECTIONSTYLE_PRESSEDBUTTON	show selected items as pressed buttons

SELECTIONSTYLE_USERBITMAP	show selected items using a user-defined bitmap.

The default setting is SELECTIONSTYLE_SELECTCOLOR.

See Also

Elements	AllowSelection property, SelectionColor property, ItemSelected event, Item property, SelectAll method, HitTest method

Topics	Raster Images: Displaying Images


SetBitmapDataPointer method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SetBitmapDataPointer (VARIANT vData, long lDataSize);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

This method can be called only for user bitmaps created with the CreateUserBitmap method.

If vData is empty, the method clears the bitmap data pointer by setting it to NULL.

This method makes the control use the data pointer from the variant. The variant must be a byte array, or this method will fail. Make sure that data pointer is cleared before the variant is freed.

See Also

Elements	CreateBitmap method, CreateUserBitmap method

Topics	Raster Images: Creating and Deleting Images


vData Parameter For SetDataPointer
vData

Parameter that can specify the bitmap data. Can be an empty variant, in which case the bitmap data pointer is set to NULL.


lDataSize Parameter For SetDataPointer
lDataSize

The size of the data from vData. If vData is empty, then this parameter is ignored. Should match the required size for the bitmap data.


Return for SetDataPointer
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetDDB method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetDDB (OLE_HANDLE hDC, OLE_HANDLE hBitmap, OLE_HANDLE hPalette);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

Makes a copy of a device-dependent bitmap (DDB) and assigns the copy to the Main Control.

For the hPalette parameter, you can use the GetPalette method to get the palette handle.

Ordinarily, you would need a DDB only if you are using Windows API functions. Nevertheless, for simplicity, the examples in this documentation get and set a DDB without using the API.

See Also

Elements	GetDIB method, SetDIB method, GetDDB method

Topics	Raster Images: Exchanging Imgages with Other Objects


hDC Parameter For SetDDB
hDC

Handle to the device responsible for the conversion. The mapping mode of the device context must be MM_TEXT.


hBitmap Parameter For SetDDB
hBitmap

Handle to the DDB to be converted.


hPalette Parameter For SetDDB
hPalette

Handle to the palette used by the DDB. You can use the GetPalette method to get the palette handle.


Return for SetDDB
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetDIB method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetDIB (OLE_HANDLE hDIB);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

Makes a copy of a device independent bitmap (DIB) and assigns the copy to the Main Control.

Ordinarily, you would need a DIB only if you are using Windows API functions. Nevertheless, for simplicity, the examples in this documentation get and set a DIB without using the API.

See Also

Elements	GetDIB method, GetDDB method, SetDDB method

Topics	Raster Images: Exchanging Imgages with Other Objects


hDIB Parameter For SetDIB
hDIB

Handle to the DIB to be converted.


Return for SetDIB
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetDstClipRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetDstClipRect (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Displaying an Image.

Remarks

Sets the destination clipping rectangle that is used when painting an image.

The clipping rectangle specifies the portion of the display rectangle to paint. Generally, this is used for updating changes in the display surface, such as when a user moves another window, uncovering a part of the image that had been covered up.

See Also

Elements	SetDstRect method, SetSrcClipRect method, SetSrcRect method

Topics	Raster Images: Displaying Images


fLeft Parameter For SetDstClipRect
fLeft

The X coordinate of the origin of the clipping rectangle.

The position is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fTop Parameter For SetDstClipRect
fTop

The Y coordinate of the origin of the clipping rectangle.

The position is relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For SetDstClipRect
fWidth

The width of the clipping rectangle. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For SetDstClipRect
fHeight

The height of the clipping rectangle. The unit of measure is determined by the ScaleMode property.


Return for SetDstClipRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetDstRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetDstRect (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Displaying an Image.

Remarks

Sets the destination rectangle that is used when painting an image.

The destination rectangle determines how the source rectangle is scaled and how the image is positioned in the device context.

Because of a Windows limitation, destination rectangle measurements, when converted to pixels, cannot exceed the maximum value of an integer. On WIN32 systems, this is rarely a problem. LEADTOOLS returns an ERROR_INV_RANGE error if the problem occurs. An alternative for scaling large images is to make the source rectangle smaller, using the SetSrcRect method.

The AutoScroll property must be FALSE before setting DstLeft or DstTop.

See Also

Elements	SetDstClipRect method, SetSrcClipRect method, SetSrcRect method

Topics	Raster Images: Displaying Images


fLeft Parameter For SetDstRect
fLeft

The X coordinate of the origin of the destination rectangle.

The position is relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fTop Parameter For SetDstRect
fTop

The Y coordinate of the origin of the destination rectangle.

The position is relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For SetDstRect
fWidth

The width of the destination rectangle. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For SetDstRect
fHeight

The height of the destination rectangle. The unit of measure is determined by the ScaleMode property.


Return for SetDstRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetFloaterDstClipRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetFloaterDstClipRect (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Sets the destination clipping rectangle that is used when painting a floater.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

If the AutoSetRects property is set to True, the clipping rectangle defaults to the full client area of the Main Control. Therefore, you do not have to set this rectangle unless you want to display only part of the floater.

To position and scale the floater, refer to the SetFloaterDstRect method.

See Also

Elements	SetFloaterDstRect method

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


fLeft Parameter For SetFloaterDstClipRect
fLeft

The X coordinate of the origin of the destination clipping rectangle.

The position is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fTop Parameter For SetFloaterDstClipRect
fTop

The Y coordinate of the origin of the destination clipping rectangle.

The position is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For SetFloaterDstClipRect
fWidth

The width of the destination clipping rectangle.

The measurement is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For SetFloaterDstClipRect
fHeight

The height of the destination clipping rectangle.

The measurement is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


Return for SetFloaterDstClipRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetFloaterDstRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetFloaterDstRect (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Positions and sizes the display of the floater by setting destination rectangle.

This method is commonly used in the MouseMove event to reposition the floater in the client area. If the floater is visible, its region is automatically repainted when you set the destination rectangle. If the AutoSetRects property is set to True, the destination rectangle defaults to the size of the floater bitmap. Therefore, you must use this method to set the destination rectangle to the desired position.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	SetFloaterDstClipRect method

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


fLeft Parameter For SetFloaterDstRect
fLeft

The X coordinate of the origin of the destination rectangle.

The position is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fTop Parameter For SetFloaterDstRect
fTop

The Y coordinate of the origin of the destination rectangle.

The position is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For SetFloaterDstRect
fWidth

The width of the destination rectangle.

The measurement is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For SetFloaterDstRect
fHeight

The height of the destination rectangle.

The measurement is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.


Return for SetFloaterDstRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetLoadResolution method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetLoadResolution (short iFormat, float fWidth, float fHeight);

Overview	Refer to Implementing PhotoCD and FlashPix Features.

Remarks

Specifies the physical resolution (width and height) of the FlashPix or PhotoCD file to load.

For PhotoCD files, you can do either of the following:

 Specify one of the exact sets of dimensions in the file. You can determine the available dimensions using the ReadLoadResolutions method.

 Specify 0 for both dimensions to load the default resolution.

For FlashPix files, you can do any of the following:

 Specify one of the exact sets of dimensions in the file. You can determine the available dimensions using the ReadLoadResolutions method.

 Specify either the desired width or desired height to load, and use 0 to get the default for the other dimension. The default preserves the aspect ratio. The load procedure resizes the bitmap while loading it if necessary.

 Specify 0 for both dimensions to load the default resolution.

For JBIG files, you can do any of the following:

 Specify 0 for both dimensions to load the default resolution, which is the highest resolution layer, which corresponds to the image with its FULL DIMENSIONS.
Ex: If the file contains the image at the following dimensions: 800X600, 400X 300 and 200X150, then in the default case the filter will load the image at 800X600.

 Specify either the desired width or desired height to load, and use 0 to get the default for the other dimension. The load procedure will determine the closest resolution layer, which best fits the user's request.
Ex:  If the file contains the image at the following dimensions: 800X600, 400X 300 and 200X150 and the user requests an image with width equal to 780 for example, then LEADTOOLS will automatically know that the proper width is 800 and load the image at the (800X600) resolution.

 Specify one of the exact sets of dimensions in the file. You can determine the available dimensions using the ReadLoadResolutions method.

See Also

Elements	ReadLoadResolutions method, LoadResolutionCount property, LoadResolutionHeight property, LoadResolutionWidth property, PCDRes property, GetLoadResolution method, Load method, LoadFromFile method, LoadMemory method, LoadStamp method

Topics	Raster Images: Loading Files


iFormat Parameter For SetLoadResolution
iFormat

Value	Meaning

FILE_PCD	Kodak PhotoCD

FILE_FPX	Kodak FlashPix

FILE_JBIG	JBIG

FILE_JP2	JPEG 2000.  This file format contains image data and extra information about the contents and organization of the file.

FILE_J2K	JPEG 2000.  This file format contains only a stream of image data.


fWidth Parameter For SetLoadResolution
fWidth

Width of the bitmap to load. You can pass 0 to get the default.


fHeight Parameter For SetLoadResolution
fHeight

Height of the bitmap to load. You can pass 0 to get the default.


Return for SetLoadResolution
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetMagGlassPos method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short SetMagGlassPos (float fXPos, float fYPos);

Overview	Refer to Using the Magnifying Glass

Remarks

Moves the Magnifying Glass to the specified position in the screen.

This method is used to move the magnifying glass to the position, specified by (fXPos, fYPos), on the screen. Since the user is responsible for displaying the magnifying glass and moving it on the screen in a manual update, this method is used in conjunction with ShowMagGlass method.

If the magnifying glass is displayed, this method will move the magnifying glass to the specified (fXPos, fYPos) position and it will be displayed there. If the magnifying glass was hidden, this method will move the magnifying glass to the specified position without displaying it.

This method can be called in the Main Control’s MouseMove event to control the position of the Magnifying Glass.

The unit of measure is determined by the ScaleMode property.

Note:	This method can be used only if the MAGGLASS_MANUAL_UPDATE flag was set in the MagGlassFlags property.

See Also

Elements	MagGlassFlags property, MagGlassCursor event, StartMagGlass method, StopMagGlass method, ShowMagGlass method, UpdateMagGlassFromHandle method

Topics	Raster Images: Displaying Images


fXPos Parameter For SetMagGlassPos
fXPos

The X coordinate of the new position of the magnifying glass, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


fYPos Parameter For SetMagGlassPos
fYPos

The Y coordinate of the new position of the magnifying glass, relative to the Main Control. The unit of measure is determined by the ScaleMode property.


Return for SetMagGlassPos
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetMousePos method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SetMousePos (float x, float y, BOOL bUpdatePos);

Overview	Refer to Implementing Annotations.

Remarks

Sets the coordinates for the automation object to use when processing mouse messages and changes the position of the cursor.

This method can be called while processing the AnnMouseXXX events.

See Also

Elements	AnnMouseDown event, AnnMouseMove event, AnnMouseUp event


x Parameter For SetMousePos
x

The new X coordinate for the automation object to use when processing the mouse messages.


y Parameter For SetMousePos
y

The new Y coordinate for the automation object to use when processing the mouse messages.


bUpdatePos Parameter For SetMousePos
bUpdatePos

Flag that indicates whether to update the cursor position to (x, y). Possible values are:

Value	Meaning

TRUE	Move the cursor to (x, y).

FALSE	Keep the cursor where it is. (The automation object will think the cursor is at (x, y).)


Return for SetMousePos
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetNewStripe method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long SetNewStripe (long nStripeStartRow, long nStripeEndRow);

Overview	Refer to Working with MRC Bitmap.

Remarks

This method is used to manually add a new stripe. The first time it is called, it initializes the control to begin the manual segmentation process. Therefore, it must be called at least once before any other manual segmentation method.

The control should have a valid bitmap before this method is called.

See Also

Elements	SetStripeSegment method

Topics	MRC Bitmap Functions: Manual Segmentation


nStripeStartRow Parameter For SetNewStripe (Mixed Raster Content Control)
nStripeStartRow

The number of the row at which the stripe starts. This row is included in the stripe.


nStripeEndRow Parameter For SetNewStripe (Mixed Raster Content Control)
nStripeEndRow

The number of the row at which the stripe ends. This row is included in the stripe.


Return for SetNewStripe
Return Value

Value	Meaning

>= 0	Index of the newly added stripe. The function was successful.

-1	An error occurred.


SetPicture method (Main Control)

Visual Basic example   Other systems   Visual J++ example

Syntax	short SetPicture (IPictureDisp* pPicture);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

Copies bitmap data from a picture object and assigns it to the Main Control.

See Also

Elements	GetPicture method

Topics	Raster Images: Exchanging Imgages with Other Objects


pPicture Parameter For SetPicture
pPicture

Address of the picture object.


Return for SetPicture
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRgnColor method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetRgnColor (OLE_COLOR crMatch, short iCombineMode);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Adds a region that consists of all pixels of a specified color.

You specify the color using a COLORREF value, which is a Windows-defined data type. You can also specify a palette index as explained in Using Palette Indexes As Color Values.

With this method, you can either replace the current region or create a complex region by setting a flag that determines how the added region interacts with the existing region. For possible values, specified in the iCombineMode parameter, refer to Flags for Setting a Region.

You can use this method to simulate the use of a transparent color as follows:

 Call this method, with the transparent color in the crMatch parameter and L_RGN_SETNOT in the iCombineMode parameter.

 Use the Floater property and the FloaterVisible property to display and manipulate the region, which consists of every part of the bitmap, except the area with the specified color.

See Also

Elements	SetRgnEllipse method, SetRgnRect method, SetRgnRoundRect method, PolygonSize property, OffsetRgn method

Topics	Raster Images: Creating and Using a Region


crMatch Parameter For SetRgnColor
crMatch

The color that defines the region.

You can specify a COLORREF color value (the return value of the RGB macro), or you can specify a palette index as explained in Using Palette Indexes As Color Values.


iCombineMode Parameter For SetRgnColor
iCombineMode

Boolean flag that determines how the added region interacts with the existing region. For possible values, refer to Flags for Setting a Region.


Return for SetRgnColor
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRgnColorHSVRange method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SetRgnColorHSVRange (short nH0, short nS0, short nV0, short nH1, short nS1, short nV1, short iCombineMode);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Creates or updates the bitmap region by adding a region that consists of all the pixels that fall in the range (nH0, nS0, nV0) ... (nH1, nS1, nV1), inclusively.

This method uses the HSV color model to set a region based on a color range.

nH0, nS0, and nV0 define a minimum (inclusive) H,S, and V. nH1, nS1, nV1 define a maximum (inclusive) H,S, and V. A pixel must have H,S, and V all greater than or equal to nH0, nS0, nV0 and less than or equal to nH1, nS1, nV1 to be included in the region.

It is useful for identifying all shades of a certain color. For example, SetRgnColorHSVRange could be used to set a region of all green colors including:

RGB(0,1,0)
RGB(0,2,0)	RGB(1,2,1)
RGB(0,3,0)	RGB(1,3,1)	RGB(2,3,2)
...	...	...	...
RGB(0,255,0)	RGB(1,255,1)	RGB(2,255,2)	...

The diagram below shows how S and V affect the color green (H = 85)

As an example, you could set a region for all red (and colors near red) by specifying arguments as follows:

nH0 = 250	nH1 = 5

nS0 = 1	nS1 = 255

nV0 = 1	nV1 = 255

Note that nH0 is 250 and nH1 is 5.  For a hue to fall in this range, it must be either 250, 251, 252, 253, 254, 255, 1, 2, 3, 4, or 5. Also, note that the hue values wrap from 255 back around to 1.

To update an existing region, you specify how the new region is to be combined with the existing one. For possible values, specified in the iCombineMode parameter, refer to Flags for Setting a Region

See Also

Elements	SetRgnColorRGBRange method, SetRgnColor method

Topics	Raster Images: Creating and Using a Region


nH0 Parameter For SetRgnColorHSVRange
nH0

The minimum Hue of the HSV color range.


nS0 Parameter For SetRgnColorHSVRange
nS0

The minimum Saturation of the HSV color range.


nV0 Parameter For SetRgnColorHSVRange
nV0

The minimum Value of the HSV color range.


nH1 Parameter For SetRgnColorHSVRange
nH1

The maximum Hue of the HSV color range.


nS1 Parameter For SetRgnColorHSVRange
nS1

The maximum Saturation of the HSV color range.


nV1 Parameter For SetRgnColorHSVRange
nV1

The maximum Value of the HSV color range.


iCombineMode Parameter For SetRgnColorHSVRange
iCombineMode

Boolean flag that determines how the added region interacts with the existing region. For possible values, refer to Flags for Setting a Region.


Return for SetRgnColorHSVRange
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRgnColorRGBRange method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SetRgnColorRGBRange (OLE_COLOR crLower, OLE_COLOR crUpper, short iCombineMode);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Creates or updates the bitmap region by adding a region that consists of all the pixels that fall in the range crLower ... crUpper, inclusively.

This method uses the RGB color model to set a region based on a color range.

To be added to the region a color must fall in the range crLower..crUpper.  To set a region for all pure red, specify crLower and crUpper as follows:

crLower RGB(1,0,0)

crUpper(255,0,0)

Note that this would fail to include many colors that look red to the eye (like RGB(255,4,4)). To include ALL shades of red, you can use the SetRgnColorHSVRange method.

To update an existing region, you specify how the new region is to be combined with the existing one. For possible values, specified in the iCombineMode parameter, refer to Flags for Setting a Region

See Also

Elements	SetRgnColorHSVRange method, SetRgnColor method

Topics	Raster Images: Creating and Using a Region


crLower Parameter For SetRgnColorRGBRange
crLower

OLE_COLOR that contains the minimum (inclusive) R, G and B values. A pixel must have R,G, and B all greater than or equal to crLower and less than or equal to crUpper to be included in the region.


crUpper Parameter For SetRgnColorRGBRange
crUpper

OLE_COLOR that contains the maximum (inclusive) R, G and B values. A pixel must have R,G, and B all greater than or equal to crLower and less than or equal to crUpper to be included in the region.


iCombineMode Parameter For SetRgnColorRGBRange
iCombineMode

Boolean flag that determines how the added region interacts with the existing region. For possible values, refer to Flags for Setting a Region.


Return for SetRgnColorRGBRange
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRgnCurve method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SetRgnCurve (short iFillMode, short iCombineMode);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Creates or updates the bitmap region by adding a curved region.

This method can draw two types of curves: a smooth curve that goes through all of the points, or a series of Bezier curves that use the points as control points. The type of curve drawn is determined by the CurveType property. The points are contained int the CurveX property and the CurveY property.

To create a curve region, first build an ordered array of points for the curve. Then create the region based on the array. The CurveSize property specifies the size of the array. Either specify a large array to start with, or increase the size of the array as needed, without losing existing points. For each point, update the following indexed properties:

 CurveX property

 CurveY property

and define the characteristics of the curve by setting the following properties:

 CurveType property

 CurveTension property

 CurveClose property

Then call the SetRgnCurve method to add the region to the bitmap.

See Also

Elements	CurveX property, CurveY property, CurveSize property, CurveToBezier method, CurveTension property, CurveClose property, CurveType property, SetRgnEllipse method, SetRgnRect method, SetRgnRoundRect method, SetRgnColor method, OffsetRgn method

Topics	Raster Images: Creating and Using a Region


iFillMode Parameter For SetRgnCurve
iFillMode

Flag that indicates how to handle complex crossing lines. The following are valid values, which are illustrated below:

Value	Meaning

L_POLY_WINDING	[0] All pixels that are inside the resulting exterior lines are in the region.

L_POLY_ALTERNATE	[1] The region includes the area between odd-numbered and even-numbered polygon sides on each scan line.


iCombineMode Parameter For SetRgnCurve
iCombineMode

Flag that indicates the action to take regarding the existing bitmap region, if one is defined. For descriptions of the possible values, refer to Flags for Setting a Region.


Return for SetRgnCurve
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRgnEllipse method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetRgnEllipse (float fLeft, float fTop, float fWidth, float fHeight, short iCombineMode);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Adds an elliptical region to the bitmap.

With this method, you can either replace the current region or create a complex region by setting a flag that determines how the added region interacts with the existing region. For possible values, specified in the iCombineMode parameter, refer to Flags for Setting a Region.

Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

See Also

Elements	SetRgnRect method, SetRgnRoundRect method, SetRgnColor method, PolygonSize property, OffsetRgn method

Topics	Raster Images: Creating and Using a Region


fLeft Parameter For SetRgnEllipse
fLeft

The X coordinate of the origin of the region's bounding rectangle. Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fTop Parameter For SetRgnEllipse
fTop

The Y coordinate of the origin of the region's bounding rectangle. Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For SetRgnEllipse
fWidth

The width of the region's bounding rectangle. Measurements are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For SetRgnEllipse
fHeight

The height of the region's bounding rectangle. Measurements are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


iCombineMode Parameter For SetRgnEllipse
iCombineMode

Boolean flag that determines how the added region interacts with the existing region. For possible values, refer to Flags for Setting a Region.


Return for SetRgnEllipse
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRgnHandle method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetRgnHandle (OLE_HANDLE hRgn, float fDx, float fDy, short iCombineMode);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Adds a stored region to the current bitmap region.

You can store a region using the GetRgnHandle method or the DeleteRgnHandle method. Keep in mind that the region data contains only positioning information, not the bitmap's pixel values.

With this method, you can either replace the current region or create a complex region by setting a flag that determines how the added region interacts with the existing region. For possible values, specified in the iCombineMode parameter, refer to Flags for Setting a Region.

See Also

Elements	GetFloaterHandle method, GetRgnHandle method, DeleteRgnHandle method, FreeRgn method

Topics	Raster Images: Creating and Using a Region


hRgn Parameter For SetRgnHandle
hRgn

Handle to the stored region. The handle is returned by the method that stores the region.


fDx Parameter For SetRgnHandle
fDx

The horizontal distance to offset the region when adding it to the bitmap. Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fDy Parameter For SetRgnHandle
fDy

The vertical distance to offset the region when adding it to the bitmap. Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


iCombineMode Parameter For SetRgnHandle
iCombineMode

Boolean flag that determines how the added region interacts with the existing region. For possible values, refer to Flags for Setting a Region.


Return for SetRgnHandle
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRgnMagicWand method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SetRgnMagicWand (float x, float, y, short iTolerance, short iCombineMode);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Sets a region based on the color found at point x, y in the region.

With this method, you can either replace the current region or create a complex region by setting a flag that determines how the added region interacts with the existing region. For possible values, specified in the iCombineMode parameter, refer to Flags for Setting a Region.

See Also

Elements	SetRgnColor method

Topics	Raster Images: Creating and Using a Region


x Parameter For SetRgnMagicWand
x

X coordinate of a point. The color of the specified point will be used to set the region.


y Parameter For SetRgnMagicWand
y

Y coordinate of a point. The color of the specified point will be used to set the region.


iTolerance Parameter For SetRgnMagicWand
iTolerance

Tolerance value that sets the stopping point when coloring the region. For example, if the color of the pixel at (x, y) is (125, 125, 125) and this parameter is 20, then pixels with values of (106, 106, 106) to (144, 144, 144) will be added to the region.


iCombineMode Parameter For SetRgnMagicWand
iCombineMode

Boolean flag that determines how the added region interacts with the existing region. For possible values, refer to Flags for Setting a Region.


Return for SetRgnMagicWand
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRgnPolygon method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetRgnPolygon (short iFillMode, short iCombineMode);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Adds a polygonal region to the bitmap.

With this method, you can either replace the current region or create a complex region by setting a flag that determines how the added region interacts with the existing region. For possible values, specified in the iCombineMode parameter, refer to Flags for Setting a Region.

To create a polygonal region, you must first build an ordered array of points for the vertices of the polygon; then create the region based on the array. The PolygonSize property specifies the size of the array. You can either specify a large array to start with, or you can increase the size of the array when necessary (without losing the existing points). For each vertex, you update the array by setting the following indexed properties:

 PolygonX property

 PolygonY property

You can then call the SetRgnPolygon method.

See Also

Topics	Raster Images: Creating and Using a Region


iFillMode Parameter For SetRgnPolygon
iFillMode

Flag that indicates how to handle complex crossing lines. The following are valid values, which are illustrated below:

Value	Meaning

L_POLY_WINDING	All pixels that are inside the resulting exterior lines are in the region.

L_POLY_ALTERNATE	The region includes the area between odd-numbered and even-numbered polygon sides on each scan line.


iCombineMode Parameter For SetRgnPolygon
iCombineMode

Boolean flag that determines how the added region interacts with the existing region. For possible values, refer to Flags for Setting a Region.


Return for SetRgnPolygon
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRgnRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetRgnRect (float fLeft, float fTop, float fWidth, float fHeight, short iCombineMode);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Adds a rectangular region to the bitmap.

With this method, you can either replace the current region or create a complex region by setting a flag that determines how the added region interacts with the existing region. For possible values, specified in the iCombineMode parameter, refer to Flags for Setting a Region.

Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

See Also

Elements	SetRgnEllipse method, SetRgnRoundRect method, SetRgnColor method, PolygonSize property, OffsetRgn method

Topics	Raster Images: Creating and Using a Region


fLeft Parameter For SetRgnRect
fLeft

The X coordinate of the origin of the region. Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fTop Parameter For SetRgnRect
fTop

The Y coordinate of the origin of the region. Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For SetRgnRect
fWidth

The width of the region. Measurements are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For SetRgnRect
fHeight

The height of the region. Measurements are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


iCombineMode Parameter For SetRgnRect
iCombineMode

Boolean flag that determines how the added region interacts with the existing region. For possible values, refer to Flags for Setting a Region.


Return for SetRgnRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRgnRoundRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetRgnRoundRect (float fLeft, float fTop, float fWidth, float fHeight, float fWidthEllipse, float fHeightEllipse, short iCombineMode);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Adds a rounded rectangular region to the bitmap.

With this method, you can either replace the current region or create a complex region by setting a flag that determines how the added region interacts with the existing region. For possible values, specified in the iCombineMode parameter, refer to Flags for Setting a Region.

Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

The following illustration shows how the you describe the rounded corners by specifying the width and height of an ellipse:

See Also

Elements	SetRgnEllipse method, SetRgnRect method, SetRgnColor method, PolygonSize property, OffsetRgn method

Topics	Raster Images: Creating and Using a Region


fLeft Parameter For SetRgnRoundRect
fLeft

The X coordinate of the origin of the region's bounding rectangle. Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fTop Parameter For SetRgnRoundRect
fTop

The Y coordinate of the origin of the region's bounding rectangle. Coordinates are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For SetRgnRoundRect
fWidth

The width of the region's bounding rectangle. Measurements are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For SetRgnRoundRect
fHeight

The height of the region's bounding rectangle. Measurements are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fWidthEllipse Parameter For SetRgnRoundRect
fWidthEllipse

The width of the ellipse that describes the arc of the rounded corners. Measurements are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


fHeightEllipse Parameter For SetRgnRoundRect
fHeightEllipse

The height of the ellipse that describes the arc of the rounded corners. Measurements are unscaled relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.


iCombineMode Parameter For SetRgnRoundRect
iCombineMode

Boolean flag that determines how the added region interacts with the existing region. For possible values, refer to Flags for Setting a Region.


Return for SetRgnRoundRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetRubberBandRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void SetRubberBandRect (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Marking a Selection with a Rubberband

Remarks

Sets the position and size of a rubberband, which is a one-pixel outline of a rectangle on the display surface.

Typically, you would use this method to outline an area that the user selects with a mouse. The unit of measure is determined by the ScaleMode property. This method works with the following properties:

 The RubberbandVisible property lets you set the rubberband to be visible or invisible (effectively, turning it on or off).

 The RubberbandHeight property is the current height.

 The RubberbandLeft property is the current X coordinate of the origin of the rubberband.

 The RubberbandTop property is the current Y coordinate of the origin of the rubberband..

 The RubberbandWidth property is the current width.

See Also

Topics	Working with the Control: Client Area Usage


fLeft Parameter For SetRubberBandRect
fLeft

The X coordinate of the origin of the rubberband. The unit of measure is determined by the ScaleMode property.


fTop Parameter For SetRubberBandRect
fTop

The Y coordinate of the origin of the rubberband. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For SetRubberBandRect
fWidth

The width of the rubberband. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For SetRubberBandRect
fHeight

The height of the rubberband. The unit of measure is determined by the ScaleMode property.


Return for SetRubberBandRect
Return Value

None.


SetSelectionBitmap method (Main Control)
SetSelectionBitmap method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short SetSelectionBitmap (OLE_COLOR crTransparent, long Bitmap);

Overview	Refer to Using the Image List Control.

Remarks

Displays selected items using the specified user-defined bitmap when the SelectionStyle property is set to SELECTIONSTYLE_USERBITMAP. The specified bitmap will be drawn with the specified color as transparent, and will be centered around each selected item.

See Also

Elements	ItemWidth property, ItemHeight property, SelectionStyle property

Topics	Raster Images: Displaying Images


crTransparent Parameter For SetSelectionBitmap
crTransparent

Color value of the transparent color.


Bitmap Parameter For SetSelectionBitmap
Bitmap

Handle to a bitmap to use as the selection bitmap


Return for SetSelectionBitmap
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetServerBitmap method (Main Control)

Visual Basic example   Access 95, 97 example   Other systems

Syntax	short SetServerBitmap (long pServer);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

Copies the LEAD ActiveX bitmap to the specified LEAD OLE Sever control.

You can use this method with the GetServerBitmap method to take advantage of the different capabilities of the ActiveX and the OLE server. For more information on the OLE server, refer to LEAD OLE Server.

See Also

Elements	GetServerBitmap method

Topics	Raster Images: Exchanging Images with Other Objects


pServer Parameter For SetServerBitmap
pServer

LEAD OLE Server object.


Return for SetServerBitmap
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetSrcClipRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetSrcClipRect (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Displaying an Image.

Remarks

Sets the source clipping rectangle that is used when painting an image.

The clipping rectangle specifies the portion of the source rectangle to paint. This is used for updating the display when part of the source bitmap has changed.

See Also

Elements	SetDstClipRect method, SetDstRect method, SetSrcRect method

Topics	Raster Images: Displaying Images


fLeft Parameter For SetSrcClipRect
fLeft

The X coordinate of the origin of the clipping rectangle. The position is relative to the bitmap. The unit of measure is determined by the ScaleMode property.


fTop Parameter For SetSrcClipRect
fTop

The Y coordinate of the origin of the clipping rectangle. The position is relative to the bitmap. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For SetSrcClipRect
fWidth

The width of the clipping rectangle. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For SetSrcClipRect
fHeight

The height of the clipping rectangle. The unit of measure is determined by the ScaleMode property.


Return for SetSrcClipRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetSrcRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SetSrcRect (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Displaying an Image.

Remarks

Sets the source rectangle that is used when painting an image.

The source rectangle specifies the part of the bitmap to use as the display source.

See Also

Elements	SetDstClipRect method, SetDstRect method, SetSrcClipRect method

Topics	Raster Images: Displaying Images


fLeft Parameter For SetSrcRect
fLeft

The X coordinate of the origin of the source rectangle.

The position is relative to the bitmap. The unit of measure is determined by the ScaleMode property.


fTop Parameter For SetSrcRect
fTop

The Y coordinate of the origin of the source rectangle.

The position is relative to the bitmap. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For SetSrcRect
fWidth

The width of the source rectangle. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For SetSrcRect
fHeight

The height of the source rectangle. The unit of measure is determined by the ScaleMode property.


Return for SetSrcRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SetStripeSegment method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long SetStripeSegment (long nStripeIndex, long SegmentLeft, long SegmentTop, long SegmentRight, long SegmentBottom, MRCSegmentTypeConstants SegType, OLE_COLOR TextForeColor, OLE_COLOR TextBackColor);

Overview	Refer to Working with MRC Bitmap.

Remarks

Manually adds a new segment to an existing stripe. The SetNewStripe method must be used to add a stripe before calling this method.

See Also

Elements	SetNewStripe method

Topics	MRC Bitmap Functions: Manual Segmentation


nStripeIndex Parameter For SetStripeSegment (Mixed Raster Content Control)
nStripeIndex

Index of the stripe to which the new segment is to be added.


SegmentLeft Parameter For SetStripeSegment (Mixed Raster Content Control)
SegmentLeft

Left segment boundary from the original bitmap.


SegmentTop Parameter For SetStripeSegment (Mixed Raster Content Control)
SegmentTop

Top segment boundary from the original bitmap.


SegmentRight Parameter For SetStripeSegment (Mixed Raster Content Control)
SegmentRight

Right segment boundary from the original bitmap.


SegmentBottom Parameter For SetStripeSegment (Mixed Raster Content Control)
SegmentBottom

Bottom segment boundary from the original bitmap.


SegType Parameter For SetStripeSegment (Mixed Raster Content Control)
SegType

Flag that indicates the type of segment.  Possible values are:

Value	Meaning

SEGMENT_TEXT	[0x01] Segment type is text.

SEGMENT_PICTURE	[0x02] Segment type is picture.


TextForeColor Parameter For SetStripeSegment (Mixed Raster Content Control)
TextForeColor

Foreground color for the segment. This parameter is only valid if SegType is SEGMENT_TEXT.


TextBackColor Parameter For SetStripeSegment (Mixed Raster Content Control)
TextBackColor

Background base color. This parameter is only valid if SegType is SEGMENT_TEXT.


Return for SetStripeSegment
Return Value

Value	Meaning

>= 0	Index of the newly added segment. The function was successful.

-1	An error occurred. Refer to Error Codes.


SetTag method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short SetTag (long lTag, short iType, long lCount, VARIANT vData);

Overview	Refer to Implementing TIFF Tags

Remarks

Sets tags to be written to a file. The set tags will actually be written when the WriteTag method or one of the SaveXXX methods is called. This process is similar to the process of writing comments to files using the Comment property and the WriteComment method or Save method.

Only TIFF files support tags. The TIFF specification reserved tags 1 to 32767 for general use (restricted tags) and recommends that tags 32768 to 65535 should be used for application use (user-defined tags). To avoid two applications using the same user-defined tag, it is also recommended that the user-defined tags should be registered with the TIFF administrator (Adobe).

The contact address for the TIFF administrator, as of Nov 5, 1999 is:

Adobe Developers Association

1585 Charleston Road

P.O. Box 7900

Mountain View, CA 94039

E-mail: gapdevsup@adobe.com

The control will maintain a list of tags that have been set. To remove a tag from the list, call SetTag(lTag, 0, 0, NULL).

To remove all tags from the list, call SetTag(0,0,0,NULL). Note that ReadTag method uses tag 0, so you cannot set it by calling SetTag.

See Also

Functions:	WriteTag method, ReadTag method, GetTagData method, GetTagCount method, GetTagType method, Comment property, Save method

Topics	Raster Images: Getting and Setting File Information


lTag Parameter For SetTag
lTag

Tag to identify the data in the TIFF file. Generally, you can specify a private tag in the range of 0x8000 to 0xFFFE. However, LEADTOOLS returns an error if you use any of the following registered tags:

Value	Meaning

0x8298	Copyright comment

0x8769	General Exif comments

0x8825	Exif GPS comments

LEADTOOLS does NOT return an error if you set:

Value	Meaning

0x80A4	Annotation TIFF tag defined as ANNTAG_TIFF.

Note that the tag with index 0 is reserved and will be filled by calling the ReadTag method.


iType Parameter For SetTag
iType

Tagged data type. If vData contains data of a different type than that specified in this parameter, the data in vData will be converted to the type specified here. Valid values are:

Value	Meaning

TAG_BYTE	[1] Byte.

TAG_ASCII	[2] Byte in the range of 0 to 255.

TAG_SHORT	[3] Two bytes, unsigned.

TAG_LONG	[4] Four bytes, unsigned.

TAG_RATIONAL	[5] Eight bytes, used as a pair of unsigned long integers, where the first number is the numerator and the second is the denominator of a fraction.

TAG_SBYTE	[6] Byte used as signed number in the range of -128 to +127.

TAG_UNDEFINED	[7] Byte, with application-defined usage.

TAG_SSHORT	[8] Two bytes, signed.

TAG_SLONG	[9] Four bytes, signed.

TAG_SRATIONAL	[10] Eight bytes, used as a pair of signed long integers, where the first number is the numerator and the second is the denominator of a fraction.

TAG_FLOAT	[11] Four bytes used as a floating point number.

TAG_DOUBLE	[12] Eight bytes used as a double-precision floating point number.


lCount Parameter For SetTag
lCount

The number of data items, based on the tagged data type. For example, if the buffer size is 16 and the data type is TAG_DOUBLE, the count is 2. vData may actually contain more items than indicated by lCount. If vData contains more than lCount items, the extra items will be ignored.


vData Parameter For SetTag
vData

Array that contains the tag data. The type of data is indicated by iType and the number of items in vData is indicated by lCount.


Return for SetTag
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SkipFile property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL SkipFile

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime only) Indicates whether to skip the file passed to the ThumbnailEvent event. Possible values are:

Value	Meaning

TRUE	If the nStatusCode parameter of the ThumbnailEvent event is BROWSE_PRELOAD, then skip the file indicated in the pszFilename parameter of the ThumbnialEvent event. This allows the user to avoid the internal file information processing. If the nStatusCode parameter is any other value, the file will not be skipped.

FALSE	Do not skip the file indicated in the pszFilename parameter of the ThumbnailEvent event.

See Also

Elements	EnableMethodErrors property, StopOnError property, ThumbnailEvent event, BrowseDir method, ContinueBrowse property

Topics	Raster Images: Using the Thumbnail Browser


ShadowColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR ShadowColor

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the color of a drop shadow that is applied to a three-dimensional shape or text object.

To have no drop shadow, set the ShadowXDepth and ShadowYDepth properties to 0.

For text objects, drop shadows are available only for the following TextStyle values:

EFX_TEXTSTYLE_DROPSHADOW
EFX_TEXTSTYLE_BLOCKSHADOW
EFX_TEXTSTYLE_OUTLINEBLOCK

For text objects, the shadow color is used for three-dimensional effects in the following TextStyle styles:

EFX_TEXTSTYLE_INSETHEAVY
EFX_TEXTSTYLE_INSETEXTRAHEAVY
EFX_TEXTSTYLE_RAISEDHEAVY
EFX_TEXTSTYLE_RAISEDEXTRAHEAVY

See Also

Elements	DrawShape method, DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShadowXDepth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ShadowXDepth

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the X offset of a drop shadow that is applied to a three-dimensional shape or text object.

To have no drop shadow, set the ShadowXDepth and ShadowYDepth properties to 0.

Whether you draw to the screen or to the bitmap, drawing objects are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

For text objects, drop shadows are available only for the following TextStyle values:

EFX_TEXTSTYLE_DROPSHADOW
EFX_TEXTSTYLE_BLOCKSHADOW
EFX_TEXTSTYLE_OUTLINEBLOCK

See Also

Elements	DrawShape method, DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShadowYDepth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ShadowYDepth

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the Y offset of a drop shadow that is applied to a three-dimensional shape or text object.

To have no drop shadow, set the ShadowXDepth and ShadowYDepth properties to 0.

Whether you draw to the screen or to the bitmap, drawing objects are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

For text objects, drop shadows are available only for the following TextStyle values:

EFX_TEXTSTYLE_DROPSHADOW
EFX_TEXTSTYLE_BLOCKSHADOW
EFX_TEXTSTYLE_OUTLINEBLOCK

See Also

Elements	DrawShape method, DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeBackgroundStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ShapeBackgroundStyle

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the background style of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

For a list of possible values, refer to BackStyle.

For styles that require an image you must specify a LEAD bitmap in a parameter of the DrawShape method. To use a background image, the PatternStyle property must not be EFX_PATTERN_SOLID.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeBorderColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR ShapeBorderColor

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the line (border) color of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeBorderStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ShapeBorderStyle

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the line (border) style of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

For a list of possible values, refer to BorderStyles.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeBorderThickness property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ShapeBorderThickness

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the line (border) thickness of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

The unit of measure is determined by the ScaleMode property. and it is relative to the Main Control's client area. If the target is the bitmap, LEADTOOLS scales the value if necessary. If the scaled value equates to less than half a pixel, it is rounded to 0.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ShapeHeight

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the height of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

Whether you draw to the screen or to the bitmap, shapes are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates. The unit of measure is determined by the ScaleMode property.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeInnerBandHiliteColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR ShapeInnerBandHiliteColor

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the inner-band highlight color of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeInnerBandShadowColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR ShapeInnerBandShadowColor

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the inner-band shadow color of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeInnerBandStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ShapeInnerBandStyle

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the inner-band style of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

For a list of possible values, refer to ShapeInnerStyles.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeInnerBandThickness property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ShapeInnerBandThickness

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the inner-band thickness of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

The unit of measure is determined by the ScaleMode property. and it is relative to the Main Control's client area. If the target is the bitmap, LEADTOOLS scales the value if necessary. If the scaled value equates to less than half a pixel, it is rounded to 0.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ShapeLeft

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the X coordinate of the origin of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

Whether you draw to the screen or to the bitmap, shapes are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates. The unit of measure is determined by the ScaleMode property.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeOuterBandHiliteColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR ShapeOuterBandHiliteColor

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the outer-band highlight color of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeOuterBandShadowColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR ShapeOuterBandShadowColor

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the outer-band shadow color of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeOuterBandStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ShapeOuterBandStyle

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the outer-band style of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

For a list of possible values, refer to ShapeOuterStyle.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeOuterBandThickness property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ShapeOuterBandThickness

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the outer-band thickness of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

The unit of measure is determined by the ScaleMode property. and it is relative to the Main Control's client area. If the target is the bitmap, LEADTOOLS scales the value if necessary. If the scaled value equates to less than half a pixel, it is rounded to 0.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ShapeTop

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the Y coordinate of the origin of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

Whether you draw to the screen or to the bitmap, shapes are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates. The unit of measure is determined by the ScaleMode property.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ShapeWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float ShapeWidth

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the width of a three-dimensional shape that you draw with the DrawShape method. The size, position, and other aspects of the shape are determined by a number of properties, as explained in Drawing Three-Dimensional Shapes and Text.

Whether you draw to the screen or to the bitmap, shapes are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates. The unit of measure is determined by the ScaleMode property.

See Also

Elements	DrawShape method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


Sharpen method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Sharpen (short iChange);

Overview	Refer to Detecting and Enhancing Edges and Lines.

Remarks

Increases or decreases the sharpness of the image in the bitmap.

Negative values decrease the sharpness of the image. Specify -1000 for minimum sharpness. Positive values increase the sharpness. Specify +1000 for maximum sharpness.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	GetChange method

Topics	Raster Images: Filtering Images
Raster Images: Where the Region Preempts the Bitmap


iChange Parameter For Sharpen
iChange

The amount to change the sharpness. Valid values range from -1000 to + 1000.


Return for Sharpen
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Shear method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Shear (short iAngle, BOOL bHorizontal, OLE_COLOR crFill);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Moves the corners of the bitmap in the fashion of a parallelogram.

You specify an angle of slant, horizontal or vertical shear, and the fill color for the created space. The angle is expressed in hundredths of degrees, with a limit of 4500 (45 degrees).

The following are horizontal and vertical examples:

See Also

Elements	GetAngle method

Topics	Raster Images: Doing Geometric Transformations
Raster Images: Methods That Transform the Region and the Bitmap (Document/Medical only)


iAngle Parameter For Shear
iAngle

The angle of slant. Positive values are for clockwise angles; negative values are for counterclockwise angles. The angle is expressed in hundredths of degrees, with a limit of 4500 (45 degrees).


bHorizontal Parameter For Shear
bHorizontal

TRUE for horizontal shear, or FALSE for vertical shear.


crFill Parameter For Shear
crFill

The fill color.

If the image is 8 bits per pixel or less, the color comes from the current palette, and it may not exactly match the specified color.

You can specify a COLORREF value (the return value of the RGB macro), or you can specify a palette index as explained in Using Palette Indexes As Color Values.


Return for Shear
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ShowMagGlass method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short ShowMagGlass (BOOL bShowMagGlass);

Overview	Refer to Using the Magnifying Glass

Remarks

Shows or hides the magnifying glass on the screen.

This method is used to control the display of the magnifying glass in the screen. Since the user is responsible for displaying the magnifying glass and moving it on the screen in a manual update, this method is used in conjunction with SetMagGlassPos method.

This method can be called with bShowMagGlass set to TRUE when the left mouse button is pressed to show the magnifying glass. It can be called with bShowMagGlass set to FALSE when the left mouse button is released to hide the magnifying glass.

Note:	This method can be used only if the MAGGLASS_MANUAL_UPDATE flag was set in the MagGlassFlags property.

See Also

Elements	MagGlassFlags property, MagGlassCursor event, StartMagGlass method, StopMagGlass method, SetMagGlassPos method, UpdateMagGlassFromHandle method

Topics	Raster Images: Displaying Images


bShowMagGlass Parameter For ShowMagGlass
bShowMagGlass

Flag that indicates whether to show or hide the Magnifying Glass. Possible values are:

Value	Meaning

TRUE	Show the Magnifying Glass.

FALSE	Hide the Magnifying Glass.


Return for ShowMagGlass
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ShowPanWin method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short ShowPanWin (BOOL bShow);

Overview	Refer to Using a PanWindow.

Remarks

Shows or hides the PanWindow.  Can only be used if the main control currently has a bitmap loaded.

See Also

Elements	PanWinBitonalScaling property, PanWinCursor property, PanWinHeight property, PanWinIcon property, PanWinPaintDither property, PanWinPaintPalette property, PanWinPointer property, PanWinRectColor property, PanWinSysMenu property, PanWinTitle property, PanWinWidth property, PanWinX property, PanWinY property, PanWin event

Topics	Raster Images: Displaying and Printing


bShow Parameter For ShowPanWin
bShow

Specifies whether to show PanWindow.

Setting	Description

TRUE	Show the PanWindow.

FALSE	Hide the PanWindow.


Return for ShowPanWin
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Size method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Size (float fWidth, float fHeight, short iFlags);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Resizes the bitmap to a new width and height.

This changes the storage requirements of the bitmap, and it is not the same as scaling the display (zooming out or zooming in).

Passing 0 for fWidth will cause the method to preserve the aspect ratio by automatically computing fWidth based on the fHeight argument.  The same holds true if passing 0 for fHeight.  Note that the method will return an error if passing nWidth=0 and nHeight = 0.

See Also

Elements	GetSize method

Topics	Raster Images: Doing Geometric Transformations
Raster Images: Methods That Transform the Region and the Bitmap (Document/Medical only)


fWidth Parameter For Size
fWidth

New width. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For Size
fHeight

New height. The unit of measure is determined by the ScaleMode property.


iFlags Parameter For Size
iFlags

Possible values are:

Value	Meaning

RESIZE_NORMAL	[0x0000] Use the normal resizing method.

RESIZE_RESAMPLE	[0x0002] Resize the bitmap, using interpolation and averaging to produce a higher-quality image than is achieved with normal resizing.

RESIZE_FAVORBLACK	[0x0001] (Document/Medical only) Preserve black objects when making the image smaller. This option affects only 1-bit, black-and-white images, where it prevents the disappearance of thin lines. You can use a plus (+) operator to combine this flag with another one. For example, RESIZE_RESAMPLE + RESIZE_FAVORBLACK causes color images to be resampled, but applies the favor-black option to 1-bit, black-and-white images.

RESIZE_FAVORBLACK_OR_RESAMPLE	[0x0003] Uses FavorBlack for 1-bit images and Resample for color images.

RESIZE_BICUBIC	[0x0004] Uses bicubic interpolation.

RESIZE_FAVORBLACK_OR_BICUBIC	[0x0005] Uses FavorBlack for 1-bit images and Bicubic for color images.


Return for Size
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Smooth event (Main Control)
SmoothEvent event (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	void SmoothEvent (long nBumpOrNick, long nStartRow, long nStartCol, long nLength, long uHorV);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) This event is triggered for each bump and nick found by the Smooth method. Set the DocCleanSuccess property to SUCCESS_REMOVE to have the bump removed or the nick filled. Set the DocCleanSuccess property to SUCCESS_NOREMOVE to leave the bump or nick unchanged. Set the DocCleanSuccess property to 0 to abort. If the uFlags parameter of the Smooth method is set to SMOOTH_IMAGE_UNCHANGED | SMOOTH_SINGLE_REGION, then the value of the DocCleanSuccess property affects only the internal single region.

See Also

Elements	Smooth method

Topics	Raster Images: Cleaning - up 1-Bit Images


nBumpOrNick Parameter For Smooth
nBumpOrNick

Flag that indicates whether to remove bumps or fill in nicks. Possible values are:

Value	Meaning

SMOOTH_BUMP	Remove a bump.

SMOOTH_NICK	Fill in a nick.


nStartRow Parameter For Smooth
nStartRow

The starting row of the bump or nick. The rows are zero-based.


nStartCol Parameter For Smooth
nStartCol

The starting column of the bump or nick. The columns are zero-based.


nLength Parameter For Smooth
nLength

Length (in pixels) of the bump or nick.


uHorV Parameter For Smooth
uHorV

Flag that indicates whether the element being smoothed is vertical or horizontal. Possible values are:

Value	Meaning

SMOOTH_HORIZONTAL_ELEMENT	A horizontal bump or nick

SMOOTH_VERTICAL_ELEMENT	A vertical bump or nick


Smooth method (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	short Smooth (long iLength, long uFlags);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) Smooths the bumps and fills in the nicks of a 1-bit black and white image.

This method smooths the text in scanned text documents.

The behavior of this method can be modified by using the SmoothEvent event.

This method works only on 1-bit black and white images.

If a region is selected, only the selected region will be changed by this method. If no region is selected, the whole image will be processed.

This method triggers both the SmoothEvent event and the ProgressStatus event.

See Also

Elements	SmoothEvent event

Topics	Raster Images: Cleaning - up 1-Bit Images


iLength Parameter For Smooth
iLength

Length of the bump (or nick) to remove (or fill). All bumps and nicks less than or equal to this size are processed. This value is in pixels.


uFlags Parameter For Smooth
uFlags

Flags that determine the behavior of the smoothing process. Flags may be combined using a bitwise OR . Possible values are:

Value	Meaning

SMOOTH_SINGLE_REGION:	For each bump or nick found by the Smooth method, if the DocCleanSuccess property is set to SUCCESS_REMOVE in the Smooth event, the removed bump or nick is added to an internal single region. If the DocCleanSuccess property is set to SUCCESS_NOREMOVE, the bump or nick is not added to the single region. When the Smooth method returns, either the DocCleanBitmap property or the hDocCleanRgn property will reference a region that contains all the removed bumps or nicks. If SMOOTH_LEAD_REGION is also set, the DocCleanBitmap will be updated with a bitmap that has a LEAD region that contains all the removed bumps or nicks. If SMOOTH_LEAD_REGION is not set, the hDocCleanRgn property is set to a Windows region that contains all the removed nicks or bumps. When the region (either LEAD or Windows) is no longer needed, it must be destroyed.

SMOOTH_LEAD_REGION	When the Smooth method returns, the DocCleanBitmap property is updated with a copy of the bitmap that also contains a region with all the removed bumps or nicks. This flag must be used in conjunction with SMOOTH_SINGLE_REGION. To use this flag set uFlags to SMOOTH_SINGLE_REGION | SMOOTH_LEAD_REGION. The DocCleanBitmap property will be updated when the Smooth method returns.

SMOOTH_IMAGE_UNCHANGED	The original image is unchanged.

SMOOTH_FAVOR_LONG	Processes long bumps or nicks before short bumps or nicks. If this flag is not passed, short is favored over long. For example:

Smooth the following image with iLength == 3

  X    X
XXXXXXXXXX

Favoring short would remove the two "bumps" giving:
XXXXXXXXXX

Favoring long would fill in the "gap" giving:

  XXXXX
XXXXXXXXXX


Return for Smooth
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Solarize method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Solarize (short iThreshold);

Overview	Refer to Applying Artistic Effects.

Remarks

Applies an effect that mimics the accidental exposure of photographic film to light. It does so by inverting all color data with an intensity value greater than or equal to the threshold that you specify.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	GetChange method

Topics	Raster Images: Filtering Images


iThreshold Parameter For Solarize
iThreshold

Threshold at or above which colors are to be inverted. The valid range is 0-255.


Return for Solarize
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Sort method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short Sort (BOOL bAscending);

Overview	Refer to Using the ImageList Control.

Remarks

Sorts the items in the ImageList Control based on their Text attribute.

See Also

Elements	Item property, Insert method, InsertAt method, Count property, Remove method, InsertFromBitmapList method, LoadFromFile method, SaveToFile method

Topics	Raster Images: Displaying Images


bAscending Parameter For Sort
bAscending

Flag indicating direction of the sort.

Value	Meaning

True	sort in ascending order

False	sort in descending order


Return for Sort
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SpatialFilter method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short SpatialFilter (short iType);

Overview	Refer to Detecting and Enhancing Edges and Lines.

Remarks

Imposes a spatial filter on the bitmap. Spatial filters are used for operations such as sharpening an image or detecting edges within the image.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

This method works best with 24-bit, 16-bit, or grayscale bitmaps. If a bitmap uses a color palette, this method matches the new brightness value of each pixel to the nearest color in the existing palette.

See Also

Elements	GetFilter method

Topics	Raster Images: Filtering Images
Raster Images: Where the Region Preempts the Bitmap


iType Parameter For SpatialFilter
iType

Refer to List of Spatial Filters.


Return for SpatialFilter
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


SrcClipHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float SrcClipHeight

Overview	Refer to Displaying an Image.

Remarks

Is the height of the source clipping rectangle to use when painting.

The initial value is the height of the bitmap. You can set this property or use the SetSrcClipRect method to change the value.

The clipping rectangle specifies the portion of the source rectangle to paint. Generally, this rectangle is used for updating the display when part of the source bitmap has changed. The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	SrcClipLeft property, SrcClipTop property, SrcClipWidth property

Topics	Raster Images: Displaying Images


SrcClipLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float SrcClipLeft

Overview	Refer to Displaying an Image.

Remarks

Is the X coordinate of the origin of the source clipping rectangle to use when painting.

The initial value is 0. You can set this property or use the SetSrcClipRect method to change the value.

The clipping rectangle specifies the portion of the source rectangle to paint. Generally, this rectangle is used for updating the display when part of the source bitmap has changed. The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	SrcClipHeight property, SrcClipTop property, SrcClipWidth property

Topics	Raster Images: Displaying Images


SrcClipTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float SrcClipTop

Overview	Refer to Displaying an Image.

Remarks

Is the Y coordinate of the origin of the source clipping rectangle to use when painting.

The initial value is 0. You can set this property or use the SetSrcClipRect method to change the value.

The clipping rectangle specifies the portion of the source rectangle to paint. Generally, this rectangle is used for updating the display when part of the source bitmap has changed. The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	SrcClipHeight property, SrcClipLeft property, SrcClipWidth property

Topics	Raster Images: Displaying Images


SrcClipWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float SrcClipWidth

Overview	Refer to Displaying an Image.

Remarks

Is the width of the source clipping rectangle to use when painting.

The initial value is the width of the bitmap. You can set this property or use the SetSrcClipRect method to change the value.

The clipping rectangle specifies the portion of the source rectangle to paint. Generally, this rectangle is used for updating the display when part of the source bitmap has changed. The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	SrcClipHeight property, SrcClipLeft property, SrcClipTop property

Topics	Raster Images: Displaying Images


SrcHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float SrcHeight

Overview	Refer to Displaying an Image.

Remarks

Is the height of the source rectangle to use when painting.

The initial value is the height of the bitmap. You can set this property or use the SetSrcRect method to change the value.

The source rectangle specifies the portion of the bitmap to paint. Generally, this rectangle is used with the destination rectangle to scale the display. The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	SrcLeft property, SrcTop property, SrcWidth property

Topics	Raster Images: Displaying Images


SrcLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float SrcLeft

Overview	Refer to Displaying an Image.

Remarks

Is the X coordinate of the origin of the source rectangle to use when painting.

The initial value is 0. You can set this property or use the SetSrcRect method to change the value.

The source rectangle specifies the portion of the bitmap to paint. Generally, this rectangle is used with the destination rectangle to scale the display. The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	SrcHeight property, SrcTop property, SrcWidth property

Topics	Raster Images: Displaying Images


SrcTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float SrcTop

Overview	Refer to Displaying an Image.

Remarks

Is the Y coordinate of the origin of the source rectangle to use when painting.

The initial value is 0. You can set this property or use the SetSrcRect method to change the value.

The source rectangle specifies the portion of the bitmap to paint. Generally, this rectangle is used with the destination rectangle to scale the display. The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	SrcHeight property, SrcLeft property, SrcWidth property

Topics	Raster Images: Displaying Images


SrcWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float SrcWidth

Overview	Refer to Displaying an Image.

Remarks

Is the width of the source rectangle to use when painting.

The initial value is the width of the bitmap. You can set this property or use the SetSrcRect method to change the value.

The source rectangle specifies the portion of the bitmap to paint. Generally, this rectangle is used with the destination rectangle to scale the display. The unit of measure is determined by the ScaleMode property, and the position of the rectangle is relative to the origin of the bitmap.

See Also

Elements	SrcHeight property, SrcLeft property, SrcTop property

Topics	Raster Images: Displaying Images


STable property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short STable (short iIndex);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Saturation lookup table. The saturation indicates the amount of white present in a color. This is one of the four tables that the RemapHue method uses to change the bitmap's hue, saturation and value. This property is used only if the bUseSTable parameter is set to TRUE when the RemapHue method is called. Hue, Saturation, and Value levels range from 0 to 255.  Therefore, the lookup tables each have 256 entries. The current hue, saturation and value of a pixel correspond to the table indexes.

If the bUseMaskTable and bUseSTable parameters are set to TRUE when the RemapHue method is called and the MaskTable(i) entry for a particular hue is not zero, then the saturation is changed to the saturation in STable(i). If MaskTable(i) is 0 then STable(i) is ignored. For example, if RemapHue is called with both bUseMaskTable and bUseSTable set to TRUE, then if a pixel has a hue of 85 and the MaskTable(85) is not 0, the saturation of the pixel is changed to STable(85).

If the bUseMaskTable parameter is FALSE and the bUseSTable parameter is TRUE when the RemapHue method is called, then the Saturation for each color present in the image will be changed to STable(i). For example, if a pixel has a hue of 70, the saturation of the pixel is changed to STable(70). If the next pixel has a hue of 75, the saturation of that pixel is changed to STable(75).

Saturation entries range from 0 to 255 where

Saturation 0 contains the most white.

Saturation 255 contains no white.

See Also

Elements	RemapHue method, MaskTable property, HTable property, VTable property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Modifying Intensity Values


iIndex Parameter For STable
iIndex

The index into the array. The first element of the array is 0. The values present in this array are Saturation values used to remap an image.


STableL property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short STableL (long lIndex);

Overview	Refer to Changing Brightness and Contrast.

Remarks

(Document/Medical only) Saturation lookup table. The saturation indicates the amount of white present in a color. This is one of the four tables that the RemapHue method uses to change the bitmap's hue, saturation and value. This property is used only if the bUseSTable parameter is set to TRUE when the RemapHue method is called and the RemapHueTablesSize property is set to 65536. Hue, Saturation, and Value levels range from 0 to 255.  The current hue, saturation and value of a pixel correspond to the table indexes.

If the bUseMaskTable and bUseSTable parameters are set to TRUE when the RemapHue method is called and the MaskTableL(i) entry for a particular hue is not zero, then the saturation is changed to the saturation in STableL(i). If MaskTableL(i) is 0 then STableL(i) is ignored. For example, if RemapHue is called with both bUseMaskTable and bUseSTable set to TRUE, then if a pixel has a hue of 85 and the MaskTableL(85) is not 0, the saturation of the pixel is changed to STableL(85).

If the bUseMaskTable parameter is FALSE and the bUseSTable parameter is TRUE when the RemapHue method is called, then the Saturation for each color present in the image will be changed to STableL(i). For example, if a pixel has a hue of 70, the saturation of the pixel is changed to STableL(70). If the next pixel has a hue of 75, the saturation of that pixel is changed to STableL(75).

Saturation entries range from 0 to 255 where

Saturation 0 contains the most white.

Saturation 255 contains no white.

This property provides support for 16-bit grayscale and 48-bit color images. Support for 16-bit grayscale and 48-bit color images is provided only in Document/Medical toolkits.

See Also

Elements	RemapHue method, MaskTableL property, HTable property, VTableL property, MaskTable property, HTable property, VTable property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Modifying Intensity Values


lIndex Parameter For STableL
lIndex

The index into the array. The first element of the array is 0. The values present in this array are Saturation values used to remap an image.


StartFeedLoad method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short StartFeedLoad (short iBitsPerPixel, long lPage, long lPages);

Overview	Refer to Loading a Bitmap from Your Own Buffer.

Remarks

Initializes a file-load process in which you control the input stream. You must call the FeedLoad method to supply buffered data, and you must call StopFeedLoad method when the loading is complete.

This file-load process is useful when receiving transmitted images, such as those on the Internet. It works the same way as the Load method , except that your code supplies the image data. The file-load process works as follows:

1.	You call the StartFeedLoad method to initialize the file-load process.

2.	You create a buffer, and each time you fill it with information, you call the FeedLoad method, which sends the data to the file-load process just as if the data were being read from a file on disk.

3.	Whenever it has enough data to do so, the file-load process behaves the same as in the Load method. It allocates and begins loading the bitmap. It generates a ProgressStatus event whenever it has enough data in its input buffer.

The file-load process does not update information in the LEAD Control until the StopFeedLoad method is called.

4.	To end the file-load process, you call the StopFeedLoad method, which cleans up the process. If you call this method before supplying the complete file, it will successfully clean up the process, but will return a file-read error. You should trap the error if the load is canceled purposely.

Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits.

See Also

Elements	Load method, LoadStamp method, BitmapDataPath property, LoadMemory method

Topics	Raster Images: Loading Files


iBitsPerPixel Parameter For StartFeedLoad
iBitsPerPixel

Resulting bitmap pixel depth. The following are valid values:

Value	Meaning

0	Keep the original file's pixel depth (Do not convert). A special note about loading 12 and 16-bit grayscale images.

1	1 bit per pixel in the resultant bitmap

4	4 bits per pixel in the resultant bitmap

8	8 bits per pixel in the resultant bitmap

12	12 bits per pixel in the resultant bitmap

16	16 bits per pixel in the resultant bitmap

24	24 bits per pixel in the resultant bitmap

32	32 bits per pixel in the resultant bitmap


lPage Parameter For StartFeedLoad
lPage

The page number (for multipage files) that contains the first image to be loaded.

If the file is not a multipage file, pass 0.


lPages Parameter For StartFeedLoad
lPages

The number of pages to load. If the file is not a multipage file, pass 1.


Return for StartFeedLoad
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


StartMagGlass method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short StartMagGlass (float fWidth, float fHeight, short nZoom, OLE_COLOR clrPen, OLE_COLOR clrBack, boolean bEllipse, float fBorderSize, boolean b3D, short nCrosshair, boolean bIgnoreRgn, boolean bCenter);

Overview	Refer to Using the Magnifying Glass

Remarks

Starts the Magnify Glass procedure.

The appearance of the magnifying glass depends on the values of bEllipse, clrPen, b3D and fBorderSize. This can be seen in the table below:

bEllipse	b3D	FborderSize	ClrPen	Result
TRUE	Ignored	Valid	Valid	An elliptical magnifying glass of border size fBorderSize and border color clrPen.
FALSE	FALSE	Valid	Valid	A rectangular magnifying glass with a flat border of width fBorderSize and border color clrPen.
FALSE	TRUE	Ignored	Ignored	A rectangular magnifying glass with a 3D border having a set width and color.
The following properties can be used to control the painting options for the magnifying glass:

PanWinPaintPalette property

PanWinBitonalScaling property

PanWinPaintDither property

PanWinPaintScaling property

The cursor for the magnifying glass can have one of the following default shapes:

When bEllipse = TRUE, the default cursor will be:

When bEllipse = FALSE, the default cursor will be:

A custom shape can be used by setting the following properties:

PanWinPointer = 99 ' custom
PanWinCursor = Your custom cursor image

Note:	To make use of other shapes of the Magnifying Glass use the UpdateMagGlassShape method.

See Also

Elements	StopMagGlass method, UpdateMagGlassShape method

Topics	Raster Images: Displaying Images


fWidth Parameter For StartMagGlass
fWidth

The width of the magnifying glass. Minimum size is 10 pixels.


fHeight Parameter For StartMagGlass
fHeight

The height of the magnifying glass. Minimum size is 10 pixels.


nZoom Parameter For StartMagGlass
nZoom

The zoom factor for the Magnification, in percentage. This value must be >= 100.  For example, to zoom the image 2X, specify 200 for nZoom.


clrPen Parameter For StartMagGlass
clrPen

The color for the border of the magnifying glass.

This is ignored when bEllipse = FALSE and b3D = TRUE.


clrBack Parameter For StartMagGlass
clrBack

The color to use for painting areas not covered by the zoomed image. (i.e. When the magnifying glass is not completely over the image.)


bEllipse Parameter For StartMagGlass
bEllipse

Flag that indicates the shape of the magnifying glass. Possible values are:

Value	Meaning

TRUE	The magnifying glass is an Ellipse

FALSE	The magnifying glass is a Rectangle


fBorderSize Parameter For StartMagGlass
fBorderSize

The size of the magnifying glass border in pixels. This value is ignored when bEllipse = FALSE and b3D = TRUE. In this case the magnifying glass appears as a rectangle with a 3D border. The 3D border has a thickness of 2 pixels, one pixel for the highlight color and one for the shadow color.


b3D Parameter For StartMagGlass
b3D

Flag that indicates whether the border of a rectangular magnifying glass appears as 3D or flat. This value is valid only if bEllipse is FALSE. Possible values are:

Value	Meaning

TRUE	The rectangular magnifying glass appears with a 3D border.

FALSE	The rectangular magnifying glass appears with a flat border.


nCrosshair Parameter For StartMagGlass
nCrosshair

Specifies the type of crosshair. Possible values are:

Value	Meaning

CROSSHAIR_NONE	[0] No Crosshair

CROSSHAIR_FINE	[1] The crosshair is one pixel wide and uses the color in clrPen

CROSSHAIR_INVERTPEN	[2] The crosshair is three pixels wide. The center pixel uses the color in clrPen. The outer pixels use the inverse of the color in clrPen.

CROSSHAIR_INVERTSCREEN	[3] The crosshair is three pixels wide. The center pixel uses the color in clrPen. The outer pixels use the inverse of the screen color.


bIgnoreRgn Parameter For StartMagGlass
bIgnoreRgn

Flag that indicates whether to magnify only the region in the source bitmap, or to ignore it.  Quietly Possible values are:

Value	Meaning

TRUE	Ignore any existing regions within the source bitmap.

FALSE	Magnify only the region within the source bitmap. Data outside the region will be replaced with the color in clrBack.


bCenter Parameter For StartMagGlass
bCenter

Flag that indicates how to center the magnified area. Possible values are:

Value	Meaning

TRUE	The zoomed rectangle is centered on the center of the pixel at the center of the magnifying glass.

FALSE	The zoomed rectangle is centered on the top, left corner of the pixel at the center of the magnifying glass.


Return for StartMagGlass
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


StopFeedLoad method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short StopFeedLoad ();

Overview	Refer to Loading a Bitmap from Your Own Buffer.

Remarks

Ends a file-load process in which you control the input stream. This cleans up all the variables and buffers allocated by the StartFeedLoad method and the FeedLoad method, and resets all internal variables to their default settings.

You must call this method to complete a file load that was started with the StartFeedLoad method. If you call this method before supplying the complete file, it will successfully clean up the process, but will return a file-read error. You should trap the error if the load is canceled purposely.

For a description of how the methods relate to each other, refer to the StartFeedLoad method.

See Also

Topics	Raster Images: Loading Files


Return for StopFeedLoad
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


StopMagGlass method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short StopMagGlass ();

Overview	Refer to Using the Magnifying Glass

Remarks

Stops the Magnify Glass procedure.

See Also

Functions:	StartMagGlass method

Topics	Raster Images: Displaying Images


Return for StopMagGlass
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


StopOnError property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL StopOnError

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only) Flag indicating whether or not to stop generating thumbnails when an error occurs.

Default setting is False.

See Also

Elements	EnableMethodErrors property, ContinueBrowse property, ThumbnailEvent event, BrowseDir method

Topics	Raster Images: Using the Thumbnail Browser


StretchIntensity method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short StretchIntensity ();

Overview	Refer to Changing Brightness and Contrast.

Remarks

Increases the contrast in an bitmap by centering, maximizing, and proportioning the range of intensity values.

Unlike the Contrast method, this method always retains the original number of different intensity values. (Ordinary contrast adjustments can lose values at the high and low ends of the scale.)

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Intensity method, GammaCorrect method, Contrast method, HistoContrast method, HistoEqualize method

Topics	Raster Images: Modifying Intensity Values
Raster Images: Where the Region Preempts the Bitmap


Return for StretchIntensity
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


StripeMaxHeight property (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long StripeMaxHeight

Overview	Refer to Working with MRC Bitmap.

Remarks

(Persistent property, available at design time) Specifies the maximum stripe height for the LEADTOOLS automatic segmentation process. This value is related to the nMinHeight parameter of the AutoSegment method. The StripeMaxHeight value should be greater than the minimum height of the segments in order to be effective in the auto-segmentation process. StripeMaxHeight is not used with manual segmentation.

To avoid setting the maximum stripe height, pass 0 as the default value.

See Also

Elements	AutoSegment method

Topics	MRC Bitmap Functions: Automatic Segmentation


SwapColors method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short SwapColors(short iFlags);

Overview	Refer to Correcting Colors.

Remarks

Swaps the specified color channels.

This method can process the whole image or a region of the image.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	ConvertToColoredGray method, BalanceColors method, GrayScale method, GrayscaleExt method, IsGrayscale property

Topics	Raster Images: Modifying Intensity Values


iFlags Parameter For SwapColors
iFlags

Flag that indicates which color channels to swap. Possible values are:

Value	Meaning

SWAP_RG	Swap the red and green channels. (Change red to green and green to red.)

SWAP_RB	Swap the red and blue channels. (Change red to blue and blue to red.)

SWAP_GB	Swap the green and blue channels. (Change green to blue and blue to green.)

SWAP_RGBR	Change red to green, green to blue and blue to red.

SWAP_RBGR	Change red to blue, blue to green and green to red.


Return for SwapColors
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


TextAlign property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short TextAlign

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the alignment of a text object within a rectangle. You specify the rectangle and other aspects of the text object using related properties described in Drawing Three-Dimensional Shapes and Text.

The DrawText method draws the text object in the control's client area or on the current bitmap.

For a list of possible values of the TextAlign property, refer to TextAlign Effects.

See Also

Elements	DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


TextAngle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short TextAngle

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the angle of rotation of a text object. The angle is in tenths of degrees. Only TrueType fonts can be rotated.

You specify other aspects of the text object using related properties described in Drawing Three-Dimensional Shapes and Text.

The DrawText method draws the text object in the control's client area or on the current bitmap.

See Also

Elements	DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


TextHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float TextHeight

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the height of the rectangle in which a text object is positioned. You specify the rectangle and other aspects of the text object using related properties described in Drawing Three-Dimensional Shapes and Text.

The DrawText method draws the text object in the control's client area or on the current bitmap.

Whether you draw to the screen or to the bitmap, text objects are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

See Also

Elements	DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


TextHiliteColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR TextHiliteColor

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the highlight color of a text object. You specify other aspects of the text object using related properties described in Drawing Three-Dimensional Shapes and Text.

The DrawText method draws the text object in the control's client area or on the current bitmap.

The highlight color is used only for the following TextStyle values:

EFX_TEXTSTYLE_INSETLIGHT
EFX_TEXTSTYLE_INSETEXTRALIGHT
EFX_TEXTSTYLE_INSETHEAVY
EFX_TEXTSTYLE_INSETEXTRAHEAVY
EFX_TEXTSTYLE_RAISEDLIGHT
EFX_TEXTSTYLE_RAISEDEXTRALIGHT
EFX_TEXTSTYLE_RAISEDHEAVY
EFX_TEXTSTYLE_RAISEDEXTRAHEAVY
EFX_TEXTSTYLE_OUTLINEBLOCK
EFX_TEXTSTYLE_MAX

See Also

Elements	DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


TextLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float TextLeft

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the X coordinate of the origin of the rectangle in which a text object is positioned. You specify the rectangle and other aspects of the text object using related properties described in Drawing Three-Dimensional Shapes and Text.

The DrawText method draws the text object in the control's client area or on the current bitmap.

Whether you draw to the screen or to the bitmap, text objects are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

See Also

Elements	DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


TextStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short TextStyle

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the style of a text object. You specify other aspects of the text object using related properties described in Drawing Three-Dimensional Shapes and Text.

The DrawText method draws the text object in the control's client area or on the current bitmap.

For a list of possible values of the TextStyle property, refer to TextStyle Effects.

See Also

Elements	DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


TextTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float TextTop

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the Y coordinate of the origin of the rectangle in which a text object is positioned. You specify the rectangle and other aspects of the text object using related properties described in Drawing Three-Dimensional Shapes and Text.

The DrawText method draws the text object in the control's client area or on the current bitmap.

Whether you draw to the screen or to the bitmap, text objects are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

See Also

Elements	DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


TextWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float TextWidth

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the width of the rectangle in which a text object is positioned. You specify the rectangle and other aspects of the text object using related properties described in Drawing Three-Dimensional Shapes and Text.

The DrawText method draws the text object in the control's client area or on the current bitmap.

Whether you draw to the screen or to the bitmap, text objects are always positioned in the Main Control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

See Also

Elements	DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


TextWordWrap property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL TextWordWrap

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Determines whether words wrap within the rectangle in which a text object is positioned. You specify the rectangle and other aspects of the text object using related properties described in Drawing Three-Dimensional Shapes and Text.

The DrawText method draws the text object in the control's client area or on the current bitmap.

See Also

Elements	DrawText method

Topics	Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


ThumbnailBackgroundColor property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR ThumbnailBackgroundColor

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Background color to use if both ForceSize and MaintainAspect are True.

Default setting is RGB(128,128,128).

See Also

Elements	BrowseDir method, ThumbnailWidth property, ThumbnailHeight property, MaintainAspect property, ForceSize property

Topics	Raster Images: Using the Thumbnail Browser


ThumbnailBitsPerPixel property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ThumbnailBitsPerPixel

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Specifies the bits per pixel for each generated thumbnail bitmap.

You can specify 0 to indicate the thumbnail should be the same bits per pixel as the original file from which is was generated.

Default setting is 24.

See Also

Elements	BrowseDir method, ThumbnailWidth property, ThumbnailHeight property

Topics	Raster Images: Using the Thumbnail Browser


ThumbnailEvent event (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void ThumbnailEvent (long Bitmap, BSTR pszFilename, short nStatusCode, short nPercent);

Overview	Refer to Thumbnail Browser.

Remarks

Occurs during thumbnail generation.

You must use this event to process each generated thumbnail.

You can also use this event to detect progress of image loading.

See Also

Elements	ContinueBrowse property, EnableMethodErrors property, StopOnError property, BrowseDir method

Topics	Raster Images: Using the Thumbnail Browser


Bitmap Parameter For ThumbnailEvent
Bitmap

The bitmap handle to the generated thumbnail.

This is only valid when nStatus is equal to 0.


pszFilename Parameter For ThumbnailEvent
pszFilename

Character string containing the name of the file that is being loaded or for which the thumbnail was generated.


nStatusCode Parameter For ThumbnailEvent
nStatusCode

This is the status code for the browse operation.  This indicates success or failure when browsing for files and generating thumbnails.

This can be any of the following

Return	Meaning

0	The function was successful.

BROWSE_LOADING	[2] Indicates the file is being loaded

BROWSE_SKIPPED	[3] Indicates the file was skipped because it exceeded the specified size range

BROWSE_PRELOAD	[4] Indicates that LEADTOOLS has found a file and is about to determine the file format. It will then attempt to create a thumbnail for it. If the user wishes to avoid the internal file information processing, return ERROR_FILE_FORMAT. This will cause LEADTOOLS to skip the file.

any other value	An error occurred. Refer to Error Codes.


nPercent Parameter For ThumbnailEvent
nPercent

When nStatus is BROWSE_LOADING, this indicates the percentage completion of the current file load operation.


ThumbnailHeight property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ThumbnailHeight

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Specifies the requested height of the generated thumbnails.

If 0 is specified for either the ThumbnailHeight property or the ThumbnailWidth property, the image will not be resized. The whole image will be returned in the ThumbnailEvent event.

If –1 is specified for either the ThumbnailHeight property or the ThumbnailWidth property, the image will not be loaded at all. The ThumbnailEvent event will occur for each file, but will only receive file information, not a valid image.

Default setting is 80.

See Also

Elements	BrowseDir method, ThumbnailWidth property, ThumbnailBitsPerPixel property, MaintainAspect property, ForceSize property, ThumbnailBackgroundColor property, Resample property

Topics	Raster Images: Using the Thumbnail Browser


ThumbnailWidth property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ThumbnailWidth

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Specifies the requested width of the generated thumbnails.

If 0 is specified for either the ThumbnailHeight property or the ThumbnailWidth property, the image will not be resized. The whole image will be returned in the ThumbnailEvent event.

If –1 is specified for either the ThumbnailHeight property or the ThumbnailWidth property, the image will not be loaded at all. The ThumbnailEvent event will occur for each file, but will only receive file information, not a valid image.

Default setting is 80.

See Also

Elements	BrowseDir method, ThumbnailHeight property, ThumbnailBitsPerPixel property, MaintainAspect property, ForceSize property, ThumbnailBackgroundColor property, Resample property

Topics	Raster Images: Using the Thumbnail Browser


Tool property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short Tool

Overview	Refer to Annotation Toolbar.

Remarks

Gets / sets the currently selected tool. When setting this property, the first button in the toolbar that has an assigned tool with the value stored in this property will be enabled. For a list of possible values, refer to Annotation Toolbar Buttons.

Please note that the automation mode does not automatically create objects for the ANNTOOL_USER_XXX tools.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Visible property

Topics	Annotations (Document/Medical only): Automation


TransformFile method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short TransformFile (BSTR pszNameSrc, BSTR pszNameDst, short iTransform, long lPage);

Overview	Refer to Examining and Altering Bitmaps

Remarks

Performs a lossless transformation for certain formats. Currently, only JPEG, CMP and JPEG TIFF formats are supported.

The flip and reverse flags can be combined with the rotate flags. More than one rotate flags cannot be combined.

Be careful when combining flags, because unexpected results are possible. For example, combining flip, reverse and 180 degree rotation produces a no-transform. Flip and reverse produce a 180 degree rotation which, when combined with another 180 degree rotation produces a 0 degree rotation (a no-transform).

The rotation transformations are performed before the flip/reverse operations.

See Also

Elements	TransformMarker event, WriteMarker method, WriteMarkerAction property

Topics	Raster Images: Doing Geometric Transformations


pszNameSrc Parameter For TransformFile
pszNameSrc

String containing the name of the input file.


pszNameDst Parameter For TransformFile
pszNameDst

String containing the name of the output file. This can be the same as the input file. If this parameter is NULL or "", then the name of the output file is the same as the input file.


iTransform Parameter For TransformFile
iTransform

Flags that indicate the transform to be performed. Possible values are:

Value	Meaning

FILE_TRANSFORM_FLIP	[0x0001] Flip the image.

FILE_TRANSFORM_REVERSE	[0x0002] Reverse the image.

FILE_TRANSFORM_ROTATE90	[0x0004] Rotate the image clockwise by 90 degrees.

FILE_TRANSFORM_ROTATE180	[0x0008] Rotate the image clockwise by 180 degrees.

FILE_TRANSFORM_ROTATE270	[0x000C] Rotate the image clockwise by 270 degrees.


lPage Parameter For TransformFile
lPage

Number of the page to transform. This is used only for multi-page files. Pass 1 to rotate the first page of the file.


Return for TransformFile
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


TransformMarker event (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void TransformMarker (short iMarker, long lSize, VARIANT vData, short iTransform);

Overview	Refer to Examining and Altering Bitmaps

Remarks

This event is fired for every JPEG marker present in the file transformed by the TransformFile method.

Processing this event is not required. It is recommended that you have a good knowledge of JPEG files before processing this event. Incorrect handling of the markers can create corrupted files.

Typically, this event could be used to process user-defined markers (APP0 – APP14). These markers may contain extra information like stamps, file resolution information, etc.

This can also be used to prevent certain markers from being written if the file. For more information, refer to the WriteMarkerAction property.

Upon returning from this event, LEADTOOLS will examine the value of the WriteMarkerAction property to see if the default processing should be performed for this marker. If the WriteMarkerAction property is:

 WRITEMARKER_DEFAULT, then LEADTOOLS will perform the default action and write it to the file.

 WRITEMARKER_IGNORE, then LEADTOOLS will not write this marker to the file.

 WRITEMARKER_ABORT, then the file transformation process is aborted and the TransformFile method will return ERROR_USER_ABORT.

When transforming the marker data, call the WriteMarker method with the WriteMarkerAction property set to WRITEMARKER_IGNORE. That way the marker will not occur twice in the file.

See Also

Elements	TransformFile method, WriteMarker method, WriteMarkerAction property

Topics	Raster Images: Doing Geometric Transformations


iMarker Parameter For TransformMarker
iMarker

ID of the JPEG marker. The JPEG markers are uniquely identified by a byte value. Possible values are 1 to 254. (0 and 255 are not allowed.)


lSize Parameter For TransformMarker
lSize

Size of the JPEG marker. The size will be less than 65535. If this value is 0, then the marker does not have any extra data.


vData Parameter For TransformMarker
vData

VARIANT array that contains the marker data.


iTransform Parameter For TransformMarker
iTransform

Flags that indicate the transform to be performed. These are the same flags passed to the TransformFile method. Possible values are:

Value	Meaning

FILE_TRANSFORM_FLIP	[0x0001] Flip the image.

FILE_TRANSFORM_REVERSE	[0x0002] Reverse the image.

FILE_TRANSFORM_ROTATE90	[0x0004] Rotate the image clockwise by 90 degrees.

FILE_TRANSFORM_ROTATE180	[0x0008] Rotate the image clockwise by 180 degrees.

FILE_TRANSFORM_ROTATE270	[0x000C] Rotate the image clockwise by 270 degrees.


TransitionEffect property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short TransitionEffect

Overview	Refer to Using Special Effects When Painting.

Remarks

(Persistent property, available at design time) Specifies the transitional effect to use when painting. For possible values, refer to the PaintEffect property.

A transition effect, if implemented, occurs before an image is painted. The transition can paint a solid color, a pattern, or a gradient color. The TransitionStyle property determines whether a transitional effect is used when painting.

LEADTOOLS provides over 2000 defined constant identifiers for effects. Visual Basic users must include L_OCXEFX.BAS in order to use the defined constant identifiers. This file can be found in the lead\include directory.

See Also

Elements	PaintEffect property

Topics	Raster Images: Implementing Special Effects


TransitionStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short TransitionStyle

Overview	Refer to Using Special Effects When Painting.

Remarks

(Persistent property, available at design time) Determines whether a transitional effect is used when painting, and determines whether the transition is based on pattern properties or gradient color properties.

A transition effect, if implemented, occurs before an image is painted. The transition can paint a solid color, a pattern, or a gradient color. The list of possible effects is the same as when painting an image. The TransitionEffect property specifies the effect to use.

Value	Meaning

EFX_TRANSITION_NONE	No transition effect.

EFX_TRANSITION_GRADIENT	Use the gradient color for the transition. Refer to Gradients and Patterns for related properties.

EFX_TRANSITION_PATTERN	Use a solid color or pattern for the transition. Refer to Gradients and Patterns for related properties.

EFX_TRANSITION_MAX	Use a solid color or pattern for the transition. Refer to Gradients and Patterns for related properties.

See Also

Elements	TransitionEffect property

Topics	Raster Images: Implementing Special Effects


Transparent property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL Transparent

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Makes the background of the control transparent.

You can set this property to TRUE to take advantage of related transparency properties when one control is positioned on top of another one.

Value	Meaning

TRUE	The background is transparent.

FALSE	The background color paints.

Setting this property to TRUE also results in the following property changes: AutoScroll is set to FALSE; Appearance is set to 0 (flat); and BorderStyle is set to 0 (no border).

See Also

Elements	BitmapTransparentColor property, Bitmap Enable Transparency property, PaintRgnOnly property

Topics	Working with the Control: General Behavior
Raster Images: Implementing Special Effects
Raster Images: Displaying Images
Raster Images: Creating and Using a Region
Implementing Transparency


TransparentColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR TransparentColor

Overview	Refer to Using Special Effects When Painting.

Remarks

THIS PROPERTY IS NOW OBSOLETE. IT HAS BEEN REPLACED WITH THE BitmapTransparentColor property

(Persistent property, available at design time) Transparent color (a color that is not painted) when painting an image or transition. This property is valid only if the Bitmap Enable Transparency property is TRUE.

See Also

Elements	PaintEffect property, TransitionEffect property, Transparent property

Topics	Raster Images: Implementing Special Effects
Implementing Transparency


Trim method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Trim (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Trims the bitmap, resulting in a bitmap that is the size of the specified rectangle.
If a region is defined for the bitmap, the region is also trimmed if necessary.

See Also

Topics	Raster Images: Doing Geometric Transformations
Raster Images: Methods That Transform the Region and the Bitmap (Document/Medical only)


fLeft Parameter For Trim
fLeft

The X coordinate of the origin of the rectangle.

The position is relative to the current bitmap. The unit of measure is determined by the ScaleMode property.


fTop Parameter For Trim
fTop

The X coordinate of the origin of the rectangle.

The position is relative to the current bitmap. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For Trim
fWidth

The width of the rectangle. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For Trim
fHeight

The height of the rectangle. The unit of measure is determined by the ScaleMode property.


Return for Trim
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Underlay method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax 	short Underlay (OLE_HANDLE hBitmap, short iFlags);

Overview	Refer to Combining Images.

Remarks

Combines two bitmaps so that one appears to be an underlying texture for the other. This is most effective when the underlying image is a filtered one, such as an embossed image.

This method changes the colors of the underlay to grayscale as it combines the images. It updates the current bitmap, leaving the second bitmap (hBitmap) unchanged. The underlying image can either be stretched or tiled to fill the target image, as shown in the following illustration:

If a region is defined for the target bitmap, the underlay is applied to the region, not to the whole bitmap. (Any region defined for the underlay bitmap is ignored.)

See Also

Topics	Raster Images: Combining Images
Examining and Altering Bitmaps
Applying Artistic Effects


hBitmap Parameter For Underlay
hBitmap

The Main Control's bitmap to use as the underlying image. This is the image that appears to be on bottom and is grayscaled as it is combined with the target image.


iFlags Parameter For Underlay
iFlags

Indicators of how the underlying image is to be positioned. Valid values are:

Value	Meaning

UNDERLAY_TILE 	Tile the underlay. This repeats the underlying image, so that it fills the target image. This method does not do any resizing; you are responsible for the size of the tiles.

UNDERLAY_STRETCH	Stretch the underlay to fit the dimensions of the target image.


Return for Underlay
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


UnlockSupport method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void UnlockSupport (short iType, BSTR pszKey);

Overview	Refer to Using the Image List Control.

Remarks

Unlocks support for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

Note: Unlocking the Document/Medical editions capabilities is necessary only if you upgrade another product to a Document/Medical product. If your current LEADTOOLS package is labeled Document/Medical, the Document/Medical capabilities are enabled automatically; your application does not have to unlock them.

Note: UnlockSupport can be replaced by entering the appropriate keys in LTOCX14.LIC. Edit the LTOCX14.LIC file and append at the end of a line, and on the same line, one or more pairs in the form |L_SUPPORT_xxx=key. The keys that can be specified are:

L_SUPPORT_BARCODES_1D
L_SUPPORT_BARCODES_PDF_READ
L_SUPPORT_BARCODES_PDF_WRITE
L_SUPPORT_BARCODES_DATAMATRIX_READ
L_SUPPORT_BARCODES_DATAMATRIX_WRITE
L_SUPPORT_BITONAL
L_SUPPORT_CMW
L_SUPPORT_DICOM
L_SUPPORT_DOCUMENT
L_SUPPORT_EXTGRAY
L_SUPPORT_J2K
L_SUPPORT_LMC
L_SUPPORT_LTPRO
L_SUPPORT_MEDICAL
L_SUPPORT_MEDICAL_NET
L_SUPPORT_OCR
L_SUPPORT_VECTOR

For example, if you wanted to unlock DOCUMENT and OCR support, you would include the following at the end of a line:

|L_SUPPORT_DOCUMENT=dockey|L_SUPPORT_OCR=ocrkey

See Also

Elements	IsSupportLocked method.

Topics	Raster Images: Displaying Images


iType Parameter For UnlockSupport
iType

The optional feature to unlock.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation. This support is also unlocked using L_SUPPORT_DOCUMENT, L_SUPPORT_MEDICAL or L_SUPPORT_MEDICAL_NET.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.
L_SUPPORT_BARCODES_1D_SILVER	Support for reading and writing Linear bar codes silver module. This is available in the LEADTOOLS 1D Silver Module.
L_SUPPORT_BARCODES_QR_READ	Support for reading QR bar codes. This is available in the LEADTOOLS 2D QR Module (read).
L_SUPPORT_BARCODES_QR_WRITE	Support for writing QR bar codes. This is available in the LEADTOOLS 2D QR Module (write).


pszKey Parameter For UnlockSupport
pszKey

The key to unlock the feature.


Return for UnlockSupport
Return Value

None.


UnlockSupport method (ISIS Control)

Visual Basic example   Visual C++ 4.0 example
 Visual J++ example

Syntax	void UnlockSupport (short iType, BSTR pszKey);

Overview	Refer to Miscellaneous Methods and Properties.

Remarks

Unlocks support for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

Note: UnlockSupport can be replaced by entering the appropriate keys in LTOCX14.LIC. Edit the LTOCX14.LIC file and append at the end of a line, and on the same line, one or more pairs in the form |L_SUPPORT_xxx=key. The keys that can be specified are:

L_SUPPORT_BARCODES_1D
L_SUPPORT_BARCODES_PDF_READ
L_SUPPORT_BARCODES_PDF_WRITE
L_SUPPORT_BARCODES_DATAMATRIX_READ
L_SUPPORT_BARCODES_DATAMATRIX_WRITE
L_SUPPORT_BITONAL
L_SUPPORT_CMW
L_SUPPORT_DICOM
L_SUPPORT_DOCUMENT
L_SUPPORT_EXTGRAY
L_SUPPORT_J2K
L_SUPPORT_LMC
L_SUPPORT_LTPRO
L_SUPPORT_MEDICAL
L_SUPPORT_MEDICAL_NET
L_SUPPORT_OCR
L_SUPPORT_VECTOR

For example, if you wanted to unlock DOCUMENT and OCR support, you would include the following at the end of a line:

|L_SUPPORT_DOCUMENT=dockey|L_SUPPORT_OCR=ocrkey

See Also

Topics	Support: Version and License Information


iType Parameter For UnlockSupport
iType

The optional feature to unlock.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation. This support is also unlocked using L_SUPPORT_DOCUMENT, L_SUPPORT_MEDICAL or L_SUPPORT_MEDICAL_NET.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.
L_SUPPORT_BARCODES_1D_SILVER	Support for reading and writing Linear bar codes silver module. This is available in the LEADTOOLS 1D Silver Module.
L_SUPPORT_BARCODES_QR_READ	Support for reading QR bar codes. This is available in the LEADTOOLS 2D QR Module (read).
L_SUPPORT_BARCODES_QR_WRITE	Support for writing QR bar codes. This is available in the LEADTOOLS 2D QR Module (write).


pszKey Parameter For UnlockSupport
pszKey

The key to unlock the feature.


Return for UnlockSupport
Return Value

None.


UnlockSupport method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void UnlockSupport (short iType, BSTR pszKey);

Overview	Refer to Miscellaneous Methods and Properties.

Remarks

Unlocks support for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

Note: UnlockSupport can be replaced by entering the appropriate keys in LTOCX14.LIC. Edit the LTOCX14.LIC file and append at the end of a line, and on the same line, one or more pairs in the form |L_SUPPORT_xxx=key. The keys that can be specified are:

L_SUPPORT_BARCODES_1D
L_SUPPORT_BARCODES_PDF_READ
L_SUPPORT_BARCODES_PDF_WRITE
L_SUPPORT_BARCODES_DATAMATRIX_READ
L_SUPPORT_BARCODES_DATAMATRIX_WRITE
L_SUPPORT_BITONAL
L_SUPPORT_CMW
L_SUPPORT_DICOM
L_SUPPORT_DOCUMENT
L_SUPPORT_EXTGRAY
L_SUPPORT_J2K
L_SUPPORT_LMC
L_SUPPORT_LTPRO
L_SUPPORT_MEDICAL
L_SUPPORT_MEDICAL_NET
L_SUPPORT_OCR
L_SUPPORT_VECTOR

For example, if you wanted to unlock DOCUMENT and OCR support, you would include the following at the end of a line:

|L_SUPPORT_DOCUMENT=dockey|L_SUPPORT_OCR=ocrkey

See Also

Topics	Support: Version and License Information


iType Parameter For UnlockSupport
iType

The optional feature to unlock.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation. This support is also unlocked using L_SUPPORT_DOCUMENT, L_SUPPORT_MEDICAL or L_SUPPORT_MEDICAL_NET.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.
L_SUPPORT_BARCODES_1D_SILVER	Support for reading and writing Linear bar codes silver module. This is available in the LEADTOOLS 1D Silver Module.
L_SUPPORT_BARCODES_QR_READ	Support for reading QR bar codes. This is available in the LEADTOOLS 2D QR Module (read).
L_SUPPORT_BARCODES_QR_WRITE	Support for writing QR bar codes. This is available in the LEADTOOLS 2D QR Module (write).


pszKey Parameter For UnlockSupport
pszKey

The key to unlock the feature.


Return for UnlockSupport
Return Value

None.


UnlockSupport method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void UnlockSupport (short iType, BSTR pszKey);

Overview	Refer to Working with MRC Bitmap.

Remarks

Unlocks support for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

Note:	Unlocking the Document/Medical editions capabilities is necessary only if you upgrade another product to a Document/Medical product. If your current LEADTOOLS package is labeled Document/Medical, the Document/Medical capabilities are enabled automatically; your application does not have to unlock them.

Note:	UnlockSupport can be replaced by entering the appropriate keys in LTOCX14.LIC. Edit the LTOCX14.LIC file and append at the end of a line, and on the same line, one or more pairs in the form |L_SUPPORT_xxx=key. The keys that can be specified are:

L_SUPPORT_BARCODES_1D
L_SUPPORT_BARCODES_PDF_READ
L_SUPPORT_BARCODES_PDF_WRITE
L_SUPPORT_BARCODES_DATAMATRIX_READ
L_SUPPORT_BARCODES_DATAMATRIX_WRITE
L_SUPPORT_BITONAL
L_SUPPORT_CMW
L_SUPPORT_DICOM
L_SUPPORT_DOCUMENT
L_SUPPORT_EXTGRAY
L_SUPPORT_J2K
L_SUPPORT_LMC
L_SUPPORT_LTPRO
L_SUPPORT_MEDICAL
L_SUPPORT_MEDICAL_NET
L_SUPPORT_OCR
L_SUPPORT_VECTOR

For example, if you wanted to unlock DOCUMENT and OCR support, you would include the following at the end of a line:

|L_SUPPORT_DOCUMENT=dockey|L_SUPPORT_OCR=ocrkey

See Also

Elements	IsSupportLocked method

Topics	MRC Bitmap Functions: Auxiliary Elements


iType Parameter For UnlockSupport (Mixed Raster Content Control)
iType

The optional feature to check.  Possible values are:

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation. This support is also unlocked using L_SUPPORT_DOCUMENT, L_SUPPORT_MEDICAL or L_SUPPORT_MEDICAL_NET.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.
L_SUPPORT_BARCODES_1D_SILVER	Support for reading and writing Linear bar codes silver module. This is available in the LEADTOOLS 1D Silver Module.
L_SUPPORT_BARCODES_QR_READ	Support for reading QR bar codes. This is available in the LEADTOOLS 2D QR Module (read).
L_SUPPORT_BARCODES_QR_WRITE	Support for writing QR bar codes. This is available in the LEADTOOLS 2D QR Module (write).


pszKey Parameter For UnlockSupport (Mixed Raster Content Control)
pszKey

String containing the key used to lock the annotation objects.


UnlockSupport method (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void UnlockSupport (short iType, BSTR pszKey);

Overview	Refer to Miscellaneous Methods and Properties.

Remarks

Unlocks support for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

Note: UnlockSupport can be replaced by entering the appropriate keys in LTOCX14.LIC. Edit the LTOCX14.LIC file and append at the end of a line, and on the same line, one or more pairs in the form |L_SUPPORT_xxx=key. The keys that can be specified are:

L_SUPPORT_BARCODES_1D
L_SUPPORT_BARCODES_PDF_READ
L_SUPPORT_BARCODES_PDF_WRITE
L_SUPPORT_BARCODES_DATAMATRIX_READ
L_SUPPORT_BARCODES_DATAMATRIX_WRITE
L_SUPPORT_BITONAL
L_SUPPORT_CMW
L_SUPPORT_DICOM
L_SUPPORT_DOCUMENT
L_SUPPORT_EXTGRAY
L_SUPPORT_J2K
L_SUPPORT_LMC
L_SUPPORT_LTPRO
L_SUPPORT_MEDICAL
L_SUPPORT_MEDICAL_NET
L_SUPPORT_OCR
L_SUPPORT_VECTOR

For example, if you wanted to unlock DOCUMENT and OCR support, you would include the following at the end of a line:

|L_SUPPORT_DOCUMENT=dockey|L_SUPPORT_OCR=ocrkey

See Also

Topics	Support: Version and License Information
Databases: OLE DB, Using a Visual Basic Data Control


iType Parameter For UnlockSupportOLE
iType

The optional feature to unlock.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation. This support is also unlocked using L_SUPPORT_DOCUMENT, L_SUPPORT_MEDICAL or L_SUPPORT_MEDICAL_NET.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.
L_SUPPORT_BARCODES_1D_SILVER	Support for reading and writing Linear bar codes silver module. This is available in the LEADTOOLS 1D Silver Module.
L_SUPPORT_BARCODES_QR_READ	Support for reading QR bar codes. This is available in the LEADTOOLS 2D QR Module (read).
L_SUPPORT_BARCODES_QR_WRITE	Support for writing QR bar codes. This is available in the LEADTOOLS 2D QR Module (write).


pszKey Parameter For UnlockSupportOLE
pszKey

The key to unlock the feature.


Return for UnlockSupportOLE
Return Value

None.


UnlockSupport method (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void UnlockSupport (short iType, BSTR pszKey);

Overview	Refer to Thumbnail Browser.

Remarks

Unlocks support for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

Note: Unlocking the Document/Medical capabilities is necessary only if you upgrade another product to a Document/Medical product. If your current LEADTOOLS package is labeled Document/Medical, the Document/Medical capabilities are enabled automatically; your application does not have to unlock them.

Note: UnlockSupport can be replaced by entering the appropriate keys in LTOCX14.LIC. Edit the LTOCX14.LIC file and append at the end of a line, and on the same line, one or more pairs in the form |L_SUPPORT_xxx=key. The keys that can be specified are:

L_SUPPORT_BARCODES_1D
L_SUPPORT_BARCODES_PDF_READ
L_SUPPORT_BARCODES_PDF_WRITE
L_SUPPORT_BARCODES_DATAMATRIX_READ
L_SUPPORT_BARCODES_DATAMATRIX_WRITE
L_SUPPORT_BITONAL
L_SUPPORT_CMW
L_SUPPORT_DICOM
L_SUPPORT_DOCUMENT
L_SUPPORT_EXTGRAY
L_SUPPORT_J2K
L_SUPPORT_LMC
L_SUPPORT_LTPRO
L_SUPPORT_MEDICAL
L_SUPPORT_MEDICAL_NET
L_SUPPORT_OCR
L_SUPPORT_VECTOR

For example, if you wanted to unlock DOCUMENT and OCR support, you would include the following at the end of a line:

|L_SUPPORT_DOCUMENT=dockey|L_SUPPORT_OCR=ocrkey

See Also

Elements	IsSupportLocked method.

Topics	Raster Images: Using the Thumbnail Browser


iType Parameter For UnlockSupport
iType

The optional feature to unlock.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation. This support is also unlocked using L_SUPPORT_DOCUMENT, L_SUPPORT_MEDICAL or L_SUPPORT_MEDICAL_NET.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.
L_SUPPORT_BARCODES_1D_SILVER	Support for reading and writing Linear bar codes silver module. This is available in the LEADTOOLS 1D Silver Module.
L_SUPPORT_BARCODES_QR_READ	Support for reading QR bar codes. This is available in the LEADTOOLS 2D QR Module (read).
L_SUPPORT_BARCODES_QR_WRITE	Support for writing QR bar codes. This is available in the LEADTOOLS 2D QR Module (write).


pszKey Parameter For UnlockSupport
pszKey

The key to unlock the feature.


Return for UnlockSupport
Return Value

None


UnsharpMask method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short UnsharpMask(short iAmount, short iRadius, short iThreshold, short iColorType);

Overview	Refer to Detecting and Enhancing Edges and Lines.

Remarks

This method is actually considered a sharpening method. It is used to sharpen the image with a minimum of noise by applying the unsharp mask. To reduce the noise, it starts by blurring a copy of the original image. The amount of blur depends on iRadius. The method then determines the difference between each pixel's value of the original image and the corresponding pixel's value in the blurred image. If the difference is greater than the iThreshold value, then the difference between the pixel values is multiplied by the value in the iAmount parameter and added to the original pixel value.

To get the same results with your images, you can use the following settings:

iAmount = 500 // (or more)
iRadius = 1
iThreshold = 0

To increase the thickness of the sharpened edges, increase the value of iRadius.

To increase the amount of sharpness, increase the value of iAmount.

To reduce the noise and eliminate the small edges or individual pixels that will produce noise in image, increase the value of iThreshold.

Using the YUV color space decreases the processing time.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Sharpen method, Posterize method, Mosaic method, Emboss method, Median method, AddNoise method, IntensityDetect method, SpatialFilter method, BinaryFilter method, MaxFilter method, MinFilter method, Oilify method, Solarize method, WindowLevel method, GaussianFilter method

Topics	Raster Images: Filtering Images


iAmount Parameter For UnsharpMask
iAmount

Value that represents an adjustment factor. This is a percentage.


iRadius Parameter For UnsharpMask
iRadius

Value that indicates the size of the neighborhood used for blurring each pixel of the bitmap.


iThreshold Parameter For UnsharpMask
iThreshold

Value that indicates the threshold for modifying the original value of the pixel. If the difference in the original pixel value and the blurred pixel value is greater than the threshold value, the original pixel value will be modified.


iColorType Parameter For UnsharpMask
iColorType

Flag that indicates the color space in which to apply the mask. Possible values are:

Value	Meaning

RGB_SPACE	[0x0001] Apply the mask in the RGB color space.

YUV_SPACE	[0x0002] Apply the mask in the YUV color space.


Return for UnsharpMask
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


UpdateMagGlass method (Main Control)

This method is now obsolete. To achieve the same functionality, use the UpdateMagGlassExt method.


UpdateMagGlassExt method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short UpdateMagGlassExt (VARIANT vColorBuffer, VARIANT vMaskPlane, long nMaskPlaneStart, long nMaskPlaneEnd, BOOL bUpdateBitmap);

Overview	Refer to Using the Magnifying Glass

Remarks

Updates the bitmap that the Magnifying Glass displays in the zoomed Magnifying Glass display area.

This method can only be called if the MagGlassExt event has been enabled by setting the EnableMagGlassEvent property to TRUE. If the EnableMagGlassEvent property has been set to TRUE, information about the non-updated parts of the bitmap, can be obtained from the MagGlassExt event. This information can then be used with LEADTOOLS Internet methods, available in the Multimedia/Internet toolkits, to fill a vColorBuffer with pixel values for the non-updated parts of the bitmap. Once this needed data is received, it can be sent to this method to update the bitmap that the Magnifying Glass displays in the zoomed Magnifying Glass display area. For an example, refer to the Ltnetcomn.hlp help file in the HELP directory.

The vColorBuffer can also be filled without using the LEADTOOLS Internet methods. Match vMaskPlane to the original bitmap and fill vColorBuffer with the corresponding pixel colors. The following example explains this procedure.

The figure below represents a bitmap 29 pixels wide and 20 pixels high. The pixels are represented by the small blue squares.

Enable the occurrence of the MagGlassExt event by setting the EnableMagGlassEvent property to TRUE and start the Magnifying Glass. When the left mouse button is pressed while moving the mouse over the bitmap, a MagGlassExt event is generated and receives the (nMaskPlaneStart, nMaskPlaneEnd, vMaskPlane) information. Each time a MagGlassExt event is generated, it indicates that part of the bitmap needs to be updated. The bitmap can be updated by calling the UpdateMagGlassExt method with the nMaskPlaneStart, nMaskPlaneEnd and vMaskPlane received by the MagGlassExt event.

The large black squares in the figure above represent portions of the bitmap. Each portion can contain a maximum of 64 pixels (8 by 8). Occasionally, portions may have less than 64 pixels, especially those portions at the edge of the bitmap. Each portion is represented by 1 bit of the bytes in the vMaskPlane array.

For example, if the Magnifying Glass is moved over the bitmap from pixel coordinate (9, 3), shown in red in the image above, to (28, 17), shown in green in the image above, then the following portions are affected: 1, 2, 3, 5, 6, 7, 9, 10 and 11.

Therefore, 9 portions are represented in the vMaskPlane. Each portion is represented by 1 bit within the vMaskPlane. Therefore, 2 bytes are needed in the vMaskPlane to represent the 9 portions of the bitmap. Each portion will be mapped to a byte in the vMaskPlane array as follows:

Portion Number	Bit Index	Byte Index
1	0	0
2	1	0
3	2	0
5	3	0
6	4	0
7	5	0
9	6	0
10	7	0
11	0	1

So, the vMaskPlane received from the MagGlassExt event will contain 2 bytes. Each bit of those 2 bytes will be filled with zero or one indicating whether or not the portion has been updated. The nMaskPlaneStart parameter of the callback will equal 1 and the nMaskPlaneEnd parameter will equal 11.

The next step is to check each bit value. If the bit value is 1 the corresponding portion needs to be updated, so vColorBuffer must be filled with the corresponding pixel colors. Start with the portion indicated in nMaskPlaneStart. In this example that is portion number 1. If the bit representing portion 1 has a value of 1, then the vColorBuffer should be filled with the corresponding pixels from the original bitmap. You must always start filling the vColorBuffer array from the first pixel in the portion. For portion 1, the first pixel has coordinates (8, 0). Move through the row until the last pixel of that portion is reached. In this case, the last pixel in the first row of portion 1 has coordinates (15, 0). Next, move to the next row and add the pixel colors of this row to vColorBuffer. Continue in this manner until the last pixel of the portion is reached. In this example the last pixel in portion 1 has the coordinates (15,7).

Having finished one portion, move to the next portion. In this example the next portion is portion 2. Check the bit value in vMaskPlane for this portion. Suppose it has a bit value of 0. For this portion, do not fill vColorBuffer with the pixel colors of the original bitmap. Proceed through the remaining portions until the portion indicated by nMaskPlaneEnd is reached.

By following this procedure vColorBuffer can be filled with the necessary pixel colors and passed, along with other information, to this method (UpdateMagGlassExt) and used to update the zoomed image displayed in the Magnifying Glass display area.

If the bUpdateBitmap flag is set to TRUE, then the Main Control's bitmap will be updated.

See Also

Elements	StartMagGlass method, StopMagGlass method, EnableMagGlassEvent property, MagGlassExt event

Topics	Raster Images: Displaying Images


vColorBuffer Parameter For UpdateMagGlassExt
vColorBuffer

An array of updated colors that match the position of needed data on the mask plane array.


vMaskPlane Parameter For UpdateMagGlassExt
vMaskPlane

An array of bit flags which represents a mask plane. This array works as a plane for the parts of the bitmap that are not yet updated.


nMaskPlaneStart Parameter For UpdateMagGlassExt
nMaskPlaneStart

The start position of the mask plane array.


nMaskPlaneEnd Parameter For UpdateMagGlassExt
iMaskPlaneEnd

The end position of the mask plane array.


bUpdateBitmap Parameter For UpdateMagGlassExt
bUpdateBitmap

Flag that indicates whether to update the Main Control's bitmap. Possible values are:

Value	Meaning

TRUE	Update the Main Control's bitmap.

FALSE	Do not update the Main Control's bitmap.


Return for UpdateMagGlassExt
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


UpdateMagGlassFromHandle method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short UpdateMagGlassFromHandle (OLE_HANDLE hBitmap, BOOL bUpdateBitmap);

Overview	Refer to Using the Magnifying Glass

Remarks

Updates the bitmap that the magnifying glass uses to paint the zoomed area.

The idea is to provide a new bitmap that the magnifying glass can use when displaying the zoomed area. The dimensions of the bitmap referenced by hBitmap should be equal to the dimensions of the magnifying glass bitmap.

Note:	This method can be used only if the MAGGLASS_MANUAL_UPDATE flag was set in the MagGlassFlags property.

See Also

Elements	MagGlassFlags property, MagGlassCursor event, StartMagGlass method, StopMagGlass method, ShowMagGlass method, SetMagGlassPos method

Topics	Raster Images: Displaying Images


hBitmap Parameter For UpdateMagGlassFromHandle
hBitmap

A LEAD bitmap handle that references the bitmap that the Magnifying Glass will use to display the zoomed area.


bUpdateBitmap Parameter For UpdateMagGlassFromHandle
bUpdateBitmap

Flag that indicates whether to update the Main Control’s bitmap or not. Possible values are:

Value	Meaning

TRUE	Update the Main Control’s bitmap.

FALSE	Do not update the Main Control’s bitmap.


Return for UpdateMagGlassFromHandle
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


UpdateMagGlassShape method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short UpdateMagGlassShape (short nMagGlassShape, OLE_HANDLE hMagGlassRgn);

Overview	Refer to Using the Magnifying Glass

Remarks

Updates the Magnifying Glass shape.

The width and height of the Magnifying Glass will be changed according to the width and height of the passed hMagGlassRgn parameter if the uMagGlassShape parameter was set to MAGGLASS_SHAPE_HRGN.

See Also

Elements	StartMagGlass method, StopMagGlass method

Topics	Raster Images: Displaying Images


nMagGlassShape Parameter For UpdateMagGlassShape
nMagGlassShape

Flags that indicate the magnifying glass shape. Possible values are:

Value	Meaning

MAGGLASS_SHAPE_RECT	[0] Rectangle shape of Magnifying Glass.

MAGGLASS_SHAPE_ELLIPSE	[1] Ellipse shape of Magnifying Glass.

MAGGLASS_SHAPE_HRGN	[2] User-defined shape of Magnifying Glass.


hMagGlassRgn Parameter For UpdateMagGlassShape
hMagGlassRgn

Handle to a region that defines the Magnifying Glass shape. This parameter is used only if the nMagGlassShape parameter is MAGGLASS_SHAPE_HRGN.


Return for UpdateMagGlassShape
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


UpdateSegmentData method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short UpdateSegmentData(long nSegId, long SegmentLeft, long SegmentTop, long SegmentRight, long SegmentBottom, MRCSegmentTypeConstants SegType, OLE_COLOR TextForeColor, OLE_COLOR TextBackColor, VARIANT_BOOL bVerifyUpdate);

Overview	Refer to Working with MRC Bitmap.

Remarks

Updates the segment information. The LEADTOOLS engine will update the segments using the new segment data passed to this method. This process may create or delete segments.

With auto segmentation, the user can enumerate all segments using the EnumSegments method to get segment IDs and segment information.

The method will return an error if the updated segment exceeds its stripe boundaries. The method will update the segments so they remain within the bitmap width and height.

This method is valid for segments generated through the automatic and manual segmentation process.

See Also

Elements	StripeMaxHeight property, AutoSegment method, DeleteSegment method, EnumSegments method

Topics	MRC Bitmap Functions: Manipulating Segments


nSegId Parameter For UpdateSegmentData (Mixed Raster Content Control)
nSegId

ID of the segment to be updated.


SegmentLeft Parameter For UpdateSegmentData (Mixed Raster Content Control)
SegmentLeft

Left segment boundary from the original bitmap.


SegmentTop Parameter For UpdateSegmentData (Mixed Raster Content Control)
SegmentTop

Top segment boundary from the original bitmap.


SegmentRight Parameter For UpdateSegmentData (Mixed Raster Content Control)
SegmentRight

Right segment boundary from the original bitmap.


SegmentBottom Parameter For UpdateSegmentData (Mixed Raster Content Control)
SegmentBottom

Bottom segment boundary from the original bitmap.


SegType Parameter For UpdateSegmentData (Mixed Raster Content Control)
SegType

Flag that indicates the type of segment.  Possible values are:

Value	Meaning

SEGMENT_TEXT	[0x01] Segment type is text.

SEGMENT_PICTURE	[0x02] Segment type is picture.


TextForeColor Parameter For UpdateSegmentData (Mixed Raster Content Control)
TextForeColor

Foreground color for the segment. This parameter is only valid if SegType is SEGMENT_TEXT.


TextBackColor Parameter For UpdateSegmentData (Mixed Raster Content Control)
TextBackColor

Background base color. This parameter is only valid if SegType is SEGMENT_TEXT.


bVerifyUpdate Parameter For UpdateSegmentData (Mixed Raster Content Control)
bVerifyUpdate

Flag that indicates the update process behavior. bVerifyUpdate is effective only in the auto segmentation process.  Possible values are:

Value	Meaning

TRUE	If the method cannot update the segment, an error is returned.

FALSE	If the method cannot update the segment, then the segment will be updated with the new data and SUCCESS is returned.


Return for UpdateSegmentData
Return Value

Value	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


UserLUTCurveSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long UserLUTCurveSize;

Overview	Refer to Using Histograms.

Remarks

Specifies the number of points in the User Lookup Table Curve. Assign to this value to allocate the array of points before setting X and Y-coordinates.

See Also

Elements	GetUserLookupTable method, RemapIntensity method, RemapTable property, RemapTableSize property, UserLUTCurveX property, UserLUTCurveY property

Topics	Changing Brightness and Contrast


UserLUTCurveX property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long UserLUTCurveX(long iIndex);

Overview	Refer to Using Histograms.

Remarks

Specifies the X coordinate of a point on the User Lookup Table curve.

For more details on using this property, see the GetUserLookupTable method.

See Also

Elements	GetUserLookupTable method, RemapIntensity method, RemapTable property, RemapTableSize property, UserLUTCurveY property, UserLUTCurveSize property

Topics	Changing Brightness and Contrast


iIndex Parameter For UserLUTCurveX
iIndex

The index into the array of points.


UserLUTCurveY property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long UserLUTCurveY(long iIndex);

Overview	Refer to Using Histograms.

Remarks

Specifies the Y coordinate of a point on the User Lookup Table curve.

For more details on using this property, see the GetUserLookupTable method.

See Also

Elements	GetUserLookupTable method, RemapIntensity method, RemapTable property, RemapTableSize property, UserLUTCurveX property, UserLUTCurveSize property

Topics	Changing Brightness and Contrast


iIndex Parameter For UserLUTCurveY
iIndex

The index into the array of points.


UserPalette property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR UserPalette (short iIndex);

Overview	Refer to Managing Palettes.

Remarks

Sets a color in a palette that you define.

The user palette is an array of 256 elements. Each element is a long integer value containing the red, green and blue (RGB) components of the color. You can specify a color using the RGB function, and you can specify 256 or fewer colors.

To apply a palette to a bitmap, you must first use this property to set each of the colors in the array; then use the ColorRes method to implement the palette.

This property is also used when loading raw, uncompressed data that is 8 bits per pixel or less. To do this, assign a palette in the UserPalette property in the LoadInfo event. For more information, refer to Working with the RAW File Filter.

Palettes are used only for images that are 8 bits per pixel or less.

See Also

Topics	Raster Images: Palettes
Raster Images: Doing Color Expansion or Reduction


iIndex Parameter For UserPalette
iIndex

The index into the array of colors.


UseTransparentColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL UseTransparentColor

Overview	Refer to Using Special Effects When Painting.

Remarks

THIS PROPERTY IS NOW OBSOLETE. IT HAS BEEN REPLACED WITH THE BITMAPENABLETRANSPARENCY PROPERTY

 (Persistent property, available at design time) Determines whether a transparent color is used when painting an image or transition.

Value	Meaning

TRUE	Implement transparency. Do not paint the color specified by the BitmapTransparentColor property.

FALSE	Do not implement transparency.

See Also

Elements	PaintEffect property, TransitionEffect property, Transparent property

Topics	Raster Images: Implementing Special Effects


VersionDate property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BSTR VersionDate

Overview	Refer to Getting LEADTOOLS Toolkit Information.

Remarks

(Read only) Is the creation date of the current version of the LEADTOOLS ActiveX.

See Also

Topics	Support: Version and License Information


VersionLevel property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short VersionLevel

Overview	Refer to Getting LEADTOOLS Toolkit Information.

Remarks

(Read only) Is the level (Document/Medical or professional) of the current version of the LEADTOOLS ActiveX.

Setting	Description

VERSIONLEVEL_DOCUMENT	Document toolkits

VERSIONLEVEL_RASTER	Raster Toolkits

VERSIONLEVEL_MEDICAL	Medical toolkits

See Also

Topics	Support: Version and License Information


VersionMajor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short VersionMajor

Overview	Refer to Getting LEADTOOLS Toolkit Information.

Remarks

(Read only) Is the major version number of the current version of the LEADTOOLS ActiveX.

See Also

Topics	Support: Version and License Information


VersionMinor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short VersionMinor

Overview	Refer to Getting LEADTOOLS Toolkit Information.

Remarks

(Read only) Is the minor version number of the current version of the LEADTOOLS ActiveX.

See Also

Topics	Support: Version and License Information


VersionProduct property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BSTR VersionProduct

Overview	Refer to Getting LEADTOOLS Toolkit Information.

Remarks

(Read only) Is the full product name of the current version of the LEADTOOLS ActiveX.

See Also

Topics	Support: Version and License Information


VersionTime property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BSTR VersionTime

Overview	Refer to Getting LEADTOOLS Toolkit Information.

Remarks

(Read only) Is the creation time of the current version of the LEADTOOLS ActiveX.

See Also

Topics	Support: Version and License Information


ViewSize property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long ViewSize

Overview	Refer to Using the Image List Control.

Remarks

(Read only) (Runtime only) Contains the ImageList Control's view size.

The value of this property may be in rows or columns. The value depends on the current scroll style. If the ScrollStyle property is SCROLLSTYLE_VERTICAL, then the value will indicate rows. If the ScrollStyle property is SCROLLSTYLE_HORIZONTAL, then the value will indicate columns.

For more information on the LEADImageListItem data type, refer to the Item property.

See Also

Elements	ScrollStyle property, FirstVisibleItem property

Topics	Raster Images: Displaying Images


Visible property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short Visible

Overview	Refer to Annotation Toolbar.

Remarks

Contains a value that indicates whether the toolbar is visible or not. This is the only property that can be set before calling the Create method.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, hWnd property, Tool property

Topics	Annotations (Document/Medical only): Automation


VScrollInfo property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	LEADScrollInfo* VScrollInfo

Overview	Refer to Scrolling an Image.

Remarks

(Runtime only) Contains the object that references the control's vertical scrollbar information.

The LEADScrollInfo object has the following properties:

Property	Description

Min	(Read only) Long value that is updated with the minimum scroll range value.

Max	(Read only) Long value that is updated with the maximum scroll range value.

Page	Long value that gets or sets the scroll page size, in pixels.

Line	Long value that gets or sets the size of the scroll line, in pixels. This is the amount that will be scrolled by line up or line down. The line value must be <= the page value.

Pos	Long value that gets or sets the thumb position (current position) of the scrollbar. This value can be set to scroll the display.

Visible	(Read only) Boolean flag that indicates whether the scrollbar is visible. If this is TRUE, the scrollbar is visible. If this value is FALSE, the scrollbar is not visible.

Width	(Read only) Float value that is updated with the size of the of the scrollbar. The unit of measure is determined by the ScaleMode property.

See Also

Elements	AutoScroll property, HScrollInfo property, Scroll event, Resize event

Topics	Raster Images: Displaying Images


VTable property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short VTable (short iIndex);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Value lookup table. The Value indicates the amount of black present in a color. This is one of the four tables that the RemapHue method uses to change the bitmap's hue, saturation and value. This property is used only if the bUseVTable parameter is set to TRUE when the RemapHue method is called. Hue, Saturation, and Value levels range from 0 to 255.  Therefore, the lookup tables each have 256 entries. The current hue, saturation and value of a pixel correspond to the table indexes.

If the bUseMaskTable and bUseVTable parameters are set to TRUE when the RemapHue method is called and the MaskTable(i) entry for a particular hue is not zero, then the value is changed to the value in VTable(i). If MaskTable(i) is 0 then VTable(i) is ignored. For example, if RemapHue is called with both bUseMaskTable and bUseVTable set to TRUE, then if a pixel has a hue of 85 and the MaskTable(85) is not 0, the value of the pixel is changed to VTable(85).

If the bUseMaskTable parameter is FALSE and the bUseVTable parameter is TRUE when the RemapHue method is called, then the Value for each color present in the image will be changed to VTable(i). For example, if a pixel has a hue of 70, the Value of the pixel is changed to VTable(70). If the next pixel has a hue of 75, the Value of that pixel is changed to VTable(75).

Value entries range from 0 to 255 where

Value 0 contains the most black.

Value 255 contains no black.

See Also

Elements	RemapHue method, MaskTable property, HTable property, STable property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Modifying Intensity Values


iIndex Parameter For VTable
iIndex

The index into the array. The first element of the array is 0. The short values present in this array are Values used to remap an image.


VTableL property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short VTableL (long lIndex);

Overview	Refer to Changing Brightness and Contrast.

Remarks

(Document/Medical only) Value lookup table. The Value indicates the amount of black present in a color. This is one of the four tables that the RemapHue method uses to change the bitmap's hue, saturation and value. This property is used only if the bUseVTable parameter is set to TRUE when the RemapHue method is called and the RemapHueTablesSize property is set to 65536. Hue, Saturation, and Value levels range from 0 to 255.  The current hue, saturation and value of a pixel correspond to the table indexes.

If the bUseMaskTable and bUseVTable parameters are set to TRUE when the RemapHue method is called and the MaskTableL(i) entry for a particular hue is not zero, then the value is changed to the value in VTable(i). If MaskTableL(i) is 0 then VTableL(i) is ignored. For example, if RemapHue is called with both bUseMaskTable and bUseVTable set to TRUE, then if a pixel has a hue of 85 and the MaskTableL(85) is not 0, the value of the pixel is changed to VTableL(85).

If the bUseMaskTable parameter is FALSE and the bUseVTable parameter is TRUE when the RemapHue method is called, then the Value for each color present in the image will be changed to VTableL(i). For example, if a pixel has a hue of 70, the Value of the pixel is changed to VTableL(70). If the next pixel has a hue of 75, the Value of that pixel is changed to VTableL(75).

Value entries range from 0 to 255 where

Value 0 contains the most black.

Value 255 contains no black.

This property provides support for 16-bit grayscale and 48-bit color images. Support for 16-bit grayscale and 48-bit color images is provided only in Document/Medical toolkits.

See Also

Elements	RemapHue method, MaskTableL property, HTableL property, STableL property, MaskTable property, HTable property, STable property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Modifying Intensity Values


lIndex Parameter For VTableL
lIndex

The index into the array. The first element of the array is 0. The short values present in this array are Values used to remap an image.


WandColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR WandColor

Overview	Refer to Using Special Effects When Painting.

Remarks

(Persistent property, available at design time) The color of the wand when implementing a paint effect or transition effect.

The wand is a solid color bar that moves during an effect. Small grain sizes produce the best wand effects.  Many of the effects listed in Effects can have a wand.

This property is used only if the WandSize property is greater than 0.

See Also

Elements	PaintEffect property, TransitionEffect property

Topics	Raster Images: Implementing Special Effects


WandSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short WandSize

Overview	Refer to Using Special Effects When Painting.

Remarks

(Persistent property, available at design time) Thickness of the wand (in pixels) when implementing a paint effect or transition effect.

The wand is a solid color bar that moves during an effect. Small grain sizes produce the best wand effects.  Many of the effects listed in Effects can have a wand.

You can set this property to 0 to disable the wand.

See Also

Elements	PaintEffect property, TransitionEffect property

Topics	Raster Images: Implementing Special Effects


Window property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long Window

Overview	Refer to Using the Image List Control.

Remarks

(Read only) Is the handle s the ImageList Control.

See Also

Elements	BorderColor property, BackColor property, BorderStyle property, Appearance property

Topics	Raster Images: Displaying Images


WindowLevel method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short WindowLevel ();

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Medical Imaging only) Converts a 12 or 16-bit grayscale image to an 8-bit grayscale or a 24-bit color bitmap, if the WindowLevelBitmap property has been set to TRUE.

There are four properties associated with this method:  LevelLowBit property, LevelHighBit property, LevelLUT property and LevelLUTLength property.  They are all reset to their default values within this method.

This method applies window leveling to the bitmap, changing the image data to match the display image.

This method supports 12 and 16-bit grayscale images. Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits.

See Also

Elements	LevelLowBit property, LevelHighBit property, LevelLUTLength property
LevelLUT property, GetWindowLevel method, GetMinMaxBits method, GetMinMaxVal method

Topics	Raster Images: Palettes


Return for WindowLevel
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


WindowLevelBitmap property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL WindowLevelBitmap;

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Medical Imaging only) Controls the behavior of the WindowLevel method.

If this proprety is TRUE, then the WindowLevel method will use the LevelLowBit property, LevelHighBit property, LevelLUT property and LevelLUTLength property to create an 8-bit or 24-bit bitmap from a 12 or 16-bit grayscale bitmap.

If this property is FALSE, then the WindowLevel method will use the LevelLowBit property, LevelHighBit property, LevelLUT property and LevelLUTLength property to apply window leveling to the bitmap, but the bitmap remains as a 12 or 16-bit grayscale bitmap. That is, the image data is not altered.

See Also

Elements	LevelLowBit property, LevelHighBit property, LevelLUTLength property
LevelLUT property, GetWindowLevel method, GetMinMaxBits method, GetMinMaxVal method

Topics	Raster Images: Palettes


WindowLevelFillLUT method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short WindowLevelFillLUT (OLE_COLOR crStart, OLE_COLOR crEnd, long nLow, long nHigh, short nLowBit, short nHighBit, long nMinValue, long nMaxValue, BOOL short nFactor, long lFlags);

Overview	Examining and Altering Bitmaps

Remarks

(Medical Imaging only) Maps grayscale intensities to a specified color range, and fills the LevelLUT property with these values.

Use this method to fill the LevelLUT property, which may be used by the WindowLevel method, depending on the value of the WindowLevelBitmap property.

If you select FILLLUT_LINEAR the LevelLUT property will be filled as follows:

Inside/Outside	nMinValue-nLow	nLow-nHigh	nHigh-nMaxValue
FILLLUT_INSIDE	solid black (0,0,0)	color gradient ranging from crStart to crEnd	solid white (255,255,255)
FILLLUT_OUTSIDE	solid color (crStart)	grayscale values from solid black (0,0,0) to solid white (255, 255, 255)	solid color (crEnd)

In either case, the grayscale values are a linear interpolation of nMinValue to nMaxValue into RGB(0,0,0) to RGB(255,255,255).

The nFactor parameter is used for log, exp and sigmoid functions only. If nFactor = 0 the method performs a linear interpolation between the two points nLow and nHigh and stores the results in the lookup table, regardless of the value in lFlags.

If lFlag is FILLLUT_EXPONENTIAL the value of nFactor modifies the lookup table values (see figure below) according to the following equations:

Y	=	uStart	+	(uEnd – uStart) * (exp ((nFactor/10. * (x-uStart))/(uEnd-uStart)) - nFirstValue)
				(nLastValue – nFirstValue)
where :

nFirstValue = exp(0).

nLastValue = exp(nFactor)

x = the intensity value of the selected point

uStart = the nLow parameter of this method

uEnd = the nHigh parameter of this method

If lFlag is FILLLUT_ LOGARITHMIC the value of nFactor modifies the lookup table values (see figure below) according to the following equations:

Y	=	uStart	+	(uEnd – uStart) * (ln (1 + (nFactor/10. * (x-uStart))/(uEnd- uStart)) - nFirstValue)
				(nLastValue – nFirstValue)
where:

nFirstValue = 0.

nLastValue = ln(1 + nFactor)

x = the intensity value of the selected point

uStart = the nLow parameter of this method

uEnd = the nHigh parameter of this method

If lFlag is FILLLUT_ SIGMOID the value of nFactor modifies the lookup table values (see figure below)according to the following equations:

Y	=	uStart	+	(uEnd – uStart) * (1./ (1 + exp(2*nFactor/10. * (x-Center))/(uEnd- uStart)) - nFirstValue)
				(nLastValue – nFirstValue)
where:

nFirstValue = 1./(1+exp(2.*nFactor/10.*(nStart - Center)/ (uEnd- uStart))).

nLastValue = 1./(1+exp(2.*nFactor/10.*(nEnd - Center)/ (uEnd- uStart))).

Center  = (nEnd + nStart)/2.

x = the intensity value of the selected point

uStart = the nLow parameter of this method

uEnd = the nHigh parameter of this method

If lFlag is FILLLUT_LINEAR, nFactor is ignored. The method fills the lookup table linearly.

Note: This method only works for 12 or 16 bit grayscale images.  Trying to use this method with other images will result in an error.

You must allocate the memory for the LUT before calling this method.  You can calculate the required size with (sizeof(RGBQUAD) * (1<<(pBitmap->HighBit - pBitmap->LowBit + 1))), as seen in the example below.

For example, suppose you are working with a 12 bit grayscale image.  There are 4096 intensity levels in a 12 bit image (2 raised to the 12th power).  Normally, the interval between 0 and 4095 would be mapped to colors between (0, 0, 0) and (255, 255, 255).  With this method, any value that falls between the low level and the high level will be mapped to colors between the start color and the end color.  If you do not want a mapping function, set the start and end colors equal.

If you only want to map the values between 1972 and 3273 (in a 12-bit image), then set nLow to 1972, set nHigh to 3273, and set bInside to TRUE. To map the values less than 1972 and greater than 3273, select FILLLUT_OUTSIDE option.

See Also

Elements	WindowLevel method, GetWindowLevel method, LevelLUT property


crStart Parameter For WindowLevelFillLUT
crStart

The starting color.


crEnd Parameter For WindowLevelFillLUT
crEnd

The ending color.


nLow Parameter For WindowLevelFillLUT
nLow

The lowest grayscale value to window level.


nHigh Parameter For WindowLevelFillLUT
nHigh

The highest grayscale value to window level.


nLowBit Parameter For WindowLevelFillLUT
nLowBit

Low-bit value.


nHighBit Parameter For WindowLevelFillLUT
nHighBit

High-bit value.


nMinValue Parameter For WindowLevelFillLUT
nMinValue

The lowest grayscale value in the image.


nMaxValue Parameter For WindowLevelFillLUT
nMaxValue

The highest grayscale value in the image.


nFactor Parameter For WindowLevelFillLUT
nFactor

Value that indicates the factor to be applied in the operation specified in the lFlags parameter. This parameter is used only if lFlags is FILLLUT_EXPONENTIAL, FILLLUT_LOGARITHMIC or FILLLUT_SIGMOID. If FILLLUT_EXPONENTIAL or FILLLUT_SIGMOID is set in lFlags, this parameter value can be any integer (+/-). If FILLLUT_LOGARITHMIC is set in lFlags, this parameter value should be >= 0. If nFactor = 0, the lookup table will be filled linearly.


lFlags Parameter For WindowLevelFillLUT
lFlags

Flags that indicate how the range is used to fill the LUT and the type of LUT and whether the LUT contains signed or unsigned data.

The following flags indicate how the range is used to fill the LUT:

Value	Meaning

FILLLUT_INSIDE	[0x0001] Fill the LUT between nLow and nHigh. ( inside the nLow...nHigh range )

FILLLUT_OUTSIDE	[0x0002] Fill the LUT below nLow and above nHigh. ( outside the nLow...nHigh range )

The following flags indicate the LUT type:

Value	Meaning

FILLLUT_LINEAR	[0x0010] LUT is linear.

FILLLUT_EXPONENTIAL	[0x0020] LUT is exponential.

FILLLUT_LOGARITHMIC	[0x0030] LUT is logarithmic.

FILLLUT_SIGMOID	[0x0030] LUT is sigmoid.

The following flags indicate whether the LUT contains signed or unsigned data:

Value	Meaning

FILLLUT_UNSIGNED	[0x0000] (Default) The LUT data is unsigned.

FILLLUT_SIGNED	[0x0100] The LUT data is signed.


Return for WindowLevelFillLUT
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


WMFResolution property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long WMFResolution

Overview	Refer to Loading a Bitmap from a File.

Remarks

Sets the DPI (dots per inch) value that LEADTOOLS uses when loading WMF files. A value of 0 results in the resolution present in the file being loaded. A positive value results in the image being loaded at the corresponding DPI. By default, the value is 0.

WMF files can contain vectored graphics or raster images. LEADTOOLS can load either type, but can save only raster images. The issue of image resolution arises mainly when loading vectored graphics.

LEADTOOLS loads a WMF file by creating a temporary device context (DC), drawing the vectored graphics (or painting the raster image) in the device context, and converting the resulting device context to a bitmap. Loading an image at some DPI values may yield an image that is smaller, and less detailed, than the original, or, since bitmaps use more memory than vectored graphics, it may yield an image that is too large to handle efficiently.

You can use InfoXRes property and WMFResolution, along with GetFileInfo, to manage these image size issues. The following are examples of how you can use these methods:

To load an image at its saved resolution, you can do the following:

1.	Set WMFResolution to 0.

2.	Call Load method to load the file.

To load an image that will fit a predetermined width (such as the width of your application's client area), you can do the following:

1.	Set WMFResolution to 0.

2.	Call GetFileInfo and check InfoXRes property and InfoWidth property, to determine the resolution and size of the image stored in the file.

3.	Calculate the necessary resolution to get the desired width. Where the necessary resolution is A, the value from InfoXRes property is B, the desired width is C, and the value of the Width field is D, the calculation is as follows: A = B * C / D.

4.	Set WMFResolution to the desired resolution.

5.	Call Load to load the file.

Some WMF files contain viewport information, which requires a device context of a particular size. LEADTOOLS always loads these files using the resolution specified in the file. In this case, the value specified by WMFResolution has no effect.

Note:  When saving WMF files, LEADTOOLS saves the current resolution value in the file.

See Also

Elements	GetFileInfo method, InfoXRes property, InfoYRes property, Load method, LoadFromFile method, LoadMemory method, LoadStamp method


WriteComment method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short WriteComment (BSTR pszFile, long lPage);

Overview	Refer to Maintaining File Comments

Remarks

Writes comments to an existing file.

This method writes all the comments set in the Comment property to the specified file, just like the Save method. However, the WriteComment method only writes the comments to the file. It does not overwrite the image stored in the file with the control’s bitmap. Any comments already in the file will be overwritten.

For more information on setting comments, refer to the Comment property. For more information on saving files, refer to the Save method. For information on reading comments, refer to the ReadComment method.

See Also

Functions:	Comment property, Save method, ReadComment method

Topics	Raster Images: Getting and Setting File Information


pszFile Parameter For WriteComment
pszFile

String that contains the name of the file in which to write the comment(s).


lPage Parameter For WriteComment
lPage

Number of the page within the specified file on which to write the comments. The first page is page 1. The specified page must exist. If the page does not exist, an error will be returned.


Return for WriteComment
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


WriteMarker method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short WriteMarker (short iMarker, long lSize, VARIANT vData);

Overview	Refer to Examining and Altering Bitmaps

Remarks

Writes the transformed marker to the file.

This method can only be called from inside the TransformMarker event.

After calling this method, it is best to set the WriteMarkerAction property to WRITEMARKER_SKIP. Otherwise, this marker can occur twice in the file.

See Also

Elements

Topics	Raster Images: Doing Geometric Transformations


iMarker Parameter For WriteMarker
iMarker

ID of the JPEG marker to write. The JPEG markers are uniquely identified by a byte value. Possible values are 1 to 254. (0 and 255 are not allowed.) This can be the same value that was passed to the TransformMarker event.


lSize Parameter For WriteMarker
lSize

Size of the JPEG marker. The size will be less than 65535. If this value is 0, then the marker does not have any extra data. If the value is greater than 0, the extra data is taken from vData.


vData Parameter For WriteMarker
vData

VARIANT byte array that contains the marker data to write. The size of this data is indicated in lSize.


Return for WriteMarker
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


WriteMarkerAction property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short WriteMarkerAction

Overview	Refer to Examining and Altering Bitmaps

Remarks

Indicates how to process the current marker passed to the TransformMarker event. This property should be accessed only from within the TransformMarker event. Possible values for this property are:

Value	Meaning

WRITEMARKER_DEFAULT	[0] The marker will be transformed using the default transformation, after which it will be written to the file.

WRITEMARKER_IGNORE	[1] The marker will not be written to the file.

WRITEMARKER_ABORT	[2] The transformation process is aborted and the TransformFile method will return ERROR_USER_ABORT.

The value of the WriteMarkerAction property will be reset for every marker to WRITEMARKER_DEFAULT.

See Also

Elements	TransformFile method, TransformMarker event, WriteMarker method

Topics	Raster Images: Doing Geometric Transformations


WriteTag method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short WriteTag (LPCTSTR pszFile, long lPage);

Overview	Refer to Implementing TIFF Tags

Remarks

Writes the tag(s) to the specified file.

For more information on setting tags, refer to the SetTag method.

See Also

Functions:	SetTag method, ReadTag method, GetTagType method, GetTagCount method, GetTagData method, Save method, Comment property

Topics	Raster Images: Getting and Setting File Information


pszFile Parameter For WriteTag
pszFile

String that contains the name of the file in which to write the tag(s). Please note that this file must exist.


lPage Parameter For WriteTag
lPage

Number of the page within the specified file on which to write the tag(s). The first page is page 1. The specified page must exist. If the page does not exist, an error will be returned.


Return for WriteTag
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ZoomIn method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ZoomIn ();

Overview	Refer to Capturing an Image from the Screen.

Remarks

Changes the mouse pointer to a magnifying glass in the center of a rectangle and begins a "ZoomIn" screen capture.  When the user moves the mouse pointer, the area inside the "ZoomIn" rectangle is captured to the Main Control and zoomed by the amount specified in the PaintZoomFactor property.

The initial size of the zoom rectangle is based on the size of the control and the existing PaintZoomFactor property at the time ZoomIn is called. During the capture, pressing the +,- or PageUp, PageDown keys will adjust the ZoomIn rectangle and zoom factor.  Once the left mouse button is clicked, the capture is completed, the image is stored in the Main Control's Bitmap, and the ZoomInDone event is generated.

There is one property associated with this method.  The EnableZoomInRect property determines whether or not to show the ZoomIn rectangle.

See Also

Elements	ZoomInDone event, Capture method, EnableZoomInRect property

Topics	Raster images: Capturing a screen image


Return for ZoomIn
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ZoomInDone event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void ZoomInDone (long x, long y);

Overview	Refer to Capturing an Image from the Screen.

Remarks

Occurs when the user clicks the left mouse button after a screen capture has been started by calling ZoomIn.

See Also

Elements	ZoomIn method, Capture method, EnableZoomInRect property

Topics	Raster images: Capturing a screen image


x Parameter For ZoomInDone
x

x location of the ZoomIn capture, relative to the top, left corner of the screen.  The unit of measure is determined by the ScaleMode property.


y Parameter For ZoomInDone
y

y location of the ZoomIn capture, relative to the top, left corner of the screen.  The unit of measure is determined by the ScaleMode property.


ZoomToRect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ZoomToRect (float fLeft, float fTop, float fWidth, float fHeight);

Overview	Refer to Displaying an Image

Remarks

Adjusts the destination display rectangle to zoom in on the part of the image that you specify.

You specify a rectangle in the Main Control's client area. This method increases the dimensions of the destination display rectangle so that your rectangle is enlarged and centered to fit the client area. If scroll bars are turned on, they are adjusted to the new size and position.

Because of a Windows limitation, destination rectangle measurements, when converted to pixels, cannot exceed the maximum value of an integer. On WIN32 systems, this is rarely a problem. LEADTOOLS returns an ERROR_INV_RANGE error if the problem occurs. An alternative for scaling large images is to make the source rectangle smaller, using the SetSrcRect method.

See Also

Topics	Raster Images: Displaying Images


fLeft Parameter For ZoomToRect
fLeft

The X coordinate of the origin of the rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fTop Parameter For ZoomToRect
fTop

The Y coordinate of the origin of the rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fWidth Parameter For ZoomToRect
fWidth

The width of the rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


fHeight Parameter For ZoomToRect
fHeight

The height of the rectangle in the Main Control's client area. The unit of measure is determined by the ScaleMode property.


Return for ZoomToRect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


LoadICCProfile method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short LoadICCProfile(BSTR pszName, VARIANT *pData, long lPage);

Overview	Refer to Using ICC Profile Methods

Remarks

ICC profiles can be loaded from JPEG, TIFF or EPS files. TIFF files are multipage and you can load the profile from a particular page using the lPage parameter.

See Also

Topics	Raster Images: Loading Files


pszName Parameter For LoadICCProfile
pszName

String containing the name of the file that contains the embedded ICC profile.


pData Parameter For LoadICCProfile
pData

A VARIANT byte array object that contains the actual ICC data.


lPage Parameter For LoadICCProfile
lPage

The page number (for multipage files) that contains the embedded ICC profile to load. If the file is not a multipage file, pass 0.


Return for LoadICCProfile
Return Value

Return	Meaning

0	The method was successful.

<>0	An error occurred. Refer to Error Codes.


Return for Fill
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Filter property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR Filter

Overview	Refer to Thumbnail Browser.

Remarks

(Persistent property, available at design time) Character string containing the file filter to browse for.  Ex. *.jpg.

This defaults to "*.*", which searches all files.

See Also

Elements	BrowseDir method

Topics	Raster Images: Using the Thumbnail Browser


FirstVisibleItem property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long FirstVisibleItem

Overview	Refer to Using the Image List Control.

Remarks

(Read only) (Runtime only) Contains the index of the first visible item in the ImageList Control's view. This is a 0-based index.

See Also

Elements	ViewSize property, RowCount property, ColumnCount property, Count property

Topics	Raster Images: Displaying Images


Flip method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Flip ();

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Flips the bitmap from top to bottom.

See Also

Topics	Raster Images: Doing Geometric Transformations
Raster Images: Methods That Transform the Region and the Bitmap (Document/Medical only)


Return for Flip
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Floater property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE Floater

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Specifies the floater bitmap for the Main Control.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

You can create the floater bitmap by assigning the Main Control's Bitmap property to it. The floater bitmap that this creates is the size of the bounding rectangle of the main bitmap's region, and it contains the same region as the main bitmap.

You can also make a copy of the floater bitmap by assigning it to the another Main Control's Bitmap property.

See Also

Elements	FloaterVisible property, IsPtInFloater method

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterDstClipHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FloaterDstClipHeight

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The height of the destination clipping rectangle used when painting the Main Control's floater bitmap.

If the AutoSetRects property is set to True, the initial value of this property is the height of the Main Control's client area. You can set this property or use the more-efficient SetFloaterDstClipRect method to change the value.

The position of the rectangle is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	FloaterDstHeight property, FloaterDstLeft property, FloaterDstTop property, FloaterDstWidth property, FloaterDstClipLeft property, FloaterDstClipTop property, FloaterDstClipWidth property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterDstClipLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FloaterDstClipLeft

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The X coordinate of the origin of the destination clipping rectangle used when painting the Main Control's floater bitmap.

If the AutoSetRects property is set to True, the initial value of this property is 0. You can set this property or use the more-efficient SetFloaterDstClipRect method to change the value.

The position of the rectangle is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	FloaterDstHeight property, FloaterDstLeft property, FloaterDstTop property, FloaterDstWidth property, FloaterDstClipHeight property, FloaterDstClipTop property, FloaterDstClipWidth property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterDstClipTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FloaterDstClipTop

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The Y coordinate of the origin of the destination clipping rectangle used when painting the Main Control's floater bitmap.

If the AutoSetRects property is set to True, the initial value of this property is 0. You can set this property or use the more-efficient SetFloaterDstClipRect method to change the value.

The position of the rectangle is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	FloaterDstHeight property, FloaterDstLeft property, FloaterDstTop property, FloaterDstWidth property, FloaterDstClipHeight property, FloaterDstClipLeft property, FloaterDstClipWidth property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterDstClipWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FloaterDstClipWidth

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The width of the destination clipping rectangle used when painting the Main Control's floater bitmap.

If the AutoSetRects property is set to True, the initial value of this property is the height of the Main Control's client area. You can set this property or use the more-efficient SetFloaterDstClipRect method to change the value.

The position of the rectangle is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	FloaterDstHeight property, FloaterDstLeft property, FloaterDstTop property, FloaterDstWidth property, FloaterDstClipHeight property, FloaterDstClipLeft property, FloaterDstClipTop property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterDstHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FloaterDstHeight

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The height of the destination rectangle used when painting the Main Control's floater bitmap.

If the AutoSetRects property is set to True, the initial value of this property is the unscaled height of the floater bitmap. You can set this property or use the more-efficient SetFloaterDstRect method to change the value.

The position of the rectangle is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	FloaterDstLeft property, FloaterDstTop property, FloaterDstWidth property, FloaterDstClipHeight property, FloaterDstClipLeft property, FloaterDstClipTop property, FloaterDstClipWidth property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterDstLeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FloaterDstLeft

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The X coordinate of the origin of the destination rectangle used when painting the Main Control's floater bitmap.

If the AutoSetRects property is set to True, the initial value of this property is 0. You can set this property or use the more-efficient SetFloaterDstRect method to change the value.

The position of the rectangle is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	FloaterDstHeight property, FloaterDstTop property, FloaterDstWidth property, FloaterDstClipHeight property, FloaterDstClipLeft property, FloaterDstClipTop property, FloaterDstClipWidth property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterDstTop property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FloaterDstTop

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The Y coordinate of the origin of the destination rectangle used when painting the Main Control's floater bitmap.

If the AutoSetRects property is set to True, the initial value of this property is 0. You can set this property or use the more-efficient SetFloaterDstRect method to change the value.

The position of the rectangle is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	FloaterDstHeight property, FloaterDstLeft property, FloaterDstWidth property, FloaterDstClipHeight property, FloaterDstClipLeft property, FloaterDstClipTop property, FloaterDstClipWidth property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterDstWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FloaterDstWidth

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

The width of the destination rectangle used when painting the Main Control's floater bitmap.

If the AutoSetRects property is set to True, the initial value of this property is the unscaled width of the floater bitmap. You can set this property or use the more-efficient SetFloaterDstRect method to change the value.

The position of the rectangle is relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	FloaterDstHeight property, FloaterDstLeft property, FloaterDstTop property, FloaterDstClipHeight property, FloaterDstClipLeft property, FloaterDstClipTop property, FloaterDstClipWidth property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FloaterHeight

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

(Read only) Is the unscaled height of the floater bitmap.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	FloaterWidth property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterVisible property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL FloaterVisible

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Displays or hides the Main Control's floater bitmap.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	Floater property, IsPtInFloater method

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


FloaterWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FloaterWidth

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

(Read only) Is the unscaled width of the floater bitmap.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	FloaterHeight property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


Font property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	IFontDisp* Font

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies the Font object for displaying each item's Text attribute when DisplayItemText is set to True.

In Visual Basic, you can set the Font object's properties at design time by double-clicking the ImageList Control's Font property in the Properties window. At run time, you set these properties as in the following example: LEADImgList1.Font.Name = "Arial".

The Font object has the following properties:

Property	Description

Bold 	TRUE for bold text; FALSE for not bold.

Italic 	TRUE for italic text; FALSE for not italic.

Name 	Text string for name of the font. For example: "Times New Roman".

Size 	Size of the font, in points. The maximum value s 2048 points.

StrikeThrough	TRUE for a line through the text; FALSE for no line.

Underline 	TRUE for underlined text; FALSE for not underlined.

Weight 	Possible runtime values are 400 for light and 700 for heavy.

See Also

Elements	ForeColor property, ItemBackgroundColor property, BackColor property, BorderColor property, DisplayItemText property, Appearance property

Topics	Raster Images: Displaying Images


Font property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	IFontDisp* Font

Overview	Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

(Persistent property, available at design time) Specifies the Font object for any text that you draw using the DrawText method.

In Visual Basic, you can set the Font object's properties at design time by double-clicking the Main Control's Font property in the Properties window. At run time, you set these properties as in the following example: Lead1.Font.Name = "Arial".

The Font object has the following properties:

Property	Description

Bold 	TRUE for bold text; FALSE for not bold.

Italic 	TRUE for italic text; FALSE for not italic.

Name 	Text string for name of the font. For example: "Times New Roman".

Size 	Size of the font, in points. The maximum value s 2048 points.

StrikeThrough	TRUE for a line through the text; FALSE for no line.

Underline 	TRUE for underlined text; FALSE for not underlined.

Weight 	Possible runtime values are 400 for light and 700 for heavy.

See Also

Topics	Working with the Control: Client Area Usage
Raster Images: Drawing on a Bitmap


ForceRepaint method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short ForceRepaint ();

Overview	Refer to Displaying an Image.

Remarks

Repaints the image on the screen.

See Also

Elements	AutoRepaint property, PaintRgnOnly property, RepaintRect method, EnablePaint property

Topics	Raster Images: Displaying Images


Return for ForceRepaint
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ForceSize property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL ForceSize

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Flag indicating whether the generated thumbnail should be forced to the requested size even if MaintainAspect is set to TRUE.  If set to TRUE, the thumbnail bitmap will be generated by creating a "canvas" bitmap with the requested size, and then centering the actual image inside that bitmap.  Note this is a slower process.

This property is ignored if MaintainAspect is False.

Default setting is False.

See Also

Elements	BrowseDir method, ThumbnailWidth property, ThumbnailHeight property, MaintainAspect property, ThumbnailBackgroundColor property, Resample property

Topics	Raster Images: Using the Thumbnail Browser


ForeColor property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR ForeColor

Overview	Refer to Using the Image List Control.

Remarks

Sets the color to be used for drawing each item's Text attribute when DisplayItemText is set to True.

See Also

Elements	DisplayItemText property, BorderColor property, ItemBackgroundColor property, BackColor property, BorderStyle property, Font property, Appearance property

Topics	Raster Images: Displaying Images


ForePalette property (Main Control)

Access 2.0 example   Other systems

Syntax	BOOL ForePalette

Overview	Refer to Displaying an Image.

Remarks

(Persistent property, available at design time) Causes the Main Control's palette to be used as a foreground palette.

The main purpose of this property is to overcome palette-handling problems in Access and FoxPro. Set this property to TRUE only if you are displaying single images. It can cause problems in a multiple document interface (MDI).

Setting	Description

TRUE	Use the LEAD control's palette as a foreground palette.

FALSE	Use the LEAD control's palette as a background palette.

See Also

Elements	BackErase property, BitonalScaling property, PaintDither property, PaintEffect property, PaintPalette property, PaintROP3 property, PaintGamma property, PaintIntensity property, PaintContrast property

Topics	Raster Images: Displaying Images


FrameColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR FrameColor

Overview	Refer to Adding a Frame to the Control.

Remarks

(Persistent property, available at design time) Specifies the border color of the three-dimensional frame that you add to the Main Control.

The FrameThickness property determines the thickness of the frame, and you can set the thickness to 0 to disable the frame. Other properties described in Adding a Frame to the Control, specify the inner and outer bands that give the frame a three-dimensional appearance.

See Also

Topics	Working with the Control: General Behavior


FrameInnerHiliteColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR FrameInnerHiliteColor

Overview	Refer to Adding a Frame to the Control.

Remarks

(Persistent property, available at design time) Specifies the inner highlight color of the three-dimensional frame that you add to the Main Control. This property works with others described in Adding a Frame to the Control to give the frame a three-dimensional appearance.

The FrameThickness property determines the thickness of the frame, and you can set the thickness to 0 to disable the frame.

See Also

Topics	Working with the Control: General Behavior


FrameInnerShadowColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR FrameInnerShadowColor

Overview	Refer to Adding a Frame to the Control.

Remarks

(Persistent property, available at design time) Specifies the inner shadow color of the three-dimensional frame that you add to the Main Control. This property works with others described in Adding a Frame to the Control to give the frame a three-dimensional appearance.

The FrameThickness property determines the thickness of the frame, and you can set the thickness to 0 to disable the frame.

See Also

Topics	Working with the Control: General Behavior


FrameInnerStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short FrameInnerStyle

Overview	Refer to Adding a Frame to the Control.

Remarks

(Persistent property, available at design time) Specifies the style of the inner band of the three-dimensional frame that you add to the Main Control. This property works with others described in Adding a Frame to the Control to give the frame a three-dimensional appearance.

The FrameThickness property determines the thickness of the frame, and you can set the thickness to 0 to disable the frame.

The following are possible values of the FrameInnerStyle property:

Value	Meaning

EFX_INNERSTYLE_INSET	Inner band inset

EFX_INNERSTYLE_RAISED	Inner band raised

EFX_INNERSTYLE_MAX	Inner band raised

See Also

Topics	Working with the Control: General Behavior


FrameInnerThickness property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FrameInnerThickness

Overview	Refer to Adding a Frame to the Control.

Remarks

(Persistent property, available at design time) Specifies the thickness of the inner band of the three-dimensional frame that you add to the Main Control. This property works with others described in Adding a Frame to the Control to give the frame a three-dimensional appearance.

The FrameThickness property determines the thickness of the frame, and you can set the thickness to 0 to disable the frame.

See Also

Topics	Working with the Control: General Behavior


FrameOuterHiliteColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR FrameOuterHiliteColor

Overview	Refer to Adding a Frame to the Control.

Remarks

(Persistent property, available at design time) Specifies the outer highlight color of the three-dimensional frame that you add to the Main Control. This property works with others described in Adding a Frame to the Control to give the frame a three-dimensional appearance.

The FrameThickness property determines the thickness of the frame, and you can set the thickness to 0 to disable the frame.

See Also

Topics	Working with the Control: General Behavior


FrameOuterShadowColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR FrameOuterShadowColor

Overview	Refer to Adding a Frame to the Control.

Remarks

(Persistent property, available at design time) Specifies the outer shadow color of the three-dimensional frame that you add to the Main Control. This property works with others described in Adding a Frame to the Control to give the frame a three-dimensional appearance.

The FrameThickness property determines the thickness of the frame, and you can set the thickness to 0 to disable the frame.

See Also

Topics	Working with the Control: General Behavior


FrameOuterStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short FrameOuterStyle

Overview	Refer to Adding a Frame to the Control.

Remarks

(Persistent property, available at design time) Specifies the style of the outer band of the three-dimensional frame that you add to the Main Control. This property works with others described in Adding a Frame to the Control to give the frame a three-dimensional appearance.

The FrameThickness property determines the thickness of the frame, and you can set the thickness to 0 to disable the frame.

The following are possible values of the FrameInnerStyle property:

Value	Meaning

EFX_OUTERSTYLE_INSET	Outer band inset

EFX_OUTERSTYLE_RAISED	Outer band raised

EFX_OUTERSTYLE_MAX	Outer band raised

See Also

Topics	Working with the Control: General Behavior


FrameOuterThickness property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FrameOuterThickness

Overview	Refer to Adding a Frame to the Control.

Remarks

(Persistent property, available at design time) Specifies the thickness of the outer band of the three-dimensional frame that you add to the Main Control. This property works with others described in Adding a Frame to the Control to give the frame a three-dimensional appearance.

The FrameThickness property determines the thickness of the frame, and you can set the thickness to 0 to disable the frame.

See Also

Topics	Working with the Control: General Behavior


FrameThickness property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float FrameThickness

Overview	Refer to Adding a Frame to the Control.

Remarks

(Persistent property, available at design time) Specifies the thickness of the frame that you add to the Main Control. You can set the thickness to 0 to disable the frame.

Other properties described in Adding a Frame to the Control give the frame a three-dimensional appearance.

See Also

Topics	Working with the Control: General Behavior


FreeRgn method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short FreeRgn ();

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Removes the current bitmap region and frees the region data from memory.

Removing the region from the bitmap allows methods to act on the whole bitmap, rather than the region. For a list of affected methods, refer to Raster Images: Where the Region Preempts the Bitmap .

See Also

Elements	GetFloaterHandle method, GetRgnHandle method, DeleteRgnHandle method, SetRgnHandle method

Topics	Raster Images: Creating and Using a Region


Return for FreeRgn
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GammaCorrect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short GammaCorrect (short iGamma);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Adjusts the intensity of colors in the bitmap by changing the gamma constant that is used to map the intensity values.

Intensity values ideally follow a logarithmic progression, because the eye perceives changes in intensity as being equal when the ratio of change is equal. For example, we would see a change from 0.1 to 0.2 as being equal to a change from 0.2 to 0.4.

Gamma is a standard constant that is used to calculate the progression. For most CRTs the gamma constant is in the range of 2.2 to 2.5.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Intensity method, Contrast method, HistoContrast method, HistoEqualize method, StretchIntensity method, GetGamma method

Topics	Raster Images: Modifying Intensity Values
Raster Images: Where the Region Preempts the Bitmap


iGamma Parameter For GammaCorrect
iGamma

Unsigned integer that represents the gamma value.

Because this is an unsigned integer, it is 100 times the actual gamma value. For example, use 235 to set a gamma value of 2.35.


Return for GammaCorrect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GaussianFilter method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short GaussianFilter(short iRadius);

Overview	Refer to Removing Noise.

Remarks

Smoothes or blurs an image by applying a Gaussian filter to the specified bitmap.

Each pixel in the bitmap is blurred based on neighborhood pixels. The parameter iRadius determines the size of the neighborhood to consider when blurring a pixel. The result is a blurred version of the original image.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Sharpen method, Posterize method, Mosaic method, Emboss method, Median method, AddNoise method, IntensityDetect method, SpatialFilter method, BinaryFilter method, Solarize method, WindowLevel method, UnsharpMask method

Topics	Raster Images: Filtering Images


iRadius Parameter For GaussianFilter
iRadius

Value that indicates the radius of the neighborhood on which the filter is applied.


Return for GaussianFilter
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetArrayInfo method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short GetArrayInfo (VARIANT vMem, long lPage, long lSize, long uFlags);

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Gets information about a file that is stored in memory.

This method updates the following properties:

InfoBits property
InfoCompress property
InfoFormat property
InfoHeight property
InfoPage property
InfoSizeDisk property
InfoSizeMem property
InfoWidth property

To save an image to a file in memory, refer to the SaveArray method. To load an image from a file in memory, refer to the LoadArray method.

Note: You cannot save a multipage file using the SaveArray method, but if you get a multipage file into memory in some other way, you can specify a page when using the GetArrayInfo method or the LoadArray method.

See Also

Elements	LoadArray method, SaveArray method, LoadMemory method, SaveMemory method, GetMemoryInfo method, GetFileInfo method

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


vMem Parameter For GetArrayInfo
vMem

A global handle (HGLOBAL) to the file in memory. If you use the SaveMemory method to create the file in memory, that method updates your handle and buffer size variables. Otherwise, your code must update and pass the appropriate variables.


lPage Parameter For GetArrayInfo
lPage

The page number of the image, if the image is in a multipage file.

GIF, TIFF (MPT), and PCX (DCX) files can be multipage files (containing more than one image). If you set the value to the page number of an image in the file, this method provides information about the specified image.

If you set the value of the page number to a number greater than the total number of pages in the file, this method updates the InfoPage property with the highest page number. Therefore, if you do not know how many pages are in a file, you can use this method to find out.

If the file is not a multipage file, pass 0.


lSize Parameter For GetArrayInfo
lSize

The size in bytes of the file referenced by hMem. If you use the SaveMemory method to create the file in memory, that method updates your handle and buffer size variables. Otherwise, your code must update and pass the appropriate variables.


uFlags Parameter For GetArrayInfo
uFlags

Flag that indicates whether to update the InfoTotalPages property. Possible values are:

Value	Meaning

0	Do not update the InfoTotalPages property.

FILEINFO_TOTALPAGES	Update the InfoTotalPages property.


Return for GetArrayInfo
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetBitmapClipSegments method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	VARIANT GetBitmapClipSegments (float y);

Overview	Refer to Creating and Using a Bitmap Region

Remarks

Gets the segments contained in the region for a particular row.

Call this method only for those rows that are within the region. That is, only those rows from RgnTop to RgnTop + RgnHeight. For the rows not contained in the region, their clip segments will include the whole row.

The segments are returned as an array of pairs of horizontal offsets. The first point in the pair is the beginning of the segment (it is contained in the region). The last point in the pair is the end of the segment. To follow the Windows rules, the end of the segment is the first point NOT CONTAINED in the region.

In most regions, there will be one segment per row. However, some regions can have 0, 1, 2 or more segments.

For example, assume that for a particular row there are two segments. The VARIANT will be filled with 4 values. Let’s call them x0, x1, x2, x3. In this case:

 portion from 0 to x0 – 1 is OUTSIDE the region

 portion from x0 to x1 - 1 is INSIDE the region

 portion from x1 to x2 – 1 is OUTSIDE the region

 portion from x2 to x3 – 1 is INSIDE the region

 portion from x3 to pBitmap->Width – 1 is OUTSIDE the region

The position is unscaled relative to the LEAD bitmap in memory.

The unit of measure is determined by the ScaleMode property.

See Also

Elements	RgnTop property, RgnHeight property

Topics	Raster Images: Creating and Using a Region


y Parameter For GetBitmapClipSegments
y

The number of the row for which to get the segments. The first row is 0, and the last row is 1 less than the bitmap height.


Return for GetBitmapClipSegments
Return Value

An array of pairs of horizontal offsets that represent the beginning and ending points of the segments present in the specified row.


GetBitmapDC method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE GetBitmapDC ();

Overview	Refer to Using the Windows API.

Remarks

Provides a powerful set of graphics features by creating a Microsoft Windows device context, using the bitmap as the display surface. If you call this method, you must call the ReleaseBitmapDC method before using other properties or methods that affect the bitmap.

This gives you many drawing capabilities such as paint, erase, color erase and brush, pen, spray gun, flood fill, color tube, text overlay, curve, line, rectangle, polygon, ellipse, freehand shapes, cut and paste, and more.

All Windows GDI functions can be used to draw to the bitmap using the returned HDC. You should use the ReleaseBitmapDC method when the bitmap no longer needs to be available for drawing functions.

If a region is defined for the bitmap, GDI functions act only on the region, not on the entire bitmap.

This method supports only 1, 4, 8, 16 and 24 bit images. If you are using an image that has some other number of bits per pixel, use the ColorRes method to change the image to a bits per pixel value supported by the DIB driver

See Also

Topics	Raster Images: Creating and Deleting Images
Raster Images: Drawing on a Bitmap
Examining and Altering Bitmaps


Return for GetBitmapDC
Return Value

Return	Meaning

>0 	Function was successful. The return value is the HDC.

NULL	An error occurred.


GetClientDC method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE GetClientDC ();

Overview	Refer to Using the Windows API.

Remarks

Returns the device context of the Main Control's client area on the screen. You can use the device context with Windows API functions, such as GDI drawing functions.

You should use the ReleaseClientDC method when the device context is no longer needed.

See Also

Elements	ReleaseClientDC method

Topics	Working with the Control: Client Area Usage


Return for GetClientDC
Return Value

Return	Meaning

>0 	Function was successful. The return value is the HDC.

NULL	An error occurred.


GetColorCount method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long GetColorCount ();

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Returns the number of unique colors in the current bitmap.

See Also

Elements	BitmapBits property, BitmapHeight property, BitmapWidth property, BitmapXRes property, BitmapYRes property

Topics	Raster Images: Getting Current Information


Return for GetColorCount
Return Value

Number of colors


GetDDB method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE GetDDB (OLE_HANDLE hDC);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

Converts a LEAD Technologies bitmap into a Windows device dependent bitmap (DDB). When this method is completed, there are two copies of the bitmap in memory: the DDB and the original LEAD bitmap. Freeing one will not affect the other.

Ordinarily, you would need a DDB only if you are using Windows API functions. Nevertheless, for simplicity, the examples in this documentation get and set a DDB without using the API.

See Also

Elements	GetDIB method, SetDIB method, SetDDB method

Topics	Raster Images: Exchanging Imgages with Other Objects


hDC Parameter For GetDDB
hDC

Handle to the device responsible for the conversion. The mapping mode of the device context must be MM_TEXT.


Return for GetDDB
Return Value

Return	Meaning

>0	Handle to the DDB.

0	An error occurred.


GetDIB method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE GetDIB (long nType);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

Converts a LEAD Technologies bitmap into a Windows device independent bitmap (DIB). When this method is completed, there are two copies of the bitmap in memory: the DIB and the original LEAD bitmap. Freeing one will not affect the other.

A DIB consists of one of the following:

 BITMAPFILEHEADER,

 BITMAPV4HEADER (Introduced in Windows 95 and Windows NT 4.0), or

 BITMAPV5HEADER (Introduced in Windows 2000 and Windows 98)

followed by a color table and then the bitmap data. The resulting DIB type is determined by the value of the uType flag.

Ordinarily, you would need a DIB only if you are using Windows API functions. Nevertheless, for simplicity, the examples in this documentation get and set a DIB without using the API.

See Also

Elements	SetDIB method, GetDDB method, SetDDB method

Topics	Raster Images: Exchanging Images with Other Objects


nType Parameter For GetDIB
nType

Type of DIB to create. Possible values are:

Value	Meaning

DIB_BITMAPINFOHEADER	[0] DIB that uses a BITMAPINFOHEADER

DIB_BITMAPV4HEADER	[1] DIB that uses a BITMAPV4HEADER. (Introduced in Windows 95 and Windows NT 4.0)

DIB_BITMAPV5HEADER	[2] DIB that uses a BITMAPV5HEADER (Introduced in Windows 2000 and Windows 98)


Return for GetDIB
Return Value

Return	Meaning

>0	Handle to the DIB.

0	An error occurred.


GetLoadResolution method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short GetLoadResolution (short iFormat);

Overview	Refer to Implementing PhotoCD and FlashPix Features.

Remarks

Gets the last values set by the SetLoadResolution method. These values determine the physical resolution of the PhotoCD, FlashPix, or JBIG file to be loaded.

This method sets the LoadResolutionCount property to 1 and updates the following properties with the current values:

 LoadResolutionHeight property

 LoadResolutionWidth property

See Also

Elements	ReadLoadResolutions method, LoadResolutionCount property, LoadResolutionHeight property, LoadResolutionWidth property, PCDRes property, SetLoadResolution method, SaveResolutionCount property, SaveResolutionHeight property, SaveResolutionWidth property

Topics	Raster Images: Loading Files


iFormat Parameter For GetLoadResolution
iFormat

Value	Meaning

FILE_PCD	Kodak PhotoCD

FILE_FPX	Kodak FlashPix

FILE_JBIG	JBIG

FILE_JP2	JPEG 2000.  This file format contains image data and extra information about the contents and organization of the file.

FILE_J2K	JPEG 2000.  This file format contains only a stream of image data.


Return for GetLoadResolution
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetFileInfo method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short GetFileInfo (BSTR pszName, long lPage, long uFlags);

Overview	Refer to Loading a Bitmap from a File.

Remarks

Gets information about the specified file.

This method updates the following properties:

InfoAnimation property
InfoAnimationHeight property
InfoAnimationWidth property
InfoBits property
InfoCompress property
InfoFormat property
InfoHasAlpha property
InfoHeight property
InfoPage property
InfoPCDRes property
InfoSizeDisk property
InfoSizeMem property
InfoTotalPages property
InfoWidth property
InfoXRes property
InfoYRes property

See Also

Elements	GetMemoryInfo method, FileOpen method

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information
Raster Images: Playing Animated Images


pszName Parameter For GetFileInfo
pszName

Character string containing the file name.


lPage Parameter For GetFileInfo
lPage

The page number of the image, if the file is in a multipage file.

GIF, TIFF (MPT), or PCX (DCX) files can be multipage files (containing more than one image). If you set the value to the page number of an image in the file, this method provides information about the specified image.

If you set the value of the page number to a number greater than the total number of pages in the file, this method updates the InfoPage property with the highest page number. Therefore, if you do not know how many pages are in a file, you can use this method to find out.

If the file is not a multipage file, pass 0.


uFlags Parameter For GetFileInfo
uFlags

Flag that indicates whether or not to update the InfoTotalPages property. Possible values are:

Value	Meaning

0	Do not update the InfoTotalPages property.

FILEINFO_TOTALPAGES	Update the InfoTotalPages property.


Return for GetFileInfo
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetFloaterHandle method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE GetFloaterHandle ();

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Stores a copy of the floater bitmap's region and returns a Windows region handle that you can use to retrieve or delete the stored region.

Keep in mind that the region data contains only positioning information relative to the floater bitmap, not the bitmap's pixel values.

To retrieve the stored region and add it to the bitmap, use the SetRgnHandle method. To delete the stored region, use the DeleteRgnHandle method.

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	GetRgnHandle method, DeleteRgnHandle method, FreeRgn method, SetRgnHandle method

Topics	Raster Images: Creating and Using a Region


Return for GetFloaterHandle
Return Value

A handle to the stored region.


GetFunctionalLookupTable method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short GetFunctionalLookupTable(long nStart, long nEnd, short nFactor, short uFlag);

Overview	Refer to Using Histograms.

Remarks

Updates a range of entries in the HistogramTable property array, based on the specified mathematical function.

The nFactor parameter is used for log and exp functions only.

If uFlag is FLT_EXP the value of nFactor modifies the lookup table values according to the following equations:

where :

nFirstValue = exp(nFactor * nStart/nEnd).

nLastValue = exp(nFactor)

x = the intensity value of the selected point

If uFlag is FLT_LN the value of nFactor modifies the lookup table values according to the following equations:

where:

nFirstValue = ln(1+ (nFactor * nStart/nEnd)).

nLastValue = ln(1 + nFactor)

x = the intensity value of the selected point

In the case of linear function, nFactor has no effect. The method performs a linear interpolation between the two points nStart and nEnd and stores the results in the lookup table. The user determines the two points nStart and nEnd and their new values, nFirstValue and nLastValue. The value nFirstValue should be stored in the lookup table at the nStart position and nLastValue at the nEnd position of the lookup table before calling this method.

As an example, suppose a user wants to select a point, change the intensity value of that point (x), and then perform two linear interpolations:

 from 0 to the intensity value x

 from intensity value x to the end of the range

To accomplish this, the user would proceed by doing the following:

 Select the point and get its intensity value (x)

 Change the intensity value of the selected point to some new value (newCol).

 Store the new intensity value in the Lookup table by assignment:

RemapTable(x) = newCol

 Call GetFunctionalLookupTable with nStart set to 0, nEnd set to x, and uFlag set to FLT_LINEAR.

 Call GetFunctionalLookupTable with nStart set to x, nEnd set to 255, and uFlag set to FLT_LINEAR. (For the example, assume the image is 8-bits per pixel.)

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	GetUserLookUpTable method, RemapIntensity method, RemapTable property, RemapTableSize property

Topic	Changing Brightness and Contrast


nStart Parameter For GetFunctionalLookupTable
nStart

Index of the first entry in the lookup table to update. The indices of the table correspond to the intensity values.


nEnd Parameter For GetFunctionalLookupTable
nEnd

Index of the last entry in the lookup table to update. The indices of the table correspond to the intensity values.


nFactor Parameter For GetFunctionalLookupTable
nFactor

Value that indicates the factor to be applied in the function operation specified in the uFlag parameter. This parameter is used only if uFlag is FLT_EXP or FLT_LN.


uFlag Parameter For GetFunctionalLookupTable
uFlag

Flag that indicates the function used to update the lookup table. Possible values are:

Value	Meaning

FLT_EXP	[0] Apply the exponential function.

FLT_LN	[1] Apply the natural logarithm function.

FLT_LINEAR	[2] Apply the linear function.


Return for GetFunctionalLookupTable
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetHistogram method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short GetHistogram (short iChannel);

Overview	Refer to Using Histograms.

Remarks

Updates the array that charts how many times each intensity level occurs in the bitmap. This method can chart red, green, and blue separately or together.

You can access the array values using the HistogramTable property. Intensity levels range from 0 to the value of HistogramTableSize property – 1. The resulting array items are indexed by intensity value. The value of each item is the number of occurrences of the intensity level.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	HistogramTable property, HistogramTableSize property, GetHistogramGray method

Topics	Raster Images: Using Histograms
Raster Images: Where the Region Preempts the Bitmap
Changing Brightness and Contrast


iChannel Parameter For GetHistogram
iChannel

The channel for which to get the histogram.

Possible values are:

Value	Meaning

CHANNEL_MASTER	All channels.

CHANNEL_RED	Red channel only.

CHANNEL_GREEN	Green channel only.

CHANNEL_BLUE	Blue channel only.


Return for GetHistogram
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetHistogramGray method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short GetHistogramGray ();

Overview	Refer to Using Histograms.

Remarks

(Medical only) This method works only on 12-bit and 16-bit grayscale images. For all other images, use the GetHistogram method.

Intensity levels in a grayscale bitmap can range from 0 to( 216 – 1), depending on whether the image is 12-bit or 16-bit grayscale, and the LowBit and HighBit of the image. The LowBit and HighBit identify which bits in a 12-bit or 16-bit entry are used. The LowBit and HighBit can be obtained by calling the GetMinMaxBits method and then looking at the MinBit and MaxBit properties.

Specifically, a histogram table for a 12-bit or 16-bit grayscale image will have 2(HighBit – LowBit + 1) entries.

After calling GetHistogramGray(), the HistogramGrayTable property is automatically sized and filled in with grayscale intensities.

For example, suppose you have a 16-bit grayscale image with LowBit = 2 and HighBit = 7. There are 2(7-2+1) = 64 possible grayscale intensities. The histogram table will therefore hold 64 entries.  The number of entries in the HistogramGrayTable property can be found by examining the HistogramGrayTableSize property. The HistogramGrayTableSize property and the HistogramGrayTable property both can change after each call to the GetHistogramGray method. The number of grayscale values with bits 2 – 7 set to 0 can be found in HistogramGrayTable(0). The number of grayscale values with bit 2 set to 1 and bits 3 – 7 set to 0 can be found in HistogramGrayTable(1), and so on up to HistogramGrayTable(63). Since the low bit is 2 and the high bit is 7, bits 0, 1, and bits 8 – 15 must all be 0. Therefore, the values set in bits 2 – 7 determine the intensities present in the image. In the table below, the gray columns represent those bits that are always 0 for the image. The columns bit 7 through bit 2 represent possible settings for those bits. The last column gives the location within the HistogramGrayTable property of the number of grayscale values having the corresponding settings. For example, HistogramGrayTable(0) contains the number of grayscale values of intensity 0 (all bits set to 0). HistogramGrayTable(1) contains all the grayscale values with intensity 4 (the 2 bit position set to 1). HistogramGrayTable(2) contains all the grayscale values with intensity 8 (the 3 bit set to 1 and the remaining bits set to 0) and so on.

bit 8 – 15	bit 7	bit 6	bit 5	bit 4	bit 3	bit 2	bit 1	bit 0	count location in HistogramGrayTable
All 0s	0	0	0	0	0	0	0	0	HistogramGrayTable(0)
All 0s	0	0	0	0	0	1	0	0	HistogramGrayTable(1)
All 0s	0	0	0	0	1	0	0	0	HistogramGrayTable(2)
All 0s	0	0	0	0	1	1	0	0	HistogramGrayTable(3)
All 0s	0	0	0	1	0	0	0	0	HistogramGrayTable(4)
…							…	…	and so on
All 0s	1	1	1	1	1	1	0	0	HistogramGrayTable(63)
As another example, suppose you have a 16-bit grayscale image with LowBit = 0 and HighBit = 15.  The number of entries in the table will be 216 = 65,536.

See Also

Elements	HistogramGrayTable property, HistogramGrayTableSize property, GetHistogram method, HistogramTable property

Topics	Raster Images: Using Histograms
Raster Images: Where the Region Preempts the Bitmap
Changing Brightness and Contrast


Return for GetHistogramGray
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetMemoryInfo method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short GetMemoryInfo (OLE_HANDLE hMem, long lPage, long iSize);

Overview	Refer to Using Memory-Resident Image Files.

Remarks

Gets information about a file that is stored in memory.

This method updates the following properties:

InfoBits property
InfoCompress property
InfoFormat property
InfoHeight property
InfoPage property
InfoSizeDisk property
InfoSizeMem property
InfoWidth property

To save an image to a file in memory, refer to the SaveMemory method. To load an image from a file in memory, refer to the LoadMemory method.

Note: You cannot save a multipage file using the SaveMemory method, but if you get a multipage file into memory in some other way, you can specify a page when using the GetMemoryInfo method or the LoadMemory method.

See Also

Elements	GetFileInfo method

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


hMem Parameter For GetMemoryInfo
hMem

A global handle (HGLOBAL) to the file in memory. If you use the SaveMemory method to create the file in memory, that method updates your handle and buffer size variables. Otherwise, your code must update and pass the appropriate variables.


lPage Parameter For GetMemoryInfo
lPage

The page number of the image, if the image is in a multipage file.

GIF, TIFF (MPT), and PCX (DCX) files can be multipage files (containing more than one image). If you set the value to the page number of an image in the file, this method provides information about the specified image.

If you set the value of the page number to a number greater than the total number of pages in the file, this method updates the InfoPage property with the highest page number. Therefore, if you do not know how many pages are in a file, you can use this method to find out.

If the file is not a multipage file, pass 0.


iSize Parameter For GetMemoryInfo
iSize

The size in bytes of the file referenced by hMem. If you use the SaveMemory method to create the file in memory, that method updates your handle and buffer size variables. Otherwise, your code must update and pass the appropriate variables.


Return for GetMemoryInfo
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetMinMaxBits method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short GetMinMaxBits()

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Medical Toolkits only) Gets the minimum and maximum bits of the pixels in a bitmap.  These values are not affected by LevelLowBit property or LevelHighBit property.

There are two properties associated with this method.  The MinBit property and MaxBit property are updated with the minimum and maximum values retrieved by this method.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	MinBit property, MaxBit property, WindowLevel method, GetMinMaxVal method

Topics	Raster Images: Palettes


Return for MinMaxBits
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetMinMaxVal method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short GetMinMaxVal()

Overview	Refer to Examining and Altering Bitmaps.

Remarks

(Medical Toolkits only) Gets the minimum and maximum intensity values of the pixels in a bitmap.  These values are not affected by LevelLowBit property or LevelHighBit property.

There are two properties associated with this method.  The MinVal property and MaxVal property are updated with the minimum and maximum values retrieved by this method.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	MinVal property, MaxVal property, WindowLevel method, GetMinMaxBits method

Topics	Raster Images: Palettes


Return for GetMinMaxVal
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetPagesCount method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short GetPagesCount (BSTR pszFileName, long * pnPages);

Overview	Refer to Working with MRC Bitmap.

Remarks

Gets the number of pages in an MRC file.

See Also

Elements	Save method, SaveT44 method, Load method

Topics	MRC Bitmap Functions: Loading a Page


pszFileName Parameter For GetPagesCount (Mixed Raster Content Control)
pszFileName

Character string containing the name of the MRC file.


pnPages Parameter For GetPagesCount (Mixed Raster Content Control)
pnPages

Address of the long integer variable to be updated with number of pages from the MRC file.

In C++, you declare the variable and pass its address. In most other languages, you pass the variable by reference. The method updates the value of the variable. The variable must be declared with the appropriate data type.


Return for GetPagesCount
Return Value

Value	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetPalette method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE GetPalette (OLE_HANDLE hDC);

Overview	Refer to Managing Palettes

Remarks

Returns the handle to the palette used by the specified device context.

Use this method with the SetDDB method to specify the DDB's palette.

See Also

Topics	Raster Images: Palettes


hDC Parameter For GetPalette
hDC

The device context that has the palette that you want to get.


Return for GetPalette
Return Value

Handle to the palette used by the specified device context.


GetPicture method (Main Control)

Visual Basic example   Other systems   Visual J++ example

Syntax	IPictureDisp* GetPicture ();

Overview	Refer to Copying and Creating Bitmaps.

Remarks

(Visual Basic only) Returns a Picture object that is a copy of the bitmap.

See Also

Elements	SetPicture method

Topics	Raster Images: Exchanging Imgages with Other Objects


Return for GetPicture
Return Value

Handle to the picture object.


GetRgnArea method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long GetRgnArea ();

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Returns the number of pixels in the bitmap region.

See Also

Elements	HasRgn property, IsPtInRgn method, RgnHeight property, RgnLeft property, RgnTop property, RgnWidth property

Topics	Raster Images: Creating and Using a Region


Return for GetRgnArea
Return Value

The number of pixels in the bitmap region.


GetRgnHandle method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE GetRgnHandle ();

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Stores a copy of the bitmap's region and returns a Windows region handle that you can use to retrieve or delete the stored region.

Keep in mind that the region data contains only positioning information relative to the LEAD bitmap in memory, not the bitmap's pixel values.

To retrieve the stored region and add it to the bitmap, use the SetRgnHandle method. To delete the stored region, use the DeleteRgnHandle method.

See Also

Elements	GetFloaterHandle method, DeleteRgnHandle method, FreeRgn method, SetRgnHandle method

Topics	Raster Images: Creating and Using a Region


Return for GetRgnHandle
Return Value

A handle to the stored region.


GetServerBitmap method (Main Control)

Visual Basic example   Access 95, 97 example   Other systems

Syntax	short GetServerBitmap (long pServer);

Overview	Refer to Copying and Creating Bitmaps.

Remarks

Copies the specified LEAD OLE Server control's bitmap to the LEAD ActiveX control.

You can use this method with the SetServerBitmap method to take advantage of the different capabilities of the ActiveX and the OLE server. For more information on the OLE server, refer to LEAD OLE Server (test release).

See Also

Elements	SetServerBitmap method

Topics	Raster Images: Exchanging Imgages with Other Objects


pServer Parameter For GetServerBitmap
pServer

LEAD OLE Server object.


Return for GetServerBitmap
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GetSubMenu method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	IAnnMenu GetSubMenu (short iIndex);

Overview	Refer to Annotation Menu

Remarks

Gets the object that references the specified submenu.

This method will only work for menu items of type ANNMENUITEMTYPE_SUBMENU.

This method is associated with the AnnMenu object that is passed to the AnnMenu event.

See Also

Elements	AnnMenu event, Count property, ItemString property, ItemType property, ItemID property, ItemEnabled property, ItemChecked property, DeleteItem method, AddItem Method

Topics	Annotations (Document/Medical only): Automation


iIndex Parameter For GetSubMenu
iIndex

Index of the item before which the new item should be inserted.


Return for GetSubMenu
Return Value

Return	Meaning

NULL	An error occurred.

! NULL	Pointer to an AnnMenu object that references the specified submenu.


GetTagCount method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	long GetTagCount (long lTag);

Overview	Refer to Implementing TIFF Tags

Remarks

Returns the number of data values associated with the specified tag.

For more information on setting tags, refer to the SetTag method.

See Also

Functions:	GetTagType method, GetTagData method, ReadTag method, SetTag method, WriteTag method, Save method, Comment property

Topics	Raster Images: Getting and Setting File Information


lTag Parameter For GetTagCount
lTag

Tag in the TIFF file from which to get the data count. Use 0 to get the data count from the tag read using the ReadTag method. Otherwise, use the tag value that was set using the SetTag method. For more information on tags available in the TIFF format, refer to the SetTag method.


Return for GetTagCount
Return Value

The the number of data values associated with the specified tag.


GetTagData method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	VARIANT GetTagData (long lTag);

Overview	Refer to Implementing TIFF Tags

Remarks

Returns the data associated with the specified tag.

The number of values in the array can be retrieved using GetTagCount method. The type of values can be retrieved using GetTagType method. Note that if the type is TAG_RATIONAL, then each element is represented with two LONG values: the numerator and denominator. So for a Rational tag, you have twice as many entries in the array: the even index elements in the array contain the numerators and the odd indexes contain the denominators.

For more information on setting tags, refer to the SetTag method.

See Also

Functions:	GetTagCount method, GetTagType method, ReadTag method, SetTag method, WriteTag method, Comment property, Save method

Topics	Raster Images: Getting and Setting File Information


lTag Parameter For GetTagData
lTag

Tag to identify the data in the TIFF file. Use 0 to get the data from the tag read using the ReadTag method. Otherwise, use the tag value that was set using the SetTag method. For more information on tags available in the TIFF format, refer to the SetTag method.


Return for GetTagData
Return Value

The variant that contains the tag data. The variant can be a single value or an array of values.


GetTagType method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short GetTagType (long lTag);

Overview	Refer to Implementing TIFF Tags

Remarks

Returns the data type of the specified tag.

If the tag type is rational, then each element is represented by two longs. Otherwise, the size of each element is indicated by its type. (An element of type TAG_LONG is type long. An element of type TAG_SHORT is type short. etc.)

For more information on setting tags, refer to the SetTag method.

See Also

Functions:	GetTagCount method, GetTagData method, ReadTag method, SetTag method, WriteTag method, Comment property, Save method

Topics	Raster Images: Getting and Setting File Information


lTag Parameter For GetTagType
lTag

Tag to identify the data in the TIFF file from which to get the data type. Use 0 to get the data type from the tag read using the ReadTag method. Otherwise, use the tag value that was set using the SetTag method. For more information on tags available in the TIFF format, refer to the SetTag method.


Return for GetTagType
Return Value

The data type of the specified tag. Possible values are:

Value	Meaning

TAG_BYTE	[1] Byte.

TAG_ASCII	[2] Byte in the range of 0 to 255.

TAG_SHORT	[3] Two bytes, unsigned.

TAG_LONG	[4] Four bytes, unsigned.

TAG_RATIONAL	[5] Eight bytes, used as a pair of unsigned long integers, where the first number is the numerator and the second is the denominator of a fraction.

TAG_SBYTE	[6] Byte used as signed number in the range of -128 to +127.

TAG_UNDEFINED	[7] Byte, with application-defined usage.

TAG_SSHORT	[8] Two bytes, signed.

TAG_SLONG	[9] Four bytes, signed.

TAG_SRATIONAL	[10] Eight bytes, used as a pair of signed long integers, where the first number is the numerator and the second is the denominator of a fraction.

TAG_FLOAT	[11] Four bytes used as a floating point number.

TAG_DOUBLE	[12] Eight bytes used as a double-precision floating point number.


GetUserLookupTable method (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	short GetUserLookupTable(long * nPointCount);

Overview	Refer to Using Histograms.

Remarks

Updates the HistogramTable property array, based on a curve that passes through points defined by the UserLUTCurveX and UserLUTCurveY properties.

This method will update the lookup table array using the best curve that passes through the points specified in the Lookup Table Curve.

Before using this method, you must allocate a Lookup Table Curve Array using the UserLUTCurveSize property, and then fill the coordinates of its points with the UserLUTCurveX and UserLUTCurveY properties.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	RemapIntensity method, RemapTable property, RemapTableSize property, UserLUTCurveX property, UserLUTCurveY property, UserLUTCurveSize property

Topic	Changing Brightness and Contrast


nPointCount Parameter for GetUserLookupTable
nPointCount

Address of the long variable to be updated with the number of entries in the lookup table that were actually modified. In C++, you declare the variable and pass its address. In most other languages, you pass the variable by reference.


Return for GetUserLookupTable
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GradientEndColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR GradientEndColor

Overview	Refer to Gradients and Patterns.

Remarks

(Persistent property, available at design time) Works with related properties to specify a gradient color for use when you implement a transitional paint effect or when you draw a three-dimensional shape or text object.

A gradient color starts as one color and ends as another, with the specified number of transitional colors from start to end. Related properties work together as follows:

 GradientStyle specifies the style.

 GradientStartColor specifies the starting color.

 GradientEndColor specifies the ending color.

 GradientSteps specifies the number of colors from start to end.

See Also

Topics	Raster Images: Implementing Special Effects
Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


GradientStartColor property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_COLOR GradientStartColor

Overview	Refer to Gradients and Patterns.

Remarks

(Persistent property, available at design time) Works with related properties to specify a gradient color for use when you implement a transitional paint effect or when you draw a three-dimensional shape or text object.

A gradient color starts as one color and ends as another, with the specified number of transitional colors from start to end. Related properties work together as follows:

 GradientStyle specifies the style.

 GradientStartColor specifies the starting color.

 GradientEndColor specifies the ending color.

 GradientSteps specifies the number of colors from start to end.

See Also

Topics	Raster Images: Implementing Special Effects
Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


GradientSteps property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short GradientSteps

Overview	Refer to Gradients and Patterns.

Remarks

(Persistent property, available at design time) Works with related properties to specify a gradient color for use when you implement a transitional paint effect or when you draw a three-dimensional shape or text object.

A gradient color starts as one color and ends as another, with the specified number of transitional colors from start to end. Related properties work together as follows:

 GradientStyle specifies the style.

 GradientStartColor specifies the starting color.

 GradientEndColor specifies the ending color.

 GradientSteps specifies the number of colors from start to end.

See Also

Topics	Raster Images: Implementing Special Effects
Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


GradientStyle property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short GradientStyle

Overview	Refer to Gradients and Patterns.

Remarks

(Persistent property, available at design time) Specifies the style of a gradient color for use when you implement a transitional paint effect or when you draw a three-dimensional shape or text object.

A gradient color starts as one color and ends as another, with the specified number of transitional colors from start to end. Related properties work together as follows:

 GradientStyle specifies the style.

 GradientStartColor specifies the starting color.

 GradientEndColor specifies the ending color.

 GradientSteps specifies the number of colors from start to end.

For possible values of the GradientStyle property, refer to Gradients.

See Also

Topics	Raster Images: Implementing Special Effects
Raster Images: Drawing on a Bitmap
Working with the Control: Client Area Usage


Grayscale method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Grayscale (short iBitsPerPixel);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Converts a 1-, 4-, 8-, 16-, 24-, or 32-bit bitmap to an 8, 12, or 16-bit grayscale bitmap.  Support for !2 and 16-bit grayscale images is only available in the Document/Medical Toolkits .

See Also

Topics	Raster Images: Doing Color Expansion or Reduction


iBitsPerPixel Parameter for Grayscale
iBitsPerPixel

Bits per pixel of the resultant bitmap.


Return for Grayscale
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


GrayscaleExt method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short GrayscaleExt(short iRedFact, short iGreenFact, short iBlueFact);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Converts any Bitmap to a grayscale bitmap without changing its resolution.

iRedFact + iGreenFact + iBlueFact must equal 1000. (Internally the values are divided by 1000).

For each pixel in the bitmap the red, green and blue values are modified by the iRedFact, iGreenFact and iBlueFact parameters, respectively. This allows the user to give more weight to one color, essentially enhancing that color, before the pixel is converted to grayscale.

For example, if this method is called with iRedFact set to 500, iGreenFact set to 250 and iBlueFact set to 250, the red value of each pixel will get 50% of the weight when determining the grayscale value. The green value will get 25% of the weight and the blue value will get 25% of the weight when determining the grayscale value. This highlights or enhances the red in the bitmap, prior to conversion to grayscale.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	GrayScale method, IsGrayscale property, ConvertToColoredGray method, BalanceColors method, SwapColors method

Topics	Raster Images: Doing Color Expansion or Reduction


iRedFact Parameter For GrayscaleExt
iRedFact

Value that represents the percentage or weight given to the red value of each pixel in the bitmap. Possible values are 0 to 1000.


iGreenFact Parameter For GrayscaleExt
iGreenFact

Value that represents the percentage or weight given to the green value of each pixel in the bitmap. Possible values are 0 to 1000.


iBlueFact Parameter For GrayscaleExt
iBlueFact

Value that represents the percentage or weight given to the blue value of each pixel in the bitmap. Possible values are 0 to 1000.


Return for GrayscaleExt
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Halftone method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Halftone (short iType, long iAngle, long iDim);

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Converts a bitmap with any resolution to a halftoned bitmap, with a specified pattern rotation. A halftoned bitmap is a 1-bit bitmap that has been dithered for black and white printing or display.

This method can process the whole image or a region of the image.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

If the bitmap is originally 1-bit but is not black and white, this method changes it to black and white.

See Also

Topics	Raster Images: Doing Color Expansion or Reduction


iType Parameter For Halftone
iType

Type of halftoning to do. Possible values are:

Value	Meaning

HALFTONE_PRINT	Halftone for printing

HALFTONE_VIEW	Halftone for display

HALFTONE_RECT	Rectangular halftone

HALFTONE_CIRC	Circular halftone

HALFTONE_ELLIPS	Elliptical halftone

HALFTONE_RAND	Random halftone

HALFTONE_LINEAR	Linear halftone


iAngle Parameter For Halftone
iAngle

The angle of rotation, expressed in hundredths of degrees. A value of 0 produces a horizontal halftone pattern. This parameter specifies the number of degrees to change the pattern. Positive values rotate the pattern clockwise; negative values rotate the pattern counterclockwise.

This value is ignored if the selected halftone pattern is HALFTONE_RECT, HALFTONE_CIRC or HALFTONE_RAND.


iDim Parameter For Halftone
iDim

Value that indicates the size of the grain. This value is ignored if the selected halftone pattern is HALFTONE_VIEW or HALFTONE_PRINT. If the pattern is not HALFTONE_VIEW or HALFTONE_PRINT, iDim should be >= 1. If this parameter is < 1 this method will return ERROR_INV_PARAMETER (20013).


Return for Halftone
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


HasMagGlass property (Main Control)

Visual Basic Example   Visual C++ 4.0 Example

Syntax	BOOL HasMagGlass;

Overview	Refer to Using the Magnifying Glass

Remarks

(Read only) Determines whether the control has a magnifying glass attached to it. Possible values are:

Value	Meaning

TRUE	The control has a magnifying glass attached to it.

FALSE	The control does not have a magnifying glass attached to it.

See Also

Functions:	StartMagGlass method, StopMagGlass method, UpdateMagGlassShape method

Topics	Raster Images: Displaying Images


HasRgn property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL HasRgn

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Determines whether a region is defined in the LEAD bitmap.

When a bitmap has a region, some methods act on the region, rather than the whole bitmap. For a list of affected methods, refer to Raster Images: Where the Region Preempts the Bitmap.

Value	Meaning

TRUE	The bitmap has a region.

FALSE	The bitmap does not have a region.

See Also

Elements	IsPtInRgn method, GetRgnArea method, RgnHeight property, RgnLeft property, RgnTop property, RgnWidth property

Topics	Raster Images: Creating and Using a Region


HistoContrast method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short HistoContrast (short iChange);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Increases or decreases the contrast of the image in a bitmap, using a histogram to determine the median brightness.

This method finds the median brightness of the image; then brightens the pixels with values above the median and darkens the pixels with values below the median. This is more sophisticated (but slower) than the Contrast method, which uses the middle possible value (128) rather than finding the actual median.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Intensity method, GammaCorrect method, Contrast method, HistoEqualize method, StretchIntensity method, GetChange method

Topics	Raster Images: Modifying Intensity Values
Raster Images: Using Histograms
Raster Images: Where the Region Preempts the Bitmap


iChange Parameter For HistoContrast
iChange

Amount of contrast change. Valid values are -1000 to +1000.


Return for HistoContrast
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


HistoEqualize method (Main Control)

Visual Basic example   Visual C++ 5.0 example

Syntax	short HistoEqualize (short iFlags);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Linearizes the number of pixels in the bitmap, based on the specified color space. This can be used to bring out the detail in dark areas of an image.  Previously, this method only equalized the number of pixels per gray level, using a gray level representation of the image. This method is now obtained by passing GRAY_SPACE for iFlags.

For the best results, set iFlags to YUV_SPACE.

This method can process the whole image or a region of the image.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Intensity method, GammaCorrect method, Contrast method, HistoContrast method, StretchIntensity method

Topics	Raster Images: Modifying Intensity Values
Raster Images: Using Histograms
Raster Images: Where the Region Preempts the Bitmap


iFlags Parameter For HistoEqualize
iFlags

Flag that indicates which color space to equalize. Possible values are:

Value	Meaning

RGB_SPACE	[0x0001] Linearizes the number of pixels across the RGB color space.(separated channels)

YUV_SPACE	[0x0002] Linearizes the number of pixels across the YUV color space.(Best results)

GRAY_SPACE	[0x0004] Linearizes the number of pixels per gray level in a gray level representation of the image.


Return for HistoEqualize
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


HistogramGrayTable property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long HistogramGrayTable (long nIndex);

Overview	Refer to Using Histograms.

Remarks

(Medical only) Is a table that charts the number of occurrences of each intensity level in a 12-bit or 16-bit grayscale bitmap.

Intensity levels in a grayscale bitmap can range from 0 to ( 216 – 1), depending on whether the image is 12-bit or 16-bit grayscale, and the LowBit and HighBit of the image. The LowBit and HighBit identify which bits in a 12-bit or 16-bit entry are used. The LowBit and HighBit can be obtained by calling the GetMinMaxBits method and then looking at the MinBit and MaxBit properties.

Specifically, a histogram table for a 12-bit or 16-bit grayscale image will have 2(HighBit – LowBit + 1) entries.

Each intensity value present in the image corresponds to a specific table index. The number of entries in the HistogramGrayTable can be found by examining the HistogramGrayTableSize property.  The HistogramGrayTableSize property and the HistogramGrayTable property both can change after each call to the GetHistogramGray method. For more information on the relationship between the intensity value and the location of the count within the HistogramGrayTable, refer to the GetHistogramGray method.

See Also

Elements	GetHistogramGray method, HistogramGrayTableSize property, GetHistogram method, HistogramTable property

Topics	Raster Images: Using Histograms
Changing Brightness and Contrast


iIndex Parameter For HistogramGrayTable
nIndex

Index into the array of long values.


HistogramGrayTableSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long HistogramGrayTableSize ();

Overview	Refer to Using Histograms.

Remarks

(Read Only) (Medical only) Is the number of entries in the HistogramGrayTable. This property (along with the HistogramGrayTable) is filled after each call to the GetHistogramGray method.

Intensity levels in a grayscale bitmap can range from 0 to( 216 – 1), depending on whether the image is 12-bit or 16-bit grayscale, and the LowBit and HighBit of the image. The LowBit and HighBit identify which bits in a 12-bit or 16-bit entry are used. The LowBit and HighBit can be obtained by calling the GetMinMaxBits method and then looking at the MinBit and MaxBit properties.

Specifically, a histogram table for a 12-bit or 16-bit grayscale image will have  2(HighBit – LowBit + 1) entries.

Each intensity value present in the image corresponds to a specific table index. The number of entries in the HistogramGrayTable can be found by examining the HistogramGrayTableSize property.  The HistogramGrayTableSize property and the HistogramGrayTable property both can change after each call to the GetHistogramGray method. For more information on the relationship between the intensity value and the location of the count within the HistogramGrayTable, refer to the GetHistogramGray method.

See Also

Elements	GetHistogramGray method, HistogramGrayTableSize property, GetHistogram method, HistogramTable property

Topics	Raster Images: Using Histograms
Changing Brightness and Contrast


HistogramTable property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long HistogramTable (long iIndex);

Overview	Refer to Using Histograms.

Remarks

Is a table that charts the number of occurrences of each intensity level in the bitmap.

Intensity levels range from:

0 to 255	for bitmaps other than 12 or 16-bit grayscale.

0 to 4095	for 12-bit bitmaps.

0 to 65535	for 16-bit bitmaps.

The current intensity values correspond to the table indexes. You can load the table with values for red, green, blue, or all color channels. Use the GetHistogram method to update the table.

See Also

Elements	HistogramTableSize property, GetHistogram method, HistogramGrayTable property

Topics	Raster Images: Using Histograms
Changing Brightness and Contrast


iIndex Parameter For HistogramTable
iIndex

The index into the histogram table. The index corresponds to the intensity level. For example, use an index of 0 to get the number of occurrences of 0 intensity values.


HistogramTableSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long HistogramTableSize;

Overview	Refer to Using Histograms.

Remarks

Specifies the number of entries in the HistogramTable property.

This value that must be set for this property depends on the color resolution (bits per pixel) of the image, as follows:

Table Size	BPP

65536	64 or 48

256	Any other color (non-grayscale) value, or grayscale 8

For 12 and 16 bit grayscale images, use the HistogramGrayTableSize property

See Also

Elements	HistogramTable property, GetHistogram method, HistogramGrayTableSize property

Topics	Raster Images: Using Histograms
Changing Brightness and Contrast


HitTest method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long HitTest (float x, float y);

Overview	Refer to Using the ImageList Control.

Remarks

Queries the specified location to determine if the point is over an ImageList Control item.

See Also

Elements	Item property, AllowSelection property, ItemSelected event, Click event, MouseMove event, MouseDown event, MouseUp event.

Topics	Raster Images: Displaying Images


x Parameter For HitTest
x

Horizontal position of the location in question.


y Parameter For HitTest
y

Vertical position of the location in question.


Return for HitTest
Return Value

Return	Meaning

>=0	The 0-based index of the item at the specified location

-1	No item at the specified location.


HolePunchRemove event (Main Control)
HolePunchRemoveEvent event (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	void HolePunchRemoveEvent (OLE_HANDLE hRgn, float fBoundingRectLeft, float fBoundingRectTop, float fBoundingRectWidth, float fBoundingRectHeight, long iHoleIndex, long iHoleTotalCount, long iWhiteCount, long iBlackCount);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical)  This event is triggered once for each occurring hole in the hole-punch configuration. For example, if there are three holes, the event gets triggered three times. Set the DocCleanSuccess property to SUCCESS_REMOVE to have a particular hole removed. Set the DocCleanSuccess property to SUCCESS_NOREMOVE to leave the hole unchanged. Set the DocCleanSuccess property to 0 to abort. If the uFlags parameter of the HolePunchRemove method is set to HOLEPUNCH_IMAGE_UNCHANGED and HOLEPUNCH_SINGLE_REGION, then the value of the DocCleanSuccess property affects only the internal single region that contains all the changes.

Note: hRgn is only valid during this event. To use the hRgn after the event has terminated, make a copy of it using the SetBitmapRgnHandle method.

See Also

Elements	HolePunchRemove method

Topics	Raster Images: Cleaning - up 1-Bit Images


hRgn Parameter For HolePunchRemove
hRgn

Windows region representing one of the holes of the hole punch pattern.


fBoundingRectLeft Parameter For HolePunchRemove
fBoundingRectLeft

X coordinate of the origin of the bounding rectangle of the hole punch being processed.


fBoundingRectTop Parameter For HolePunchRemove
fBoundingRectTop

Y coordinate of the origin of the bounding rectangle of the hole punch being processed.


fBoundingRectWidth Parameter For HolePunchRemove
fBoundingRectWidth

Width of the bounding rectangle of the hole punch being processed.


fBoundingRectHeight Parameter For HolePunchRemove
fBoundingRectHeight

Height of the bounding rectangle of the hole punch being processed.


iHoleIndex Parameter For HolePunchRemove
iHoleIndex

Index of the hole within a hole punch pattern. The holes are numbered from 1 to n, where n is the total number of holes in the hole punch pattern.


iHoleTotalCount Parameter For HolePunchRemove
iHoleTotalCount

The total number of holes that make up the hole punch pattern. This value will not change for a particular call to the HolePunchRemove method.


iWhiteCount Parameter For HolePunchRemove
iWhiteCount

Total number of white pixels in one of the holes of a hole punch pattern.


iBlackCount Parameter For HolePunchRemove
iBlackCount

Total number of black pixels in one of the holes of a hole punch pattern.


HolePunchRemove method (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	short HolePunchRemove (long uFlags, long iMinHoleCount, long iMaxHoleCount, long iMinHoleWidth, long iMinHoleHeight, long iMaxHoleWidth, long iMaxHoleHeight, long iLocation);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) This method detects and removes hole punches, common in scanned documents.

This method works only on 1-bit black and white images.

Hole punch configurations may consist of 2 or more holes.

If a region is selected, only the selected region will be changed by this method.  If no region is selected, the whole image will be processed.

The behavior of this method can be modified using the HolePunchRemoveEvent event.

This method triggers both the HolePunchRemoveEvent event and the ProgressStatus event.

See Also

Elements	HolePunchRemoveEvent event

Topics	Raster Images: Cleaning - up 1-Bit Images


uFlags Parameter For HolePunchRemove
uFlags

Flags that determine the behavior of the border removal process. Flags may be combined using a bitwise OR (|). Possible values are:

Value	Meaning

HOLEPUNCH_SINGLE_REGION:	For each hole punch found by the HolePunchRemove method, if the DocCleanSuccess property is set to SUCCESS_REMOVE in the HolePunchRemoveEvent event, the removed hole punch is added to an internal single region. If the DocCleanSuccess property is set to SUCCESS_NOREMOVE, the hole punch is not added to the single region. When the HolePunchRemove method returns, either  the DocCleanBitmap property or the hDocCleanRgn property will reference a region that contains all the removed hole punches. If HOLEPUNCH_LEAD_REGION is also set, the DocCleanBitmap property will be set to a bitmap that has a LEAD region that contains all the removed hole punches. If HOLEPUNCH_LEAD_REGION is not set, hDocCleanRgn is set to a Windows region that contains all the removed hole punches. When the region (either LEAD or Windows) is no longer needed, it must be destroyed.

HOLEPUNCH_LEAD_REGION	When the HolePunchRemove method returns, the DocCleanBitmap property is updated with a copy of the bitmap that also contains a region with all the removed hole punches. This flag must be used in conjunction with HOLEPUNCH_SINGLE_REGION. To use this flag set uFlags to HOLEPUNCH_SINGLE_REGION | HOLEPUNCH_LEAD_REGION. The DocCleanBitmap property will be updated when the HolePunchRemove method returns.

HOLEPUNCH_IMAGE_UNCHANGED	The original image is unchanged.

HOLEPUNCH_USE_DPI	The unit of measure for all parameters of this method is thousandths of an inch. Use the image's DPI to convert to pixels. This allows the processing of many images with different DPI. If this flag is not set, the unit of measure for all fields of the HOLEPUNCH structure is pixels.

HOLEPUNCH_CALLBACK_REGION	The HolePunchRemoveEvent event receives a Windows region that contains the current hole punch to be removed. Setting this flag lets the user create his or her own composite of removed hole punches by combining the regions received by the event, if the DocCleanSuccess property was set to SUCCESS_REMOVE in the event. The regions can be combined using a logical OR operator. Combining all regions received by the event, that are removed, results in a region identical to the region created when HOLEPUNCH_SINGLE_REGION is set in uFlags.

HOLEPUNCH_USE_SIZE	Use the iMinHoleWidth, iMinHoleHeight, iMaxHoleWidth, iMaxHoleHeight parameters of this method to indicate the size of the hole punches to remove. If this flag is not set, default values for the four sizes will be used. If HOLEPUNCH_USE_DPI is set, the defaults are calculated from the image DPI.  Otherwise, the defaults are calculated from the image width and height.

HOLEPUNCH_USE_COUNT	Use the iMinHoleCount and iMaxHoleCount parameters of this method to indicate the number of hole punches to remove. If this flag is not set, default values for the two count values will be used. These default values are as follows: iMinHoleCount = 3 and iMaxHoleCount = 3.

HOLEPUNCH_USE_LOCATION	Use the iLocation parameter of this method to indicate the location of the hole punches to remove. If this flag is not set, a default of HOLEPUNCH_LEFT will be used.


iMinHoleCount Parameter For HolePunchRemove
iMinHoleCount

Minimum number of holes to detect. This member is valid only if HOLEPUNCH_USE_COUNT is set in uFlags.  If used, this must be greater than or equal to 2.


iMaxHoleCount Parameter For HolePunchRemove
iMaxHoleCount

Maximum number of holes to detect. This member is valid only if HOLEPUNCH_USE_COUNT is set in uFlags.


iMinHoleWidth Parameter For HolePunchRemove
iMinHoleWidth

The minimum width of one of the holes of the hole punch configuration to be removed. If HOLEPUNCH_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels. This parameter is valid only if HOLEPUNCH_USE_SIZE is set in uFlags.


iMinHoleHeight Parameter For HolePunchRemove
iMinHoleHeight

The minimum height of one of the holes of the hole punch configuration to be removed.. If HOLEPUNCH_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels. This parameter is valid only if HOLEPUNCH_USE_SIZE is set in uFlags.


iMaxHoleWidth Parameter For HolePunchRemove
iMaxHoleWidth

The maximum width of one of the holes of the hole punch configuration to be removed. If HOLEPUNCH_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels. This parameter is valid only if HOLEPUNCH_USE_SIZE is set in uFlags.


iMaxHoleHeight Parameter For HolePunchRemove
iMaxHoleHeight

The maximum height of one of the holes of the hole punch configuration to be removed. If HOLEPUNCH_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels. This parameter is valid only if HOLEPUNCH_USE_SIZE is set in uFlags.


iLocation Parameter For HolePunchRemove
iLocation

Indicates the location within the document of the hole-punches to remove. Possible values are:

Value	Meaning

HOLEPUNCH_LEFT	Searches for the hole-punch pattern on the left side of the document

HOLEPUNCH_RIGHT	Searches for the hole-punch pattern on the right side of the document

HOLEPUNCH_TOP	Searches for the hole-punch pattern across the top of the document

HOLEPUNCH_BOTTOM	Searches for the hole-punch pattern across the bottom of the document


Return for HolePunchRemove
Return Value

Value	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


HSV_HfromRGB method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short HSV_HfromRGB (OLE_COLOR cr);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Returns the corresponding Hue of a standard Windows COLORREF (OLE_COLOR).

Traditionally, hue ranges from 0 to 359.  For HSV_HfromRGB, the range of 0 to 359 is remapped to a range of 0..255.  For example,

Color	Hue(0..359)	Hue(0..255)
Red	0	0
Green	120	85
Blue	240	170
The standard Windows values for COLORREF(OLE_COLOR) represent either red, green, and blue color values, or an index into the bitmap's palette. A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value.  If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette, which holds the color value. You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes as Color Values. Please note that just because an image has a palette, does not mean the value returned by this property is a palette index.

See Also

Elements	HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Doing Color Space Conversions
Creating and Using a Bitmap Region


cr Parameter For HSV_HfromRGB
cr

OLE_COLOR for which to return the corresponding Hue.


Return for HSV_HfromRGB
Return Value

Returns the Hue corresponding to the specified OLE_COLOR.


HSV_SfromRGB method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short HSV_SfromRGB (OLE_COLOR cr);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Returns the corresponding Saturation (S) of a standard Windows COLORREF (OLE_COLOR).

Saturation is the amount of "white" in a color. A saturation of 0 contains the most white and a saturation of 255 contains no white.

The standard Windows values for COLORREF(OLE_COLOR) represent either red, green, and blue color values, or an index into the bitmap's palette. A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value.  If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette, which holds the color value. You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes as Color Values. Please note that just because an image has a palette, does not mean the value returned by this property is a palette index.

See Also

Elements	HSV_HfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Doing Color Space Conversions
Creating and Using a Bitmap Region


cr Parameter For HSV_SfromRGB
cr

OLE_COLOR for which to return the corresponding Saturation.


Return for HSV_SfromRGB
Return Value

Returns the Saturation corresponding to the specified OLE_COLOR.


HSV_VfromRGB method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short HSV_VfromRGB (OLE_COLOR cr);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Returns the corresponding Value (V) of a standard Windows COLORREF (OLE_COLOR).

Value is the amount of "black" in a color. A Value of 0 contains the most black and a Value of 255 contains the least black.

The standard Windows values for COLORREF(OLE_COLOR) represent either red, green, and blue color values, or an index into the bitmap's palette. A COLORREF value with the format 0x00BBGGRR represents the blue, green, and red color values for the specified pixel, where 0xBB is the blue value, 0xGG is the green value and 0xRR is the red value.  If 0x01000000 is set in the COLORREF value (0x010000ZZ), the lower 8 bits (0xZZ) represent an index into the bitmap's palette, which holds the color value. You can specify a COLORREF value (the return value of the RGB function), or you can specify a palette index as explained in Using Palette Indexes as Color Values. Please note that just because an image has a palette, does not mean the value returned by this property is a palette index.

See Also

Elements	HSV_HfromRGB method, HSV_SfromRGB method, RGBfromHSV method

Topics	Raster Images: Doing Color Space Conversions
Creating and Using a Bitmap Region


cr Parameter For HSV_VfromRGB
cr

OLE_COLOR for which to return the corresponding Value.


Return for HSV_VfromRGB
Return Value

Returns the Value corresponding to the specified OLE_COLOR.


HTable property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short HTable (short iIndex);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Hue lookup table. This is one of the four tables that the RemapHue method uses to change the bitmap's hue, saturation and value. This property is used only if the bUseHTable parameter is set to TRUE when the RemapHue method is called. Hue, Saturation, and Value levels range from 0 to 255.  Therefore, the lookup tables each have 256 entries. The current hue, saturation and value of a pixel correspond to the table indexes. If the bUseMaskTable parameter is set to TRUE when the RemapHue method is called and the MaskTable(i) entry for a particular hue is not zero, then the hue is changed to the hue in HTable(i). If MaskTable(i) is 0 then HTable(i) is ignored. For example, if RemapHue is called with both bUseMaskTable and bUseHTable set to TRUE, then if a pixel has a hue of 85 and the MaskTable(85) is not 0, the hue of the pixel is changed to HTable(85).

Traditionally, hue ranges from 0 to 359. For the lookup table, the range of 0 to 359 is remapped to a range of 0..255.  For example,

Color	Hue(0..359)	Hue(0..255)
Red	0	0
Green	120	85
Blue	240	170
See Also

Elements	RemapHue method, MaskTable property, STable property, VTable property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Modifying Intensity Values


iIndex Parameter For HTable
iIndex

The index into the array. The first element of the array is 0. The values present in this array are hue values used to remap the hues of an image.


HTableL property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short HTable (long lIndex);

Overview	Refer to Changing Brightness and Contrast.

Remarks

(Document/Medical only) Hue lookup table. This is one of the four tables that the RemapHue method uses to change the bitmap's hue, saturation and value. This property is used only if the bUseHTable parameter is set to TRUE when the RemapHue method is called and the RemapHueTablesSize property is set to 65536. Hue, Saturation, and Value levels range from 0 to 255.  The current hue, saturation and value of a pixel correspond to the table indexes. If the bUseMaskTable parameter is set to TRUE when the RemapHue method is called and the MaskTableL(i) entry for a particular hue is not zero, then the hue is changed to the hue in HTableL(i). If MaskTableL(i) is 0 then HTableL(i) is ignored. For example, if RemapHue is called with both bUseMaskTable and bUseHTable set to TRUE, then if a pixel has a hue of 85 and the MaskTableL(85) is not 0, the hue of the pixel is changed to HTable(85).

Traditionally, hue ranges from 0 to 359. For the lookup table, the range of 0 to 359 is remapped to a range of 0..255.  For example,

Color	Hue(0..359)	Hue(0..255)
Red	0	0
Green	120	85
Blue	240	170
This property provides support for 16-bit grayscale and 48-bit color images. Support for 16-bit grayscale and 48-bit color images is provided only in Document/Medical toolkits.

See Also

Elements	RemapHueTablesSize property, RemapHue method, MaskTableL property, STableL property, VTableL property, MaskTable property, STable property, VTable property, HSV_HfromRGB method, HSV_SfromRGB method, HSV_VfromRGB method, RGBfromHSV method

Topics	Raster Images: Modifying Intensity Values


lIndex Parameter For HTableL
lIndex

The index into the array. The first element of the array is 0. The values present in this array are hue values used to remap the hues of an image.


Hue method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Hue (short iAngle);

Overview	Refer to Correcting Colors.

Remarks

Changes the hue of colors in the bitmap by rotating the color wheel.

This method can rotate the color wheel in either direction. A 180-degree rotation in either direction changes each color to its complement. Positive rotation takes red toward green, green toward blue, and blue toward red. Negative rotation has the opposite effect.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Saturation method, Invert method, GetChange method

Topics	Raster Images: Modifying Intensity Values
Raster Images: Where the Region Preempts the Bitmap


iAngle Parameter For Hue
iAngle

Angular amount to change the hue, in degrees.


Return for Hue
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


hDocCleanRgn property (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	OLE_HANDLE hDocCleanRgn

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) Window HRGN that is updated with a Windows region that contains all the elements removed by one of the Document Cleanup methods listed below. This property is updated when the method returns. It is updated only if the XXX_SINGLE_REGION flag is set in the uFlags parameter of one of the following methods:

BorderRemove method

DotRemove method

HolePunchRemove method

InvertedText method

LineRemove method

Smooth method

Set this property to 0 at any time to free the resources associated with it.

See Also

Elements	BorderRemove method, DotRemove method, HolePunchRemove method, InvertedText method, LineRemove method, Smooth method

Topics	Raster Images: Cleaning - up 1-Bit Images


HScrollInfo property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	LEADScrollInfo* HScrollInfo

Overview	Refer to Scrolling an Image.

Remarks

(Runtime only) Contains the object that references the control's horizontal scrollbar information.

The LEADScrollInfo object has the following properties:

Property	Description

Min	(Read only) Long value that is updated with the minimum scroll range value.

Max	(Read only) Long value that is updated with the maximum scroll range value.

Page	Long value that gets or sets the scroll page size, in pixels.

Line	Long value that gets or sets the size of the scroll line, in pixels. This is the amount that will be scrolled by line left or line right. The line value must be <= the page value.

Pos	Long value that gets or sets the thumb position (current position) of the scrollbar. This value can be set to scroll the display.

Visible	(Read only) Boolean flag that indicates whether the scrollbar is visible. If this is TRUE, the scrollbar is visible. If this value is FALSE, the scrollbar is not visible.

Width	(Read only) Float value that is updated with the size of the of the scrollbar. The unit of measure is determined by the ScaleMode property.

See Also

Elements	AutoScroll property, VScrollInfo property, Scroll event, Resize event

Topics	Raster Images: Displaying Images


hWnd property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	OLE_HANDLE hWnd

Overview	Refer to Miscellaneous Methods and Properties.

Remarks

(Read only) Is the handle to the Main Control.

See Also

Topics	Working with the Control: General Behavior


hWnd property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_HANDLE hWnd

Overview	Refer to Annotation Toolbar.

Remarks

(Read only) Is the handle to the annotation toolbar.

See Also

Elements	AutoSetTool property, ButtonBitmapDown property, ButtonBitmapDown property, ButtonColumns property,ButtonCount property, ButtonMenuText property, ButtonMenuTextID property, ButtonMenuTool property, ButtonRows property, ButtonTool property, ButtonToolCount property, ButtonToolTipText property, ButtonToolTipTextID property, ButtonVisible property, Create method, Tool property, Visible property

Topics	Annotations (Document/Medicalonly): Automation


IgnoreFilters method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short IgnoreFilters (BSTR pszFilters);

Overview	Refer to Loading Filters

Remarks

Specifies which file filters LEADTOOLS should NEVER load, even if present.  Use this method if you never want to load a particular file filter(s).  This is useful for instance if you never load AVI files and you want to ignore the AVI filter since this filter on its own loads all the DLLs required for Video for Windows (there are about 10 of them).

The files specified in PreLoadFilters take priority over the files specified in IgnoreFilters.  This means that if the filter is present in pszFilters for both methods, then the filter will be loaded and will not be ignored.

Note that IgnoreFilters has effect only if called prior to loading, saving or getting information about a file. Calling this method after that will have no effect.

See Also

Elements	PreLoadFilters method

Topics	Working with the Control: General Behavior, Files To Be Included With Your Application


pszFilters Parameter For IgnoreFilters
pszFilters

String containing which filters should be ignored.  pszFilters has the same format as in PreLoadFilters method.


Return for IgnoreFilters
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


IncludeSubDirectories property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL IncludeSubDirectories

Overview	Refer to Thumbnail Browser.

Remarks

(persistent property, available at design time) Flag indicating whether or not to recurse subdirectories when looking for files.

If this property is set to True, the control will search for files in the specified directory, and any subdirectories.

This defaults to False.

See Also

Elements	BrowseDir method

Topics	Raster Images: Using the Thumbnail Browser


InfoAnimation property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL InfoAnimation

Overview	Refer to Playing an Animation.

Remarks

(Read only) Indicates whether the specified file is an animation file.

If this value is TRUE, the file is played as an animation as it is loaded (when the AutoAnimate property is TRUE).

This property is TRUE only for animated GIF files and AVI files. Keep in mind, however, that any multipage file can be loaded to create a bitmap list, and any bitmap list can be played as an animation after it is loaded or created.

Use the GetFileInfo method to update this property.

Setting	Description

TRUE	The file is an animated GIF or AVI file.

FALSE	The file is not an animated file (although it may be a multipage file).

See Also

Elements	GetFileInfo method, InfoAnimationHeight property, InfoAnimationWidth property

Topics	Raster Images: Playing Animated Images


InfoAnimationHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float InfoAnimationHeight

Overview	Refer to Playing an Animation.

Remarks

(Read only) Is the height that will be used for the target bitmap when playing an animation.

Use the GetFileInfo method to update this property. The value of this property is valid only if the InfoAnimation property is TRUE. The unit of measure is determined by the ScaleMode property.

See Also

Elements	GetFileInfo method, InfoAnimation property, InfoAnimationWidth property

Topics	Raster Images: Playing Animated Images


InfoAnimationWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float InfoAnimationWidth

Overview	Refer to Playing an Animation.

Remarks

(Read only) Is the width that will be used for the target bitmap when playing an animation.

Use the GetFileInfo method to update this property. The value of this property is valid only if the InfoAnimation property is TRUE. The unit of measure is determined by the ScaleMode property.

See Also

Elements	GetFileInfo method, InfoAnimation property, InfoAnimationHeight property

Topics	Raster Images: Playing Animated Images


InfoBits property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short InfoBits

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Is the number of bits per pixel of the specified image file.

Use the GetFileInfo method to update this property.

Support for 12 and 16-bit grayscale  images is available only in the Document/Medical Imaging .

See Also

Elements	InfoCompress property, InfoFormat property, InfoHeight property, InfoPage property, InfoPCDRes property, InfoSizeDisk property, InfoSizeMem property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoBits property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InfoBits

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the number of bits per pixel of the file from which the thumbnail was generated.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

Support for 12 and 16-bit grayscale images is available only in the Document/Medical Imaging.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoCompression property, InfoFormat property, InfoWidth property, InfoHeight property, InfoTotalPages property, InfoPage property, InfoSizeDisk property, InfoSizeMem property, InfoXRes property, InfoYRes property

Topics	Raster Images: Using the Thumbnail Browser


InfoCompress property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BSTR InfoCompress

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Is the compression method of the specified image file.

Use the GetFileInfo method to update this property.

See Also

Elements	InfoBits property, InfoFormat property, InfoHeight property, InfoPage property, InfoPCDRes property, InfoSizeDisk property, InfoSizeMem property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoCompression property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR InfoCompression

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the compression method of the file from which the thumbnail was generated.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoBits property, InfoFormat property, InfoWidth property, InfoHeight property, InfoTotalPages property, InfoPage property, InfoSizeDisk property, InfoSizeMem property, InfoXRes property, InfoYRes property

Topics	Raster Images: Using the Thumbnail Browser


InfoFormat property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short InfoFormat

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Is the format of the specified image file.

Use the GetFileInfo method to update this property. For possible values, refer to Formats of Input Files. Please note that if a TIFF file of unknown compression is used, this property will be updated

See Also

Elements	InfoBits property, InfoCompress property, InfoHeight property, InfoPage property, InfoPCDRes property, InfoSizeDisk property, InfoSizeMem property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoFormat property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InfoFormat

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the format of the file from which the thumbnail was generated.

For possible values, refer to Formats of Input Files.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoBits property, InfoCompression property, InfoWidth property, InfoHeight property, InfoTotalPages property, InfoPage property, InfoSizeDisk property, InfoSizeMem property, InfoXRes property, InfoYRes property

Topics	Raster Images: Using the Thumbnail Browser


InfoHasAlpha property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL InfoHasAlpha

Overview	Refer to Loading a Bitmap from a Files.

Remarks

(Read only) Indicates whether the specified file contains an Alpha Bitmap.

Use the GetFileInfo method to update this property.

Setting	Description

TRUE	The file contains an Alpha Bitmap.

FALSE	The file does not contain an Alpha Bitmap.

See Also

Elements	GetFileInfo method, InfoAnimation property, InfoAnimationHeight property, InfoAnimationWidth property, InfoBits property, InfoCompress property, InfoFormat property, InfoHeight property, InfoPage property, InfoPCDRes property, InfoSizeDisk property, InfoSizeMem property, InfoTotalPages property, InfoWidth property, InfoXRes property, InfoYRes property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information
PNG Files and Transparency


InfoHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float InfoHeight

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Is the height of the image in the specified file.

The unit of measure is determined by the ScaleMode property. Use the GetFileInfo method to update this property.

See Also

Elements	InfoBits property, InfoCompress property, InfoFormat property, InfoPage property, InfoPCDRes property, InfoSizeDisk property, InfoSizeMem property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoHeight property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InfoHeight

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the height of the image from which the thumbnail was generated.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoBits property, InfoCompression property, InfoFormat property, InfoWidth property, InfoTotalPages property, InfoPage property, InfoSizeDisk property, InfoSizeMem property, InfoXRes property, InfoYRes property

Topics	Raster Images: Using the Thumbnail Browser


InfoIFD property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long InfoIFD

Overview	Refer to Loading and Saving Large TIFF Files.

Remarks

Specifies the offset within the current file of the current page.

This property value is valid only if it is greater than 0. A value of zero indicates that the file format does not support Image File Directories (IFDs).

The value of this property can be used for the LoadIFD property and the SaveIFD property to speed up loading and saving of TIFF files with many pages.

See Also

Elements	LoadIFD property, SaveIFD property

Topics	Raster Images: Loading and Saving Large TIFF Files


InfoLayers property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InfoLayers

Overview	Refer to Layers in Files

Remarks

Represents the total number of layers present in a file.

Currently, only PSD files support layers, but not all PSD files have layers.

Use this property to determine which layers can be loaded from a file.

See Also

Elements	LoadLayer method, GetFileInfo method, InfoTotalPages property, LayerLeft property, LayerTop property, Save method, SaveLayers property, GetFileInfo method

Topics	Raster Images: Getting and Setting File Information


InfoPage property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long InfoPage

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Is the page number, in a multipage file, of the image.

Use the GetFileInfo method to update this property. The resulting value is either the page number specified in the method or the last page in the file. It is the last page only if the specified number was greater than the total pages in the file.

See Also

Elements	InfoBits property, InfoCompress property, InfoFormat property, InfoHeight property, InfoPCDRes property, InfoSizeDisk property, InfoSizeMem property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoPage property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InfoPage

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the number of the page within the file, from which the thumbnail was generated.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoBits property, InfoCompression property, InfoFormat property, InfoWidth property, InfoHeight property, InfoTotalPages property, InfoSizeDisk property, InfoSizeMem property, InfoXRes property, InfoYRes property

Topics	Raster Images: Using the Thumbnail Browser


InfoPCDRes property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access example   Visual FoxPro example   Visual J++ example

Syntax	BOOL InfoPCDRes (short iIndex);

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Is true if the resolution specified by the index value is in the PhotoCD file.

You load the values of this property by using the GetFileInfo method.

Before loading a bitmap from a file, use the PCDRes property to specify which resolution to load. (The PhotoCD format is read only; so the PhotoCD resolution is not an issue when saving a file.)

Index	Resolution

PCDRES_BASE_OVER_64	64 x 96

PCDRES_BASE_OVER_16	128 x 192

PCDRES_BASE_OVER_4	256 x 384

PCDRES_BASE 	512 x 768

PCDRES_4BASE 	1024 x 1536

PCDRES_16BASE	2048 x 3072

See Also

Elements	InfoBits property, InfoCompress property, InfoFormat property, InfoHeight property, InfoPage property, InfoSizeDisk property, InfoSizeMem property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


iIndex Parameter For InfoPCDRes
iIndex

The index into the array of boolean values. Use the following constants as possible values:

Index	Resolution

PCDRES_BASE_OVER_64	64 x 96

PCDRES_BASE_OVER_16	128 x 192

PCDRES_BASE_OVER_4	256 x 384

PCDRES_BASE 	512 x 768

PCDRES_4BASE 	1024 x 1536

PCDRES_16BASE	2048 x 3072


InfoSizeDisk property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long InfoSizeDisk

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Is the size of the specified image file.

Use the GetFileInfo method to update this property. The value is expressed in bytes.

See Also

Elements	InfoBits property, InfoCompress property, InfoFormat property, InfoHeight property, InfoPage property, InfoPCDRes property, InfoSizeMem property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoSizeDisk property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long InfoSizeDisk

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the size of the file from which the thumbnail was generated.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoBits property, InfoCompression property, InfoFormat property, InfoWidth property, InfoHeight property, InfoTotalPages property, InfoPage property, InfoSizeMem property, InfoXRes property, InfoYRes property

Topics	Raster Images: Using the Thumbnail Browser


InfoSizeMem property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	long InfoSizeMem

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Is the amount of memory required to load a bitmap from the specified file.

Use the GetFileInfo method to update this property. The value is expressed in bytes.

See Also

Elements	InfoBits property, InfoCompress property, InfoFormat property, InfoHeight property, InfoPage property, InfoPCDRes property, InfoSizeDisk property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoSizeMem property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long InfoSizeMem

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the amount of memory required to load the original image from which the thumbnail was generated.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoBits property, InfoCompression property, InfoFormat property, InfoWidth property, InfoHeight property, InfoPage property, InfoTotalPages property, InfoSizeDisk property, InfoXRes property, InfoYRes property

Topics	Raster Images: Using the Thumbnail Browser


InfoTotalPages property (Main Control)

Visual Basic example   Visual C++ 4.0 example
 Visual J++ example

Syntax	long InfoTotalPages

Overview	Refer to Loading a Bitmap from a File.

Remarks

Represents the total number of pages in a multipage file.

See Also

Topics	Raster Images: Getting and Setting File Information


InfoTotalPages property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InfoTotalPages

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the total number of pages in the file from which the thumbnail was generated.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoBits property, InfoCompression property, InfoFormat property, InfoWidth property, InfoHeight property, InfoPage property, InfoSizeMem property, InfoSizeDisk property, InfoXRes property, InfoYRes property

Topics	Raster Images: Using the Thumbnail Browser


InfoViewPerspective property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InfoViewPerspective

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Is the view perspective of the specified image file.

Use the GetFileInfo method to update this property.

Possible values are:

TOP_LEFT	[0] Top-left of image is first in memory.

BOTTOM_LEFT	[2] Bottom-left of image is first in memory.

TOP_RIGHT	[1] Top-right of image is first in memory.

BOTTOM_LEFT180	[1] Same as TOP_RIGHT, which is BOTTOM_LEFT rotated clockwise by 180 degrees.

BOTTOM_RIGHT	[3] Bottom-right of image is first in memory.

TOP_LEFT180	[3] Same as BOTTOM_RIGHT, which is TOP_LEFT rotated clockwise by 180 degrees.

RIGHT_TOP	[4] First row is the right side, first column is top side.

TOP_LEFT90	[4] Same as RIGHT_TOP, which is TOP_LEFT rotated clockwise by 90 degrees.

LEFT_BOTTOM	[8] First row is the left side, first column is top side.

TOP_LEFT270	[8] Same as LEFT_BOTTOM, which is TOP_LEFT rotated clockwise by 270 degrees.

LEFT_TOP	[5] First row is the left side, first column is the top side

BOTTOM_LEFT90	[5] Same as LEFT_TOP, which is BOTTOM_LEFT rotated clockwise by 90 degrees

RIGHT_BOTTOM	[7] First row is the right side, first column is the bottom side

BOTTOM_LEFT270 	[7] Same as RIGHT_BOTTOM, which is BOTTOM_LEFT rotated clockwise by 270 degrees

See Also

Elements	GetFileInfo method, InfoBits property, InfoFormat property, InfoHeight property, InfoPage property, InfoPCDRes property, InfoSizeDisk property, InfoSizeMem property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	float InfoWidth

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Is the width of the image in the specified file.

The unit of measure is determined by the ScaleMode property. Use the GetFileInfo method to update this property.

See Also

Elements	InfoBits property, InfoCompress property, InfoFormat property, InfoHeight property, InfoPage property, InfoPCDRes property, InfoSizeDisk property, InfoSizeMem property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoWidth property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InfoWidth

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the width of the image from which the thumbnail was generated.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoBits property, InfoCompression property, InfoFormat property, InfoTotalPages property, InfoHeight property, InfoPage property, InfoSizeMem property, InfoSizeDisk property, InfoXRes property, InfoYRes property

Topics	Raster Images: Using the Thumbnail Browser


InfoXRes property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long InfoXRes

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Gets the X resolution in the specified file.

Use the GetFileInfo method to update this property.

See Also

Elements	InfoYRes property, InfoBits property, InfoCompress property, InfoFormat property, InfoPage property, InfoPCDRes property, InfoSizeDisk property, InfoSizeMem property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoXRes property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InfoXRes

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the x resolution of the original image from which the thumbnail was generated.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoBits property, InfoCompression property, InfoFormat property, InfoWidth property, InfoHeight property, InfoPage property, InfoSizeMem property, InfoSizeDisk property, InfoTotalPages property, InfoYRes property

Topics	Raster Images: Using the Thumbnail Browser


InfoYRes property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long InfoYRes

Overview	Refer to Loading a Bitmap from a File.

Remarks

(Read only) Gets the Y resolution in the specified file.

Use the GetFileInfo method to update this property.

See Also

Elements	InfoXRes property, InfoBits property, InfoCompress property, InfoFormat property, InfoPage property, InfoPCDRes property, InfoSizeDisk property, InfoSizeMem property, InfoWidth property

Topics	Raster Images: Loading Files
Raster Images: Getting and Setting File Information


InfoYRes property (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InfoYRes

Overview	Refer to Thumbnail Browser.

Remarks

(Runtime-only, Read-only) Is the y resolution of the original image from which the thumbnail was generated.

This property is updated by the successful generation of a thumbnail.  You can read this property in the ThumbnailEvent event.

See Also

Elements	ThumbnailEvent event, BrowseDir method, InfoBits property, InfoCompression property, InfoFormat property, InfoWidth property, InfoHeight property, InfoPage property, InfoSizeMem property, InfoSizeDisk property, InfoTotalPages property, InfoXRes property

Topics	Raster Images: Using the Thumbnail Browser


Insert method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short Insert (long Bitmap, BSTR pszText,long Data);

Overview	Refer to Using the ImageList Control.

Remarks

Inserts a new item into the ImageList Control. Insertion occurs at the end of the list.

See Also

Elements	Item property, InsertAt method, Remove method, Count property, Sort method, InsertFromBitmapList method, LoadFromFile method, SaveToFile method

Topics	Raster Images: Displaying Images


Bitmap Parameter For Insert
Bitmap

Handle to the bitmap to be inserted.


pszText Parameter For Insert
pszText

Text attribute for the new item to insert.


Data Parameter For Insert
Data

Data attribute for the new item to insert.  You can use this for any extra information you wish to associate with the item.


Return for Insert
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


InsertAt method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InsertAt (long Bitmap, BSTR pszText,long Data, long nIndex);

Overview	Refer to Using the ImageList Control.

Remarks

Inserts a new item into the ImageList Control at the specified index.  All items past nIndex are pushed up one position. The index is zero-based.

See Also

Elements	Item property, Insert method, Remove method, Count property, Sort method, InsertFromBitmapList method, LoadFromFile method, SaveToFile method

Topics	Raster Images: Displaying Images


Bitmap Parameter For InsertAt
Bitmap

Handle to the bitmap to be inserted.


pszText Parameter For InsertAt
pszText

Text attribute for the new item to insert.


Data Parameter For InsertAt
Data

Data attribute for the new item to insert.  You can use this for any extra information you wish to associate with the item.


nIndex Parameter For InsertAt
nIndex

Index at which to insert the new item.


Return for InsertAt
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


InsertBitmapListItem method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short InsertBitmapListItem (short iIndex, OLE_HANDLE hBitmap);

Overview	Refer to Bitmaps and Bitmap Lists.

Remarks

Inserts a bitmap into the control's bitmap list. You can get a bitmap to insert by referencing the Bitmap property of another Main Control.

If you insert a bitmap into the middle of a list, the indexes of other items in the list are adjusted.

See Also

Topics	Raster Images: Creating and Maintaining Lists of Images


iIndex Parameter For InsertBitmapListItem
iIndex

Position of the bitmap in the list. Use -1 to append the bitmap to the end of the list.


hBitmap Parameter For InsertBitmapListItem
hBitmap

Bitmap to insert into the list. You can get a bitmap to insert by referencing the Bitmap property of another Main Control.


Return for InsertBitmapListItem
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


InsertFromBitmapList method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short InsertFromBitmapList (long hBitmapList, BSTR pszDefaultText);

Overview	Refer to Using the ImageList Control.

Remarks

Inserts new items into the ImageList Control from the specified LEAD Bitmap List.  All items are inserted with the same Text attribute, specified in pszDefaultText.  You can change this after the items are inserted using the Item collection property.

See Also

Elements	Item property, InsertAt method, Remove method, Count property, Sort method, Insert method, LoadFromFile method, SaveToFile method

Topics	Raster Images: Displaying Images


hBitmapList Parameter For InsertFromBitmapList
hBitmapList

Handle to the bitmap list from which items are to be inserted.


pszDefaultText Parameter For InsertFromBitmapList
pszDefaultText

Text attribute for the new items to be inserted.


Return for InsertFromBitmapList
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Intensity method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Intensity (short iChange);

Overview	Refer to Changing Brightness and Contrast.

Remarks

Changes the intensity (brightness) of the bitmap.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	GammaCorrect method, Contrast method, HistoContrast method, HistoEqualize method, StretchIntensity method, GetChange method

Topics	Raster Images: Modifying Intensity Values
Raster Images: Where the Region Preempts the Bitmap


iChange Parameter For Intensity
iChange

Amount to change the intensity. The intensity ranges from -1000 to 1000. A positive value increases (or lightens) the brightness of the bitmap. A negative values decreases (or darkens) the brightness of the bitmap.


Return for Intensity
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


IntensityDetect method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short IntensityDetect (short iLow, short iHigh);

Overview	Refer to Detecting and Enhancing Edges and Lines.

Remarks

Filters the bitmap to detect colors in a specified intensity range.

Intensity levels range from 0 to 255 for each color plane (red, green, and blue). This method processes each plane separately. If a value falls within the range, it is raised to 255, and if it falls outside the range, it is lowered to 0.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	GetRange method

Topics	Raster Images: Modifying Intensity Values
Raster Images: Filtering Images
Raster Images: Where the Region Preempts the Bitmap


iLow Parameter For IntensityDetect
iLow

Lowest intensity to detect.


iHigh Parameter For IntensityDetect
iHigh

Highest intensity to detect.


Return for IntensityDetect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


Invert method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	short Invert ();

Overview	Refer to Correcting Colors.

Remarks

Inverts the colors in the bitmap, making it like a photographic negative.

This method can also be used to invert the color of a 1-bit bitmap, making the black white and the white black.

This method supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 48 and 64-bit color images is available only in the Document/Medical toolkits.

See Also

Elements	Hue method, Saturation method

Topics	Raster Images: Modifying Intensity Values
Raster Images: Where the Region Preempts the Bitmap


Return for Invert
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


InvertedText event (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	void InvertedText (OLE_HANDLE hRgn, float fBoundingRectLeft, float fBoundingRectTop, float fBoundingRectWidth, float fBoundingRectHeight, long iWhiteCount, long iBlackCount);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) This event is triggered once for each area of inverted text that is detected. Set the DocCleanSuccess property to SUCCESS_REMOVE to have the area inverted. Set the DocCleanSuccess property to SUCCESS_NOREMOVE to leave the area unchanged. Set the DocCleanSuccess property to 0 to abort. If the uFlags parameter of the InvertedText method is set to INVERTEDTEXT_IMAGE_UNCHANGED | INVERTEDTEXT _SINGLE_REGION, then the value of the DocCleanSuccess property affects only the internal single region that contains all the changes.

Note: hRgn is only valid during this event. To use the hRgn after the event has terminated, make a copy of it using the SetBitmapRgnHandle method.

See Also

Elements	InvertedText method

Topics	Raster Images: Cleaning - up 1-Bit Images


hRgn Parameter For InvertedText
hRgn

Windows region representing an area of inverted text.


fBoundingRectLeft Parameter For InvertedText
fBoundingRectLeft

X coordinate of the origin of the bounding rectangle of the inverted text being processed.


fBoundingRectTop Parameter For InvertedText
fBoundingRectTop

Y coordinate of the origin of the bounding rectangle of the inverted text being processed.


fBoundingRectWidth Parameter For InvertedText
fBoundingRectWidth

Width of the bounding rectangle of the inverted text being processed.


fBoundingRectHeight Parameter For InvertedText
fBoundingRectHeight

Height of the bounding rectangle of the inverted text being processed.


iWhiteCount Parameter For InvertedText
iWhiteCount

Total number of white pixels in the inverted text region being processed.


iBlackCount Parameter For InvertedText
iBlackCount

Total number of black pixels in the inverted text region being processed.


InvertedText method (Main Control)

Visual Basic Example   Visual C++ 4.0 example

Syntax	short InvertedText (long uFlags, long iMinInvertWidth, long iMinInvertHeight, long iMinBlackPercent, long iMaxBlackPercent);

Overview	Refer to Cleaning - up 1-Bit Images

Remarks

(Document/Medical) Finds and inverts areas of inverted text in a 1-bit black and white image.

Inverted text is commonly found in scanned text documents.

Below is an example of inverted text often found in scanned images:

Inverting the area of inverted text yields:

This method works only on 1-bit black and white images.

If a region is selected, only the selected region will be changed by this method. If no region is selected, the whole image will be processed.

The behavior of this method can be modified by using the InvertedText event.

This method triggers both the InvertedText event and the ProgressStatus event.

See Also

Elements	InvertedText event

Topics	Raster Images: Cleaning - up 1-Bit Images


uFlags Parameter For InvertedText
uFlags

Flags that determine the behavior of the inverted text removal process. Flags may be combined using a bitwise OR (|). Possible values are:

Value	Meaning

INVERTEDTEXT_SINGLE_REGION:	For each inverted text segment found by the InvertedText method, if the DocCleanSuccess property is set to SUCCESS_REMOVE, the inverted text is added to an internal single region. If the DocCleanSuccess property is set to SUCCESS_NOREMOVE, the inverted text is not added to the single region. When the InvertedText method returns, either the DocCleanBitmap property or the hDocCleanRgn property will reference a region that contains all the corrected inverted text. If INVERTEDTEXT_LEAD_REGION is also set, the DocCleanBitmap property will be updated with a bitmap that has a LEAD region that contains all the corrected inverted text. If INVERTEDTEXT_LEAD_REGION is not set, hDocCleanRgn is updated with a Windows region that contains all the corrected inverted text. When the region (either LEAD or Windows) is no longer needed, it must be destroyed.

INVERTEDTEXT_LEAD_REGION	When the InvertedText method returns, the DocCleanBitmap property is updated with a bitmap that also contains a region with all the corrected inverted text. This flag must be used in conjunction with INVERTEDTEXT_SINGLE_REGION. To use this flag set uFlags to INVERTEDTEXT_SINGLE_REGION | INVERTEDTEXT_LEAD_REGION. The DocCleanBitmap property will be updated when the InvertedText method returns.

INVERTEDTEXT_IMAGE_UNCHANGED	The original image is unchanged.

INVERTEDTEXT_USE_DPI	The unit of measure for all parameters of this method is thousandths of an inch. Use the image's DPI to convert to pixels. This allows the processing of many images with different DPI. If this flag is not set, the unit of measure is pixels.

INVERTEDTEXT_CALLBACK_REGION	The InvertedText event receives a Windows region that contains the current inverted text to be inverted. Setting this flag lets the user create his or her own composite of inverted text by combining the regions received by the InvertedText event, if the event returns SUCCESS_REMOVE. The regions can be combined using a logical OR operator. Combining all regions received by the event, that are removed, results in a region identical to the region created when INVERTEDTEXT_SINGLE_REGION is set in uFlags. When the region received by the event is no longer needed, it must be destroyed.

INVERTEDTEXT_USE_DIAGONALS	Considers pixels that are diagonal to the inverted text as part of the inverted text.


iMinInvertWidth Parameter For InvertedText
iMinInvertWidth

The minimum width of an area that is considered to be inverted text. If INVERTEDTEXT_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.


iMinInvertHeight Parameter For InvertedText
iMinInvertHeight

The minimum height of an area that is considered to be inverted text. If INVERTEDTEXT_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.


iMinBlackPercent Parameter For InvertedText
iMinBlackPercent

The minimum percent of total pixels in an inverted text area that must be black. Areas with a lower percent of black pixels are not considered.


iMaxBlackPercent Parameter For InvertedText
iMaxBlackPercent

The maximum percent of total pixels in an inverted text area that must be black. Areas with a higher percent of black pixels are not considered.


Return for InvertedText
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


IsGrayscale property (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example

Syntax	short IsGrayscale

Overview	Refer to Examining and Altering Bitmaps.

Remarks

Is an indicator of the kind of grayscale palette, if any, that a bitmap has.

Grayscale images can be 1, 4, 8, 12, or 16-bit. With a 1-bit image, you can use this property to check for inversion (for example, white lines on a black background) caused by an inverted palette.

Value	Meaning

GRAY_NO	Not grayscale.

GRAY_ORDEREDNORMAL	Normally ordered grayscale (dark to light).

GRAY_ORDEREDINVERSE	Reverse ordered grayscale (light to dark).

GRAY_NOTORDERED	Unordered grayscale.

Support for 12 and 16 bit grayscale images is only available in the Document/Medical Toolkits.

See Also

Topics	Raster Images: Doing Color Expansion or Reduction


IsSigned property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL IsSigned

Overview	Refer to Examining and Altering Bitmaps

Remarks

Indicates whether the bitmap currently loaded in the control contains signed data. This property is valid only if the control contains a bitmap. Possible values are:

Value	Meaning

TRUE	The bitmap data is signed.

FALSE	The bitmap data is not signed.

If this property is TRUE, the signed bitmap data should be converted to unsigned using the ConvertSignedToUnsigned method. If the bitmap data is signed, image processing and the paint functions may not work correctly. Currently, only TIF files contain signed data. A bitmap with signed data will not be loaded unless the LoadSigned property is set to TRUE before loading the image.

If this property is FALSE, no further processing is needed.

Support for 12 and 16-bit grayscale images is only available in the Document/Medical toolkits.

See Also

Elements	LoadSigned property, ConvertSignedToUnsigned method

Topics	Raster Images: Doing Color Expansion or Reduction
Raster Images: Getting and Setting File Information


ISISAcquire method (ISIS Control)
ISISAcquire method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short ISISAcquire (long hWnd, long uFlags);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical)  Scans a single page into the Bitmap property.

You must call the ISISLoadDriver method before calling ISISAcquire.

If you wish to use this bitmap with the Main Control, you can copy the image by assigning the ISIS® Bitmap to the Main Bitmap after acquiring the image. Alternatively, to avoid a copy, set the Main Control's RefBitmap property to True before assigning the ISIS® Control's Bitmap to the Main Control. For example:

LEAD1.RefBitmap = True
LEAD1.Bitmap = LEADISIS1.Bitmap
LEAD1.RefBitmap = False

See Also

Elements	Bitmap property

Topics	Raster Images: Scanning Images using ISIS®


hWnd Parameter For ISISAcquire
hWnd

Window handle to the ISIS® dialog's parent.


uFlags Parameter For ISISAcquire
uFlags

Flags indicating ISIS® Acquire options.  Possible values are:

0	Don't show the user interface.

1	Show the user interface.


Return for ISISAcquire
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISAcquireMulti method (ISIS Control)
ISISAcquireMulti method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short ISISAcquireMulti (long hWnd, BSTR pszBaseFileName, long uFlags, short nFormat, long bMultiPage);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical)  Scans multiple pages into a multipage file or into multiple single page files.

You must set the EnableISISEvent property to TRUE, before calling ISISAcquireMulti, in order to generate ISISPage events.

You must call the ISISLoadDriver method before calling ISISAcquireMulti.

There are two ways to handle the scanned pages in the ISISPage event.

1. If you set the Bitmap property = 0 before calling ISISAcquireMulti, you must copy the image to a Main Control for processing.

ex.

LEAD1.Bitmap = LEADIsis1.Bitmap

2. If you set the Bitmap property equal to a valid bitmap handle from a Main Control before calling ISISAcquireMulti, you can simply use the Main Control to process the bitmap without making a copy.

ex.

LEAD1.Save (...)

In case #2, you should not attempt to copy from the ISIS® Control to another control.

See Also

Elements	ISISAcquire method, EnableISISEvent property, PagesDiscarded property, ISISGetTag method, ISISSetTag method, ISISPage event

Topics	Raster Images: Scanning Images using ISIS


hWnd Parameter For ISISAcquireMulti
hWnd

Window handle to the ISIS® dialog's parent.


hWnd Parameter For ISISAcquire
pszBaseFileName

Base filename string for the output file or files.

If bMultiPage is FALSE, save each scanned image in a separate TIFF file.  In this case, filenames are created using the string in pszBaseFileName and incrementing each filename by one. By default, the numbering will begin with "0001" and will be incremented with each page scanned ("0002","0003", ... ). Each file will be saved according to the format indicated in nFormat. If a file already exists, for example "Page0002", it will be overwritten. The user can control the number of digits used in numbering the filenames by including asterisks '*' in the filename, before the extension. For example, passing "c:\temp\isis\test**.tif" for pszBaseFileName indicates to use only two digits in the filenames (test04.tif), while passing "c:\temp\isis\test*****.tif" for pszBaseFileName indicates to use only five digits in the filenames (test00001.tif). If no asterisks are included, the default of four digits will be used (test0003.tif).


uFlags Parameter For ISISAcquireMulti
uFlags

Flags indicating ISIS® Acquire options.  Possible values are:

0	Don't show the user interface.

1	Show the user interface.

2	Do not save data to file.


nFormat Parameter For ISISAcquireMulti
nFormat

Value indicating the format to use when saving one or more images to one or more files.  The available formats depend on whether or not the data is acquired in compressed form or in uncompressed form.  If the data is uncompressed, that is if the ISIS® tags TAG_COMPRESSION has been set to TAG_COMPRESSION_NONE, any format supported by LEADTOOLS is valid.  For a list of these formats, refer to Formats of Output Files.

If the data is compressed, the type of compression will determine the output format. If a format that is incompatible with the current compression is passed, an error will occur.  Possible valid format values and the corresponding compressions are:

FILE_CCITT	[25] Tiff, compressed using CCITT.  A file is saved in this format when TAG_COMPRESSION is set to TAG_COMPRESSION_MG3 and nFormat is set to either FILE_CCITT or FILE_FASTEST.

FILE_CCITT_GROUP3_1DIM	[27] TIFF, compressed using CCITT, group 3, 1 dimension. A file is saved in this format when TAG_COMPRESSION is set to TAG_COMPRESSION_G3 and nFormat is set to either FILE_CCITT_GROUP3_1DIM or FILE_FASTEST.

FILE_CCITT_GROUP4	[29] TIFF, compressed using CCITT, group 4. A file is saved in this format when TAG_COMPRESSION is set to TAG_COMPRESSION_G4 and nFormat is set to either FILE_CCITT_GROUP4 or FILE_FASTEST.

FILE_TIFLZW	[17] TIFF, compressed using LZW.  A file is saved in this format when TAG_COMPRESSION is set to TAG_COMPRESSION_LZW and nFormat is set to either FILE_TIFLZW or FILE_FASTEST.

FILE_TIF_PACKBITS	[87] TIFF, compressed using Packed Bits. A file is saved in this format when TAG_COMPRESSION is set to TAG_COMPRESSION_32771 and nFormat is set to either FILE_TIF_PACKBITS or FILE_FASTEST.

FILE_FASTEST	[105] Saves the file as a TIFF using the current compression from the scanner.


bMultiPage Parameter For ISISAcquireMulti
bMultiPage

Flag indicating how to save the scanned images.

TRUE	Save scanned images in a single multipage TIFF file.

FALSE	Save each scanned image in a separate TIFF file.  In this case, filenames are created using the string in pszBaseFileName and incrementing each filename by one.


Return for ISISAcquire
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISGetASCIITag method (ISIS Control)
ISISGetASCIITag method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ISISGetASCIITag (long uTag, BSTR *pszValue, BOOL bDefault);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical) Gets the current or default value of the ISIS® Scanner Driver tag designated in uTag.

The ISISLoadDriver method must be called before calling the ISISGetASCIITag method.

See Also

Elements	ISISSetASCIITag method, ISISSetTag method, ISISGetASCIITagChoiceCount method, ISISGetASCIITagChoice method, ISISGetTagChoiceCount method, ISISGetTagChoice method, ISISAcquire method, ISISAcquireMulti method, ISISGetTag method, ISISSetTag method

Topics	Raster Images: Scanning Images using ISIS


uTag Parameter For ISISGetASCIITag
uTag

One of the supported ISIS® ASCII tags.  For more information on tags, refer to ISIS ASCIItags.


pszValue Parameter For ISISGetASCIITag
pszValue

Address of a string to be updated with the current or default value of the tag designated in uTag.


bDefault Parameter For ISISGetASCIITag
bDefault

Flag that indicates whether to get the default or current value. Possible values are:

Value	Meaning

TRUE	Get the scanner's default value for the specified tag.

FALSE	Get the scanner's current value for the specified tag.


Return for ISISGetASCIITag
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISGetASCIITagChoice method (ISIS Control)
ISISGetASCIITagChoice method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ISISGetASCIITagChoice (long uTag, long nIndex, BSTR *pszValue);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical) Gets the value or choice, at the specified index, of the ISIS® Scanner Driver tag designated in uTag.

The ISISLoadDriver method must be called before calling the ISISGetASCIITagChoice method.

See Also

Elements	ISISSetASCIITag method, ISISGetASCIITagChoiceCount method, ISISGetASCIITag method, ISISGetTagChoiceCount method, ISISGetTagChoice method, ISISAcquire method, ISISAcquireMulti method, ISISSetTag method, ISISGetTag method

Topics	Raster Images: Scanning Images using ISIS


uTag Parameter For ISISGetASCIITagChoice
uTag

One of the supported ISIS® ASCII tags.  For more information on tags, refer to ISIS ASCIItags.


nIndex Parameter For ISISGetASCIITagChoice
nIndex

Index of the value or choice to get for the tag designated in uTag. This value must be between 0 and the maximum number of choices - 1. To determine the maximum number of available choices, call the ISISGetASCIITagChoiceCount method.


pszValue Parameter For ISISGetASCIITagChoice
pszValue

Address of a string to be updated with the value or choice, at the specified index, of the tag designated in uTag.


Return for ISISGetASCIITagChoice
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISGetASCIITagChoiceCount method (ISIS Control)
ISISGetASCIITagChoiceCount method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ISISGetASCIITagChoiceCount (long uTag, long *plCount);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical) Gets the number of possible values or choices for the  ISIS® Scanner Driver tag designated in uTag.

The ISISLoadDriver method must be called before calling the ISISGetASCIITagChoiceCount method.

See Also

Elements	ISISGetASCIITagChoice method, , ISISGetASCIITag method, ISISSetASCIITag method, ISISSetTag method, ISISGetTagChoiceCount method, ISISGetTagChoice method, ISISAcquire method, ISISAcquireMulti method, ISISGetTag method, ISISSetTag method

Topics	Raster Images: Scanning Images using ISIS


uTag Parameter For ISISGetASCIITagChoiceCount
uTag

One of the supported ISIS® ASCII tags.  For more information on tags, refer to ISIS ASCII tags.


plCount Parameter For ISISGetASCIITagChoiceCount
plCount

Address of a variable to be updated with the number of possible values or choices for the tag designated in uTag.


Return for ISISGetASCIITagChoiceCount
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISGetTag method (ISIS Control)
ISISGetTag method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short ISISGetTag (long uTag, long *plValue );

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical)  Gets the current value of the ISIS® Scanner Driver tag designated in uTag.

You must call the ISISLoadDriver method before calling ISISGetTag.

See Also

Elements	ISISSetTag method , ISISAcquire method, ISISAcquireMulti method , ISISGetASCIITag method, ,ISISGetASCIITagChoice method , ISISGetASCIITagChoiceCount method , ISISGetTagChoice method , ISISGetTagChoiceCount method , ISISSetASCIITag method

Topics	Raster Images: Scanning Images using ISIS


uTag Parameter For ISISGetTag
uTag

One of the supported ISIS® tags.  For more information on tags, refer to ISIS tags.


plValue Parameter For ISISGetTag
plValue

Address of a long integer that receives the current value of the tag designated in uTag. If the value pointed to by plValue is ISIS_DEFAULT [-99], then the scanner's default for the tag designated by uTag will be used for scanning.  For example, if the value pointed to by plValue is ISIS_DEFAULT and uTag is TAG_COMPRESSION, then the scanner's default setting for compression will be used for scanning, unless the value pointed to by plValue is set to another value using the ISISSetTag method.


Return for ISISGetTag
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISGetTagChoice method (ISIS Control)
ISISGetTagChoice method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ISISGetTagChoice (long uTag, long nIndex, long *plValue);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical) Gets the value or choice, at the specified index, of the ISIS® Scanner Driver tag designated in uTag.

The ISISLoadDriver method must be called before calling the ISISGetTagChoice method.

See Also

Elements	ISISGetTagChoiceCount method, ISISSetTag method, ISISGetTag method, ISISSetASCIITag method, ISISGetASCIITagChoiceCount method, ISISGetASCIITagChoice method, ISISGetASCIITag method, ISISAcquire method, ISISAcquireMulti method

Topics	Raster Images: Scanning Images using ISIS


uTag Parameter For ISISGetTagChoice
uTag

One of the supported ISIS® tags. For more information on tags, refer to ISIS tags.


nIndex Parameter For ISISGetTagChoice
nIndex

Index of the value or choice to get for the tag designated in uTag. This value must be between 0 and the maximum number of choices - 1. To determine the maximum number of available choices, call the ISISGetTagChoiceCount method.


plValue Parameter For ISISGetTagChoice
plValue

Address of a variable to be updated with the value or choice, at the specified index, of the tag designated in uTag.


Return for ISISGetTagChoice
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISGetTagChoiceCount method (ISIS Control)
ISISGetTagChoiceCount method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ISISGetTagChoiceCount (long uTag, long *plCount);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical) Gets the number of possible values or choices for the  ISIS® Scanner Driver tag designated in uTag.

The ISISLoadDriver method must be called before calling the ISISGetASCIITagChoiceCount method.

See Also

Elements	ISISGetTagChoice method, ISISGetTag method, ISISSetTag method, ISISSetASCIITag method, ISISGetASCIITag method, ISISGetASCIITagChoice method, ISISGetASCIITagChoiceCount method, ISISAcquire method, ISISAcquireMulti method

Topics	Raster Images: Scanning Images using ISIS


uTag Parameter For ISISGetTagChoiceCount
uTag

One of the supported ISIS® tags.  For more information on tags, refer to ISIS tags.


plCount Parameter For ISISGetTagChoiceCount
plCount

Address of a variable to be updated with the number of possible values or choices for the tag designated in uTag.


Return for ISISGetTagChoiceCount
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


IsISISAvailable property (ISIS Control)
IsISISAvailable property (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	BOOL IsISISAvailable

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical)  Indicates whether ISIS® support DLLs are present.  If IsISISAvailable is TRUE, the ISIS® support DLLs were successfully located and loaded.  If IsISISAvailable is FALSE, the DLLs were not located and were not loaded successfully.

Note: This method only indicates whether the ISIS® support DLLs have been properly installed.  It does not indicate the presence of the scanner driver itself.  You must get the ISIS® scanner driver from either the scanner manufacturer or from Pixel Translations.  The .chn or .chw file must be in your path for ISIS® scanning to work.

See Also

Elements	ISISSelect method

Topics	Raster Images: Scanning Images using ISIS


ISISLoadDriver method (ISIS Control)
ISISLoadDriver method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short ISISLoadDriver (void);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical)  Loads the driver set in the DriverName property.  You must load the ISIS® Driver before calling ISISAcquire, ISISAcquireMulti, ISISGetTag, or ISISSetTag.

If DriverName property is NULL, the currently selected driver will be loaded.

See Also

Elements	ISISLoadDriver method, ISISAcquire method, ISISAcquireMulti method,
ISISGetTag method, ISISSetTag method, DriverName property

Topics	Raster Images: Scanning Images using ISIS


Return for ISISLoadDriver
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISPage event (ISIS Control)
ISISPage event (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	void ISISPage (long nPage, BSTR pszFileName);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical)  ISISPage event is called after each page is acquired by the ISISAcquireMulti method.

You must set the EnableISISEvent property to TRUE, before calling ISISAcquireMulti, in order to generate ISISPage events.

In the ISISPage event, the Bitmap property will hold the current page. You can copy this to a Main Control for further processing, saving, etc.

There are two ways to handle the scanned pages in the ISISPage event.

1. If you set the Bitmap property = 0 before calling ISISAcquireMulti, you must copy the image to a Main Control for processing.

ex.

LEAD1.Bitmap = LEADIsis1.Bitmap

2. If you set the Bitmap property equal to a valid bitmap handle from a Main Control before calling ISISAcquireMulti, you can simply use the Main Control to process the bitmap without making a copy.

ex.

LEAD1.Save (...)

In case #2, you should not attempt to copy from the ISIS® Control to another control.

See Also

Elements	ISISAcquireMulti method, EnableISISEvent property

Topics	Raster Images: Scanning Images using ISIS


nPage Parameter For ISISPage
nPage

Number of the page just scanned.


pszFileName Parameter For ISISPage
pszFileName

Filename into which the page was saved.


ISISSelect method (ISIS Control)
ISISSelect method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short ISISSelect (long hWnd);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical)  Displays the ISIS® Scanner Select dialog box, allowing the user to select an ISIS® driver currently installed, or to add a new ISIS® driver.  The DriverName property will be updated with the selected driver.

See Also

Elements	IsISISAvailable property, DriverName property, ISISLoadDriver method

Topics	Raster Images: Scanning Images using ISIS


hWnd Parameter For ISISSelect
hWnd

Window handle to the ISIS® dialog's parent.


Return for ISISSelect
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISSetASCIITag method (ISIS Control)
ISISSetASCIITag method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ISISSetASCIITag (long uTag, BSTR pszValue);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical) Sets the current value of the ISIS® Scanner Driver tag designated in uTag.

The ISISLoadDriver method must be called before calling the ISISSetASCIITag method.

See Also

Elements	ISISGetASCIITag method, ISISGetASCIITagChoiceCount method, ISISGetASCIITagChoice method, ISISGetTagChoiceCount method, ISISGetTagChoice method, ISISSetTag method, ISISGetTag method, ISISAcquire method, ISISAcquireMulti method

Topics	Raster Images: Scanning Images using ISIS


uTag Parameter For ISISSetASCIITag
uTag

One of the supported ISIS® ASCII tags.  For more information on tags, refer to ISIS ASCII tags.


pszValue Parameter For ISISSetASCIITag
pszValue

String that contains the new value of the tag designated in uTag.


Return for ISISGetASCIITag
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISSetScanOptions method (ISIS Control)
ISISSetScanOptions method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short ISISSetScanOptions (long hWnd);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical)  Displays the ISIS® Scan Options dialog box.  You must call the ISISLoadDriver method before calling ISISSetScanOptions.

See Also

Elements	ISISAcquire method, EnableISISEvent property, PagesDiscarded property, ISISGetTag method, ISISSetTag method, ISISPage event

Topics	Raster Images: Scanning Images using ISIS


hWnd Parameter For ISISSetScanOptions
hWnd

Window handle to the ISIS® dialog's parent.


Return for ISISSetScanOptions
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISSetTag method (ISIS Control)
ISISSetTag method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short ISISSetTag (long uTag, long lValue );

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical)  Sets one of the supported ISIS® Scanner Driver tags.

You must call the ISISLoadDriver method before calling ISISSetTag.

When determining the color format, tags must be set in the following order:

TAG_SAMPLESPERPIXEL

TAG_BITSPERSAMPLE

TAG_COMPRESSION

When setting the following tags, the tags must be set in the following order:

TAG_XRESOLUTION

TAG_YRESOLUTION

TAG_XPOSITION

TAG_YPOSITION

TAG_IMAGELENGTH

TAG_IMAGEWIDTH

See Also

Elements	ISISGetTag method, ISISAcquire method, ISISAcquireMulti method , ISISGetASCIITag method, ,ISISGetASCIITagChoice method , ISISGetASCIITagChoiceCount method , ISISGetTagChoice method , ISISGetTagChoiceCount method , ISISSetASCIITag method

Topics	Raster Images: Scanning Images using ISIS


uTag Parameter For ISISSetTag
uTag

One of the supported ISIS® tags.  For more information on tags, refer to ISIS tags.


lValue Parameter For ISISSetTag
lValue

New value for the tag designated in uTag.


Return for ISISSetTag
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


ISISUnloadDriver method (ISIS Control)
ISISUnloadDriver method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	short ISISUnloadDriver (void);

Overview	Using ISIS® to Scan Images

Remarks

(Document/Medical)  Unloads the ISIS® driver.  You must unload the ISIS® driver when you are finished with ISIS® support.

See Also

Elements	ISISLoadDriver method, ISISAcquire method, ISISAcquireMulti method,
ISISGetTag method, ISISSetTag method, DriverName property

Topics	Raster Images: Scanning Images using ISIS


Return for ISISUnloadDriver
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


IsPtInFloater method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL IsPtInFloater (float fx, float fy);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Lets you see whether a point in the Main Control's client area is in the floater.

This method is commonly used in the MouseDown event to test whether the mouse click selects the floater. The coordinates of the point are relative to the Main Control's client area. The unit of measure is determined by the ScaleMode property. To avoid translating mouse position coordinates, set the scale mode to your development system's default (twips in Visual basic, pixels in C++).

A floater is an additional bitmap that is associated with the Main Control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the Main Control's client area.

See Also

Elements	Floater property, FloaterVisible property

Topics	Raster Images: Copying Images
Raster Images: Creating and Using a Region


fx Parameter For IsPtInFloater
fx

The X coordinate of the point to test. In the MouseDown event, you can use the event's X parameter.


fy Parameter For IsPtInFloater
fy

The Y coordinate of the point to test. In the MouseDown event, you can use the event's Y parameter.


Return for IsPtInFloater
Return Value

Return	Meaning

TRUE	The point is in the floater.

FALSE	The point is outside the floater.


IsPtInRgn method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL IsPtInRgn (float fx, float fy);

Overview	Refer to Creating and Using a Bitmap Region.

Remarks

Determines whether the specified point is in the bitmap's region.

The coordinates of the point are relative to the LEAD bitmap in memory. The unit of measure is determined by the ScaleMode property.

Value	Meaning

TRUE	The bitmap has a region.

FALSE	The bitmap does not have a region.

See Also

Elements	HasRgn property, GetRgnArea method, RgnHeight property, RgnLeft property, RgnTop property, RgnWidth property

Topics	Raster Images: Creating and Using a Region


fx Parameter For IsPtInRgn
fx

The X coordinate of the point to test. In the MouseDown event, you can use the event's X parameter.


fy Parameter For IsPtInRgn
fy

The Y coordinate of the point to test. In the MouseDown event, you can use the event's Y parameter.


Return for IsPtInRgn
Return Value

Return	Meaning

TRUE	The point is in the region.

FALSE	The point is outside the region.


IsSupportLocked method (Mixed Raster Content Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	VARIANT_BOOL IsSupportLocked (MRCSupportLockConstants iType);

Overview	Refer to Working with MRC Bitmap.

Remarks

Indicates whether support is locked for an optional feature, such as JBIG compression support.

To unlock a feature, use the UnlockSupport method.

See Also

Elements	UnlockSupport method

Topics	MRC Bitmap Functions: Auxiliary Elements


iType Parameter For IsSupportLocked (Mixed Raster Content Control)
iType

The optional feature to check.  Possible values are:

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.


IsSupportLocked method (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL IsSupportLocked (short iType);

Overview	Refer to Using the Image List Control.

Remarks

Indicates whether support is locked for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

To unlock a feature, use the UnlockSupport method.

See Also

Elements	UnlockSupport method

Topics	Raster Images: Displaying Images


iType Parameter For IsSupportLocked
iType

The optional feature to unlock.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.


Return for IsSupportLocked
Return Value

Return	Meaning

TRUE	The optional feature is locked.

FALSE	The optional feature is available in your toolkit.


IsSupportLocked method (ISIS Control)
IsSupportLocked method (ISIS® Control)

Visual Basic example   Visual C++ 4.0 example
Visual J++ example

Syntax	BOOL IsSupportLocked (short iType);

Overview	Refer to Miscellaneous Methods and Properties.

Remarks

Indicates whether support is locked for an optional feature, such LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

To unlock a feature, use the UnlockSupport method.

See Also

Topics	Support: Version and License Information


iType Parameter For IsSupportLocked
iType

The optional feature to check.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.


Return for IsSupportLocked
Return Value

Return	Meaning

TRUE	The optional feature is locked.

FALSE	The optional feature is available in your toolkit.


IsSupportLocked method (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	BOOL IsSupportLocked (short iType);

Overview	Refer to Miscellaneous Methods and Properties.

Remarks

Indicates whether support is locked for an optional feature, such LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

To unlock a feature, use the UnlockSupport method.

See Also

Topics	Support: Version and License Information


iType Parameter For IsSupportLocked
iType

The optional feature to check.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.


Return for IsSupportLocked
Return Value

Return	Meaning

TRUE	The optional feature is locked.

FALSE	The optional feature is available in your toolkit.


IsSupportLocked method (OLE DB Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL IsSupportLocked (short iType);

Overview	Refer to Miscellaneous Methods and Properties.

Remarks

Indicates whether support is locked for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

To unlock a feature, use the UnlockSupport method.

See Also

Topics	Support: Version and License Information
Databases: OLE DB, Using a Visual Basic Data Control


iType Parameter For IsSupportLocked
iType

The optional feature to check.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.


Return for IsSupportLockedOLE
Return Value

Return	Meaning

TRUE	The optional feature is locked.

FALSE	The optional feature is available in your toolkit.


IsSupportLocked method (Thumbnail Browser Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL IsSupportLocked (short iType);

Overview	Refer to Thumbnail Browser.

Remarks

Indicates whether support is locked for an optional feature, such as LEADTOOLS Document/Medical capabilities.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

To unlock a feature, use the UnlockSupport method.

See Also

Elements	UnlockSupport method

Topics	Raster Images: Using the Thumbnail Browser


iType Parameter For IsSupportLocked
iType

The optional feature to unlock.

Value	Meaning
L_SUPPORT_BARCODES_1D	Support for reading and writing Linear bar codes. This is available in the LEADTOOLS 1D Module.
L_SUPPORT_BARCODES_PDF_READ	Support for reading PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (read).
L_SUPPORT_BARCODES_PDF_WRITE	Support for writing PDF bar codes. This is available in the LEADTOOLS 2D PDF Module (write).
L_SUPPORT_BARCODES_DATAMATRIX_READ	Support for reading Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (read).
L_SUPPORT_BARCODES_DATAMATRIX_WRITE	Support for writing Data Matrix bar codes. This is available in the LEADTOOLS 2D Data Matrix Module (write).
L_SUPPORT_BITONAL	Support for Scale to Gray and Favor Black processing.
L_SUPPORT_CMW	Support for the CMW file format, which uses Wavelet CMP compression.
L_SUPPORT_DICOM	DICOM file format support, but not the DICOM Communication support.
L_SUPPORT_DOCUMENT	LEADTOOLS Document features . A LEADTOOLS Document license is required
L_SUPPORT_EXTGRAY	Support for 12 bit grayscale, 16-bit grayscale, 48-bit color and 64-bit color image creation and manipulation.
L_SUPPORT_ICR	Support for the ICR Module within the OCR engine. This supports the recognition of handwritten text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_J2K	Unlocks support for JPEG2000 images. The support needs to be unlocked to read and write both types of JPEG 2000 images (JPEG 2000 stream and JP2 files).
L_SUPPORT_LMC	Support for the LMC file formats, which use proprietary LEAD 1-bit compression. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_LTPRO	Support for advanced image processing functions only available in the Raster Pro and above toolkits.
L_SUPPORT_MEDICAL	Support for the capabilities unlocked by L_SUPPORT_DICOM and L_SUPPORT_EXTGRAY, plus all Medical features.
L_SUPPORT_MEDICAL_NET	Support for everything unlocked by L_SUPPORT_MEDICAL, plus support for the unsecure DICOM Network Communication for Message Exchange.
L_SUPPORT_OCR	Support for the OCR features. (Document/Medical).
L_SUPPORT_OCR_ASIAN	Support for the OCR engine to recognize Asian text. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_OCR_PDF_OUTPUT	Support for saving OCR results as a PDF file. This license is in addition to the cost of the OCR Plugin or Document Imaging Suite.
L_SUPPORT_OMR	Support for the OMR Module within the OCR engine. This supports the recognition of check boxes. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_PDF	Support for the PDF, PS and EPS file formats. Available only in the LEADTOOLS PDF Plug in. If this support is locked, the PDF, PS and EPS files will not be loaded or saved.
L_SUPPORT_PDF_SAVE	Support for saving raster images as a PDF file. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selections.
L_SUPPORT_VECTOR	Support for the Vector Features and Vector file formats. Available only in selected LEADTOOLS products. For a list of products, refer to Topic Selection.


Return for IsSupportLocked
Return Value

Return	Meaning

TRUE	The optional feature is locked.

FALSE	The optional feature is available in your toolkit.


Item property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	LEADImageListItem Item(long Index)

Overview	Refer to Using the Image List Control.

Remarks

(Runtime-only) This property returns an item from the ImageList Control's collection of items.

The index of the first item is 0, and the index of the last item is Count -1.

The Item object has the following properties (attributes):

Property	Type	Description
Bitmap	long	The handle to the item’s bitmap
Text	BSTR	The item’s text attribute.
Data	long	Extra data for user-defined use.
Selected	BOOL	Selected flag. True if item is selected. False if item is not selected.
The Bitmap property can be used to copy or change the image that an item is displaying.

The Text property can be displayed as a label for the item if DisplayItemText is set to True.

The Data property can be used to store extra, user-defined information for each item.

The Selected property is used to indicate if an item is selected or not.  When an item is selected, it is displayed according to the value set in the SelectionStyle and SelectionColor properties.

See Also

Elements	Count property, RowCount property, PageCount property, ColumnCount property, Insert method, Remove method, Clear method, SelectAll method, SelectionStyle property, SelectionColor property

Topics	Raster Images: Displaying Images


ItemBackgroundColor property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	OLE_COLOR ItemBackgroundColor

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies the color to use as the background of each item that is displayed.

The default setting is the return value of the Windows API GetSysColor(COLOR_BTNFACE).

See Also

Elements	ItemWidth property, ItemHeight property, ItemVerticalSpacing property, ItemHorizontalSpacing property, DisplayItemText property

Topics	Raster Images: Displaying Images


ItemChecked property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL ItemChecked (short iIndex)

Overview	Refer to Annotation Menu

Remarks

Gets or sets the checked state of the specified menu item. Possible values are:

Value	Meaning

TRUE	The menu item is checked.

FALSE	The menu item is not checked.

This property is associated with the AnnMenu object that is passed to the AnnMenu event.

See Also

Elements	AnnMenu event, Count property, ItemString property, ItemType property, ItemID property, ItemEnabled property, DeleteItem method, AddItem method, GetSubMenu Method

Topics	Annotations (Document/Medical only): Automation


iIndex Parameter For ItemChecked
iIndex

Index into the menu items in the AnnMenu object. This is a zero-based index.


ItemEnabled property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL ItemEnabled (short iIndex)

Overview	Refer to Annotation Menu

Remarks

Gets or sets the enabled state of the specified menu item. Possible values are:

Value	Meaning

TRUE	The menu item is enabled.

FALSE	The menu item is not enabled.

This property is associated with the AnnMenu object that is passed to the AnnMenu event.

See Also

Elements	AnnMenu event, Count property, ItemString property, ItemType property, ItemID property, ItemChecked property, DeleteItem method, AddItem method, GetSubMenu Method

Topics	Annotations (Document/Medical only): Automation


iIndex Parameter For ItemEnabled
iIndex

Index into the menu items in the AnnMenu object. This is a zero-based index.


ItemHeight property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float ItemHeight

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies the height for displayed items.  The unit of measure is determined by the ScaleMode property.

The default setting is 115 pixels.

See Also

Elements	ItemBackgroundColor property, ItemWidth property, ItemVerticalSpacing property, ItemHorizontalSpacing property, DisplayItemText property

Topics	Raster Images: Displaying Images


ItemHorizontalSpacing property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float ItemHorizontalSpacing

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies the horizontal distance between displayed items.  The unit of measure is determined by the ScaleMode property.

The default setting is 5 pixels.

See Also

Elements	ItemBackgroundColor property, ItemWidth property, ItemHeight property, ItemVerticalSpacing property, DisplayItemText property

Topics	Raster Images: Displaying Images


ItemID property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long ItemID (short iIndex)

Overview	Refer to Annotation Menu

Remarks

Gets or sets the command ID value for the specified menu item.

The ID value set must be in the range LTANNEVENT_MENUFIRST [0x0100] to LTANNEVENT_MENULAST [0x01FF].

This property is associated with the AnnMenu object that is passed to the AnnMenu event.

See Also

Elements	AnnMenu event, Count property, ItemString property, ItemType property, ItemChecked property, ItemEnabled property, DeleteItem method, AddItem method, GetSubMenu Method

Topics	Annotations (Document/Medical only): Automation


iIndex Parameter For ItemID
iIndex

Index into the menu items in the AnnMenu object. This is a zero-based index.


ItemSelected event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void ItemSelected (long nIndex);

Overview	Refer to Using the ImageList Control.

Remarks

Occurs when an item’s Selected attribute is automatically set to True in response to the user clicking the item.

See Also

Elements	AllowSelection property, SelectionStyle property, SelectionColor property, Item property

Topics	Raster Images: Displaying Images


nIndex Parameter For ItemSelected
nIndex

The 0-based index of the item that was selected.


ItemString property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BSTR ItemString (short iIndex)

Overview	Refer to Annotation Menu

Remarks

Gets or sets the text to be displayed for the specified menu item.

This property is associated with the AnnMenu object that is passed to the AnnMenu event.

See Also

Elements	AnnMenu event, Count property, ItemID property, ItemType property, ItemChecked property, ItemEnabled property, DeleteItem method, AddItem method, GetSubMenu Method

Topics	Annotations (Document/Medical only): Automation


iIndex Parameter For ItemString
iIndex

Index into the menu items in the AnnMenu object. This is a zero-based index.


ItemType property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short ItemType (short iIndex)

Overview	Refer to Annotation Menu

Remarks

(Read only) Gets the specified menu item’s type. Possible values are:

Value	Meaning

ANNMENUITEMTYPE_NORMAL	[0] Normal menu item.

ANNMENUITEMTYPE_SEPARATOR	[1] Menu item is a separator.

ANNMENUITEMTYPE_SUBMENU	[2] Menu item is a popup menu.

This property is associated with the AnnMenu object that is passed to the AnnMenu event.

See Also

Elements	AnnMenu event, Count property, ItemString property, ItemID property, ItemChecked property, ItemEnabled property, DeleteItem method, AddItem method, GetSubMenu Method

Topics	Annotations (Document/Medical only): Automation


iIndex Parameter For ItemType
iIndex

Index into the menu items in the AnnMenu object. This is a zero-based index.


ItemUnSelected event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void ItemUnSelected (long nIndex);

Overview	Refer to Using the ImageList Control.

Remarks

Occurs when an item’s Selected attribute is automatically set to False in response to the user clicking an item.

See Also

Elements	AllowSelection property, SelectionStyle property, SelectionColor property, Item property, ItemSelected event

Topics	Raster Images: Displaying Images


nIndex Parameter For ItemUnSelected
nIndex

Index of the item unselected. This is a zero-based index.


ItemVerticalSpacing property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float ItemVerticalSpacing

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies the vertical distance between displayed items.  The unit of measure is determined by the ScaleMode property.

The default setting is 5 pixels.

See Also

Elements	ItemBackgroundColor property, ItemWidth property, ItemHeight property, ItemHorizontalSpacing property, DisplayItemText property

Topics	Raster Images: Displaying Images


ItemWidth property (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float ItemWidth

Overview	Refer to Using the Image List Control.

Remarks

(Persistent property, available at design time) Specifies the width for displayed items.  The unit of measure is determined by the ScaleMode property.

The default setting is 115 pixels.

See Also

Elements	ItemBackgroundColor property, ItemHeight property, ItemVerticalSpacing property, ItemHorizontalSpacing property, DisplayItemText property

Topics	Raster Images: Displaying Images


J2KCBS_ErrorResilienceSymbol property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean J2KCBS_ErrorResilienceSymbol

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Boolean value that indicates whether a 4 symbol marker is included for each bit-plane, following the normalization pass. Possible values are:

Value	Meaning

TRUE	A 4 symbol marker is included for each bit-plane, following the normalization pass.

FALSE	A 4 symbol marker is not included for each bit-plane, following the normalization pass.

See Also

Elements	J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KCBS_PredictableTermination property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean J2KCBS_PredictableTermination

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Boolean value that indicates whether the encoder has a predictable termination policy and identifies that the policy was used in the code-stream COD/COC markers. This can be used to implement error detection and concealment. Possible values are:

Value	Meaning

TRUE	The encoder has a predictable termination policy and identifies that the policy was used in the COD/COC markers.

FALSE	The encoder does not have a predictable termination policy.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KCBS_ResetContextOnBoundaries property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean J2KCBS_ResetContextOnBoundaries

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Boolean value that indicates whether the arithmetic coder's probability models are reset between coding passes. This controls where the end of encoded data is and limits the amount of potentially lost data in the event of a transmission error. Possible values are:

Value	Meaning

TRUE	The arithmetic coder's probability models are reset between coding passes.

FALSE	The arithmetic coder's probability models are not reset between coding passes.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KCBS_SelectiveACBypass property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean J2KCBS_SelectiveACBypass

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Boolean value that indicates whether the "lazy coding mode" is adopted. If the lazy coding mode is adopted, trailing bit-planes bypass the arithmetic coder except in the normalization pass. Possible value are:

Value	Meaning

TRUE	The "lazy-coding mode" is adopted. Trailing bit-planes bypass the arithmetic coder except in the normalization pass.

FALSE	The arithmetic encoder will be used on all passes.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KCBS_TerminationOnEachPass property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean J2KCBS_TerminationOnEachPass

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Boolean value that indicates whether the arithmetic code-word generation process stops on a byte boundary at the end of each coding pass. Possible values are:

Value	Meaning

TRUE	The arithmetic code-word generation process stops on a byte boundary at the end of each coding pass.

FALSE	The arithmetic code-word generation process does not stop on a byte boundary at the end of each coding pass.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KCBS_VerticallyCausalContext property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean J2KCBS_VerticallyCausalContext

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Boolean value that indicates whether the context models are restricted to being vertically causal within each sub-block. Possible values are:

Value	Meaning

TRUE	The context models are restricted to being vertically causal within each sub-block.

FALSE	The context models are not restricted to being vertically causal within each sub-block.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KCodBlockHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KCodBlockHeight

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Height of the code block, following wavelet transformation. The value must be a power of 2. It must be at least 4 and less than or equal to 1024.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KCodBlockWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KCodBlockWidth

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Width of the code block, following wavelet transformation. The value must be a power of 2. It must be at least 4 and less than or equal to 1024.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KCompressionControl property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short J2KCompressionControl

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Indicates how to determine the resulting compression. The value of this property determines which property should be used for determining the compression. Possible values are:

Value	Meaning

J2K_COMPRESSION_LOSSLESS	Lossless compression.

J2K_COMPRESSION_RATIO	Compress the file based on the value of the J2KCompressionRatio property.

J2K_COMPRESSION_TARGETSIZE	Compress the file based on the target file size in the J2KTargetFileSize property.

J2K_COMPRESSION_QFACTOR	Compress the file based on the quality factor used when saving the file.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KCompressionRatio property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	float J2KCompressionRatio

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Indicates the compression ratio to use. This value is used only if the J2KCompressionControl property is set to J2K_COMPRESSION_RATIO.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KDecompLevel property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KDecompLevel

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Number of resolution levels in the compressed file. The maximum number of levels depends on the size of the image. Passing values that are too large will cause the save operation to fail.  Each resolution level is one-half the size of the previous resolution, starting with the full image resolution.  The default value is 5.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KDerivedBaseExponent property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KDerivedBaseExponent

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

The base exponent used for derived quantization.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KDerivedBaseMantissa property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KDerivedBaseMantissa

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

The base mantissa used for derived quantization.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KDerivedQuantization property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean J2KDerivedQuantization

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Boolean value that indicates whether to use derived quantization or expounded quantization. Possible values are:

Value	Meaning

TRUE	Use derived quantization.

FALSE	Use expounded quantization.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KGuardBits property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KGuardBits

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Number of extra bits to consider when encoding an image. This prevents coding overflow. Possible values are 0 - 7. The default is 2.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KProgressOrder property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KProgressOrder

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Indicates the order of progression. Possible values are:

Value	Description

J2K_LAYER_RESOLUTION_COMPONENT_POSITION	[0] Quality–axis order.

J2K_RESOLUTION_LAYER_COMPONENT_POSITION	[1] Resolution-axis order.

J2K_RESOLUTION_POSITION_COMPONENT_LAYER	[2] Resolution-axis order.

J2K_POSITION_COMPONENT_RESOLUTION_LAYER	[3] Position–axis order.

J2K_COMPONENT_POSITION_RESOLUTION_LAYER	[4] Color-axis order.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KROIControl property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	J2KRegionOfInterest J2KROIControl

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Flag that indicates how to define the region of interest. Possible values are:

Value	Meaning

J2K_USEOPTION_RECT	[0] Use the rectangle specified in the J2KROILeft, J2KROITop, J2KROIWidth and J2KROIHeight properties to define the region of interest.

J2K_USELEAD_REGION	[1] Use the LEAD bitmap region to define the region of interest.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property, J2KUseROI property, J2KROILeft property, J2KROITop property, J2KROIWidth property, J2KROIHeight property

Topics	Raster Images: Saving Files


J2KROIHeight property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KROIHeight

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Gets or sets the height of a rectangle that defines the region of interest within the image.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property, J2KROIControl property, J2KROITop property, J2KROILeft property, J2KROIWidth property, J2KUseROI property

Topics	Raster Images: Saving Files


J2KROILeft property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KROILeft

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Gets or sets the left coordinate of a rectangle that defines the region of interest within the image.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property, J2KROIControl property, J2KROIHeight property, J2KROITop property, J2KROIWidth property, J2KUseROI property

Topics	Raster Images: Saving Files


J2KROITop property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KROITop

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Gets or sets the top coordinate of a rectangle that defines the region of interest within the image.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property, J2KROIControl property, J2KROIHeight property, J2KROILeft property, J2KROIWidth property, J2KUseROI property

Topics	Raster Images: Saving Files


J2KROIWidth property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KROIWidth

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Gets or sets the width of a rectangle that defines the region of interest within the image.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property, J2KROIControl property, J2KROIHeight property, J2KROITop property, J2KROILeft property, J2KUseROI property

Topics	Raster Images: Saving Files


J2KSetDefaults method (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	short J2KSetDefaults ();

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Updates the J2K properties with the default values used when saving a JPEG 2000 file. To change the values used when saving a JPEG 2000 file, set the following properties:

J2KCBS_ErrorResilienceSymbol property

J2KCBS_PredictableTermination property

J2KCBS_ResetContextOnBoundaries property

J2KCBS_SelectiveACBypass property

J2KCBS_TerminationOnEachPass property

J2KCBS_VerticallyCausalContext property

J2KCodBlockHeight property

J2KCodBlockWidth property

J2KCompressionControl property

J2KCompressionRatio property

J2KDecompLevel property

J2KDerivedBaseExponent property

J2KDerivedBaseMantissa property

J2KDerivedQuantization property

J2KGuardBits property

J2KProgressOrder property

J2KSetDefaults method

J2KTargetFileSize property

J2KUseColorTransform property

J2KUseEPHMarker property

J2KUseSOPMarker property

J2KXOsiz property

J2KXTOsiz property

J2KXTsiz property

J2KYOsiz property

J2KYTOsiz property

J2KYTsiz property

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


Return for J2KSetDefaults
Return Value

Return	Meaning

0	The function was successful.

<>0	An error occurred. Refer to Error Codes.


J2KTargetFileSize property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KTargetFileSize

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Indicates the size of the target file, in bytes. This value is used only if the J2KCompressionControl property is set to J2K_COMPRESSION_TARGETSIZE.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KUseColorTransform property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean J2KUseColorTransform

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Indicates whether to convert an RGB image to YUV space before compressing. (YUV space provides greater compression with higher image quality.) Possible values are:

Value	Meaning

TRUE	Convert to YUV space before compressing. (Default)

FALSE	Do not convert to YUV space before compressing.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KUseEPHMarker property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean J2KUseEPHMarker

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Boolean value that indicates whether to use the EPH marker. Possible values are:

Value	Meaning

TRUE	Use the EPH marker.

FALSE	Do not use the EPH marker. (Default)

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KUseROI property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	BOOL J2KUseROI

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Indicates whether to use a region of interest.  Possible values are:

Setting	Description

TRUE	Use a region of interest as specified in the J2KROIControl property.

FALSE	Do not use a region of interest. If you do not want to use a region of interest, set this property to FALSE. Otherwise, there may be a significant compression and speed performance loss.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property, J2KROIControl property, J2KROILeft property, J2KROITop property, J2KROIWidth property, J2KROIHeight property

Topics	Raster Images: Saving Files


J2KUseSOPMarker property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	boolean J2KUseSOPMarker

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Boolean value that indicates whether to use the SOP marker. Possible values are:

Value	Meaning

TRUE	Use the SOP marker.

FALSE	Do not use the SOP marker. (Default)

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KXOsiz property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KXOsiz

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Horizontal offset from the origin of the reference grid to the left side of the image area.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KXTOsiz property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KXTOsiz

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Horizontal offset from the origin of the reference grid to the left side of the first tile.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KXTsiz property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KXTsiz

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Width of one reference tile, with respect to the reference grid.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KYOsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KYOsiz property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KYOsiz

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Vertical offset from the origin of the reference grid to the top of the image area.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYTOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KYTOsiz property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KYTOsiz

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Vertical offset from the origin of the reference grid to the top of the first tile.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTsiz property

Topics	Raster Images: Saving Files


J2KYTsiz property (Main Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	long J2KYTsiz

Overview	Refer to Implementing JPEG 2000 Plug In Features

Remarks

Height of one reference tile, with respect to the reference grid.

See Also

Elements	J2KCBS_ErrorResilienceSymbol property, J2KCBS_PredictableTermination property, J2KCBS_ResetContextOnBoundaries property, J2KCBS_SelectiveACBypass property, J2KCBS_TerminationOnEachPass property, J2KCBS_VerticallyCausalContext property, J2KCodBlockHeight property, J2KCodBlockWidth property, J2KCompressionControl property, J2KCompressionRatio property, J2KDecompLevel property, J2KDerivedBaseExponent property, J2KDerivedBaseMantissa property, J2KDerivedQuantization property, J2KGuardBits property, J2KProgressOrder property, J2KSetDefaults method, J2KTargetFileSize property, J2KUseColorTransform property, J2KUseEPHMarker property, J2KUseSOPMarker property, J2KXOsiz property, J2KXTOsiz property, J2KXTsiz property, J2KYOsiz property, J2KYTOsiz property

Topics	Raster Images: Saving Files


KeyDown event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void KeyDown (short KeyCode, short Shift);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when the user presses a key while the ImageList Control has the focus. (To interpret ANSI characters, use the KeyPress event.)

See Also

Elements	Resize event, Click event, DblClick event, KeyPress event, KeyUp event, MouseMove event, MouseDown event, MouseUp event, Scroll event

Topics	Raster Images: Displaying Images


KeyCode Parameter For KeyDown
KeyCode

Each development system has its own way of handling key codes. The following topics provide a quick reference:

 Visual Basic Constants for Key Codes.

 Visual C++ Key Codes.

 Visual FoxPro Key Codes.

 Access Key Codes.


Shift Parameter For KeyDown
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. The following are possible values:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


KeyDown event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void KeyDown (short* KeyCode, short Shift);

Overview	Refer to Detecting Events.

Remarks

Occurs when the user presses a key while the Main Control has the focus. (To interpret ANSI characters, use the KeyPress event.)

See Also

Elements	KeyUp event, KeyPress event

Topics	Working with the Control: General Behavior


KeyCode Parameter For KeyDown
KeyCode

Each development system has its own way of handling key codes. The following topics provide a quick reference:

 Visual Basic Constants for Key Codes.

 Visual C++ Key Codes.

 Visual FoxPro Key Codes.

 Access Key Codes.


Shift Parameter For KeyDown
Shift

An integer that indicates which of the SHIFT, CTRL, and ALT keys are down when the button specified in the button argument is pressed. The following are possible values:

Value	Meaning

1	SHIFT key

2	CTRL key

4	ALT key

3	CTRL/SHIFT key

5	ALT/SHIFT key

6	CTRL/ALT key

7	CTRL/ALT/SHIFT key


KeyPress event (ImageList Control)

Visual Basic example   Visual C++ 4.0 example

Syntax	void KeyPress (short KeyAscii);

Overview	Refer to Using the Image List Control.

Remarks

Occurs when the user presses and releases an ANSI key.

See Also

Elements	Resize event, Click event, DblClick event, KeyDown event, KeyUp event, MouseMove event, MouseDown event, MouseUp event, Scroll event

Topics	Raster Images: Displaying Images


KeyAscii Parameter For KeyPress
KeyAscii

The standard numeric ANSI keycode. KeyAscii is passed by reference; changing it sends a different character to the object.  Changing KeyAscii to 0 cancels the keystroke so that the object receives no character.


KeyPress event (Main Control)

Visual Basic example   Visual C++ 4.0 example
Access 2.0 example   Access 95, 97 example   Visual FoxPro example   Visual J++ example

Syntax	void KeyPress (short* KeyAscii);

Overview	Refer to Detecting Events.

Remarks

Occurs when the user presses and releases an ANSI key.

See Also

Elements	KeyDown event, KeyUp event

Topics	Working with the Control: General Behavior


Tutorial for Visual C++ 4.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS ActiveX. Note that the ActiveX requires the MFC 4.2 files, which are described in System Files Updated.

Implementing the LEADTOOLS ActiveX in Visual C++ 4.0 and later is much different than with earlier versions of Visual C++. These instructions were developed with versions 4.0, 4.2, or 5.0 and were tested with version 5.0, except for the Implementing a Database with the MS ADO Data Control tutorial, which requires version 6.0.

For general information about the syntax requirements of this interface, refer to Visual C++ 4.0 Syntax.

Note:	These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Loading and Displaying an Image

Loading and Saving Images Using Databases

Zooming Out and Zooming In

Dynamically Positioning the Control

Zooming In on a Selection

Outlining, Dragging, and Pasting a Region

Creating and Using Annotations

Loading and Saving Annotations Using Databases

Using ODBC to Access Image Data

Implementing a Database with the MS ADO Data Control

Printing Multiple Images

Writing and Reading Multipage Files

Using Transparent Controls

Drawing Simple Lines and Shapes

Cropping a Bitmap

Creating, Viewing, and Merging Color Separations

Updating a Gauge and Detecting a User Interrupt

Creating an MDI Application

Using the Magnifying Glass

Using Imaging Common Dialog

Adding a Color Resolution Dialog

Using a PanWindow

Print a Real Image Size in Inches

Combining Images with Regions

Miscellaneous Examples


Loading and Displaying an Image (Visual C++ 4.0)
Loading and Displaying an Image (C++ 4.0 and later)

Take the following steps to start a project and to add some code that positions, scales, and displays an image in a dialog box.

1.	Start a new project as follows:

For C++ 4.x, run Microsoft Developer Studio for Visual C++, select the File >New menu option, select Project Workspace, and click the OK button. In the New Project Workspace dialog box, do the following:

a.	In the Type list box, select MFC AppWizard (exe).

b.	In the Name text box, specify tutor.

c.	In the Location text box, specify the path of the project.

d.	In the Platforms list box, check Win32.

e.	Click the Create button.

For C++ 5.0, run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:

a.	Click the Projects tab.

b.	Select MFC AppWizard (exe) as the project type

c.	In the Project name text box, specify tutor.

d.	In the Location text box, specify the path of the project.

e.	Click the OK button.

2.	In the Step 1 dialog box, do the following:

a.	Select Dialog based.

b.	Click the Next button.

3.	In the Step 2 of 4 dialog box, do the following:

a.	Ensure that About Box is selected.

b.	Ensure that 3D Controls is selected.

c.	Select OLE Controls (ActiveX Controls in 5.0).

d.	Click the Next button.

4.	In the Step 3 of 4 dialog box, do the following:

a.	For comments, ensure that Yes, Please is selected.

b.	For how to use the MFC library, select As a statically linked library.

c.	Click the Next button.

5.	In the Step 4 of 4 dialog box, just click Finish.

6.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)

7.	Add the L_OCX40.H  and L_OcxErr.H files, which define LEAD constants, to your project as follows:

a.	Copy the \lead\include\l_ocx40.h and l_ocxerr.h files to your project directory.

b.	In the Project Workspace, click the FileView tab.

c.	Double-click the tutor files folder to open it.

d.	Double-click the Dependencies folder (the Header Files folder in 5.0) to open it.

e.	Double-click the StdAfx.h file to edit it.

f.	Add the following line to the end of the file:

#include "L_OCX40.H"

8.	Add a LEAD control to the main window as follows:

For C++ 4.x:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the tutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_TUTOR_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Insert > Component. (The Component Gallery appears.)

g.	Click the OLE Controls tab.

h.	Double-click the LEAD Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLead, CPicture, and COleFont are checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD control appears in the Controls toolbar.)

k.	 Click the LEAD control icon; then size and position the control as you want it to appear at run time.

l.	Double-click the new LEAD control to edit its properties.

m.	Change the ID to IDC_LEAD1.

For C++ 5.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the tutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_TUTOR_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Project > Add To Project > Components and Controls.

g.	Select Registered ActiveX Controls.

h.	Double-click the LEAD Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLead, CPicture, and COleFont are checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD control appears in the Controls toolbar.)

k.	 Click the LEAD control icon; then size and position the control as you want it to appear at run time.

l.	Use the right mouse button to edit the properties of the new LEAD control.

m.	Change the ID to IDC_LEAD1.

9.	 Add a command button to your form and name it as follows:

ID	Caption

IDC_LOADLEAD	Load Image

10.	Press Ctrl-F4 to close all windows back to the Project Workspace.

11.	Do the following to add m_Lead1 to the CTutorDlg class and link the variable to the LEAD control using dynamic data exchange:

a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CTutorDlg.

d.	In the Control IDs list, select IDC_LEAD1.

e.	Click the Add Variable... button.

f.	Specify m_Lead1 as the variable name, and Control as the category.

g.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

12.	Go to the OnInitDialog() function as follows:

a.	In the Project Workspace, click the ClassView tab.

b.	Double-click the tutor classes folder to open it.

c.	Expand the CTutorDlg class.

d.	Double-click the OnInitDialog() function to edit it.

13.	Edit the OnInitDialog() function to add the following code after the line that says //TODO: Add extra initialization here:

// Set defaults for displaying the image.
// These are all persistent properties that can be set in the properties box.
m_Lead1.SetAppearance(APPEARANCE_FLAT);
m_Lead1.SetBorderStyle(1);
m_Lead1.SetBackColor(RGB(255, 255, 125));
m_Lead1.SetPaintDither(PAINTDITHER_DIFFUSION);
m_Lead1.SetPaintPalette(PAINTPALETTE_AUTO);
m_Lead1.SetAutoRepaint(TRUE);
m_Lead1.SetAutoSize(FALSE);
m_Lead1.SetAutoSetRects(TRUE);
m_Lead1.SetPaintSizeMode(PAINTSIZEMODE_FIT);

14.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_LOADLEAD.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnLoadlead).

f.	Click the Edit Code button and enter the following code:

m_Lead1.Load("c:\\lead\\images\\image1.cmp", 0, 0, 1);

15.	To accommodate a 256-color display driver, continue with the remaining steps, which send WM_QUERYNEWPALETTE and WM_PALETTECHANGED messages to the LEADTOOLS ActiveX.

16.	In the Project Workspace, click the FileView tab.

17.	Edit the TUTORDLG.H file and insert the following lines in the definition of CTutorDlg class, just before DECLARE_MESSAGE_MAP():

afx_msg BOOL OnQueryNewPalette();
afx_msg void OnPaletteChanged( CWnd *pwin );

18.	Edit the TUTORDLG.CPP file and insert the following lines between the lines: BEGIN_MESSAGE_MAP(CTutorDlg, CDialog) and END_MESSAGE_MAP():

ON_WM_QUERYNEWPALETTE()
ON_WM_PALETTECHANGED()

19.	Go to the end of TUTORDLG.CPP file and insert the following two functions:

BOOL CTutorDlg::OnQueryNewPalette()
{
  if(!IsWindow(m_Lead1.m_hWnd))
    return FALSE;
  return m_Lead1.SendMessage(WM_QUERYNEWPALETTE);
}

void CTutorDlg::OnPaletteChanged(CWnd* pFocusWnd)
{
  if(pFocusWnd->m_hWnd == m_hWnd || !IsWindow(m_Lead1.m_hWnd))
     return;
  m_Lead1.SendMessage(WM_PALETTECHANGED, (WPARAM) pFocusWnd->m_hWnd);
}

20.	On the main menu, select Build > Build tutor.exe to build the project.

21.	On the main menu, select Build > Execute tutor.exe to run the project.


Loading and Saving Images Using Databases (Visual C++ 5.0)
Loading and Saving Images Using Databases (C++ 5.0 and later)

Take the following steps to start a project and to add some code that demonstrates adding images to or deleting images from the BLOB field of a database file.

You need to create a database file (DB1.MDB) with the fields listed below, before running this tutorial.

Field Name	Type
Image	OleObject
Size	Number
1.	Start a new project as follows:
	Run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:
	a.	Click the Projects tab.
	b.	Select MFC AppWizard (exe) as the project type
	c.	In the Project name text box, specify ImageBlob.
	d.	In the Location text box, specify the path of the project.
	e.	Click the OK button.
2.	In the Step 1 dialog box, do the following:
	a.	Select Dialog based.
	b.	Click the Next button.
3.	In the Step 2 of 4 dialog box, do the following:
	a.	Ensure that About Box is selected.
	b.	Ensure that 3D Controls is selected.
	c.	Select ActiveX Controls.
	d.	Click the Next button.
4.	In the Step 3 of 4 dialog box, do the following:
	a.	For comments, ensure that Yes, Please is selected.
	b.	For how to use the MFC library, select Use MFC in a Shared DLL.
	c.	Click the Next button.
5.	In the Step 4 of 4 dialog box, just click Finish.
6.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)
7.	Add #import and #include statements to your program so you can access the LEAD COM constants and classes:
	a.	In the Project Workspace, click the FileView tab.
	b.	Double-click the ImageBlob files folder to open it.
	c.	Double-click the Header Files folder to open it.
	d.	Double-click the StdAfx.h file to edit it.
	Add the following lines to the end of the file (keep in mind, you may have to change the path to where the header files reside):
#include "..\\..\\ include\\L_OCX40.H"

8.	Add #import statements to your program so you can access the Microsoft ActiveX Data Object 2.6 Library:
	a.	In the Project Workspace, click the FileView tab.
	b.	Double-click the ImageBlob files folder to open it.
	c.	Double-click the Header Files folder to open it.
	d.	Double-click the StdAfx.h file to edit it.
	Add the following lines to the end of the file (keep in mind, you may have to change the path to where the .tlb files reside):
#import <C:\\Windows\\system32\\msado26.tlb> rename("EOF", "ADOEOF")
using namespace ADODB

9.	Add a LEAD Main control to the main window as follows:
	a.	In the Project Workspace, click the ResourceView tab.
	b.	Double-click the ImageBlob resources folder to open it.
	c.	Double-click the Dialog folder to open it.
	d.	Double-click IDD_IMAGEBLOB_DIALOG  to design the form.
	e.	Select the TODO... text control; then press the Delete key to delete it.
	f.	From the main menu, select Project > Add to project > Components and Controls. (The Component Gallery appears.)
	g.	Click the Registered ActiveX Contols.
	h.	Double-click the LEAD Main Control (14) icon. (The Confirm Classes dialog box appears.)
	i.	Ensure that CLEAD, CPicture, and COleFont are checked.
	j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD Main control appears in the Controls toolbar.)
	k.	Click the LEAD Main Control icon; then size and position the control as you want it to appear at run time.
10.	Add six command buttons to your form and name them as follows:
	ID	Caption
	IDC_CONNECT	&Connect To Database
	IDC_DISCONNECT	&Disconnect From Data Base
	IDC_ADDRECORD	&Add Record
	IDC_DELETERECORD	D&elete Record
	IDC_MOVENEXT	Move &Next
	IDC_MOVEPREVIOUS	Move &Previous
11.	Press Ctrl-F4 to close all windows back to the Project Workspace.
12.	Do the following to add m_Lead1 to the CImageBlobDlg class and link the variable to the LEAD Main control using dynamic data exchange:
	a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)
	b.	Click the Member Variables tab.
	c.	In the Class Name box, select CImageBlobDlg.
	d.	In the Control IDs list, select IDC_LEADCTRL1.
	e.	Click the Add Variable... button.
	f.	Specify m_Lead1 as the variable name, and Control as the category.
	g.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.
13.	Do the following to add m_btnAddRecord to the CImageBlobDlg class and link the variable to the CButton control using dynamic data exchange:
	a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)
	b.	Click the Member Variables tab.
	c.	In the Class Name box, select CImageBlobDlg.
	d.	In the Control IDs list, select IDC_ADDRECORD.
	e.	Click the Add Variable... button.
	f.	Specify m_btnAddRecord as the variable name, and Control as the category.
	g.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.
14.	Repeat step 13 for the other buttons, using the following variable names:
	ID	Member Variable Name
	IDC_MOVEPREVIOUS	m_btnMovePrevious
	IDC_MOVENEXT	m_btnMoveNext
	IDC_DISCONNECT	m_btnDisconnect
	IDC_DELETERECORD	m_btnDeleteRecord
	IDC_CONNECT	m_btnConnect
15.	Add the following Member Variables to the CImageBlobDlg class:
	_ConnectionPtr	m_pConnection;
	_RecordsetPtr	m_pRecordset;
16.	Go to the OnInitDialog() function as follows:
	a.	In the Project Workspace, click the ClassView tab.
	b.	Double-click the ImageBlob classes folder to open it.
	c.	Expand the CImageBlobDlg class.
	d.	Double-click the OnInitDialog() function to edit it.
17.	Edit the OnInitDialog() function to add the following code after the line that says //TODO: Add extra initialization here:
   m_Lead1.Load("c:\\parrots.jpg",0,0,1);

   m_pConnection.CreateInstance(__uuidof( Connection) );
   m_pRecordset.CreateInstance(__uuidof(Recordset));

   m_btnMoveNext.EnableWindow(FALSE);
   m_btnMovePrevious.EnableWindow(FALSE);
   m_btnAddRecord.EnableWindow(FALSE);
   m_btnDeleteRecord.EnableWindow(FALSE);

18.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CImageBlobDlg.
	c.	In the Object IDs list box, select IDC_CONNECT.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnConnect).
	f.	Click the Edit Code button and enter the following code: (you will have to change to file name to an existing database file name on your computer)
   HRESULT hr;
   _bstr_t bstrQuery("SELECT * FROM Images");
   _variant_t vNull;
   vNull.vt = VT_ERROR ;
   vNull.scode = DISP_E_PARAMNOTFOUND ;

   if (m_pConnection->State == adStateClosed)
   {
      hr = m_pConnection->Open( _bstr_t(L"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=DB1.mdb;"),
                                  _bstr_t(L""), _bstr_t(L""), adModeUnknown ) ;
   }

   if (SUCCEEDED(hr))
   {
      m_pRecordset->PutRefActiveConnection(m_pConnection);
      hr = m_pRecordset->Open(_variant_t(bstrQuery), vNull, adOpenKeyset, adLockOptimistic, adCmdText );

      if (SUCCEEDED(hr))
      {
         if(!m_pRecordset->GetBOF())
         {
            m_pRecordset->MoveFirst();
         }

         if (!m_pRecordset->GetADOEOF())
         {
            m_btnMoveNext.EnableWindow(TRUE);
            m_btnMovePrevious.EnableWindow(TRUE);
            m_btnDeleteRecord.EnableWindow(TRUE);
         }

         m_btnAddRecord.EnableWindow(TRUE);
      }
   }

19.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CImageBlobDlg.
	c.	In the Object IDs list box, select IDC_DISCONNECT.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnDisconnect).
	f.	Click the Edit Code button and enter the following code:
      if (m_pConnection->State == adStateOpen)
   {
      m_pConnection->Close();
   }

   if (m_pRecordset->State == adStateOpen )
   {
       m_pRecordset->Close();
   }

   m_btnMoveNext.EnableWindow(FALSE);
   m_btnMovePrevious.EnableWindow(FALSE);
   m_btnAddRecord.EnableWindow(FALSE);
   m_btnDeleteRecord.EnableWindow(FALSE);

20.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CImageBlobDlg.
	c.	In the Object IDs list box, select IDC_ADDRECORD.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnAddRecord).
	f.	Click the Edit Code button and enter the following code:
   COleVariant vData;
   long lUBound,lLBound;
   int nSize;

   if (m_pConnection->State == adStateClosed )
   {
      MessageBox (TEXT("Connection closed"));
      return;
   }

   m_pRecordset->AddNew();

   vData.Clear();
   vData = m_Lead1.SaveArray(FILE_BMP,0,0);

   SafeArrayGetUBound(vData.parray, 1, &lUBound);
   SafeArrayGetLBound(vData.parray, 1, &lLBound);
   nSize = lUBound - lLBound + 1;

   m_pRecordset->Fields->Item[_variant_t( (long) 1)]->Value = _variant_t(vData);
   m_pRecordset->Fields->Item[_variant_t( (long) 2)]->Value = _variant_t( (long) nSize);

   m_pRecordset->Update();

   if(m_pRecordset->RecordCount >= 0)
   {
      m_btnMoveNext.EnableWindow(TRUE);
      m_btnMovePrevious.EnableWindow(TRUE);
      m_btnDeleteRecord.EnableWindow(TRUE);
   }

21.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CImageBlobDlg.
	c.	In the Object IDs list box, select IDC_DELETERECORD.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnDeleteRecord).
	f.	Click the Edit Code button and enter the following code:

     if (m_pConnection->State == adStateClosed )
   {
      MessageBox (TEXT("Connection closed"));
      return;
   }

   if (!m_pRecordset->GetBOF() || !m_pRecordset->GetADOEOF())
   {
      m_pRecordset->MoveLast();
      m_pRecordset->Delete(adAffectCurrent);
      m_pRecordset->Update();

      if(m_pRecordset->RecordCount <= 0)
      {
            m_btnMoveNext.EnableWindow(FALSE);
            m_btnMovePrevious.EnableWindow(FALSE);
            m_btnDeleteRecord.EnableWindow(FALSE);
      }
   }

22.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CImageBlobDlg.
	c.	In the Object IDs list box, select IDC_MOVENEXT.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnMoveNext).
	f.	Click the Edit Code button and enter the following code:

   int nSize;
   int nRet;

   if (m_pConnection->State == adStateClosed )
   {
      MessageBox (TEXT("Connection closed"));
      return;
   }

   if (!m_pRecordset->GetADOEOF())
   {
      m_pRecordset->MoveNext();
   }

   if (m_pRecordset->GetADOEOF())
   {
      MessageBox(TEXT("Unable to get the Image from db"));
      m_pRecordset->MovePrevious();
   }
   else
   {
      _variant_t varSize;
      varSize = m_pRecordset->Fields->Item[2L]->Value;
      nSize = varSize.intVal;

      if(nSize)
      {
         _variant_t vData;
         vData = m_pRecordset->Fields->Item[1L]->Value;
         nRet = m_Lead1.LoadArray (vData,0,0,-1, nSize);
      }
  }

23.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CImageBlobDlg.
	c.	In the Object IDs list box, select IDC_MOVEPREVIOUS.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnMovePrevious).
	f.	Click the Edit Code button and enter the following code:

    int nSize;
   int nRet;

   if (m_pConnection->State == adStateClosed )
   {
      MessageBox (TEXT("Connection closed"));
      return;
   }

   if (!m_pRecordset->GetBOF())
   {
      m_pRecordset->MovePrevious();
   }

   if (m_pRecordset->GetBOF())
   {
      MessageBox(TEXT("Unable to get the image from the database"));
      m_pRecordset->MoveNext();
   }
   else
   {
      _variant_t varSize;
      varSize = m_pRecordset->Fields->Item[2L]->Value;
      nSize = varSize.intVal;

      if(nSize)
      {
         _variant_t vData;
         vData = m_pRecordset->Fields->Item[1L]->Value;
         nRet = m_Lead1.LoadArray (vData,0,0,-1, nSize);
      }
   }

24.	On the main menu, select Build > Build ImageBlob.exe to build the project.
25.	On the main menu, select Build > Execute ImageBlob.exe to run the project.


Zooming Out and Zooming In (Visual C++ 4.0)
Zooming Out and Zooming In (C++ 4.0 and later)

Take the following steps to add code that can reduce and enlarge the displayed size of the image. This demonstrates the scaling properties that are normally used for zooming in and zooming out. It emphasizes the relationship of the displayed rectangle to the LEAD control.

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

2.	Go to the Project WorkSpace and click the ResourceView tab.

3.	Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.

4.	 Add two command buttons to your form and name them as follows:

ID	Caption

IDC_ZOOMIN	Zoom In

IDC_ZOOMOUT	Zoom Out

5.	Press Ctrl-F4 to close all windows back to the Project Workspace.

6.	To add code for the Zoom Out button, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_ZOOMOUT.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnZoomout).

f.	Click the Edit Code button, and enter the following code:

m_Lead1.SetAutoSetRects( TRUE);
m_Lead1.SetPaintSizeMode( PAINTSIZEMODE_ZOOM);
if (m_Lead1.GetPaintZoomFactor() > 10)
{
   m_Lead1.SetPaintZoomFactor(m_Lead1.GetPaintZoomFactor() - 10);
}

7.	To add code for the Zoom In button, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_ZOOMIN.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnZoomIn).

f.	Click the Edit Code button, and enter the following code:

m_Lead1.SetAutoSetRects( TRUE);
m_Lead1.SetPaintSizeMode( PAINTSIZEMODE_ZOOM);
m_Lead1.SetPaintZoomFactor(m_Lead1.GetPaintZoomFactor() + 10);

8.	Rebuild and run the application.


Dynamically Positioning the Control (Visual C++ 4.0)
Dynamically Positioning the Control (C++ 4.0 and later)

Take the following steps to dynamically scale and position the LEAD control when loading an image. This example scales the control to use most of the form's area while preserving the image's aspect ratio.

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

2.	Modify the OnLoadlead procedure so that it appears as follows. For a general explanation of how images are positioned and scaled, refer to Displaying an Image.

// Declare local variables.
float HeightFactor, WidthFactor, HeightAllowed, WidthAllowed;
float Width, Height, Left, Top;
CString ImageFile;

// Load the bitmap. This hard-coded path name may be different on your system.
/******* put a valid image path here **********/
ImageFile = "c:\\lead\\images\\image1.cmp";
/**********************************************/

// Get file information
m_Lead1.GetFileInfo(ImageFile, 0, 0);

// Set the variables used for preserving the aspect ratio.
// Allow for a border of 1/8 of the form size.
// The units of measure do not matter, since we are calculating proportions.
HeightFactor = m_Lead1.GetInfoHeight();
WidthFactor = m_Lead1.GetInfoWidth();
CRect rcWindow;
GetClientRect(rcWindow);
HeightAllowed = rcWindow.Height() * 3.0f / 4;
WidthAllowed = rcWindow.Width() * 3.0f / 4;

// Center the LEAD control on the form, preserving the aspect ratio.
// Check to see if using the maximum width will make the image too tall.
// Set the dimensions based on the result.
if(((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed)
{
  Left = rcWindow.Width() / 8.0f;
  Width = WidthAllowed;
  Height = (Width * HeightFactor) / WidthFactor;
  Top = (rcWindow.Height() - Height) / 2;
}
else
{
  Top = rcWindow.Height() / 8.0f;
  Height = HeightAllowed;
  Width = (Height * WidthFactor) / HeightFactor;
  Left = (rcWindow.Width() - Width) / 2;
}
rcWindow.SetRect(0, 0, (int) Width, (int) Height);
rcWindow.OffsetRect((int) Left, (int) Top);
m_Lead1.MoveWindow(rcWindow);

// Set up for handling our own display rectangles.
m_Lead1.SetAutoScroll(FALSE);
m_Lead1.SetAutoSetRects(FALSE);
m_Lead1.SetAutoRepaint(TRUE);

// Set the image display size to match the LEAD control
m_Lead1.SetDstRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.SetDstClipRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());

// Load the bitmap
m_Lead1.Load(ImageFile, 0, 0, 1);


Zooming In on a Selection (Visual C++ 4.0)
Zooming In on a Selection (C++ 4.0 and later)

Take the following steps to add code that lets you select an area with a mouse, and zoom in on the selected area.

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

2.	To add the code for LEAD events, do the following:

a.	Press Ctrl-W to go to the MFC ClassWizard.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_LEAD1.

d.	Continue with the remaining steps for each event.

3.	In the MFC ClassWizard, double-click the MouseDown event and add code as follows:

void CTutorDlg::OnMouseDownLead1(short Button, short Shift, long X, long Y)
{
  m_Lead1.SetAutoRubberBand(TRUE);
  m_Lead1.SetMousePointer(2);
}

4.	In the MFC ClassWizard, double-click the RubberBand event and add code as follows:

void CMfc40Dlg::OnRubberBandLead1()
{
  float zoomleft;
  float zoomtop;
  float zoomwidth;
  float zoomheight;

  m_Lead1.SetMousePointer(0);

  //Zoom in on the selection.
  zoomleft = m_Lead1.GetRubberBandLeft();
  zoomtop = m_Lead1.GetRubberBandTop();
  zoomwidth = m_Lead1.GetRubberBandWidth();
  zoomheight = m_Lead1.GetRubberBandHeight();

  //zoom in on the rectangle defined by the rubberband
  m_Lead1.ZoomToRect(zoomleft, zoomtop, zoomwidth, zoomheight);
  m_Lead1.ForceRepaint();
}

5.	Rebuild and run the application.


Outlining, Dragging, and Pasting a Region (Visual C++ 4.0)
Outlining, Dragging, and Pasting a Region (C++ 4.0 and later)

Take the following steps to add code that lets you outline an area with a mouse, drag a copy of the selected area, and paste the copy into another part of the bitmap:

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

2.	Add another LEAD control with an ID of IDC_LEAD2, set its Visible property to FALSE, and give it a variable name of m_Lead2. (You can follow the same instructions as when adding the first LEAD control.)

3.	Go to the Project WorkSpace and click the FileView tab.

4.	Edit TUTORDLG.H and insert the following lines in the definition of CTutorDlg after DECLARE_MESSAGE_MAP():

BOOL ReadyToDrag;    //The state after marking the region but before dragging
BOOL Dragging;        //The state when the mouse is used for dragging the floater
float StartX;            //Starting X position in screen pixels
float StartY;        //Starting Y position in screen pixels
float FloaterX;        //Floater X position in screen pixels
float FloaterY;        //Floater Y position in screen pixels
float ZoomFactorX;  //Used for translating positioning information
float ZoomFactorY;  //Used for translating positioning information

5.	Go to the Project Workspace and click the ResourceView tab.

6.	Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.

7.	 Add two new buttons to use for selecting and pasting the region. To do this, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box.

8.	Double-click each button and change its values as follows:

ID	Caption

IDC_SELRGN	Select Region

IDC_PASTEFLOATER	Paste Floater

9.	Start the Class Wizard and add code for the IDC_SELRGN button. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_SELRGN.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnSelRgn).

f.	Click the Edit Code button to start entering the code.

10.	Enter new code as follows:

void CTutorDlg::OnSelrgn()
{
   // TODO: Add your control notification handler code here
   m_Lead1.SetRgnMarkingMode(RGNMARK_FREEHAND);
   MessageBox("Draw a freehand region");

}

11.	Start the Class Wizard and add code for the IDC_PASTEFLOATER button. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_PASTEFLOATER.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnPastefloater).

f.	Click the Edit Code button to start entering the code.

12.	Enter new code as follows:

void CTutorDlg::OnPastefloater()
{
   // Variable for the Combine operation.
   long MyOp;

   // Variables for the client area coordinates.
   float LCRgnX, LCRgnY , LCRgnWidth, LCRgnHeight;

   // Variables for the bitmap coordinates.
   float LBRgnX, LBRgnY , LBRgnWidth, LBRgnHeight;

   // Do nothing if there is no floater.
   if (m_Lead1.GetFloater() == 0) return;

   // Set the scale mode to pixels so that we do not have to
   // translate mouse coordinates
   m_Lead1.SetScaleMode(3);

   // Get the floater into another bitmap
   m_Lead2.SetScaleMode(m_Lead1.GetScaleMode());
   m_Lead2.SetBitmap(m_Lead1.GetFloater());

   // Get the floater's client coordinates into local variables.
   LCRgnX = m_Lead1.GetFloaterDstLeft();
   LCRgnY = m_Lead1.GetFloaterDstTop();
   LCRgnWidth = m_Lead1.GetFloaterDstWidth();
   LCRgnHeight = m_Lead1.GetFloaterDstHeight();

   // Delete the floater.
   m_Lead1.SetFloaterVisible(FALSE);
   m_Lead1.SetFloater(0);

   // Translate the client coordinates to bitmap coordinates.
   LBRgnX = ((LCRgnX - m_Lead1.GetDstLeft()) / ZoomFactorX) + m_Lead1.GetSrcLeft();
   LBRgnY = ((LCRgnY - m_Lead1.GetDstTop()) / ZoomFactorY) + m_Lead1.GetSrcTop();
   LBRgnWidth = LCRgnWidth / ZoomFactorX;
   LBRgnHeight = LCRgnHeight / ZoomFactorY;

   // Reposition the region to use as a mask for the Combine method.
   m_Lead1.OffsetRgn(LBRgnX - m_Lead1.GetRgnLeft(), LBRgnY - m_Lead1.GetRgnTop());

   // Use the Combine method to paste the Lead2 bitmap into the Lead1 bitmap.
   MyOp = CB_OP_ADD + CB_DST_0; // Operation flags for a simple paste.
   m_Lead1.Combine(LBRgnX, LBRgnY, LBRgnWidth, LBRgnHeight,
               m_Lead2.GetBitmap(), 0.0f, 0.0f, MyOp);

   // Repaint the part of the client area that has changed.
   m_Lead1.RepaintRect(LCRgnX, LCRgnY, LCRgnWidth, LCRgnHeight, FALSE);

   // Free the region.
   m_Lead1.FreeRgn();

}

13.	To add the code for LEAD mouse events, do the following:

a.	Press Ctrl-W to go to the MFC ClassWizard.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_LEAD1.

d.	Continue with the remaining steps for each mouse event.

14.	In the MFC ClassWizard, double-click the MouseDown event and add code as follows:

void CTutorDlg::OnMouseDownLead1(short Button, short Shift, long X, long Y)
{
   // Declare local variables.
   float BitmapX, BitmapY;
   float NewX, NewY, NewWidth, NewHeight;

   // Do nothing if we are drawing a region.
   if (m_Lead1.GetRgnMarkingMode() != RGNMARK_NONE) return;

   //  Save the starting position, in case we need it.
   StartY = (float)Y;
   StartX = (float)X;

   // if we are ready to drag the selection, get a floater.
   if (ReadyToDrag == TRUE)
   {
      // Translate the current mouse coordinates.
      // These coordinates account for the zoom factor and offset.
      ZoomFactorX = m_Lead1.GetDstWidth() / m_Lead1.GetSrcWidth();
      ZoomFactorY = m_Lead1.GetDstHeight() / m_Lead1.GetSrcHeight();
      BitmapX = (X / ZoomFactorX) - (m_Lead1.GetDstLeft() / ZoomFactorX)
              + m_Lead1.GetSrcLeft();
      BitmapY = (Y / ZoomFactorY) - (m_Lead1.GetDstTop() / ZoomFactorY)
               + m_Lead1.GetSrcTop();

      // Continue to create the floater if the mouse is pointing to
      //  the region we marked.
      if (m_Lead1.IsPtInRgn(BitmapX, BitmapY))
      {
         // Hide the region frame.
         m_Lead1.SetRgnFrameType(RGNFRAME_NONE);

         // Create the floater bitmap, which will be the part of the main bitmap
         // that is in the region's bounding rectangle.
         m_Lead1.SetFloater(m_Lead1.GetBitmap());

         // Translate the bitmap region coordinates to client area coordinates.
         NewY = ((m_Lead1.GetRgnTop() - m_Lead1.GetSrcTop()) * ZoomFactorY)
               + m_Lead1.GetDstTop();
         NewX = ((m_Lead1.GetRgnLeft() - m_Lead1.GetSrcLeft()) * ZoomFactorX)
               + m_Lead1.GetDstLeft();
         NewWidth = m_Lead1.GetRgnWidth() * ZoomFactorX;
         NewHeight = m_Lead1.GetRgnHeight() * ZoomFactorY;

         // Set the initial display position of the floater.
         m_Lead1.SetFloaterDstRect(NewX, NewY, NewWidth, NewHeight);

         // Set form-level variables.
         FloaterY = m_Lead1.GetFloaterDstTop();
         FloaterX = m_Lead1.GetFloaterDstLeft();
         m_Lead1.SetFloaterVisible(TRUE);
         Dragging = TRUE;
         ReadyToDrag = FALSE;
      }
   }
}

15.	In the MFC ClassWizard, double-click the MouseMove event and add code as follows:

void CTutorDlg::OnMouseMoveLead1(short Button, short Shift, long X, long Y)
{
   // Variables for repositioning the floater.
   float NewX, NewY, NewWidth, NewHeight, XDelta, YDelta;

   // Do nothing if we are drawing a region.
   if (m_Lead1.GetRgnMarkingMode() != RGNMARK_NONE) return;

   // Reposition the floater if we are dragging it.
   if ((Dragging == TRUE) && (Button == 1) && (m_Lead1.GetFloater() != 0))
   {
      if (m_Lead1.IsPtInFloater((float)X, (float)Y))
      {
         // Update the position variables.
         XDelta = (float)X - StartX;
         YDelta = (float)Y - StartY;
         NewX = FloaterX + XDelta;
         NewY = FloaterY + YDelta;
         NewWidth = m_Lead1.GetFloaterDstWidth();
         NewHeight = m_Lead1.GetFloaterDstHeight();

         // Reposition the floater.
         m_Lead1.SetFloaterDstRect(NewX, NewY, NewWidth, NewHeight);

         // Save the form-level position variables.
         FloaterY = NewY;
         FloaterX = NewX;
         StartY = (float)Y;
         StartX = (float)X;
      }
   }
}

16.	In the MFC ClassWizard, double-click the MouseUp event and add code as follows:

void CTutorDlg::OnMouseUpLead1(short Button, short Shift, long X, long Y)
{
   //  If we were drawing a region, set up for the next operation.
   if (m_Lead1.GetRgnMarkingMode() != RGNMARK_NONE)
   {
      m_Lead1.SetRgnMarkingMode( RGNMARK_NONE);
      m_Lead1.SetRgnFrameType( RGNFRAME_STATIC);
      ReadyToDrag = TRUE;
      MessageBox("Now, drag the selection to another place.");
   }
}

17.	Run your program to test it.


Creating and Using Annotations (Visual C++ 4.0)
Creating and Using Annotations (C++ 4.0 and later)

Note: This topic is for Document/Medical  only.

Take the following steps to add code that demonstrates the creation and deletion, saving and loading, and copying and pasting of annotation objects. This code also demonstrates the related events. Message boxes prompt for user actions that trigger events.

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

2.	Go to the Project WorkSpace and click the ResourceView tab.

3.	Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.

4.	 Add four new buttons at the top of the form. To do this for each button, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box. Then double-click the button to change its properties. Set the properties as follows:

ID	Caption

IDC_ANNTOGGLE	Start

IDC_IOTOGGLE	Save

IDC_CLIPBOARDTOGGLE	Copy

IDC_REALIZE	Realize

5.	Press Ctrl-F4 to close all windows back to the Project Workspace.

6.	Add code for the user mode toggle button (IDC_ANNTOGGLE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_ANNTOGGLE.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnAnntoggle).

f.	Click the Edit Code button to start entering the code.

void CTutorDlg::OnAnntoggle()
{
   CString Caption;
   // Use the button to toggle between design mode and run mode
   CWnd *pButton = GetDlgItem(IDC_ANNTOGGLE);
   pButton->GetWindowText(Caption);
   if (Caption == "Start")
   {
      m_Lead1.SetAnnUserMode(ANNUSERMODE_DESIGN);
      m_Lead1.SetAnnTool(ANNTOOL_BUTTON);
      // Make run mode the next thing.
      pButton->SetWindowText("Run Mode");
      MessageBox("In design mode now. Draw a button object.");
   }
   else if (Caption == "Design Mode")
   {
      m_Lead1.SetAnnUserMode(ANNUSERMODE_DESIGN);
      m_Lead1.SetAnnTool(ANNTOOL_BUTTON);
      // Make run mode the next thing.
      pButton->SetWindowText("Run Mode");
   }
   else // The button takes us to run mode
   {
      m_Lead1.SetAnnUserMode(ANNUSERMODE_RUN);
      MessageBox("Click on your new button.");
      pButton->SetWindowText("Design Mode");
   }
}

7.	Add code for the load and save toggle button (IDC_IOTOGGLE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_IOTOGGLE.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnIotoggle).

f.	Click the Edit Code button to start entering the code.

void CTutorDlg::OnIotoggle()
{
   CString Caption;
   int nRet;
   // Disable errors so that we can trap our own.
   m_Lead1.SetEnableMethodErrors(FALSE);
   // Use the button to toggle between saving and loading annotations
   CWnd *pButton = GetDlgItem(IDC_IOTOGGLE);
   pButton->GetWindowText(Caption);
   if (Caption == "Save")
   {
      // Do nothing if there are no annotations.
      if (m_Lead1.GetAnnContainer() == 0)
      return;
      // Save the selected annotations.
      nRet = m_Lead1.AnnSave("c:\\lead\\images\\tmp.ann",
         ANNFMT_NATIVE, TRUE, SAVE_OVERWRITE, 0);
      if (nRet == 0)
      {
         pButton->SetWindowText("Load");
         // Make loading the next thing.
         MessageBox("Use the right mouse button to delete any annotations, then click Load.");
      }
      else
      {
         char  buffer[50];
         sprintf(buffer, "LEAD Error %d", nRet);
         MessageBox(buffer, "ERROR", MB_OK);
      }
   }
   else // We are loading annotations
   {
      // Make sure we are in design mode
      m_Lead1.SetAnnUserMode(ANNUSERMODE_DESIGN);
      // Load the annotations.
      nRet = m_Lead1.AnnLoad("c:\\lead\\images\\tmp.ann", 1);
      if (nRet == 0)
         pButton->SetWindowText("Save");
      else
         MessageBox("No annotations to load.");
   }
}

8.	Add code for the clipboard toggle button (IDC_CLIPBOARDTOGGLE). To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following. (Note that Copy, Cut, and Paste are available as automated popup menu options. This code is for tailoring your application.)

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_IOTOGGLE.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnIotoggle).

f.	Click the Edit Code button to start entering the code.

void CTutorDlg::OnClipboardtoggle()
{
   CString Caption;
   int nRet;
   // Disable errors so that we can trap our own.
   m_Lead1.SetEnableMethodErrors(FALSE);
   // Use the button to toggle between copying and pasting annotations
   CWnd *pButton = GetDlgItem(IDC_CLIPBOARDTOGGLE);
   pButton->GetWindowText(Caption);
   if (Caption == "Copy")
   {
      // Do nothing if there are no annotations.
      if (m_Lead1.GetAnnContainer() == 0)
         return;
      // Copy the selected annotations to the clipboard.
      nRet = m_Lead1.AnnCopy(ANNFMT_NATIVE, TRUE, TRUE);
      if (nRet == 0)
      {
         // Make pasting the next thing.
         pButton->SetWindowText("Paste");
         MessageBox("Use the right mouse button to delete any annotations, then click Paste");
      }
      else
      {
         char  buffer[50];
         sprintf(buffer, "LEAD Error %d", nRet);
         MessageBox(buffer, "ERROR", MB_OK);
      }
   }
   else // We are pasting annotations
   {
      // Make sure we are in design mode
      m_Lead1.SetAnnUserMode(ANNUSERMODE_DESIGN);
      // Paste the annotations
      if (m_Lead1.GetAnnPasteReady())
      {
         m_Lead1.AnnPaste();
         pButton->SetWindowText("Copy");
      }
      else
      {
          MessageBox("No annotations to paste");
      }
   }
}

9.	Add code for the realize button (IDC_REALIZE), which renders the annotation objects to the bitmap. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_REALIZE.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnIotoggle).

f.	Click the Edit Code button to start entering the code.

void CTutorDlg::OnRealize()
{
   m_Lead1.AnnRealize(FALSE);
   m_Lead1.ForceRepaint();
   MessageBox("Annotations are now rendered to the bitmap");
}

10.	To add the code for the LEAD control's annotation events, do the following:

a.	Press Ctrl-W to go to the MFC ClassWizard.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_LEAD1.

d.	Continue with the remaining steps for each mouse event.

11.	In the MFC ClassWizard, double-click the AnnCreate event and add code as follows:

void CTutorDlg::OnAnnCreateLead1(long hObject)
{
   //  Update the tag if we need one.
   static int NewTag;
   if ((m_Lead1.AnnGetType(hObject) == ANNOBJECT_BUTTON) ||
      (m_Lead1.AnnGetType(hObject) == ANNOBJECT_HOTSPOT))
   {
      NewTag = NewTag + 1;
      m_Lead1.AnnSetTag(hObject, NewTag);
   }
}

12.	In the MFC ClassWizard, double-click the AnnDrawn event and add code as follows:

void CTutorDlg::OnAnnDrawnLead1(long hObject)
{
   m_Lead1.SetAnnTool(ANNTOOL_SELECT);
   MessageBox("Use the right mouse button to modify this object; then click on Run Mode to test it.");
}

13.	In the MFC ClassWizard, double-click the AnnClicked event and add code as follows:

void CTutorDlg::OnAnnClickedLead1(long hObject)
{
   char  buffer[50];
   sprintf(buffer, " This is what we do for the button tagged %d", m_Lead1.AnnGetTag(hObject));
   MessageBox(buffer, "NOTE", MB_OK);
}

14.	In the MFC ClassWizard, double-click the AnnDestroy event and add code as follows:

void CTutorDlg::OnAnnDestroyLead1(long hObject)
{
   char  buffer[50];
   sprintf(buffer, "The object tagged %d is deleted.", m_Lead1.AnnGetTag(hObject));
   MessageBox(buffer, "NOTE", MB_OK);
}

15.	Compile and run your program to test it.


Loading and Saving Annotations Using Databases (Visual C++ 5.0)
Loading and Saving Annotations Using Databases (C++ 5.0 and later)

Note: This topic is for Document/Medical  only.

Take the following steps to start a project and to add some code that demonstrates adding annotation objects to or deleting annotation objects from the BLOB field of a database file.

You need to create a database file (DB1.MDB) with the fields listed below, before running this tutorial.

Field Name	Type
Image	OleObject
Size	Number
1.	Start a new project as follows:
	Run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:
	a.	Click the Projects tab.
	b.	Select MFC AppWizard (exe) as the project type
	c.	In the Project name text box, specify AnnBlob.
	d.	In the Location text box, specify the path of the project.
	e.	Click the OK button.
2.	In the Step 1 dialog box, do the following:
	a.	Select Dialog based.
	b.	Click the Next button.
3.	In the Step 2 of 4 dialog box, do the following:
	a.	Ensure that About Box is selected.
	b.	Ensure that 3D Controls is selected.
	c.	Select ActiveX Controls.
	d.	Click the Next button.
4.	In the Step 3 of 4 dialog box, do the following:
	a.	For comments, ensure that Yes, Please is selected.
	b.	For how to use the MFC library, select Use MFC in a Shared DLL.
	c.	Click the Next button.
5.	In the Step 4 of 4 dialog box, just click Finish.
6.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)
7.	Add #import and #include statements to your program so you can access the LEAD COM constants and classes:
	a.	In the Project Workspace, click the FileView tab.
	b.	Double-click the AnnBlob files folder to open it.
	c.	Double-click the Header Files folder to open it.
	d.	Double-click the StdAfx.h file to edit it.
	Add the following lines to the end of the file (keep in mind, you may have to change the path to where the header files reside):
#include "..\\..\\ include\\L_OCX40.H"

8.	Add #import statements to your program so you can access the Microsoft ActiveX Data Object 2.6 Library:
	a.	In the Project Workspace, click the FileView tab.
	b.	Double-click the AnnBlob files folder to open it.
	c.	Double-click the Header Files folder to open it.
	d.	Double-click the StdAfx.h file to edit it.
	Add the following lines to the end of the file (keep in mind, you may have to change the path to where the .tlb files reside):
#import <C:\\Windows\\system32\\msado26.tlb> rename("EOF", "ADOEOF")
using namespace ADODB

9.	Add a LEAD Main control to the main window as follows:
	a.	In the Project Workspace, click the ResourceView tab.
	b.	Double-click the AnnBlob resources folder to open it.
	c.	Double-click the Dialog folder to open it.
	d.	Double-click IDD_ANNBLOB_DIALOG  to design the form.
	e.	Select the TODO... text control; then press the Delete key to delete it.
	f.	From the main menu, select Project > Add to project > Components and Controls. (The Component Gallery appears.)
	g.	Click the Registered ActiveX Contols.
	h.	Double-click the LEAD Main Control (14) icon. (The Confirm Classes dialog box appears.)
	i.	Ensure that CLead, CPicture, and COleFont are checked.
	j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD Main control appears in the Controls toolbar.)
	k.	Click the LEAD Main control icon; then size and position the control as you want it to appear at run time.
10.	Add six command buttons to your form and name them as follows:
	ID	Caption
	IDC_CONNECT	&Connect To Database
	IDC_DISCONNECT	&Disconnect From Data Base
	IDC_ADDRECORD	&Add Record
	IDC_DELETERECORD	D&elete Record
	IDC_MOVENEXT	Move &Next
	IDC_MOVEPREVIOUS	Move &Previous
11.	Press Ctrl-F4 to close all windows back to the Project Workspace.
12.	Do the following to add m_Lead1 to the CAnnBlobDlg class and link the variable to the LEAD Main control using dynamic data exchange:
	a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)
	b.	Click the Member Variables tab.
	c.	In the Class Name box, select CAnnBlobDlg.
	d.	In the Control IDs list, select IDC_LEADCTRL1.
	e.	Click the Add Variable... button.
	f.	Specify m_Lead1 as the variable name, and Control as the category.
	g.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.
13.	Do the following to add m_btnAddRecord to the CAnnBlobDlg class and link the variable to the CButton control using dynamic data exchange:
	a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)
	b.	Click the Member Variables tab.
	c.	In the Class Name box, select CAnnBlobDlg.
	d.	In the Control IDs list, select IDC_ADDRECORD.
	e.	Click the Add Variable... button.
	f.	Specify m_btnAddRecord as the variable name, and Control as the category.
	g.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.
14.	Repeat step 13 for the other buttons, using the following variable names:
	ID	Member Variable Name
	IDC_MOVEPREVIOUS	m_btnMovePrevious
	IDC_MOVENEXT	m_btnMoveNext
	IDC_DISCONNECT	m_btnDisconnect
	IDC_DELETERECORD	m_btnDeleteRecord
	IDC_CONNECT	m_btnConnect
15.	Add the following Member Variables to the CAnnBlobDlg class:
	_ConnectionPtr	m_pConnection;
	_RecordsetPtr	m_pRecordset;
16.	Go to the OnInitDialog() function as follows:
	a.	In the Project Workspace, click the ClassView tab.
	b.	Double-click the AnnBlob classes folder to open it.
	c.	Expand the CAnnBlobDlg class.
	d.	Double-click the OnInitDialog() function to edit it.
17.	Edit the OnInitDialog() function to add the following code after the line that says //TODO: Add extra initialization here:
   m_Lead1.UnlockSupport(L_SUPPORT_DOCUMENT,L_KEY_DOCUMENT);

   m_Lead1.Load("c:\\parrots.jpg",0,0,1);

   CAnnToolbar AnnToolbar = m_Lead1.GetAnnToolbar();
   AnnToolbar.SetVisible(TRUE);
   AnnToolbar.Create(10, 10, ANNTOOLALIGN_TOP);

   m_Lead1.SetAnnUserMode(ANNUSERMODE_DESIGN);

   m_pConnection.CreateInstance(__uuidof( Connection) );
   m_pRecordset.CreateInstance(__uuidof(Recordset));

   m_btnMoveNext.EnableWindow(FALSE);
   m_btnMovePrevious.EnableWindow(FALSE);
   m_btnAddRecord.EnableWindow(FALSE);
   m_btnDeleteRecord.EnableWindow(FALSE);

18.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CAnnBlobDlg.
	c.	In the Object IDs list box, select IDC_CONNECT.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnConnect).
	f.	Click the Edit Code button and enter the following code: (you will have to change to file name to an existing database file name on your computer)
   HRESULT hr;
   _bstr_t bstrQuery("SELECT * FROM Images");
   _variant_t vNull;
   vNull.vt = VT_ERROR ;
   vNull.scode = DISP_E_PARAMNOTFOUND ;

   if (m_pConnection->State == adStateClosed)
   {
      hr = m_pConnection->Open( _bstr_t(L"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=DB1.mdb;"),
                                  _bstr_t(L""), _bstr_t(L""), adModeUnknown ) ;
   }

   if (SUCCEEDED(hr))
   {
      m_pRecordset->PutRefActiveConnection(m_pConnection);
      hr = m_pRecordset->Open(_variant_t(bstrQuery), vNull, adOpenKeyset, adLockOptimistic, adCmdText );

      if (SUCCEEDED(hr))
      {
         if(!m_pRecordset->GetBOF())
         {
            m_pRecordset->MoveFirst();
         }

         if (!m_pRecordset->GetADOEOF())
         {
            m_btnMoveNext.EnableWindow(TRUE);
            m_btnMovePrevious.EnableWindow(TRUE);
            m_btnDeleteRecord.EnableWindow(TRUE);
         }

         m_btnAddRecord.EnableWindow(TRUE);
      }
   }

19.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CAnnBlobDlg.
	c.	In the Object IDs list box, select IDC_DISCONNECT.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnDisconnect).
	f.	Click the Edit Code button and enter the following code:
      if (m_pConnection->State == adStateOpen)
   {
      m_pConnection->Close();
   }

   if (m_pRecordset->State == adStateOpen )
   {
       m_pRecordset->Close();
   }

   m_btnMoveNext.EnableWindow(FALSE);
   m_btnMovePrevious.EnableWindow(FALSE);
   m_btnAddRecord.EnableWindow(FALSE);
   m_btnDeleteRecord.EnableWindow(FALSE);

20.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CAnnBlobDlg.
	c.	In the Object IDs list box, select IDC_ADDRECORD.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnAddRecord).
	f.	Click the Edit Code button and enter the following code:
   COleVariant vData;
   long lUBound,lLBound;
   int nSize;
   int nRet;

   if (m_pConnection->State == adStateClosed )
   {
      MessageBox (TEXT("Connection closed"));
      return;
   }

   m_pRecordset->AddNew();

   vData.Clear();
   nRet = m_Lead1.AnnSaveArray (&vData,ANNFMT_NATIVE, false, SAVE_OVERWRITE, 0);

   SafeArrayGetUBound(vData.parray, 1, &lUBound);
   SafeArrayGetLBound(vData.parray, 1, &lLBound);
   nSize = lUBound - lLBound + 1;

   m_pRecordset->Fields->Item[_variant_t( (long) 1)]->Value = _variant_t(vData);
   m_pRecordset->Fields->Item[_variant_t( (long) 2)]->Value = _variant_t( (long) nSize);

   m_pRecordset->Update();

   if(m_pRecordset->RecordCount >= 0)
   {
      m_btnMoveNext.EnableWindow(TRUE);
      m_btnMovePrevious.EnableWindow(TRUE);
      m_btnDeleteRecord.EnableWindow(TRUE);
   }

21.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CAnnBlobDlg.
	c.	In the Object IDs list box, select IDC_DELETERECORD.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnDeleteRecord).
	f.	Click the Edit Code button and enter the following code:

     if (m_pConnection->State == adStateClosed )
   {
      MessageBox (TEXT("Connection closed"));
      return;
   }

   if (!m_pRecordset->GetBOF() || !m_pRecordset->GetADOEOF())
   {
      m_pRecordset->MoveLast();
      m_pRecordset->Delete(adAffectCurrent);
      m_pRecordset->Update();

      if(m_pRecordset->RecordCount <= 0)
      {
            m_btnMoveNext.EnableWindow(FALSE);
            m_btnMovePrevious.EnableWindow(FALSE);
            m_btnDeleteRecord.EnableWindow(FALSE);
      }
   }

22.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CAnnBlobDlg.
	c.	In the Object IDs list box, select IDC_MOVENEXT.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnMoveNext).
	f.	Click the Edit Code button and enter the following code:

    int nSize;
   int nRet;

   if (m_pConnection->State == adStateClosed )
   {
      MessageBox (TEXT("Connection closed"));
      return;
   }

   if (!m_pRecordset->GetADOEOF())
   {
      m_pRecordset->MoveNext();
   }

   if (m_pRecordset->GetADOEOF())
   {
      MessageBox(TEXT("Unable to get the annotation from the database"));
      m_pRecordset->MovePrevious();
   }
   else
   {
      _variant_t varSize;
      varSize = m_pRecordset->Fields->Item[2L]->Value;
      nSize = varSize.intVal;

      if(nSize)
      {
         _variant_t vData;
         vData = m_pRecordset->Fields->Item[1L]->Value;
         nRet = m_Lead1.AnnLoadArray (vData, nSize, 1);
      }
  }

23.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:
	a.	Click the Message Maps tab.
	b.	In the Class Name combo box, select CAnnBlobDlg.
	c.	In the Object IDs list box, select IDC_MOVEPREVIOUS.
	d.	In the Messages list box, select BN_CLICKED.
	e.	Click the Add function button. Choose OK for the default function name (OnMovePrevious).
	f.	Click the Edit Code button and enter the following code:

   int nSize;
   int nRet;

   if (m_pConnection->State == adStateClosed )
   {
      MessageBox (TEXT("Connection closed"));
      return;
   }

   if (!m_pRecordset->GetBOF())
   {
      m_pRecordset->MovePrevious();
   }

   if (m_pRecordset->GetBOF())
   {
      MessageBox(TEXT("Unable to get the annotation from the database"));
      m_pRecordset->MoveNext();
   }
   else
   {
      _variant_t varSize;
      varSize = m_pRecordset->Fields->Item[2L]->Value;
      nSize = varSize.intVal;

      if(nSize)
      {
         _variant_t vData;
         vData = m_pRecordset->Fields->Item[1L]->Value;
         nRet = m_Lead1.AnnLoadArray (vData, nSize, 1);
      }
  }

24	Open the ANNBLOBDLG.CPP file and add the following line after the #include statements:
#include "anntoolbar.h"

26.	On the main menu, select Build > Build AnnBlob.exe to build the project.
27.	On the main menu, select Build > Execute AnnBlob.exe to run the project.


Using ODBC to Access Image Data (Visual C++ 4.0)
Using ODBC to Access Image Data (C++ 4.0 and later)

This lesson describes how to use the LEADTOOLS ODBC features to maintain images in a table with other data. In this lesson, you accomplish the following:

 Create a database with one table containing images and names for the images.

 Create an ODBC data source that references the table.

 Use a DAO recordset to manage the table and to access the names.

 Use the LEADTOOLS methods to access the images through the ODBC data source.

 Use SQL SELECT statements to maintain a sorted view of the records.

 Synchronize the record pointers so that the two views of the same table are always correct.

Note:	The LEADTOOLS ActiveX requires ODBC drivers that can properly handle long binary fields. Examples have been tested and will work with version 3.0 of the Microsoft ODBC Desktop Driver Pack. (This driver pack ships with Access 95 and works on 32-bit systems.) You can download drivers from the LEAD BBS, the CompuServe forum, or the Worldwide Web home page. The CompuServe forum is at GO LEADTECH. The web page is ftp://ftp.leadtools.com/pub/utils/ODBC32.zip. The file to download is ODBC32.ZIP.

1.	Use a database manager to create an ACCESS MBD database with one table that has two fields. Use the following specifications:

a.	Database name: leadpic.mdb.

b.	Table name: people.

c.	Field name: who. Data Type: text. Size: 255.

d.	Field name: photo. Data Type: Long Binary. Size: N/A.

2.	Create an ODBC data source that references the same database follows:

a.	From the Windows Control Panel, open the ODBC administrator and click the Add button.

b.	Select Microsoft Access driver and click the OK button.

c.	Enter the name LEADODBC.

d.	Click the Select directory button and select the path to the database that you created.

e.	Click the OK button; click the next OK button; then click the Close button.

3.	Start the Microsoft Developer Studio for Visual C++, version 4.0.

4.	Select the File >New menu option, select Project Workspace, and click the OK button.

5.	In the New Project Workspace dialog box, do the following:

a.	In the Type list box, select MFC AppWizard (exe).

b.	In the Name text box, specify ltcdb.

c.	In the Location text box, specify the path of the project.

d.	In the Platforms list box, check Win32.

e.	Click the Create button.

6.	In the Step 1 dialog box, do the following:

a.	Select Single document.

b.	Click the Next button.

7.	In the Step 2 of 6 dialog box, do the following:

a.	Select Database view without file support.

b.	Click the Data Source button.

c.	Select DAO and use the browser to specify the leadpic.mdb database that you created earlier.

d.	Ensure that Dynaset and Detect dirty columns are selected and click the OK button.

e.	Select the people table and click the OK button.

f.	Click the Next button.

8.	In the Step 3 of 6 dialog box, do the following:

a.	For OLE compound document support, ensure that None is selected.

b.	For OLE support, select OLE Controls.

c.	Click the Next button.

9.	In the Step 4 of 6 dialog box, do the following:

a.	For supported features, select only Docking toolbar and 3D controls.

b.	Click the Next button.

10.	In the Step 5 of 6 dialog box, do the following:

a.	For comments, ensure that Yes, Please is selected.

b.	For how to use the MFC library, select As a statically linked library.

c.	Click the Next button.

11.	In the Step 6 of 6 dialog box, just click Finish.

12.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)

13.	Add the L_OCX40.H and L_OcxErr.H files, which define LEAD constants, to your project as follows:

a.	Copy the \lead\include\l_ocx40.h and l_ocxerr.h files to your project directory.

b.	In the Project Workspace, click the FileView tab.

c.	Double-click the ltcdb files folder to open it.

d.	Double-click the Dependencies folder to open it.

e.	Double-click the StdAfx.h file to edit it.

f.	Add the following line to the end of the file:

#include "L_OCX40.H"

14.	Add a LEAD control to the Controls toolbar as follows:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the ltcdb resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_LTCDB_FORM to design the form.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Insert > Component. (The Component Gallery appears.)

g.	Click the OLE Controls tab.

h.	Double-click the LEAD Control icon. (The Confirm Classes dialog box appears.)

i.	Ensure that both CLead and CPicture are checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD control appears in the Controls toolbar.)

15.	Add the LEAD control to your form as follows:

a.	 Click the LEAD control icon; then click and drag on the form to size and position the control.

b.	Double-click the new LEAD control to edit its properties.

c.	Change the ID to IDC_LEAD1 and change the BorderStyle property to 1 - Fixed Single.

16.	Add an edit box for the image name and bind it to the database as follows:

a.	Click the Edit Box icon; then click and drag on the form to size and position the control.

b.	Double-click the new Edit Box control to edit its properties.

c.	Change the ID to IDC_Cwho.

d.	Hold down the Ctrl key and double click the control.

e.	For the Member variable name, select m_pSet->m_who, and click the OK button.

17.	Do the following to add m_Lead1 to the CLtcdbView class and link the variable to the LEAD control using dynamic data exchange:

a.	Open the ClassWizard (CTRL-W).

b.	Click the Member Variables tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Control IDs list, select IDC_LEAD1.

e.	Click the Add Variable... button.

f.	Specify m_Lead1 as the variable name, and Control as the category.

g.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

18.	Edit LTCDBVIEW.H and insert the following lines in the definition of CLtcdbView after DECLARE_MESSAGE_MAP():

// These variables let us synchronize the LEAD control's ODBC access with the
// the normal database access
long OldPosition, NewPosition;

// This variable lets us make the dbMove method conditional
BOOL NormalMove;

19.	Edit the CLtcdbView::OnInitialUpdate() function and add the following code to the end of the function:

// Turn off automatic scrolling and repainting
m_Lead1.SetAutoScroll(FALSE);
m_Lead1.SetAutoRepaint(FALSE);

// Open the database.
// Use the same SELECT statement that is used for the data control.
// Note that the image field must be listed first in the SELECT statement.
int nRet = m_Lead1.dbOpen("ODBC;DSN=LEADODBC", "SELECT photo FROM people ORDER BY who", "photo", DB_OPENOPTIONS_NONE);

// Set the LEAD control's database properties
m_Lead1.SetDbLoadBits(24);
m_Lead1.SetDbLockingMode(DB_LOCKINGMODE_OPTIMISTIC);

// Enable use of the dbMove method in the data control's Reposition event
NormalMove = TRUE;
NewPosition = 0;

20.	Disable the DAO recordset's access of the photo field. (We will access this field through the LEAD control.) To disable the recordset's access, do the following:

a.	Edit the CLtcdbSet::CLtcdbSet function to change m_nFields = 2 to m_nFields = 1.

b.	Edit the CLtcdbSet::DoFieldExchange function and remove the following statement: DFX_LongBinary(pFX, _T("[photo]"), m_photo);

c.	Edit the CLtcdbSet.h file to remove the following line: CLongBinary    m_photo;

21.	Edit the CLtcdbSet::GetDefaultSQL function to use an SQL SELECT statement as follows:

CString CLtcdbSet::GetDefaultSQL()
{
  return "SELECT who FROM people ORDER BY who";
}

22.	Add the LEAD control's Change event as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CLtcdbView.

c.	In the Object IDs list box, select IDC_LEAD1.

d.	In the Messages list box, select Change.

e.	Click the Add function button. Choose OK for the default function name (OnChangeLead1).

f.	Click the Edit Code button, and edit the function so that it appears as follows:

void CLtcdbView::OnChangeLead1()
{
  // Avoid sizing images that are not loaded.
  if (m_Lead1.GetBitmap() == 0)
  {
    m_Lead1.ForceRepaint(); // So we can see when images are missing.
    return;
  }

  // Calculate the display rectangle to fit the image inside the control
  float HeightAllowed = m_Lead1.GetScaleHeight();
  float WidthAllowed = m_Lead1.GetScaleWidth();
  float XProportion = m_Lead1.GetBitmapWidth();
  float YProportion = m_Lead1.GetBitmapHeight();
  float DisplayTop;
  float DisplayHeight;
  float DisplayWidth;
  float DisplayLeft;

  // See if using the allowed height makes the image too wide.
  if ((HeightAllowed * XProportion / YProportion) <= WidthAllowed)
  {   // Use the allowed height.
    DisplayTop = (float)0;
    DisplayHeight = HeightAllowed;
    DisplayWidth = DisplayHeight * XProportion / YProportion;
    DisplayLeft = (WidthAllowed - DisplayWidth) / 2;
  }
  else
  {   // Use the allowed width.
    DisplayLeft = (float)0;
    DisplayWidth = WidthAllowed;
    DisplayHeight = DisplayWidth * YProportion / XProportion;
    DisplayTop = (HeightAllowed - DisplayHeight) / 2;
  }

  // Set the image display size
  m_Lead1.SetDstRect(DisplayLeft, DisplayTop, DisplayWidth, DisplayHeight);
  m_Lead1.SetDstClipRect(DisplayLeft, DisplayTop, DisplayWidth, DisplayHeight);
  m_Lead1.ForceRepaint();
}

23.	Add the code for the LEAD control to close the database when the application ends. To do so, open the ClassWizard (CTRL-W), and do the following:

a.	In the Class name combo box, select CLtcdbView.

b.	In the Object IDs list box, select CLtcdbView.

c.	In the Messages list box, select WM_DESTROY.

d.	Click the Add function button. Choose OK for the default function name (OnDestroy).

e.	Click the Edit Code button to start entering the code.

f.	Edit the function to appear as follows:

void CLtcdbView::OnDestroy()
{
  CLtcdbView::OnDestroy();
  // TODO: Add your message handler code here
  m_Lead1.dbClose();
}

24.	Add code to synchronize the LEAD control's record pointer with the DAO recordset's record pointer. To do so, add the following to the end of the CLtcdbView::DoDataExchange function:

if ((NormalMove == TRUE) && (NewPosition != m_pSet->GetAbsolutePosition()))
{
  OldPosition = NewPosition;
  NewPosition = m_pSet->GetAbsolutePosition();
  m_Lead1.dbMove(NewPosition - OldPosition);
}

25.	In this step and the next one, change the resource file to add some buttons. For the first button, do the following:

a.	Click on the ResourceView tab of the Project Workspace.

b.	Double-click on the ltcdb resources folder.

c.	Double-click on Dialog.

d.	Double-click on IDD_LTCDB_FORM.

e.	Select the command button control on the Controls toolbar.

f.	Click and drag on the dialog window to create and position the button.

g.	Double-click the button just created to bring up the Push Button Properties window.

h.	Change the ID to IDC_ADDNEW and the caption to Add Record.

i.	Close the window.

26.	For the other buttons, repeat the preceding step with the following differences for each button:

- With an ID of IDC_FLIP and caption Flip Photo

- With an ID of IDC_DELETE and caption Delete Record

27.	Add code for the IDC_ADDNEW button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CLtcdbView.

c.	In the Object IDs list box, select IDC_ADDNEW.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnAddnew).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CLtcdbView::OnAddnew()
{
  // Make sure we can add records to the database.
  if (!m_pSet->CanUpdate())
  {
    MessageBox("You cannot update this database.", "ERROR");
    return;
  }

  // Get the name of the file to load.
  // This filter list is complete, except for GIF.
  CString ImageFilter = "Graphics|*.cmp; *.jpg; *.jff; *.jtf; *.bmp; *.tif; *.tga; *.pcx; *.cal; *.mac; *.mac; *.img; *.msp; *.wpg; *.wpg; *.ras; *.pct; *.pcd; *.eps; *.wmf||";
  CFileDialog  OpenFile(TRUE, NULL, NULL,0,ImageFilter);
  if (OpenFile.DoModal() != IDOK)
    return;
  CWaitCursor wait;  // Display an hourglass
  CString MyFile = OpenFile.GetPathName();

  // Disable the normal synchronization code and hide the LEAD control
  // while we manipulate the recordsets.
  NormalMove = FALSE;
  m_Lead1.ShowWindow (SW_HIDE);

  // Add a record to the DAO recordset.
  m_pSet->AddNew();
  SetDlgItemText(IDC_Cwho, MyFile);
  UpdateData();

try
  {
    m_pSet->Update();
  }
  catch( CDaoException* e )
  {
    AfxMessageBox(
        e->m_pErrorInfo->m_strDescription,
        MB_ICONEXCLAMATION );
    m_pSet->CancelUpdate();
    UpdateData(FALSE);
    m_Lead1.ShowWindow(SW_NORMAL);
    NormalMove = TRUE;
    return;
  }

  // Requery the DAO recordset and wait for the change to take effect.
  m_pSet->Requery();
  Sleep(5000);

  // Requery the LEAD recordset and make sure the recordsets match.
  m_Lead1.dbRequery();
  m_pSet->MoveFirst();
  NewPosition = 0;
  m_pSet->MoveLast();

  if (NewPosition != m_pSet->GetAbsolutePosition())
  {
    OldPosition = NewPosition;
    NewPosition = m_pSet->GetAbsolutePosition();
    m_Lead1.dbMove(NewPosition - OldPosition);
  }

  if(m_Lead1.GetDbCurrentRecord() != m_pSet->GetAbsolutePosition())
  {
    MessageBox("Synchronization error!\nDelete the record and exit", "ERROR", MB_OK);
    m_pSet->FindFirst(CString("who = '") + MyFile + CString("'"));
    return;
  }

  // Find the record we just added and synchronize the recordsets.
  m_pSet->FindFirst(CString("who = '") + MyFile + CString("'"));
  if (NewPosition != m_pSet->GetAbsolutePosition())
  {
    OldPosition = NewPosition;
    NewPosition = m_pSet->GetAbsolutePosition();
    m_Lead1.dbMove(NewPosition - OldPosition);
  }

  // Use return values to trap errors.
  BOOL ErrHand = m_Lead1.GetEnableMethodErrors(); // Save the current setting.
  m_Lead1.SetEnableMethodErrors(FALSE);

  // Redisplay the LEAD control, load the image, update the record,
  // and restore normal recordset synchronization.
  m_Lead1.ShowWindow(SW_NORMAL);
  m_Lead1.dbEdit();
  int nRet = m_Lead1.Load(MyFile, 24, 0, 1);
  if (nRet != 0)
  {
    char  buffer[50];
    sprintf(buffer, "LEAD Error %d loading image.", nRet);
    MessageBox(buffer, "ERROR", MB_OK);
  }

  // Update the recordset using the appropriate format
  if (m_Lead1.GetBitmapBits() == 1)
     nRet = m_Lead1.dbUpdate(FILE_LEAD1BIT, 1, 0);
  else if  (m_Lead1.GetBitmapBits() == 4)
     nRet = m_Lead1.dbUpdate(FILE_PCX, 4, 0);
  else if (m_Lead1.GetIsGrayscale() == GRAY_NO)
     nRet = m_Lead1.dbUpdate(FILE_CMP, 24, QFACTOR_QMS);
  else // save as grayscale
     nRet = m_Lead1.dbUpdate(FILE_CMP, 8, QFACTOR_QMS);
  if (nRet != 0)
  {
    char  buffer[50];
    sprintf(buffer, "LEAD Error %d saving image to database", nRet);
    MessageBox(buffer, "ERROR", MB_OK);
  }
  // Restore previous error handling.
  m_Lead1.SetEnableMethodErrors(ErrHand);
  NormalMove = TRUE;

}

28.	Add code for the IDC_FLIP button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CLtcdbView.

c.	In the Object IDs list box, select IDC_FLIP.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnUpdate).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CLtcdbView::OnFlip()
{
  // Make sure we can update records in the database.
  if (m_Lead1.GetDbCanUpdate() == FALSE)
  {
    MessageBox("You cannot update this database.", "ERROR");
    return;
  }

  // Make sure the current record contains an image.
  if (m_Lead1.GetDbIsEOF() || m_Lead1.GetDbIsBOF() || m_Lead1.GetBitmap() == 0)
  {
    MessageBox("No current image", "NOTICE", MB_OK);
    return;
  }

  // Flip the image.
  m_Lead1.dbEdit();
  m_Lead1.Flip();

  // Use return values to trap errors.
  BOOL ErrHand = m_Lead1.GetEnableMethodErrors(); // Save the current setting.
  m_Lead1.SetEnableMethodErrors(FALSE);

  // Update the recordset using the appropriate format

   int nRet;
  if (m_Lead1.GetBitmapBits() == 1)
     nRet = m_Lead1.dbUpdate(FILE_LEAD1BIT, 1, 0);
  else if  (m_Lead1.GetBitmapBits() == 4)
     nRet = m_Lead1.dbUpdate(FILE_PCX, 4, 0);
  else if (m_Lead1.GetIsGrayscale() == GRAY_NO)
     nRet = m_Lead1.dbUpdate(FILE_CMP, 24, QFACTOR_QMS);
  else // save as grayscale
     nRet = m_Lead1.dbUpdate(FILE_CMP, 8, QFACTOR_QMS);
  if (nRet != 0)
  {
    char  buffer[50];
    sprintf(buffer, "LEAD Error %d saving image to database", nRet);
    MessageBox(buffer, "ERROR", MB_OK);
  }

  // Restore previous error handling.
  m_Lead1.SetEnableMethodErrors(ErrHand);
}

29.	Add code for the IDC_DELETE button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CLtcdbView.

c.	In the Object IDs list box, select IDC_DELETE.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnDelete).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CLtcdbView::OnDelete()
{
  // Make sure we can delete records from the database.
  if (!m_pSet->CanUpdate())
  {
    MessageBox("You cannot update this database.", "ERROR");
    return;
  }

  // Make sure the database is not empty.
  if (m_pSet->IsEOF() && m_pSet->IsBOF())
  {
    MessageBox("The database is empty", "NOTICE", MB_OK);
    return;
  }
  CWaitCursor wait;  // Display an hourglass

  // Disable the normal record synchronization and hide the LEAD control.
  NormalMove = FALSE;
  m_Lead1.ShowWindow(SW_HIDE);

  // Save the current position.
  long RecMarker = m_pSet->GetAbsolutePosition();

  // Delete the current record and wait for the change to take effect.
  m_pSet->Delete();
  Sleep(5000);

  // Requery the recordsets, move to the last record,
  // and initialize the NewPosition global variable.
  m_pSet->Requery();
  m_Lead1.dbRequery();
  m_pSet->MoveLast();
  NewPosition = m_pSet->GetAbsolutePosition();
  m_Lead1.dbMove(NewPosition);

  // Make sure the LEAD control is on the last record.
  m_Lead1.dbMoveNext();
  if(m_Lead1.GetDbIsEOF())
  {
    m_Lead1.dbMovePrev();
  }
  else
  {
    int nRet = MessageBox("Synchronization error!\nRestart the application", "ERROR", MB_OK);
    return;
  }

  // Return to the old record position, if possible.
  NormalMove = TRUE;
  m_Lead1.ShowWindow(SW_NORMAL);
  long RelativePosition = RecMarker - NewPosition;
  if (RelativePosition < 0)
  {
    m_pSet->Move(RelativePosition);
  }

  // Update the edit box with data from the current record.
  UpdateData(FALSE);

}

30.	To accommodate a 256-color display driver, continue with the remaining steps, which send WM_QUERYNEWPALETTE and WM_PALETTECHANGED messages to the LEADTOOLS ActiveX.

31.	Edit the LTCDBVIEW.H file and insert the following lines in the definition of CLtcdbView class, just before DECLARE_MESSAGE_MAP():

afx_msg BOOL OnQueryNewPalette();
afx_msg void OnPaletteChanged( CWnd *pwin );

32.	Edit the LTCDBVIEW.CPP file and insert the following lines between the lines: BEGIN_MESSAGE_MAP(CLtcdbView, CDaoRecordView) and END_MESSAGE_MAP():

ON_WM_QUERYNEWPALETTE()
ON_WM_PALETTECHANGED()

33.	Go to the end of LTCDBVIEW.CPP file and insert the following two functions:

BOOL CLtcdbView::OnQueryNewPalette()
{
  if(!IsWindow(m_Lead1.m_hWnd))
      return FALSE;
  return m_Lead1.SendMessage(WM_QUERYNEWPALETTE);
}

void CLtcdbView::OnPaletteChanged(CWnd* pFocusWnd)
{
  if(pFocusWnd->m_hWnd == m_hWnd || !IsWindow(m_Lead1.m_hWnd))
      return;
  m_Lead1.SendMessage(WM_PALETTECHANGED, (WPARAM) pFocusWnd->m_hWnd);
}

34.	On the main menu, select Build > Build ltcdb.exe to build the project.

35.	On the main menu, select Build > Execute ltcdb.exe to run the project.


Implementing a Database with the MS ADO Data Control (MFC60)

Note:	This tutorial requires MFC 6.0.

In MFC, the LEADTOOLS OLEDB control is a OLEDB data bound control. This means you can associate the LEADTOOLS OLEDB control with an ADO data control so that the LEADTOOLS OLEDB control's bitmap is bound to a specified field in the data control's recordset.

Take the following steps to start a project and to add some code that associates the LEADTOOLS OLEDB control with an ADO data control:

1.	Use a database manager to create an ACCESS MBD database with one table that has two fields. Use the following specifications:

a.	Database name: leadpic.mdb.

b.	Table name: people.

c.	Field name: who. Data Type: text. Size: 255.

d.	Field name: photo. Data Type: Long Binary. Size: N/A.

2.	Create an ODBC data source that references the same database follows:

a.	From the Windows Control Panel, open the ODBC administrator and click the Add button.

b.	Select Microsoft Access driver and click the OK button.

c.	Enter the name LEADACCESS.

d.	Click the Select directory button and select the path to the database that you created.

e.	Click the OK button; click the next OK button; then click the Close button.

3.	Start the Microsoft Developer Studio for Visual C++, version 6.0.

4.	Select the File >New menu option.  Select the Projects tab.  Select MFC AppWizard (exe) from the list.  Set the location for the new project as c:\ltwin14x\examples\ocx\MFC60 (you may need to change this for your system) and name the project "mfcoledb".  When you are finished, clik OK.

5.	In step 1, choose "Dialog Based" for the type of application, and click Next.

6.	In step 2, make sure "ActiveX Controls" is checked, and click Finish.

7.	Open the new project's resources, and go to the IDD_MFCOLEDB_DIALOG dialog resource.

8.	Right click on the dialog, and click on Insert ActiveX Control.  Add the LEAD Main Control to the dialog.  Size and Position the control to your liking.

9.	Do the following to add m_LEAD1 to the CMfcoledbDlg class and link the variable to the LEAD control using dynamic data exchange:

a.	Open the ClassWizard (CTRL-W).

b.	Click the Member Variables tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Control IDs list, select IDC_LEADCTRL1.

e.	Click the Add Variable... button.

f.	ClassWizard will prompt you to generate the class wrapper for the LEAD Main Control.  Select OK, and then select OK again to accept the default filenames.

g.	Specify m_LEAD1 as the variable name, and Control as the category.

h.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

10.	Right click on the dialog, and click on Insert ActiveX Control.  Add the MS ADO DataControl to the dialog.  Size and Position the control to your liking.

11.	Set the following properties for the ADO Data Control:

a.	Set the ConnectionString property by using the browse to build the string.  Select the OLEDB Provider for ODBC Drivers, and set the DSN to LEADACCESS.

b.	Set the RecordSource by setting the CommandType to adCommandTable and the table to the "people" table.

12.	Do the following to add m_ADODC1 to the CMfcoledbDlg class and link the variable to the MS ADO Data Control using dynamic data exchange:

a.	Open the ClassWizard (CTRL-W).

b.	Click the Member Variables tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Control IDs list, select IDC_ADODC1.

e.	Click the Add Variable... button.

f.	ClassWizard will prompt you to generate the class wrapper for the ADO Data Control.  Select OK, and then select OK again to accept the default filenames.

g.	Specify m_ADODC1 as the variable name, and Control as the category.

h.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

13.	Right click on the dialog, and click on Insert ActiveX Control.  Add the MS MaskedEdit Control to the dialog.  Size and Position the control to your liking.

14.	Set the following properties for the MaskedEdit Control:

a.	Set the DataSource property to IDC_ADODC1.

b.	Set the DataField property to "who"

15.	Do the following to add m_Text1 to the CMfcoledbDlg class and link the variable to the MS MaskedEdit Control using dynamic data exchange:

a.	Open the ClassWizard (CTRL-W).

b.	Click the Member Variables tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Control IDs list, select IDC_MASKEDBOX1.

e.	Click the Add Variable... button.

f.	ClassWizard will prompt you to generate the class wrapper for the MS MaskedEdit Control.  Select OK, and then select OK again to accept the default filenames.

g.	Specify m_Text1 as the variable name, and Control as the category.

h.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

16.	Right click on the dialog, and click on Insert ActiveX Control.  Add the LEAD OLEDB  Control to the dialog.

17.	Set the following properties for the LEAD OLEDB Control:

a.	Set the DataSource property to IDC_ADODC1.

b.	Leave the DataMember property empty to use the default for this data source.

18.	Do the following to add m_LEADOLEDB1 to the CMfcoledbDlg class and link the variable to the LEAD OLEDB Control using dynamic data exchange:

a.	Open the ClassWizard (CTRL-W).

b.	Click the Member Variables tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Control IDs list, select IDC_LTODBCTL1.

e.	Click the Add Variable... button.

f.	ClassWizard will prompt you to generate the class wrapper for the LEAD OLEDB  Control.  Select OK, and then select OK again to accept the default filenames.

g.	Specify m_LEADOLEDB1 as the variable name, and Control as the category.

h.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

19.	Edit the file mfcoledbDlg.cpp and add the following include files after #include "mfcoledbDlg.h":

#include "..\..\..\..\include\l_ocx40.h"
#include "..\..\..\..\include\ltdlgocx.h"
#include "_recordset.h"
#include "fields.h"
#include "field.h"

20.	Modify the OnInitDialog function follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	Click the Message Maps tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Object IDs list box, select CLtcdbView.

e.	In the Messages list box, select WM_INITDIALOG.

f.	Click the Edit Code button, and edit the function by adding the following just after "// TODO: Add extra initialization here":

// TODO: Add extra initialization here

   m_LEAD1.SetPaintSizeMode(PAINTSIZEMODE_FIT);

   m_LEAD1.SetAutoScroll(FALSE);
   m_LEAD1.SetAutoRepaint(TRUE);

   //databind performed at design-time, except for the data field
   m_LEADOLEDB1.SetDataField("photo");

   //Set the data properties on the LEAD OLE DB control
   m_LEADOLEDB1.SetDataLoadBits(0);
   m_LEADOLEDB1.SetDataSaveBits(24);
   m_LEADOLEDB1.SetDataSaveFormat(FILE_LEAD);
   m_LEADOLEDB1.SetDataSaveQuality(QFACTOR_QMS);

   m_LEADOLEDB1.SetEnableMethodErrors(FALSE);

   return TRUE;  // return TRUE  unless you set the focus to a control

21.	Open the project's resources, and go to the IDD_MFCOLEDB_DIALOG dialog resource.

22.	Right click on the dialog, and click on Insert ActiveX Control.  Add the LEAD Common Dialog Control to the dialog.

23.	Do the following to add m_LEADDlg1 to the CMfcoledbDlg class and link the variable to the LEAD Common Dialog Control using dynamic data exchange:

a.	Open the ClassWizard (CTRL-W).

b.	Click the Member Variables tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Control IDs list, select IDC_LEADDLGCTRL1.

e.	Click the Add Variable... button.

f.	ClassWizard will prompt you to generate the class wrapper for the LEAD Common Dialog Control.  Select OK, and then select OK again to accept the default filenames.

g.	Specify m_LEADDlg1 as the variable name, and Control as the category.

h.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

24.	Open the project's resources, and go to the IDD_MFCOLEDB_DIALOG dialog resource.

25.	Add 3 command buttons to the dialog, and set the properties as follows

ID	Caption

IDC_ADDREC	"AddRec"

IDC_DELREC	"DelRec"

IDC_FLIP	"Flip"

26.	Add the OnAddrec event as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	Click the Message Maps tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Object IDs list box, select IDC_ADDREC.

e.	In the Messages list box, select BN_CLICKED.

f.	Click the Add function button. Choose OK for the default function name (OnAddrec).

g.	Click the Edit Code button, and edit the function so it appears as follows:

   VARIANT va1;
   VARIANT va2;
   C_Recordset recset;
   CString csMyFile;

   VariantInit(&va1);
   VariantInit(&va2);
   // release any reference
   m_LEADOLEDB1.SetBitmap(0);
   // This filter list is complete, except for GIF
   m_LEADDlg1.SetFilter("");
   m_LEADDlg1.SetFileDlgFlags(0);
   m_LEADDlg1.SetDialogTitle("Open File");
   m_LEADDlg1.SetUIFlags(DLG_FO_FILEINFO | DLG_FO_SHOWPREVIEW | DLG_FO_SHOWSTAMP);

   m_LEADDlg1.FileOpen((long)this->m_hWnd);
   csMyFile = m_LEADDlg1.GetFileName();
   m_Text1.SetWindowText(csMyFile);
   if(csMyFile.GetLength())
   {
      // Hide the Lead control while we update the recordset
      m_LEAD1.ShowWindow(SW_HIDE);
      recset = m_ADODC1.GetRecordset();

      CFields Fields;
      CField cwho;
      CField cphoto;
      FILE *pFile;
      unsigned int nbytes = 1024, bytesread;
      BYTE buffer[1024];
      VARIANT var;
      VariantInit(&var);  //Initialize our variant
      void * pArrayData = NULL;

      va1.vt = VT_I4;
      va1.lVal = 0;

      va2.vt = VT_BSTR;
      va2.bstrVal = csMyFile.AllocSysString();

      recset.AddNew(va1, va2);
      m_LEADOLEDB1.SetDataDirty (TRUE);

      recset.Update(va1, va2);
      Fields = recset.GetFields();

      //Set the type to an array of unsigned chars (OLE SAFEARRAY)
      var.vt = VT_ARRAY | VT_UI1;

      //Set up the bounds structure
      SAFEARRAYBOUND  rgsabound[1];
      va1.lVal = 1;
      cphoto = Fields.GetItem(va1);

      if((pFile = fopen(LPCTSTR(csMyFile), "r+b")) == NULL)
         return;

      //read the image into chunks as 1K
      do
      {
         bytesread = fread(buffer, sizeof(BYTE), nbytes, pFile);
         rgsabound[0].cElements = bytesread;
         rgsabound[0].lLbound = 0;

        //Create an OLE SAFEARRAY
         var.parray = SafeArrayCreate(VT_UI1,1,rgsabound);

         if(var.parray != NULL)
         {
            //Get a safe pointer to the array
            SafeArrayAccessData(var.parray,&pArrayData);

            //Copy bitmap to it
            memcpy(pArrayData, buffer, bytesread);

            //Unlock the variant data
            SafeArrayUnaccessData(var.parray);

            //Append the chunks into the photo field
            cphoto.AppendChunk(var);
         }
      }
      while(bytesread == nbytes);

      fclose(pFile);

      VariantInit(&var);  //Initialize our variant

      //Set the type to an array of unsigned chars (OLE SAFEARRAY)
      var.vt = VT_ARRAY | VT_UI1;
      m_LEAD1.StartFeedLoad(0, 0, 1);
      do
      {
         //Get the image data into chunks and load them
         var = cphoto.GetChunk(nbytes);
         m_LEAD1.FeedLoad(var, var.parray->rgsabound[0].cElements);
      }
      while(var.parray->rgsabound[0].cElements == nbytes);

      m_LEAD1.StopFeedLoad();

      ::SysFreeString(va2.bstrVal);

      // Go to the new record, and show the LEAD control
      m_LEAD1.ShowWindow(SW_SHOW);
      CString csSearch;
      csSearch = "who = '" + csMyFile + "'";
      va1 = recset.GetBookmark();
      recset.Find((LPCTSTR)csSearch, 0, 1/*search forward*/, va1);
   }

27.	Add the OnDelrec event as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	Click the Message Maps tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Object IDs list box, select IDC_DELREC.

e.	In the Messages list box, select BN_CLICKED.

f.	Click the Add function button. Choose OK for the default function name (OnDelrec).

g.	Click the Edit Code button, and edit the function so it appears as follows:

   // Hide the LEAD control.
   m_LEAD1.ShowWindow(SW_HIDE);
   // Delete the record
   C_Recordset recset;
   recset = m_ADODC1.GetRecordset();
   recset.Delete(1);//delete current record only
   // Requery the recordset, and move to saved position
   recset.Requery(0);
   m_LEAD1.ShowWindow(SW_SHOW);
   if(recset.GetEof())
      recset.MoveLast();

28.	Add the OnFlip event as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	Click the Message Maps tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Object IDs list box, select IDC_FLIP.

e.	In the Messages list box, select BN_CLICKED.

f.	Click the Add function button. Choose OK for the default function name (OnFlip).

g.	Click the Edit Code button, and edit the function so it appears as follows:

    //Flip the image
    m_LEAD1.Flip();
    m_LEAD1.AnnFlip(TRUE, m_LEAD1.GetBitmapHeight() / 2, FALSE);
    m_LEADOLEDB1.SetDataDirty(TRUE);

29.	Add the LEAD OLEDB Control's OnDataLoaded event as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	Click the Message Maps tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Object IDs list box, select IDC_LTODBCTL1.

e.	In the Messages list box, select DataLoaded.

f.	Click the Add function button. Choose OK for the default function name (OnDataLoadedLtodbctl1).

g.	Click the Edit Code button, and edit the function so it appears as follows:

if(nStatus == 0)
   {
      m_LEAD1.SetRefBitmap(TRUE); //don't make a copy
      m_LEAD1.SetBitmap(m_LEADOLEDB1.GetBitmap()); //send the image to the LEAD OCX
      m_LEAD1.SetRefBitmap(FALSE); //reset
   }
   else if(nStatus == ERROR_FILENOTFOUND) //if it's an empty record
      m_LEAD1.SetBitmap(0);
   else if (nStatus != ERROR_FILENOTFOUND) //if it's not an empty record
   {
      m_LEAD1.SetBitmap(0);
      AfxMessageBox("Error loading from database!");
   }
   m_LEAD1.ForceRepaint();
   m_LEADOLEDB1.SetDataDirty(FALSE);

30.	Add the LEAD OLEDB Control's OnDataSaved event as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	Click the Message Maps tab.

c.	In the Class Name box, select CLtcdbView.

d.	In the Object IDs list box, select IDC_LTODBCTL1.

e.	In the Messages list box, select DataSaved.

f.	Click the Add function button. Choose OK for the default function name (OnDataSavedLtodbctl1).

g.	Click the Edit Code button, and edit the function so it appears as follows:

m_LEADOLEDB1.SetBitmap(0); //free the current reference
   m_LEAD1.SetBitmap(0); //free the current bitmap
   if(nStatus != 0)
   {
      m_LEAD1.ForceRepaint();
      AfxMessageBox("Error saving to database!");
   }

31.	On the main menu, select Build > Build ltcdb.exe to build the project.

32.	On the main menu, select Build > Execute ltcdb.exe to run the project.


Printing Multiple Images (Visual C++ 4.0)
Printing Multiple Images (C++ 4.0 and later)

Take the following steps to add code that prints two images on one page. This code shows you how to control the size and position of images on the page.

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

2.	Go to the Project WorkSpace and click the ResourceView tab.

3.	Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.

4.	 Add a new button under the Cancel button. To do this, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box.

5.	Double-click the button and change IDC_BUTTON1 to IDC_PRINT. Also, set the Caption to &Print.

6.	Press Ctrl-F4 to close all windows back to the Project Workspace.

7.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_PRINT.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnPrint).

f.	Click the Edit Code button to start entering the code.

8.	Enter new code as follows:

void CTutorDlg::OnPrint()
{
  // TODO: Add your control notification handler code here

  //Declare the variable for printed text
  static char szMessage1[] = "This is a print example using LEADTOOLS ActiveX.";
  //Declare the variables for pixel measurements
  int TextHeightInPixels;
  int UsableWidth;
  int UsableHeight;
  int MaxImageHeight;
  //Declare the variables for sizing and positioning the image
  long PrintLeft;
  long PrintTop;
  long PrintHeight;
  long PrintWidth;
  //Declare variables used for preserving aspect ratios
  int WidthFactor;
  int HeightFactor;

  HDC hdcPrinter;

  PRINTDLG  printdlg;
  int yPrinter;
  DOCINFO docinfo;

  SIZE    size;

  //Set the variables used for preserving the aspect ratio
  HeightFactor = (int)m_Lead1.GetBitmapHeight();
  WidthFactor = (int)m_Lead1.GetBitmapWidth();

  // get the printer DC here
  memset( &printdlg, 0, sizeof(printdlg) );
  printdlg.lStructSize = sizeof(printdlg);
  printdlg.Flags = PD_RETURNDC;
  if( !PrintDlg(&printdlg) )
    return;

  if( (hdcPrinter = printdlg.hDC) == NULL )
  {
    if( printdlg.hDevMode ) GlobalFree(printdlg.hDevMode);
    if( printdlg.hDevNames) GlobalFree(printdlg.hDevNames);
    return;
  }

  docinfo.cbSize = sizeof(docinfo);
  docinfo.lpszDocName = "Print example using LEADTOOLS ActiveX.";
  docinfo.lpszOutput = NULL;
#ifdef WIN32
  docinfo.fwType = 0L;
#endif

  if( StartDoc(hdcPrinter, &docinfo) <= 0)
  {
    if( printdlg.hDevMode ) GlobalFree(printdlg.hDevMode);
    if( printdlg.hDevNames) GlobalFree(printdlg.hDevNames);
    DeleteDC(hdcPrinter);
  }

  StartPage(hdcPrinter);
  //Set the pointer to an hourglass
  HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT));

  //Get the page width and height in pixels (dots)
  UsableWidth = GetDeviceCaps(hdcPrinter,HORZRES);
  UsableHeight = GetDeviceCaps(hdcPrinter,VERTRES);
  //Print a title at the top of the page

  yPrinter = 0;
  TextOut( hdcPrinter, 0, yPrinter, szMessage1, strlen(szMessage1));

  //Get the maximum height of one image,
  //assuming two equal-size images and space for 12 lines of text

#ifdef WIN32
  GetTextExtentPoint32( hdcPrinter, szMessage1, strlen(szMessage1), &size );
#else
   DWORD dwSize = GetTextExtent( hdcPrinter, szMessage1, strlen(szMessage1) );
   size.cx = LOWORD(dwSize);
   size.cy = HIWORD(dwSize);
#endif

  TextHeightInPixels = (int)size.cy;
  yPrinter += TextHeightInPixels;
  MaxImageHeight = (UsableHeight - (12 * TextHeightInPixels)) / 2;

  //Size and position the first image, preserving the aspect ratio.
  //Check to see if using the maximum width will make the image too tall.
  //Set the dimensions based on the result.
  if ( ((UsableWidth * HeightFactor) / WidthFactor) < MaxImageHeight)
  {
    PrintLeft = 1; //This is for flush left. Use 0 for centering.
    PrintTop = yPrinter;
    PrintWidth = UsableWidth;
    PrintHeight = (PrintWidth * HeightFactor) / WidthFactor;
  }
  else
  {
    PrintLeft = 1; //This is for flush left. Use 0 for centering.
    PrintTop = yPrinter;
    PrintHeight = MaxImageHeight;
    PrintWidth = (PrintHeight * WidthFactor) / HeightFactor;
  }

  //Print the first image
  m_Lead1.Render( (OLE_HANDLE)hdcPrinter, (float)PrintLeft, (float)PrintTop, (float)PrintWidth, (float)PrintHeight );
  //Update the current printing position
  yPrinter += PrintHeight;
  //Leave a blank line, then print a caption for the next picture
  yPrinter += TextHeightInPixels;
  static char szMessage2[] = "This is a print example using LEADTOOLS ActiveX.";
  TextOut( hdcPrinter, 0, yPrinter, szMessage2, strlen(szMessage2) );
  yPrinter += TextHeightInPixels;
  //Stretch the intensity of the bitmap for the second printing
  //to show the difference between the second picture and the first
  m_Lead1.StretchIntensity();

  //Size and position the second image, preserving the aspect ratio.
  //The coding is the same as for the first image.
  if( ((UsableWidth * HeightFactor) / WidthFactor) < MaxImageHeight )
  {
    PrintLeft = 1; //This is for flush left. Use 0 for centering.
    PrintTop = yPrinter;
    PrintWidth = UsableWidth;
    PrintHeight = (PrintWidth * HeightFactor) / WidthFactor;
  }
  else
  {
    PrintLeft = 1; //This is for flush left. Use 0 for centering.
    PrintTop = yPrinter;
    PrintHeight = MaxImageHeight;
    PrintWidth = (PrintHeight * WidthFactor) / HeightFactor;
  }

  //Print the second image
  m_Lead1.Render( (OLE_HANDLE)hdcPrinter, (float)PrintLeft, (float)PrintTop, (float)PrintWidth, (float)PrintHeight );
  //Finish the page and finish the print job
  EndPage( hdcPrinter );
  EndDoc( hdcPrinter );
  //Set the mouse pointer back to the default
  SetCursor( hOldCursor );

  if( printdlg.hDevMode ) GlobalFree(printdlg.hDevMode);
  if( printdlg.hDevNames) GlobalFree(printdlg.hDevNames);
  DeleteDC(hdcPrinter);
}

9.	Rebuild and run the application.


Writing and Reading Multipage Files (Visual C++ 4.0)
Writing and Reading Multipage Files (C++ 4.0 and later)

Take the following steps to create a multipage file, then load and display the images from the file. Only TIFF (MPT) and PCX (DCX) formats support multipage files.

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

2.	Go to the Project WorkSpace and click the ResourceView tab.

3.	Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.

4.	Add a new LEAD Control to the dialog box as follows:

a.	 In the Controls toolbar, click the LEAD control icon; then click the dialog box to add the control to the dialog box.

b.	Double-click the new LEAD control to edit its properties.

c.	Change the properties ID to IDC_LEAD2.

5.	 Add a new button at the top of the dialog box. To do this, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box.

6.	Double-click the button and change IDC_BUTTON1 to IDC_MULTIPAGE. Also, set the Caption to &Multipage.

7.	Press Ctrl-F4 to close all windows back to the Project Workspace.

8.	Do the following to add m_Lead2 to the CTutorDlg class and link the variable to the LEAD control using dynamic data exchange:

a.	From the main menu, select View > ClassWizard. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CTutorDlg.

d.	In the Control IDs list, select IDC_LEAD2.

e.	Click the Add Variable... button.

f.	Specify m_Lead2 as the variable name, and Control as the category.

g.	Click OK to close the ClassWizard.

9.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_MULTIPAGE.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnMultipage).

f.	Click the Edit Code button to start entering the code.

10.	Enter new code as follows:

// Disable automatic repainting of the image.
  m_Lead1.SetAutoRepaint(FALSE);
  m_Lead2.SetAutoRepaint(FALSE);
  // Turn off scroll bars to make sure we use the full client area.
  m_Lead1.SetAutoScroll(FALSE);
  m_Lead2.SetAutoScroll(FALSE);
  // Position and size the main form so that it takes up most of the screen.
  float Width = (float)GetSystemMetrics(SM_CXSCREEN)  * 0.9f;
  float Height = (float)GetSystemMetrics(SM_CYSCREEN)* 0.8f;
  float Left = ((float)GetSystemMetrics(SM_CXSCREEN) - Width) / 2;
  float Top = ((float)GetSystemMetrics(SM_CYSCREEN) - Height) / 2;

  // Display the form and set the mouse pointer to an hourglass.
  MoveWindow((int) Left, (int) Top, (int) Width, (int) Height);
  BeginWaitCursor();

  // Load the bitmaps. These path names may be different on your system.
  m_Lead1.Load( "c:\\lead\\images\\image1.cmp", 0, 0, 1 );
  m_Lead2.Load( "c:\\lead\\images\\image2.cmp", 0, 0, 1 );
  // Save the bitmaps to a single multipage TIFF file
  m_Lead1.Save( "c:\\lead\\images\\combined.tif", FILE_TIF, 24, 0, SAVE_OVERWRITE );
  m_Lead2.Save( "c:\\lead\\images\\combined.tif", FILE_TIF, 24, 0, SAVE_APPEND );
  // Clear the bitmaps from memory
  m_Lead1.SetBitmap( 0 );
  m_Lead2.SetBitmap( 0 );

  // Get information about the images so that we can size the controls.
  m_Lead1.GetFileInfo( "c:\\lead\\images\\combined.tif", 1, 0 );
  m_Lead2.GetFileInfo( "c:\\lead\\images\\combined.tif", 2, 0 );

  // Set the variables used for preserving the aspect ratio.
  float HeightFactor1 = m_Lead1.GetInfoHeight();
  float WidthFactor1 = m_Lead1.GetInfoWidth();
  float HeightFactor2 = m_Lead2.GetInfoHeight();
  float WidthFactor2 = m_Lead2.GetInfoWidth();

  CRect rcWindow;
  GetClientRect(rcWindow);

  float HeightAllowed = rcWindow.Height() * 0.8f;
  float WidthAllowed = rcWindow.Width() * 0.45f;

  // Center each LEAD control on half of the form, preserving the aspect ratio.
  // Check to see if using the maximum width will make the image too tall.
  // Set the dimensions based on the result.
  if( (WidthAllowed * HeightFactor1) / WidthFactor1 < HeightAllowed )
  {
    Left = ( (rcWindow.Width() / 4) - (WidthAllowed / 2) );
    Width = WidthAllowed;
    Height = ((Width * HeightFactor1) / WidthFactor1);
    Top = ((rcWindow.Height() - Height) / 2);
  }
  else
  {
    Top = ((rcWindow.Height() - HeightAllowed) / 2);
    Height = HeightAllowed;
    Width = ((Height * WidthFactor1) / HeightFactor1);
    Left = ((rcWindow.Width() / 4) - (Width / 2));
  }
  m_Lead1.MoveWindow( CRect((int)Left, (int)Top, (int)Left + (int)Width, (int)Top + (int)Height) );

  if( (WidthAllowed * HeightFactor2) / WidthFactor2 < HeightAllowed )
  {
    Left =  ((rcWindow.Width() * 3/4) - (WidthAllowed / 2));
    Width = WidthAllowed;
    Height = ((Width * HeightFactor2) / WidthFactor2);
    Top = ((rcWindow.Height() - Height) / 2);
  }
  else
  {
    Top = (rcWindow.Height() - HeightAllowed) / 2;
    Height = HeightAllowed;
    Width = ((Height * WidthFactor2) / HeightFactor2);
    Left = ((rcWindow.Width() * 3 / 4) - (Width / 2));
  }
  m_Lead2.MoveWindow( CRect((int)Left, (int)Top, (int)Left + (int)Width, (int)Top + (int)Height) );

  // Load the bitmaps from the multipage TIFF file
  m_Lead1.Load( "c:\\lead\\images\\combined.tif", 24, 1, 1 );
  m_Lead2.Load( "c:\\lead\\images\\combined.tif", 24, 2, 1 );
  // Set the image display sizes to match the LEAD controls
  float ImageWidth = m_Lead1.GetScaleWidth();
  float ImageHeight = m_Lead1.GetScaleHeight();
  m_Lead1.SetDstRect( 0.0f, 0.0f, ImageWidth, ImageHeight );
  m_Lead1.SetDstClipRect( 0.0f, 0.0f, ImageWidth, ImageHeight );
  // Set the image display sizes to match the LEAD controls
  ImageWidth= m_Lead2.GetScaleWidth();
  ImageHeight= m_Lead2.GetScaleHeight();

  m_Lead2.SetDstRect( 0.0f, 0.0f, ImageWidth, ImageHeight );
  m_Lead2.SetDstClipRect( 0.0f, 0.0f, ImageWidth, ImageHeight );
  // Display the images
  m_Lead1.ForceRepaint();
  m_Lead2.ForceRepaint();
  // Set the mouse pointer back to the default();
  EndWaitCursor();

11.	Rebuild and run the application. Running the application may take a long time because it will load two images, write both of them into a TIF file and read them again.


Using Transparent Controls (Visual C++ 4.0)
Using Transparent Controls (C++ 4.0 and later)

Take the following steps to add transparent controls, with special effects. The transparent controls are added as nested child controls.

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

2.	Edit the TUTORDLG.H file, and add the following as protected members to the CTutorDlg class:

CLead   m_Lead2;
CLead   m_Lead3;

3.	Also in the TUTORDLG.H file, include the FONT.H file by adding the following statement at the beginning of the file:

#include "font.h"

4.	Update the CTutorDlg::OnInitDialog function to create the m_Lead2 and m_Lead3 controls at run time. To do so, add the following code just before the last return statement:

const WCHAR _szLicString[] =
L"LEADTOOLS OCX Copyright (c) 1997 LEAD Technologies, Inc.";
BSTR lpLic = SysAllocString(_szLicString);
m_Lead2.Create("", 0, CRect(0,0,1,1), &m_Lead1, 0,NULL,FALSE,lpLic);
m_Lead2.ShowWindow(SW_SHOW);
m_Lead3.Create("", 0, CRect(0,0,1,1), &m_Lead2, 0,NULL,FALSE,lpLic);
m_Lead3.ShowWindow(SW_SHOW);
SysFreeString(lpLic);

5.	Add a command button, and code its click event as follows:

void CTutorDlg::OnButton1()
{
   // Avoid extra repaints.
   m_Lead1.SetAutoRepaint(FALSE);
   m_Lead2.SetAutoRepaint(FALSE);
   m_Lead3.SetAutoRepaint(FALSE);

   // Make m_Lead2 and m_Lead3 transparent.
   m_Lead2.SetTransparent(TRUE);
   m_Lead3.SetTransparent(TRUE);

   // Give each control a different effect.
   m_Lead1.SetPaintEffect(EFX_EFFECT_WIPE_RECTANGLE_OUT);
   m_Lead2.SetPaintEffect(EFX_EFFECT_WIPE_RECTANGLE_IN);
   m_Lead3.SetPaintEffect(EFX_EFFECT_WIPE4_R_B_L_B);

   m_Lead1.SetEffectDelay(20);
   m_Lead2.SetEffectDelay(20);
   m_Lead3.SetEffectDelay(20);
   m_Lead1.SetEffectGrain(1);
   m_Lead2.SetEffectGrain(5);
   m_Lead3.SetEffectGrain(1);
   m_Lead1.SetScaleMode(3);
   m_Lead2.SetScaleMode(3);
   m_Lead3.SetScaleMode(3);

   // Position m_Lead2 and m_Lead3 inside m_Lead1.
   float LabelWidth = m_Lead1.GetScaleWidth() / 2;
   float LabelHeight = m_Lead1.GetScaleHeight() / 2;
   float LabelLeft = LabelWidth / 2;
   float LabelTop = LabelHeight / 2;
   m_Lead2.MoveWindow((int)LabelLeft,(int)LabelTop,(int)LabelWidth,(int)LabelHeight);
   m_Lead3.MoveWindow(0,0,(int)LabelWidth,(int)LabelHeight);

   // Update the measurements that we use, based on the client area.
   LabelWidth = m_Lead2.GetScaleWidth();
   LabelHeight = m_Lead2.GetScaleHeight();

// We will be drawing into the bitmaps.
   m_Lead2.SetDrawPersistence(TRUE);
   m_Lead3.SetDrawPersistence(TRUE);

   // First, we need some bitmaps.
   m_Lead2.CreateBitmap(LabelWidth, LabelHeight, 24);
   m_Lead3.CreateBitmap(LabelWidth, LabelHeight, 24);

   // Fill them with black, and make black transparent.
   m_Lead2.Fill(RGB(0, 0, 0));
   m_Lead3.Fill(RGB(0, 0, 0));
   m_Lead2.SetBitmapEnableTransparency(TRUE);
   m_Lead3.SetBitmapEnableTransparency(TRUE);
   m_Lead2.SetBitmapTransparentColor(RGB(0, 0, 0));
   m_Lead3.SetBitmapTransparentColor(RGB(0, 0, 0));

   // Draw a shape into m_Lead2.
   // Shape background
   m_Lead2.SetShapeBackgroundStyle(EFX_BACKSTYLE_TRANSLUCENT);

   // Shape location
   m_Lead2.SetShapeTop(0.0f);
   m_Lead2.SetShapeLeft(0.0f);
   m_Lead2.SetShapeWidth(LabelWidth);
   m_Lead2.SetShapeHeight(LabelHeight);

   // Shape border
   m_Lead2.SetShapeBorderColor(RGB(255, 0, 0));
   m_Lead2.SetShapeBorderStyle(EFX_BORDERSTYLE_SOLID);
   m_Lead2.SetShapeBorderThickness(5.0f);

   // Set the fill pattern.
   m_Lead2.SetPatternStyle(EFX_PATTERN_TRANSPARENT);

   // Draw the shape.
   m_Lead2.DrawShape(EFX_SHAPE_STAR4, 0);

   // Draw text into m_Lead3.
   // Make the font 48 point Arial. The variable, myFont, is a dispatch interface.
   COleFont myFont = m_Lead3.GetFont();
   myFont.SetName("Arial");
   CY size = myFont.GetSize();
   size.int64 = 48 * 10000;
   myFont.SetSize(size);

   // Finish describing the text.
   m_Lead3.SetTextAngle(450);
   m_Lead3.SetDrawFontColor(RGB(0, 0, 255)); //Blue
   m_Lead3.SetTextStyle(EFX_TEXTSTYLE_NORMAL);
   m_Lead3.SetTextAlign(EFX_TEXTALIGN_HCENTER_VCENTER);

   // Set the location for the text.
   m_Lead3.SetTextTop(0.0f);
   m_Lead3.SetTextLeft(0.0f);
   m_Lead3.SetTextWidth(LabelWidth);
   m_Lead3.SetTextHeight(LabelHeight);

   // Set the properties for drawing a rectangle behind the text.
   m_Lead3.SetDrawPenStyle(DRAWPENSTYLE_SOLID);
   m_Lead3.SetDrawPenColor(RGB(255, 255, 0));
   m_Lead3.SetDrawMode(DRAWMODE_COPY_PEN);

   // Draw the rectangle, then draw the text.
   m_Lead3.DrawRectangle(0.0f, 0.0f, LabelWidth, LabelHeight);
   m_Lead3.DrawText("Text", 0);

   // Load an image into m_Lead1, and paint the image.
   m_Lead1.Load("e:\\LTWIN14x\\images\\image1.cmp", 0, 0, 1);
   m_Lead1.ForceRepaint();

   // Turn off the paint effects.
   m_Lead1.SetPaintEffect(EFX_EFFECT_NONE);
   m_Lead2.SetPaintEffect(EFX_EFFECT_NONE);
   m_Lead3.SetPaintEffect(EFX_EFFECT_NONE);
}

6.	Rebuild and run the application.


Drawing Simple Lines and Shapes (Visual C++ 4.0)
Drawing Simple Lines and Shapes (C++ 4.0 and later)

Take the following steps to add code that lets you draw a line, rectangle and ellipse on the bitmap.

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

2.	Edit TUTORDLG.H and insert the following lines in the definition of CTutorDlg after DECLARE_MESSAGE_MAP():

int DrawObject; // The object we are drawing
long StartX; // Starting X position
long StartY; // Starting Y position
long EndX; // Ending X position
long EndY; // Ending Y position
BOOL Drawing;

3.	Edit the OnLoadlead() function to add the following code to initialize the form-level variables when you load an image:

DrawObject = 0;
Drawing = FALSE;

4.	Code the LEAD control's MouseDown event as follows. This code selects a different drawing object each time the event occurs.

void CDrawtestDlg::OnMouseDownLead1(short Button, short Shift, long x, long y)
{
  //temp. Disable Scrolling
  m_Lead1.SetEnableKeyboard(FALSE);
  m_Lead1.SetEnableScroll(TRUE);
  Drawing = TRUE;
  // Save the starting position.
  StartX = x;
  StartY = y;
  EndX = x;
  EndY = y;

  // Cycle through the types of drawing objects.
  switch (DrawObject)
  {
    case 0:
      DrawObject = 1;   // Line
      break;
    case 1:
      DrawObject = 2;   // Rectangle
      break;
    case 2:
      DrawObject = 0;   // Ellipse
      break;
  }
}

5.	Code the LEAD control's MouseMove event as follows. This code uses DRAWMODE_INVERT for the DrawMode, which means that pixel colors are inverted. Thus, the drawing methods can erase the previous object and draw a new one.

void CDrawtestDlg::OnMouseMoveLead1(short Button, short Shift, long x, long y)
{
  int OldEndX, OldEndY;
  long OldDrawX, OldDrawY, OldWidth, OldHeight;
  long DrawX, DrawY, NewWidth, NewHeight;

  if (Drawing == TRUE)
  {
    // Set the drawing styles.
    m_Lead1.SetDrawPenStyle(DRAWPENSTYLE_SOLID);
    m_Lead1.SetDrawMode(DRAWMODE_INVERT);
    m_Lead1.SetDrawFillStyle(DRAWFILLSTYLE_TRANSPARENT);
    m_Lead1.SetDrawPersistence(FALSE); // On the window, not the bitmap

    // Save the previous ending mouse position.
    OldEndX = EndX;
    OldEndY = EndY;

    // Get the current mouse position.
    EndX = x;
    EndY = y;

    // Calculate the origin of the current object.
    if (EndX > StartX)
       DrawX = StartX;
    else
       DrawX = EndX;
    if (EndY > StartY)
       DrawY = StartY;
    else
       DrawY = EndY;

    // Calculate the origin of the previous object.
    if (OldEndX > StartX)
       OldDrawX = StartX;
    else
       OldDrawX = OldEndX;
    if (OldEndY > StartY)
       OldDrawY = StartY;
    else
       OldDrawY = OldEndY;

    // Calculate the height and width of the current object.
    NewHeight = abs(StartY - EndY);
    NewWidth = abs(StartX - EndX);

    // Calculate the height and width of the previous object.
    OldHeight = abs(StartY - OldEndY);
    OldWidth = abs(StartX - OldEndX);

    // Erase the old object and draw the new one.
    switch (DrawObject)
    {
       case 0:   // Ellipse
         m_Lead1.DrawEllipse(OldDrawX, OldDrawY, OldWidth, OldHeight);
         m_Lead1.DrawEllipse(DrawX, DrawY, NewWidth, NewHeight);
         break;
       case 1:   // Line
         m_Lead1.DrawLine(StartX, StartY, OldEndX, OldEndY);
         m_Lead1.DrawLine(StartX, StartY, EndX, EndY);
         break;
       case 2:   // Rectangle
         m_Lead1.DrawRectangle(OldDrawX, OldDrawY, OldWidth, OldHeight);
         m_Lead1.DrawRectangle(DrawX, DrawY, NewWidth, NewHeight);
         break;
    }
  }
}

6.	Code the LEAD control's MouseUp event as follows. This code sets the drawing style and draws the object on the bitmap.

void CDrawtestDlg::OnMouseUpLead1(short Button, short Shift, long x, long y)
{
  long DrawX, DrawY, NewWidth, NewHeight;

  //Restore scrolling
  m_Lead1.SetEnableKeyboard(TRUE);
  m_Lead1.SetEnableScroll(TRUE);
  Drawing = FALSE;

  // Set the drawing style.
  m_Lead1.SetDrawPenStyle(DRAWPENSTYLE_SOLID);
  m_Lead1.SetDrawPenWidth(2);
  m_Lead1.SetDrawPenColor(RGB(255, 0, 0));    // Red
  m_Lead1.SetDrawMode(DRAWMODE_COPY_PEN);
  m_Lead1.SetDrawFillColor(RGB(0, 255, 0));   // Green
  m_Lead1.SetDrawFillStyle(DRAWFILLSTYLE_HORIZONTAL_LINE);
  m_Lead1.SetDrawPersistence(TRUE);           // On the bitmap

  // Get the current mouse position
  EndX = x;
  EndY = y;

  // Determine the origin of the object.
  if (EndX > StartX)
   DrawX = StartX;
  else
   DrawX = EndX;
  if (EndY > StartY)
   DrawY = StartY;
  else
   DrawY = EndY;

  // Determine the height and width of the object.
  NewHeight = abs(StartY - EndY);
  NewWidth = abs(StartX - EndX);

  // Draw the object
  switch (DrawObject)
  {
   case 0:   // Ellipse
     m_Lead1.DrawEllipse(DrawX, DrawY, NewWidth, NewHeight);
     break;
   case 1:   // Line
     m_Lead1.DrawLine(StartX, StartY, EndX, EndY);
     break;
   case 2:   // Rectangle
     m_Lead1.DrawRectangle(DrawX, DrawY, NewWidth, NewHeight);
     break;
  }
}

7.	Run your program to test it.


Cropping a Displayed Image and Copying It to a Bitmap (Visual C++ 4.0)
Cropping a Bitmap (C++ 4.0 and later)

Take the following steps to add code that lets you select an area with a mouse, crop the display to show only that area, and trim the bitmap to match the selected area. (This example uses both cropping and trimming, so that you can see the difference.)

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

2.	Go to the Project WorkSpace and click the FileView tab.

3.	Edit TUTORDLG.H and insert the following lines in the definition of CTutorDlg after DECLARE_MESSAGE_MAP():

BOOL Cropping;   //The state when the mouse is used for cropping
float StartX;     //Starting X position in screen pixels
float StartY;     //Starting Y position in screen pixels
float EndX;       //Ending X position in screen pixels
float EndY;       //Ending Y position in screen pixels

4.	Go to the Project Workspace and click the ResourceView tab.

5.	Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.

6.	 Add a new button to use for activating a selection mode. To do this, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box.

7.	Double-click the button and change IDC_BUTTON1 to IDC_SELECT. Also, set the Caption to &Select.

8.	 Add another button to use for trimming the bitmap. To do this, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box.

9.	Double-click the button and change IDC_BUTTON1 to IDC_TRIM. Also, set the Caption to &Trim.

10.	Press Ctrl-F4 to close all windows back to the Project Workspace.

11.	Start the Class Wizard and add code for the Select button. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_SELECT.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnSelect).

f.	Click the Edit Code button to start entering the code.

12.	Enter new code as follows:

void CTutorDlg::OnSelect()
{
  // TODO: Add your control notification handler code here
  // Initialize cropping so that you can do it more than once
  if( Cropping )
  {
    // Set the clipping area to match the image.
    m_Lead1.SetDstClipRect( m_Lead1.GetDstLeft(), m_Lead1.GetDstTop(), m_Lead1.GetDstWidth(), m_Lead1.GetDstHeight() );
    // Display the image
    m_Lead1.ForceRepaint();
  }
  // Set a global variable to let other events know that you are cropping
  Cropping = TRUE;

  // Set the pointer to a crosshair
  m_Lead1.SetMousePointer(2);
}

13.	Add code for the Trim button. To do so, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select IDC_TRIM.

c.	In the Messages list box, select BN_CLICKED.

d.	Click the Add function button. Choose OK for the default function name (OnTrim).

e.	Click the Edit Code button to start entering the code.

14.	Enter new code as follows:

void CTutorDlg::OnTrim()
{
  float   XFactor, YFactor,
      NewTop, NewLeft, NewWidth, NewHeight;
  // TODO: Add your control notification handler code here
  m_Lead1.SetMousePointer(11); // hourglass
  // Use the clipping rectangle// s percentage offsets in the image rectangle
  // to determine the trimmed rectangle in the bitmap.
  // Using percentages allows for the possibility that the image is zoomed.
  XFactor = m_Lead1.GetBitmapWidth() / m_Lead1.GetDstWidth();
  YFactor = m_Lead1.GetBitmapHeight() / m_Lead1.GetDstHeight();
  NewTop = (m_Lead1.GetDstClipTop() - m_Lead1.GetDstTop()) * YFactor;
  NewLeft = (m_Lead1.GetDstClipLeft() - m_Lead1.GetDstLeft()) * XFactor;
  NewWidth = m_Lead1.GetDstClipWidth() * XFactor;
  NewHeight = m_Lead1.GetDstClipHeight() * YFactor;

  // Make sure display rectangles are automatically adjusted.
  m_Lead1.SetAutoSetRects(TRUE);
  // Trim the bitmap. This changes the size of the image and
  // both the source and destination clipping rectangles
  m_Lead1.Trim(NewLeft, NewTop, NewWidth, NewHeight);
  // Turn off scroll bars to make sure we use the full client area.
  m_Lead1.SetAutoScroll(FALSE);
  // Set the image display size to match the LEAD control
  // The source rectangle matches the smaller bitmap.
  // Making the destination rectangle bigger, the paint will fill the LEAD control
  m_Lead1.SetDstRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight() );
  m_Lead1.SetDstClipRect( 0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight() );
  // Display the image
  m_Lead1.ForceRepaint();
  m_Lead1.SetMousePointer(0); // Default
}

15.	To add the code for LEAD mouse events, do the following:

a.	Press Ctrl-W to go to the MFC ClassWizard.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_LEAD1.

d.	Continue with the remaining steps for each mouse event.

16.	In the MFC ClassWizard, double-click the MouseDown event and add code as follows:

void CTutorDlg::OnMouseDownLead1(short Button, short Shift, long X, long Y)
{
  // Save the starting position
  if( Cropping && Button == 1 )
  {
    StartX = (float)X;
    StartY = (float)Y;
    // Make the rubberband invisible until the mouse moves
    m_Lead1.SetRubberBandVisible(FALSE);
  }
}

17.	In the MFC ClassWizard, double-click the MouseMove event and add code as follows:

void CTutorDlg::OnMouseMoveLead1(short Button, short Shift, long X, long Y)
{
  if( Cropping && Button == 1 )
  {
    float rbX, rbY, rbWidth, rbHeight;
    // Get the current mouse position
    EndX = (float)X;
    EndY = (float)Y;
    // Determine the origin of the rubberband rectangle,
    // regardless of which way the mouse moves.
    if( EndX > StartX )
      rbX = StartX;
    else
      rbX = EndX;

    if( EndY > StartY )
      rbY = StartY;
    else
      rbY = EndY;

    // Determine the height and width of the rubberband rectangle
    rbHeight = (float)fabs((double)StartY - EndY);
    rbWidth = (float)fabs((double)StartX - EndX);
    // Set the rubberband rectangle
    m_Lead1.SetRubberBandRect( rbX, rbY, rbWidth, rbHeight );
      // Alternatively, you could use the following properties to set the
      // rubberband rectangle:
      // m_Lead1.SetRubberBandHeight(rbHeight);
      // m_Lead1.SetRubberBandLeft(rbX);
      // m_Lead1.SetRubberBandTop(rbY);
      // m_Lead1.SetRubberBandWidth(rbWidth);

    // Make the rubberband rectangle visible
    m_Lead1.SetRubberBandVisible(TRUE);
  }
}

18.	In the MFC ClassWizard, double-click the MouseUp event and add code as follows:

void CTutorDlg::OnMouseUpLead1(short Button, short Shift, long X, long Y)
{
  if( Cropping && Button == 1 )
  {
  float CropLeft, CropTop, CropWidth, CropHeight;
  // Get the current mouse position
  EndX = (float)X;
  EndY = (float)Y;
  // Get the origin of the clipping rectangle.
  // Allow for different mouse drag directions
  if( StartX < EndX )
    CropLeft = StartX;
  else
     CropLeft = EndX;

  if( StartY < EndY )
    CropTop = StartY;
  else
     CropTop = EndY;

  // Get the height and width of the cropped area
  CropWidth = (float)fabs((double)EndX - StartX);
  CropHeight = (float)fabs((double)EndY - StartY);

  // Crop and repaint the image
  m_Lead1.SetDstClipRect(CropLeft, CropTop, CropWidth, CropHeight);
  m_Lead1.ForceRepaint();
  m_Lead1.SetRubberBandVisible(FALSE);
  m_Lead1.SetMousePointer(0); // Default
  }
}

19.	Press Ctrl-Home to go to the top of the current file (tutorDlg.cpp), and add the following to the list of include files:

#include <math.h>

20.	Rebuild and run the application.


Creating, Viewing, and Merging Color Separations (Visual C++ 4.0)
Creating, Viewing, and Merging Color Separations (C++ 4.0 and later)

Take the following steps to add code that creates CMYK color separations, displays each of the color planes, merges the planes, and displays the result. The code increases the contrast of the K plane to demonstrate how you can manipulate the color separations.

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

2.	Go to the Project WorkSpace and click the ResourceView tab.

3.	Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.

4.	 Add a new button under the Cancel button. To do this, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box.

5.	Double-click the button and change IDC_BUTTON1 to IDC_MERGE. Also, set the caption to Color Merge.

6.	Close all the windows until you reach the project window, answering yes when asked whether to save the changes.

7.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select IDC_MERGE.

c.	In the Messages list box, select BN_CLICKED.

d.	Click the Add function button. Choose OK for the default function name (OnMerge).

e.	Click the Edit Code button to start entering the code.

8.	Enter new code as follows:

void CTutorDlg::OnMerge()
{
  // TODO: Add your control notification handler code here

  // Count the button clicks and take the next step with each click
  static int ClickCount;

  BeginWaitCursor();
  // Turn off the automatic display rectangles.
  m_Lead1.SetAutoSetRects( FALSE );

  switch(ClickCount)
  {
  case 0:
    m_Lead1.ColorSeparate(COLORSEP_CMYK);
    // Free the palette used by the original bitmap

    // Just for fun, add contrast to the K plane
    m_Lead1.SetBitmap(m_Lead1.GetColorPlanes(3));
    m_Lead1.Contrast(300); // Increase the contrast

    m_Lead1.SetColorPlanes(3, m_Lead1.GetBitmap()); // Update the K plane

    m_Lead1.ForceRepaint();
    MessageBox("Separated. Keep clicking to see separations, then merge","Merge",MB_OK);
    break;
  case 1:
    m_Lead1.SetBitmap(m_Lead1.GetColorPlanes(0)); // Cyan
    m_Lead1.ForceRepaint();
    break;
  case 2:
    m_Lead1.SetBitmap(m_Lead1.GetColorPlanes(1)); //  Magenta
    m_Lead1.ForceRepaint();
    break;
  case 3:
    m_Lead1.SetBitmap(m_Lead1.GetColorPlanes(2)); //  Yellow
    m_Lead1.ForceRepaint();
    break;
  case 4:
    m_Lead1.SetBitmap(m_Lead1.GetColorPlanes(3)); //  K
    m_Lead1.ForceRepaint();
    break;
  case 5:
    m_Lead1.ColorMerge(COLORSEP_CMYK);
    m_Lead1.ForceRepaint();
    m_Lead1.SetColorPlanes(0, 0);   // free the color planes
    m_Lead1.SetColorPlanes(1, 0);
    m_Lead1.SetColorPlanes(2, 0);
    m_Lead1.SetColorPlanes(3, 0);
    MessageBox("Merged, with more contrast in the K plane","Merge",MB_OK);
    break;
  default:
    ClickCount = -1;
    MessageBox("Cycle is finished","Merge",MB_OK);
    break;
  };

  ClickCount = ClickCount + 1;
  EndWaitCursor();
}

9.	Rebuild and run the application.


Updating a Gauge and Detecting a User Interrupt (Visual C++ 4.0)
Updating a Gauge and Detecting a User Interrupt (C++ 4.0 and later)

Take the following steps to update a gauge during processing and detect a user interrupt:

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

2.	Go to the Project WorkSpace and click the ResourceView tab.

3.	Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.

4.	 Add a new button under the Cancel button. To do this, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box.

5.	Add another button under the previously added button.

6.	Double-click the first button and change IDC_BUTTON1 to IDC_MEDIAN. Also, set the caption to Do &Median.

7.	Double-click the second button and change IDC_BUTTON2 to IDC_QUIT. Also, set the caption to &Quit.

8.	To build a gauge, select the Progress control on the Controls toolbar. (If you do not have a Progress control, you can use any control that has a rectangular shape and a border.) Put the gauge at the top of the dialog box to keep it away from the image.

9.	Double-click on the gauge and change the ID from IDC_PROGRESS1 to IDC_GAUGE.

10.	Close all the windows until you reach the project window, answering yes when asked whether to save the changes.

11.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select IDC_MEDIAN.

c.	In the Messages list box, select BN_CLICKED.

d.	Click the Add function button. Choose OK for the default function name (OnMedian).

e.	Click the Edit Code button to start entering the code.

12.	Enter new code as follows:

void CTutorDlg::OnMedian()
{
  // TODO: Add your control notification handler code here
  // Enable the ProgressStatus event
  m_Lead1.SetEnableProgressEvent( TRUE );
  // Initialize the indicators
  fEscape = FALSE; // The user does not want to quit
  fInProc = TRUE; // Processing is taking place
  // Perform a relatively slow median filter
  m_Lead1.Median(4);
  // Clean up
  fInProc = FALSE; //  Processing is no longer taking place
  m_Lead1.ForceRepaint();
  // reset the gauge
  GetDlgItem(IDC_GAUGE)->InvalidateRect(NULL, TRUE);
}

13.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select IDC_QUIT.

c.	In the Messages list box, select BN_CLICKED.

d.	Click the Add function button. Choose OK for the default function name (OnQuit).

e.	Click the Edit Code button to start entering the code.

14.	Enter new code as follows:

void CTutorDlg::OnQuit()
{
  // TODO: Add your control notification handler code here
  fEscape = TRUE; // The user wants to quit

  // Set the gauge back to the beginning
  GetDlgItem(IDC_GAUGE)->InvalidateRect(NULL, TRUE);
}

15.	Edit the TUTORDLG.H file and change the definition of CTutorDlg : CDialog by inserting the following lines after DECLARE_MESSAGE_MAP:

BOOL    fInProc;
BOOL    fEscape;

16.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select IDC_LEAD1.

c.	In the Messages list box, select ProgressStatus.

d.	Click the Add function button. Choose OK for the default function name (OnProgressStatusLead1).

e.	Click the Edit Code button to start entering the code.

17.	Enter new code as follows:

void CTutorDlg::OnProgressStatusLead1(short iPercent)
{
  MSG msg;
  // are there any messages in the queue (like a button being pressed) ?
  while( PeekMessage(&msg,NULL, 0, 0, PM_REMOVE) )
  {
    TranslateMessage( &msg );      /* Translates virtual key codes.  */
    DispatchMessage( &msg );       /* Dispatches message to window.  */
  }
  if( !fEscape ) // Look for the Click on the Quit button
  {
    CWnd *pwndGauge = GetDlgItem( IDC_GAUGE );
    RECT rcGauge;
    pwndGauge->GetClientRect( &rcGauge );
    // Update the gauge
    short LineLength = (rcGauge.right-rcGauge.left) * iPercent / 100;
    CDC *pdc = pwndGauge->GetDC();
    CPen hpen( PS_SOLID, rcGauge.bottom - rcGauge.top, RGB(0,0,0) ); // black pen
    CPen *pOldPen = pdc->SelectObject(&hpen);

    pdc->MoveTo( rcGauge.left, (rcGauge.top + rcGauge.bottom) / 2 );
    pdc->LineTo( rcGauge.left + LineLength, (rcGauge.top + rcGauge.bottom) / 2 );
    pdc->SelectObject(pOldPen);
  }
  else
    m_Lead1.SetEnableProgressEvent(FALSE); // Cancel the task
}

18.	Continue with the remaining steps to prevent the user from quitting while a process is still going. This requires additional checks in the handling of the OK and Cancel buttons.

19.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select IDCANCEL.

c.	In the Messages list box, select BN_CLICKED.

d.	Click the Add function button. Choose OK for the default function name (OnCancel).

e.	Click the Edit Code button to start entering the code.

20.	Enter new code as follows:

void CTutorDlg::OnCancel()
{
  // TODO: Add extra cleanup here
  if( !fInProc )
    CDialog::OnCancel();
}

21.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select IDOK.

c.	In the Messages list box, select BN_CLICKED.

d.	Click the Add function button. Choose OK for the default function name (OnOK).

e.	Click the Edit Code button to start entering the code.

22.	Enter new code as follows:

void CTutorDlg::OnOK()
{
  // TODO: Add extra validation here
  if( !fInProc )
    CDialog::OnOK();
}

23.	Insert the following line in the TUTORDLG.CPP file at the end of CTutorDlg::OnInitDialog, just before the return statement:

fInProc = FALSE;

24.	Rebuild the application and run the program.


Creating an MDI Application (Visual C++ 4.0)
Creating an MDI Application (C++ 4.0 and later)

Take the following steps to start an MDI (Multiple Document Interface) project and to add some code that positions, scales, and displays an image in a dialog box.

1.	Start the Microsoft Developer Studio for Visual C++, version 4.0.

2.	Select the File >New menu option, select Project Workspace, and click the OK button.

3.	In the New Project Workspace dialog box, do the following:

a.	In the Type list box, select MFC AppWizard (exe).

b.	In the Name text box, specify mditutor.

c.	In the Location text box, specify the path of the project.

d.	In the Platforms list box, check Win32 Platforms.

e.	Click the Create button.

4.	In the Step 1 dialog box, do the following:

a.	Select Multiple Documents.

b.	Click the Next button.

5.	In the Step 2 of 6 dialog box, do the following:

a.	Select None for Database support.

b.	Click the Next button.

6.	In the Step 3 of 6 dialog box, do the following:

a.	Select None for OLE compound document support.

b.	Select OLE controls for the type of OLE support.

c.	Click the Next button.

7.	In the Step 4 of 6 dialog box, do the following:

a.	Ensure that that 3D Controls and Printing and Print Preview are selected as features to include.

b.	Click the Next button.

8.	In the Step 5 of 6 dialog box, do the following:

a.	For comments, ensure that Yes, Please is selected.

b.	For how to use the MFC library, select As a statically linked library.

c.	Click the Next button.

9.	In the Step 6 of 6 dialog box, do the following:

a.	Select CMditutorView from the class list that AppWizard will create so that it appears in the Class name entry field.

b.	Change the Base class from CView to CFormView.

c.	Click the Finish button.

10.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)

11.	Change the resource file to add a LEAD control to the mditutor dialog template form as follows:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the mditutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_MDITUTOR_FORM to design the form.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Insert > Component. (The Component Gallery appears.)

g.	Click the OLE Controls tab.

h.	Double-click the LEAD Control icon. (The Confirm Classes dialog box appears.)

i.	Ensure that both CLead and CPicture are checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD control appears in the Controls toolbar.)

k.	 Click the LEAD control icon; then click the mditutor dialog box to add the control to the dialog box.

l.	Double-click the new LEAD control to edit its properties.

m.	Change the ID to IDC_LEAD1.

n.	Press Ctrl-F4 to close all windows back to the Project Workspace.

12.	Do the following to add m_Lead1 to the CMditutorView class and link the variable to the LEAD control using dynamic data exchange:

a.	From the main menu, select View > ClassWizard. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CMditutorView.

d.	In the Control IDs list, select IDC_LEAD1.

e.	Click the Add Variable... button.

f.	Specify m_Lead1 as the variable name, and Control as the category.

g.	Click OK to close the dialog box.

13.	Do the following to add code to the OnInitialUpdate function:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMditutorView.

c.	In the Object IDs list box, select CMditutorView.

d.	In the Messages list box, select OnInitialUpdate.

e.	Click the Add function button.

f.	Click the Edit Code button to start entering the code.

14.	Edit the OnInitialUpdate() function to add the following code after the line that says //TODO: Add your specialized code here:

CDocument *pDoc = GetDocument();

int nRet = m_Lead1.Load((LPCTSTR)pDoc->GetPathName(), 0, 1, 1);

if (nRet )
{
   char szBuffer[30];
   wsprintf(szBuffer, "Load Error: Error code %d", nRet);
   AfxMessageBox(szBuffer);

   m_Lead1.SetBitmap(0);
   // Parent of view is MDI Child frame window
   CFrameWnd *pMDIFrame = GetParentFrame();
   pMDIFrame->PostMessage(WM_CLOSE);
}
else
{
   m_Lead1.SetPaintPalette(PAINTPALETTE_AUTO);

   CRect rcRect;
   GetClientRect(rcRect);
   m_Lead1.MoveWindow(rcRect);
}

15.	Add the L_OCX40.H and L_OcxErr.H files, which define LEAD constants, to your project as follows:

a.	Copy the \lead\include\l_ocx40.h and l_ocxerr.h files to your project directory.

b.	In the Project Workspace, click the FileView tab.

b.	Double-click the Dependencies folder to open it.

c.	Double-click the StdAfx.h file to edit it.

d.	Add the following line to the end of the file:

#include "L_OCX40.H"

16.	In the file Mditutor.CPP, find the function CMditutorApp::InitInstance() and comment out some lines as follows:

// Parse command line for standard shell commands, DDE, file open
// CCommandLineInfo cmdInfo;
// ParseCommandLine(cmdInfo);

// Dispatch commands specified on the command line
// if (!ProcessShellCommand(cmdInfo))
// return FALSE;

17.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMditutorView.

c.	In the Object IDs list box, select CMditutorView.

d.	In the Messages list box, select WM_SIZE.

e.	Click the Add function button.

f.	Click the Edit Code button to start entering the code.

18.	Edit the OnSize() function to add the following code after the line that says //TODO: Add your message handler code here:

if (IsWindow(m_Lead1.m_hWnd))
  m_Lead1.MoveWindow(0, 0, cx, cy);

19.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMainFrame.

c.	In the Object IDs list box, select CMainFrame.

d.	In the Messages list box, select WM_PALETTECHANGED.

e.	Click the Add function button.

f.	Click the Edit Code button to start entering the code.

20.	Edit the OnPaletteChanged() function to add the following code after the line that says //TODO: Add your message handler code here:

CMDIChildWnd* pMDIChildWnd = MDIGetActive();
if (pMDIChildWnd == NULL)
  return; // no active MDI child frame

SendMessageToDescendants(WM_DOREALIZE,
  (WPARAM)pFocusWnd->m_hWnd, (LPARAM) TRUE);

21.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMainFrame.

c.	In the Object IDs list box, select CMainFrame.

d.	In the Messages list box, select WM_QUERYNEWPALETTE.

e.	Click the Add function button.

f.	Click the Edit Code button to start entering the code.

22.	Edit the OnQueryNewPalette() function so that it appears as follows:

BOOL CMainFrame::OnQueryNewPalette()
{
  // always realize the palette for the active view
  CMDIChildWnd* pMDIChildWnd = MDIGetActive();
  if (pMDIChildWnd == NULL)
    return FALSE; // no active MDI child frame (no new palette)
  CView* pView = pMDIChildWnd->GetActiveView();
  ASSERT(pView != NULL);

  // just notify the target view
  return((BOOL) pView->SendMessage(WM_DOREALIZE,
                         (WPARAM)m_hWnd, (LPARAM) FALSE));
}

23.	Edit the MDITUTOR.H file and add the following line after the preprocessing:

#define WM_DOREALIZE  (WM_USER + 512)

24.	Edit the MDITUTORVIEW.H file and insert the following line just before DECLARE_MESSAGE_MAP():

afx_msg LRESULT OnDoRealize(WPARAM wParam, LPARAM lParam);

25.	Edit the MditutorView.CPP file and add the following function:

LRESULT CMditutorView::OnDoRealize(WPARAM wParam, LPARAM lParam)
{
    if (!m_Lead1.m_hWnd  ||  !m_Lead1.GetBitmap())
         return FALSE;

    if(lParam)
    {
        return m_Lead1.SendMessage(WM_PALETTECHANGED, wParam);
    }
    else
    {
        UINT nColorsChanged = 0;
        CDC* pdc;
        pdc = theApp.m_pMainWnd->GetDC();
        HPALETTE hpal =
           (HPALETTE)m_Lead1.GetPalette((OLE_HANDLE) pdc->m_hDC);
      if(hpal)
      {
           CPalette pal;
           pal.Attach(hpal);
          CPalette* oldPalette = pdc->SelectPalette(&pal, (BOOL) lParam);
          nColorsChanged = pdc->RealizePalette();
          if (nColorsChanged > 0)
                m_Lead1.InvalidateRect(NULL, FALSE);
          pdc->SelectPalette(oldPalette, TRUE);
      }
        theApp.m_pMainWnd->ReleaseDC(pdc);
      return ((LRESULT) (BOOL) (nColorsChanged > 0));
    }
}

26.	In the MditutorView.CPP file, look for the following lines:

BEGIN_MESSAGE_MAP(CMditutorView, CFormView)
  //{{AFX_MSG_MAP(CMditutorView)

After these lines, add the following line:

ON_MESSAGE(WM_DOREALIZE, OnDoRealize)

Also, near the top of the file, add the following line:

extern CMditutorApp  theApp;

27.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMditutorView.

c.	In the Object IDs list box, select CMditutorView.

d.	In the Messages list box, select OnActivateView.

e.	Click the Add function button.

f.	Click the Edit Code button to start entering the code.

28.	Edit the OnActivateView() function so that it appears as follows:

void CMditutorView::OnActivateView(BOOL bActivate, CView* pActivateView,
                                 CView* pDeactiveView)
{
  // TODO: Add your specialized code here and/or call the base class

  CFormView::OnActivateView(bActivate, pActivateView, pDeactiveView);
  if (bActivate)
  {
      ASSERT(pActivateView == this);
      OnDoRealize((WPARAM)theApp.m_pMainWnd->m_hWnd,
                (LPARAM) FALSE);   // same as SendMessage(WM_DOREALIZE);
  }
}

29.	To remove the default printing functions, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMditutorView.

c.	In the Object IDs list box, select CMditutorView.

d.	In the Messages list box, select OnPrint.

e.	Click Delete function and answer YES to the dialog box.

f.	In the Messages list box, select OnBeginPrinting.

g.	Click Delete function and answer YES to the dialog box.

h.	Click OK to exit ClassWizard.

i.	Go to MditutorView.CPP and manually delete the functions CMditutorView::OnPrint() and CMditutorView::OnBeginPrinting().

30.	To add new printing functions, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMditutorView.

c.	In the Object IDs list box, select CMditutorView.

d.	In the Messages list box, select OnDraw.

e.	Click the Add function button.

f.	Click the Edit Code button to start entering the code.

31.	Edit the OnDraw() function so that it appears as follows:

void CMditutorView::OnDraw(CDC* pDC)
{
  CRect rcClip;
  CSize winext;
  CSize viewext;
  CSize paintext;

  CMditutorDoc* pDoc = GetDocument();
  ASSERT_VALID(pDoc);

  if(pDC->IsPrinting())
  {
    pDC->SaveDC();
    ::GetWindowExtEx(pDC->m_hDC, &winext);
    ::GetViewportExtEx(pDC->m_hDC, &viewext);
    paintext.cx = MulDiv((int) m_Lead1.GetBitmapWidth(), viewext.cx, winext.cx);
    paintext.cy = MulDiv((int) m_Lead1.GetBitmapHeight(), viewext.cy, winext.cy);
    ::SetMapMode(pDC->m_hDC, MM_TEXT);
    m_Lead1.Render((OLE_HANDLE) pDC->m_hDC, (float) 0, (float) 0, (float)
                   paintext.cx, (float) paintext.cy);
    pDC->RestoreDC(-1);
  }
}

32.	To remove unused menu items, click the ResourceView tab of the Project Workspace, and do the following:

a.	Open the mditutor resources folder.

b.	Open the Menu folder.

c.	Double-click on IDR_MAINFRAME

d.	Click the File menu; then select the New menu item and press the Delete key.

e.	Double-click on IDR_MDITUTORTYPE.

f.	Click the File menu option; then select and delete the following items: New, Save, and Save As....

g.	Press Ctrl-F4 twice to return to the Project Workspace.

33.	On the main menu, select Build > Build mditutor.exe to build the project.

34.	On the main menu, select Build > Execute mditutor.exe to run the project.


Using a PanWindow (Visual C++ 4.0 and later)
Using a PanWindow (Visual C++ 4.0 or later)

Take the following steps to start a project and to add some code that opens and displays an image file and allows you to bring up a PanWindow.

1.	Start a new project as follows:

For C++ 4.x, run Microsoft Developer Studio for Visual C++, select the File >New menu option, select Project Workspace, and click the OK button. In the New Project Workspace dialog box, do the following:

a.	In the Type list box, select MFC AppWizard (exe).

b.	In the Name text box, specify pan.

c.	In the Location text box, specify the path of the project.

d.	In the Platforms list box, check Win32.

e.	Click the Create button.

For C++ 5.0, run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:

a.	Click the Projects tab.

b.	Select MFC AppWizard (exe) as the project type

c.	In the Project name text box, specify pan.

d.	In the Location text box, specify the path of the project.

e.	Click the OK button.

2.	In the Step 1 dialog box, do the following:

a.	Select Dialog based.

b.	Click the Next button.

3.	In the Step 2 of 4 dialog box, do the following:

a.	Ensure that About Box is selected.

b.	Ensure that 3D controls is selected.

c.	Select OLE controls (ActiveX controls in 5.0).

d.	Click the Next button.

4.	In the Step 3 of 4 dialog box, do the following:

a.	For comments, ensure that Yes, Please is selected.

b.	For how to use the MFC library, select As a shared DLL.

c.	Click the Next button.

5.	In the Step 4 of 4 dialog box, just click Finish.

6.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)

7.	Add the L_OCX40.H and l_OcxErr.H files to your project as follows:

a.	Copy the L_ocx40.h and l_ocxerr.h files to your project directory, from the \lead\include\ directory.

b.	In the Project Workspace, click the FileView tab.

c.	Double-click the pan files folder to open it.

d.	Double-click the Dependencies folder (the Header Files folder in 5.0) to open it.

e.	Double-click the StdAfx.h file to edit it.

f.	Add the following lines to the end of the file:

#include "L_OCX40.H"

8.	Add a LEAD control to the main window as follows:

For C++ 4.x:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the dlgtutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_PAN_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Insert > Component. (The Component Gallery appears.)

g.	Click the OLE controls tab.

h.	Double-click the LEAD Main Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLead, CPicture, and COleFont are checked.

j.	Click OK to complete the selection, then click Close to close the Component Gallery. (The LEAD controls appears in the controls toolbar.)

k.	 Click the LEAD Control icon on the toolbar; then size and position the control as you want it to appear at run time.

l.	Double-click the new LEAD Control to edit its properties.

m.	Change the ID to IDC_LEAD1.

For C++ 5.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the pan resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_PAN_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Project > Add To Project > Components and controls.

g.	Select Registered ActiveX controls.

h.	Double-click the LEAD Main Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLead, CPicture, and COleFont are checked.

j.	Click OK to complete the selection, then click Close to close the Component Gallery. (The LEAD controls appears in the controls toolbar.)

k.	Click the LEAD Main Control icon; then size and position the control as you want it to appear at run time.

l.	Use the right mouse button to edit the properties of the new LEAD Main Control.

m.	Change the ID to IDC_LEAD1.

9.	Add a command button to your form and name it as follows:

ID	Caption

IDC_PANWIN	Show Pan Window

10.	Add a Check box control to the main window and set the ID and Caption as follows:

ID	Caption

IDC_CHECK1	Pan Window

11.	Press Ctrl-F4 to close all windows back to the Project Workspace.

12.	Do the following to add m_LEAD1 and m_Check1 to the CPanDlg class and link the variable to the controls using dynamic data exchange:

a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CPanDlg.

d.	In the Control IDs list, select IDC_LEAD1.

e.	Click the Add Variable... button.

f.	Specify m_LEAD1 as the variable name, and control as the category.

g.	Click OK to close the dialog box.

h.	Back in MFC Wizard, go to the Member Variables tab, and ensure CDlgTutorDlg is in the Class Name box.

i.	In the Control IDs list, select IDC_CHECK1.

j.	Click the Add Variable... button.

k.	Specify m_Check1 as the variable name, and control as the category.

l.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

13.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CPanDlg.

c.	In the Object IDs list box, select IDC_PANWIN.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnPanWin).

f.	Click the Edit Code button and enter the following code:

/*set the location of the PanWindow*/
m_LEAD1.SetPanWinX(100.0f);
m_LEAD1.SetPanWinY(100.0f);
/*set the size of the PanWindow*/
m_LEAD1.SetPanWinWidth(150.0f);
m_LEAD1.SetPanWinHeight(200.0f);
/*set the type of mouse pointer*/
m_LEAD1.SetPanWinPointer(12);

m_LEAD1.SetPanWinTitle("PanWindow");
m_LEAD1.SetPanWinRectColor(RGB(0, 0, 255));
m_LEAD1.SetPanWinSysMenu(1);
/*use the settings for LEAD1*/
m_LEAD1.SetPanWinPaintPalette(m_LEAD1.GetPaintPalette());
m_LEAD1.SetPanWinBitonalScaling(m_LEAD1.GetBitonalScaling());
m_LEAD1.SetPanWinPaintScaling(m_LEAD1.GetPaintScaling());
m_LEAD1.SetPanWinPaintDither(m_LEAD1.GetPaintDither());
m_LEAD1.ShowPanWin(TRUE);
m_Check1.SetCheck(TRUE);

14.	Add the following line to the OnInitDialog procedure in the PanDlg.cpp file, following : // TODO: Add extra initialization here

m_LEAD1.Load("v:\\images\\eagle.cmp", 0, 0, 1);

15.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CPanDlg.

c.	In the Object IDs list box, select IDC_LEAD1.

d.	In the Messages list box, select OnPanWin.

e.	Click the Add function button. Choose OK for the default function name (OnPanWin).

f.	Click the Edit Code button and code the OnPanWin procedure as follows:

if (iFlag == PANWIN_DESTROYED)
{
m_Check1.SetCheck(FALSE);
}

16.	On the main menu, select Build> Build pan.exe to build the project.

17.	On the main menu, select Build> Execute pan.exe to run the project.


Print a Real Image Size in Inches (Visual C++ 4.0)
Print a Real Image Size in Inches (C++ 4.0 and later)

Take the following steps to start a project and to add some code that prints an image:

1.	Start a new project as follows:

For C++ 4.x, run Microsoft Developer Studio for Visual C++, select the File >New menu option, select Project Workspace, and click the OK button. In the New Project Workspace dialog box, do the following:

a.	In the Type list box, select MFC AppWizard (exe).

b.	In the Name text box, specify tutor.

c.	In the Location text box, specify the path of the project.

d.	In the Platforms list box, check Win32.

e.	Click the Create button.

For C++ 5.0, run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:

a.	Click the Projects tab.

b.	Select MFC AppWizard (exe) as the project type

c.	In the Project name text box, specify tutor.

d.	In the Location text box, specify the path of the project.

e.	Click the OK button.

2.	In the Step 1 dialog box, do the following:

a.	Select Dialog based.

b.	Click the Next button.

3.	In the Step 2 of 4 dialog box, do the following:

a.	Ensure that About Box is selected.

b.	Ensure that 3D Controls is selected.

c.	Select OLE Controls (ActiveX Controls in 5.0).

d.	Click the Next button.

4.	In the Step 3 of 4 dialog box, do the following:

a.	For comments, ensure that Yes, Please is selected.

b.	For how to use the MFC library, select As a statically linked library.

c.	Click the Next button.

5.	In the Step 4 of 4 dialog box, just click Finish.

6.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)

7.	Include the L_OCX40.H  and L_OcxErr.H header files, which define LEAD constants, in your project as follows:

#include "L_OCX40.H"
#include "L_OcxErr.H"

8.	Add a LEAD control to the main window as follows:

For C++ 4.x:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the tutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_TUTOR_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Insert > Component. (The Component Gallery appears.)

g.	Click the OLE Controls tab.

h.	Double-click the LEAD Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLead, CPicture, and COleFont are checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD control appears in the Controls toolbar.)

k.	 Click the LEAD control icon; then size and position the control as you want it to appear at run time.

l.	Double-click the new LEAD control to edit its properties.

m.	Change the ID to IDC_LEAD1.

For C++ 5.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the tutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_TUTOR_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Project > Add To Project > Components and Controls.

g.	Select Registered ActiveX Controls.

h.	Double-click the LEAD Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLead, CPicture, and COleFont are checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD control appears in the Controls toolbar.)

k.	 Click the LEAD control icon; then size and position the control as you want it to appear at run time.

l.	Use the right mouse button to edit the properties of the new LEAD control.

m.	Change the ID to IDC_LEAD1.

9.	Do the following to add m_Lead1 to the CTutorDlg class and link the variable to the LEAD control using dynamic data exchange:

a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CTutorDlg.

d.	In the Control IDs list, select IDC_LEAD1.

e.	Click the Add Variable... button.

f.	Specify m_Lead1 as the variable name, and Control as the category.

g.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

10.	Go to the OnInitDialog() function as follows:

a.	In the Project Workspace, click the ClassView tab.

b.	Double-click the tutor classes folder to open it.

c.	Expand the CTutorDlg class.

d.	Double-click the OnInitDialog() function to edit it.

11.	Edit the OnInitDialog() function to add the following code after the line that says //TODO: Add extra initialization here:

long hdcPrinter;   // Printer device context
float fRealWidth;   // Image's real width in inches
float fRealHeight;   // Image's real height in inches
float fPrnDPIX;   // Number of pixels per logical inch along the screen width
float fPrnDPIY;   // Number of pixels per logical inch along the screen height

m_Lead1.Load("c:\\image1.cmp", 0, 0, 1);

fRealWidth = m_Lead1.GetBitmapWidth() / m_Lead1.GetBitmapXRes();
fRealHeight = m_Lead1.GetBitmapHeight() / m_Lead1.GetBitmapYRes();

hdcPrinter = m_Lead1.PrintStart();

fPrnDPIX = (float)GetDeviceCaps((HDC)hdcPrinter, LOGPIXELSX);
fPrnDPIY = (float)GetDeviceCaps((HDC)hdcPrinter, LOGPIXELSY);

m_Lead1.Render(hdcPrinter, 1, 1, fPrnDPIX * fRealWidth, fPrnDPIY * fRealHeight);

m_Lead1.PrintEnd(hdcPrinter);

12.	On the main menu, select Build > Build tutor.exe to build the project.

13.	On the main menu, select Build > Execute tutor.exe to run the project.


Using the Magnifying Glass (Visual C++ 4.0 and later)
Using the Magnifying Glass (Visual C++ 4.0 or later)

Take the following steps to enable the generation of the MagGlass event and update the zoomed image using the LEADTOOLS Internet toolkit methods.

1.	Start a new project as follows:

For C++ 4.x, run Microsoft Developer Studio for Visual C++, select the File >New menu option, select Project Workspace, and click the OK button. In the New Project Workspace dialog box, do the following:

a.	In the Type list box, select MFC AppWizard (exe).

b.	In the Name text box, specify MagGlsNt.

c.	In the Location text box, specify the path of the project.

d.	In the Platforms list box, check Win32.

e.	Click the Create button.

For C++ 5.0, run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:

a.	Click the Projects tab.

b.	Select MFC AppWizard (exe) as the project type

c.	In the Project name text box, specify MagGlsNt.

d.	In the Location text box, specify the path of the project.

e.	Click the OK button.

2.	In the Step 1 dialog box, do the following:

a.	Select Dialog based.

b.	Click the Next button.

3.	In the Step 2 of 4 dialog box, do the following:

a.	Ensure that About Box is selected.

b.	Ensure that 3D Controls is selected.

c.	Select OLE Controls (ActiveX Controls in 5.0).

d.	Click the Next button.

4.	In the Step 3 of 4 dialog box, do the following:

a.	For comments, ensure that Yes, Please is selected.

b.	For how to use the MFC library, select As a statically linked library.

c.	Click the Next button.

5.	In the Step 4 of 4 dialog box, just click Finish.

6.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)

7.	Add a LEAD Main control and LEAD Internet control to the main window as follows:

For C++ 4.x:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the MagGlsNt resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_MAGGLSNT_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	Select also the OK button; then press the Delete key to delete it.

g.	From the main menu, select Insert > Component. (The Component Gallery appears.)

h.	Click the OLE Controls tab.

i.	Double-click the LEAD Main Control (14) icon. (The Confirm Classes dialog box appears.)

j.	Ensure that CLead, CPicture, and COleFont are checked.

k.	Click OK to complete the selection.

l.	Double-click the LEAD Internet Control (14) icon. (The Confirm Classes dialog box appears.)

m.	Ensure that CLeadNet and CLTInetPacket are checked.

n.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD Main Control and LEAD Internet Control appear in the Controls toolbar.)

o.	Click the LEAD Main control icon; then size and position the control as you want it to appear at run time.

p.	Double-click the new LEAD Main Control to edit its properties.

q.	Change the ID to IDC_LEAD1.

r.	Click the LEAD Internet Control icon and position the control on the main window.

s.	Double-click the new LEAD Internet Control to edit its properties.

t.	Change the ID to IDC_LEADNet1.

For C++ 5.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the MagGlsNt resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_MAGGLSNT_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	Select also the OK button; then press the Delete key to delete it.

g.	From the main menu, select Project > Add To Project > Components and Controls.

h.	Select Registered ActiveX Controls.

i.	Double-click the LEAD Main Control (14) icon. (The Confirm Classes dialog box appears.)

j.	Ensure that CLead, CPicture, and COleFont are checked.

k.	Click OK to complete the selection.

l.	Double-click the LEAD Internet Control (14) icon. (The Confirm Classes dialog box appears.)

m.	Ensure that CLeadNet and CLTInetPacket are checked.

n.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD Main Control and LEAD Internet Control appear in the Controls toolbar.)

o.	Click the LEAD Main Control icon; then size and position the control as you want it to appear at run time.

p.	Use the right mouse button to edit the properties of the new LEAD Main Control.

q.	Change the ID to IDC_LEAD1.

r.	Click the LEAD Internet Control icon and position the control on the main window.

s.	Use the right mouse button to edit the properties of the new LEAD Internet Control.

t.	Change the ID to IDC_LEADNet1.

8.	Add seven command buttons to your form and name them as follows:

ID	Caption

IDC_STARTUP_SERVER	Start Up Server

IDC_SHUTDOWN_SERVER	Shut Down Server

IDC_CONNECT	Connect To Remote Server

IDC_DISCONNECT	Disconnect From Remote Server

IDC_LOAD_REMOTE	Load Remote Image

IDC_START_MAG_GLASS	Start Magnifying Glass

IDC_STOP_MAG_GLASS	Stop Magnifying Glass

9.	Add an Edit Box Control to the main window and give it the following ID:

ID

IDC_REMOTE_ADDRESS

10.	Press Ctrl-F4 to close all windows back to the Project Workspace.

11.	Do the following to add m_Lead1, m_LEADNet1 and m_RemoteAddress to the CMagGlsNtDlg class and link the variables to its control using dynamic data exchange:

a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CMagGlsNtDlg.

d.	In the Control IDs list, select IDC_LEAD1.

e.	Click the Add Variable... button.

f.	Specify m_Lead1 as the variable name, and Control as the category.

g.	Click OK to close the dialog box.

h.	Back in MFC Wizard, go to the Member Variables tab, and ensure CMagGlsNtDlg is in the Class Name box.

i.	In the Control IDs list, select IDC_LEADNet1.

j.	Click the Add Variable... button.

k.	Specify m_LEADNet1 as the variable name, and control as the category.

l.	Click OK to close the dialog box

m.	Back in MFC Wizard, go to the Member Variables tab, and ensure CMagGlsNtDlg is in the Class Name box.

n.	In the Control IDs list, select IDC_Remote.

o.	Click the Add Variable... button.

p.	Specify m_RemoteAddress as the variable name, and control as the category.

q.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

12.	Add the L_Ocx40.h, L_OcxErr.h, LtKey.h, LtLck_.h and LtNetOcx.h files to your project as follows:

a.	Copy the L_Ocx40.h, L_OcxErr.h, LtKey.h, LtLck_.h and LtNetOcx.h files to your project directory from the \lead\include directory.

b.	In the Project Workspace, click the FileView tab.

c.	Double-click the MagGlsNt files folder to open it.

d.	Double-click the Dependencies folder (the Header Files folder in 5.0) to open it.

e.	Double-click the StdAfx.h file to edit it.

f.	Add the following lines to the end of the file:

#include "L_Ocx40.H"

#include "LtNetOcx.h"

#include "LtInetPacket.h"

13.	Edit the MagGlsNtDlg.h file and insert the following declarations in the public section:

short m_hServer;

long  m_nCommandID;

BOOL  m_bMagGlass;

14.	Go to the OnInitDialog() function as follows:

a.	In the Project Workspace, click the ClassView tab.

b.	Double-click the MagGlsNt classes folder to open it.

c.	Expand the CMagGlsNtDlg class.

d.	Double-click the OnInitDialog() function to edit it.

15.	Edit the OnInitDialog() function to add the following code after the line that says //TODO: Add extra initialization here:

// Initialize some variables
m_hServer = 0;
m_nCommandID = 0;
m_bMagGlass = FALSE;

// Set defaults for displaying the image.
// These are all persistent properties that can be set in the properties box.
m_Lead1.SetAppearance(APPEARANCE_FLAT);
m_Lead1.SetBorderStyle(1);
m_Lead1.SetBackColor(RGB(255, 255, 125));
m_Lead1.SetPaintDither(PAINTDITHER_DIFFUSION);
m_Lead1.SetPaintPalette(PAINTPALETTE_AUTO);
m_Lead1.SetAutoRepaint(TRUE);
m_Lead1.SetAutoSize(FALSE);
m_Lead1.SetAutoSetRects(TRUE);
m_Lead1.SetPaintSizeMode(PAINTSIZEMODE_FIT);

// Unlock the Internet features.  Note that TestKey is a sample key and will not work in your toolkit.
m_LEADNet1.UnlockSupport(L_SUPPORT_INTERNET, "TestKey");

// Stop runtime exceptions generation for LEAD Main and LEAD Internet Controls.
m_Lead1.SetEnableMethodErrors(FALSE);
m_LEADNet1.SetEnableMethodErrors(FALSE);

16.	To add code for the Start Up Server button, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_STARTUP_SERVER.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnStartupServer).

f.	Click the Edit Code button and code the OnStartupServer procedure as follows:

int nRet;
CString cs;

/* initialize server on port 1000 */
nRet = m_LEADNet1.InetServerInit(&m_hServer, 1000);
if (nRet != 0)
{
   cs.Format("%s %d\n","Error initializing server:", nRet);
   AfxMessageBox(cs);
}

17.	To add code for the Shut Down Server button, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_SHUTDOWN_SERVER.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnShutdownServer).

f.	Click the Edit Code button and code the OnShutdownServer procedure as follows:

short nRet;
CString cs;

if (m_hServer != 0)
{
   nRet = m_LEADNet1.InetServerClose(m_hServer);
   if(nRet != 0)
   {
      cs.Format("%s %d\n","Error Shutting Down server:", nRet);
      AfxMessageBox(cs);
   }
   else
      m_hServer = 0;
}

18.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_LEADNet1.

d.	In the Messages list box, select InetAccept.

e.	Click the Add function button. Choose OK for the default function name (OnInetAcceptLEADNet1).

f.	Click the Edit Code button and code the OnInetAcceptLEADNet1 procedure as follows:

int nRet;
short hComputer;
BSTR hName;
CString cs;

nRet = m_LEADNet1.InetAcceptConnect(m_hServer, &hComputer);

if (nRet != 0)
{
   cs.Format("%s %d\n","Error accepting connection:", nRet);
   AfxMessageBox(cs);
}
m_LEADNet1.InetGetHostName(hComputer, HOST_NAME_DESCRP, &hName);
/* add to our send list */
m_LEADNet1.SetSendList(m_LEADNet1.GetSendListNum(), hComputer);
AfxMessageBox("Connection accepted.");

19.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDCANCEL.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnCancel).

f.	Click the Edit Code button and add the following code after the line that says //TODO: Add extra cleanup here:

int i, num;
/* disconnect all connections */
num = m_LEADNet1.GetConnectListNum();
for (i = 0; i < num; i++)
{
   m_LEADNet1.InetDisconnect(m_LEADNet1.GetConnectList(i));
}

if(m_bMagGlass)
   m_Lead1.StopMagGlass();

20.	To add code for the Connect To Remote Server button, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_CONNECT.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnConnect).

f.	Click the Edit Code button and code the OnConnect procedure as follows:

int nRet;
CString cs,text;

/* get the name of the computer entered in the edit box control */
m_RemoteAddress.GetWindowText(text);
/* Connect to remote computer on port 1000 */
nRet = m_LEADNet1.InetConnect(text, 1000);
if (nRet != 0)
{
   cs.Format(" %s\n %s\n", "Error connecting to :", text);
   AfxMessageBox(cs);
}

21.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_DISCONNECT.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnDisconnect).

f.	Click the Edit Code button and code the OnDisconnect procedure as follows:

int nRet;
CString cs;
/* We are assuming only one connection in this example.
   Therefore, the handle to the remote computer will be
   in the first position in the SendList.
*/
nRet = m_LEADNet1.InetDisconnect(m_LEADNet1.GetSendList(0));
if (nRet != 0)
{
   cs.Format("%s %d\n", "Error disconnecting from the server:",nRet);
   AfxMessageBox(cs);
}

22.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_LEADNet1.

d.	In the Messages list box, select InetConnected.

e.	Click the Add function button. Choose OK for the default function name (OnInetConnectedLEADNet1).

f.	Click the Edit Code button and code the OnInetConnectedLEADNet1 procedure as follows:

BSTR sRemote;
/* Get the name of the remote host */
m_LEADNet1.InetGetHostName(iComputer, HOST_NAME_DESCRP, &sRemote);
/* Add this connection to our SendList. */
m_LEADNet1.SetSendList(m_LEADNet1.GetSendListNum(), iComputer);
AfxMessageBox("Successfully connected to server.");

23.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_LEADNet1.

d.	In the Messages list box, select InetDisconnected.

e.	Click the Add function button. Choose OK for the default function name (OnInetDisconnectedLEADNet1).

f.	Click the Edit Code button and code the OnInetDisconnectedLEADNet1 procedure as follows:

    if(m_hServer == 0)
      AfxMessageBox("Disconnect from remote server.");
    else
      AfxMessageBox("Connection to remote computer closed.");

24.	To add code for the Load Remote Image button, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_LOAD_REMOTE.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnLoadRemote).

f.	Click the Edit Code button and code the OnLoadRemote procedure as follows:

short nRet;
CString csOut;

nRet = m_LEADNet1.InetSendLoadCmd(m_nCommandID++, "v:\\images\\eagle.cmp", 0, 1);

if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
{
   csOut.Format("ERROR %d calling InetSendLoadCmd.", nRet);
   AfxMessageBox(csOut);
}

25.	To add code for the Start Magnifying Glass button, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_START_MAG_GLASS.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnStartMagGlass).

f.	Click the Edit Code button and code the OnStartMagGlass procedure as follows:

   if(m_Lead1.GetBitmap() != 0 && m_hServer == 0)
   {
      // Enable MagGlass event.
      if(!m_Lead1. GetEnableMagGlassEvent())
         m_Lead1. SetEnableMagGlassEvent(TRUE);

      m_Lead1.SetRgnFrameType(0);

      // Start the Magnifying Glass
      int nRet = m_Lead1.StartMagGlass(150.0f, 100.0f, 200,
                                       0, m_Lead1.GetBackColor(),
                                       FALSE, 1.0f, TRUE, CROSSHAIR_FINE,
                                       TRUE, TRUE);

      if(nRet == 0)
         m_bMagGlass = TRUE;
   }

26.	To add code for the Stop Magnifying Glass button, press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_STOP_MAG_GLASS.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnStopMagGlass).

f.	Click the Edit Code button and code the OnStopMagGlass procedure as follows:

   if(m_Lead1.GetBitmap() != 0 && m_hServer == 0)
   {
      int nRet = m_Lead1.StopMagGlass();

      if(nRet == 0)
         m_bMagGlass = FALSE;
   }

27.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a. 	In the Class name combo box, select CMagGlsNtDlg.

b.	In the Object IDs list box, select IDC_LEAD1.

c.	In the Messages list box, select MagGlass.

d.	Click the Add function button. Choose OK for the default function name (OnMagGlassLead1).

e.	Click the Edit Code button and code the OnMagGlassLead1 procedure as follows:

   short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendGetMagGlassDataCmd(m_nCommandID++, 0, vMaskPlane, nMaskPlaneStart, nMaskPlaneEnd);

   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendGetMagGlassDataCmd.", nRet);
      AfxMessageBox(csOut);
   }

28.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_LEADNet1.

d.	In the Messages list box, select InetReceiveCmd.

e.	Click the Add function button. Choose OK for the default function name (OnInetReceiveCmdLEADNet1).

f.	Click the Edit Code button and code the OnInetReceiveCmdLEADNet1 procedure as follows:

   short nStatus;
   CString szMsg;
   CLTInetPacket Packet(Params);
   VARIANT vColorBuffer;

   nStatus = ERROR_FEATURE_NOT_SUPPORTED;

   if(nError != 0)
      nStatus = ERROR_TRANSFER_ABORTED;
   else
   {
      switch(InetCommand)
      {
      case INETCMD_LOAD:
         // check the validity of the parameters
         if((Packet.GetParamCount() == 4) && (Packet.GetParamType(0) == PARAM_TYPE_STRING) &&
            (Packet.GetParamType(1) == PARAM_TYPE_INT32) && (Packet.GetParamType(2) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(3) == PARAM_TYPE_UINT32))
         {
            nStatus = m_Lead1.Load((CString)Packet.GetParamValue(0).bstrVal,
                                  (short)Packet.GetParamValue(1).lVal,
                                  1, 1);

            if(nStatus != 0)
            {
               szMsg.Format("Load Bitmap failed with error code %d", nStatus);
               AfxMessageBox(szMsg);
            }
            else
            {
               nStatus = m_LEADNet1.InetSendBitmap(m_Lead1.GetBitmap(), FILE_CMP, 0, QFACTOR_PQ2);

               if(nStatus != 0)
               {
                  szMsg.Format("SendBitmap failed with error code %d", nStatus);
                  AfxMessageBox(szMsg);
               }
            }
         }
         else
            nStatus = ERROR_INV_PARAMETER; // Invalid parameter

         m_LEADNet1.InetSendLoadRsp(nCommandID, 0, 0, NULL, nStatus);
         return;
         break;

      case INETCMD_GET_MAGGLASS_DATA:
         // check the validity of the parameters
         if((Packet.GetParamCount() == 5) && (Packet.GetParamType(0) == PARAM_TYPE_UINT32) &&
            (Packet.GetParamType(1) == PARAM_TYPE_UINT32) && (Packet.GetParamType(2) == PARAM_TYPE_USTRING) &&
            (Packet.GetParamType(3) == PARAM_TYPE_INT32) && (Packet.GetParamType(4) == PARAM_TYPE_INT32))
         {
            if(m_Lead1.GetBitmap() != 0)
            {
               nStatus = m_LEADNet1.InetGetMagGlassData(m_Lead1.GetBitmap(),
                                                        &vColorBuffer,
                                                        Packet.GetParamValue(2),
                                                        Packet.GetParamValue(3).iVal,
                                                        Packet.GetParamValue(4).iVal);

               if(nStatus != 0)
               {
                  szMsg.Format("InetGetMagGlassData failed with error code %d", nStatus);
                  AfxMessageBox(szMsg);
               }
            }
            else
               nStatus = ERROR_INV_PARAMETER; // Invalid parameter
         }
         else
            nStatus = ERROR_INV_PARAMETER; // Invalid parameter

         m_LEADNet1.InetSendGetMagGlassDataRsp(nCommandID,
                                               vColorBuffer,
                                               Packet.GetParamValue(2),
                                               Packet.GetParamValue(3).iVal,
                                               Packet.GetParamValue(4).iVal,
                                               0, NULL, nStatus);
         return;
         break;
      }
   }
   m_LEADNet1.InetSendRsp(InetCommand, nCommandID, Params, 0, NULL, nStatus);

29.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_LEADNet1.

d.	In the Messages list box, select InetReceiveRsp.

e.	Click the Add function button. Choose OK for the default function name (OnInetReceiveRspLEADNet1).

f.	Click the Edit Code button and code the OnInetReceiveRspLEADNet1 procedure as follows:

   short nRet;

   CString szMsg;

   CLTInetPacket Packet(Params);

   if(nError != 0)

      return;

   switch(InetCommand)

   {

   case INETCMD_LOAD:

      if(nStatus != 0)

      {

         szMsg.Format("Load failed with error code %d", nStatus);

         AfxMessageBox(szMsg);

      }

      break;

   case INETCMD_GET_MAGGLASS_DATA:

      if(nStatus == 0)

      {

         if((Packet.GetParamCount() == 6) && (Packet.GetParamType(0) == PARAM_TYPE_UINT32) &&

            (Packet.GetParamType(1) == PARAM_TYPE_USTRING) && (Packet.GetParamType(2) == PARAM_TYPE_UINT32) &&

            (Packet.GetParamType(3) == PARAM_TYPE_USTRING) && (Packet.GetParamType(4) == PARAM_TYPE_INT32) &&

            (Packet.GetParamType(5) == PARAM_TYPE_INT32))

         {

            nRet = m_Lead1.UpdateMagGlass (Packet.GetParamValue(1),

                                             Packet.GetParamValue(3),

                                             Packet.GetParamValue(4).lVal,

                                             Packet.GetParamValue(5).lVal,

                                             TRUE);

            if(nRet != 0)

            {

               szMsg.Format("UpdateMagGlass failed with error code %d", nRet);

               AfxMessageBox(szMsg);

            }

         }

         else

            AfxMessageBox("Invalid parameter passed to INETCMD_GET_MAGGLASS_DATA response");

      }

      else

      {

         szMsg.Format("Get MagGlass Data from sever failed with error code %d", nStatus);

         AfxMessageBox(szMsg);

      }

      break;

   }

30.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CMagGlsNtDlg.

c.	In the Object IDs list box, select IDC_LEADNet1.

d.	In the Messages list box, select InetReceiveBitmap.

e.	Click the Add function button. Choose OK for the default function name (OnInetReceiveBitmapLEADNet1).

f.	Click the Edit Code button and code the OnInetReceiveBitmapLEADNet1 procedure as follows:

m_Lead1.SetBitmap(hBitmap);

31.	To accommodate a 256-color display driver, continue with the remaining steps, which send WM_QUERYNEWPALETTE and WM_PALETTECHANGED messages to the LEADTOOLS ActiveX.

32.	In the Project Workspace, click the FileView tab.

33.	Edit the MagGlsNtDlg.h file and insert the following lines in the definition of CMagGlsNtDlg class, just before DECLARE_MESSAGE_MAP():

afx_msg BOOL OnQueryNewPalette();
afx_msg void OnPaletteChanged(CWnd *pwin);

34.	Edit the MagGlsNtDlg.CPP file and insert the following lines between the lines: BEGIN_MESSAGE_MAP(CMagGlsNtDlg, CDialog) and END_MESSAGE_MAP():

ON_WM_QUERYNEWPALETTE()
ON_WM_PALETTECHANGED()

35.	Go to the end of MagGlsNtDlg.CPP file and insert the following two functions:

BOOL CMagGlsNtDlg::OnQueryNewPalette()
{
  if(!IsWindow(m_Lead1.m_hWnd))
    return FALSE;
  return m_Lead1.SendMessage(WM_QUERYNEWPALETTE);
}

void CMagGlsNtDlg::OnPaletteChanged(CWnd* pFocusWnd)
{
  if(pFocusWnd->m_hWnd == m_hWnd || !IsWindow(m_Lead1.m_hWnd))
     return;
  m_Lead1.SendMessage(WM_PALETTECHANGED, (WPARAM) pFocusWnd->m_hWnd);
}

36.	On the main menu, select Build > Build MagGlsNt.exe to build the project.

37.	On the main menu, select two times Build > Execute MagGlsNt.exe to run two projects.

38.	In the first project press Start Up Server button.

39.	In the second project fill the edit box with the IP Address of the Remote computer on which you run the first project as Server then press Connect To Remote Server button to connect to the specified address.

40.	After that press the Load Remote Image button of project number two to load an image on Server then press the Start Magnifying Glass button to start the Magnifying Glass with Internet support, then start press the left key and move over the image to see the zoomed area using the Magnifying Glass with Internet support.


Combining Images with Regions (Visual C++ 4.0)
Combining Images with Regions (C++ 4.0 and later)

Take the following steps to start a project and to add some code that combines two images with a region:

1.	Start a new project as follows:

For C++ 4.x, run Microsoft Developer Studio for Visual C++, select the File >New menu option, select Project Workspace, and click the OK button. In the New Project Workspace dialog box, do the following:

a.	In the Type list box, select MFC AppWizard (exe).

b.	In the Name text box, specify tutor.

c.	In the Location text box, specify the path of the project.

d.	In the Platforms list box, check Win32.

e.	Click the Create button.

For C++ 5.0, run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:

a.	Click the Projects tab.

b.	Select MFC AppWizard (exe) as the project type

c.	In the Project name text box, specify tutor.

d.	In the Location text box, specify the path of the project.

e.	Click the OK button.

2.	In the Step 1 dialog box, do the following:

a.	Select Dialog based.

b.	Click the Next button.

3.	In the Step 2 of 4 dialog box, do the following:

a.	Ensure that About Box is selected.

b.	Ensure that 3D Controls is selected.

c.	Select OLE Controls (ActiveX Controls in 5.0).

d.	Click the Next button.

4.	In the Step 3 of 4 dialog box, do the following:

a.	For comments, ensure that Yes, Please is selected.

b.	For how to use the MFC library, select As a statically linked library.

c.	Click the Next button.

5.	In the Step 4 of 4 dialog box, just click Finish.

6.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)

7.	Add the L_OCX40.H files, which define LEAD constants, to your project as follows:

a.	In the Project Workspace, click the FileView tab.

b.	Double-click the tutor files folder to open it.

c.	Double-click the Dependencies folder (the Header Files folder in 5.0) to open it.

d.	Double-click the StdAfx.h file to edit it.

e.	Add the following line to the end of the file:

#include "C:\LEAD\Include\L_OCX40.H"

8.	Add a LEAD control to the main window as follows:

For C++ 4.x:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the tutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_TUTOR_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Insert > Component. (The Component Gallery appears.)

g.	Click the OLE Controls tab.

h.	Double-click the LEAD Main Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLead, CPicture, and COleFont are checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD control appears in the Controls toolbar.)

k.	 Click the LEAD control icon; then size and position the control as you want it to appear at run time.

l.	Double-click the new LEAD control to edit its properties.

m.	Change the ID to IDC_LEAD1.

n.	 Click the LEAD control icon; then size and position the control as you want it to appear at run time.

o.	Double-click the new LEAD control to edit its properties.

p.	Change the ID to IDC_LEAD2.

q.	Ensure that the Visible radio button is unchecked.

For C++ 5.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the tutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_TUTOR_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Project > Add To Project > Components and Controls.

g.	Select Registered ActiveX Controls.

h.	Double-click the LEAD Main Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLead, CPicture, and COleFont are checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD control appears in the Controls toolbar.)

k.	 Click the LEAD control icon; then size and position the control as you want it to appear at run time.

l.	Use the right mouse button to edit the properties of the new LEAD control.

m.	Change the ID to IDC_LEAD1.

n.	 Click the LEAD control icon; then size and position the control as you want it to appear at run time.

o.	Use the right mouse button to edit the properties of the new LEAD control.

p.	Change the ID to IDC_LEAD2.

q.	Ensure that the Visible radio button is unchecked.

9.	Press Ctrl-F4 to close all windows back to the Project Workspace.

10.	Do the following to add m_Lead1 and m_Lead2 to the CTutorDlg class and link the variables to the LEAD controls using dynamic data exchange:

a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CTutorDlg.

d.	In the Control IDs list, select IDC_LEAD1.

e.	Click the Add Variable... button.

f.	Specify m_Lead1 as the variable name, and Control as the category.

g.	Click OK to close the dialog box.

h.	In the Control IDs list, select IDC_LEAD2.

i.	Click the Add Variable... button.

j.	Specify m_Lead2 as the variable name, and Control as the category.

k.	Click OK to close the dialog box and click OK to close the MFC ClassWizard.

11.	Go to the OnInitDialog() function as follows:

a.	In the Project Workspace, click the ClassView tab.

b.	Double-click the tutor classes folder to open it.

c.	Expand the CTutorDlg class.

d.	Double-click the OnInitDialog() function to edit it.

12.	Edit the OnInitDialog() function to add the following code after the line that says //TODO: Add extra initialization here:

   m_Lead1.Load("c:\\sample1.cmp", 0, 0, 1);
   m_Lead2.Load("c:\\sample2.cmp", 0, 0, 1);

   m_Lead1.SetRgnRect(100, 100, 300, 300, L_RGN_SET);
   m_Lead1.Combine(100, 100, 300, 300, m_Lead2.GetBitmap(), 0, 0, CB_OP_ADD | CB_DST_0);

   m_Lead1.FreeRgn();

13.	On the main menu, select Build > Build tutor.exe to build the project.

14.	On the main menu, select Build > Execute tutor.exe to run the project.


Using the Main ActiveX Control in VC++ .NET

1.	Open .NET and create a new Visual C++ MFC Application that is Dialog Based and uses MFC in a shared DLL.  Take the defaults for everything else.  Name the project "Tutor"

2.	Once the main dialog appears, right click the dialog and select "Insert ActiveX control…"  From the list of ActiveX Controls select "LEAD Main Control" and click okay.

3.	Right click the control on the dialog and select "Add Variable…" Name the variable "m_Lead1" and click okay.

4.	Open the header file "stdafx.h" and at the end of the file add the following line of code:

#import "ltocx14n.ocx" no_namespace, named_guids, exclude("ReadyStateConstants")

5.	Open the *.h file TutorDlg.h.  Add the public variable: _DLeadPtr m_pLead1;

6.	Open the *.cpp file TutorDlg.cpp.  In OnInitDialog add the code:

m_pLead1 = m_Lead1.GetControlUnknown();

m_pLead1->Load("D:\\Test\\Test.jpg", 0, 0, 1);

7.	Compile and run your code.  You should see an image when the dialog appears.

8.	In this code you will use the m_pLead1 variable when calling any property or method.  Follow the same procedure to add other controls to the form.


Miscellaneous Examples (Visual C++ 4.0)
Miscellaneous Examples (C++ 4.0 and later)

You can test any of the following examples by adding a command button to one of the previous lessons in the tutorial, and pasting the sample code in the Click procedure. In most cases, you can add the button after the first lesson Loading and Displaying an Image.  In cases where you need to use the Imaging Common Dialog Control, you must first finish Using Imaging Common Dialog

AboutBox example for C++ 4.0 and later

AddBitmaps example for C++ 5.0 and later

AddBorder example for C++ 4.0 and later

AddFrame example for C++ 4.0 and later

AddNoise example for C++ 4.0 and later

AlphaBlend example for C++ 5.0 and later

AllowSelection example for Visual C++ 4.0

Animate Event example for C++ 4.0 and later

AnimationEnable example for C++ 4.0 and later

AnimationPause example for C++ 4.0 and later

AnnAutoDialogFontSize example for C++ 4.0 and later

AnnAutoDrawEnable example for C++ 4.0 and later

AnnAutomation Property example for C++ 4.0 and later

AnnAutoMenuEnable example for C++ 4.0 and later

AnnAutoResize example for C++ 4.0 and later

AnnAutoRotate example for C++ 4.0 and later

AnnBoundingRect... example for Visual C++

AnnChange Event example for C++ 4.0 and later

AnnContainer example for C++ 4.0 and later

AnnDataPath example for C++ 4.0 and later

AnnDeletePage example for C++ 5.0 and later

AnnDeletePageArray example for C++ 5.0 and later

AnnDeletePageMemory example for C++ 5.0 and later

AnnDestroy example for C++ 4.0 and later

AnnEnumerate example for C++ 4.0 and later

AnnGetContainer example for Visual C++

AnnGetGrouping example for C++ 4.0 and later

AnnGetHyperlinkParam example for C++ 4.0 and later

AnnGetHyperlinkString example for C++ 4.0 and later

AnnGetHyperlinkType example for C++ 4.0 and later

AnnGetNameOffsetX example for C++ 5.0 and later

AnnGetNameRestrict example for C++ 5.0 and later

AnnGetLocked example for C++ 4.0 and later

AnnGetObjectFromTag example for C++ 4.0 and later

AnnGetPoint... example for C++ 4.0 and later

AnnGetProtractorOptions example for Visual C++

AnnGetRgnHandle example for Visual C++

AnnGetScalarX example for Visual C++

AnnGetSelectList example for C++ 4.0 and later

AnnGroup example for C++ 4.0 and later

AnnHitTest example for Visual C++

AnnHyperlink example for C++ 4.0 and later

AnnHyperlinkMenuEnable example for C++ 4.0 and later

AnnInsert example for C++ 4.0 and later

AnnLoadArray example for C++ 4.0 and later

AnnLock example for C++ 4.0 and later

AnnLocked example for C++ 4.0 and later

AnnMenu example for C++ 4.0 and later

AnnMouseDown example for C++ 4.0 and later

AnnMove example for C++ 4.0 and later

AnnNameBoundingRectLeft example for Visual Basic

AnnNameRectLeft example for Visual Basic

Annotation Colors example for Visual C++

AnnRectLeft example for C++ 4.0 and later

AnnRotate example for C++ 4.0 and later

AnnSaveArray example for C++ 4.0 and later

AnnSaveMemory example for C++ 4.0 and later

AnnSaveOffset example for Visual C++

AnnSaveTag example for C++ 4.0 and later

AnnSelect example for C++ 4.0 and later

AnnSelectRect example for Visual C++

AnnSetAutoMenuItemEnable example for C++ 4.0 and later

AnnSetAutoText example for C++ 4.0 and later

AnnSetGrouping example for C++ 4.0 and later

AnnSetHyperlinkMsg example for C++ 4.0 and later

AnnSetHyperlinkString example for C++ 4.0 and later

AnnSetMetafile example for Visual C++

AnnSetPolyFillMode example for Visual C++

AnnSetROP2 example for Visual C++

AnnSetSecondaryBitmap example for Visual C++

AnnSetUnit example for Visual C++

AnnSetUser example for C++ 4.0 and later

AnnSetWnd example for Visual C++

AnnShowLockedIcon example for C++ 4.0 and later

AnnToolChecked example for C++ 4.0 and later

AnnToolDestroy example for C++ 4.0 and later

AnnUndo example for C++ 4.0 and later

AnnUndoDepth example for C++ 4.0 and later

AnnUndoEnable example for C++ 4.0 and later

AnnUngroup example for C++ 4.0 and later

AnnUnlock example for C++ 4.0 and later

AnnUnlocked example for C++ 4.0 and later

AnnUnrealize example for C++ 4.0 and later

AntiAlias example for C++ 5.0 and later

Appearance (ImageList Control) example for C++ 4.0 and later

Appearance example for C++ 4.0 and later

AutoAnimate example for C++ 4.0 and later

AutoPan example for C++ 4.0 and later

AutoSegment (Mixed Raster Content Control) example for C++ 4.0 and later

AutoSetTool example for C++ 4.0 and later

AutoSize example for C++ 4.0 and later

AutoTrim example for C++ 4.0 and later

Average example for C++ 4.0 and later

BackColor (ImageList Control) example for C++ 4.0 and later

BackColor example for C++ 4.0 and later

BackErase example for C++ 4.0 and later

BalanceColors example for C++ 5.0 and later

BinaryFilter example for C++ 4.0 and later

BitmapAlpha example for C++ 4.0 and later

BitmapCompression example for C++ 4.0 and later

BitmapDataPath example for C++ 4.0 and later

BitmapDataPathClosed example for Visual C++

BitmapDpi example for Visual C++

BitmapToClient example for C++ 4.0 and later

BitmapXres and BitmapYres example for C++ 4.0 and later

BitonalScaling (ImageList Control) example for C++ 4.0 and later

BitonalScaling example for C++ 4.0 and later

BorderColor (ImageList Control) example for C++ 4.0 and later

BorderRemove example for C++ 4.0 and later

BorderStyle example for C++ 4.0 and later

BrowseDir (Thumbnail Browser Control) example for C++ 4.0 and later

ButtonColumns example for C++ 4.0 and later

ButtonMenuTool example for C++ 4.0 and later

ButtonRows example for C++ 4.0 and later

ButtonVisible example for Visual C++ 4.0

Capture example for C++ 4.0 and later

CenterImage example for C++ 4.0 and later

Change example for C++ 4.0 and later

Clear (ImageList Control) example for C++ 4.0 and later

ClientToBitmap example for C++ 4.0 and later

ColorRes example for C++ 4.0 and later

ColorResList example for C++ 4.0 and later

Combine example for C++ 4.0 and later

CombineBitmapWarp example for C++ 4.0 and later

CombineExt example for C++ 4.0 and later

Comment example for C++ 4.0 and later

ContinueBrowse (Thumbnail Browser Control) example for C++ 4.0 and later

ContourFilter example for C++ 4.0 and later

Contrast example for C++ 4.0 and later

ConvertToColoredGray example for C++ 5.0 and later

Create example for C++ 4.0 and later

CreateBitmap, Size, and Combine example for C++ 4.0 and later

CreateUserBitmap example for C++ 4.0 and later

CreateThumbnailFromFile example for C++ 4.0 and later

CurveToBezier example for C++ 4.0 and later

dbCan... example for C++ 4.0 and later

DblClick (ImageList Control) example for C++ 4.0 and later

DblClick example for C++ 4.0 and later

DDB example for C++ 4.0 and later

DeleteBitmapListItems example for C++ 4.0 and later

DeletePage example for C++ 4.0 and later

Deskew example for C++ 4.0 and later

Deskew example for C++ 4.0 and later

Despeckle example for C++ 4.0 and later

DIB example for C++ 4.0 and later

DocCleanBitmap example for C++ 4.0 and later

DocCleanSuccess example for C++ 4.0 and later

DoubleBuffer example for C++

DrawShape example for C++ 4.0 and later

DrawText example for C++ 4.0 and later

Dst... example for C++ 4.0 and later

EdgeDetector example for C++ 5.0 and later

Emboss example for C++ 4.0 and later

EnableFastRender example for C++ 4.0 and later

EnableKeyboard (ImageList Control) example for C++ 4.0 and later

EnableMethodErrors (ImageList Control) example for C++ 4.0 and later

EnableMethodErrors example for C++ 4.0 and later

EnableMethodErrors (Thumbnail Browser Control) example for C++ 4.0 and later

EnablePaint example for C++ 4.0 and later

EnableZoomInRect example for C++ 4.0 and later

EnumSegments (Mixed Raster Content Control) example for C++ 4.0 and later

Exif example for C++ 4.0 and later

FastRotate example for C++ 4.0 and later

FeatherAlphaBlend example for C++ 5.0 and later

FeedLoad example for C++ 4.0 and later

FileOpen example for C++ 4.0 and later

FilePage Event example for C++ 4.0 and later

Fill example for C++ 4.0 and later

Flip example for C++ 4.0 and later

FloaterDstClip... example for C++ 4.0 and later

Font (ImageList Control) example for C++ 4.0 and later

Font example for C++ 4.0 and later

ForeColor (ImageList Control) example for C++ 4.0 and later

Frame... example for C++ 4.0 and later

GammaCorrect example for C++ 4.0 and later

GaussianFilter example for C++ 5.0 and later

GetBitmapClipSegments example for C++ 4.0 and later

GetBitmapDC example for C++ 4.0 and later

GetColorCount example for C++ 4.0 and later

GetDIB example for C++ 4.0 and later

GetFileInfo example for C++ 4.0 and later

GetFloaterHandle example for C++ 4.0 and later

GetFunctionalLookupTable example for C++ 4.0 and later

GetHistogram example for C++ 4.0 and later

GetHistogramGray example for C++ 4.0 and later

GetMinMaxBits example for C++ 4.0 and later

GetMinMaxVal example for C++ 4.0 and later

GetRgnHandle example for C++ 4.0 and later

GetUserLookupTable example for C++ 4.0 and later

Grayscale example for C++ 4.0 and later

GrayscaleExt example for C++ 5.0 and later

Halftone example for C++ 4.0 and later

HasMagGlass example for C++ 4.0 and later

HistoContrast example for C++ 4.0 and later

HistoEqualize example for C++ 4.0 and later

HistogramTableSize example for C++ 4.0 and later

HScrollInfo example for C++ 4.0 and later

HSV_HfromRGB example for C++ 4.0 and later

HTableL example for C++ 4.0 and later

Hue example for C++ 4.0 and later

hDocCleanRgn example for C++ 4.0 and later

hWnd (AnnToolbar) example for C++ 4.0 and later

IgnoreFilters example for C++ 4.0 and later

InfoHasAlpha example for C++ 4.0 and later

InfoLayers example for C++ 4.0 and later

InfoViewPerspective example for C++ 4.0 and later

Insert (ImageList Control) example for C++ 4.0 and later

InsertAt (ImageList Control) example for C++ 4.0 and later

InsertBitmapListItem example for C++ 4.0 and later

InsertFromBitmapList (ImageList Control) example for C++ 4.0 and later

Intensity example for C++ 4.0 and later

IntensityDetect example for C++ 4.0 and later

Invert example for C++ 4.0 and later

InvertedText example for C++ 4.0 and later

ISISAcquire example for C++ 4.0 and later

ISISAcquireMulti example for C++ 4.0 and later

ISISGetASCIITag example for C++ 4.0 and later

ISISGetASCIITagChoiceCount example for C++ 4.0 and later

ISISGetTagChoiceCount example for C++ 4.0 and later

IsISISAvailable example for C++ 4.0 and later

ISISSelect example for C++ 4.0 and later

ISISSetScanOptions example for C++ 4.0 and later

IsSigned example for C++ 4.0 and later

IsSupportLocked (ISIS Control) example for C++ 4.0 and later

IsSupportLocked (OLE DB Control) example for C++ 4.0 and later

Item (ImageList Control) example for C++ 4.0 and later

ItemBackgroundColor (ImageList Control) example for C++ 4.0 and later

ItemSelected (ImageList Control) example for C++ 4.0 and later

ItemUnSelected example for C++ 4.0 and later

ItemWidth (ImageList Control) example for C++ 4.0 and later

J2KCompressionControl example for C++ 4.0 and later

J2KCompressionRatio example for C++ 4.0 and later

J2KROIControl Example for Visual C++ 4.0

J2KSetDefaults example for C++ 4.0 and later

J2KTargetFileSize example for C++ 4.0 and later

KeyDown (ImageList Control) example for C++ 4.0 and later

KeyPress (ImageList Control) example for C++ 4.0 and later

KeyPress example for C++ 4.0 and later

KeyUp (ImageList Control) example for C++ 4.0 and later

LevelHighBit example for C++ 4.0 and later

LevelLowBit example for C++ 4.0 and later

LevelLUT example for C++ 4.0 and later

LevelLUTLength example for C++ 4.0 and later

LineProfile example for C++ 5.0 and later

LineRemove example for C++ 4.0 and later

Load (Mixed Raster Content Control) example for C++ 4.0 and later

LoadArray example for C++ 4.0 and later

LoadCompressed example for C++ 4.0 and later

LoadDatabase example for C++ 4.0 and later

LoadFromFile (ImageList Control) example for C++ 4.0 and later

LoadIFD example for Visual C++ 4.0

LoadInfo... example for C++ 4.0 and later

LoadICCProfile example for Visual C++

LoadMemory example for C++ 4.0 and later

LoadResize example for C++ 4.0 and later

LoadUseViewPerspective example for C++ 4.0 and later

MagGlassPaintContrast example for C++ 4.0 and later

MaxFilter example for C++ 4.0 and later

Median example for C++ 4.0 and later

MinFilter example for C++ 4.0 and later

Mosaic example for C++ 4.0 and later

MotionBlur example for C++ 5.0 and later

MouseDown (ImageList Control) example for C++ 4.0 and later

MouseMove (ImageList Control) example for C++ 4.0 and later

MousePointer (ImageList Control) example for C++ 4.0 and later

MouseWheel (Main Control) example for C++ 4.0 and later

ODBC example for C++ 4.0 and later

Oilify example for C++ 4.0 and later

OLEDropAllowed example for C++ 4.0 and later

OLEDropFile example for C++ 4.0 and later

OLEStartDrag (ImageList Control) example for C++ 4.0 and later

OLEStartDrag (Main Control) example for C++ 4.0 and later

OwnerDrawItem event example for C++ 4.0 and later

OwnerDrawItems example for C++ 4.0 and later

PageCount (ImageList Control) example for C++ 4.0 and later

Paint event example for C++ 4.0 and later

PaintContrast example for C++ 4.0 and later

PaintDither (ImageList Control) example for C++ 4.0 and later

PaintDither example for C++ 4.0 and later

PaintEffect example for C++ 4.0 and later

PaintGamma example for C++ 4.0 and later

PaintIntensity example for C++ 4.0 and later

PaintMaxPasses example for C++ 4.0 and later

PaintPalette example for C++ 4.0 and later

PaintROP3 example for C++ 4.0 and later

PaintScaling (ImageList Control) example for C++ 4.0 and later

PaintScaling example for C++ 4.0 and later

PaintSizeMode example for C++ 4.0 and later

PaintSizeUseDPI example for C++ 4.0 and later

PaintWhileLoad example for C++ 4.0 and later

PaintZoomFactor example for C++ 4.0 and later

PatternStyle example for C++ 4.0 and later

PCDRes example for C++ 4.0 and later

PDFSaveLowMemory example for C++ 4.0 and later

PDFSaveUseDPI example for C++ 4.0 and later

PDFXResolution example for C++ 4.0 and later

PicturizeBitmapList example for C++ 5.0 and later

Picturize example for C++ 4.0 and later

PicturizeSingle example for C++ 5.0 and later

Pixel example for C++ 4.0 and later

PixelData example for C++ 4.0 and later

Posterize example for C++ 4.0 and later

PreferredLoadFormat example for Visual C++ 4.0

PreLoadFilters example for C++ 4.0 and later

PrinterScaleHeight example for C++ 4.0 and later

ProgressivePasses example for C++ 4.0 and later

ProgressStatus example for C++ 4.0 and later

RasterizeViewMode example for C++ 4.0 and later

RawLoad example for C++ 4.0 and later

RawSave example for C++ 4.0 and later

ReadLoadResolutions example for C++ 4.0 and later

ReadyState example for C++ 4.0 and later

RefBitmapList example for C++ 4.0 and later

RemapHue example for C++ 4.0 and later

RemapTableSize example for C++ 4.0 and later

Remove (ImageList Control) example for C++ 4.0 and later

RemoveRedeye example for C++ 5.0 and later

RenderCenter example for C++ 5.0 and later

Resize (ImageList Control) example for C++ 4.0 and later

Resize event example for C++ 4.0 and later

ResizeRgn example for C++ 5.0 and later

RGBfromHSV example for C++ 4.0 and later

RgnChange example for C++ 4.0 and later

RgnFrameColor example for Visual C++ 4.0

Rotate example for C++ 4.0 and later

RowCount (ImageList Control) example for C++ 4.0 and later

Saturation example for C++ 4.0 and later

Save example for C++ 4.0 and later

Save (Mixed Raster Content Control) example for C++ 4.0 and later

SaveArray example for C++ 4.0 and later

SaveBuffer example for C++ 5.0 and later

SaveDatabase example for C++ 4.0 and later

SaveIFD example for C++ 4.0 and later

SaveInterlaced example for C++ 4.0 and later

SaveLayers example for C++ 4.0 and later

SaveLSB example for C++ 4.0 and later

SaveMemory example for C++ 4.0 and later

SavePage example for C++ 4.0 and later

SaveResolutionCount example for Visual C++ 4.0 and later

SaveTileWidth example for C++ 4.0 and later

SaveToFile (ImageList Control) example for C++ 4.0 and later

SaveWithStamp example for C++ 4.0 and later

ScaleMode (ImageList Control) example for C++ 4.0 and later

Scroll event example for C++ 4.0 and later

ScrollItems (ImageList Control) example for C++ 4.0 and later

ScrollStyle (ImageList Control) example for C++ 4.0 and later

SelectedItems example for C++ 4.0 and later

SelectAll (ImageList Control) example for C++ 4.0 and later

SelectionColor (ImageList Control) example for C++ 4.0 and later

SelectionStyle (ImageList Control) example for C++ 4.0 and later

SetNewStripe (Mixed Raster Content Control) example for C++ 4.0 and later

SetRgn... example for C++ 4.0 and later

SetRgnColorHSVRange example for C++ 4.0 and later

SetRgnColorRGBRange example for C++ 4.0 and later

SetRgnMagicWand example for Visual C++ 4.0

SetSelectionBitmap example for C++ 4.0 and later

SetSrcClipRect example for C++ 4.0 and later

SetSrcRect example for C++ 4.0 and later

SetTag example for C++ 4.0 and later

SkipFile example for C++ 4.0 and later

Sharpen example for C++ 4.0 and later

Shear example for C++ 4.0 and later

ShowMagGlass example for C++ 4.0 and later

Solarize example for C++ 4.0 and later

Sort (ImageList Control) example for C++ 4.0 and later

SpatialFilter example for C++ 4.0 and later

Src... example for C++ 4.0 and later

STable example for C++ 4.0 and later

StopMagGlass example for C++ 4.0 and later

StretchIntensity example for C++ 4.0 and later

SwapColors example for C++ 5.0 and later

TextWordWrap example for C++ 4.0 and later

TransitionEffect example for C++ 4.0 and later

TransparentColor example for C++ 4.0 and later

Trim example for C++ 4.0 and later

Underlay example for C++ 4.0 and later

UnlockSupport (ImageList Control) example for C++ 4.0 and later

UnlockSupport (ISIS Control) example for C++ 4.0 and later

UnlockSupport (Mixed Raster Content Control) example for C++ 4.0 and later

UnlockSupport (OLE DB Control) example for C++ 4.0 and later

UnlockSupport (Thumbnail Browser Control) example for C++ 4.0 and later

UnsharpMask example for C++ 5.0 and later

UserPalette and BitmapPalette example for C++ 4.0 and later

Version... example for C++ 4.0 and later

ViewSize example for C++ 4.0 and later

VTable example for C++ 4.0 and later

Window (ImageList Control) example for C++ 4.0 and later

WindowLevel... example for C++ 4.0 and later

WindowLevelBitmap example for C++ 4.0 and later

WindowLevelFillLUT example for C++ 4.0 and later

WMFResolution example for C++ 4.0 and later

WriteComment example for C++ 4.0 and later

WriteMarkerAction example for C++ 4.0 and later

ZoomIn example for C++ 4.0 and later

ZoomInDone example for C++ 4.0 and later


AboutBox example for Visual C++ 4.0
AboutBox example for C++ 4.0 and later

This example displays the LEADTOOLS ActiveX information.

m_Lead1.AboutBox();


AddBitmaps example for C++ 5.0 and later

   short i;
   m_Lead3.SetBitmap (0);
   for(i=0; i<5; ++i)
   {
      m_Lead2.SetBitmap(m_Lead1.GetBitmap());
      m_Lead2.Rotate (7200 * i, 0, RGB(255, 0, 0));
      m_Lead3.InsertBitmapListItem (-1, m_Lead2.GetBitmap());
   }
   m_Lead3.AddBitmaps(BC_AVG);


AddBorder example for C++ 4.0 and later

m_Lead1.AddBorder(30, 30, 30, 30, BORDER_OUTSIDE, BORDER_STYLE_OPAQUE, BORDER_EFFECT_CURVEDIN, 0, BORDER_GRAD_INSIDEOUT, RGB(200, 150, 150), 0, 200, FALSE, FALSE, 0, BORDER_SHADOW_LEFT, FALSE);


AddFrame example for C++ 4.0 and later

m_Lead1.AddFrame(m_Lead2.GetBitmap(), FALSE, FALSE, 0, 0, FRAME_OUTSIDE, FRAME_QUALITY_LOW);


AddNoise example for C++ 4.0 and later

This example adds red noise and redisplays the bitmap.

m_Lead1.AddNoise(500, CHANNEL_RED);
m_Lead1.ForceRepaint();


AlphaBlend example for C++ 5.0 and later

   m_Lead2.SetBitmap(m_Lead1.GetBitmap());
   m_Lead2.IntensityDetect(150, 250);
   m_Lead1.AlphaBlend(0, 0, m_Lead1.GetBitmapWidth(), m_Lead1.GetBitmapHeight(), m_Lead2.GetBitmap(), 0, 0, 128);


AllowSelection example for Visual C++ 4.0
AllowSelection example for C++ 4.0 and later

This example lets you step through the selection options. For manual selection you must provide the code for handling the selection.

void CTestimglstDlg::OnButton2()

{
   int nAllow;
   nAllow = m_LeadImgList1.GetAllowSelection();
   if (nAllow == ALLOWSELECTION_NONE)
   {
     m_LeadImgList1.SetAllowSelection(ALLOWSELECTION_SINGLE);
     	AfxMessageBox("Single Automatic Selection", MB_OK, 0);
   }
   else if (nAllow == ALLOWSELECTION_SINGLE)
   {
     m_LeadImgList1.SetAllowSelection(ALLOWSELECTION_MULTI);
     	AfxMessageBox("Multiple Automatic Selection", MB_OK, 0);
   }
   else
   {
     m_LeadImgList1.SetAllowSelection(ALLOWSELECTION_NONE);
     	AfxMessageBox("Manual Selection", MB_OK, 0);
   }
   return;
}


Animate Event Example for Visual C++ 4.0
Animate Event Example for C++ 4.0 and later

This example shows how the Animate event can be used to toggle the use of a button to start and stop the animation.

void CTutorDlg::OnAnimateLead1(BOOL bEnable)
{
   CWnd *pButton = GetDlgItem(IDC_BUTTON1);
   if (bEnable == TRUE)
      pButton->SetWindowText("Stop Animation");
   else
      pButton->SetWindowText("Start Animation");
}

void CTutorDlg::OnButton1()
{
   if (m_Lead1.GetAnimationEnable())
      m_Lead1.SetAnimationEnable(FALSE);
   else
      m_Lead1.SetAnimationEnable(TRUE);
}


AnimationEnable Example for Visual C++ 4.0
AnimationEnable Example for C++ 4.0 and later

This example loads and plays an animated file. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

// Load all pages of an AVI file.
m_Lead1.Load("c:\\windows\\system\\wndsurf1.avi", 0, 1, -1);

// Set properties for a scaled animation.
m_Lead1.SetAutoRepaint(TRUE);
m_Lead1.SetAutoSetRects(FALSE);

// Set the image display size to match the LEAD control.
m_Lead1.SetDstRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.SetDstClipRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());

// Allow a continuous loop.
m_Lead1.SetAnimationLoop(TRUE);

// Start the animation.
m_Lead1.SetAnimationEnable(TRUE);


AnimationPause Example for Visual C++ 4.0
AnimationPause Example for C++ 4.0 and later

void CAnimationDlg::OnEnableanimation()
{

   /* Load all pages of an animated gif file.*/
   m_LEAD1.Load ( "E:\\LEADTOOLS\\Images\\eye.gif", 0, 1, -1 ) ;
   // Set properties for a scaled animation.
   m_LEAD1.SetAutoRepaint (TRUE);
   m_LEAD1.SetAutoSetRects (FALSE);
   // Set the image display size to match the LEAD control.
   m_LEAD1.SetDstRect (0.0f, 0.0f, m_LEAD1.GetScaleWidth(), m_LEAD1.GetScaleHeight());
   m_LEAD1.SetDstClipRect (0.0f, 0.0f, m_LEAD1.GetScaleWidth(), m_LEAD1.GetScaleHeight());

   // Allow a continuous loop.
   m_LEAD1.SetAnimationLoop (TRUE);
   // Start the animation.
   m_LEAD1.SetAnimationEnable (TRUE);

   /*Set the middle frame as the start frame in the animation*/
   m_LEAD1.SetAnimationFrameIndex ((int)(m_LEAD1.GetBitmapListCount / 2) - 1);
}

void CAnimationDlg::OnTogglePause()
{
   m_LEAD1.SetAnimationPause (! m_LEAD1.GetAnimationPause () );
}


AnnAutoDialogFontSize example for Visual C++ 4.0
AnnAutoDialogFontSize example for C++ 4.0 and later

   // This example will set the dialog fonts to use Courier 15
   m_Lead1.AnnSetAutoText(ANNAUTOTEXT_DIALOG_FONT, "Courier New");
   m_Lead1.SetAnnAutoDialogFontSize(15);


AnnAutoDrawEnable Example for Visual C++ 4.0
AnnAutoDrawEnable Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example toggles the AnnAutoDrawEnable property.

if (m_Lead1.GetAnnAutoDrawEnable() == TRUE)
   m_Lead1.SetAnnAutoDrawEnable(FALSE);
else
   m_Lead1.SetAnnAutoDrawEnable(TRUE);


AnnAutomation Property Example for Visual C++ 4.0
AnnAutomation Property Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example shows how you can use the AnnAutomation property to access the automation object through DLL functions.

#include "l_bitmap.h" /* LEADTOOLS DLL header files */
void CTutorDlg::OnButton1()
{
   L_BOOL IsBold; /* Is the object’s text bold */
   OLE_HANDLE hAnnObject;

   hAnnObject = m_Lead1.GetAnnAutomation();

   /* Set the default font to bold, unless it already is */
   L_AnnGetFontBold((HANNOBJECT)hAnnObject, &IsBold);
   if (IsBold == TRUE)
       MessageBox ("Already bold", "Notice", MB_OK);
   else
       L_AnnSetFontBold((HANNOBJECT)hAnnObject, TRUE, 0);
}


AnnAutoMenuEnable Example for Visual C++ 4.0
AnnAutoMenuEnable Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example toggles the AnnAutoMenuEnable property.

if (m_Lead1.GetAnnAutoMenuEnable() == TRUE)
   m_Lead1.SetAnnAutoMenuEnable(FALSE);
else
   m_Lead1.SetAnnAutoMenuEnable(TRUE);


AnnAutoResize example for Visual C++ 4.0
AnnAutoResize example for C++ 4.0 and later

// This example will double the size of the bitmap and annotations
m_Lead1.SetAnnAutoResize(TRUE);
m_Lead1.Size( m_Lead1.GetBitmapWidth () * 2, m_Lead1.GetBitmapHeight() * 2, RESIZE_RESAMPLE);


AnnAutoRotate example for Visual C++ 4.0
AnnAutoRotate example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example enables automatic rotation of annotations, then rotates the bitmap 2222 hundredths of degrees to demonstrate the automation:

m_Lead1.SetAnnAutoRotate(TRUE);
m_Lead1.Rotate (2222, ROTATE_RESIZE, RGB(0, 0, 255));


AnnBoundingRact… Example for Visual C++ 4.0
AnnBoundingRect... example for Visual C++

   VARIANT     variantX, variantY;
   SAFEARRAY   *ptrsafearrayX, *ptrsafearrayY;
   SAFEARRAYBOUND    arrayboundX, arrayboundY;
   float *pX, *pY;   /* pointer to the data */
   /* Set up the VARIANT and the SAFEARRAY structures */
   arrayboundX.cElements = 4;
   arrayboundX.lLbound = 0;
   arrayboundY.cElements = 4;
   arrayboundY.lLbound = 0;
   ptrsafearrayX = SafeArrayCreate( VT_R4, 1, &arrayboundX);
   ptrsafearrayY = SafeArrayCreate( VT_R4, 1, &arrayboundX);
   SafeArrayLock( ptrsafearrayX );
   SafeArrayLock( ptrsafearrayY );
   pX = (float*)ptrsafearrayX->pvData;    /* get a pointer to the buffer */
   pY = (float*)ptrsafearrayY->pvData;    /* get a pointer to the buffer */

   V_VT(&variantX) = VT_ARRAY | VT_R4;
   V_VT(&variantY) = VT_ARRAY | VT_R4;
   V_ARRAY(&variantX) = ptrsafearrayX;
   V_ARRAY(&variantY) = ptrsafearrayY;

   long hObj = m_Lead1.AnnCreateItem (m_Lead1.GetAnnContainer(), ANNOBJECT_PROTRACTOR, TRUE);
   long hObj2 = m_Lead1.AnnCreateItem (m_Lead1.GetAnnContainer(), ANNOBJECT_POLYGON, TRUE);
   pX[1] = 10;  pY[1] = 20;
   pX[2] = 100; pY[2] = 200;
   pX[3] = 200; pY[3] = 100;
   m_Lead1.AnnSetPoints (hObj, variantX, variantY, 3);
   pX[0] = 50;  pY[0] = 220; // SetPoints starts at 0 because No. of points set to 4;
   m_Lead1.AnnSetPoints(hObj2, variantX, variantY, 4);
   SafeArrayUnlock( ptrsafearrayX );
   SafeArrayDestroy( ptrsafearrayX );
   SafeArrayUnlock( ptrsafearrayY );
   SafeArrayDestroy( ptrsafearrayY );
   m_Lead1.AnnSetFillMode (hObj2, ANNFILLMODE_OPAQUE, FALSE);
   CString msg;
   m_Lead1.AnnBringToFront (hObj2);
   msg.Format("Polygon Area:%d\nProtractor Angle:%f", m_Lead1.AnnGetArea (hObj2), (double)m_Lead1.AnnGetAngle (hObj));
   ::MessageBox(NULL, (LPCSTR)msg, "Brought Polygon to front", MB_OK);
   m_Lead1.AnnSendToBack (hObj2);
   msg.Format("Protractor Bounding Rectangle, Left:%f, Top:%f, Width:%f, Height:%f" ,
      (double)m_Lead1.GetAnnBoundingRectLeft (hObj),
      (double)m_Lead1.GetAnnBoundingRectTop (hObj),
      (double)m_Lead1.GetAnnBoundingRectWidth (hObj),
      (double)m_Lead1.GetAnnBoundingRectHeight (hObj));
   ::MessageBox(NULL, (LPCSTR)msg, "Sent Polygon to back", MB_OK);
   m_Lead1.AnnCut (hObj2, ANNFMT_WMF, FALSE, TRUE);


AnnChange Event Example for Visual C++ 4.0
AnnChange Event Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example tests the AnnChange event.

void CTutorDlg::OnAnnChangeLead1(long hObject, long uType)
{
   char  buffer[50];
   sprintf(buffer, " This is a change for the button tagged %d", m_Lead1.AnnGetTag(hObject));
   MessageBox(buffer, "NOTE", MB_OK);
}


AnnContainer (OLE DB Control) example for Visual C++ 4.0
AnnContainer (OLE DB Control) example for C++ 4.0 and later

void COLEDBDlg::OnDataLoadedLtodbctl1()
{
   m_LEAD1.SetAnnContainer(0);
   m_LEAD1.SetAnnContainer(m_LEADOLEDB1.GetAnnContainer());
   m_LEAD1.ForceRepaint();
}


AnnDataPath example for Visual C++ 4.0
AnnDataPath example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example shows how to load an annotation file from the Internet.

m_Lead1.SetAnnDataPath("ftp://ftp.leadtools.com/vbaward.ann");


AnnDeletePage example for C++ 5.0 and later

//This sample saves the annotations as the first page of a multipage annotation file
//The format is specified by the 'uFormat' parameter (either ANNFMT_NATIVE or ANNFMT_ENCODED)
//The annotations are flipped, and saved as the second page
//The annotations are rotated, and saved as the third page
//Information is displayed about the annotation file
//The second page is deleted, and information is again displayed about the annotation file
void CVCsampleLoadMemoryDlg::SampleAnnSave(CString strFileName, short uFormat)
{
   int nRet;
   char *pszFormat;
   CString strMsg;

   //Save as the first page of the annotation file
   m_Lead1.AnnSave (strFileName, uFormat, FALSE, SAVE_OVERWRITE, 0);

   //Flip the container, and save as the second page (insert before page 2)
   m_Lead1.AnnFlip (TRUE, m_Lead1.GetBitmapHeight() / 2, FALSE);
   m_Lead1.AnnSave(strFileName, uFormat, FALSE, SAVE_INSERT, 2);

   //Rotate the container, and save as the third page
   //Here we could pass the SAVE_INSERT flag and 3 for nPage,
   //but instead we will use the SAVE_APPEND flag
   m_Lead1.AnnRotate (FALSE, m_Lead1.GetBitmapWidth ()/ 2, m_Lead1.GetBitmapHeight()/ 2, 45, FALSE);
   m_Lead1.AnnSave (strFileName, uFormat, FALSE, SAVE_APPEND, 0);

   //Verify contents of file
   nRet = m_Lead1.AnnFileInfo (strFileName);
    if (nRet == 0)
    {
        switch(m_Lead1.GetAnnInfoFormat ())
        {
           case ANNFMT_NATIVE:
             pszFormat = "ANNFMT_NATIVE";
                break;
             case ANNFMT_WMF:
             pszFormat = "ANNFMT_WMF";
                break;
             case ANNFMT_ENCODED:
             pszFormat = "ANNFMT_ENCODED";
                break;
             default:
             pszFormat = "Unknown";
                break;
        }

        strMsg.Format("File: %s\nFormat: %s\nVersion: %d\nTotal Pages: %d\n",
           strFileName,
           pszFormat,
           m_Lead1.GetAnnInfoVersion (),
           m_Lead1.GetAnnInfoTotalPages ()
           );

        MessageBox(strMsg);

          }
    else
    {
       MessageBox("Invalid Annotation File: " + strFileName);
    }

   //Now delete the second page, and display informtion
   m_Lead1.AnnDeletePage(strFileName, 2);

  //Verify contents of file
   nRet = m_Lead1.AnnFileInfo(strFileName);
    if (nRet == 0)
    {
        switch(m_Lead1.GetAnnInfoFormat ())
        {
           case ANNFMT_NATIVE:
             pszFormat = "ANNFMT_NATIVE";
                break;
             case ANNFMT_WMF:
             pszFormat = "ANNFMT_WMF";
                break;
             case ANNFMT_ENCODED:
             pszFormat = "ANNFMT_ENCODED";
                break;
             default:
             pszFormat = "Unknown";
                break;
        }

        strMsg.Format("File: %s\nFormat: %s\nVersion: %d\nTotal Pages: %d\n",
           strFileName,
           pszFormat,
           m_Lead1.GetAnnInfoVersion (),
           m_Lead1.GetAnnInfoTotalPages ()
           );

        MessageBox(strMsg);

          }
    else
    {
       MessageBox("Invalid Annotation File: " + strFileName);
    }
}


AnnDeletePageArray example for C++ 5.0 and later

//This sample saves the annotations as the first page of a multipage annotation file in memory
//The annotations are flipped, and saved as the second page
//The annotations are rotated, and saved as the third page
//Information is displayed about the annotation file
//The second page is deleted, and information is again displayed about the annotation file
//Assume the following is a member variable of the class
//   VARIANT m_AnnVariant
void CVCsampleLoadMemoryDlg::OnButtonAnnfileinfoarray()
{
   int nRet;
   CString strFormat;
   CString strMsg;
   short nFormat;

   nFormat = ANNFMT_NATIVE;

   VariantInit(&m_AnnVariant);

   //Save as the first page of the annotation file
   nRet = m_Lead1.AnnSaveArray (&m_AnnVariant, nFormat, FALSE, SAVE_OVERWRITE, 0);

   //Flip the container, and save as the second page (insert before page 2)
   m_Lead1.AnnFlip (TRUE, m_Lead1.GetBitmapHeight() / 2, FALSE);
   nRet = m_Lead1.AnnSaveArray (&m_AnnVariant, nFormat, FALSE, SAVE_INSERT, 2);

   //Rotate the container, and save as the third page
   //Here we could pass the SAVE_INSERT flag and 3 for nPage,
   //but instead we will use the SAVE_APPEND flag
   m_Lead1.AnnRotate (FALSE, m_Lead1.GetBitmapWidth () / 2, m_Lead1.GetBitmapHeight() / 2, 45, FALSE);
   m_Lead1.AnnSaveArray (&m_AnnVariant, nFormat, FALSE, SAVE_APPEND, 0);

   //Verify contents of file
   nRet = m_Lead1.AnnFileInfoArray (m_AnnVariant);
   if (nRet == 0)
   {
      switch (m_Lead1.GetAnnInfoFormat ())
      {
      case ANNFMT_NATIVE:
         strFormat = "ANNFMT_NATIVE";
         break;

      case ANNFMT_WMF:
         strFormat = "ANNFMT_WMF";
         break;

      case ANNFMT_ENCODED:
         strFormat = "ANNFMT_ENCODED";
         break;

      default:
         strFormat = "Unknown";
         break;
      }
      strMsg.Format("Format: %s\nVersion: %d\nTotal Pages: %d\n",
         strFormat,
         m_Lead1.GetAnnInfoVersion (),
         m_Lead1.GetAnnInfoTotalPages ()
         );

      MessageBox(strMsg);
   }

   else
   {
      MessageBox("Invalid Annotation Memory File");
   }
   //Now delete the second page, and display informtion
   m_Lead1.AnnDeletePageArray (&m_AnnVariant, 2);

   //Verify contents of file
   nRet = m_Lead1.AnnFileInfoArray (m_AnnVariant);
   if (nRet == 0)
   {
      switch (m_Lead1.GetAnnInfoFormat ())
      {
      case ANNFMT_NATIVE:
         strFormat = "ANNFMT_NATIVE";
         break;

      case ANNFMT_WMF:
         strFormat = "ANNFMT_WMF";
         break;

      case ANNFMT_ENCODED:
         strFormat = "ANNFMT_ENCODED";
         break;

      default:
         strFormat = "Unknown";
         break;
      }
      strMsg.Format("Format: %s\nVersion: %d\nTotal Pages: %d\n",
         strFormat,
         m_Lead1.GetAnnInfoVersion (),
         m_Lead1.GetAnnInfoTotalPages ()
         );

      MessageBox(strMsg);
   }

   else
   {
      MessageBox("Invalid Annotation Memory File");
   }

   //if finished with m_AnnVariant, free the memory by calling VariantClear
}


AnnDeletePageMemory example for C++ 5.0 and later

//This sample saves the annotations as the first page of a multipage annotation file in memory
//The annotations are flipped, and saved as the second page
//The annotations are rotated, and saved as the third page
//Information is displayed about the annotation file
//The second page is deleted, and information is again displayed about the annotation file
//Assume the following is a member variable of the class
//   HGLOBAL m_hGlobal
void CVCsampleLoadMemoryDlg::OnButtonAnnfileinfomemory()
{
   int nRet;
   CString strFormat;
   CString strMsg;
   long lSize;
   short nFormat;

   nFormat = ANNFMT_NATIVE;

   //Save as the first page of the annotation file
   m_hGlobal = 0;
   m_Lead1.AnnSaveMemory ((long *)&m_hGlobal, nFormat, FALSE, &lSize, SAVE_OVERWRITE, 0);

   //Flip the container, and save as the second page (insert before page 2)
   m_Lead1.AnnFlip (TRUE, m_Lead1.GetBitmapHeight() / 2, FALSE);
   m_Lead1.AnnSaveMemory ((long *)&m_hGlobal, nFormat, FALSE, &lSize, SAVE_INSERT, 2);

   //Rotate the container, and save as the third page
   //Here we could pass the SAVE_INSERT flag and 3 for nPage,
   //but instead we will use the SAVE_APPEND flag
   m_Lead1.AnnRotate (FALSE, m_Lead1.GetBitmapWidth () / 2, m_Lead1.GetBitmapHeight() / 2, 45, FALSE);
   m_Lead1.AnnSaveMemory ((long *)&m_hGlobal, nFormat, FALSE, &lSize, SAVE_APPEND, 0);

   //Verify contents of file
   nRet = m_Lead1.AnnFileInfoMemory ((long)m_hGlobal, lSize);
   if (nRet == 0)
   {
      switch (m_Lead1.GetAnnInfoFormat ())
      {
      case ANNFMT_NATIVE:
         strFormat = "ANNFMT_NATIVE";
         break;

      case ANNFMT_WMF:
         strFormat = "ANNFMT_WMF";
         break;

      case ANNFMT_ENCODED:
         strFormat = "ANNFMT_ENCODED";
         break;

      default:
         strFormat = "Unknown";
         break;
      }
      strMsg.Format("Format: %s\nVersion: %d\nTotal Pages: %d\nTotal Size: %d\n",
         strFormat,
         m_Lead1.GetAnnInfoVersion (),
         m_Lead1.GetAnnInfoTotalPages (),
         lSize);

      MessageBox(strMsg);
   }

   else
   {
      MessageBox("Invalid Annotation Memory File");
   }

   //Now delete the second page, and display informtion
   m_Lead1.AnnDeletePageMemory ((long)m_hGlobal, &lSize, 2);

   //Verify contents of file
   nRet = m_Lead1.AnnFileInfoMemory ((long)m_hGlobal, lSize);
   if (nRet == 0)
   {
      switch (m_Lead1.GetAnnInfoFormat ())
      {
      case ANNFMT_NATIVE:
         strFormat = "ANNFMT_NATIVE";
         break;

      case ANNFMT_WMF:
         strFormat = "ANNFMT_WMF";
         break;

      case ANNFMT_ENCODED:
         strFormat = "ANNFMT_ENCODED";
         break;

      default:
         strFormat = "Unknown";
         break;
      }
      strMsg.Format("Format: %s\nVersion: %d\nTotal Pages: %d\nTotal Size: %d\n",
         strFormat,
         m_Lead1.GetAnnInfoVersion (),
         m_Lead1.GetAnnInfoTotalPages (),
         lSize);

      MessageBox(strMsg);
   }

   else
   {
      MessageBox("Invalid Annotation Memory File");
   }
}


AnnDestroy example for Visual C++ 4.0
AnnDestroy example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

m_LEAD1.AnnDestroy(m_LEAD1.GetAnnContainer(), ANNFLAG_RECURSE | ANNFLAG_SELECTED);


AnnEnumerate example for Visual C++ 4.0
AnnEnumerate example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

//This event is fired for each annotation
//Displays the handle for each annotation
void CMFC42samplesDlg::OnAnnEnumerateLeadctrl1(long hObject)
{
CString str;

str.Format("hObject: %x", hObject);
AfxMessageBox(str);
}

//Load image and annotation file and then enumerate all the annotations
void CMFC42samplesDlg::OnButtonAnnenumerate()
{
m_Lead1.Load("rgbw.bmp",0,0,1);
m_Lead1.AnnLoad("d:\\work\\images\\rgbw.ann",0);
m_Lead1.SetAnnUserMode(ANNUSERMODE_RUN);
m_Lead1.AnnEnumerate(m_Lead1.GetAnnContainer(), ANNFLAG_RECURSE, NULL);
}


AnnGetContainer Example for Visual C++ 4.0
AnnGetContainer example for Visual C++

   OLE_HANDLE hPin, h1, h2, hCont;
   hCont = m_Lead1.AnnCreate (ANNOBJECT_CONTAINER, TRUE, FALSE);
   if(hCont != 0)
   {
      hPin = m_Lead1.AnnCreateItem (hCont, ANNOBJECT_PUSHPIN, FALSE);
      h1 = m_Lead1.AnnGetContainer (hCont);
      h2 = m_Lead1.AnnGetTopContainer (hPin);
      if(h1 == h2 && h1 == m_Lead1.GetAnnContainer ())
         AfxMessageBox("root container is same as that of LEAD1");
   }


AnnGetGrouping example for Visual C++ 4.0
AnnGetGrouping example for C++ 4.0 and later

//This event is fired for each annotation
//Toggles the Grouping feature for all the containers

void CMFC42samplesDlg::OnAnnEnumerateLeadctrl1(long hObject)
{
   if(m_Lead1.AnnGetType(hObject) == ANNOBJECT_CONTAINER)
      m_Lead1.AnnSetGrouping(hObject, !m_Lead1.AnnGetGrouping(hObject), 0);
}

 // Add subcontainers by selecting objects and grouping them
 //    before clicking on this button
 // Note that after you disable the grouping you can select and change
 //   individual objects belonging to a group. When you re-enable
 //    the grouping, the objects act as a group again.

void CMFC42samplesDlg::OnButtonAnnenumerate()
{
   m_Lead1.SetAnnUserMode(ANNUSERMODE_DESIGN);
   m_Lead1.AnnEnumerate(m_Lead1.GetAnnContainer(), ANNFLAG_RECURSE| ANNFLAG_NOTTHIS, NULL);
}


AnnGetHyperlinkParam example for Visual C++ 4.0
AnnGetHyperlinkParam example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example retrieves parameters using AnnGetHyperlinkParam.

void CTestocxDlg::OnAnnChangeLeadctrl1(long hObject)
{
    CString msgstr;
    CString tmp;
    int nType;
    int iParamCount;
    long lRet;

    nType = m_Lead1.AnnGetHyperlinkType(hObject);
    if (nType == ANNLINK_ANNEVENT5)
    {
        msgstr.Format("Params are:\n");
        for(iParamCount=0; iParamCount<5; iParamCount++)
        {
            lRet = m_Lead1.AnnGetHyperlinkParam(hObject, iParamCount);
            tmp.Format("   Param%d: %ld\n", iParamCount + 1, lRet);
            msgstr = msgstr + tmp;
        }
    }
    else
        msgstr.Format("Invalid Type");

    AfxMessageBox(msgstr);
}


AnnGetHyperlinkString example for Visual C++ 4.0
AnnGetHyperlinkString example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

The following example places calls to both the AnnSetHyperlinkString method and the AnnGetHyperlinkString method.

void CTestocxDlg::OnAnnHyperlinkMenu Leadctrl1(const VARIANT FAR& aObjects, short uCount)
{
   long x;
   CString linkstr;
   int hObject;

   // Set AnnHyperLink to a URL
   for( x=0; x<uCount; x++)
   {
       SafeArrayGetElement(aObjects.parray, &x, &hObject);
       m_Lead1.AnnSetHyperlinkString(hObject, ANNLINK_WEBPAGE, "http://www.leadtools.com");
       // get the string to see what got set
       linkstr = m_Lead1.AnnGetHyperlinkString(hObject);
       AfxMessageBox(linkstr);
   }
}


AnnGetHyperlinkType example for Visual C++ 4.0
AnnGetHyperlinkType example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

The following is an example of AnnHyperlink event code which includes a call to AnnGetHyperlinkType.

void CTestocxDlg::OnAnnHyperlink Leadctrl1(long hObject, short iParamCount, long lParam1, long lParam2, long lParam3, long lParam4, long lParam5)
{
    CString msgstr;
    CString tmp;
    int nType;

    nType = m_Lead1.AnnGetHyperlinkType(hObject);

    if ((nType == ANNLINK_ANNEVENT5) || (nType == ANNLINK_ANNEVENT))
    {
        if (iParamCount >= 0)
            msgstr.Format("%d params are valid\n", iParamCount);

        if (iParamCount >= 1)
        {
           tmp.Format("Param1: %ld \n", lParam1);
           msgstr = msgstr + tmp;
        }
        if (iParamCount >= 2)
        {
           tmp.Format("Param2: %ld \n", lParam2);
           msgstr = msgstr + tmp;
        }
        if (iParamCount >= 3)
        {
           tmp.Format("Param3: %ld \n", lParam3);
           msgstr = msgstr + tmp;
        }
        if (iParamCount >= 4)
        {
           tmp.Format("Param4: %ld \n", lParam4);
           msgstr = msgstr + tmp;
        }
        if (iParamCount >= 5)
        {
           tmp.Format("Param5: %ld \n", lParam5);
           msgstr = msgstr + tmp;
        }
    }
    else
        msgstr.Format("Invalid Type");

    AfxMessageBox(msgstr);
}


AnnGetNameOffsetX example for C++ 5.0 and later

//This sample shifts the NameOffset of the annotation object hObject
//two pixels in the X direction and one pixel in the Y direction
void CVCsampleLoadMemoryDlg::SampleNameOffset(OLE_HANDLE hObject)
{
   long lOffsetX;
   long lOffsetY;
   CString strMsg;
   lOffsetX = m_Lead1.AnnGetNameOffsetX(hObject);
   lOffsetY = m_Lead1.AnnGetNameOffsetY (hObject);

   lOffsetX += 2;
   lOffsetY += 1;

   strMsg.Format("Shifting Name Offset to %d, %d", lOffsetX, lOffsetY);
   MessageBox(strMsg);

   m_Lead1.AnnSetNameOffsetX (hObject, lOffsetX, FALSE);
   m_Lead1.AnnSetNameOffsetY (hObject, lOffsetY, FALSE);
}


AnnGetNameRestrict example for C++ 5.0 and later

//This sample toggles the bNameRestrict property of the annotation object hObject
void CVCsampleLoadMemoryDlg::SampleNameRestrict(OLE_HANDLE hObject)
{
   BOOL bNameRestrict;
   CString strMsg;

   bNameRestrict = m_Lead1.AnnGetNameRestrict (hObject);
   bNameRestrict = !bNameRestrict;

   if (bNameRestrict)
      strMsg = "Changing NameRestrict property to TRUE";
   else
      strMsg = "Changing NameRestrict property to FALSE";

   MessageBox(strMsg);
   m_Lead1.AnnSetNameRestrict (hObject,  bNameRestrict, FALSE);
}


AnnGetObjectFromTag example for Visual C++ 4.0
AnnGetObjectFromTag example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

OLE_HANDLE hObject=NULL;
   long lTag;

   lTag = 4; // find object with tag == 4

   hObject = m_LEAD1.AnnGetObjectFromTag(m_LEAD1.GetAnnContainer(), lTag, FALSE);
   if(lTag == m_LEAD1.AnnGetTag(hObject))
      AfxMessageBox("Found it!");


AnnGetPoint example for Visual C++ 4.0
AnnGetPoint... example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

In the AnnDrawn event, this example checks to see if the annotation object is a polygon. If it is a polygon, the example gets the number of points that define the object; then it gets the arrays of X and Y coordinates and displays the points in a message box.

void CMfc40Dlg::OnAnnDrawnLead1(long hObject)
{
   int nType;
   long a;
   VARIANT xPoints;  //array for the X coordinates
   VARIANT yPoints;  //array for the Y coordinates
   long nPoints;     //number of points in the object
   CString msg;
   CString msg2;
   float x;
   float y;

   nType = m_Lead1.AnnGetType(hObject);
   if (nType == ANNOBJECT_POLYGON)  //Is the object a polygon?
   {
      VariantInit(&xPoints);
      VariantInit(&yPoints);
      AfxMessageBox("Object is a Polygon");
      m_Lead1.SetEnableMethodErrors(FALSE);
      nPoints = m_Lead1.AnnGetPointCount(hObject);    //get the number of points
      xPoints = m_Lead1.AnnGetPointX(hObject);        //get the X coordinates
      yPoints = m_Lead1.AnnGetPointY(hObject);        //get the Y coordinates
      msg = "(";
      for (a=0; a<nPoints; a++)
      {
         msg = msg + "{";
         SafeArrayGetElement(xPoints.parray, &a, &x);
         msg2.Format("%g", x);
         msg = msg + msg2;
         msg = msg + ",";
         msg2.Empty();
         SafeArrayGetElement(yPoints.parray, &a, &y);
         msg2.Format("%g", y);
         msg = msg + msg2;
         msg = msg + "}";
      }
      VariantClear(&xPoints);
      VariantClear(&yPoints);
      msg = msg + ")";
      msg2.Empty;
      msg2.Format("The Polygon's %ld points:", nPoints);
      ::MessageBox(NULL,(LPCTSTR) msg,(LPCTSTR) msg2,MB_OK);
   }
}


AnnGetProtractorOptions Example for Visual C++ 4.0
AnnGetProtractorOptions example for Visual C++

    Long hProt;
   float ArcRadius;
   BOOL bAcute;
   short nUnit, nPrecision;
   m_Lead1.AnnGetProtractorOptions (hProt, &bAcute, &nUnit, &nPrecision, &ArcRadius);
   m_Lead1.AnnSetProtractorOptions (hProt, !bAcute, 1 - nUnit + ANNANGLE_DEF_ABBR, NULL, (nPrecision + 1) % 5, ArcRadius, FALSE);
   m_Lead1.AnnSetShowFlags (hProt, (m_Lead1.AnnGetShowFlags (hProt) + 1) % 4, FALSE);


AnnGetRgnHandle Example for Visual C++ 4.0
AnnGetRgnHandle example for Visual C++

   m_Lead2.SetRgnHandle (m_Lead1.AnnGetRgnHandle (hPlgn), 1, 1, L_RGN_SET);
   m_Lead2.SetRgnFrameType (RGNFRAME_ANIMATED);


AnnGetScalarX example for Visual C++ 4.0
AnnGetScalarX example for Visual C++

   OLE_HANDLE hCont = m_Lead1.AnnCreate (ANNOBJECT_CONTAINER, FALSE, FALSE);
   CString msg2;
   msg2.Format("ScalarX: %f, ScalarY: %f, OffsetX: %f, OffsetY: %f",
      (double)m_Lead1.AnnGetScalarX (hCont),
      (double)m_Lead1.AnnGetScalarY (hCont),
      (double)m_Lead1.AnnGetOffsetX (hCont),
      (double)m_Lead1.AnnGetOffsetY (hCont));
   AfxMessageBox(msg2);
   m_Lead1.AnnSetScalarX (hCont, 1.5, FALSE);
   m_Lead1.AnnSetScalarY (hCont, 1.5, FALSE);
   m_Lead1.AnnSetOffsetX(hCont, 10, FALSE);
   m_Lead1.AnnSetOffsetY (hCont, 20, FALSE);
   msg2.Format("ScalarX: %f, ScalarY: %f, OffsetX: %f, OffsetY: %f",
     (double)m_Lead1.AnnGetScalarX (hCont),
      (double)m_Lead1.AnnGetScalarY (hCont),
      (double)m_Lead1.AnnGetOffsetX (hCont),
      (double)m_Lead1.AnnGetOffsetY (hCont));
   AfxMessageBox(msg2);


AnnGetSelectList example for Visual C++ 4.0
AnnGetSelectList example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example gets the number of selected annotation objects; then it gets an array of the selected object handles and checks to see if any of the objects in the array are polygons.

void CMfc40Dlg::OnGetSelectedButton()
{
   int nType;
   int uCount;
   long x;
   int bSelected;
   CString msg;
   int hObject;
   VARIANT aObjects;

   VariantInit(&aObjects);
   uCount = m_Lead1.AnnGetSelectCount();  //get number of selected objects
   aObjects = m_Lead1.AnnGetSelectList(); //get handles of the selected objects
   msg.Format("%d",uCount);
  msg = msg + " objects were selected";
  AfxMessageBox ((LPCTSTR)msg);

   for (x=0; x<uCount; x++)
   {
      SafeArrayGetElement(aObjects.parray, &x, &hObject);
      nType = m_Lead1.AnnGetType(hObject);
      if (nType == ANNOBJECT_POLYGON)
         bSelected = TRUE;
   }
       if (bSelected != TRUE)
          AfxMessageBox("No Polygon Objects were selected");
   VariantClear(&aObjects);
}


AnnGroup example for Visual C++ 4.0
AnnGroup example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

m_LEAD1.AnnGroup(m_LEAD1.GetAnnContainer(), ANNFLAG_SELECTED | ANNFLAG_RECURSE, "");


AnnHitTest example for Visual C++ 4.0
AnnHitTest example for Visual C++

   long hObj;
   if(m_Lead1.AnnHitTest (m_Lead1.GetAnnContainer (), 100, 100, &hObj) == ANNHIT_BODY)
   {
      m_Lead1.AnnSetName (hObj, TRUE, "AnnHitFound", FALSE);
      if(m_Lead1.AnnGetType (hObj) == ANNOBJECT_TEXT)
      {
         m_Lead1.AnnSetFontBold (hObj, !m_Lead1.AnnGetFontBold (hObj), FALSE);
         m_Lead1.AnnSetFontItalic (hObj, !m_Lead1.AnnGetFontItalic (hObj), FALSE);
         m_Lead1.AnnSetFontStrikeThrough (hObj, !m_Lead1.AnnGetFontStrikeThrough (hObj), FALSE);
         m_Lead1.AnnSetFontUnderline (hObj, !m_Lead1.AnnGetFontUnderline (hObj), FALSE);
         m_Lead1.AnnSetFontName (hObj, m_Lead1.AnnGetFontName (hObj), FALSE);
         m_Lead1.AnnSetFontSize (hObj, ((int)m_Lead1.AnnGetFontSize (hObj)-9) %10 +10, FALSE);
         BOOL bShow;
         m_Lead1.AnnSetText (hObj, m_Lead1.AnnGetText (hObj) + m_Lead1.AnnGetName (hObj, &bShow), FALSE);
      }
   }


AnnHyperlinkMenuEnable example for Visual C++ 4.0
AnnHyperlinkMenuEnable example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example toggles the AnnHyperlinkMenuEnable property .

    //toggle AnnHyperLinkMenu item and event
    if (m_Lead1.GetAnnHyperlinkMenuEnable() == TRUE)
        m_Lead1.SetAnnHyperlinkMenuEnable(FALSE);
    else
        m_Lead1.SetAnnHyperlinkMenuEnable(TRUE);


AnnInsert example for Visual C++ 4.0
AnnInsert example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

   long hEllipseObject;
   hEllipseObject = m_LEAD1.AnnCreate(ANNOBJECT_ELLIPSE, FALSE, TRUE);
   m_LEAD1.AnnInsert(m_LEAD1.GetAnnContainer(), hEllipseObject, FALSE);


AnnLoadArray example for Visual C++ 4.0
AnnLoadArray example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

void CVCLoadSampleDlg::OnAnnLoadArray()
{
   long lCount;
   COleVariant MyVar;
   HFILE hFile;
   HGLOBAL hData=NULL;
   void FAR* pData=NULL;
   SAFEARRAY FAR *psa;
   SAFEARRAYBOUND rgsabound[1];

   MyVar.Clear();

   hFile = _lopen("d:\\work\\images\\a.ann", OF_READ);
   lCount = _llseek(hFile, 0, SEEK_END);
   _llseek(hFile, 0, SEEK_SET);
   hData = GlobalAlloc(GMEM_MOVEABLE, lCount);
   pData = GlobalLock(hData);

   _lread(hFile, pData, lCount);

   rgsabound[0].lLbound = 0;
   rgsabound[0].cElements = lCount;
   psa = SafeArrayCreate(VT_UI1, 1, rgsabound);

   SafeArrayLock(psa);
   memcpy(psa->pvData, pData, lCount);
   unsigned int uCopy;
   unsigned long dwBytes;
   unsigned char  *pDst=NULL;
   unsigned char  *pSrc=NULL;

   pDst = (unsigned char *)psa->pvData;
   pSrc = (unsigned char *)pData;
   dwBytes = lCount;
   while (dwBytes)
   {
      uCopy = (unsigned int) min (dwBytes, 0x0FFFEUL);
      memcpy(pDst, pSrc, uCopy);
      dwBytes -= uCopy;
      pDst += uCopy, pSrc += uCopy;
   }

   SafeArrayUnlock(psa);

   V_VT(&MyVar) = (VT_ARRAY | VT_UI1);
   V_ARRAY(&MyVar) = psa;

   GlobalUnlock(hData);
   GlobalFree(hData);

   m_Lead1.AnnLoadArray(MyVar, lCount, 1);
   m_Lead1.SetAnnUserMode(ANNUSERMODE_DESIGN);
   _lclose(hFile);
}


AnnLock example for Visual C++ 4.0
AnnLock example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example locks objects of type ANNOBJECT_ELLIPSE using the key "IkeStarnes".

   int nType;
   int uCount;
   long x;
   int bSelected;
   int hObject;
   VARIANT aObjects;

   VariantInit(&aObjects);
   uCount = m_Lead1.AnnGetSelectCount();  //get number of selected objects
   aObjects = m_Lead1.AnnGetSelectList(); //get handles of the selected objects
   for (x=0; x<uCount; x++)
   {
      SafeArrayGetElement(aObjects.parray, &x, &hObject);
      nType = m_Lead1.AnnGetType(hObject);
      if (nType == ANNOBJECT_ELLIPSE)
      {
         bSelected = TRUE;
         m_Lead1.AnnLock(hObject, "IkeStarnes", FALSE);
      }
   }
       if (bSelected != TRUE)
          AfxMessageBox("No Ellipse Objects were selected");
   VariantClear(&aObjects);


AnnLocked example for Visual C++ 4.0
AnnLocked example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

The following is an example of an AnnLocked event.

void CTestocxDlg::OnAnnLocked Leadctrl1(long hObject)
{
   CString msg;

   msg.Format("Object: %ld was locked.", hObject);
   AfxMessageBox (msg);
}


AnnMenu example for Visual C++ 4.0
AnnMenu example for C++ 4.0 and later

Note: This topic is for Document/Medical only.

void CAnntestDlg::OnAnnMenuLeadctrl1(LPDISPATCH AnnMenu)
{
   long nID;
   short x;
   CString csOut;
   CAnnMenu AnnMenuMain(AnnMenu);

   csOut.Format("There are %ld Items", AnnMenuMain.GetCount());
   AfxMessageBox(csOut);

   csOut = "Original Text for item#2: " + AnnMenuMain.GetItemString(1);
   AfxMessageBox(csOut);
   //set new string
   AnnMenuMain.SetItemString(1, "TestText");
   csOut = "Custom Text for item#2: " + AnnMenuMain.GetItemString(1);
   AfxMessageBox(csOut);

   //make 3rd and 4th menu items have the same command id
   nID = AnnMenuMain.GetItemID(3);
   AnnMenuMain.SetItemID(2, nID);

   //check all unchecked menu items that are not popup submenus
   //disable all enabled menu items that are not popup submenus
   for(x=0; x<AnnMenuMain.GetCount(); x++)
   {
      if(AnnMenuMain.GetItemType(x) == ANNMENUITEMTYPE_NORMAL)
      {
         if(!AnnMenuMain.GetItemChecked(x))
            AnnMenuMain.SetItemChecked(x, TRUE);
         if(AnnMenuMain.GetItemEnabled(x))
            AnnMenuMain.SetItemEnabled(x, FALSE);
      }
   }

   //insert 2 user-defined menu items
   AnnMenuMain.AddItem("&Flip", ANNMENUITEMTYPE_NORMAL, LTANNEVENT_MENUFIRST, AnnMenuMain.GetCount());
   AnnMenuMain.AddItem("Test&2", ANNMENUITEMTYPE_NORMAL, LTANNEVENT_MENUFIRST + 1, AnnMenuMain.GetCount());

   //delete the last menu item
   AnnMenuMain.DeleteItem(AnnMenuMain.GetCount() - 1);
   //delete the first menu item
   AnnMenuMain.DeleteItem(0);

   //insert a popup menu
   AnnMenuMain.AddItem("&Popup1", ANNMENUITEMTYPE_SUBMENU, 0, AnnMenuMain.GetCount());
   //get the new item, and add some items to it
   CAnnMenu PopupMenuItem;
   PopupMenuItem = AnnMenuMain.GetSubMenu(AnnMenuMain.GetCount() - 1);
   PopupMenuItem.AddItem("Test&1", ANNMENUITEMTYPE_NORMAL, LTANNEVENT_MENUFIRST + 2, PopupMenuItem.GetCount());
   PopupMenuItem.AddItem("Test&2", ANNMENUITEMTYPE_NORMAL, LTANNEVENT_MENUFIRST + 3, PopupMenuItem.GetCount());

   AnnMenuMain.DetachDispatch();
}
void CAnntestDlg::OnAnnUserMenuLeadctrl1(long nID)
{
   if (nID == LTANNEVENT_MENUFIRST)
       m_Lead1.AnnFlip (FALSE, 0.0f, TRUE);
   else
    {
       CString str;
       str.Format("nID = LTANNEVENT_MENUFIRST + %d", nID – LTANNEVENT_MENUFIRST);
       MessageBox(str);
    }
}


AnnMouseDown example for Visual C++ 4.0
AnnMouseDown example for C++ 4.0 and later

Note: This topic is for Document/Medical only.

void CAnntestDlg::OnAnnMouseDownLeadctrl1(short Button, short Shift, long x, long y)
{
   m_x0 = x;
   m_y0 = y;

   switch(m_LEAD1.GetAnnTool())
   {
   case ANNTOOL_USER_FIRST:
      // create the objects
      m_LEAD1.AnnSetSelected(m_LEAD1.GetAnnContainer(), FALSE, TRUE);
      //Add an undo node to undo the creation of these objects.
      m_LEAD1.AnnAddUndoNode();
      m_hRectObject = m_LEAD1.AnnCreate(ANNOBJECT_RECT, TRUE, TRUE);
      m_hEllipseObject = m_LEAD1.AnnCreate(ANNOBJECT_ELLIPSE, TRUE, TRUE);
      // set the automation defaults to the objects newly created
      m_LEAD1.AnnSetAutoDefaults(m_hRectObject, 0);
      m_LEAD1.AnnSetAutoDefaults(m_hEllipseObject, 0);
      // start defining them from the x, y coordinate
      m_LEAD1.AnnDefine(m_hRectObject, (float)x, (float)y, ANNDEFINE_BEGINSET);
      m_LEAD1.AnnDefine(m_hEllipseObject, (float)x, (float)y, ANNDEFINE_BEGINSET);
      break;
   }
}

void CAnntestDlg::OnAnnMouseMoveLeadctrl1(short Button, short Shift, long x, long y)
{
   if(Button == 1)
   {
      switch(m_LEAD1.GetAnnTool())
      {
      case ANNTOOL_USER_FIRST:
         // update the objects from the x, y coordinate
         m_LEAD1.AnnDefine(m_hRectObject, (float)x, (float)y, ANNDEFINE_UPDATE);
         m_LEAD1.AnnDefine(m_hEllipseObject, (float)x, (float)y, ANNDEFINE_UPDATE);
         break;
      case ANNTOOL_RECT:
         AdjustMousePos(Shift, x, y);
         break;
      }
   }
}

void CAnntestDlg::OnAnnMouseUpLeadctrl1(short Button, short Shift, long x, long y)
{
   switch(m_LEAD1.GetAnnTool())
   {
   case ANNTOOL_USER_FIRST:
      m_LEAD1.AnnDefine(m_hRectObject, (float)x, (float)y, ANNDEFINE_END);
      m_LEAD1.AnnDefine(m_hEllipseObject, (float)x, (float)y, ANNDEFINE_END);
      m_LEAD1.AnnSetSelected(m_hRectObject, TRUE, FALSE);
      m_LEAD1.AnnSetSelected(m_hEllipseObject, TRUE, FALSE);
      m_LEAD1.AnnGroup(m_LEAD1.GetAnnContainer(), ANNFLAG_RECURSE |
ANNFLAG_SELECTED, "");
      m_hEllipseObject = 0;
      m_hRectObject = 0;
      break;
   case ANNTOOL_RECT:
      AdjustMousePos(Shift, x, y);
      break;
   }
}

void CAnntestDlg::AdjustMousePos(short Shift, long x, long y)
{
   long dx,dy;

   if(Shift == 1)
   {
      // if shift key is down, force the creation of squares
      dx = abs(x - m_x0);
      dy = abs(y - m_y0);
      if(dx > dy)
      {
         // adjust y to be as far from y0 as x is from x0
         if(y > m_y0)
            y = m_y0 + dx;
         else
            y = m_y0 - dx;
      }
      else
      {
         // adjust x to be as far from x0 as y is from y0
         if(x > m_x0)
            x = m_x0 + dy;
         else
            x = m_x0 - dy;
      }
      // set the mouse cursor and update its position
      m_LEAD1.SetMousePos((float)x, (float)y, FALSE);
   }
}


AnnMove example for Visual C++ 4.0
AnnMove example for C++ 4.0 and later

Note: This topic is for Document/Medical only.

This example moves one or more selected annotation objects.

// Declare local variables.
float DeltaX, DeltaY;

// Use twips.
m_Lead1.SetScaleMode (1);

// Specify arbitrary delta values.
DeltaX = (float) +2000;
DeltaY = (float) -2000;

// Move the selected annotations.
m_Lead1.AnnMove (DeltaX, DeltaY, TRUE);


AnnNameBoundingRectLeft example for C++ 5.0 and later

//This sample displays the bounding rectangle of the annotation hObject
void CVCsampleLoadMemoryDlg::SampleAnnNameBoundingRect(OLE_HANDLE hObject)
{
   CString strMsg;

   strMsg.Format("Ann Name Bounding Rect:\n\tleft: %f\n\ttop: %f\n\twidth: %f\n\theight: %f",
      m_Lead1.GetAnnNameBoundingRectLeft (hObject),
      m_Lead1.GetAnnNameBoundingRectTop (hObject),
      m_Lead1.GetAnnNameBoundingRectWidth (hObject),
      m_Lead1.GetAnnNameBoundingRectHeight (hObject)
      );

   MessageBox(strMsg);
}


AnnNameRectLeft example for C++ 5.0 and later

//This sample displays the defining rectangle of the annotation hObject
void CVCsampleLoadMemoryDlg::SampleAnnNameRect(OLE_HANDLE hObject)
{
   CString strMsg;

   strMsg.Format("Ann Name Rect:\n\tleft: %f\n\ttop: %f\n\twidth: %f\n\theight: %f",
      m_Lead1.GetAnnNameRectLeft (hObject),
      m_Lead1.GetAnnNameRectTop (hObject),
      m_Lead1.GetAnnNameRectWidth (hObject),
      m_Lead1.GetAnnNameRectHeight (hObject)
      );

   MessageBox(strMsg);
}


Annotation Colors Example for Visual C++ 4.0
Annotation Colors example for Visual C++

   OLE_COLOR cr;
long hStamp , hPlgn;
   m_Lead2.Load ("C:\\TEMP\\flagsel.bmp", 0, 1, 1);
   m_Lead1.AnnSetBitmap (hStamp, m_Lead2.GetBitmap (), FALSE);
   m_Lead1.AnnSetAutoBackColor (m_Lead1.GetAnnAutomation (), ANNOBJECT_ALL, RGB(40, 80, 160));
   cr = m_Lead1.AnnGetAutoBackColor (m_Lead1.GetAnnAutomation(), ANNOBJECT_POLYGON);
   CString text;
   text.Format("AutoBackColor: %X", cr);
   AfxMessageBox(text);

   if(! m_Lead1.AnnGetTransparent (hStamp))
      m_Lead1.AnnSetTransparent (hStamp, TRUE, FALSE);

   m_Lead1.AnnSetTransparentColor (hStamp, RGB(0, 255, 0), FALSE);
   cr = m_Lead1.AnnGetTransparentColor (hStamp);
   text.Format("TransparentColor: %X", cr);
   AfxMessageBox(text);

   m_Lead1.AnnSetBackColor (hPlgn, RGB(100, 20, 200), FALSE);
   cr = m_Lead1.AnnGetBackColor (hPlgn);
   text.Format("BackColor: %X", cr);
   AfxMessageBox(text);

   m_Lead1.AnnSetForeColor (hPlgn, RGB(180, 220, 120), FALSE);
   cr = m_Lead1.AnnGetForeColor (hPlgn);
   text.Format("ForeColor: %X", cr);
   AfxMessageBox(text);
   m_Lead1.SetBitmap (m_Lead1.AnnGetBitmap (hStamp));


AnnRectLeft example for Visual C++ 4.0
AnnRectLeft example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

void CAnntestDlg::OnAnnEnumerateLeadctrl1(long hObject)
{
   CString csOut;

   switch(m_nEnumerate)
   {
   case 0:
      if(m_LEAD1.AnnGetVisible(hObject))
         csOut.Format("Type: %ld - Visible", m_LEAD1.AnnGetType(hObject));
      else
         csOut.Format("Type: %ld - Not Visible", m_LEAD1.AnnGetType(hObject));
      AfxMessageBox(csOut);
      break;
   case 1:
      m_nTag++;
      m_LEAD1.AnnSetTag(hObject, m_nTag);
      break;
   case 2:
      m_LEAD1.SetAnnRectLeft(hObject, m_LEAD1.GetAnnRectLeft(hObject) + 50);
      break;
   case 3:
      m_LEAD1.SetAnnRectTop(hObject, m_LEAD1.GetAnnRectTop(hObject) + 50);
      break;
   case 4:
      m_LEAD1.SetAnnRectWidth(hObject, m_LEAD1.GetAnnRectWidth(hObject) + 50);
      break;
   case 5:
      m_LEAD1.SetAnnRectHeight(hObject, m_LEAD1.GetAnnRectHeight(hObject) + 50);
      break;
   case 6:
      if(m_LEAD1.AnnGetAutoMenuItemEnable(hObject, 0, ANNAUTOTEXT_MENU_DELETE))
         AfxMessageBox("True");
      else
         AfxMessageBox("False");
      break;
   }
}


AnnRotate example for Visual C++ 4.0
AnnRotate example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example uses the AnnFlip, AnnReverse, and AnnRotate methods. To code this example, add a command button with and ID of IDC_TEST to the example you created in Loading and Displaying an Image. For best results when you run the example, draw two objects in opposite corners, and use the right mouse button to select all annotation objects. The command button then lets you cycle through the AnnFlip, AnnReverse, and AnnRotate methods.

void CTutorDlg::OnTest()
{
  CString MyCaption;
  CWnd *pButton = GetDlgItem(IDC_TEST);
  pButton->GetWindowText(MyCaption);

if (MyCaption == "Flip")
{
  // Flip using the center of the bitmap as the axis.
  m_Lead1.AnnFlip(TRUE, m_Lead1.GetBitmapHeight() / 2, TRUE);
  pButton->SetWindowText("Reverse");
}
else if (MyCaption == "Reverse")
{
  // Reverse using the center of the bitmap as the axis.
  m_Lead1.AnnReverse(TRUE, m_Lead1.GetBitmapWidth() / 2, TRUE);
  pButton->SetWindowText("Rotate");
}
else if (MyCaption == "Rotate")
{
   // Rotate 90 degrees using the center of the bitmap as the axis.
  m_Lead1.AnnRotate(TRUE, m_Lead1.GetBitmapWidth() / 2, m_Lead1.GetBitmapHeight() / 2, 90.0f, TRUE);
  pButton->SetWindowText("Flip");
}
else
{
  pButton->SetWindowText("Flip");
  m_Lead1.SetAnnUserMode(ANNUSERMODE_DESIGN);
  m_Lead1.SetAnnTool(ANNTOOL_REDACT);
  MessageBox("Draw two objects, use the right mouse button to select all, then click the command button");
}

}


AnnSaveArray example for Visual C++ 4.0
AnnSaveArray example for C++ 4.0 and later

Note: This topic is for Document/Medical only.

//This sample saves the currently loaded annotations in memory (as a VARIANT)
//The variant is then saved as a readable annotation file
void CVCsampleLoadMemoryDlg::OnButtonAnnsavearray()
{
   COleVariant AnnVariant;
   long lSize,lUBound,lLBound;
   HFILE hFile;
   void HUGEP* pData=NULL;
   char *pszAnnFile = "d:\\work\\images\\a.ann";

   AnnVariant.Clear();
   m_Lead1.AnnSaveArray (&AnnVariant, ANNFMT_ENCODED, FALSE, SAVE_OVERWRITE, 0);

   hFile = _lcreat(pszAnnFile, 0);
   //hFile = _lopen(pszAnnFile, OF_READWRITE);
   SafeArrayAccessData(AnnVariant.parray, &pData);
   SafeArrayGetUBound(AnnVariant.parray, 1, &lUBound);
   SafeArrayGetLBound(AnnVariant.parray, 1, &lLBound);
   lSize = lUBound-lLBound + 1;
   _lwrite(hFile, (LPCSTR)pData, lSize);
   SafeArrayUnaccessData(AnnVariant.parray);
   _lclose(hFile);
}


AnnSaveMemory example for Visual C++ 4.0
AnnSaveMemory example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example lets you save the current annotations to a file in memory, and lets you load the annotations that were saved.

1.	Start with the project that you created in Creating and Using Annotations.

2.	Edit TUTORDLG.H and insert the following lines in the definition of CTutorDlg after DECLARE_MESSAGE_MAP():

HGLOBAL m_hMem;
long m_iSize;

3.	 At the top of your main form, add two command buttons and name them as follows:

Name	Caption

AnnSaveMem	Save In Memory

AnnLoadMem	Load From Memory

4.	Code the AnnSaveMem button's Click procedure as follows:

void CMfc40Dlg::OnAnnSaveMem()
{
   m_hMem = NULL;
   if (m_Lead1.AnnSaveMemory((long FAR *)&m_hMem,
        ANNFMT_NATIVE, FALSE, &m_iSize, SAVE_OVERWRITE, 0) != 0)
        AfxMessageBox("Error calling AnnSaveMemory");
}

5.	Code the AnnLoadMem button's Click procedure as follows:

void CMfc40Dlg::OnAnnLoadMem()
{
   //Load the annotations from the memory-resident file.
   if (m_Lead1.AnnLoadMemory ((OLE_HANDLE)m_hMem, m_iSize, 1) != 0)
      AfxMessageBox("Error calling AnnLoadMemory");
   else
      AfxMessageBox("AnnLoadMemory succeeded");

   ::GlobalFree(m_hMem);
   m_Lead1.ForceRepaint();
}

6.	Run your program to test it.


AnnSaveOffset example for Visual C++ 4.0
AnnSaveOffset example for Visual C++

   HANDLE hFile = CreateFile("c:\\temp\\test.wmf", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
   if(hFile == INVALID_HANDLE_VALUE)
   {
      AfxMessageBox("Could not open file.");
      return;
   }
   m_Lead1.AnnSaveOffset ((OLE_HANDLE)hFile, 0, hPlgn, ANNFMT_WMF, FALSE);
   CloseHandle(hFile);


AnnSaveTag example for Visual C++ 4.0
AnnSaveTag example for C++ 4.0 and later

Note: This topic is for Document/Medical only.

The following example saves selected objects as a Wang compatible TIFF tag.

    // Save only selected objects in Wang TIFF tag
    m_Lead1.AnnSaveTag(TRUE,TRUE);

    m_Lead1.Save("d:\\temp\\testwang.tif", FILE_CCITT_GROUP4, 1, 2, SAVE_OVERWRITE);


AnnSelect example for Visual C++ 4.0
AnnSelect example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example for the AnnSelect event displays a message box showing the number of selected annotation objects. It then goes through the array of selected objects to see if any of them are polygons.

void CMfc40Dlg::OnAnnSelect Lead1(const VARIANT FAR& aObjects, short uCount)
{
  int nType;
  long x;
  int bSelected = 0;
  CString msg;
  int hObject;

  msg.Format("%d",uCount);
  msg = msg + " objects were selected";
  AfxMessageBox ((LPCTSTR)msg);

  for (x=0; x<uCount; x++)
  {
    SafeArrayGetElement(aObjects.parray, &x, &hObject);
    nType = m_Lead1.AnnGetType(hObject);
    if (nType == ANNOBJECT_POLYGON)
        bSelected = TRUE;
  }
  if (bSelected != TRUE)
    AfxMessageBox("No Polygon Objects were selected");
}


AnnSelectRect Example for Visual C++ 4.0
AnnSelectRect example for Visual C++

   m_Lead1.AnnSelectRect (m_Lead1.GetAnnContainer (), 10, 10, 200, 100);
   m_Lead1.AnnSelectPoint (m_Lead1.GetAnnContainer(), 300, 300);
   if(m_Lead1.AnnGetSelected (hPlgn))
   {
      m_Lead1.AnnRemove (hPlgn);
      m_Lead1.AnnSetSelected (hPlgn, FALSE, FALSE);
   }
   else
      m_Lead1.AnnInsert (m_Lead1.GetAnnContainer(), hPlgn, FALSE);

   CString msg;
   msg.Format("Left: %f, Top: %f, Width: %f, Height:%f",
      (double)m_Lead1.GetAnnSelectRectLeft (m_Lead1.GetAnnContainer()),
      (double)m_Lead1.GetAnnSelectRectTop (m_Lead1.GetAnnContainer()),
      (double)m_Lead1.GetAnnSelectRectWidth (m_Lead1.GetAnnContainer()),
      (double)m_Lead1.GetAnnSelectRectHeight (m_Lead1.GetAnnContainer()));


AnnSetAutoMenuItemEnable Example for Visual C++ 4.0
AnnSetAutoMenuItemEnable Example for C++ 4.0 and later

Note: This topic is for Document/Medical only.

// disable the Delete menu item from all the selected objects
   m_LEAD1.AnnSetAutoMenuItemEnable(m_LEAD1.GetAnnContainer(), 0,
ANNAUTOTEXT_MENU_DELETE, ANNMENU_DISABLED, ANNFLAG_RECURSE |
ANNFLAG_SELECTED, "");
   // disable the Delete menu item from all the ellipse objects
   m_LEAD1.AnnSetAutoMenuItemEnable(m_LEAD1.GetAnnAutomation(), ANNOBJECT_ELLIPSE,
ANNAUTOTEXT_MENU_DELETE, ANNMENU_DISABLED, 0, "");


AnnSetAutoText Example for Visual C++ 4.0
AnnSetAutoText Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example modifies the text string that is used for the undo option on the annotation pop-up menu.

CString TestText;
TestText = m_Lead1.AnnGetAutoText(ANNAUTOTEXT_MENU_UNDO);
TestText = TestText + " - New";
m_Lead1.AnnSetAutoText(ANNAUTOTEXT_MENU_UNDO, TestText);


AnnSetSecondaryBitmap Example for Visual C++ 4.0
AnnSetSecondaryBitmap example for Visual C++

long hPushPin;
   m_Lead1.AnnSetSecondaryBitmap (hPushPin, m_Lead2.GetBitmap (), FALSE);
   m_Lead1.SetAnnUserMode (ANNUSERMODE_RUN);
   AfxMessageBox("secondary bitmap set");
   m_Lead1.SetBitmap(m_Lead1.AnnGetSecondaryBitmap (hPushPin));


AnnSetGrouping example for Visual C++ 4.0
AnnSetGrouping example for C++ 4.0 and later

// This example will temporarily disable the grouping in all objects
// and re-enable the grouping later

// disable grouping in all groups
m_Lead1.AnnSetGrouping(m_Lead1.GetAnnContainer(), FALSE, ANNFLAG_RECURSE);

… // you can now select and change individual objects from groups
… // you can also put the two calls to AnnSetGrouping in two
… // buttons

// re-enable grouping all groups
// note that we do NOT enable grouping in the topmost container!
// if you enable the grouping in the top container, then all the
// objects will act as a group!

m_Lead1.AnnSetGrouping(m_Lead1.GetAnnContainer(), TRUE, ANNFLAG_RECURSE|ANNFLAG_NOTTHIS);


AnnSetHyperlinkMsg Example for Visual C++ 4.0
AnnSetHyperlinkMsg Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

The following is an example of AnnHyperlinkMenu event code, which includes a call to AnnSetHyperlinkMsg.

void CTestocxDlg::OnAnnHyperlinkMenu Leadctrl1(const VARIANT FAR& aObjects, short uCount)
{
   long x;
   CString linkstr;
   int hObject;

    // set HyperLink to type ANNLINK_ANNEVENT5
    // and set the 5 params to some values.
   for( x=0; x<uCount; x++)
   {
       SafeArrayGetElement(aObjects.parray, &x, &hObject);
       m_Lead1.AnnSetHyperlinkMsg(hObject, ANNLINK_ANNEVENT5, 5, 4, 3, 2, 1);
   }
}


AnnSetMetafile Example for Visual C++ 4.0
AnnSetMetafile example for Visual C++

   long hStamp;
   HMETAFILE hMeta;
   BOOL bEnh;
   hMeta = (HMETAFILE)m_Lead1.AnnGetPredefinedMetafile (ANNMETAFILE_IMPORTANT, &bEnh);
   m_Lead1.AnnSetPredefinedMetafile (ANNMETAFILE_TOPSECRET, (OLE_HANDLE)hMeta);
   m_Lead1.AnnSetMetafile (hStamp, 0, ANNMETAFILE_TOPSECRET, FALSE);
   AfxMessageBox("stamp set to TopSecret");

   hMeta = (HMETAFILE)m_Lead1.AnnGetMetafile (hStamp);
   switch(::GetObjectType(hMeta))
   {
   case OBJ_ENHMETAFILE:
      AfxMessageBox("Type is EMF");
   case OBJ_METAFILE:
      AfxMessageBox("Type is WMF");
   }


AnnSetPolyFillMode Example for Visual C++ 4.0
AnnSetPolyFillMode example for Visual C++

   short nNodes;
   BOOL bShow;
   m_Lead1.AnnSetFillPattern (hPlgn, (m_Lead1.AnnGetFillPattern (hPlgn) + 1) % 7, FALSE);
   m_Lead1.AnnSetFillMode (hPlgn, (m_Lead1.AnnGetFillMode (hPlgn) + 1) % 3, FALSE);
   m_Lead1.AnnSetPolyFillMode (hPlgn, 1 - m_Lead1.AnnGetPolyFillMode (hPlgn), FALSE);
   m_Lead1.AnnSetLineStyle (hPlgn, (m_Lead1.AnnGetLineStyle (hPlgn) + 1) % 6, FALSE);
   m_Lead1.AnnSetLineWidth (hPlgn, int(m_Lead1.AnnGetLineWidth (hPlgn)) % 4 + 1, FALSE);
   nNodes = m_Lead1.AnnGetNodes (hPlgn, &bShow);
   m_Lead1.AnnSetNodes (hPlgn, !bShow, (nNodes + 1) % m_Lead1.AnnGetPointCount (hPlgn), FALSE);


AnnSetROP2t Example for Visual C++ 4.0
AnnSetROP2 example for Visual C++

   m_Lead1.AnnSetROP2 (hPlgn, (m_Lead1.AnnGetROP2 (hPlgn) + 1) % 3, FALSE);


AnnSetUnit Example for Visual C++ 4.0
AnnSetUnit example for Visual C++

   short nUnit;
   long hCrossProd;
   m_Lead1.AnnGetUnit (hCrossProd, &nUnit, NULL);
   nUnit = (nUnit + 1) % 10;
   m_Lead1.AnnSetUnit (hCrossProd, nUnit | ANNUNIT_DEF_ABBR, NULL, 2, FALSE);
   m_Lead1.AnnSetGaugeLength (hCrossProd, 3, FALSE);
   CString msg;
   msg.Format("Unit: %s\nDistance: %f\nGauge Length: %f",
      (LPCSTR)m_Lead1.AnnGetUnit(hCrossProd, NULL, NULL),
      (double)m_Lead1.AnnGetDistance (hCrossProd, NULL),
      (double)m_Lead1.AnnGetGaugeLength (hCrossProd));
   AfxMessageBox(msg);


AnnSetUser Example for Visual C++ 4.0
AnnSetUser Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

// hide the selected objects
   m_LEAD1.AnnSetVisible(m_LEAD1.GetAnnContainer(), FALSE, ANNFLAG_RECURSE | ANNFLAG_SELECTED, "");
   // set the selected objects to belong to user XXX
   m_LEAD1.AnnSetUser(m_LEAD1.GetAnnContainer(), "", "xxx", TRUE);


AnnSetWnd Example for Visual C++ 4.0
AnnSetWnd example for Visual C++

   OLE_HANDLE oldWnd = m_Lead1.AnnGetWnd (hPlgn);
   m_Lead1.AnnSetWnd (hPlgn, (OLE_HANDLE)m_hWnd);
   m_Lead1.AnnSetVisible (hPlgn, FALSE, 0, 0);
   m_Lead1.AnnSetVisible(hPlgn, TRUE, 0, 0);
   AfxMessageBox("will restore old window");
   m_Lead1.AnnSetWnd(hPlgn, oldWnd);


AnnShowLockedIcon Example for Visual C++ 4.0
AnnShowLockedIcon Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example toggles the AnnShowLockedIcon property.

    //Toggle AnnShowLockedIcon
    if(m_Lead1.GetAnnShowLockedIcon() == TRUE)
        m_Lead1.SetAnnShowLockedIcon(FALSE);
    else
        m_Lead1.SetAnnShowLockedIcon(TRUE);


AnnToolChecked Example for Visual C++ 4.0
AnnToolChecked Example for C++ 4.0 and later

Note: This topic is for Document/Medical only.

void CNewannDlg::OnAnnToolCheckedLead1(short iTool)
{
char cs[80];
char ToolString[25];

// TODO: Add your control notification handler code here
switch(iTool)
{
case ANNTOOL_SELECT:
strcpy(ToolString,"Selection pointer");
break;
case ANNTOOL_LINE:
strcpy(ToolString, "Line");
break;
case ANNTOOL_RECT:
strcpy(ToolString, "Rectangle");
break;
case ANNTOOL_ELLIPSE:
strcpy(ToolString, "Ellipse");
break;
case ANNTOOL_POLYLINE:
strcpy(ToolString, "Polyline");
break;
.
.
.
default:
strcpy(ToolString, "User defined");

}
sprintf(cs, "You selected a %s tool\n", ToolString);
MessageBox(cs, "", MB_OK);
}


AnnToolDestroy Example for Visual C++ 4.0
AnnToolDestroy Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

void CNewannDlg::OnAnnToolDestroyLead1()
{
// TODO: Add your control notification handler code here
MessageBox("You have closed the toolbar.", "", MB_OK);

}


AnnUndo example for Visual C++ 4.0
AnnUndo example for C++ 4.0 and later

// Make some changes and then call this method.
// See how the last change is undone.
m_Lead1.AnnUndo();


AnnUndoDepth example for Visual C++ 4.0
AnnUndoDepth example for C++ 4.0 and later

// This example increases the length of the undo stack

m_Lead1.SetAnnUndoDepth(m_Lead1.GetAnnUndoDepth() + 5);


AnnUndoEnable example for Visual C++ 4.0
AnnUndoEnable example for C++ 4.0 and later

// This example toggles the Undo feature

m_Lead1.SetAnnUndoEnable(!m_Lead1.GetAnnUndoEnable());


AnnUngroup Example for Visual C++ 4.0
AnnUngroup Example for C++ 4.0 and later

Note: This topic is for Document/Medical only.

m_LEAD1.AnnUngroup(m_LEAD1.GetAnnContainer(), ANNFLAG_SELECTED | ANNFLAG_RECURSE, "");


AnnUnlock Example for Visual C++ 4.0
AnnUnlock Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This is also the example for AnnGetLocked.

If an object is found to be locked, using AnnGetLocked method, the object is unlocked, by AnnUnlock, using the key "IkeStarnes".

BOOL bLocked;

   bLocked = m_Lead1.AnnGetLocked(ghObject);
   if(bLocked == TRUE)
      m_Lead1.AnnUnlock(ghObject, "IkeStarnes");


AnnUnlocked Example for Visual C++ 4.0
AnnUnlocked Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

The following is an example of an AnnUnlocked event.

void CTestocxDlg::OnAnnUnlockedLeadctrl1(long hObject)
{
   CString msg;

   msg.Format("Object: %ld was unlocked.", hObject);
   AfxMessageBox (msg);
}


AnnUnrealize Example for Visual C++ 4.0
AnnUnrealize Example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

The following example calls the AnnUnrealize method.

    // Unrealize all redact objects in the container

    m_Lead1.AnnUnrealize(m_Lead1.GetAnnContainer(), FALSE);


AntiAlias example for C++ 5.0 and later

   m_Lead1.AntiAlias(128, 3, ANTIALIAS_1);


Appearance (ImageList Control) example for C++ 4.0 and later

   //set the control to have 3d appearance
   m_LEADImgList1.SetAppearance(APPEARANCE_THREED);


Appearance Example for Visual C++ 4.0
Appearance Example for C++ 4.0 and later

This example toggles the Appearance property.

void CTutorDlg::OnButton1()
{
   if (m_Lead1.GetAppearance() == APPEARANCE_FLAT)
      m_Lead1.SetAppearance(APPEARANCE_THREED);
   else
      m_Lead1.SetAppearance(APPEARANCE_FLAT);
}


AutoAnimate Example for Visual C++ 4.0
AutoAnimate Example for C++ 4.0 and later

This example gets information about an animated file, uses the information to position the LEAD control, and plays the animation as it loads the file.

// Declare variables for positioning the control.
int DisplayWidth, DisplayHeight, DisplayLeft, DisplayTop;

// Force continued looping after the file loads.
m_Lead1.SetAutoAnimationLoop(AUTOANIMATIONLOOP_INFINITE);

// Get information about the file we will load.
m_Lead1.GetFileInfo("c:\\windows\\system\\wndsurf1.avi", 0, 0 );

// Exit if this is not an animated file.
if (m_Lead1.GetInfoAnimation() == FALSE)
{
   MessageBox("Not an animated file", "Error");
   return;
}

// Calculate information for centering the LEAD control.
CRect rcClient;
GetClientRect(rcClient);
DisplayWidth = (int) m_Lead1.GetInfoAnimationWidth();
DisplayHeight = (int) m_Lead1.GetInfoAnimationHeight();
DisplayLeft = (rcClient.right - DisplayWidth) / 2;
DisplayTop= (rcClient.bottom - DisplayHeight) / 2;

// Center the LEAD control.
CRect rcWindow;
rcWindow.SetRect(DisplayLeft, DisplayTop,
   DisplayLeft + DisplayWidth,
   DisplayTop + DisplayHeight);
m_Lead1.MoveWindow(rcWindow);

// Set properties for playing the animation as is loads.
m_Lead1.SetAutoAnimate(TRUE);
m_Lead1.SetAutoRepaint(TRUE);

// Load the animated file.
m_Lead1.Load("c:\\windows\\system\\wndsurf1.avi", 0, 0, -1);


AutoPan Example for Visual C++ 4.0
AutoPan Example for C++ 4.0 and later

   m_LEAD1.Load("v:\\images\\babe.cmp", 0, 1, 1);
   m_LEAD1.SetAutoPan(TRUE);


AutoSegment (Mixed Raster Content Control)example for Visual C++ 4.0
AutoSegment (Mixed Raster Content Control) example for C++ 4.0 and later

void CT44TestDlg::OnAutoSeg()
{
   m_LeadMrc1.SetBitmap(m_Lead1.GetBitmap());
   m_LeadMrc1.SetBaseBackColor(RGB(200, 255, 255));
   m_LeadMrc1.SetBaseForeColor(RGB(0, 80, 0));
   m_LeadMrc1.SetStripeMaxHeight(100);
   m_LeadMrc1.AutoSegment(60, 40, 30);
   SetWindowText("Picture segments will be green-hashed");
}
void CT44TestDlg::OnAutoSegmentLeadmrcctrl1(long nStripeNo, long nStripeStartRow, long nStripeEndRow, long nSegmentNo, long SegmentLeft, long SegmentTop, long SegmentRight, long SegmentBottom, long SegType, long TextForeColor, long TextBackColor)
{
   m_Lead1.SetDrawFillStyle(DRAWFILLSTYLE_DIAGONAL_CROSS);
   m_Lead1.SetDrawPenWidth(6);
   m_Lead1.SetDrawPenColor(RGB(0, 255, 255));
   if(SegType == SEGMENT_PICTURE)
      m_Lead1.SetDrawFillColor(RGB(0, 255, 0));
   else
      m_Lead1.SetDrawFillColor(RGB(255, 0, 0));
   m_Lead1.DrawRectangle((float)SegmentLeft, (float)SegmentTop, (float)(SegmentRight - SegmentLeft), (float)(SegmentBottom - SegmentTop));
}


AutoSetTool Example for Visual C++ 4.0
AutoSetTool Example for C++ 4.0 and later

   CAnnToolbar AnnToolbar;
   AnnToolbar = m_LEAD1.GetAnnToolbar();
   //now lead1 will automatically set the tool when you click on the toolbar
   AnnToolbar.SetAutoSetTool(TRUE);


AutoSize Example for Visual C++ 4.0
AutoSize Example for C++ 4.0 and later

This example shows how the AutoSize property works when loading and when rotating an image.

m_Lead1.SetAutoSize(TRUE);
m_Lead1.Load("c:\\lead\\images\\image1.cmp", 0, 0, 1);
MessageBox ("Control is sized to fit the loaded bitmap", "Notice", MB_OK);
m_Lead1.Rotate(4500, ROTATE_RESIZE, RGB(0,0,0));
MessageBox ("Control is sized to fit the rotated bitmap", "Notice", MB_OK);


AutoTrim example for Visual C++ 4.0
AutoTrim example for C++ 4.0 and later

This example trims the bitmap with threshold of 10.

m_Lead1.AutoTrim(10);
m_Lead1.ForceRepaint();


Average example for Visual C++ 4.0
Average example for C++ 4.0 and later

This example applies an average filter with a 3x3 neighborhood and redisplays the bitmap.

m_Lead1.Average(3);
m_Lead1.ForceRepaint();


BackColor (ImageList Control) example for C++ 4.0 and later

   //This example sets the background color to red.
   m_LEADImgList1.SetBackColor(RGB(255,0,0));


BackColor example for Visual C++ 4.0
BackColor example for C++ 4.0 and later

This example sets the background color to red. You can zoom out to see the background color.

m_Lead1.SetBackColor(RGB(255, 0, 0));


BackErase example for Visual C++ 4.0
BackErase example for C++ 4.0 and later

This example turns off repainting of the background, then zooms out to show the effect when repainting.

m_Lead1.SetBackErase(FALSE);
m_Lead1.SetAutoRepaint(FALSE);
m_Lead1.SetAutoScroll(FALSE);

// Calculate the values to zoom out by 10 percent and center the image.
m_Lead1.SetDstWidth(m_Lead1.GetDstWidth() * 0.9f);
m_Lead1.SetDstHeight(m_Lead1.GetDstHeight() * 0.9f);
m_Lead1.SetDstTop((m_Lead1.GetScaleHeight() - m_Lead1.GetDstHeight()) / 2);
m_Lead1.SetDstLeft((m_Lead1.GetScaleWidth() - m_Lead1.GetDstWidth()) / 2);

// Set the clipping area to the same as the destination rectangle
m_Lead1.SetDstClipWidth(m_Lead1.GetDstWidth());
m_Lead1.SetDstClipHeight(m_Lead1.GetDstHeight());
m_Lead1.SetDstClipTop(m_Lead1.GetDstTop());
m_Lead1.SetDstClipLeft(m_Lead1.GetDstLeft());

// Redisplay the image
m_Lead1.ForceRepaint();


BalanceColors example for C++ 5.0 and later

   float RedFactToRed = 0.25f;
   float RedFactToGreen = 0.5f;
   float RedFactToBlue = 0.25f;
   float GreenFactToRed = 0.3f;
   float GreenFactToGreen = 0.4f;
   float GreenFactToBlue = 0.3f;
   float BlueFactToRed = 0.1f;
   float BlueFactToGreen = 0.6f;
   float BlueFactToBlue = 0.3f;
   m_Lead1.BalanceColors(RedFactToRed, RedFactToGreen, RedFactToBlue, GreenFactToRed, GreenFactToGreen, GreenFactToBlue, BlueFactToRed, BlueFactToGreen, BlueFactToBlue);


BinaryFilter example for Visual C++ 4.0
BinaryFilter example for C++ 4.0 and later

This example does omni-directional erosion of black objects and repaints the image.

m_Lead1.BinaryFilter(BFLT_EROSION_OMNI);
m_Lead1.ForceRepaint();


BitmapAlpha example for Visual C++ 4.0
BitmapAlpha example for C++ 4.0 and later

This example shows how to use the BitmapAlpha property to save a region in a file's alpha channel. It also shows how to use the region as a mask for transparency.

   float rgntop;
   float rgnleft;
   float rgnwidth;
   float rgnheight;
   long  hRGN;
   long  test;

   m_LEAD1.SetScaleMode (3);
   m_LEAD1.Load ("v:\\images\\eagle.cmp", 0, 0, 1);
   m_LEAD1.SetAutoRepaint (FALSE);
   // Get an alpha channel bitmap, and fill it with white
   m_LEADAlpha.SetBitmap (m_LEAD1.GetBitmapAlpha ());

   m_LEADAlpha.SetRgnColor ( RGB(0, 0, 0), L_RGN_SETNOT);
   test = m_LEADAlpha.GetRgnArea ();

   // test here, if test = 0, then Alpha is all Black
   if (test == 0)
      AfxMessageBox("Alpha image is all black");

   m_LEADAlpha.Fill (RGB(255, 255, 255));
   rgntop = 0;
   rgnleft = 0;
   rgnwidth = m_LEAD1.GetBitmapWidth ();
   rgnheight = m_LEAD1.GetBitmapHeight ();

   // Create an elliptical region in the AlphaBitmap
   m_LEADAlpha.SetRgnEllipse (rgntop, rgnleft, rgnwidth, rgnheight, L_RGN_SET);
   // Fill the region with black
   m_LEADAlpha.Fill (RGB(0, 0, 0));
   // Free the region
   m_LEADAlpha.FreeRgn ();
   // Update the alpha channel in the main bitmap
   m_LEAD1.SetBitmapAlpha (m_LEADAlpha.GetBitmap ());
   // Save the bitmap as 32-bit TGA
   m_LEAD1.Save("d:\\temp\\test.tga", FILE_TGA, 32, 0, SAVE_OVERWRITE);

   // Free the bitmaps
   m_LEAD1.SetBitmap (0);
   m_LEADAlpha.SetBitmap(0);
   // Load the bitmap we just saved and get the alpha channel
   m_LEAD1.Load ("d:\\temp\\test.tga", 0, 0, 1);
   m_LEADAlpha.SetBitmap(m_LEAD1.GetBitmapAlpha ());
   // Create a region in the AlphaBitmap that includes all of the black pixels
   m_LEADAlpha.SetRgnColor (RGB(0, 0, 0), L_RGN_SET);
   // Get the region from the AlphaBitmap and set it into the main bitmap
   hRGN = m_LEADAlpha.GetRgnHandle ();
   m_LEAD1.SetRgnHandle (hRGN, 0, 0, L_RGN_SET);

   m_LEAD1.SetPaintRgnOnly (TRUE);
   m_LEAD1.ForceRepaint ();


BitmapCompression example for Visual C++ 4.0
BitmapCompression example for C++ 4.0 and later

// This example toggles the bitmap’s compression
long oldSize;

oldSize = m_Lead1.GetBitmapSize();

if(m_Lead1.GetBitmapCompression() == COMP_NONE)
{
   if(m_Lead1.GetBitmapBits () == 24)
      m_Lead1.SetBitmapCompression(COMP_SUPER);
   else if(m_Lead1.GetBitmapBits () == 1)
      m_Lead1.SetBitmapCompression(COMP_RLE);
}
else
    m_Lead1.SetBitmapCompression(COMP_NONE);

CString szMsg;
szMsg.Format("Old Size = %d\rNew Size = %d", oldSize, m_Lead1.GetBitmapSize());
MessageBox(szMsg);


BitmapDataPath Example for Visual C++ 4.0
BitmapDataPath Example for C++ 4.0 and later

This example shows how to load an image from the Internet. It uses the BitmapDataPath property to start the asynchronous load; then uses the ReadyStateChange event to paint the image when loading is complete.

void CTutorDlg::OnOK()
{
   // Start the asynchronous load.
   m_Lead1.SetBitmapDataPath("http://www.leadtools.com/images/vbaward.jpg");
}

void CTutorDlg::OnReadyStateChangeLead1(long ReadyState)
{
   // Paint the image when loading is complete.
   if (ReadyState == READYSTATE_COMPLETE)
   {
      m_Lead1.SetAutoSetRects(TRUE);
      m_Lead1.SetPaintSizeMode(PAINTSIZEMODE_FIT);
      m_Lead1.ForceRepaint();
   }
}


BitmapDataPathClosed Example for Visual C++ 4.0
BitmapDataPathClosed example for Visual C++

BOOL bBmpClosed;

void CTestDlg::OnButton1()
{
    bBmpClosed = TRUE;

    m_LEAD1.SetBitmapDataPath("http://www.leadtools.com/Home2/vertmkts/images/v14web.jpg");

    Sleep(1);

    m_LEAD1.SetBitmapDataPath("http://www.leadtools.com/images/end-user.jpg");
}

void CTestDlg::OnBitmapDataPathClosedLeadctrl1()
{
   bBmpClosed = FALSE;
}


BitmapDpi Example for Visual C++ 4.0
BitmapDpi example for Visual C++

   float x, y;
   OLE_HANDLE hAuto = m_Lead1.AnnCreate (ANNOBJECT_AUTOMATION, FALSE, FALSE);
   x = m_Lead1.AnnGetBitmapDpiX (hAuto);
   y = m_Lead1.AnnGetBitmapDpiY (hAuto);
   CString msg;
   msg.Format("X: %f, Y: %f", (double)x, (double)y);
   AfxMessageBox(msg);
   m_Lead1.AnnSetBitmapDpiX (hAuto, x + 2, FALSE);
   m_Lead1.AnnSetBitmapDpiY (hAuto, y + 2, FALSE);
   x = m_Lead1.AnnGetBitmapDpiX(hAuto);
   y = m_Lead1.AnnGetBitmapDpiY(hAuto);
   msg.Format("X: %f, Y: %f", (double)x, (double)y);
   AfxMessageBox(msg);


BitmapToClient example for Visual C++ 4.0
BitmapToClient example for C++ 4.0 and later

   CString szOut;

   //Test a bitmap location for its screen location
   m_LEAD1.BitmapToClient(50.0f, 50.0f);
   szOut.Format("ClientX = %d\nClientY = %d",
            (long)m_LEAD1.GetConvertX(),
            (long)m_LEAD1.GetConvertY());
   AfxMessageBox(szOut);


BitmapXres and BitmapYres example for Visual C++ 4.0
BitmapXres and BitmapYres example for C++ 4.0 and later

This example sets the bitmap's resolution to 300 x 600 DPI.

m_Lead1.SetBitmapXRes(300);
m_Lead1.SetBitmapYRes(600);


BitonalScaling (ImageList Control) example for C++ 4.0 and later

   //set the control to use scale to gray
   m_LEADImgList1.SetBitonalScaling(BITONALSCALING_SCALETOGRAY);


BitonalScaling example for Visual C++ 4.0
BitonalScaling example for C++ 4.0 and later

This example sets the display to use scale-to-gray and repaints the image. This affects only 1-bit images.

if (m_Lead1.IsSupportLocked(L_SUPPORT_DOCUMENT))
{
   CString cMsg("No scale to gray - You need to unlock Document/Medical capabilities");
   MessageBox(cMsg, "Error");
}
else
{
   m_Lead1.SetBitonalScaling(BITONALSCALING_SCALETOGRAY);
   m_Lead1.ForceRepaint();
}


BorderColor (ImageList Control) example for C++ 4.0 and later

//This sets the border style to Fixed Single.
//And sets the border color to blue.
m_LEADImgList1.SetAppearance(APPEARANCE_FLAT);
m_LEADImgList1.SetBorderStyle(1);
m_LEADImgList1.SetBorderColor(RGB(0, 0, 255));


BorderRemove example for Visual C++ 4.0
BorderRemove example for C++ 4.0 and later

   short nRet;
   //Border Remove
   //This example updates a region with the borders of a bitmap

   //For the example, windows regions are passed to the BorderRemove Event and combined.
   //In practice it would be easier and faster to just update a LEAD region representing the changes
   //The border is removed from the image

   //Create a NULL region
   hRgnAll = CreateRectRgn(0, 0, 0, 0);

   nRet = m_LEAD1.BorderRemove(BORDER_CALLBACK_REGION | BORDER_USE_VARIANCE,
                               BORDER_TOP | BORDER_BOTTOM | BORDER_LEFT | BORDER_RIGHT,
                               20, 2, 5);

   if(nRet == 0)
   {
      m_LEAD1.FreeRgn();
      m_LEAD1.SetRgnHandle((OLE_HANDLE)hRgnAll, 0.0f, 0.0f, L_RGN_SET);
      m_LEAD1.SetRgnFrameType(RGNFRAME_ANIMATED);
   }
   //delete the Windows Rgn
   DeleteObject(hRgnAll);

void CDoccleanDlg::OnBorderRemoveLeadctrl1(long hRgn, long uBorderToRemove, float fBoundingRectLeft, float fBoundingRectTop, float fBoundingRectWidth, float fBoundingRectHeight)
{
   CString szBorder;
   CString csOut;
   CombineRgn(hRgnAll, hRgnAll, (HRGN)hRgn, RGN_OR);
   switch(uBorderToRemove)
   {
   case BORDER_TOP:
      szBorder = "Top";
   case BORDER_LEFT:
      szBorder = "Left";
   case BORDER_RIGHT:
      szBorder = "Right";
   case BORDER_BOTTOM:
      szBorder = "Bottom";
   }
   csOut.Format("Border - %s Bounds:%d,%d,%d,%d",
                szBorder,
                (long)fBoundingRectLeft,
                (long)fBoundingRectTop,
                (long)fBoundingRectWidth,
                (long)fBoundingRectHeight);
   m_LEAD1.SetDocCleanSuccess(SUCCESS_REMOVE);
}


BorderStyle example for Visual C++ 4.0
BorderStyle example for C++ 4.0 and later

This example toggles the border style and repaints the image.

if (m_Lead1.GetBorderStyle() == 1)
   m_Lead1.SetBorderStyle(0);
else
   m_Lead1.SetBorderStyle(1);
m_Lead1.ForceRepaint();


BrowseDir (Thumbnail Browser Control) example for C++ 4.0 and later

   m_LEADThumb1.SetEnableMethodErrors(FALSE);
   m_LEADThumb1.SetStopOnError(TRUE);

   m_LEADThumb1.SetFilter("*.jpg"); //search for JPEG files

   m_LEADThumb1.SetThumbnailWidth(150);
   m_LEADThumb1.SetThumbnailHeight(150);
   m_LEADThumb1.SetThumbnailBitsPerPixel(0);

   m_LEADThumb1.SetMaintainAspect(TRUE);
   m_LEADThumb1.SetForceSize(TRUE);
   m_LEADThumb1.SetThumbnailBackgroundColor(RGB(0, 255, 0));

   m_LEADThumb1.SetLoadStamp(TRUE);
   m_LEADThumb1.SetResample(TRUE);

   m_LEADThumb1.SetIncludeSubDirectories(FALSE);

   m_LEADThumb1.SetExpandMultipage(FALSE);

   m_LEADThumb1.SetMaxSizeDisk(0); //no filesize limit
   m_LEADThumb1.SetMaxSizeMem(4096000); //set a image size limit

   m_LEADThumb1.SetDitherFlags(CRD_STUCKIDITHERING);
   m_LEADThumb1.SetPaletteFlags(CRP_FIXEDPALETTE);

   m_LEADThumb1.BrowseDir("o:\\images\\new");


ButtonColumns example for Visual C++ 4.0
ButtonColumns example for C++ 4.0 and later

This example is for Document/Medical only.

CAnnToolbar AnnToolbar;

   AnnToolbar = m_LEAD1.GetAnnToolbar();
   AnnToolbar.SetButtonColumns(AnnToolbar.GetButtonColumns() + 1);


ButtonMenuTool example for Visual C++ 4.0
ButtonMenuTool example for C++ 4.0 and later

   int i;
   CAnnToolbar AnnToolbar;
   AnnToolbar = m_LEAD1.GetAnnToolbar();
   // make the first rubber stamp tool draw a rectangle
   for(i=0; i<AnnToolbar.GetButtonCount(); i++)
   {
      // is this the button with the rubber stamps ?
      if(AnnToolbar.GetButtonToolCount(i) > 1)
         AnnToolbar.SetButtonMenuTool(i, 0, ANNTOOL_RECT);
   }


ButtonRows example for Visual C++ 4.0
ButtonRows example for C++ 4.0 and later

This example is for Document/Medical only.

CAnnToolbar AnnToolbar;

   AnnToolbar = m_LEAD1.GetAnnToolbar();
   AnnToolbar.SetButtonRows(AnnToolbar.GetButtonRows() + 1);


ButtonVisible example for Visual C++ 4.0
ButtonVisible example for C++ 4.0 and later

   CAnnToolbar AnnToolbar;
   AnnToolbar = m_LEAD1.GetAnnToolbar();
   // hide/show the first toolbar button
   if(AnnToolbar.GetButtonVisible(0))
      AnnToolbar.SetButtonVisible(0, FALSE);
   else
      AnnToolbar.SetButtonVisible(0, TRUE);


Capture example for Visual C++ 4.0
Capture example for C++ 4.0 and later

This example captures the current form and displays the captured image with scroll bars.

// Turn on the automatic display rectangles.
m_Lead1.SetAutoSetRects(TRUE);
CRect rcWindow;
GetWindowRect(&rcWindow);
m_Lead1.Capture(0, (float) rcWindow.left, (float) rcWindow.top,
(float) rcWindow.Width(), (float) rcWindow.Height());
m_Lead1.SetAutoScroll(TRUE);
m_Lead1.ForceRepaint();


CenterImage example for Visual C++ 4.0
CenterImage example for C++ 4.0 and later

//toggle CenterImage
m_LEAD1.SetCenterImage(!m_LEAD1.GetCenterImage());


Change example for Visual C++ 4.0
Change example for C++ 4.0 and later

Typically, you would use this event to flag changed image data and prompt the user to save the changes before closing a window or exiting an application.  That use of the event cannot be tested properly without writing a complete application; so this example just shows you a simple test of the event.

void CTutorDlg::OnChangeLead1()
{
    // TODO: Add your control notification handler code here
    MessageBox("Image data has changed", "Test Message", MB_OK);
}


Clear (ImageList Control) example for C++ 4.0 and later

   //empty the current list
   m_LEADImgList1.Clear();


ClientToBitmap example for Visual C++ 4.0
ClientToBitmap example for C++ 4.0 and later

void CMfcClientToBitmapDlg::OnMouseDownLeadctrl1(short Button, short Shift, long x, long y)
{
   float BitmapX;
   float BitmapY;

   BitmapX = (float)x;
   BitmapY = (float)y;
   m_LEAD1.ClientToBitmap(BitmapX, BitmapY);

   //Change that pixel to White
   m_LEAD1.SetPixel(m_LEAD1.GetConvertX(),
m_LEAD1.GetConvertY(),
RGB(255,255,255));
}


ColorRes example for Visual C++ 4.0
ColorRes example for C++ 4.0 and later

This example checks to see if the bitmap is 8 bits per pixel and converts it if it is not.

if (m_Lead1.GetBitmapBits() != 8)
{
  BeginWaitCursor();
  m_Lead1.ColorRes(8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0);
  m_Lead1.ForceRepaint();
  EndWaitCursor();
}


ColorResList Example for Visual C++ 4.0
ColorResList Example for C++ 4.0 and later

This example changes the hue of bitmaps in a list, then plays the list as an animation. When changing the hue, it preserves the transparent color.

short i; // Loop counter
short uCount; // Number of bitmaps in the list
OLE_COLOR TransparentColor; // Color used for transparency

// Save the current transparent color.
TransparentColor = m_Lead1.GetBitmapTransparentColor();

// Avoid repaints while we modify the bitmaps.
m_Lead1.SetAutoRepaint(FALSE);

// Change the hue of each bitmap in the list,
// and restore the transparent color as the last color in the palette.
uCount = m_Lead1.GetBitmapListCount();
for (i = 0; i < uCount; ++i)
{
   m_Lead1.SetBitmapListIndex(i);
   m_Lead1.Hue(i * 10);
   m_Lead1.SetBitmapPalette(255, TransparentColor);
}

// Get an optimized palette for the whole list.
m_Lead1.ColorResList(8, CRP_OPTIMIZEDPALETTE, CRD_NODITHERING, 0);

// Update the palette that is used for playback.
for (i = 0; i < 256; ++ i)
   m_Lead1.SetAnimationPalette(i, m_Lead1.GetBitmapPalette(i));

// Start the animation.
m_Lead1.SetAutoRepaint(TRUE);
m_Lead1.SetAnimationEnable(TRUE);


Combine example for Visual C++ 4.0
Combine example for C++ 4.0 and later

This example copies the Lead1 bitmap to Lead2, trims and filters the copied image, and combines the filtered image with the original Lead1 bitmap image. Trimming Lead2 lets you see the difference between filtered and nonfiltered regions.

BeginWaitCursor();
m_Lead2.SetBitmap(m_Lead1.GetBitmap());
float TrimLeft = (m_Lead2.GetBitmapWidth() * 0.2f);
float TrimTop = (m_Lead2.GetBitmapHeight() * 0.2f);
float TrimWidth = (m_Lead2.GetBitmapWidth() * 0.6f);
float TrimHeight = (m_Lead2.GetBitmapHeight() * 0.6f);
m_Lead2.Trim(TrimLeft, TrimTop, TrimWidth, TrimHeight);
m_Lead2.SpatialFilter (FLT_LINESEG_LTOR);
float DstLeft = TrimLeft;
float DstTop = TrimTop;
float DstWidth = TrimWidth;
float DstHeight = TrimHeight;
float SrcLeft = 0.0f;
float SrcTop = 0.0f;
m_Lead1.Combine(DstLeft, DstTop, DstWidth, DstHeight, m_Lead2.GetBitmap(), SrcLeft, SrcTop, CB_OP_ADD);
m_Lead1.ForceRepaint();
EndWaitCursor();


CombineBitmapWarp example for C++ 4.0 and later

   int nRet;
   VARIANT  xPoints;  //array for the X coordinates
   VARIANT  yPoints;  //array for the Y coordinates
   VARIANT  vValue;
   long nPoints;

   VariantInit(&xPoints);
   VariantInit(&yPoints);
   VariantInit(&vValue);
   nPoints = m_LEADMaster.AnnGetPointCount (m_hObject);    //get the number of points for the annotation object
   xPoints = m_LEADMaster.AnnGetPointX (m_hObject);        //get the X coordinates for the annotation object
   yPoints = m_LEADMaster.AnnGetPointY (m_hObject);        //get the Y coordinates for the annotation object

   // Note that the bits per pixel of master and slave must be the same
   // If palletized, the palettes must be the same
   UINT uMasterBPP = m_LEADMaster.GetBitmapBits ();
   UINT uSlaveBPP  = m_LEADSlave.GetBitmapBits ();
   if ((uMasterBPP < 24) || (uSlaveBPP < 24))
   {
      UINT uBitsPerPixel = max(uMasterBPP, uSlaveBPP );
      if (uMasterBPP != uBitsPerPixel)
         m_LEADMaster.ColorRes(uBitsPerPixel, CRP_FIXEDPALETTE | CRP_BYTEORDERBGR, CRD_NODITHERING, CRP_OPTIMIZEDPALETTE);

      if (uSlaveBPP != uBitsPerPixel)
         m_LEADSlave.ColorRes (uBitsPerPixel, CRP_FIXEDPALETTE | CRP_BYTEORDERBGR, CRD_NODITHERING, CRP_OPTIMIZEDPALETTE);
   }

   UINT uFlags = m_bBilinearInterpolate ? CBW_BILINEAR | CBW_RESERVED8  : CBW_RESERVED8;
   BeginWaitCursor();
   nRet = m_LEADMaster.CombineBitmapWarp(xPoints, yPoints, 4, m_LEADSlave.GetBitmap(), 0, 0, (long)m_LEADSlave.GetBitmapWidth (), (long)m_LEADSlave.GetBitmapHeight(), (long)uFlags);
   EndWaitCursor();
   VariantClear(&xPoints);
   VariantClear(&yPoints);

   if (nRet == ERROR_FEATURE_NOT_SUPPORTED)
   {
      MessageBox("Error--Feature not supported");
   }
   else if (nRet != 0)
   {
      char *pszMsg = "One of the following caused the error:\n"
         "1. Polygon must be concave\n"
         "2. Polygon must lie completely on the master bitmap\n"
         "3. The bits per pixel of the Master and Slave must be the same\n"
         "4. Master or slave image not loaded\n";

      MessageBox(pszMsg);
   }
   else
      m_LEADMaster.ForceRepaint ();


CombineExt example for C++ 4.0 and later

This example copies the Lead1 bitmap to Lead2, trims and filters the copied image, and combines the filtered image with the original Lead1 bitmap image. Trimming Lead2 lets you see the difference between filtered and nonfiltered regions.

BeginWaitCursor();
m_Lead2.SetBitmap(m_Lead1.GetBitmap());
float TrimLeft = (m_Lead2.GetBitmapWidth() * 0.2f);
float TrimTop = (m_Lead2.GetBitmapHeight() * 0.2f);
float TrimWidth = (m_Lead2.GetBitmapWidth() * 0.6f);
float TrimHeight = (m_Lead2.GetBitmapHeight() * 0.6f);
m_Lead2.Trim(TrimLeft, TrimTop, TrimWidth, TrimHeight);
m_Lead2.SpatialFilter (FLT_LINESEG_HORZ);
float DstLeft = TrimLeft;
float DstTop = TrimTop;
float DstWidth = TrimWidth;
float DstHeight = TrimHeight;
float SrcLeft = 0.0f;
float SrcTop = 0.0f;
m_Lead1.CombineExt (DstLeft, DstTop, DstWidth, DstHeight, m_Lead2.GetBitmap(), SrcLeft, SrcTop, CB_OP_ADD);
m_Lead1.ForceRepaint();
EndWaitCursor();


Comment example for Visual C++ 4.0
Comment example for C++ 4.0 and later

This example does the following:

1.	Loads an image from a TIFF file.

2.	Updates the current comment array by reading comments from the file.

3.	Modifies one of the comments.

4.	Modifies and saves the file.

5.	Reads the comment that was saved, and displays it in a message box.

This example handles only string comments. For more complex comments, refer to Exif Examples.

// Value for clearing comments.
COleVariant Empty = COleVariant();

// Specify the file that we will load and update.
CString FilePath = "d:\\lead\\images\\testcmt.tif";

// Get all of the current comments from the file.
// Temporarily disable errors so that we do not fail when comments are missing.
m_Lead1.SetEnableMethodErrors(FALSE);
for(short i = 0; i <= CMNT_LAST; ++i)
{
  m_Lead1.SetComment(i, Empty);
  m_Lead1.SetComment(i, m_Lead1.ReadComment(FilePath, 0, i));
}
m_Lead1.SetEnableMethodErrors(TRUE);

// Load and modify the image.
m_Lead1.Load(FilePath, 0, 0, 1);
m_Lead1.Reverse();

// Update the CMNT_SZDESC comment.
VARIANT V1 = m_Lead1.GetComment(CMNT_SZDESC);
COleVariant VDescString;
VDescString.Attach(V1);
VDescString =  CString(VDescString.bstrVal) + "\nThis image has been reversed.";
m_Lead1.SetComment(CMNT_SZDESC, VDescString);

// Save the file.
int SaveBits = m_Lead1.GetBitmapBits();
m_Lead1.Save(FilePath, FILE_EXIF, SaveBits, 0, SAVE_OVERWRITE);

// Read the comment that we saved.
VARIANT V2 = m_Lead1.ReadComment(FilePath, 0, CMNT_SZDESC);
COleVariant VNewDescString;
VNewDescString.Attach(V2);

// Display the message.
MessageBox(CString(VNewDescString.bstrVal));

// Clear the comments from memory
for( i = 0; i <= CMNT_LAST; ++i)
  m_Lead1.SetComment(i, Empty);


ContinueBrowse (Thumbnail Browser Control) example for C++ 4.0 and later

void CTttDlg::OnThumbnailEventLeadthumbctrl1(long Bitmap, LPCTSTR pszFilename, short
nStatusCode, short nPercent)
{
   //in this example, nCount is a global variable used to count the thumbnails
   if(nStatusCode == 0) //successful thumbnail generation
   {
      //save thumbnails in a multipage TIFF file
      m_LEAD1.SetBitmap(Bitmap);
      m_LEAD1.Save("d:\\temp\\thumbs.tif", FILE_TIF, 24, 0, SAVE_APPEND);
      nCount++;
      if(nCount > 20) //allow max of 20 thumbnails
      {
         m_LEADThumb1.SetContinueBrowse(FALSE); //stop the browse
         return;
      }
      CString csOut;
      csOut.Format("%s\nFormat: %d\nCompression: %d\nBits: %d\nWidth: %d\nHeight: %d\nPage:
%d\nTotalPages: %d\nSizeDisk: %ld\nSizeMem: %ld\nXRes: %d\nYRes: %d",
                   pszFilename,
                   m_LEADThumb1.GetInfoFormat(),
                   m_LEADThumb1.GetInfoCompression(),
                   m_LEADThumb1.GetInfoBits(),
                   m_LEADThumb1.GetInfoWidth(),
                   m_LEADThumb1.GetInfoHeight(),
                   m_LEADThumb1.GetInfoPage(),
                   m_LEADThumb1.GetInfoTotalPages(),
                   m_LEADThumb1.GetInfoSizeDisk(),
                   m_LEADThumb1.GetInfoSizeMem(),
                   m_LEADThumb1.GetInfoXRes(),
                   m_LEADThumb1.GetInfoYRes());
   }
   m_LEADThumb1.SetContinueBrowse(TRUE); //continue the browse operation
}


ContourFilter example for Visual C++ 4.0
ContourFilter example for C++ 4.0 and later

short nRet;

   m_LeadDlg1.SetUIFlags(DLG_CONTOUR_SHOWPREVIEW |
                         DLG_CONTOUR_OPTION      |
                         DLG_CONTOUR_THRESHOLD   |
                         DLG_CONTOUR_DELTADIRECTION |
                         DLG_CONTOUR_MAXIMUMERROR   |
                         DLG_CONTOUR_95CONTEXTHELP );
   m_LeadDlg1.SetContourOptionFlags(DLG_CONTOUR_OPTION_THIN    |
                                    DLG_CONTOUR_OPTION_LINK_BW |
                                    DLG_CONTOUR_OPTION_LINK_GRAY  |
                                    DLG_CONTOUR_OPTION_LINK_COLOR |
                                    DLG_CONTOUR_OPTION_APPROX_COLOR);
   m_LeadDlg1.SetBitmap(m_Lead1.GetBitmap());
   nRet = m_LeadDlg1.GetContourFilter((long)this->m_hWnd);
   if (nRet != 0)
   {
      if(nRet != ERROR_DLG_CANCELED)
         AfxMessageBox("Error");
   }
   else
      nRet = m_Lead1.ContourFilter(m_LeadDlg1.GetContourThreshold(),
                                   m_LeadDlg1.GetContourDeltaDirection(),
                                   m_LeadDlg1.GetContourMaximumError(),
                                   m_LeadDlg1.GetContourOption());
   m_LeadDlg1.SetBitmap(0);


Contrast example for Visual C++ 4.0
Contrast example for C++ 4.0 and later

This example increases the contrast and repaints the image.

m_Lead1.Contrast(50);
m_Lead1.ForceRepaint();


ConvertToColoredGray example for C++ 5.0 and later

   short RedFact = 300;
   short GreenFact = 590;
   short BlueFact = 110;
   short RedGrayFact = 500;
   short GreenGrayFact = 300;
   short BlueGrayFact = 200;
   m_Lead1.ConvertToColoredGray(RedFact, GreenFact, BlueFact, RedGrayFact, GreenGrayFact, BlueGrayFact);


Create example for Visual C++ 4.0
Create example for C++ 4.0 and later

CAnnToolbar AnnToolbar;

   m_LEAD1.SetAutoPan(FALSE);
   AnnToolbar = m_LEAD1.GetAnnToolbar();
   AnnToolbar.SetVisible(FALSE);
   AnnToolbar.Create(0.0f, 0.0f, ANNTOOLALIGN_TOP + ANNTOOLALIGN_LEFT);

   AnnToolbar.SetButtonTool(AnnToolbar.GetButtonCount(), ANNTOOL_USER_FIRST);

   m_LEAD1.Load("d:\\LTWIN14x\\images\\Ulay1.bmp", 0, 0, 1);
   AnnToolbar.SetButtonBitmapUp(AnnToolbar.GetButtonCount(), m_LEAD1.GetBitmap());
   m_LEAD1.Load("d:\\LTWIN14x\\images\\Ulay2.bmp", 0, 0, 1);
   AnnToolbar.SetButtonBitmapDown(AnnToolbar.GetButtonCount(), m_LEAD1.GetBitmap());
   m_LEAD1.Load("d:\\LTWIN14x\\images\\image2.cmp", 0, 0, 1);
   AnnToolbar.SetButtonToolTipTextID(AnnToolbar.GetButtonCount(), -1);
   AnnToolbar.SetButtonToolTipText(AnnToolbar.GetButtonCount(), "User defined tool");

   AnnToolbar.SetButtonCount(AnnToolbar.GetButtonCount() + 1);
   AnnToolbar.SetVisible(TRUE);
   m_LEAD1.SetAnnUserMode(ANNUSERMODE_DESIGN);
   //AnnToolbar.SetButtonMenuTextID(14, 1, -1);
   AnnToolbar.SetButtonMenuText(14, 1, "My text");


CreateBitmap, Size, and Combine example for Visual C++ 4.0
CreateBitmap, Size, and Combine example for C++ 4.0 and later

This example creates a bitmap for Lead2 (same size and BPS as Lead 1) and fills it with green. It resizes the Lead1 bitmap, then uses a loop to do multiple combines with the Lead2 bitmap. It then copies the Lead2 bitmap to Lead1 and redisplays m_Lead1.

BeginWaitCursor();
// Create the Lead2 bitmap. (The control must already be on the form).
int MyWidth = (int) m_Lead1.GetBitmapWidth();
int MyHeight = (int) m_Lead1.GetBitmapHeight();
int MyBPS = m_Lead1.GetBitmapBits();
m_Lead2.CreateBitmap((float) MyWidth, (float) MyHeight, MyBPS);
m_Lead2.Fill(RGB(0, 255, 0)); // fill with green
// Resize the Lead1 bitmap
int ImageWidth = (int) (MyWidth * 0.3);
int ImageHeight = (int) (MyHeight * 0.3);
m_Lead1.Size((float) ImageWidth, (float) ImageHeight, RESIZE_RESAMPLE);
// Initialize the variables used for multiple combines.
int TestWidth = MyWidth; // Used for horizontal positioning
int TestHeight = MyHeight; // Used for vertical positioning
int VFactor = (int) (MyHeight / ImageHeight) + 1; // Number spaces between images
int VSpacing = (int) ((MyHeight % ImageHeight) / VFactor); // Pixels between images
int HFactor = (int) (MyWidth / ImageWidth) + 1; // Number spaces between images
int HSpacing = (int) ((MyWidth % ImageWidth) / HFactor); // Pixels between images
int DstT = VSpacing; // Top coordinate of the destination rectangle
int SrcL = 0; // Left coordinate of the source rectangle
int SrcT = 0; // Top coordinate of the source rectangle
int DstW = ImageWidth;  // Width of the destination rectangle
int DstH = ImageHeight; // Height of the destination rectangle
int MyOp = CB_OP_ADD + CB_DST_0; // Operation flags used when combining images
// Do the loop that does the multiple combines
while(TestHeight > ImageHeight) // Vertical loop
{
  DstT = MyHeight - TestHeight + VSpacing;
  TestHeight = TestHeight - ImageHeight - VSpacing;
  while(TestWidth > ImageWidth) // Horizontal loop
  {
int DstL = MyWidth - TestWidth + HSpacing;
TestWidth = TestWidth - ImageWidth - HSpacing;
m_Lead2.Combine((float) DstL, (float) DstT, (float) DstW, (float) DstH,
 m_Lead1.GetBitmap(), (float) SrcL, (float) SrcT, MyOp);
  }
  TestWidth = MyWidth;
}
// Copy the Lead2 bitmap to Lead1
m_Lead1.SetBitmap(m_Lead2.GetBitmap());
// Set the image display size to match the LEAD control
m_Lead1.SetDstRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.SetDstClipRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.ForceRepaint(); // Repaint the image
EndWaitCursor();


CreateUserBitmap example for Visual C++ 4.0
CreateUserBitmap example for C++ 4.0 and later

void CDataDlg::OnButton1()
{
   // create an empty variant
   COleVariant vEmpty;

   // make sure I am using pixels
   m_LEAD1.SetScaleMode(3);

   // Create the empty user bitmap.
   m_LEAD1.CreateUserBitmap(640, 480, 24, vEmpty, 0);

   long lDataSize = (640 * 480 * 24 / 8);

   SAFEARRAYBOUND rgsabound[1];
   rgsabound[0].lLbound = 0;
   rgsabound[0].cElements = lDataSize;

   SAFEARRAY *psa = SafeArrayCreate(VT_UI1, 1, rgsabound);

   if(psa)
   {
      SafeArrayLock(psa);

      for(int i = 0; i < lDataSize; i++)
         ((BYTE *)psa->pvData)[i] = 128; // gray

      SafeArrayUnlock(psa);

      COleVariant vBitmapData;

      V_VT(&vBitmapData) = (VT_ARRAY | VT_UI1);
      V_ARRAY(&vBitmapData) = psa;

      // set the bitmap data pointer
      m_LEAD1.SetBitmapDataPointer (vBitmapData, lDataSize);

      // save the bitmap
      m_LEAD1.Save("c:\\gray.jpg", FILE_JPEG, 0, 25, SAVE_OVERWRITE);

      // when I go out of scope, the variant will be freed, so
      //    my bitmap data pointer will be invalid.
      // I need to clear the bitmap data pointer
      m_LEAD1.SetBitmapDataPointer(vEmpty, 0);
   }
}

void CDataDlg::OnButton2()
{
   m_LEAD1.Load("c:\\gray.jpg", 0, 0, 1);
}


CreateThumbnailFromFile example for Visual C++ 4.0
CreateThumbnailFromFile example for C++ 4.0 and later

void COcxthumbDlg::OnButton1()
{
   m_LEADThumb1.SetLoadStamp(FALSE);
   m_LEADThumb1.SetForceSize(TRUE);
   m_LEADThumb1.SetThumbnailBackgroundColor(RGB(0,255,0));
   m_LEADThumb1.SetThumbnailWidth(80);
   m_LEADThumb1.SetThumbnailHeight(40);

   m_LEADThumb1.CreateThumbnailFromFile("c:\\temp\\testdb6.tif", 1);
   m_LEADThumb1.CreateThumbnailFromFile("c:\\temp\\testdb6.tif", 2);
   m_LEADThumb1.CreateThumbnailFromFile("c:\\temp\\testdb6.tif", 3);
}

void COcxthumbDlg::OnThumbnailEventLeadthumbctrl1(long Bitmap, LPCTSTR pszFilename, short nStatusCode, short nPercent)
{
   if( (nStatusCode == 0) &&
       (nPercent    == 0) &&
       (Bitmap      != 0) )
   {
      m_LEAD1.SetBitmap(Bitmap);
      AfxMessageBox("pause");
   }
}


CurveToBezier example for Visual C++ 4.0
CurveToBezier example for C++ 4.0 and later

   m_Lead1.SetCurveClose(CURVE_CLOSE);
   m_Lead1.SetCurveSize(4);
   m_Lead1.SetCurveX(0, 220);
   m_Lead1.SetCurveY(0, 10);
   m_Lead1.SetCurveX(1, 10);
   m_Lead1.SetCurveY(1, 30);
   m_Lead1.SetCurveX(2, 20);
   m_Lead1.SetCurveY(2, 240);
   m_Lead1.SetCurveX(3, 250);
   m_Lead1.SetCurveY(3, 260);
   m_Lead1.SetCurveTension(0.35f);
   m_Lead1.SetCurveType(CURVE_STANDAR);
   m_Lead1.SetRgnCurve(L_POLY_WINDING, L_RGN_SET);
   m_Lead1.SetRgnFrameType(RGNFRAME_ANIMATED);

   m_Lead1.CurveToBezier();

   POINT *p = new POINT[m_Lead1.GetBezierSize()];
   int i;
   for(i=0; i<m_Lead1.GetBezierSize(); ++i)
   {
      p[i].x = m_Lead1.GetBezierX(i);
      p[i].y = m_Lead1.GetBezierY(i);
   }
   CDC *cdc = GetDC();
   PolyBezier(cdc->GetSafeHdc(), p, m_Lead1.GetBezierSize());
   ReleaseDC(cdc);


dbCan... example for Visual C++ 4.0
dbCan... example for C++ 4.0 and later

This example displays property values in a message box. You can implement this example by adding a button, with this code, to the project described in Using ODBC to Access Image Data.

CString TempStr, InfoStr;

InfoStr.Format("dbCanAppend = %d\n", m_Lead1.GetDbCanAppend());
TempStr.Format("dbCanRestart = %d\n", m_Lead1.GetDbCanRestart());
InfoStr += TempStr;

TempStr.Format("dbCanScroll = %d\n", m_Lead1.GetDbCanScroll());
InfoStr += TempStr;

TempStr.Format("dbCanUpdate = %d\n", m_Lead1.GetDbCanUpdate());
InfoStr += TempStr;

TempStr.Format("dbEditMode = %d\n", m_Lead1.GetDbEditMode());
InfoStr += TempStr;

TempStr.Format("dbIsBOF = %d\n", m_Lead1.GetDbIsBOF());
InfoStr += TempStr;

TempStr.Format("dbIsEOF = %d\n", m_Lead1.GetDbIsEOF());
InfoStr += TempStr;

TempStr.Format("dbIsDeleted = %d\n", m_Lead1.GetDbIsDeleted());
InfoStr += TempStr;

TempStr.Format("dbIsOpen = %d\n", m_Lead1.GetDbIsOpen());
InfoStr += TempStr;

TempStr.Format("dbLoadBits = %d\n", m_Lead1.GetDbLoadBits());
InfoStr += TempStr;

TempStr.Format("dbLockingMode = %d\n", m_Lead1.GetDbLockingMode());
InfoStr += TempStr;

TempStr.Format("dbRecordCount = %d\n", m_Lead1.GetDbRecordCount());
InfoStr += TempStr;

TempStr.Format("dbCurrentRecord = %d (0 based)", m_Lead1.GetDbCurrentRecord());
InfoStr += TempStr;

MessageBox(InfoStr, "INFO");


DblClick (ImageList Control) example for C++ 4.0 and later

void CTttDlg::OnDblClickLeadimglistctrl1()
{
   AfxMessageBox("Control was Double-Clicked");
}


DblClick example for Visual C++ 4.0
DblClick example for C++ 4.0 and later

This example demonstrates the DblClick event.

void CTutorDlg::OnDblClickLead1()
{
  // TODO: Add your control notification handler code here
  m_Lead1.Flip(); //Just test the event
  m_Lead1.ForceRepaint();
}


DDB example for Visual C++ 4.0
DDB example for C++ 4.0 and later

This example copies the Lead1 bitmap to the clipboard as a DDB. It pastes the DDB into Lead2 and reverses the image. It then gets a DDB from Lead2, sets the same DDB to Lead1, and repaints.

BeginWaitCursor();
int MyFlags = COPY_EMPTY + COPY_DDB + COPY_PALETTE;
m_Lead1.Copy(MyFlags);
m_Lead2.Paste(0);
m_Lead2.Reverse();
OLE_HANDLE MyDC = m_Lead2.GetClientDC();
OLE_HANDLE MyDDB = m_Lead2.GetDDB(MyDC);
OLE_HANDLE MyPalette = m_Lead2.GetPalette(MyDC);
m_Lead1.SetDDB(MyDC, MyDDB, MyPalette);
m_Lead1.ForceRepaint();
m_Lead2.ReleaseClientDC();
DeleteObject((HBITMAP) MyDDB);
DeleteObject((HPALETTE) MyPalette);
EndWaitCursor();


DeleteBitmapListItems example for Visual C++ 4.0
DeleteBitmapListItems example for C++ 4.0 and later

This example deletes the first five bitmaps from the control's bitmap list. Then, it plays the animation to show that the bitmaps are missing.

//Delete the first five bitmaps.
m_Lead1.DeleteBitmapListItems(0, 5);

//Play the animation without looping.
m_Lead1.SetAnimationLoop(FALSE);
m_Lead1.SetAnimationEnable(TRUE);


DeletePage example for Visual C++ 4.0
DeletePage example for C++ 4.0 and later

// delete page 1 from TEST.TIF
m_Lead1.DeletePage("TEST.TIF", 1);


Deskew example for Visual C++ 4.0
Deskew example for C++ 4.0 and later

This example automatically straightens the bitmap and repaints the image. The image to be straightened should be mainly text.

m_LEAD1.Deskew(RGB(0,255,0));m_LEAD1.ForceRepaint();


Despeckle example for Visual C++ 4.0
Despeckle example for C++ 4.0 and later

This example automatically removes specks from the bitmap and repaints the image. Use this on a 1-bit bitmap such as a scanned document.

m_Lead1.Despeckle();
m_Lead1.ForceRepaint();


DIB example for Visual C++ 4.0
DIB example for C++ 4.0 and later

This example copies the Lead1 bitmap to the clipboard as a DIB. It pastes the DIB into Lead2 and reverses the image. It then gets a DIB from Lead2, sets the same DIB to Lead1, and repaints.

BeginWaitCursor();
int MyFlags = COPY_EMPTY + COPY_DIB + COPY_PALETTE;
m_Lead1.Copy(MyFlags);
m_Lead2.Paste(0);
m_Lead2.Reverse();
OLE_HANDLE MyDib = m_Lead2.GetDIB();
m_Lead1.SetDIB(MyDib);
m_Lead1.ForceRepaint();
GlobalFree((HGLOBAL) MyDib);
EndWaitCursor();


DocCleanBitmap example for Visual C++ 4.0
DocCleanBitmap example for C++ 4.0 and later

   short nRet;
   //Smooth
   //This example smooths all nicks and bumps up to 2 pixels in length
   //Long bumps/nicks are treated before short bumps/nicks
   //A LEAD region is updated to show all the changes
   //The Smooth Event is used to display information about bump or nick
   m_LEAD1.SetDocCleanSuccess(SUCCESS_REMOVE);
   nRet = m_LEAD1.Smooth(2, SMOOTH_SINGLE_REGION |
SMOOTH_LEAD_REGION | SMOOTH_FAVOR_LONG);
   if(nRet == 0)
   {
      m_LEAD1.FreeRgn();
      m_LEAD2.SetBitmap(m_LEAD1.GetDocCleanBitmap()); //copy the result so we can get the rgn handle
      m_LEAD1.SetRgnHandle(m_LEAD2.GetRgnHandle(), 0.0f, 0.0f, L_RGN_SET);
      m_LEAD2.SetBitmap(0); //no longer need copy
      m_LEAD1.SetDocCleanBitmap(0); //no longer need rgn either
      m_LEAD1.SetRgnFrameType(RGNFRAME_COLOR);
   }

void CDoccleanDlg::OnSmoothLeadctrl1(long nBumpOrNick, long nStartRow, long nStartCol, long nLength, long uHorV)
{
   CString szType;
   CString szHorV;
   CString szOut;
   if(nBumpOrNick == SMOOTH_BUMP)
      szType = "Bump";
   else
      szType = "Nick";

   if(uHorV == SMOOTH_HORIZONTAL_ELEMENT)
      szHorV = "Horz.";
   else
      szHorV = "Vert.";

   szOut.Format("Found %s at %d,%d Length=%d Type=%s\n", szType, nStartRow, nStartCol, nLength, szHorV);
   OutputDebugString(szOut);
}


DocCleanSuccess example for Visual C++ 4.0
DocCleanSuccess example for C++ 4.0 and later

   short nRet;
   //This example updates a region with 1x1 to 3x3 specks that are solid black
   //If a speck has any white pixels, it is NOT part of the updated region
   //The call is configured to update a single LEAD region corresponding to all changes
   //The image itself is unchanged
   //The DotRemove Event is used to display information about each speck that is removed
   nRet = m_LEAD1.DotRemove(DOT_USE_SIZE | DOT_SINGLE_REGION | DOT_LEAD_REGION | DOT_IMAGE_UNCHANGED, 1, 1, 3, 3);
   if(nRet == 0)
   {
      m_LEAD1.FreeRgn();
      m_LEAD2.SetBitmap(m_LEAD1.GetDocCleanBitmap()); //copy the result so we can get the rgn handle
      m_LEAD1.SetRgnHandle(m_LEAD2.GetRgnHandle(), 0.0f, 0.0f, L_RGN_SET);
      m_LEAD2.SetBitmap(0); //no longer need copy
      m_LEAD1.SetDocCleanBitmap(0); //no longer need rgn either
      m_LEAD1.SetRgnFrameType(RGNFRAME_COLOR);
   }

void CDoccleanDlg::OnDotRemoveLeadctrl1(long hRgn, float fBoundingRectLeft, float fBoundingRectTop, float fBoundingRectWidth, float fBoundingRectHeight, long iWhiteCount, long iBlackCount)
{
   long nRet;
   CString csOut;
   csOut.Format("Dot Fount at %d, %d, %d, %d, WhiteCount=%d BlackCount=%d\n",
                 (long)fBoundingRectLeft,
                 (long)fBoundingRectTop,
                 (long)fBoundingRectWidth,
                 (long)fBoundingRectHeight,
                 iWhiteCount,
                 iBlackCount);
   OutputDebugString(csOut);
   //Do not remove the speck if it contains any white pixels
   if(iWhiteCount > 0)
      nRet = SUCCESS_NOREMOVE;
   else
      nRet = SUCCESS_REMOVE;
   m_LEAD1.SetDocCleanSuccess(nRet);
}


DoubleBuffer example for C++

    m_LEAD1.SetDoubleBuffer(TRUE); // enable double buffer paint

    m_LEAD1.Load ("d:\\temp\\images\\golf.jpg", 0, 1, 1);


DrawShape example for Visual C++ 4.0
DrawShape example for C++ 4.0 and later

This example demonstrates most of the three-dimensional shape properties as it draws a rectangle on the current bitmap. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

m_Lead1.SetAutoRepaint(FALSE);

// Load an image for the main control
m_Lead1.Load("c:\\lead\\images\\image1.cmp", 0, 0, 1);

// Load an image for the background of the shape
m_Lead2.Load("ulay1.bmp", 0, 0, 1);

// Shape background
m_Lead1.SetShapeBackgroundStyle(EFX_BACKSTYLE_TILED_IMAGE);
m_Lead1.SetBackgroundImageTop(0);
m_Lead1.SetBackgroundImageLeft(0);
m_Lead1.SetBackgroundImageWidth(m_Lead2.GetBitmapWidth());
m_Lead1.SetBackgroundImageHeight(m_Lead2.GetBitmapHeight());

// Shape location
m_Lead1.SetShapeTop(50);
m_Lead1.SetShapeLeft(50);
m_Lead1.SetShapeWidth(m_Lead1.GetDstWidth() - 50);
m_Lead1.SetShapeHeight(m_Lead1.GetDstHeight() - 50);

// Shape border
m_Lead1.SetShapeBorderColor(RGB(255, 0, 0));
m_Lead1.SetShapeBorderStyle(EFX_BORDERSTYLE_SOLID);
m_Lead1.SetShapeBorderThickness(10);

m_Lead1.SetShapeInnerBandHiliteColor(RGB(255, 255, 255));
m_Lead1.SetShapeInnerBandShadowColor(0);
m_Lead1.SetShapeInnerBandStyle(EFX_INNERSTYLE_RAISED);
m_Lead1.SetShapeInnerBandThickness(2);

m_Lead1.SetShapeOuterBandHiliteColor(RGB(0, 255, 0));
m_Lead1.SetShapeOuterBandShadowColor(RGB(128, 128, 128));
m_Lead1.SetShapeOuterBandStyle(EFX_OUTERSTYLE_RAISED);
m_Lead1.SetShapeOuterBandThickness(2);

// Make the shape a permanent part of the bitmap
m_Lead1.SetDrawPersistence(TRUE);

// Draw the shape
m_Lead1.DrawShape(EFX_SHAPE_RECTANGLE, m_Lead2.GetBitmap());

// Repaint
m_Lead1.SetAutoRepaint(TRUE);


DrawText example for Visual C++ 4.0
DrawText example for C++ 4.0 and later

This example demonstrates most of the properties of a three-dimensional text object as it draws rotated text on the current bitmap.

m_Lead1.SetAutoRepaint(FALSE);

// Load an image for the main control
m_Lead1.Load("c:\\lead\\images\\image1.cmp", 0, 0, 1);

// Load an image for the foreground of the text
m_Lead2.Load("ulay1.bmp", 0, 0, 1);

// text location
m_Lead1.SetTextTop(50);
m_Lead1.SetTextLeft(50);
m_Lead1.SetTextWidth(m_Lead1.GetDstWidth() - 50);
m_Lead1.SetTextHeight(m_Lead1.GetDstHeight() - 50);

// The foreground image needs to be the correct size.
m_Lead2.Size(m_Lead1.GetTextWidth(), m_Lead1.GetTextHeight(), 0);

// Text alignment and angle
m_Lead1.SetTextAlign(EFX_TEXTALIGN_HCENTER_VCENTER);
m_Lead1.SetTextAngle(450);   // 45 degrees

// Text highlight color and style
m_Lead1.SetTextHiliteColor(RGB(255, 255, 255));
m_Lead1.SetTextStyle(EFX_TEXTSTYLE_DROPSHADOW);

// Text drop shadow
m_Lead1.SetShadowColor(RGB(0, 0, 0));
m_Lead1.SetShadowXDepth(5);
m_Lead1.SetShadowYDepth(5);

// Make the text a permanent part of the bitmap
m_Lead1.SetDrawPersistence(TRUE);

// Draw the text
m_Lead1.DrawText("LEADTOOLS", m_Lead2.GetBitmap());
m_Lead1.ForceRepaint();


Dst... example for Visual C++ 4.0
Dst... example for C++ 4.0 and later

This example uses the destination rectangle properties to zoom in on an image.

// Calculate the values to zoom in by 10 percent and center the image.
m_Lead1.SetDstWidth(m_Lead1.GetDstWidth() * 1.1f);
m_Lead1.SetDstHeight(m_Lead1.GetDstHeight() * 1.1f);
m_Lead1.SetDstTop((m_Lead1.GetScaleHeight() - m_Lead1.GetDstHeight()) / 2);
m_Lead1.SetDstLeft((m_Lead1.GetScaleWidth() - m_Lead1.GetDstWidth()) / 2);
// Set the clipping area to the same as the destination rectangle
m_Lead1.SetDstClipWidth(m_Lead1.GetDstWidth());
m_Lead1.SetDstClipHeight(m_Lead1.GetDstHeight());
m_Lead1.SetDstClipTop(m_Lead1.GetDstTop());
m_Lead1.SetDstClipLeft(m_Lead1.GetDstLeft());
// Redisplay the image
m_Lead1.ForceRepaint();


EdgeDetector example for C++ 5.0 and later

   m_Lead1.EdgeDetector(60, EDG_SOBEL_ALL);


Emboss example for Visual C++ 4.0
Emboss example for C++ 4.0 and later

This example applies an emboss effect and repaints the image.

m_Lead1.Emboss(EMBOSS_NE, 500);
m_Lead1.ForceRepaint();


EnableFastRender (Main Control) example for C++ 4.0 and later

   long hdcPrinter;
   m_LEAD1.Load("c:\\Wizard4.jpg", 0, 0, 1);
   m_LEAD1.SetEnableFastRender(TRUE);
   hdcPrinter = m_LEAD1.PrintStart();
   m_LEAD1.Render(hdcPrinter, 0, 0, 0, 0);
   m_LEAD1.PrintEnd(hdcPrinter);

   m_LEAD1.SetEnableFastRender(FALSE);


EnableKeyboard (ImageList Control) example for C++ 4.0 and later

   //disable keyboard processing
   m_LEADImgList1.SetEnableKeyboard(FALSE);


EnableMethodErrors (ImageList Control) example for C++ 4.0 and later

//disable method errors
m_LEADImgList1.SetEnableMethodErrors(FALSE);


EnableMethodErrors example for Visual C++ 4.0
EnableMethodErrors example for C++ 4.0 and later

This example disables method errors temporarily so that it can give the user guidance about a particular error (an out-of-range shear angle in this case).

int ShearAngle = 9000; // This would be the user's input * 100
m_Lead1.SetEnableMethodErrors(FALSE);
int nRet = m_Lead1.Shear(ShearAngle, TRUE, RGB(0, 0, 255));
if (nRet == 20013)
{
   CString cMsg("The angle cannot be more than 45 degrees");
   MessageBox(cMsg, "Error");
}
else
{
   m_Lead1.ForceRepaint();
}
m_Lead1.SetEnableMethodErrors(TRUE);


EnableMethodErrors (Thumbnail Browser Control) example for C++ 4.0 and later

//disable method errors
m_LEADThumb1.SetEnableMethodErrors(FALSE);


EnablePaint example for Visual C++ 4.0
EnablePaint example for C++ 4.0 and later

   // disable the paint
   m_Lead1.SetEnablePaint(FALSE);
   // do whatever changes you want. The control will not repaint
   m_Lead1.Size(m_Lead1.GetBitmapWidth() * 2, m_Lead1.GetBitmapHeight() * 2, RESIZE_BICUBIC);
   // re-enable the paint
   m_Lead1.SetEnablePaint(TRUE);
   // call ForceRepaint because the control will not automatically repaint
   m_Lead1.ForceRepaint();


EnableZoomInRect example for Visual C++ 4.0
EnableZoomInRect example for C++ 4.0 and later

This example toggles the EnableZoomInRect property.

// Toggle the ZoomInRect setting
           if (m_Lead1.GetEnableZoomInRect() == TRUE)
               m_Lead1.SetEnableZoomInRect(FALSE);
           else
               m_Lead1.SetEnableZoomInRect(TRUE);


EnumSegments (Mixed Raster Content Control)example for Visual C++ 4.0
EnumSegments (Mixed Raster Content Control) example for C++ 4.0 and later

void CT44TestDlg::OnEnumSegmentsLeadmrcctrl1(long nSegId, long SegmentLeft, long SegmentTop, long SegmentRight, long SegmentBottom, long SegType, long TextForeColor, long TextBackColor)
{
   m_Lead1.SetDrawFillStyle(DRAWFILLSTYLE_DIAGONAL_CROSS);
   m_Lead1.SetDrawPenWidth(6);
   m_Lead1.SetDrawPenColor(RGB(0, 255, 255));
   if(SegType == SEGMENT_PICTURE)
      m_Lead1.SetDrawFillColor(RGB(0, 255, 0));
   else
      m_Lead1.SetDrawFillColor(RGB(255, 0, 0));
   m_Lead1.DrawRectangle((float)SegmentLeft, (float)SegmentTop, (float) (SegmentRight - SegmentLeft), (float)(SegmentBottom - SegmentTop));
}

void CT44TestDlg::OnEnumSeg()
{
   m_LeadMrc1.EnumSegments();
   SetWindowText("Picture segments will be green-hashed");
}


RasterizeViewMode example for Visual C++ 4.0
RasterizeViewMode example for C++ 4.0 and later

void CTwoDOptionsDlg::OnTest()
{

   /* This example will set current viewport mode to L2D_USE_WIDTH_AND_HEIGHT,
      sets the current viewport size to 400*400 pixels and then loads a DXF file */

   /* Set viewport mode to L2D_USE_WIDTH_HEIGHT */
   m_Lead.SetRasterizeViewMode (L2D_USE_WIDTH_HEIGHT);
   /*  Set viewport size to 400*400 pixels */
   m_Lead.SetRasterizeViewportWidth(400);
   m_Lead.SetRasterizeViewportHeight(400);
   /* Load a DXF file */
   m_Lead.Load ("c:\\Test.dxf", 0, 0, 1);

}


RawLoad example for C++ 4.0 and later

//This example loads RAW data into a LEAD control.
//Raw data parameters are set in the LoadInfo event, which gets called
//when the file format is FILE_RAW, or any unrecognized file format.
//The LoadInfo event obtains information through class variables.

//class variables used in the LoadInfo event
//   int nWidth;                //width of image
//   int nHeight;               //height of image
//   int nBitsPerPixel;         //bits per pixel of image--if palettized, a gray palette is generated
//   int nViewPerspective;      //view perspective of raw data (TOP_LEFT, BOTTOM_LEFT, etc)
//   int bOrderBGR;             //TRUE if order BGR, FALSE if order RGB
//   unsigned long nOffset;     //offset into file where raw data begins
//   int bPadding;              //TRUE if each line of data is padded to four bytes
//   int bReverseBits;          //TRUE if the bits of each byte are reversed

void CRawDlg::RawLoad(char * pszFileName)
{
   int nRet;
   char szMsg[200];

   //Fill in the class variables
   //The class variables will get access in the LoadInfo event
   nWidth = 294;
   nHeight = 415;
   nBitsPerPixel = 24;
   nViewPerspective = BOTTOM_LEFT;
   bOrderBGR = TRUE;
   nOffset = 250;
   bPadding = TRUE;
   bReverseBits = TRUE;

   nRet = m_Lead.Load(pszFileName, nBitsPerPixel, 0, 1);
   if (nRet == 0)
      wsprintf(szMsg, "SUCCESS file load: %s", pszFileName);
   else
      wsprintf(szMsg, "FAILED--file load: %s", pszFileName);
   AfxMessageBox(szMsg);
}

void CRawDlg::OnLoadInfoLeadctrl1()
{
   unsigned int uColors, i;
   unsigned int uGray;
   unsigned int uFlags;

   m_Lead.SetScaleMode(3);
   m_Lead.SetLoadInfoFormat(FILE_RAW);
   m_Lead.SetLoadInfoWidth((float)nWidth);
   m_Lead.SetLoadInfoHeight((float)nHeight);
   m_Lead.SetLoadInfoBits(nBitsPerPixel);
   m_Lead.SetLoadInfoXRes(150);
   m_Lead.SetLoadInfoYRes(150);
   m_Lead.SetLoadInfoOffset(nOffset);
   uFlags = 0;

   if (bPadding)
      uFlags |= LOADINFO_PAD4;

   if (bOrderBGR == FALSE)
      uFlags |= LOADINFO_ORDERRGB;

   if (bReverseBits)
      uFlags |=  LOADINFO_LSB;

   switch(nViewPerspective)
   {
   case TOP_LEFT:
      uFlags |= LOADINFO_TOPLEFT;
      break;

   case BOTTOM_LEFT:
      uFlags |= LOADINFO_REVERSE;
      break;

   case TOP_RIGHT: //BOTTOM_LEFT180
      uFlags |= LOADINFO_BOTTOMLEFT180;
      break;

   case BOTTOM_RIGHT: //TOP_LEFT180
      uFlags |= LOADINFO_TOPLEFT180;
      break;

   case RIGHT_TOP:   //TOP_LEFT90
      uFlags |= LOADINFO_TOPLEFT90;
      break;

   case LEFT_BOTTOM: //TOP_LEFT270
      uFlags |= LOADINFO_TOPLEFT270;
      break;

   case LEFT_TOP:   //BOTTOM_LEFT90
      uFlags |= LOADINFO_BOTTOMLEFT90;
      break;

   case RIGHT_BOTTOM:    //BOTTOM_LEFT270
      uFlags |= LOADINFO_BOTTOMLEFT270;
      break;
   }

   //if image is palettized create a grayscale palette
   if (nBitsPerPixel <= 8)
   {
      uColors = 1 << nBitsPerPixel;
      uFlags |= LOADINFO_PALETTE;

      for (i=0; i<uColors; i++)
      {
         uGray = (i * 256) / uColors;
         m_Lead.SetUserPalette(i, RGB(uGray, uGray, uGray));
      }
   }
   m_Lead.SetLoadInfoFlags(uFlags);
}


RawSave example for C++ 4.0 and later

//This example saves a LEAD BITMAPHANDLE as RAW data starting at offset uOffset.
//The data is padded so that each line of bytes is evenly divided by 4.
//The bits in each byte are reversed before saving.
//The bits per pixel of the raw data is the same as the bits per pixel LEAD1.
//If LEAD1 is a palettized image, the palette is not saved--only the raw data.

void CRawDlg::RawSave(char * pszFileName, unsigned long uOffset)
{
   int nRet;
   char szMsg[200];
   m_Lead.SetSaveLSB(TRUE);
   m_Lead.SetSavePad4(TRUE);
   nRet = m_Lead.SaveOffset(pszFileName, uOffset, FILE_RAW, 0, 0, 0);
   if (nRet == 0)
      wsprintf(szMsg, "SUCCESS file save: %s  Size[%d]", pszFileName, m_Lead.GetFileSizeWritten());
   else
      wsprintf(szMsg, "FAILED file save: %s", pszFileName);
   AfxMessageBox(szMsg);

}


ReadLoadResolutions Example for Visual C++ 4.0
ReadLoadResolutions Example for C++ 4.0 and later

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

CString TempStr, InfoStr; // For composing message strings
int LoadResolutionCount;       // Number of resolutions available

// Initialize the display
m_Lead1.SetAutoScroll(FALSE);
m_Lead1.SetAutoSetRects(TRUE);
m_Lead1.SetPaintSizeMode(PAINTSIZEMODE_FIT);
m_Lead1.GetFileInfo("v:\\images\\image5.fpx", 0, 0 );

// Update information about the available resolutions.
m_Lead1.ReadLoadResolutions("v:\\images\\image5.fpx");

// Update a local variable with the number of resolutions.
LoadResolutionCount = m_Lead1.GetLoadResolutionCount();

// Display a message box that shows the available sizes.
InfoStr = "Available dimensions:\n";

for(int i = 0; i < LoadResolutionCount; ++i)
{
   TempStr.Format("%d X %d\n", (int)m_Lead1.GetLoadResolutionWidth(i),
      (int)m_Lead1.GetLoadResolutionHeight(i) );
   InfoStr += TempStr;
}
MessageBox( InfoStr, "File Information" );

// Set the size to load, the smallest size in this case.
m_Lead1.SetLoadResolution(m_Lead1.GetInfoFormat(),
   m_Lead1.GetLoadResolutionWidth(0), m_Lead1.GetLoadResolutionHeight(0));

// Get the dimensions that we just set and display them.
m_Lead1.GetLoadResolution(m_Lead1.GetInfoFormat());

InfoStr = "Size that will be loaded:\n\n";
TempStr.Format("%d X %d\n", (int)m_Lead1.GetLoadResolutionWidth(0),
   (int)m_Lead1.GetLoadResolutionHeight(0) );
InfoStr += TempStr;
MessageBox(InfoStr, "File Information" );

// Load the bitmap, keeping the bits per pixel of the file.
m_Lead1.Load("v:\\images\\image5.fpx", 0, 0, 1);


Exif example for Visual C++ 4.0
Exif example for C++ 4.0 and later

This example does the following:

1.	Reads all of the comments in an existing Exif file, updating the Comment array.

2.	Loads and modifies the file's image.

3.	Updates some of the comments in the comment array.

4.	Saves the file.

5.	Reads and displays the updated comments.

Note: Comments for GIF, TIFF, and DICOM files are simpler than the ones in this Exif example. With those file types, all of the comments are strings that you can get and set with simple assignments.

// Array index for general use.
long MyIndex;

// Value for clearing comments.
COleVariant Empty = COleVariant();

// File that we will load and update.
CString FilePath = "d:\\lead\\images\\exif1.tif";

// Get all of the current comments from an Exif file.
// Temporarily disable errors so that we do not fail when comments are missing.
m_Lead1.SetEnableMethodErrors(FALSE);
for(short i = 0; i <= CMNT_LAST; ++i)
{
  m_Lead1.SetComment(i, Empty);
  m_Lead1.SetComment(i, m_Lead1.ReadComment(FilePath, 0, i));
}
m_Lead1.SetEnableMethodErrors(TRUE);

// Load and modify the image.
m_Lead1.Load(FilePath, 0, 0, 1);
m_Lead1.Reverse();

// Update the date when the file is generated.
CTime RightNow = CTime::GetCurrentTime();
CString DateTimeString = RightNow.Format("%Y:%m:%d %H:%M:%S");
m_Lead1.SetComment(CMNT_SZDATETIMEDIGITIZED, COleVariant(DateTimeString));
m_Lead1.SetComment(CMNT_SZSUBSECTIMEDIGITIZED, Empty);

// Change the CMNT_SUBJECTDISTANCE comment to 4 1/3 meters.

// Create a SAFEARRAY that contains the RATIONAL values.
COleSafeArray ASubjectDistance;
ASubjectDistance.CreateOneDim( VT_I4, 2, NULL, 0 );
long SaveNumerator = 13;
long SaveDenominator = 3;
MyIndex = 0;
ASubjectDistance.PutElement( &MyIndex, &SaveNumerator );
MyIndex = 1;
ASubjectDistance.PutElement( &MyIndex, &SaveDenominator );

// Update the CMNT_SUBJECTDISTANCE comment.
m_Lead1.SetComment(CMNT_SUBJECTDISTANCE, ASubjectDistance);

// Add an ASCII CMNT_USERCOMMENT comment.

// Specify the user comment string.
CString MyCommentText = "This is my new comment.";
int MyCommentSize = 8 + MyCommentText.GetLength();

// Define the array for the user comment.
CByteArray MyComment;
MyComment.SetSize(MyCommentSize + 1);

// Fill in the ASCII prefix.
MyComment[0] = 'A';
MyComment[1] = 'S';
MyComment[2] = 'C';
MyComment[3] = 'I';
MyComment[4] = 'I';
MyComment[5] = '\0';
MyComment[6] = '\0';
MyComment[7] = '\0';

// Fill in the rest of the CMNT_USERCOMMENT comment.
for( i = 8; i < MyCommentSize; ++i)
{
  MyComment[i] = MyCommentText[i-8];
}
MyComment[MyCommentSize] = '\0';

// Update the CMNT_USERCOMMENT comment.
m_Lead1.SetComment(CMNT_USERCOMMENT, Empty);
m_Lead1.SetComment(CMNT_USERCOMMENT, COleVariant(MyComment));

// Save the file.
m_Lead1.Save(FilePath, FILE_EXIF, 24, 0, SAVE_OVERWRITE);

// Read the comments that we saved.
VARIANT V1 = m_Lead1.ReadComment(FilePath, 0, CMNT_SZDATETIMEDIGITIZED);
COleVariant VDateTimeString;
VDateTimeString.Attach(V1);

VARIANT V2 = m_Lead1.ReadComment(FilePath, 0, CMNT_SUBJECTDISTANCE);
COleVariant VSubjectDistance;
VSubjectDistance.Attach(V2);

VARIANT V3 = m_Lead1.ReadComment(FilePath, 0, CMNT_USERCOMMENT);
COleVariant VMyComment;
VMyComment.Attach(V3);

// Interpret the CMNT_SUBJECTDISTANCE RATIONAL.
long MyNumerator, MyDenominator;
MyIndex = 0;
SafeArrayGetElement(VSubjectDistance.parray, &MyIndex, &MyNumerator);
MyIndex = 1;
SafeArrayGetElement(VSubjectDistance.parray, &MyIndex, &MyDenominator);

// Format the Subject Distance as a string.
CString DistanceString;
DistanceString.Format("%f", (double)MyNumerator / MyDenominator);

// Format the CMNT_SZDATETIMEDIGITIZED comment as a string.
CString NewDateTime =  CString(VDateTimeString.bstrVal);

// Initialize the string for the message box.
CString MyMsg = "Subject Distance = " + DistanceString + "\nDate/Time = " + NewDateTime;

// Add the ASCII comment to the message, if the comment is there.
MyIndex = 0;
char OneCharacter;
SafeArrayGetElement(VMyComment.parray, &MyIndex, &OneCharacter);

if( OneCharacter == 'A')
{
   MyMsg = MyMsg + "\n\n";
   long ArraySize, LowerBound, UpperBound;
   SafeArrayGetLBound(VMyComment.parray, 1, &LowerBound);
   SafeArrayGetUBound(VMyComment.parray, 1, &UpperBound);
   ArraySize = UpperBound - LowerBound;
   for ( MyIndex = 8; MyIndex <= ArraySize; MyIndex++)
   {
      SafeArrayGetElement(VMyComment.parray, &MyIndex, &OneCharacter);
      MyMsg = MyMsg + CString(OneCharacter);
   }
}

// Display the message.
MessageBox(MyMsg);

// Clear the comments from memory
for( i = 0; i <= CMNT_LAST; ++i)
  m_Lead1.SetComment(i, Empty);


FastRotate example for Visual C++ 4.0
FastRotate example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example uses fast rotation to rotate an image 90 degrees:

m_Lead1.FastRotate (90);


FeatherAlphaBlend example for C++ 5.0 and later

   m_Lead2.CreateBitmap (800, 600, 24);
   m_Lead2.SetRgnRoundRect(50, 50, 500, 500, 150, 150, L_RGN_SET);
   m_Lead3.CreateFadedMask(m_Lead2.GetBitmap(), 60, 20, 3, 0, FADE_DUMPFILL + FADE_NOTRANSPARENCY, 255, RGB(0, 0, 255));
   m_Lead2.Load("c:\\temp\\test.cmp", 0, 1, 1);
   m_Lead1.FeatherAlphaBlend(0, 0, m_Lead3.GetBitmapWidth(), m_Lead3.GetBitmapHeight(), m_Lead2.GetBitmap(), 0, 0, m_Lead3.GetBitmap());


FeedLoad example for Visual C++ 4.0
FeedLoad example for C++ 4.0 and later

This example uses StartFeedLoad, FeedLoad, and StopFeedLoad and loads a file through a buffer to simulate receiving a transmitted image.

#define BUFFERSIZE 1000

void CTutorDlg::OnFeedload()
{
   VARIANT     variant;
   SAFEARRAY   *ptrsafearray;
   SAFEARRAYBOUND    arraybound;
   LPSTR       lp;   /* pointer to the data */

   /* Set up the VARIANT and the SAFEARRAY structures */
   arraybound.cElements = BUFFERSIZE;  /* 1000 bytes at a  time */
   arraybound.lLbound = 0;

   ptrsafearray = SafeArrayCreate( VT_UI1, 1, &arraybound );
   SafeArrayLock( ptrsafearray );
   lp = (LPSTR)ptrsafearray->pvData;    /* get a pointer to the buffer */

   V_VT(&variant) = VT_ARRAY | VT_UI1;
   V_ARRAY(&variant) = ptrsafearray;

   /* Now we have a variant and we can do the real work */
   HFILE    hf;
   int      bytesread;
   OFSTRUCT of;

   if( (hf = OpenFile("v:\\images\\eagle.cmp", &of, OF_READ)) == HFILE_ERROR)
   {
      SafeArrayUnlock( ptrsafearray );
      SafeArrayDestroy( ptrsafearray );
      MessageBox( "Error opening file !" );
      return;
   }

   if( m_Lead.StartFeedLoad( 0, 0, 1 ) ) /* default bits per pixel and first page */ {
      SafeArrayUnlock( ptrsafearray );
      SafeArrayDestroy( ptrsafearray );
      _lclose( hf );
      MessageBox( "Error in StartFeedLoad !" );
      return;
   }

   do
   {
      bytesread = (int)_hread( hf, lp, BUFFERSIZE );
      if( m_Lead.FeedLoad( variant, bytesread ) )
      {
         SafeArrayUnlock( ptrsafearray );
         SafeArrayDestroy( ptrsafearray );
         _lclose( hf );
         MessageBox( "Error in FeedLoad !" );
         return;
      }
   } while (bytesread > 0);

   if( m_Lead.StopFeedLoad() )
   {
      SafeArrayUnlock( ptrsafearray );
      SafeArrayDestroy( ptrsafearray );
      _lclose( hf );
      MessageBox( "Error in StopFeedLoad !" );
      return;
   }

   SafeArrayUnlock( ptrsafearray );
   SafeArrayDestroy( ptrsafearray );
}


FileOpen Example for Visual C++ 4.0
FileOpen Example for C++ 4.0 and later

void CBsDlg::OnButton1()
{
   m_LEADDlg1.SetFileDlgFlags(0);
   m_LEADDlg1.SetDialogTitle("Open A File");
   m_LEADDlg1.SetPreviewEnabled(TRUE);
   m_LEADDlg1.SetFilter("All |*.*|CMP|*.cmp|JPEG|*.jpg");
   m_LEADDlg1.SetFilterIndex(2); //look for *.cmp first
   m_LEADDlg1.SetInitialDir("f:\\images\\");
   m_LEADDlg1.SetLoadPasses(0);
   m_LEADDlg1.SetLoadRotated(TRUE);
   m_LEADDlg1.SetLoadCompressed(COMP_NONE);
   m_LEADDlg1.SetBitmap(0); //free any existing bitmap reference
   m_LEADDlg1.SetUIFlags( DLG_FO_AUTOPROCESS |
                          DLG_FO_PROGRESSIVE |
                          DLG_FO_MULTIPAGE |
                          DLG_FO_LOADROTATED |
                          DLG_FO_LOADCOMPRESSED |
                          DLG_FO_FILEINFO |
                          DLG_FO_SHOWSTAMP |
                          DLG_FO_SHOWPREVIEW );
   m_LEADDlg1.FileOpen((long)this->m_hWnd);
   //output the results
   m_LEAD1.SetRefBitmap (TRUE); //don't make a copy
   m_LEAD1.SetBitmap (m_LEADDlg1.GetBitmap()); //send the image to LEAD OCX
   m_LEAD1.SetRefBitmap (FALSE); //reset

   m_LEAD2.SetBitmap (0);
   m_LEAD2.SetBitmap(m_LEADDlg1.GetThumbnail()); //copy thumbnail image to m_LEAD2 OCX

   CString csRes;
   csRes.Format("%s\n%d\n%d\n%d\n%d\n",
                 m_LEADDlg1.GetFileName(),
                 m_LEADDlg1.GetPageNumber(),
                 m_LEADDlg1.GetLoadCompressed(),
                 m_LEADDlg1.GetLoadRotated(),
                 m_LEADDlg1.GetLoadPasses() );
   AfxMessageBox(csRes);
}


FilePage Event Example for Visual C++ 4.0
FilePage Event Example for C++ 4.0 and later

This example shows how the FilePage event can be used to size and position a lead control when an image is loaded.

void CTutorDlg::OnFilePageLead1()
{
   float HeightFactor, WidthFactor;    // Factors for aspect ratio
   float HeightAllowed, WidthAllowed;  // Maximum width and height
   float Width, Height, Left, Top;     // Variables for control dimensions

   /**********************************************/
   // Set the variables used for preserving the aspect ratio.
   // Allow for a border of 1/8 of the form size.
   // The units of measure do not matter, since we are calculating proportions.
   HeightFactor = m_Lead1.GetInfoHeight();
   WidthFactor = m_Lead1.GetInfoWidth();
   CRect rcWindow;
   GetClientRect(rcWindow);
   HeightAllowed = rcWindow.Height() * 3.0f / 4;
   WidthAllowed = rcWindow.Width() * 3.0f / 4;

   // Center the LEAD control on the form, preserving the aspect ratio.
   // Check to see if using the maximum width will make the image too tall.
   // Set the dimensions based on the result.
   if(((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed)
   {
     Left = rcWindow.Width() / 8.0f;
     Width = WidthAllowed;
     Height = (Width * HeightFactor) / WidthFactor;
     Top = (rcWindow.Height() - Height) / 2;
   }
   else
   {
     Top = rcWindow.Height() / 8.0f;
     Height = HeightAllowed;
     Width = (Height * WidthFactor) / HeightFactor;
     Left = (rcWindow.Width() - Width) / 2;
   }
   rcWindow.SetRect(0, 0, (int) Width, (int) Height);
   rcWindow.OffsetRect((int) Left, (int) Top);
   m_Lead1.MoveWindow(rcWindow);

   // Turn off scroll bars to make sure we use the full client area.
   m_Lead1.SetAutoScroll(FALSE);

   // Set the image display size to match the LEAD control
   m_Lead1.SetDstRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
   m_Lead1.SetDstClipRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
}


FilePageLoaded example for Visual C++ 4.0
FilePageLoaded example for C++ 4.0 and later

//  The following example loads the first five pages of a multipage file,
//  and writes the individual pages as TIF files
//  m_nCount is an integer member varaiable of the class

void CGetArrayInfoDlg::OnFilePageLoadedLeadctrl1()
{
   CString  strFileName;
   m_nCount++;
   strFileName.Format("d:\\erase\\mpage%d.TIF", m_nCount);
   m_LEAD1.Save(strFileName, FILE_TIF, 0, 0, SAVE_OVERWRITE);
}

void CGetArrayInfoDlg::OnFilePageLoaded()
{
   m_nCount = 0;
   m_LEAD1.SetEnableFilePageLoadedEvent(TRUE);
   m_LEAD1.Load("d:\\work\\images\\mtif.tif", 0, 0, 5);
   m_LEAD1.SetEnableFilePageLoadedEvent(FALSE);
}


Fill example for Visual C++ 4.0
Fill example for C++ 4.0 and later

This example fills the bitmap with blue and repaints the image.

m_Lead1.Fill(RGB(0, 0, 255));
m_Lead1.ForceRepaint();


Flip example for Visual C++ 4.0
Flip example for C++ 4.0 and later

This example flips the bitmap and repaints the image.

m_Lead1.Flip();
m_Lead1.ForceRepaint();


FloaterDstClip... example for Visual C++ 4.0
FloaterDstClip... example for C++ 4.0 and later

The following code adjusts the destination clipping rectangle of the floater. You can test it by adding it to a new command button for the lesson described in Outlining, Dragging, and Pasting a Region. By default, the destination clipping rectangle for the floater is the full client area. This code gets the current values and uses them to reduce the size of the clipping rectangle.

// Declare local variables.
float AdjustX, AdjustY, NewLeft, NewTop, NewWidth, NewHeight;

// Set variables to use for adjustment increments.
AdjustX = m_Lead1.GetScaleWidth() / 20;
AdjustY = m_Lead1.GetScaleHeight() / 20;

// Determine new values, based on adjustments of current values.
NewLeft = m_Lead1.GetFloaterDstClipLeft() + AdjustX;
NewTop = m_Lead1.GetFloaterDstClipTop() + AdjustY;
NewWidth = m_Lead1.GetFloaterDstClipWidth() - (2 * NewLeft);
NewHeight = m_Lead1.GetFloaterDstClipHeight() - (2 * NewTop);

// Set the clipping rectangle to the new values.
m_Lead1.SetFloaterDstClipRect(NewLeft, NewTop, NewWidth, NewHeight);


Font (ImageList Control) example for C++ 4.0 and later

//change the font properties
   COleFont myFont = m_LEADImgList1.GetFont();
   if(myFont.GetBold)
       myFont.SetBold(FALSE);
   else
       myFont.SetBold(TRUE);

   CY size = myFont.GetSize();
   size.Hi = 0;
   size.Lo = 10*10000L; //10 point
   myFont.SetSize(size);
   myFont.SetName("Arial");


Font example for Visual C++ 4.0
Font example for C++ 4.0 and later

This example, in a MouseUp event, determines the size of a rectangle for a string in the specified font. It then draws the rectangle and draws the text on top of the rectangle. The header file must have the following statement: #include "font.h".

void CDrawtestDlg::OnMouseUpLeadctrl1(short Button, short Shift, long x, long y)
{
   float TextWidth;
   float TextHeight;

   // Specify the font, and styles.
   COleFont myFont = m_Lead1.GetFont();
   myFont.SetName("Times New Roman");

   CY size = myFont.GetSize();
   size.Hi = 0;             // Hi will be 0 unless you use a really big font
   size.Lo = 32L * 10000L;  // 32 point
   myFont.SetSize(size);
   m_Lead1.SetDrawFontColor(RGB(0, 0, 255)); //Blue
   m_Lead1.SetTextStyle(EFX_TEXTSTYLE_NORMAL);
   m_Lead1.SetTextAlign(EFX_TEXTALIGN_HCENTER_VCENTER);

   // Get the width and height of the text to be drawn.
   TextWidth = m_Lead1.DrawTextWidth("This is my text.");
   TextHeight = m_Lead1.DrawTextHeight("This is my text.");

   // Set the location for the text
   m_Lead1.SetTextTop(y);
   m_Lead1.SetTextLeft(x);
   m_Lead1.SetTextWidth(TextWidth);
   m_Lead1.SetTextHeight(TextHeight);

   // Set the properties for drawing a rectangle behind the text.
   m_Lead1.SetDrawPenStyle(DRAWPENSTYLE_SOLID);
   m_Lead1.SetDrawMode(DRAWMODE_COPY_PEN);
   m_Lead1.SetDrawFillColor(RGB(0, 255, 0)); //Green

   // Draw on the screen, not on the bitmap.
   m_Lead1.SetDrawPersistence(FALSE);

   // Draw the rectangle, then draw the text.
   m_Lead1.DrawRectangle(x, y, TextWidth, TextHeight);
   m_Lead1.DrawText("This is my text.", 0);
}


ForeColor (ImageList Control) example for C++ 4.0 and later

   //set text color to green
   m_LEADImgList1.SetForeColor(RGB(0, 255, 0));


Frame... example for Visual C++ 4.0
Frame... example for C++ 4.0 and later

This example sets the control's frame properties. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

m_Lead1.SetAutoRepaint(FALSE);
m_Lead1.SetFrameThickness(2);
m_Lead1.SetFrameColor(RGB(0, 0, 0));
m_Lead1.SetFrameInnerStyle(EFX_INNERSTYLE_INSET);
m_Lead1.SetFrameOuterStyle(EFX_OUTERSTYLE_RAISED);
m_Lead1.SetFrameInnerHiliteColor(RGB(255, 255, 0));   // Yellow
m_Lead1.SetFrameInnerShadowColor(RGB(128, 128, 128)); // Dark Gray
m_Lead1.SetFrameOuterHiliteColor(RGB(255, 0, 0));     // Red
m_Lead1.SetFrameOuterShadowColor(RGB(192, 192, 192)); // Light Gray
m_Lead1.SetFrameInnerThickness (3);
m_Lead1.SetFrameOuterThickness (3);
m_Lead1.SetAutoRepaint(TRUE);


GammaCorrect example for Visual C++ 4.0
GammaCorrect example for C++ 4.0 and later

This example applies a 2.2 gamma correction and repaints the image.

m_Lead1.GammaCorrect(220);
m_Lead1.ForceRepaint();


GaussianFilter example for C++ 5.0 and later

   m_Lead1.GaussianFilter(20);


GetArrayInfo example for C++ 5.0 and later

// This example
// 1. loads a file into a memory buffer
// 2. Calls GetInfoMemory
// 3. Displays information about the file in memory

void CGetArrayInfoDlg::OnButton1()
{
   CString strFormat;
   int nWidth;
   int nHeight;
   int nBpp;
   int nPage;
   long nSizeDisk;
   long nSizeMem;
   CString strCompress;
   int nFormat;
   CString strMsg;
   int nTotalPages;
   int xRes, yRes;
   COleVariant MyVar;
   long lSize;

   // Create the memory file
   HFILE hFile;
   HGLOBAL hData=NULL;
   void FAR* pData=NULL;
   SAFEARRAY FAR *psa;
   SAFEARRAYBOUND rgsabound[1];

   MyVar.Clear();

   hFile = _lopen("d:\\work\\images\\mtif.tif", OF_READ);
   lSize = _llseek(hFile, 0, SEEK_END);
   _llseek(hFile, 0, SEEK_SET);
   hData = GlobalAlloc(GMEM_MOVEABLE, lSize);
   pData = GlobalLock(hData);

   _lread(hFile, pData, lSize);

   rgsabound[0].lLbound = 0;
   rgsabound[0].cElements = lSize;
   psa = SafeArrayCreate(VT_UI1, 1, rgsabound);

   SafeArrayLock(psa);
   memcpy(psa->pvData, pData, lSize);
   SafeArrayUnlock(psa);

   V_VT(&MyVar) = (VT_ARRAY | VT_UI1);
   V_ARRAY(&MyVar) = psa;

   GlobalUnlock(hData);
   GlobalFree(hData);

   m_LEAD1.GetArrayInfo(MyVar, 1, lSize, FILEINFO_TOTALPAGES);

   // Read the updated properties
   nFormat = m_LEAD1.GetInfoFormat();
   nWidth = (int)m_LEAD1.GetInfoWidth();
   nHeight = (int)m_LEAD1.GetInfoHeight();
   nBpp = m_LEAD1.GetInfoBits();
   nPage = m_LEAD1.GetInfoPage();
   nSizeDisk = m_LEAD1.GetInfoSizeDisk();
   nSizeMem = m_LEAD1.GetInfoSizeMem();
   strCompress = m_LEAD1.GetInfoCompress();
   xRes = m_LEAD1.GetInfoXRes();
   yRes = m_LEAD1.GetInfoYRes();
   nTotalPages = m_LEAD1.GetInfoTotalPages();

   // Translate the meaning of the format constant
   strFormat = "Unknown format";
   switch( nFormat)
   {
   case FILE_TIF:
      strFormat = "TIF";
      break;

   case FILE_PCX:
      strFormat = "ZSoft PCX";
      break;

   case FILE_GIF:
      strFormat = "CompuServe GIF";
      break;

   case FILE_TGA:
      strFormat = "TARGA";
      break;

   case FILE_PNG:
      strFormat = "Portable Network Graphics";
      break;

   case FILE_PSD:
      strFormat = "Adobe Photoshop 3.0";
      break;

   case FILE_BMP:
      strFormat = "Windows BMP";
      break;

   case FILE_OS2:
      strFormat = "OS/2 BMP version 1.x";
      break;

   case FILE_OS2_2:
      strFormat = "OS/2 BMP version 2.x";
      break;

   case FILE_WMF:
      strFormat = "Windows Meta File";
      break;

   case FILE_EPS:
      strFormat = "Encapsulated PostScript";
      break;

   case FILE_PCT:
      strFormat = "Macintosh Pict";
      break;

   case FILE_MSP:
      strFormat = "Microsoft Paint";
      break;

   case FILE_IMG:
      strFormat = "GEM Image";
      break;

   case FILE_PCD:
      strFormat = "Kodak PhotoCD";
      break;

   case FILE_EPSTIFF:
      strFormat = "Encapsulated PostScript with an embedded TIFF file";
      break;
   }

   strMsg.Format("Page = %d of %d\nFormat = %s\nWidth and Height [%d, %d]\nMemory Size = %d\nDisk Size = %d\nBits per pixel = %d\n XRes,YRes = [%d, %d]\n",
      nPage, nTotalPages,
      strFormat,
      nWidth, nHeight,
      nSizeMem,
      nSizeDisk,
      nBpp,
      xRes, yRes);

   MessageBox(strMsg, "File Info");
}


GetBitmapClipSegments example for Visual C++ 4.0
GetBitmapClipSegments example for C++ 4.0 and later

COleSafeArray vSegments;
float y;
long LBound, UBound;
float *pSegments;
int i, j;

m_Lead1.SetScaleMode(3); // use pixels
m_Lead1.SetAutoRepaint(FALSE); // disable repainting

y = m_Lead1.GetRgnTop();

// get the clip segments
vSegments = m_Lead1.GetBitmapClipSegments(y);

// vSegments should be an array of floats.
if(V_VT((LPVARIANT)vSegments) == VT_ARRAY | VT_R4)
{
   // get the bounds
   vSegments.GetLBound(1, &LBound);
   vSegments.GetUBound(1, &UBound);

   // get a pointer to the data
   vSegments.AccessData((void**)&pSegments);

   // loop through all the segments
   for(i = LBound; i < UBound; i += 2)
   {
      // for every segment, set all the pixels to black
      for(j = (int)pSegments[i – LBound]; j < pSegments[i – LBound + 1]; j++)
         m_Lead1.SetPixel((float)j, y, RGB(0, 0, 0));
   }

   m_Lead1.SetAutoRepaint(TRUE); // re-enable repainting
   vSegments.UnaccessData();
}


GetBitmapDC example for Visual C++ 4.0
GetBitmapDC example for C++ 4.0 and later

Take the following steps to demonstrate how GDI functions can be used to print text on the bitmap and on the control. The text printed on the bitmap is a permanent part of the bitmap and becomes permanent if the bitmap is saved; whereas the text on the control is superficial and does not affect the bitmap.

Note: For an easier way of drawing text, refer to the DrawText example.

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

2.	Go to the Project WorkSpace and click the ResourceView tab.

3.	Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.

4.	 Add a new button under the Cancel button. To do this, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box.

5.	Double-click the button and change IDC_BUTTON1 to IDC_TEXT. Also, set the Caption to &Text.

6.	Press Ctrl-F4 to close all windows back to the Project Workspace.

7.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_TEXT.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnText).

f.	Click the Edit Code button to start entering the code.

8.	Enter new code as follows:

void CTutorDlg::OnText()
{
  // TODO: Add your control notification handler code here

  // First, print text on the bitmap.
  HDC hdcLead = (HDC)m_Lead1.GetBitmapDC();
  HFONT hfnt = (HFONT)GetStockObject( SYSTEM_FONT );
  HFONT hOldFont = (HFONT)SelectObject( hdcLead, hfnt );
  static  char mystring[] = "Text on the bitmap";

  SetBkMode( hdcLead, OPAQUE );
  // output black text on white background
  SetBkColor( hdcLead, RGB(255,255,255) );
  TextOut( hdcLead, 20, 40, mystring, lstrlen(mystring) );

  // Select the old font
  SelectObject( hdcLead, hOldFont );

  // Release the device context
  m_Lead1.ReleaseBitmapDC();

  // Repaint the part of the image that has changed
  m_Lead1.SetBackErase(FALSE);
  m_Lead1.ForceRepaint();

  // Allow full repainting again
  m_Lead1.SetBackErase(TRUE);

  // Now paint the control AFTER you repainted the window !
  hdcLead = (HDC)m_Lead1.GetClientDC();

  hOldFont = (HFONT)SelectObject( hdcLead, hfnt );
  static  char mystring2[] = "Text on the control";

  // output black text on white background
  SetBkColor( hdcLead, RGB(255,255,255) );
  TextOut( hdcLead, 20, 20, mystring2, lstrlen(mystring2) );

  // Select the old font
  SelectObject( hdcLead, hOldFont );

  // Release the device context
  m_Lead1.ReleaseClientDC();
}

9.	Rebuild and run the application.


GetColorCount Example for Visual C++ 4.0
GetColorCount Example for C++ 4.0 and later

This example displays a message box showing the number of unique colors in the control's current bitmap.

// Declare local variables.
char szMessage[80]; // Buffer for the MessageBox string
long NumberOfColors; // Number of colors in the bitmap

// Get the number of colors in the bitmap.
NumberOfColors = m_Lead1.GetColorCount();

// Display the result in a message.
wsprintf( szMessage, "The bitmap has %ld colors", NumberOfColors );
MessageBox(szMessage, "Notice");


GetDIB example for Visual C++ 4.0
GetDIB example for C++ 4.0 and later

//This example takes a LEAD1 control (m_Lead1) with an image,
//converts it to a V5 DIB and writes out the DIB as a bitmap file

int CDIB2Dlg::MySaveFile(HGLOBAL hDIB, char * pszFileName)
{
   int fp, nSize;
   unsigned char *pDIB;
   BITMAPFILEHEADER bfh;
   PBITMAPINFOHEADER pbih;
   int nDIBsize;

   nDIBsize = GlobalSize(hDIB);

   bfh.bfType        = 0x4d42; //"BM";
   bfh.bfSize        =  sizeof(BITMAPFILEHEADER) + nDIBsize;
   bfh.bfReserved1   = 0;
   bfh.bfReserved2   = 0;

   pDIB = (unsigned char*)::GlobalLock(hDIB);
   pbih = (PBITMAPINFOHEADER)pDIB;

   // Compute the offset to the array of color indices.
   bfh.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) +
                    pbih->biSize + pbih->biClrUsed  * sizeof (RGBQUAD);

   fp = _open(pszFileName, _O_RDWR | _O_CREAT | _O_BINARY,  0);//_S_IREAD | _S_IWRITE );
   if (fp == 0)
      return FALSE;

   nSize =  _write( fp, &bfh, sizeof(BITMAPFILEHEADER));
   nSize =  _write( fp, pDIB, nDIBsize);
   _close(fp);

   GlobalUnlock(hDIB);
   return TRUE;
}

int CDIB2Dlg::ExampleConvertToDIB2(char * pszFileName)
{
   int bRet;
   HGLOBAL hDIB;
   hDIB = (HGLOBAL)m_Lead1.GetDIB(DIB_BITMAPV5HEADER);
   bRet = MySaveFile(hDIB, pszFileName);
   GlobalFree(hDIB);
   return bRet;
}


GetFileInfo example for Visual C++ 4.0
GetFileInfo example for C++ 4.0 and later

This example gets information about the specified file.

// Initialize variables
CString fname = "c:\\lead\\images\\image2.cmp";
// Update the variables
m_Lead1.GetFileInfo(fname, 0, FILEINFO_TOTALPAGES);
// Read the updated properties
int fmt = m_Lead1.GetInfoFormat();
float width = m_Lead1.GetInfoWidth();
float height = m_Lead1.GetInfoHeight();
int bps = m_Lead1.GetInfoBits();
int xres = m_Lead1.GetBitmapXRes();
int yres = m_Lead1.GetBitmapYRes();
int pg = m_Lead1.GetInfoPage();
long sizd = m_Lead1.GetInfoSizeDisk();
long sizm = m_Lead1.GetInfoSizeMem();
CString cmp = m_Lead1.GetInfoCompress();
// Translate the meaning of the format constant
CString cFmt;
switch (fmt)
{
   case FILE_PCX:
      cFmt = "ZSoft PCX";
      break;
   case FILE_GIF:
      cFmt = "CompuServe GIF";
      break;
   case FILE_TGA:
      cFmt = "TARGA";
      break;
   case FILE_PNG:
      cFmt = "Portable Network Graphics";
      break;
   case FILE_PSD:
      cFmt = "Adobe Photoshop 3.0";
      break;
   case FILE_BMP:
      cFmt = "Windows BMP";
      break;
   case FILE_OS2:
      cFmt = "OS/2 BMP version 1.x";
      break;
   case FILE_OS2_2:
      cFmt = "OS/2 BMP version 2.x";
      break;
   case FILE_WMF:
      cFmt = "Windows Meta File";
      break;
   case FILE_EPS:
      cFmt = "Encapsulated PostScript";
      break;
   case FILE_TIF:
      cFmt = "Tagged Image File Format (TIFF, TIFLZW, or CCITT file)";
      break;
   case FILE_TIF_JPEG:
      cFmt = "Tagged Image File with JPEG compression";
      break;
   case FILE_FAX_G3_1D:
      cFmt = "Raw FAX, compressed using CCITT group 3, 1 dimension";
      break;
   case FILE_FAX_G3_2D:
      cFmt = "Raw FAX, compressed using CCITT group 3, 2 dimensions";
      break;
   case FILE_FAX_G4:
      cFmt = "Raw FAX, compressed using CCITT group 4";
      break;
   case FILE_WFX_G3_1D:
      cFmt = "WinFax, compressed using CCITT group 3, 1 dimension";
      break;
   case FILE_WFX_G4:
      cFmt = "WinFax, compressed using CCITT group 4";
      break;
   case FILE_ICA_G3_1D:
      cFmt = "IOCA, compressed using CCITT group 3, 1 dimension";
      break;
   case FILE_ICA_G3_2D:
      cFmt = "IOCA, compressed using CCITT group 3, 2 dimensions";
      break;
   case FILE_ICA_G4:
      cFmt = "IOCA, compressed using CCITT group 4";
      break;
   case FILE_CMP:
      cFmt = "LEAD proprietary compression format";
      break;
   case FILE_CMP_NOLOSS:
      cFmt = "LEAD lossless compression format";
      break;
   case FILE_JPEG:
      cFmt = "JPEG File Interchange Format";
      break;
   case FILE_WPG:
      cFmt = "WordPerfect";
      break;
   case FILE_RAS:
      cFmt = "Sun Raster";
      break;
   case FILE_CALS:
      cFmt = "CALS Raster";
      break;
   case FILE_MAC:
      cFmt = "MacPaint";
      break;
   case FILE_PCT:
      cFmt = "Macintosh Pict";
      break;
   case FILE_MSP:
      cFmt = "Microsoft Paint";
      break;
   case FILE_IMG:
      cFmt = "GEM Image";
      break;
   case FILE_PCD:
      cFmt = "Kodak PhotoCD";
      break;
   case FILE_EPSTIFF:
      cFmt = "Encapsulated PostScript with an embedded TIFF file";
      break;
   default:
      cFmt = "Unknown format";
      break;
}
// Create the message string
char szMsg[512];
wsprintf(szMsg, "%s\n"
"Page = %u of %u\n"
"Format = %s\n"
"Width = %u\n"
"Height = %u\n"
"BitsPerPixel = %u\n"
"X resolution = %u\n"
"Y resolution = %u\n",
LPCSTR(fname), (UINT) pg, (UINT)m_Lead1.GetInfoTotalPages(), LPCSTR(cFmt),
(UINT) width, (UINT) height, (UINT) bps,
(UINT) xres, (UINT) yres);
MessageBox(szMsg, "File Info");


GetFloaterHandle example for Visual C++ 4.0
GetFloaterHandle example for C++ 4.0 and later

The following is an alternative way of coding the PasteFloaterBtn button's click procedure in  Outlining, Dragging, and Pasting a Region. This alternative uses the GetFloaterHandle and SetRgnHandle methods to specify the mask for the paste. It also shows how to use the HasRgn, FloaterWidth, and FloaterHeight properties.

void CTutorDlg::OnPastefloater()
{
   // Variable for the Combine operation.
   long MyOp;

   // Variable for the saved region.
   OLE_HANDLE SavedRgn;

   // Variables for the client area coordinates.
   float LCRgnX, LCRgnY , LCRgnWidth, LCRgnHeight;

   // Variables for the bitmap coordinates.
   float LBRgnX, LBRgnY , LBRgnWidth, LBRgnHeight;

   // Exit this routine if there is no region.
   if (m_Lead1.GetHasRgn() == FALSE) return;

   // Save the region that is in the floater.
   SavedRgn = m_Lead1.GetFloaterHandle();

   // Get the floater into another bitmap
   m_Lead2.SetScaleMode(m_Lead1.GetScaleMode());
   m_Lead2.SetBitmap(m_Lead1.GetFloater());

   // Get the floater's client coordinates into local variables.
   LCRgnX = m_Lead1.GetFloaterDstLeft();
   LCRgnY = m_Lead1.GetFloaterDstTop();
   LCRgnWidth = m_Lead1.GetFloaterDstWidth();
   LCRgnHeight = m_Lead1.GetFloaterDstHeight();

   // Translate the client coordinates to bitmap coordinates.
   LBRgnX = ((LCRgnX - m_Lead1.GetDstLeft()) / ZoomFactorX) + m_Lead1.GetSrcLeft();
   LBRgnY = ((LCRgnY - m_Lead1.GetDstTop()) / ZoomFactorY) + m_Lead1.GetSrcTop();
   LBRgnWidth = m_Lead1.GetFloaterWidth();
   LBRgnHeight = m_Lead1.GetFloaterHeight();

   // Delete the floater.
   m_Lead1.SetFloaterVisible(FALSE);
   m_Lead1.SetFloater(0);

   // Set the saved region to use as a mask for the Combine method.
   m_Lead1.SetRgnHandle(SavedRgn, LBRgnX, LBRgnY, L_RGN_SET);

   // Use the Combine method to paste the Lead2 bitmap into the Lead1 bitmap.
   MyOp = CB_OP_ADD + CB_DST_0; // Operation flags for a simple paste.
   m_Lead1.Combine(LBRgnX, LBRgnY, LBRgnWidth, LBRgnHeight,
            m_Lead2.GetBitmap(), 0.0f, 0.0f, MyOp);

   // Repaint the part of the client area that has changed.
   m_Lead1.RepaintRect(LCRgnX, LCRgnY, LCRgnWidth, LCRgnHeight, FALSE);

   // Free the region.
   m_Lead1.FreeRgn();

   // Delete the region handle.
   m_Lead1.DeleteRgnHandle(SavedRgn);
}


GetFunctionalLookupTable example for C++ 4.0 and later

   m_Lead1.GetFunctionalLookupTable(0, 255, 5, FLT_EXP);
   m_Lead1.RemapIntensity(CHANNEL_MASTER);


GetHistogram example for Visual C++ 4.0
GetHistogram example for C++ 4.0 and later

The following code does a CMYK separation and uses a histogram to find the brightest and darkest intensities in the K plane of the bitmap. It then remaps the intensities to use the full range and merges the color planes to recreate the bitmap:

BeginWaitCursor();
// Do a CMYK color separation and copy the K plane to the bitmap
m_Lead1.ColorSeparate(COLORSEP_CMYK);
m_Lead1.SetBitmap(m_Lead1.GetColorPlanes(3)); // Copy the K plane
// Load the histogram
m_Lead1.GetHistogram(CHANNEL_MASTER);
// Find the brightest and darkest intensities in the image
int MyIndex = 0;
int Brightest = 0;
int Darkest = -1;
while (MyIndex < 256)
{
  if (m_Lead1.GetHistogramTable(MyIndex) > 0)
  {
    Brightest = MyIndex;
    if (Darkest == -1)
       Darkest = MyIndex;
  }
  MyIndex = MyIndex + 1;
}
// Remap the intensities to use the full range
MyIndex = Darkest;
int CurrentRange = Brightest - Darkest;
if (CurrentRange > 0)
{
  while (MyIndex <= Brightest)
  {
    int Offset = MyIndex - Darkest;
    m_Lead1.SetRemapTable(MyIndex, (255 * Offset) / CurrentRange);
    MyIndex = MyIndex + 1;
  }
  m_Lead1.RemapIntensity(CHANNEL_MASTER);
}

// Merge the color planes and free them from memory
m_Lead1.SetColorPlanes(3, m_Lead1.GetBitmap()); // Update the K plane
m_Lead1.ColorMerge(COLORSEP_CMYK);
m_Lead1.SetColorPlanes(0, 0);
m_Lead1.SetColorPlanes(1, 0);
m_Lead1.SetColorPlanes(2, 0);
m_Lead1.SetColorPlanes(3, 0);
// Set the image display size to match the LEAD control
m_Lead1.SetDstRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.SetDstClipRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.ForceRepaint();
EndWaitCursor();


GetHistogramGray example for Visual C++ 4.0
GetHistogramGray example for C++ 4.0 and later

This example is for Medical only.

//This example gets a histogram for a 12-bit or 16-bit grayscale image and then
//displays the number of occurrences of the brightest and darkest intensities

void CHistogramGrayDlg::OnButton4()
{
   int nRet;
   char szMsg[100];
   long lMin, lMax;

   m_Lead.UnlockSupport(L_SUPPORT_MEDICAL, L_KEY_MEDICAL);

   wsprintf(szMsg, "Table size before call to GetHistogramGray: %d", m_Lead.GetHistogramGrayTableSize());
   ::MessageBox(NULL, szMsg, "", MB_OK);

   nRet = m_Lead.GetHistogramGray();
   if (nRet == 0)
   {
      m_Lead.GetMinMaxVal();
      lMin = m_Lead.GetMinVal();
      lMax = m_Lead.GetMaxVal();

      wsprintf(szMsg, "Highest Intensity: 0x%X      Count: %d\nLowest Intensity: 0x%X    Count:%d",
         lMax,
         m_Lead.GetHistogramGrayTable(lMax),
         lMin,
         m_Lead.GetHistogramGrayTable(lMin)
         );

      ::MessageBox(NULL, szMsg, "", MB_OK);

   }
   wsprintf(szMsg, "Table size after call to GetHistogramGray: %d", m_Lead.GetHistogramGrayTableSize());
   ::MessageBox(NULL, szMsg, "", MB_OK);
}


GetMinMaxBits example for Visual C++ 4.0
GetMinMaxBits example for C++ 4.0 and later

The following example retrieves the values for MinBit and MaxBit using GetMinMaxBits and writes the results.

    CString cs;

    m_Lead1.GetMinMaxBits();
    cs.Format("%d", m_Lead1.GetMinBit());
    m_Edit1.SetWindowText(cs);
    cs.Format("%d", m_Lead1.GetMaxBit());
    m_Edit2.SetWindowText(cs);


GetMinMaxVal example for Visual C++ 4.0
GetMinMaxVal example for C++ 4.0 and later

The following example retrieves the values for MinVal and MaxVal using GetMinMaxVal and writes the results.

    CString cs;

    //must call GetMinMaxVal first
    m_Lead1.GetMinMaxVal();
    cs.Format("%ld", m_Lead1.GetMinVal());
    m_Edit3.SetWindowText(cs);
    cs.Format("%ld", m_Lead1.GetMaxVal());
    m_Edit4.SetWindowText(cs);


GetRgnHandle example for Visual C++ 4.0
GetRgnHandle example for C++ 4.0 and later

The following code creates a region, saves its handle and adds the saved region beside the current region.

// Declare local variables.
float OffsetX, OffsetY;
OLE_HANDLE SavedRegion;

// Initialize the variables that we will manipulate to simulate mouse coordinates.
OffsetX = m_Lead1.GetBitmapWidth() / 8;
OffsetY = m_Lead1.GetBitmapHeight() / 6;

// Create an elliptical region.
m_Lead1.SetRgnEllipse(OffsetX, OffsetY, OffsetX, OffsetY, L_RGN_SET);

// Save a copy of the region.
SavedRegion = m_Lead1.GetRgnHandle();

// Add the saved region to the bitmap, offsetting it so that we can see it.
m_Lead1.SetRgnHandle(SavedRegion, OffsetX, OffsetY, L_RGN_OR);

// Delete the saved region.
m_Lead1.DeleteRgnHandle(SavedRegion);

// Fill the bitmap region with blue.
m_Lead1.Fill(RGB(0, 0, 255));

// Free the bitmap region.
m_Lead1.FreeRgn();

// Repaint the image so that we can see how the image was updated.
m_Lead1.ForceRepaint();


GetUserLookupTable example for C++ 4.0 and later

   long PointCount;
   m_Lead1.SetUserLUTCurveSize(3);
   m_Lead1.SetUserLUTCurveX(0, 0);
   m_Lead1.SetUserLUTCurveY(0, 0);
   m_Lead1.SetUserLUTCurveX(1, 128);
   m_Lead1.SetUserLUTCurveY(1, 150);
   m_Lead1.SetUserLUTCurveX(2, 255);
   m_Lead1.SetUserLUTCurveY(2, 255);
   m_Lead1.GetUserLookupTable(&PointCount);
   m_Lead1.RemapIntensity (CHANNEL_MASTER);
   CString s;
   s.Format("%ld Points were modified", PointCount);
   AfxMessageBox(s);


Grayscale example for Visual C++ 4.0
Grayscale example for C++ 4.0 and later

This example converts the bitmap to 12-bit grayscale.

m_Lead1.Grayscale(12); //grayscale to 12-bit


GrayscaleExt example for C++ 5.0 and later

   m_Lead1.GrayscaleExt(300, 590, 110);


Halftone example for Visual C++ 4.0
Halftone example for C++ 4.0 and later

This example halftones the bitmap with a horizontal pattern and repaints the image.

m_Lead1.Halftone(HALFTONE_PRINT, 0, 0);
m_Lead1.ForceRepaint();


HasMagGlass example for Visual C++ 4.0
HasMagGlass example for C++ 4.0 and later

   if(m_LEAD1.GetHasMagGlass())
   {
      SetWindowText("Stop");
      //Stop the MagGlass
      m_LEAD1.StopMagGlass();
   }
   else
      SetWindowText("Error");


HistoContrast example for Visual C++ 4.0
HistoContrast example for C++ 4.0 and later

This example applies a histogram contrast to the bitmap and repaints the image.

m_Lead1.HistoContrast(300);
m_Lead1.ForceRepaint();


HistoEqualize example for Visual C++ 4.0
HistoEqualize example for C++ 5.0 and later

This example equalizes the bitmap's histogram and repaints the image.

   m_Lead1.HistoEqualize(YUV_SPACE);


HistogramTableSize example for C++ 4.0 and later

   if(m_Lead1.GetBitmapBits() == 64 || m_Lead1.GetBitmapBits() == 48)
      m_Lead1.SetHistogramTableSize (65536);
   else
      m_Lead1.SetHistogramTableSize(256);


HScrollInfo example for Visual C++ 4.0
HScrollInfo example for C++ 4.0 and later

void CMfcdemoView::OnResizeLeadctrl1()
{
   if(!m_Lead.m_hWnd)
      return;
   if(m_Lead.GetHScrollInfo().GetVisible())
   {
      m_Lead.GetHScrollInfo().SetPage(m_Lead.GetHScrollInfo().GetMax() / 10);
      m_Lead.GetHScrollInfo().SetLine(10);
   }
   if(m_Lead.GetVScrollInfo().GetVisible())
   {
      m_Lead.GetVScrollInfo().SetPage(m_Lead.GetVScrollInfo().GetMax() / 10);
      m_Lead.GetVScrollInfo().SetLine(10);
   }
   OutputDebugString("*************\n");
   CString cs;
   cs.Format("HScrollMin: %d\n", m_Lead.GetHScrollInfo().GetMin());
   OutputDebugString(cs);
   cs.Format("HScrollMax: %d\n", m_Lead.GetHScrollInfo().GetMax());
   OutputDebugString(cs);
   cs.Format("VScrollMin: %d\n", m_Lead.GetVScrollInfo().GetMin());
   OutputDebugString(cs);
   cs.Format("VScrollMax: %d\n", m_Lead.GetVScrollInfo().GetMax());
   OutputDebugString(cs);
   cs.Format("-------------\n");
   OutputDebugString(cs);
   cs.Format("HScrollPage: %d\n", m_Lead.GetHScrollInfo().GetPage());
   OutputDebugString(cs);
   cs.Format("HScrollLine: %d\n", m_Lead.GetHScrollInfo().GetLine());
   OutputDebugString(cs);
   cs.Format("VScrollPage: %d\n", m_Lead.GetVScrollInfo().GetPage());
   OutputDebugString(cs);
   cs.Format("VScrollLine: %d\n", m_Lead.GetVScrollInfo().GetLine());
   OutputDebugString(cs);
   cs.Format("-------------\n");
   OutputDebugString(cs);
   cs.Format("HScrollPos: %d\n", m_Lead.GetHScrollInfo().GetPos());
   OutputDebugString(cs);
   cs.Format("VScrollPos: %d\n", m_Lead.GetVScrollInfo().GetPos());
   OutputDebugString(cs);
   cs.Format("-------------\n");
   OutputDebugString(cs);
   cs.Format("HScrollWidth: %f\n", m_Lead.GetHScrollInfo().GetWidth());
   OutputDebugString(cs);
   cs.Format("VScrollWidth: %f\n", m_Lead.GetVScrollInfo().GetWidth());
   OutputDebugString(cs);
}


HSV_HfromRGB example for Visual C++ 4.0
HSV_HfromRGB example for C++ 4.0 and later

//Takes an RGB, displays the RGB components, and displays the HSV components

void CColorReplaceDlg::RGBtoHSV(COLORREF cr)
{
   int nR, nG, nB, nH, nS, nV;
   char szMsg[100];

   nR = GetRValue(cr);
   nG = GetGValue(cr);
   nB = GetBValue(cr);

   nH = m_Lead.HSV_HfromRGB(cr);
   nS = m_Lead.HSV_SfromRGB(cr);
   nV = m_Lead.HSV_VfromRGB(cr);

   wsprintf(szMsg, "RGB(%d,%d,%d) is HSV(%d,%d,%d)", nR, nG, nB, nH, nS, nV);
   ::MessageBox(NULL, szMsg, "", MB_OK);
}


HTableL example for Visual C++ 4.0
HTableL example for C++ 4.0 and later

   m_Lead.Load( "image.cmp",16,0,1);

   m_Lead.SetRemapHueTablesSize(65536);
   for(int i =0;i<m_Lead.GetRemapHueTablesSize() ;++i)
   {
      m_Lead.SetMaskTableL(i,0);
      m_Lead.SetHTableL(i,1);
      m_Lead.SetVTableL(i,0);
      m_Lead.SetSTableL(i,0);
   }
   m_Lead.RemapHue( false, true, false, false );


Hue example for Visual C++ 4.0
Hue example for C++ 4.0 and later

This example rotates the hue 180 degrees and repaints the image.

m_Lead1.Hue(180);
m_Lead1.ForceRepaint();


hDocCleanRgn example for Visual C++ 4.0
hDocCleanRgn example for C++ 4.0 and later

   short nRet;
   //HolePunch Remove
   //This example updates a windows region with the removed hole punches
   //For the example, a windows region is updated and then converted to a LEAD region
   //but in practice it would easier and faster to just update a LEAD region
   //The HOLEPUNCH_USE_DPI flag instructs the API to determine the size of the hole punches
   //based on the image DPI
   //The image is modified
   //The HolePunch Event is used to display information about each hole punch removed
   nRet = m_LEAD1.HolePunchRemove(HOLEPUNCH_SINGLE_REGION | HOLEPUNCH_USE_DPI |
                                  HOLEPUNCH_USE_COUNT | HOLEPUNCH_USE_LOCATION,
                                  2, 4, 0, 0, 0, 0, HOLEPUNCH_LEFT);
   if(nRet == 0)
   {
      m_LEAD1.FreeRgn();
      m_LEAD1.SetRgnHandle(m_LEAD1.GethDocCleanRgn(), 0.0f, 0.0f, L_RGN_SET);
      m_LEAD1.SethDocCleanRgn(0); //no longer need rgn
      m_LEAD1.SetRgnFrameType(RGNFRAME_COLOR);
   }

void CDoccleanDlg::OnHolePunchRemoveLeadctrl1(long hRgn, float fBoundingRectLeft, float fBoundingRectTop, float fBoundingRectWidth, float fBoundingRectHeight, long iHoleIndex, long iHoleTotalCount, long iWhiteCount, long iBlackCount)
{
   CString csOut;
   csOut.Format("HolePunch at %d,%d,%d,%d, Index=%d Count=%d WhiteCount=%d, BlackCount=%d\n",
                (long)fBoundingRectLeft,
                (long)fBoundingRectTop,
                (long)fBoundingRectWidth,
                (long)fBoundingRectHeight,
                iHoleIndex,
                iHoleTotalCount,
                iWhiteCount,
                iBlackCount);
   OutputDebugString(csOut);
}


hWnd example for Visual C++ 4.0
hWnd example for C++ 4.0 and later

CAnnToolbar AnnToolbar;

   AnnToolbar = m_LEAD1.GetAnnToolbar();

   AfxMessageBox("Toolbar has been destroyed!");
   if(AnnToolbar.GetHWnd() == 0)
      AnnToolbar.Create(0.0f, 0.0f, 0);
   m_iTool = AnnToolbar.GetTool();


IgnoreFilters example for Visual C++ 4.0
IgnoreFilters example for C++ 4.0 and later

This example shows how to ignore filters so that they are not loaded.

    // First, make sure PreLoaded Filters does not
    // contain CMP, and that 0 filters can be cached
    m_Lead1.PreLoadFilters(3, 0, "BMP,FAX,TIF");

    // now, ignore cmp filter (never load cmp files)
    m_Lead1.IgnoreFilters("CMP");


InfoHasAlpha example for Visual C++ 4.0
InfoHasAlpha example for C++ 4.0 and later

   m_LEAD1.Load("c:\\temp\\1.jpg", 24, 1, 1);//load a 24-bit image
   m_LEAD2.SetBitmap(m_LEAD1.GetBitmap());
   m_LEAD2.ColorRes(8, 0, 0, 0); //just make it 8-bit
   //now set an alpha channel
   m_LEAD1.SetBitmapAlpha(m_LEAD2.GetBitmap());

   //save and free
   m_LEAD1.Save("c:\\temp\\32.png", FILE_PNG, 32, 0, 0);
   m_LEAD1.SetBitmap(0);
   m_LEAD2.SetBitmap(0);

   AfxMessageBox("Pause");

   //re-load
   m_LEAD1.GetFileInfo("c:\\temp\\32.png", 0, 0);
   if(m_LEAD1.GetInfoHasAlpha())
      m_LEAD1.Load("c:\\temp\\32.png", 0, 1, 1);
   m_LEAD2.SetBitmap(m_LEAD1.GetBitmapAlpha());


InfoLayers example for Visual C++ 4.0
InfoLayers example for C++ 4.0 and later

int i;

// This example loads all the layers in a file to a bitmap list
m_Lead1.GetFileInfo("c:\\temp\\layers.psd", 0, 0);

if(m_Lead1.GetInfoLayers() == 0)
   MessageBox("This file has no layers!", "Info");
else
{
m_Lead1.LoadLayer("c:\\temp\\layers.psd", 0, 0);

m_Lead1.SetRefBitmap(TRUE);

for(i = 1; i < m_Lead1.GetInfoLayers(); i++)
{
   m_Lead2.LoadLayer("c:\\temp\\layers.psd", 0, i);
   m_Lead1.InsertBitmapListItem(-1, m_Lead2.GetBitmap());
   }
}


InfoViewPerspective example for Visual C++ 4.0
InfoViewPerspective example for C++ 4.0 and later

   CString cs;
   m_LEAD1.GetFileInfo("c:\\test.tif", 1, 0);
   cs.Format("%d\n", m_LEAD1.GetInfoViewPerspective());
   AfxMessageBox(cs);


Insert (ImageList Control) example for C++ 4.0 and later

   //load an image
   m_LEAD1.Load("v:\\images\\eagle.cmp", 0, 1, 1);
   //insert it into the ImageList control
   m_LEADImgList1.Insert((long)m_LEAD1.GetBitmap(), "testing", 1);
   m_LEADImgList1.EnsureVisible(m_LEADImgList1.GetCount() - 1);
AfxMessageBox("new item, press OK to move back to top");
   m_LEADImgList1.ScrollItems(-m_LEADImgList1.GetRowCount());


InsertAt (ImageList Control) example for C++ 4.0 and later

   //load an image
   m_LEAD1.Load("v:\\images\\eagle.cmp", 0, 0, 1);
   //insert it into the ImageList control at the first item
   m_LEADImgList1.InsertAt((long)m_LEAD1.GetBitmap(), "test2", 1, 0);


InsertBitmapListItem Example for Visual C++ 4.0
InsertBitmapListItem Example for C++ 4.0 and later

This example loads an ordinary file and uses it to create and play an animation. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

float nMax = 160.0f; // Maximum width or height for bitmaps in the list
float BitmapWidth, BitmapHeight; // Width and height of the bitmap
short i; // Loop counter

m_Lead2.Load("c:\\lead\\images\\image1.cmp", 0, 0, 1);
BitmapWidth = m_Lead2.GetBitmapWidth();
BitmapHeight = m_Lead2.GetBitmapHeight();

// Reduce memory requirements, if necessary. Only small bitmaps play smoothly.
if (BitmapWidth > nMax)
   m_Lead2.Size(nMax, (BitmapHeight * nMax) / BitmapWidth, RESIZE_RESAMPLE);
else if (BitmapHeight > nMax)
   m_Lead2.Size((BitmapWidth * nMax) / BitmapHeight, nMax, RESIZE_RESAMPLE);

// Dither to an optimized palette, leaving the last color blank to use
// for transparency.
m_Lead2.ColorRes(8, CRP_IDENTITYPALETTE, CRD_FLOYDSTEINDITHERING, 255);

// Set an arbitrary transparent color in the last position of the bitmap palette.
m_Lead2.SetBitmapPalette(255, RGB(212, 222, 202));

// Set the playback values that will apply to all bitmaps in the list.
m_Lead2.SetBitmapDelay(10);
m_Lead2.SetBitmapTop(0.0f);
m_Lead2.SetBitmapLeft(0.0f);
m_Lead2.SetBitmapEnableTransparency(TRUE);
m_Lead2.SetBitmapTransparentColor(16777216 + 255); // Specified by palette index
m_Lead2.SetBitmapDisposalMethod(ANIMATIONDISPOSAL_RESTOREPREVIOUS);

// Free the LEAD1 control's current bitmap list.
m_Lead1.SetBitmapList(0);

// Populate the bitmap list in the LEAD1 control.
for (i = 0; i <= 36; ++ i)
{
   m_Lead1.InsertBitmapListItem(i, m_Lead2.GetBitmap());

   // Rotate, using the transparent color as the fill color.
   m_Lead1.SetBitmapListIndex(i);
   m_Lead1.Rotate(1000 * i, 0, 16777216 + 255);
}

/* Set the animation playback properties */
m_Lead1.SetAnimationBackColor(RGB(0,0,255));
m_Lead1.SetAnimationBitsPerPixel(8);
m_Lead1.SetAnimationHeight(m_Lead1.GetScaleHeight());
m_Lead1.SetAnimationWidth(m_Lead1.GetScaleWidth());
m_Lead1.SetAnimationLoop(FALSE);
for (i = 0; i < 256; ++ i)
   m_Lead1.SetAnimationPalette(i, m_Lead1.GetBitmapPalette(i));

// Set properties for a scaled animation.
m_Lead1.SetAutoRepaint(TRUE);
m_Lead1.SetAutoSetRects(FALSE);

// Set the image display size to match the LEAD control.
m_Lead1.SetDstRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.SetDstClipRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());

// Start the animation.
m_Lead1.SetAnimationEnable(TRUE);

// Free the LEAD2 control's bitmap.
m_Lead2.SetBitmapList(0);


InsertFromBitmapList (ImageList Control) example for C++ 4.0 and later

//load an image
   m_LEAD1.Load("v:\\images\\eagle.cmp", 0, 0, 1);
   //make a bitmap list
   m_LEAD2.InsertBitmapListItem(0, m_LEAD1.GetBitmap());
   m_LEAD1.Rotate(2500, 0, 0);
   m_LEAD2.InsertBitmapListItem(0, m_LEAD1.GetBitmap());
   m_LEAD1.Rotate(2500, 0, 0);
   m_LEAD2.InsertBitmapListItem(0, m_LEAD1.GetBitmap());
   m_LEAD1.Rotate(2500, 0, 0);

   //now, insert the items from the bitmap list into the ImageList Control
   m_LEADImgList1.InsertFromBitmapList((long)m_LEAD2.GetBitmapList(), "test_list");


Intensity example for Visual C++ 4.0
Intensity example for C++ 4.0 and later

This example lightens the bitmap and repaints the image.

m_Lead1.Intensity(150);
m_Lead1.ForceRepaint();


IntensityDetect example for Visual C++ 4.0
IntensityDetect example for C++ 4.0 and later

This example filters the bitmap to get the lightest intensities and repaints the image.

m_Lead1.IntensityDetect(200, 255);
m_Lead1.ForceRepaint();


Invert example for Visual C++ 4.0
Invert example for C++ 4.0 and later

This example inverts the bitmap's colors and repaints the image.

m_Lead1.Invert();
m_Lead1.ForceRepaint();


InvertedText example for Visual C++ 4.0
InvertedText example for C++ 4.0 and later

   short nRet;
   //InvertedText
   //This example finds all inverted text regions greater than 5 inches in width and 1/2 inch in height
   //and inverts the text so that it appears normal
   //The InvertedText Event is used to display additional information about the inverted text regions
   //A LEAD region is updated to show all of the changes
   m_LEAD1.SetDocCleanSuccess(SUCCESS_REMOVE);
   nRet = m_LEAD1.InvertedText(INVERTEDTEXT_SINGLE_REGION | INVERTEDTEXT_LEAD_REGION | INVERTEDTEXT_USE_DPI, 5000, 500, 70, 95);
   if(nRet == 0)
   {
      m_LEAD1.FreeRgn();
      m_LEAD2.SetBitmap(m_LEAD1.GetDocCleanBitmap()); //copy the result so we can get the rgn handle
      m_LEAD1.SetRgnHandle(m_LEAD2.GetRgnHandle(), 0.0f, 0.0f, L_RGN_SET);
      m_LEAD2.SetBitmap(0); //no longer need copy
      m_LEAD1.SetDocCleanBitmap(0); //no longer need rgn either
      m_LEAD1.SetRgnFrameType(RGNFRAME_COLOR);
   }

void CDoccleanDlg::OnInvertedTextLeadctrl1(long hRgn, float fBoundingRectLeft, float fBoundingRectTop, float fBoundingRectWidth, float fBoundingRectHeight, long iWhiteCount, long iBlackCount)
{
   CString csOut;
   csOut.Format("Inverted at %d, %d, %d, %d, WhiteCount=%d BlackCount=%d\n",
                 (long)fBoundingRectLeft,
                 (long)fBoundingRectTop,
                 (long)fBoundingRectWidth,
                 (long)fBoundingRectHeight,
                 iWhiteCount,
                 iBlackCount);
   OutputDebugString(csOut);
}


IsSigned example for Visual C++ 4.0
IsSigned example for C++ 4.0 and later

// Load the bitmap data as signed so we can use a different conversion
m_Lead1.SetLoadSigned(TRUE);
m_Lead1.Load("c:\\temp\\signed.tif", 0, 0, 1);
// use the non-default conversion "zero to center"
m_Lead1.ConvertSignedToUnsigned(SHIFT_ZERO_TO_CENTER);


ISISAcquire example for Visual C++ 4.0
ISISAcquire example for C++ 4.0 and later

short nRet;
   //The following example acquires a single image using ISISAcquire.
   m_LEADISIS1.SetEnableMethodErrors(FALSE);
   nRet = m_LEADISIS1.ISISLoadDriver();
   if (nRet == 0)
   {
     nRet = m_LEADISIS1.ISISAcquire((long)this->m_hWnd, ISIS_SHOWUI);
     m_LEADISIS1.ISISUnloadDriver();
   }
   if (nRet == 0)
     m_LEAD1.SetBitmap(m_LEADISIS1.GetBitmap());
   else
   {
    if (nRet != ERROR_ISIS_CANCEL)
       AfxMessageBox("Error during ISIS Scan!");
   }


ISISAcquireMulti example for Visual C++ 4.0
ISISAcquireMulti example for C++ 4.0 and later

long nMaxPages;
   short nRet;

   //The following example prepares for scanning multiple images by setting tags and enabling the ISISPage event and then scans multiple images, using ISISAcquireMulti method.
   nMaxPages = 10;
   m_LEADISIS1.SetEnableMethodErrors(FALSE);
   m_LEADISIS1.SetEnableISISEvent(TRUE);
   nRet = m_LEADISIS1.ISISLoadDriver();
   if (nRet == 0)
   {
       m_LEADISIS1.ISISSetTag(TAG_SCANAHEAD, TAG_SCANAHEAD_YES);
       m_LEADISIS1.ISISGetTag(TAG_MAXPAGES, &nMaxPages);
       m_LEADISIS1.ISISSetTag(TAG_SCANAHEAD_MAXPAGES, (short)(nMaxPages / 2));
       m_LEADISIS1.ISISSetTag(TAG_COMPRESSION, TAG_COMPRESSION_G4);
       nRet = m_LEADISIS1.ISISAcquireMulti((long)this->m_hWnd, "d:\\temp\\mfctest.tif", ISIS_SHOWUI, FILE_CCITT_GROUP4, 1);
       m_LEADISIS1.ISISUnloadDriver();
       if (nRet != 0)
       {
           if (nRet == ERROR_USER_ABORT)
           {
              CString csMsg;
              csMsg.Format("Acquire canceled, %d pages were aborted!\n",
                           m_LEADISIS1.GetPagesDiscarded() );
              AfxMessageBox(csMsg);
           }
           else if (nRet != ERROR_ISIS_CANCEL)
              AfxMessageBox("Error During ISIS Scan");
       }
       else
           AfxMessageBox("Image(s) acquired to file(s) d:\\temp\\mfctest.tif");
   }
}

void CBsDlg::OnISISPageLtisiocxctl1(long nPage, LPCTSTR pszFileName)
{
   CString csMsg;
   csMsg.Format("Page #: %ld\nFileName: %s\n",
                nPage, pszFileName);
   AfxMessageBox(csMsg);
}


ISISGetASCIITag example for Visual C++ 4.0
ISISGetASCIITag example for C++ 4.0 and later

   CString szVal;
   BSTR bstrVal=NULL;

   m_LEADISIS1.ISISLoadDriver();

   //get the default value
   m_LEADISIS1.ISISGetASCIITag(TAG_PAGESIZE, &bstrVal, TRUE);
   szVal = bstrVal;
   SysFreeString(bstrVal);
   AfxMessageBox("Default: " + szVal);

   //get the current value
   m_LEADISIS1.ISISGetASCIITag(TAG_PAGESIZE, &bstrVal, FALSE);
   szVal = bstrVal;
   SysFreeString(bstrVal);
   AfxMessageBox("Current: " + szVal);

   //set a new value
   //NOTE, this would have to be a valid choice for the scanner
   m_LEADISIS1.ISISSetASCIITag(TAG_PAGESIZE, "Scanner's Maximum");

   //get the default value
   m_LEADISIS1.ISISGetASCIITag(TAG_PAGESIZE, &bstrVal, FALSE);
   szVal = bstrVal;
   SysFreeString(bstrVal);
   AfxMessageBox("Current: " + szVal);

   m_LEADISIS1.ISISUnloadDriver();


ISISGetASCIITagChoiceCount example for Visual C++ 4.0
ISISGetASCIITagChoiceCount example for C++ 4.0 and later

   long n;
   long x;
   CString szChoice;
   CString szTemp;
   BSTR bstrChoice=NULL;

   m_LEADISIS1.ISISLoadDriver();
   m_LEADISIS1.ISISGetASCIITagChoiceCount(TAG_PAGESIZE, &n);
   szChoice.Format("Scanner has %d choices\n", n);
   OutputDebugString(szChoice);
   for(x=0; x<n; x++)
   {
      m_LEADISIS1.ISISGetASCIITagChoice(TAG_PAGESIZE, x, &bstrChoice);
      szTemp = bstrChoice;
      szChoice.Format("Choice: %d  Value: %s\n", x, szTemp);
      OutputDebugString(szChoice);
   }

   m_LEADISIS1.ISISUnloadDriver();


ISISGetTagChoiceCount example for Visual C++ 4.0
ISISGetTagChoiceCount example for C++ 4.0 and later

   long lCount;
   long lVal;
   long x;
   CString szOut;

   m_LEADISIS1.ISISLoadDriver();

   //try a long tag
   m_LEADISIS1.ISISGetTagChoiceCount(TAG_IMAGEWIDTH, &lCount);
   szOut.Format("Scanner has %d choices\n", lCount);
   OutputDebugString(szOut);
   for(x=0; x<lCount; x++)
   {
      m_LEADISIS1.ISISGetTagChoice(TAG_IMAGEWIDTH, x, &lVal);
      szOut.Format("Choice: %d   Value: %d\n", x, lVal);
      OutputDebugString(szOut);
   }

   OutputDebugString("********\n");

   //try a short tag
   m_LEADISIS1.ISISGetTagChoiceCount(TAG_BRIGHTNESS, &lCount);
   szOut.Format("Scanner has %d choices\n", lCount);
   OutputDebugString(szOut);
   for(x=0; x<lCount; x++)
   {
      m_LEADISIS1.ISISGetTagChoice(TAG_BRIGHTNESS, x, &lVal);
      szOut.Format("Choice: %d   Value: %d\n", x, lVal);
      OutputDebugString(szOut);
   }

   m_LEADISIS1.ISISUnloadDriver();


IsISISAvailable example for Visual C++ 4.0
IsISISAvailable example for C++ 4.0 and later

//The following example tests to see if ISIS is available.  If not, then a message is output in MsgBox.
   if (m_LEADISIS1.GetIsISISAvailable() == 0)
      AfxMessageBox("ISIS Support not installed!");


ISISSelect example for Visual C++ 4.0
ISISSelect example for C++ 4.0 and later

//The following example displays the ISISSelect DialogBox and writes a message indicating which ISIS Scanner Driver was selected.
    m_LEADISIS1.ISISSelect((long)this->m_hWnd);
    CString csMsg;
    csMsg.Format("%s was selected!",
                 m_LEADISIS1.GetDriverName() );
    AfxMessageBox(csMsg);


ISISSetScanOptions example for Visual C++ 4.0
ISISSetScanOptions example for C++ 4.0 and later

    m_LEADISIS1.ISISLoadDriver();
    m_LEADISIS1.ISISSetScanOptions((long)m_LEADISIS1.m_hWnd);
    m_LEADISIS1.ISISUnloadDriver();


IsSupportLocked (ISIS Control) example for Visual C++ 4.0
IsSupportLocked (ISIS Control) example for C++ 4.0 and later

    long bRet;

    bRet = m_LEADISIS1.IsSupportLocked(L_SUPPORT_DOCUMENT);
    if (bRet!=0)
        AfxMessageBox("Document Support Locked");


IsSupportLocked (OLE DB Control) example for Visual C++ 4.0
IsSupportLocked (OLE DB Control) example for C++ 4.0 and later

long bRet;
bRet = m_LEADOLEDB1.IsSupportLocked(L_SUPPORT_DOCUMENT);
if (bRet!=0)
   AfxMessageBox("Document Support Locked");


Item (ImageList Control) example for C++ 4.0 and later

CLEADImageListItem LEADItem;
   long lCount,x,lSelCount;

   m_LEADImgList1.SelectAll(FALSE);
   //flip the 3rd item's bitmap
   LEADItem = m_LEADImgList1.Item(2);
   m_LEAD1.SetBitmap(LEADItem.GetBitmap ());
   m_LEAD1.Flip();
   LEADItem.SetBitmap (m_LEAD1.GetBitmap());
   //set the 4th and 6th items as selected
   LEADItem = m_LEADImgList1.Item(3);
   LEADItem.SetSelected (TRUE);
   LEADItem = m_LEADImgList1.Item(5);
   LEADItem.SetSelected (TRUE);

   //now, count the selected items
   lCount = m_LEADImgList1.GetCount();
   lSelCount = 0;
   for(x=0; x<lCount; x++)
   {
      LEADItem = m_LEADImgList1.Item(x);
      if(LEADItem.GetSelected())
         lSelCount++;
   }
   CString csOut;
   csOut.Format("%ld Items were selected!", lSelCount);
   AfxMessageBox(csOut);


ItemBackgroundColor (ImageList Control) example for C++ 4.0 and later

m_LEADImgList1.SetItemBackgroundColor(RGB(255, 0, 0)); //set to RED


ItemSelected (ImageList Control) example for C++ 4.0 and later

void CTttDlg::OnItemSelectedLeadimglistctrl1(long nIndex)
{
   CLEADImageListItem LEADItem;
   LEADItem = m_LEADImgList1.Item(nIndex);
   AfxMessageBox(LEADItem.GetText () + " was selected!");
}


ItemUnSelected Example for Visual C++ 4.0
ItemUnSelected Example for C++ 4.0 and later

void CTttDlg::OnItemUnSelectedLeadimglistctrl1(long nIndex)
{
   CLEADImageListItem LEADItem;
   LEADItem = m_LEADImgList1.Item(nIndex);
   AfxMessageBox(LEADItem.GetText () + " was unselected!");
}


ItemWidth (ImageList Control) example for C++ 4.0 and later

   //set item display options
   m_LEADImgList1.SetItemWidth(150.0f);
   m_LEADImgList1.SetItemHeight(150.0f);
   m_LEADImgList1.SetItemVerticalSpacing(20.0f);
   m_LEADImgList1.SetItemHorizontalSpacing(20.0f);
   m_LEADImgList1.SetDisplayItemText(FALSE);


J2KCompressionControl example for Visual C++ 4.0
J2KCompressionControl example for C++ 4.0 and later

   // save a lossless file
   m_LEAD1.SetJ2KCompressionControl(J2K_COMP_LOSSLESS);
   m_LEAD1.Save("c:\\temp\\lossless.j2k", FILE_J2K, 0, 0, SAVE_OVERWRITE);


J2KCompressionRatio example for Visual C++ 4.0
J2KCompressionRatio example for C++ 4.0 and later

   // save a JPEG2000 file using 100:1 comp ratio
   m_LEAD1.SetJ2KCompressionControl(J2K_COMP_RATIO);
   m_LEAD1.SetJ2KCompressionRatio(100.0f);
   m_LEAD1.Save("c:\\temp\\100_to_1.j2k", FILE_J2K, 0, 0, SAVE_OVERWRITE);


J2KROIControl Example for Visual C++ 4.0
J2KROIControl Example for C++ 4.0 and later

   m_LEAD1.J2KSetDefaults();
   // Set our options
   m_LEAD1.SetJ2KCompressionRatio(1000);
   m_LEAD1.SetJ2KCompressionControl(J2K_COMP_RATIO);
   m_LEAD1.SetJ2KUseROI(TRUE);
   m_LEAD1.SetJ2KROIControl(J2K_USEOPTION_RECT);
   m_LEAD1.SetJ2KROILeft(200);
   m_LEAD1.SetJ2KROITop(200);
   m_LEAD1.SetJ2KROIWidth(600);
   m_LEAD1.SetJ2KROIHeight(600);

   m_LEAD1.SetJ2KXTsiz(100);
   m_LEAD1.SetJ2KYTsiz(100);
   // Save the bitmap to disk
   m_LEAD1.Save("c:\\image1.j2k", FILE_J2K, 24, 2, SAVE_OVERWRITE);


J2KSetDefaults example for Visual C++ 4.0
J2KSetDefaults example for C++ 4.0 and later

   CString msg;
   char  s[50];

   // Display all the default JPEG2000 advanced options
   m_LEAD1.J2KSetDefaults();

   msg = msg + "J2KUseColorTransform = " + _itoa(m_LEAD1.GetJ2KUseColorTransform(), s, 10) + "\r\n";
   msg = msg + "J2KDerivedQuantization = " + _itoa(m_LEAD1.GetJ2KDerivedQuantization(), s, 10) + "\r\n";

   msg = msg + "J2KXOsiz = " + _itoa(m_LEAD1.GetJ2KXOsiz(), s, 10) + "\r\n";
   msg = msg + "J2KYOsiz = " + _itoa(m_LEAD1.GetJ2KYOsiz(), s, 10) + "\r\n";
   msg = msg + "J2KXTsiz = " + _itoa(m_LEAD1.GetJ2KXTsiz(), s, 10) + "\r\n";
   msg = msg + "J2KYTsiz = " + _itoa(m_LEAD1.GetJ2KYTsiz(), s, 10) + "\r\n";
   msg = msg + "J2KXTOsiz = " + _itoa(m_LEAD1.GetJ2KXTOsiz(), s, 10) + "\r\n";
   msg = msg + "J2KYTOsiz = " + _itoa(m_LEAD1.GetJ2KYTOsiz(), s, 10) + "\r\n";

   msg = msg + "J2KDecompLevel = " + _itoa(m_LEAD1.GetJ2KDecompLevel(), s, 10) + "\r\n";
   msg = msg + "J2KProgressOrder = " + _itoa(m_LEAD1.GetJ2KProgressOrder(), s, 10) + "\r\n";
   msg = msg + "J2KCodBlockWidth = " + _itoa(m_LEAD1.GetJ2KCodBlockWidth(), s, 10) + "\r\n";
   msg = msg + "J2KCodBlockHeight = " + _itoa(m_LEAD1.GetJ2KCodBlockHeight(), s, 10) + "\r\n";

   msg = msg + "J2KCBS_SelectiveACBypass = " + _itoa(m_LEAD1.GetJ2KCBS_SelectiveACBypass(), s, 10) + "\r\n";
   msg = msg + "J2KCBS_ResetContextOnBoundaries = " + _itoa(m_LEAD1.GetJ2KCBS_ResetContextOnBoundaries(), s, 10) + "\r\n";
   msg = msg + "J2KCBS_TerminationOnEachPass = " + _itoa(m_LEAD1.GetJ2KCBS_TerminationOnEachPass(), s, 10) + "\r\n";
   msg = msg + "J2KCBS_VerticallyCausalContext = " + _itoa(m_LEAD1.GetJ2KCBS_VerticallyCausalContext(), s, 10) + "\r\n";
   msg = msg + "J2KCBS_PredictableTermination = " + _itoa(m_LEAD1.GetJ2KCBS_PredictableTermination(), s, 10) + "\r\n";
   msg = msg + "J2KCBS_ErrorResilienceSymbol = " + _itoa(m_LEAD1.GetJ2KCBS_ErrorResilienceSymbol(), s, 10) + "\r\n";

   msg = msg + "J2KGuardBits = " + _itoa(m_LEAD1.GetJ2KGuardBits(), s, 10) + "\r\n";
   msg = msg + "J2KDerivedBaseMantissa = " + _itoa(m_LEAD1.GetJ2KDerivedBaseMantissa(), s, 10) + "\r\n";
   msg = msg + "J2KDerivedBaseExponent = " + _itoa(m_LEAD1.GetJ2KDerivedBaseExponent(), s, 10) + "\r\n";

   msg = msg + "J2KUseSOPMarker = " + _itoa(m_LEAD1.GetJ2KUseSOPMarker(), s, 10) + "\r\n";
   msg = msg + "J2KUseEPHMarker = " + _itoa(m_LEAD1.GetJ2KUseEPHMarker(), s, 10) + "\r\n";

   MessageBox(msg);


J2KTargetFileSize example for Visual C++ 4.0
J2KTargetFileSize example for C++ 4.0 and later

   // save a 30K JPEG2000 file
   m_LEAD1.SetJ2KCompressionControl(J2K_COMP_TARGETSIZE);
   m_LEAD1.SetJ2KTargetFileSize(30 * 1024);
   m_LEAD1.Save("c:\\temp\\30k.j2k", FILE_J2K, 0, 0, SAVE_OVERWRITE);


KeyDown (ImageList Control) example for C++ 4.0 and later

void CTttDlg::OnKeyDown Leadimglistctrl1(short KeyCode, short Shift)
{
   AfxMessageBox("KeyDown event");
}


KeyPress (ImageList Control) example for C++ 4.0 and later

void CTttDlg::OnKeyPress Leadimglistctrl1(short KeyAscii)
{
   AfxMessageBox("KeyPress event!");
}


KeyPress example for Visual C++ 4.0
KeyPress example for C++ 4.0 and later

Note: 	This example failed during testing, because MFC 4.0 did not pass the KeyPress event. However the ScaleMode code inside the if statement will work if you use it in another event, such as a command button's click event.

VOID COcxtestDlg::Lead1_OnKeyPress(short FAR * KeyAscii)
{
  // This is example uses the KeyPress event to implement a custom scale mode.
  // There is no particular reason to put this code in this event, except that
  // we needed examples of both the event and the scale mode.
  if (*KeyAscii == 67) // Uppercase C
  {
    // This example sets a custom scale mode and uses it to crop the
    // display. Keep in mind that the actual height and width do not change.
    // Only the unit of measure changes.

    // Change the scale so that origin is moved one-third right and one-third down
    m_Lead1.SetScaleLeft(-1.0f);
    m_Lead1.SetScaleTop(-1.0f);
    m_Lead1.SetScaleWidth(3.0f);
    m_Lead1.SetScaleHeight(3.0f);
    // Crop the display so that it takes up the middle third of the height and width
    m_Lead1.SetDstClipLeft(0.0f);
    m_Lead1.SetDstClipTop(0.0f);
    m_Lead1.SetDstClipWidth(1.0f);
    m_Lead1.SetDstClipHeight(1.0f);
    m_Lead1.ForceRepaint();
  }
}


KeyUp (ImageList Control) example for C++ 4.0 and later

void CTttDlg::OnKeyUp Leadimglistctrl1(short KeyCode, short Shift)
{
   AfxMessageBox("KeyUp event!");
}


LevelLowBit example for Visual C++ 4.0
LevelLowBit example for C++ 4.0 and later

This is also the example for LevelHighBit.

This example sets LevelLowBit and LevelHighBit to display the image using only the eight least significant bits.

    m_Lead1.SetAutoRepaint(FALSE);
    //use least significant 8 bits
    m_Lead1.SetLevelLowBit(0);
    m_Lead1.SetLevelHighBit(7);

    m_Lead1.SetAutoRepaint(TRUE);


LevelLUT example for Visual C++ 4.0
LevelLUT example for C++ 4.0 and later

This is also the example for MinVal property and MaxVal property.

The following example sets LevelLowBit and LevelHighBit to use all bits. It then gets the minimum and maximum bits and intensity values for the image, and sets the LUT so that pixels with values in the minimum range are mapped to the color RED, while pixels with values in the maximum range are mapped to BLUE.

    long min;
    long max;
    long i;

    m_Lead1.SetAutoRepaint(FALSE);
    //use all bits
    m_Lead1.SetLevelLowBit(0);
    m_Lead1.SetLevelHighBit(m_Lead1.GetBitmapBits() - 1);

    m_Lead1.GetMinMaxBits();
    m_Lead1.GetMinMaxVal();
    max = m_Lead1.GetMaxVal();
    min = m_Lead1.GetMinVal();

    //set LUT so that min range maps to RED and max range maps to BLUE
    for( i=min; i<min+100; i++ )
        m_Lead1.SetLevelLUT(i, RGB(255, 0, 0));
    for( i=max-100; i<max; i++ )
        m_Lead1.SetLevelLUT(i, RGB(0, 0, 255));

    m_Lead1.SetAutoRepaint(TRUE);


LevelLUTLength example for Visual C++ 4.0
LevelLUTLength example for C++ 4.0 and later

This example writes out the number of entries in the LUT.

    CString cs;
    cs.Format("%d", m_Lead1.GetLevelLUTLength());
    m_Edit5.SetWindowText(cs);


LineProfile example for C++ 5.0 and later

   long maxR = 0, maxG = 0, maxB = 0;
   int i;
   m_Lead1.LineProfile(10, 10, 220, 120);
   for(i=0; i<m_Lead1.GetLineProfileSize(); ++i)
   {
      if(m_Lead1.GetLineProfileRed(i) > maxR) maxR = m_Lead1.GetLineProfileRed(i);
      if(m_Lead1.GetLineProfileGreen(i) > maxG) maxG = m_Lead1.GetLineProfileGreen(i);
      if(m_Lead1.GetLineProfileBlue(i) > maxB) maxB = m_Lead1.GetLineProfileBlue(i);
   }
   CString msg;
   msg.Format("maxR=%ld, maxG=%ld, maxB=%ld", maxR, maxG, maxB);
   AfxMessageBox(msg);


LineRemove example for Visual C++ 4.0
LineRemove example for C++ 4.0 and later

   short nRet;
   //Line Remove
   //This examples removes vertical lines that are at least 200 pixels in length
   //and no more than 5 pixels in width
   //The lines can have gaps up to two pixels in length
   //The LineRemove Event is used to display information about each line removed
   nRet = m_LEAD1.LineRemove(LINE_USE_GAP, 200, 5, 7, 10, 2, 0, LINEREMOVE_HORIZONTAL);

void CDoccleanDlg::OnLineRemoveLeadctrl1(long nStartRow, long nStartCol, long nLength, long hRgnLine)
{
   CString csOut;
   csOut.Format("Line at %d,%d Length=%d", nStartRow, nStartCol, nLength);
   OutputDebugString(csOut);
}


Load (Mixed Raster Content Control)example for Visual C++ 4.0
Load (Mixed Raster Content Control) example for C++ 4.0 and later

   long nPages;
   m_LeadMrc1.SetEnableMethodErrors(TRUE);
   m_LeadMrc1.GetPagesCount("d:\\temp\\testT44.mrc", &nPages);
   CString msg;
   msg.Format("File has %ld pages", nPages);
   SetWindowText(msg);
   // load last page
   m_LeadMrc1.Load("d:\\temp\\testT44.mrc", nPages);
   m_Lead1.SetBitmap(m_LeadMrc1.GetBitmap());


LoadArray example for Visual C++ 4.0
LoadArray example for C++ 4.0 and later

   long lCount;
   COleVariant MyVar;
   HFILE hFile;
   HGLOBAL hData=NULL;
   void FAR* pData=NULL;
   SAFEARRAY FAR *psa;
   SAFEARRAYBOUND rgsabound[1];

   MyVar.Clear();

   hFile = _lopen("d:\\temp\\test.cmp", OF_READ);
   lCount = _llseek(hFile, 0, SEEK_END);
   _llseek(hFile, 0, SEEK_SET);
   hData = GlobalAlloc(GMEM_MOVEABLE, lCount);
   pData = GlobalLock(hData);

   _lread(hFile, pData, lCount);

   rgsabound[0].lLbound = 0;
   rgsabound[0].cElements = lCount;
   psa = SafeArrayCreate(VT_UI1, 1, rgsabound);

   SafeArrayLock(psa);
#ifdef WIN32
   memcpy(psa->pvData, pData, lCount);
#else
   unsigned int uCopy;
   unsigned long dwBytes;
   unsigned char _huge *pDst=NULL;
   unsigned char _huge *pSrc=NULL;

   pDst = (unsigned char _huge *)psa->pvData;
   pSrc = (unsigned char _huge *)pData;
   dwBytes = lCount;
   while (dwBytes)
   {
      uCopy = (unsigned int) min (dwBytes, 0x0FFFEUL);
      _fmemcpy(pDst, pSrc, uCopy);
      dwBytes -= uCopy;
      pDst += uCopy, pSrc += uCopy;
   }
#endif
   SafeArrayUnlock(psa);

   V_VT(&MyVar) = (VT_ARRAY | VT_UI1);
   V_ARRAY(&MyVar) = psa;

   GlobalUnlock(hData);
   GlobalFree(hData);

   m_LEAD1.LoadArray(MyVar, 0, 0, -1, lCount);
   _lclose(hFile);


LoadFromFile (ImageList Control) example for C++ 4.0 and later

   //Insert all pages from a multipage file
   m_LEADImgList1.LoadFromFile("d:\\temp\\img\\test1.tif", 0, 0, -1);
   CString csOut;
   csOut.Format("Inserted %ld Items!", m_LEADImgList1.GetCount());
   AfxMessageBox(csOut);


LoadCompressed example for Visual C++ 4.0
LoadCompressed example for C++ 4.0 and later

m_Lead1.SetLoadCompressed(COMP_NONE);
// now "test.tif" will be loaded uncompressed
m_Lead1.Load("test.tif",0,0,1);


LoadDatabase Example for Visual C++ 4.0
LoadDatabase Example for C++ 4.0 and later

   //load existing db
   m_LEADImgList1.LoadDatabase("c:\\temp\\testdb6.tif");


LoadIFD example for Visual C++ 4.0
LoadIFD example for C++ 4.0 and later

// All examples will assume that "test.tif" has over 1002 images
// This example will load pages 1000 and 1001 after getting the information for page 1000:
m_Lead1.GetFileInfo("test.tif", 1000, 0);
// Setting LoadIFD to InfoIFD indicates that 1000 is treated as page 1
m_Lead1.SetLoadIFD(m_Lead1.GetInfoIFD());
m_Lead1.Load("test.tif", 0, 1, 2);
// Reset LoadIFD to 0 so other TIF files will be handled properly
m_Lead1.SetLoadIFD(0);


LoadInfo example for Visual C++ 4.0
LoadInfo... example for C++ 4.0 and later

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.	Edit TUTORDLG.H and insert the following lines in the definition of CTutorDlg after DECLARE_MESSAGE_MAP():

// Declare variables for demonstrating raw FAX.
int MyInfoBits;
long MyInfoFlags;
int MyInfoFormat;
float MyInfoHeight;
long MyInfoOffset;
float MyInfoWidth;
int MyInfoXRes;
int MyInfoYRes;

3.	 Add a CommandButton control and code its click procedure as follows:

void CTutorDlg::OnButton1()
{
  m_Lead1.SetScaleMode(3); // Pixels

  // Make the image look OK as a 1-bit image.
  m_Lead1.Size(m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight(), RESIZE_RESAMPLE);
  m_Lead1.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 = m_Lead1.GetBitmapHeight();
  MyInfoOffset = 0;
  MyInfoWidth = m_Lead1.GetBitmapWidth();
  MyInfoXRes = m_Lead1.GetBitmapXRes();
  MyInfoYRes = m_Lead1.GetBitmapYRes();

  // Save the image as raw FAX; then load the saved file.
  // Format information will be supplied in the LoadInfo event.
  m_Lead1.Save("c:\\lead\\images\\tmp.tif", FILE_FAX_G3_2D, 1, 1, SAVE_OVERWRITE);
  m_Lead1.Load("c:\\lead\\images\\tmp.tif", 0, 0, 1);

  // Repaint the newly loaded image.
  m_Lead1.ForceRepaint();

}

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

void CTutorDlg::OnLoadInfoLead1()
{
   // Use the form-level variables to supply format information.
  m_Lead1.SetLoadInfoBits( MyInfoBits);
  m_Lead1.SetLoadInfoFlags( MyInfoFlags);
  m_Lead1.SetLoadInfoFormat( MyInfoFormat);
  m_Lead1.SetLoadInfoHeight( MyInfoHeight);
  m_Lead1.SetLoadInfoOffset( MyInfoOffset);
  m_Lead1.SetLoadInfoWidth( MyInfoWidth);
  m_Lead1.SetLoadInfoXRes( MyInfoXRes);
  m_Lead1.SetLoadInfoYRes( MyInfoYRes);
}

5.	Run your program to test it.


LoadICCProfile example for Visual C++

   VARIANT Data;
   FILE *fp;
   int nRet;
   long uBound;

   VariantInit(&Data);

   fp = fopen(TEXT("c:\\MyICC.ICM"),"wb");

   nRet = Lead1.LoadICCProfile ("c:\\dst_rgb_image.tif", &Data, 1);
   SafeArrayGetUBound(Data.parray, 1, &uBound);

   for(long i =0;i<(uBound+1);++i)
   {
      int tmp;
      SafeArrayGetElement(Data.parray, &i, &tmp);
      fwrite(&tmp,1,1,fp);
   }

   VariantClear(&Data);
   fclose(fp);


LoadMemory example for Visual C++ 4.0
LoadMemory example for C++ 4.0 and later

This example uses WIN32 API calls to load a file into memory, then uses the LoadMemory method to load the memory-resident file into a bitmap.

void CTutorDlg::OnLoadMemory()
{
   HFILE    hf;
   HGLOBAL  hMem;
   LPSTR    lpMem;
   long     iSize;
   OFSTRUCT of;

   if( (hf = OpenFile( "c:\\lead\\images\\image1.cmp", &of, OF_READ )) ==   HFILE_ERROR )
   {
      MessageBox( "Error opening file!" );
      return;
   }

   iSize = _llseek( hf, 0, SEEK_END );

   _llseek( hf, 0, SEEK_SET );

   if( (hMem = GlobalAlloc( GMEM_MOVEABLE, iSize)) == NULL )
   {
      _lclose( hf );
      MessageBox( "Not enough memory to hold the file in memory!" );
      return;
   }

   if( (lpMem = (LPSTR)GlobalLock(hMem)) == NULL )
   {
      _lclose( hf );
      GlobalFree( hMem );
      MessageBox( "Not enough memory to hold the file in memory!" );
      return;
   }

   if( _hread( hf, lpMem, iSize) != iSize )
   {
      _lclose( hf );
      GlobalUnlock( hMem );
      GlobalFree( hMem );
      MessageBox( "Error reading file" );
      return;
   }

   _lclose( hf );

   GlobalUnlock( hMem );

   if( m_Lead.LoadMemory( (OLE_HANDLE)hMem, 0, 0, -1, iSize ) )
      MessageBox( "Error calling LoadMemory" );
   else
      MessageBox( "LoadMemory succeeded" );

   GlobalFree( hMem );
}


LoadResize example for Visual C++ 4.0
LoadResize example for C++ 4.0 and later

   m_Lead1.LoadResize("c:\\temp\\test1.cmp", 60, 80, RESIZE_RESAMPLE, 0);


LoadUseViewPerspective example for Visual C++ 4.0
LoadUseViewPerspective example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example times the loading of a bitmap with and without changing the internal view perspective.

// Declare local variables.
CTime StartTime, EndTime;
CTimeSpan DeltaTime;

// Do not include paints when measuring time.
m_Lead1.SetAutoRepaint (FALSE);

// Time the load using the bitmap's view perspective.
m_Lead1.SetLoadUseViewPerspective (TRUE);
StartTime = CTime::GetCurrentTime();

m_Lead1.Load ("d:\\lead\\images\\rotated.tif", 0, 0, 1);
EndTime = CTime::GetCurrentTime();
DeltaTime = EndTime - StartTime;
MessageBox (DeltaTime.Format("%S seconds loaded as is" ), "Notice", MB_OK);

// Time the load that converts the bitmap's view perspective.
m_Lead1.SetLoadUseViewPerspective (FALSE);
StartTime = CTime::GetCurrentTime();

m_Lead1.Load ("d:\\lead\\images\\rotated.tif", 0, 0, 1);
EndTime = CTime::GetCurrentTime();
DeltaTime = EndTime - StartTime;
MessageBox (DeltaTime.Format("%S seconds converted on load" ), "Notice", MB_OK);


MagGlassPaintContrast example for Visual C++ 4.0
MagGlassPaintContrast example for C++ 4.0 and later

void CSampleDlg::StartMagnifyingGlass()
{
   int      nRet;
   CString  szMsg;

   // Setting the Magnifying Glass Paint contrast, gamma and intensity
   m_Lead1.SetMagGlassPaintContrast(m_Lead1.GetMagGlassPaintContrast() + 100);
   m_Lead1.SetMagGlassPaintGamma(m_Lead1.GetMagGlassPaintGamma() + 100);
   m_Lead1.SetMagGlassPaintIntensity(m_Lead1.GetMagGlassPaintIntensity() + 100);

   // Starting the Magnifying Glass
   nRet = m_Lead1.StartMagGlass(100, 100, 400, RGB(255, 0, 0), RGB(128, 128, 128), false, 1, false, CROSSHAIR_FINE, true, true);
   if (nRet != 0)
   {
      szMsg.Format("Error Starting the Magnifying Glass, Error: %d", nRet);
      AfxMessageBox(szMsg);
   }
}


MaxFilter example for Visual C++ 4.0
MaxFilter example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example erodes dark objects and repaints the image.

m_Lead1.MaxFilter(3);
m_Lead1.ForceRePaint();


Median example for Visual C++ 4.0
Median example for C++ 4.0 and later

This example applies a median filter with a 3x3 neighborhood and redisplays the bitmap.

m_Lead1.Median(3);
m_Lead1.ForceRepaint();


MinFilter example for Visual C++ 4.0
MinFilter example for C++ 4.0 and later

Note: This topic is for Document/Medical  only.

This example dilates dark objects and repaints the image.

m_Lead1.MinFilter(3);
m_Lead1.ForceRePaint();


Mosaic example for Visual C++ 4.0
Mosaic example for C++ 4.0 and later

This example applies a mosaic effect with 8x8 tiles and redisplays the bitmap.

m_Lead1.Mosaic(8);
m_Lead1.ForceRepaint();


MotionBlur example for C++ 5.0 and later

   m_Lead1.MotionBlur(12, 4500, FALSE);


MouseDown (ImageList Control) example for C++ 4.0 and later

void CTttDlg::OnMouseDownLeadimglistctrl1(short Button, short Shift, float x, float y)
{
   long lItem;

   lItem = m_LEADImgList1.HitTest(x, y);

   if(lItem >= 0)
   {
      CLEADImageListItem LEADItem;
      m_LEADImgList1.SetSelectionColor(RGB(255, 0, 0));
      LEADItem = m_LEADImgList1.Item(lItem);
      LEADItem.SetSelected (TRUE);
   }
}

void CTttDlg::OnMouseUpLeadimglistctrl1(short Button, short Shift, float x, float y)
{
   long lItem;

   lItem = m_LEADImgList1.HitTest(x, y);

   if(lItem >= 0)
   {
      CLEADImageListItem LEADItem;
      m_LEADImgList1.SetSelectionColor(RGB(0, 0, 255));
      LEADItem = m_LEADImgList1.Item(lItem);
      LEADItem.SetSelected (TRUE);
   }
}


MouseMove (ImageList Control) example for C++ 4.0 and later

void CTttDlg::OnMouseMove Leadimglistctrl1(short Button, short Shift, float x, float y)
{
   CString csOut;
   csOut.Format("X: %ld, Y: %ld", (long)x, (long)y);
   SetWindowText(csOut);
}

void CTttDlg::OnClick Leadimglistctrl1()
{
   long lItem;

   lItem = m_LEADImgList1.HitTest(100.0f, 100.0f); //check a location

   if(lItem >= 0)
   {
      CLEADImageListItem LEADItem;
      LEADItem = m_LEADImgList1.Item(lItem);
      m_LEADImgList1.SetSelectionColor(RGB(0, 0, 255));
      LEADItem.SetSelected (TRUE);
   }
}


MousePointer (ImageList Control) example for C++ 4.0 and later

m_LEADImgList1.SetMousePointer(5);


MouseWheel (Main Control) example for C++ 4.0 and later

void CMyClass::OnMouseWheel(short nDelta, short Shift, long x, long y)
{
   if (Shift ==2) //CONTROL Key is Pressed
   {
         if(nDelta < 0)
         {
            if (m_Lead1.GetPaintZoomFactor() < 100 * 16)
            {
               m_Lead1.SetPaintZoomFactor(m_Lead1.GetPaintZoomFactor() * 2);
            }
         }
         else
         {
            if (m_Lead1.GetPaintZoomFactor() > 100 / 16)
               m_Lead1.SetPaintZoomFactor( m_Lead1.GetPaintZoomFactor() / 2);
         }
   }
   else
   {
      m_Lead1.GetVScrollInfo().SetPos(m_Lead1.GetVScrollInfo().GetPos() - nDelta);
   }
}

void CMyClass::OnLoad()
{
   m_Lead1.Load ("c:\\1.bmp",0,0,1);
   m_Lead1.SetEnableMouseWheel(TRUE);
}


ODBC Example for Visual C++ 4.0
ODBC Example for C++ 4.0 and later

Take the following steps to create and use a simple database, containing only images. (For a more sophisticated approach, refer to Using ODBC to Access Image Data.)

Note:	The LEADTOOLS ActiveX requires ODBC drivers that can properly handle long binary fields. Examples have been tested and will work with version 3.0 of the Microsoft ODBC Desktop Driver Pack. (This driver pack ships with Access 95 and works on 32-bit systems.) You can download drivers from the LEAD BBS or CompuServe forum. The CompuServe forum is at GO LEADTECH.  The web page is ftp://ftp.leadtools.com/pub/utils/ODBC32.zip. The file to download is ODBC32.ZIP.

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

Note:	This example changes the initialization of the window; so using a copy of the original project prevents problems with later reuse of the original project.

2.	Create an ODBC data source, and name it LEADACCESS. The data source should have one long binary field, the table name should be ltvcpic and the field name should be photo. For a description of how to create an appropriate data source, refer to Using ODBC to Access Image Data.

3.	Edit the TUTORDLG.CPP member function CTutorDlg::OnInitDialog.  After the comment // TODO: Add extra initialization here, replace the code with the following:

// Position and size the main form so that it takes up most of the screen.
float Width = GetSystemMetrics(SM_CXSCREEN) * 0.9f;
float Height = GetSystemMetrics(SM_CYSCREEN) * 0.8f;
float Left = (GetSystemMetrics(SM_CXSCREEN) - Width) / 2.0f;
float Top = (GetSystemMetrics(SM_CYSCREEN) - Height) / 2.0f;
MoveWindow((int) Left, (int) Top, (int) Width, (int) Height);
m_Lead1.SetAutoRepaint(FALSE); // Take control of when the image paints
m_Lead1.SetPaintPalette(PAINTPALETTE_AUTO);
m_Lead1.SetEnableMethodErrors(FALSE);

// Make first param "ODBC;" to select data source from a listbox.
int nRet = m_Lead1.dbOpen("ODBC;DSN=LEADACCESS", "ltvcpic", "photo", 0);
if (nRet)
{
  GetDlgItem(IDC_FIRST)->EnableWindow(FALSE);
  GetDlgItem(IDC_PREV)->EnableWindow(FALSE);
  if (m_Lead1.GetDbIsEOF() && m_Lead1.GetDbIsBOF())
  {
    GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
    GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);
  }

  m_Lead1.dbMoveFirst();
  m_Lead1.SetDbLoadBits(0);
  m_Lead1.SetDbLockingMode(DB_LOCKINGMODE_OPTIMISTIC);
  ImageInit();
}
return TRUE;

4.	Edit the TUTORDLG.H file. After the line DECLARE_MESSAGE_MAP() in the class CTutorDlg, add the following line:

VOID ImageInit();

5.	Edit the TUTORDLG.CPP file.  Add the following member function.

VOID CTutorDlg::ImageInit()
{
CWaitCursor wait;  // display hourglass

float HeightFactor;
float WidthFactor;
float HeightAllowed;
float WidthAllowed;
float Width = GetSystemMetrics(SM_CXSCREEN) * 0.9f;
float Height = GetSystemMetrics(SM_CYSCREEN) * 0.8f;
float Left = (GetSystemMetrics(SM_CXSCREEN) - Width) / 2.0f;
float Top = (GetSystemMetrics(SM_CYSCREEN) - Height) / 2.0f;
if (m_Lead1.GetBitmap() == 0)
{
  m_Lead1.ForceRepaint();
  return;
}
// Set the variables used for preserving the aspect ratio.
// Allow for a border of 1/8 of the form size.
// The units of measure do not matter, since we are calculating proportions.
HeightFactor = m_Lead1.GetBitmapHeight();
WidthFactor = m_Lead1.GetBitmapWidth();
CRect rcWindow;
GetClientRect(rcWindow);
HeightAllowed = rcWindow.Height() * 3.0f / 4;
WidthAllowed = rcWindow.Width() * 3.0f / 4;
// Center the LEAD control on the form, preserving the aspect ratio.
// Check to see if using the maximum width will make the image too tall.
// Set the dimensions based on the result.
if(((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed)
{
  Left = rcWindow.Width() / 8.0f;
  Width = WidthAllowed;
  Height = (Width * HeightFactor) / WidthFactor;
  Top = (rcWindow.Height() - Height) / 2;
}
else
{
  Top = rcWindow.Height() / 8.0f;
  Height = HeightAllowed;
  Width = (Height * WidthFactor) / HeightFactor;
  Left = (rcWindow.Width() - Width) / 2;
}
rcWindow.SetRect(0, 0, (int) Width, (int) Height);
rcWindow.OffsetRect((int) Left, (int) Top);
m_Lead1.MoveWindow(rcWindow);
// Turn off scroll bars to make sure we use the full client area.
m_Lead1.SetAutoScroll(FALSE);
// Set the image display size to match the LEAD control
m_Lead1.SetDstRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.SetDstClipRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
// Display the image
m_Lead1.ForceRepaint(); // Repaint the image
}

6.	In this step and the next one, change the resource file to add some buttons. For the first button, do the following:

a.	Click on the ResourceView tab of the Project Workspace.

b.	Double-click on the tutor resources folder.

c.	Double-click on Dialog.

d.	Double-click on IDD_TUTOR_DIALOG.

e.	Select the command button control on the Controls toolbar.

f.	Click and drag on the dialog window to create and position the button.

g.	Double-click the button just created to bring up the Push Button Properties window.

h.	Change the ID to IDC_ADDNEW and the caption to Add New.

i.	Close the window.

7.	For the other buttons, repeat Step 6 with the following differences for each button:

- With an ID of IDC_LOAD and caption Load

- With an ID of IDC_UPDATE and caption Update

- With an ID of IDC_DELETE and caption Delete

- With an ID of IDC_FIRST and caption |<

- With an ID of IDC_PREV and caption <

- With an ID of IDC_NEXT and caption >

- With an ID of IDC_LAST and caption >|

8.	Select the CANCEL button and press DEL to remove it.

9.	Double-click the OK button and rename it to Exit.

10.	Press CTRL-F4 twice and answer YES to the message to save.

11.	Add code for the IDC_FIRST button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_FIRST.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnFirst).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CTutorDlg::OnFirst()
{
  CWaitCursor wait;  // display hourglass

  if (m_Lead1.GetDbIsEOF() && m_Lead1.GetDbIsBOF())
  {
  MessageBox("The database is empty", "NOTICE", MB_OK);
  GetDlgItem(IDC_FIRST)->EnableWindow(FALSE);
  GetDlgItem(IDC_PREV)->EnableWindow(FALSE);
  GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
  GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);
  }
  else
  {
  m_Lead1.dbMoveFirst();
  // Viewed image is in the database (after repaint)
  CWnd *pButton = GetDlgItem(IDC_UPDATE);
  pButton->SetWindowText("Update");

  GetDlgItem(IDC_FIRST)->EnableWindow(FALSE);
  GetDlgItem(IDC_PREV)->EnableWindow(FALSE);

  GetDlgItem(IDC_LAST)->EnableWindow(TRUE);
  GetDlgItem(IDC_NEXT)->EnableWindow(TRUE);
  }
  ImageInit();
}

12.	Add code for the IDC_PREV button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_PREV.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnPrev).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CTutorDlg::OnPrev()
{
  CWaitCursor wait;  // display hourglass
  if (!m_Lead1.GetDbIsBOF())
  {
  m_Lead1.dbMovePrev();
  // Viewed image is in the database (after repaint)
  CWnd *pButton = GetDlgItem(IDC_UPDATE);
  pButton->SetWindowText("Update");
  }

  // don't combine with above as an else case!
  if (m_Lead1.GetDbIsBOF())     // BOF
  {
  GetDlgItem(IDC_FIRST)->EnableWindow(FALSE);
  GetDlgItem(IDC_PREV)->EnableWindow(FALSE);

  if (!m_Lead1.GetDbIsEOF())
  {
    m_Lead1.dbMoveNext(); // move off BOF
    MessageBox("Already at first record", "NOTICE", MB_OK);
  }
  else  // BOF && EOF
  {
     GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
     GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);
  }
  }
  else
  {
  GetDlgItem(IDC_LAST)->EnableWindow(TRUE);
  GetDlgItem(IDC_NEXT)->EnableWindow(TRUE);

  ImageInit();
  }
}

13.	Add code for the IDC_NEXT button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_NEXT.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnNext).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CTutorDlg::OnNext()
{
  CWaitCursor wait;  // display hourglass

  if (!m_Lead1.GetDbIsEOF())
  {
  m_Lead1.dbMoveNext();
  // Viewed image is in the database (after repaint)
  CWnd *pButton = GetDlgItem(IDC_UPDATE);
  pButton->SetWindowText("Update");
  }

  // don't combine with above as an else case!
  if (m_Lead1.GetDbIsEOF())   // EOF
  {
   GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
   GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);

   if (!m_Lead1.GetDbIsBOF())
   {
    m_Lead1.dbMovePrev(); // move back from EOF
    MessageBox("Already at last record", "NOTICE", MB_OK);
   }
   else    // EOF && BOF
   {
    GetDlgItem(IDC_FIRST)->EnableWindow(FALSE);
    GetDlgItem(IDC_PREV)->EnableWindow(FALSE);
   }
  }
  else
  {
    GetDlgItem(IDC_FIRST)->EnableWindow(TRUE);
    GetDlgItem(IDC_PREV)->EnableWindow(TRUE);

    ImageInit();
  }
}

14.	Add code for the IDC_LAST button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_LAST.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnLast).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CTutorDlg::OnLast()
{
  CWaitCursor wait;  // display hourglass

  if (m_Lead1.GetDbIsEOF() && m_Lead1.GetDbIsBOF())
  {
    MessageBox("The database is empty", "NOTICE", MB_OK);
    GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
    GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);
    GetDlgItem(IDC_FIRST)->EnableWindow(FALSE);
    GetDlgItem(IDC_PREV)->EnableWindow(FALSE);
  }
  else
  {
    m_Lead1.dbMoveLast();

    // Viewed image is in the database (after repaint)
    CWnd *pButton = GetDlgItem(IDC_UPDATE);
    pButton->SetWindowText("Update");

    GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
    GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);

    GetDlgItem(IDC_PREV)->EnableWindow(TRUE);
    GetDlgItem(IDC_FIRST)->EnableWindow(TRUE);
  }
  ImageInit();
}

15.	Add code for the IDC_DELETE button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_DELETE.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnDelete).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CTutorDlg::OnDelete()
{
  CWaitCursor wait;  // display hourglass

  char buffer[10];
  if (m_Lead1.GetDbCanUpdate() == FALSE)
  {
    MessageBox("You cannot update this database.", "ERROR");
    return;
  }
  CWnd *pButton = GetDlgItem(IDC_UPDATE);
  pButton->GetWindowText(buffer, 7);
  // Update button's text will be UPDATE if an image has been loaded but
  // not updated.
  if (isupper(buffer[1]))
  {
    MessageBox("Viewed image is not in database", "ERROR", MB_OK);
    // User can do a MoveNext and MovePrev to see what the current image
    // currently is.
    return;
  }
  if (m_Lead1.GetDbIsEOF() && m_Lead1.GetDbIsBOF())
  {
    MessageBox("The database is empty", "NOTICE", MB_OK);
    GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
    GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);
    GetDlgItem(IDC_FIRST)->EnableWindow(FALSE);
    GetDlgItem(IDC_PREV)->EnableWindow(FALSE);
  }
  else if (!m_Lead1.GetDbIsBOF() && !m_Lead1.GetDbIsEOF())
  {
    if (m_Lead1.GetDbEditMode() == DB_EDITMODE_ADDNEW)
    {
        // User selected Add New and then Delete without an Update.
        // Update the empty record first before deleting it.
        int nRet = m_Lead1.dbUpdate(FILE_CMP, 24, QFACTOR_PQ1);
        if (!nRet)
        {
            m_Lead1.dbMoveLast(); // new records are added to the end
            GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
            GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);

            GetDlgItem(IDC_FIRST)->EnableWindow(TRUE);
            GetDlgItem(IDC_PREV)->EnableWindow(TRUE);
        }
    }

    m_Lead1.dbDelete();

    if (m_Lead1.GetDbIsDeleted() == FALSE)
    {
         MessageBox("Unable to delete record!", "ERROR");
         return;
    }
    if (m_Lead1.GetDbCanRestart() == TRUE)
    {
          m_Lead1.dbRequery();     // moves you to the first image in the database
          GetDlgItem(IDC_PREV)->EnableWindow(FALSE);
          GetDlgItem(IDC_FIRST)->EnableWindow(FALSE);

          if (m_Lead1.GetDbIsEOF())
          {
             GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);
             GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
          }
          else
          {
             GetDlgItem(IDC_NEXT)->EnableWindow(TRUE);
             GetDlgItem(IDC_LAST)->EnableWindow(TRUE);
          }
    }
    else
    {
        m_Lead1.dbMovePrev();
      GetDlgItem(IDC_LAST)->EnableWindow(TRUE);
      GetDlgItem(IDC_NEXT)->EnableWindow(TRUE);

        if (m_Lead1.GetDbIsBOF()) // just before first record
        {
            m_Lead1.dbMoveNext(); // move forward to first record
            GetDlgItem(IDC_FIRST)->EnableWindow(FALSE);
            GetDlgItem(IDC_PREV)->EnableWindow(FALSE);

            if (m_Lead1.GetDbIsEOF())    // just past last record
            {
                // no more records left
                MessageBox("The database is empty", "NOTICE", MB_OK);
                m_Lead1.ForceRepaint();
                GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
                GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);
            }
        }
    }
    ImageInit();
    // Viewed image is in the database (after repaint)
    pButton->SetWindowText("Update");
  }
}

16.	Add code for the IDC_LOAD button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_LOAD.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnLoad).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CTutorDlg::OnLoad()
{
  CFileDialog  OpenFile(TRUE, NULL, "*.*");
  if (OpenFile.DoModal() == IDOK)
  {
        CWaitCursor wait;  // display hourglass

        int nRet = m_Lead1.Load(OpenFile.GetPathName(), 0, 0, 1);
        if (!nRet)
        {
          ImageInit();
          // Remind user that the image has not been updated in the database.
          CWnd *pButton = GetDlgItem(IDC_UPDATE);
          pButton->SetWindowText("UPDATE");
        }
      else
      {
            AfxMessageBox("Error loading image.");
            if (m_Lead1.GetDbEditMode() == DB_EDITMODE_ADDNEW)
                 OnLast(); // cancel Add New
        }

  }
}

17.	Add code for the IDC_UPDATE button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_UPDATE.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnUpdate).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CTutorDlg::OnUpdate()
{
  CWaitCursor wait;  // display hourglass

  int  nRet, nEditMode;
  if (m_Lead1.GetDbCanUpdate() == FALSE)
  {
      MessageBox("You cannot update this database.", "ERROR");
      return;
  }
  // Save Edit mode in a temp variable since dbUpdate() clears the edit mode.
  nEditMode = m_Lead1.GetDbEditMode();
  if ((nEditMode == DB_EDITMODE_NONE) &&
      !m_Lead1.GetDbIsBOF() && !m_Lead1.GetDbIsEOF())
          m_Lead1.dbEdit();
  if (m_Lead1.GetDbEditMode() != DB_EDITMODE_NONE)
  {
    // dbUpdate() clears the EditMode flag.
    nRet = m_Lead1.dbUpdate(FILE_CMP, 24, QFACTOR_PQ1);
    // Viewed image is in the database (after repaint)
    CWnd *pButton = GetDlgItem(IDC_UPDATE);
    pButton->SetWindowText("Update");
    if (!nRet)
    {
        if (nEditMode == DB_EDITMODE_ADDNEW)
        {
            m_Lead1.dbMoveLast();
            GetDlgItem(IDC_LAST)->EnableWindow(FALSE);
            GetDlgItem(IDC_NEXT)->EnableWindow(FALSE);

            GetDlgItem(IDC_FIRST)->EnableWindow(TRUE);
            GetDlgItem(IDC_PREV)->EnableWindow(TRUE);
        }
    }
    else
    {
        char  buffer[50];
        sprintf(buffer, "LEAD Error %d saving image to database.", nRet);
        MessageBox(buffer, "ERROR", MB_OK);
    }
  }
  else
  {
    MessageBox("Sequence Error - no record to update.", "ERROR", MB_OK);
  }
}

18.	Add code for the IDC_ADDNEW button as follows:

a.	Press Ctrl-W to go to the MFC Class Wizard.

b.	In the Class name combo box, select CTutorDlg.

c.	In the Object IDs list box, select IDC_ADDNEW.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnAddnew).

f.	Click the Edit Code button to start entering the code.

g.	Edit the function to appear as follows:

void CTutorDlg::OnAddnew()
{
    CWaitCursor wait;  // display hourglass

    // TODO: Add your control notification handler code here
    if (m_Lead1.GetDbCanAppend() == FALSE)
    {
      MessageBox("You cannot append to this database.", "ERROR");
      return;
    }
    m_Lead1.dbAddNew();
    m_Lead1.ForceRepaint();     // no image for a new record

    wait.Restore();
    OnLoad();
}

19.	Open the ClassWizard (CTRL-W), and do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select CTutorDlg.

c.	In the Messages list box, select WM_DESTROY.

d.	Click the Add function button. Choose OK for the default function name (OnDestroy).

e.	Click the Edit Code button to start entering the code.

f.	Edit the function to appear as follows:

void CTutorDlg::OnDestroy()
{
    CDialog::OnDestroy();

    // TODO: Add your message handler code here
    m_Lead1.dbClose();

}

20.	Rebuild and run the application.


Oilify example for Visual C++ 4.0
Oilify example for C++ 4.0 and later

This example applies an oil-painting effect and repaints the image.

m_Lead1.Oilify(10);
m_Lead1.ForceRePaint();


OLEDropAllowed example for Visual C++ 4.0
OLEDropAllowed example for C++ 4.0 and later

This example toggles the OLEDropAllowed property.

if (m_Lead1.GetOLEDropAllowed() == FALSE)
   m_Lead1.SetOLEDropAllowed(TRUE);
else
   m_Lead1.SetOLEDropAllowed(FALSE);


OLEDropFile example for Visual C++ 4.0
OLEDropFile example for C++ 4.0 and later

This example sets the OLEDropAutoLoad property, based on the input from the MessageBox.

void CTestDlg::OnOLEDropFileLeadctrl1(LPCTSTR pszName)
{
   // when a file is dropped, bring up a dialog box and ask the user
   // whether to load the file or not
   m_Lead1.SetOLEDropAutoLoad(MessageBox(pszName, "Load this file?", MB_YESNO)
       == IDYES);
}


OLEStartDrag (ImageList Control)example for Visual C++ 4.0
OLEStartDrag (ImageList Control) example for C++ 4.0 and later

BOOL COLEDragDropDlg::OnInitDialog()
{
.
.
.
   m_LeadImgList2.SetDisplayItemText(true);
   m_LeadImgList2.SetScrollStyle (IMGLST_SCROLLSTYLE_VERTICAL);
   m_LeadImgList2.SetItemHeight(150);
   m_LeadImgList2.SetItemWidth(150);
   m_LeadImgList2.SetAllowSelection(IMGLST_ALLOWSELECTION_MULTI);

   m_LeadImgList1.LoadFromFile("c:\\1.bmp",0,0,1);
   return TRUE;  // return TRUE  unless you set the focus to a control
}

void COLEDragDropDlg::OnStartDrag()
{
   m_LeadImgList1.SetEnableOLEDragMethod(true);
   m_LeadImgList2.SetEnableOLEDragMethod(true);

   CPictureHolder PicHolder;
   PicHolder.CreateFromIcon(IDR_MAINFRAME);

   m_LeadImgList1.SetOLEDragCursor((IDispatch *)PicHolder.m_pPict);
   m_LeadImgList2.SetOLEDragCursor((IDispatch *)PicHolder.m_pPict);
}

void COLEDragDropDlg::OnStopDrag()
{
   m_LeadImgList1.SetEnableOLEDragMethod(false);
   m_LeadImgList2.SetEnableOLEDragMethod(false);
}

void COLEDragDropDlg::OnImgList1_OLECompleteDrag(short Button, short Shift, long x, long y)
{
   CString tmp;
   tmp.Format("Drag Complete for Item# %d \n",m_LeadImgList1.HitTest(x, y));
   m_strHistory += tmp;
}

void COLEDragDropDlg::OnImgList1_OLEDragOver(short Button, short Shift, long x, long y)
{
   CString tmp;
   tmp.Format("Drag Over Item# %d \n",m_LeadImgList1.HitTest(x, y));
   m_strHistory += tmp;
}

void COLEDragDropDlg::OnImgList1_OLEGiveFeedback()
{
m_LeadImgList1.SetEnableUseDefaultCursor(false);
}

void COLEDragDropDlg::OnImgList1_OLEStartDrag(short Button, short Shift, long x, long y)
{
   CString tmp;
   tmp.Format("Drag Start for Item# %d \n",m_LeadImgList1.HitTest(x, y));
   m_strHistory += tmp;
}

void COLEDragDropDlg::OnShowHistory()
{
   MessageBox(m_strHistory);
}


OLEStartDrag (Main Control) example for Visual C++ 4.0
OLEStartDrag (Main Control) example for C++ 4.0 and later

BOOL COLEDragDropDlg::OnInitDialog()
{
.
.
.
   m_Lead1.Load("c:\\test.cmp",0,0,1);
   return TRUE;  // return TRUE  unless you set the focus to a control
}
void COLEMainOCXDlg::OnStartDrag()
{
   m_Lead1.SetEnableOLEDragMethod(true);
   m_Lead2.SetEnableOLEDragMethod(true);

   CPictureHolder PicHolder;
   PicHolder.CreateFromIcon(IDR_MAINFRAME);

   m_Lead1.SetOLEDragCursor((IDispatch *)PicHolder.m_pPict);
   m_Lead2.SetOLEDragCursor((IDispatch *)PicHolder.m_pPict);
}

void COLEMainOCXDlg::OnStopDrag()
{
   m_Lead1.SetEnableOLEDragMethod(false);
   m_Lead2.SetEnableOLEDragMethod(false);
}

void COLEMainOCXDlg::OnLEAD1_OLEStartDrag(short Button, short Shift, long x, long y)
{
   CString tmp;
   tmp.Format("Drag Started at Pos (%d,%d)\n",x,y);
   m_strHistory += tmp;
}

void COLEMainOCXDlg::OnLEAD1_OLECompleteDrag(short Button, short Shift, long x, long y)
{
   CString tmp;
   tmp.Format("Drag Complete at Pos (%d,%d)\n",x,y);
   m_strHistory += tmp;
}

void COLEMainOCXDlg::OnLEAD1_OLEDragOver(short Button, short Shift, long x, long y)
{
   CString tmp;
   tmp.Format("Drag Over at Pos (%d,%d)\n",x,y);
   m_strHistory += tmp;
}

void COLEMainOCXDlg::OnLEAD1_OLEGiveFeedback(BOOL FAR* pbUseDefaultCursor)
{
*pbUseDefaultCursor = false;
}

void COLEMainOCXDlg::OnLEAD2_OLEGiveFeedback(BOOL FAR* pbUseDefaultCursor)
{
*pbUseDefaultCursor = false;
}

void COLEMainOCXDlg::OnHistory()
{
   MessageBox(m_strHistory);
}


OwnerDrawItem event example for Visual C++ 4.0
OwnerDrawItem event example for C++ 4.0 and later

void CXxxxxxDlg::OnOwnerDrawItemLeadimglistctrl1(long nIndex, long hDC, float ItemLeft, float ItemTop, float ItemRight, float ItemBottom, float ItemBackLeft, float ItemBackTop, float ItemBackRight, float ItemBackBottom)
{
   //use Windows GDI to custom paint the items
   //make sure you have previously set ScaleMode to Pixels (3) so
   //that you get these values in Pixels rather than Twips!!!!!!!
   //ex. LEADImgList1.ScaleMode = 3 'pixels

   CString szText;
   szText = m_LEADImgList1.Item(nIndex).GetText();

   Ellipse((HDC)hDC, (long)ItemLeft, (long)ItemTop, (long)ItemRight, (long)ItemBottom);
   TextOut((HDC)hDC, (long)ItemLeft, (long)ItemTop, szText, szText.GetLength());
}


OwnerDrawItems example for Visual C++ 4.0
OwnerDrawItems example for C++ 4.0 and later

   //toggle OwnerDraw
   m_LEADImgList1.SetOwnerDrawItems(!m_LEADImgList1.GetOwnerDrawItems());


PageCount (ImageList Control) example for C++ 4.0 and later

void CTttDlg::OnScroll Leadimglistctrl1()
{
   CString csOut;
   csOut.Format("Page: %ld of %ld",
                m_LEADImgList1.GetCurrentPage(),
                m_LEADImgList1.GetPageCount());
   AfxMessageBox(csOut);
}


Paint event, Enabled property, and hWnd property example for Visual C++ 4.0
Paint event example for C++ 4.0 and later

This example uses some Windows API functions to demonstrate the following:

 Paint event

 Click event

 Enabled property

 hWnd property

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

3.	In the project Workspace, click the ResourceView tab .

4.	Double-click Dialog and double-click IDD_TUTOR_DIALOG to bring up the application's dialog box.

5.	 Add a new button beside the OK button. To do this, select the button control on the Controls toolbar. Then, click and drag to position the button on the dialog box.

6.	Double-click the button and change IDC_BUTTON1 to IDC_TOGGLE. Also, set the Caption to Toggle.

7.	Similarly add a label beneath the Toggle button, naming it IDC_DIRECTIONS, with no Caption.

8.	Close all the windows until you reach the project window, answering yes when asked whether to save the changes.

9.	Edit TUTORDLG.CPP by double-clicking the file.

10.	Near the top of the file (after the last of the preprocessor directives) add the following code:

char ClickEnabledDir[] = "Click on the image for a splat";
char ClickDisabledDir[] = "Click does nothing";
char ClickEnabledTog[] = "&Disable Click";
char ClickDisabledTog[] = "&Enable Click";

11.	In the function BOOL CTutorDlg::OnInitDialog(), add the following code before the return:

// Set toggling values
m_Lead1.SetEnabled(TRUE);
GetDlgItem(IDC_DIRECTIONS)->SetWindowText(ClickEnabledDir);
GetDlgItem(IDC_TOGGLE)->SetWindowText(ClickEnabledTog);

12.	Close the file, choosing Yes when asked whether to save the changes.

13.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select IDC_TOGGLE.

c.	In the Messages list box, select BN_CLICKED.

d.	Click the Add function button. Choose OK for the default function name (OnToggle).

e.	Click the Edit Code button to start entering the code.

14.	Edit the OnToggle function so that it appears as follows:

void CTutorDlg::OnToggle()
{
  if (m_Lead1.GetEnabled())
  {
    m_Lead1.SetEnabled(FALSE);
    GetDlgItem(IDC_DIRECTIONS)->SetWindowText(ClickDisabledDir);
    GetDlgItem(IDC_TOGGLE)->SetWindowText(ClickDisabledTog);
  }
  else
  {
    m_Lead1.SetEnabled(TRUE);
    GetDlgItem(IDC_DIRECTIONS)->SetWindowText(ClickEnabledDir);
    GetDlgItem(IDC_TOGGLE)->SetWindowText(ClickEnabledTog);
  }
}

15.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select IDC_LEAD1.

c.	In the Messages list box, select Click.

d.	Click the Add function button. Choose OK for the default function name (OnClickLead1).

e.	Click the Edit Code button to start entering the code as follows:

void CTutorDlg::OnClickLead1()
{
  HWND hCtl;
  short nScaleMode;
  RECT  MyRect;

  hCtl = (HWND)m_Lead1.GetHWnd();

  nScaleMode = m_Lead1.GetScaleMode();
  m_Lead1.SetScaleMode(3); // Pixels
  MyRect.left = 0;
  MyRect.top = 0;
  MyRect.bottom = (long)m_Lead1.GetScaleHeight();
  MyRect.right = (long)m_Lead1.GetScaleWidth();
  CWnd::FromHandle(hCtl)->InvalidateRect (&MyRect, TRUE);
  m_Lead1.SetScaleMode(nScaleMode);
}

16.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	In the Class name combo box, select CTutorDlg.

b.	In the Object IDs list box, select IDC_LEAD1.

c.	In the Messages list box, select Paint.

d.	Click the Add function button. Choose OK for the default function name (OnPaintLead1).

e.	Click the Edit Code button to start entering the code as follows:

void CTutorDlg::OnPaintLead1()
{
  CDC *LeadClientDC;
  HWND hLeadWnd;
  int xStart, xDelta, xEnd;
  int yStart, yDelta, yEnd;
  int i;
  static int seed = 2;
  srand(seed);
  hLeadWnd = (HWND)m_Lead1.GetHWnd();

  // Create a device context for the control that the GDI functions can access
  LeadClientDC = CDC::FromHandle((HDC)m_Lead1.GetClientDC());

  // Draw random lines on the control. This overlay does not affect the bitmap.
  xStart = (int)((rand() * (long)m_Lead1.GetScaleWidth() / RAND_MAX) + 1);
  yStart = (int)((rand() * (long)m_Lead1.GetScaleHeight() / RAND_MAX) + 1);
  LeadClientDC->MoveTo(xStart, yStart);
  for( i = 1; i < 50; i++)
  {
    xDelta = (int)(81L * rand() / RAND_MAX) - 40;
    yDelta = (int)(81L * rand() / RAND_MAX) - 40;
    xEnd = xStart + xDelta;
    yEnd = yStart + yDelta;
    LeadClientDC->LineTo(xEnd, yEnd);
    LeadClientDC->MoveTo(xStart, yStart);
  }

  // Remove the lock from the device control
  m_Lead1.ReleaseClientDC();
  seed = rand();
}

17.	Rebuild and run the application.


PaintContrast example for Visual C++ 4.0
PaintContrast example for C++ 4.0 and later

This example increases the contrast for painting images.

m_Lead1.SetPaintContrast(m_Lead1.GetPaintContrast() + 100);
m_Lead1.ForceRepaint();


PaintDither (ImageList Control) example for C++ 4.0 and later

   //set the control to use error diffusion
   m_LEADImgList1.SetPaintDither(PAINTDITHER_DIFFUSION);


PaintDither example for Visual C++ 4.0
PaintDither example for C++ 4.0 and later

This example turns on error diffusion and redisplays the bitmap.

m_Lead1.SetPaintDither(PAINTDITHER_DIFFUSION);
m_Lead1.ForceRepaint();


PaintEffect example for Visual C++ 4.0
PaintEffect example for C++ 4.0 and later

The following functions use the KeyDown and KeyUp events to repaint the image with effects.

VOID CSampleDlg::Lead1_OnKeyDown(short FAR * KeyCode, short Shift)
{
   if (*KeyCode == 116) // Code for F5
   {
      m_Lead1.SetAutoRepaint(FALSE);
      m_Lead1.SetBackErase(TRUE);
      m_Lead1.SetEffectGrain(20);
      m_Lead1.SetEffectDelay(50);
      m_Lead1.SetWandSize(5);
      m_Lead1.SetWandColor(RGB(255,255,0));   // Yellow wand
      m_Lead1.SetPaintEffect(EFX_EFFECT_WIPE_L_TO_R);
      m_Lead1.ForceRepaint();
   }
}

VOID CSampleDlg::Lead1_OnKeyUp(short FAR * KeyCode, short Shift)
{
   if (*KeyCode == 116) // Code for F5
   {
      m_Lead1.SetPaintEffect(EFX_EFFECT_WIPE_R_TO_L);
      m_Lead1.ForceRepaint();
      m_Lead1.SetPaintEffect(EFX_EFFECT_NONE);
   }
}


PaintGamma example for Visual C++ 4.0
PaintGamma example for C++ 4.0 and later

This example increases the gamma correction for painting images.

m_Lead1.SetPaintGamma(m_Lead1.GetPaintGamma() + 100);
m_Lead1.ForceRepaint();


PaintIntensity example for Visual C++ 4.0
PaintIntensity example for C++ 4.0 and later

This example increases the intensity for painting images.

m_Lead1.SetPaintIntensity(m_Lead1.GetPaintIntensity() + 100);
m_Lead1.ForceRepaint();


PaintMaxPasses example for Visual C++ 4.0
PaintMaxPasses example for C++ 4.0 and later

This example includes two procedures. First, a button click starts a multi-pass paint effect; then LEAD's PaintNotification event changes the direction of the effect on each pass.

void CTutorDlg::OnButton1()
{
   m_Lead1.SetAutoRepaint(FALSE);

   // Set the effect
   m_Lead1.SetPaintEffect(EFX_EFFECT_WIPE_L_TO_R);
   m_Lead1.SetPaintMaxPasses(5);    // 5 total passes
   m_Lead1.SetPaintPass(1);         // Start with pass number 1
   m_Lead1.SetPaintNotificationDelay(200); // Delay 200 milliseconds between passes
   m_Lead1.Load("c:\\lead\\images\\image1.cmp", 0, 0, 1);    // load the image
   m_Lead1.SetAutoRepaint(TRUE);
}

void CMfc40ocxDlg::OnPaintNotificationLead1(short uPass, short uType)
{
  // If the first pass is complete
  if ((uType == EFX_NOTIFY_IMAGE) && (uPass > 0))
  {
    // Toggle the effect from left_to_right to right_to_left
    if (m_Lead1.GetPaintEffect()== EFX_EFFECT_WIPE_L_TO_R)
       m_Lead1.SetPaintEffect(EFX_EFFECT_WIPE_R_TO_L);
    else
       m_Lead1.SetPaintEffect(EFX_EFFECT_WIPE_L_TO_R);
  }
}


PaintPalette example for Visual C++ 4.0
PaintPalette example for C++ 4.0 and later

This example sets the paint palette to the palette of each Lead control. It then loads two images and dithers them to 8 bits per pixel with optimized palettes, and displays them side by side.  In 8-bit display mode, you can see the palette problems that result when you do not use a fixed palette.

// Disable automatic repainting of the image.
m_Lead1.SetAutoRepaint(FALSE);
m_Lead2.SetAutoRepaint(FALSE);
// Turn off scroll bars to make sure we use the full client area.
m_Lead1.SetAutoScroll(FALSE);
m_Lead2.SetAutoScroll(FALSE);
// Clear the bitmaps from memory
m_Lead1.SetBitmap(0);
m_Lead2.SetBitmap(0);
BeginWaitCursor();
// Load the bitmaps. These path names may be different on your system.
m_Lead1.Load("c:\\lead\\images\\image1.cmp", 0, 0, 1);
m_Lead2.Load("c:\\lead\\images\\image2.cmp", 0, 0, 1);
// Change the bitmaps to 8 BPS with optimized palettes
m_Lead1.ColorRes(8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0);
m_Lead2.ColorRes(8, CRP_OPTIMIZEDPALETTE, CRD_FLOYDSTEINDITHERING, 0);
// Make the controls visible so that we can size and position them.
// They will not really appear until we load an image and paint it.
m_Lead1.ShowWindow(SW_NORMAL);
m_Lead2.ShowWindow(SW_NORMAL);
// Set the variables used for preserving the aspect ratio.
float HeightFactor1 = m_Lead1.GetBitmapHeight();
float WidthFactor1 = m_Lead1.GetBitmapWidth();
float HeightFactor2 = m_Lead2.GetBitmapHeight();
float WidthFactor2 = m_Lead2.GetBitmapWidth();
CRect rcWindow;
GetWindowRect(rcWindow);
float ScaleWidth = (float) rcWindow.Width();
float ScaleHeight = (float) rcWindow.Height();
float HeightAllowed = ScaleHeight * 0.8f;
float WidthAllowed = ScaleWidth * 0.45f;
// Center each LEAD control on half of the form, preserving the aspect ratio.
// Check to see if using the maximum width will make the image too tall.
// Set the dimensions based on the result.
float Left;
float Width;
float Height;
float Top;
CRect rcControl;
if ((WidthAllowed * HeightFactor1) / WidthFactor1 < HeightAllowed)
{
  Left =  (ScaleWidth / 4) - (WidthAllowed / 2);
  Width = WidthAllowed;
  Height = (Width * HeightFactor1) / WidthFactor1;
  Top = (ScaleHeight - Height) / 2;
}
else
{
  Top = (ScaleHeight - HeightAllowed) / 2;
  Height = HeightAllowed;
  Width = (Height * WidthFactor1) / HeightFactor1;
  Left = (ScaleWidth / 4) - (Width / 2);
}
rcControl.SetRect(0, 0, (int) Width, (int) Height);
rcControl.OffsetRect((int) Left, (int) Top);
m_Lead1.MoveWindow(rcControl);
if ((WidthAllowed * HeightFactor2) / WidthFactor2 < HeightAllowed)
{
  Left =  (ScaleWidth * 3/4) - (WidthAllowed / 2);
  Width = WidthAllowed;
  Height = (Width * HeightFactor2) / WidthFactor2;
  Top = (ScaleHeight - Height) / 2;
}
else
{
  Top = (ScaleHeight - HeightAllowed) / 2;
  Height = HeightAllowed;
  Width = (Height * WidthFactor2) / HeightFactor2;
  Left = (ScaleWidth * 3 / 4) - (Width / 2);
}
rcControl.SetRect(0, 0, (int) Width, (int) Height);
rcControl.OffsetRect((int) Left, (int) Top);
m_Lead2.MoveWindow(rcControl);
// Set the image display sizes to match the LEAD controls
m_Lead1.SetDstRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.SetDstClipRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead2.SetDstRect(0.0f, 0.0f, m_Lead2.GetScaleWidth(), m_Lead2.GetScaleHeight());
m_Lead2.SetDstClipRect(0.0f, 0.0f, m_Lead2.GetScaleWidth(), m_Lead2.GetScaleHeight());
// Display the images
m_Lead1.SetPaintPalette(PAINTPALETTE_AUTO);
m_Lead2.SetPaintPalette(PAINTPALETTE_AUTO);
m_Lead1.ForceRepaint();
m_Lead2.ForceRepaint();
EndWaitCursor();


PaintROP3 example for Visual C++ 4.0
PaintROP3 example for C++ 4.0 and later

This example demonstrates the PaintROP3 property.

// Paint an inverted image.
void CTutorDlg::OnPaintrop3()
{
   m_Lead.SetPaintROP3( SRCINVERT );
   m_Lead.InvalidateRect(NULL);
}


PaintScaling (ImageList Control) Example for Visual C++ 4.0
PaintScaling (ImageList Control) Example for C++ 4.0 and later

// toggle through the paint scale modes
switch(m_LEADImgList1.GetPaintScaling())
{
case PAINTSCALING_NORMAL:
m_LEADImgList1.SetPaintScaling(PAINTSCALING_RESAMPLE);
AfxMessageBox("Resample");
break;
case PAINTSCALING_RESAMPLE:
m_LEADImgList1.SetPaintScaling(PAINTSCALING_BICUBIC);
AfxMessageBox("Bicubic");
break;
case PAINTSCALING_BICUBIC:
m_LEADImgList1.SetPaintScaling(PAINTSCALING_NORMAL);
AfxMessageBox("Normal");
break;
}


PaintScaling Example for Visual C++ 4.0
PaintScaling Example for C++ 4.0 and later

// This example sets the display to use bilinear interpolation
m_Lead1.SetPaintScaling(PAINTSCALING_RESAMPLE);


PaintSizeMode Example for Visual C++ 4.0
PaintSizeMode Example for C++ 4.0 and later

This example shows how to set the PaintSizeMode property so that the control uses only a vertical scroll bar.

m_Lead1.SetAutoScroll(TRUE);
m_Lead1.SetAutoSetRects(TRUE);
m_Lead1.SetPaintSizeMode(PAINTSIZEMODE_FITSIDES);
m_Lead1.ForceRepaint();


PaintSizeUseDPI example for Visual C++ 4.0
PaintSizeUseDPI example for C++ 4.0 and later

This example toggles the PaintSizeUseDPI property.

if (m_Lead1.GetPaintSizeUseDPI() == FALSE)
   m_Lead1.SetPaintSizeUseDPI(TRUE);
else
   m_Lead1.SetPaintSizeUseDPI(FALSE);


PaintWhileLoad example for Visual C++ 4.0
PaintWhileLoad example for C++ 4.0 and later

This example causes the LEAD control to paint the image as it loads.

m_Lead1.SetPaintWhileLoad(TRUE);
// Get information about the image so that we can size the control.
m_Lead1.GetFileInfo("c:\\lead\\images\\image2.cmp", 0, 0 );
// Set the variables used for preserving the aspect ratio.
// Allow for a border of 1/8 of the form size.
// The units of measure do not matter, since we are calculating proportions.
CRect rcWindow;
CRect rcControl;
GetClientRect(&rcWindow);
GetWindowRect(&rcControl);
float HeightFactor = m_Lead1.GetInfoHeight();
float WidthFactor = m_Lead1.GetInfoWidth();
float HeightAllowed = rcWindow.Height() * 3.0f / 4.0f;
float WidthAllowed = rcWindow.Width() * 3.0f / 4.0f;
// Center the LEAD control on the form, preserving the aspect ratio.
// Check to see if using the maximum width will make the image too tall.
// Set the dimensions based on the result.
if (((WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed)
{
  rcControl.SetRect(0, 0,
    (int) WidthAllowed,
    (int) ((WidthAllowed * HeightFactor) / WidthFactor));
  rcControl.OffsetRect(rcWindow.Width() / 8,
(rcWindow.Height() - rcControl.Height()) / 2);
}
else
{
  rcControl.SetRect(0, 0,
   (int) ((HeightAllowed * WidthFactor) / HeightFactor),
   (int) HeightAllowed);
  rcControl.OffsetRect((rcWindow.Width() - rcControl.Width()) / 2,
rcWindow.Height() / 8);
}
m_Lead1.MoveWindow(rcControl);
// Set the image display sizes to match the LEAD controls
float ImageHeight = m_Lead1.GetScaleHeight();
float ImageWidth = m_Lead1.GetScaleWidth();
float BitmapHeight = m_Lead1.GetInfoHeight();
float BitmapWidth = m_Lead1.GetInfoWidth();
m_Lead1.SetSrcRect(0.0f, 0.0f, BitmapWidth, BitmapHeight);
m_Lead1.SetSrcClipRect(0.0f, 0.0f, BitmapWidth, BitmapHeight);
m_Lead1.SetDstRect(0.0f, 0.0f, ImageWidth, ImageHeight);
m_Lead1.SetDstClipRect(0.0f, 0.0f, ImageWidth, ImageHeight);
// Turn off the automatic adjustment of display rectangles
m_Lead1.SetAutoSetRects(FALSE);
// Load the file
m_Lead1.Load("c:\\lead\\images\\image2.cmp", 0, 0, 1);
// Turn on the automatic adjustment of display rectangles for future use
m_Lead1.SetAutoSetRects(TRUE);


PaintZoomFactor Example for Visual C++ 4.0
PaintZoomFactor Example for C++ 4.0 and later

This example shows how to set the PaintZoomFactor property so that image is scaled 200 percent for display.

m_Lead1.SetAutoScroll(FALSE);
m_Lead1.SetAutoSetRects(TRUE);
m_Lead1.SetPaintSizeMode(PAINTSIZEMODE_ZOOM);
m_Lead1.SetPaintZoomFactor(200.0f);
m_Lead1.ForceRepaint();


PatternStyle example for Visual C++ 4.0
PatternStyle example for C++ 4.0 and later

This example paints a transition with a diagonal cross pattern.

m_Lead1.SetAutoRepaint(FALSE);
m_Lead1.SetEffectDelay(50);
m_Lead1.Load("c:\\lead\\images\\image1.cmp", 0, 0, 1);
m_Lead1.SetTransitionEffect(EFX_EFFECT_WIPE_RECTANGLE_OUT);
m_Lead1.SetTransitionStyle(EFX_TRANSITION_PATTERN);
m_Lead1.SetPatternStyle(EFX_PATTERN_DIAG_CROSS);
m_Lead1.SetPatternBackColor(RGB(255, 0, 0));
m_Lead1.SetPatternForeColor(RGB(0, 0, 255));
m_Lead1.SetAutoRepaint(TRUE);


PCDRes example for Visual C++ 4.0
PCDRes example for C++ 4.0 and later

This example checks for a high resolution image and loads it if possible.

CString myfile("v:\\images\\img0024.pcd"); // No PCD sample image is included with LEADTOOLS
m_Lead1.GetFileInfo(myfile, 0, 0 );
CString msg;
if (m_Lead1.GetInfoPCDRes (PCDRES_4BASE))
{
  m_Lead1.SetPCDRes(PCDRES_4BASE);
  msg = "Loading 1024 x 1536 resolution";
}
else
{
  m_Lead1.SetPCDRes(PCDRES_BASE);
  msg = "Loading 512 x 768 resolution";
}
MessageBox(msg);
BeginWaitCursor();
// Turn on the automatic display rectangles and the scroll bars.
m_Lead1.SetAutoSetRects(TRUE);
m_Lead1.SetAutoScroll(TRUE);
// Load the file.
m_Lead1.Load(myfile, 0, 0, 1);
m_Lead1.ForceRepaint();
EndWaitCursor();


PDFSaveLowMemory example for Visual C++ 4.0
PDFSaveLowMemory example for C++ 4.0 and later

    //Save a Color PDF file using less RAM for the process
    m_LEAD1.SetPDFSaveLowMemory(TRUE);
    m_LEAD1.Save("d:\\temp\\test.pdf", FILE_RAS_PDF_JPEG, 0, 0, 0);


PDFSaveUseDPI example for Visual C++ 4.0
PDFSaveUseDPI example for C++ 4.0 and later

void CPdfSaveDlg::OnSave()
{
   //Use image DPI when saving as PDF .
   m_LEAD.SetPDFSaveUseDPI(TRUE);
   //Save image as Raster PDF with CCITT G4 compression
   m_LEAD.Save ("c:\\tmp.pdf", FILE_RAS_PDF_G4, 1, 1, SAVE_OVERWRITE);
}


PDFXResolution Example for Visual C++ 4.0
PDFXResolution Example for C++ 4.0 and later

void CPdfTestDlg::OnPdfTest()
{
   /*
      This example does the following :

      1- Changes the horizontal and vertical PDF resolutions to 150 dpi .
      2- Sets the pixel depth to 8.
      3- Disables both font and graphics anti-aliasing.
      4- Forces the PDF module to use it's own installed fonts.
      5- Loads a PDF file using the new settings.*/

   /*Set horizontal resolution*/
   m_Lead1.SetPDFXResolution (150);
   /*Set vertical resolution */
   m_Lead1.SetPDFYResolution (150);
   /*Set Display depth*/
   m_Lead1.SetPDFDisplayDepth(8);
   /* No font anti-aliasing */
   m_Lead1.SetPDFTextAlpha (1);
   /* No graphics anti-aliasing */
   m_Lead1.SetPDFGraphicsAlpha (1);
   /* Use fonts installed by the PDF module */
   m_Lead1.SetPDFUseLibFonts (TRUE);
   /* Load the PDF file */
   m_Lead1.Load ("c:\\Test.pdf", 0, 0, 1);
}


PicturizeBitmapList example for C++ 5.0 and later

   m_Lead1.PicturizeBitmapList(20, 15, 200, m_Lead3.GetBitmapList ());


Picturize example for Visual C++ 4.0
Picturize example for C++ 4.0 and later

// replace the current image in the main control with an image created
// from all the images present in c:\images. Resize all images present in that directory
// to 32x32 pixels and load them all in memory before proceeding

m_Lead1.SetScaleMode(3); 	// use pixels as measurement units for size
m_Lead1.Picturize("c:\\images", PICTURIZE_LOADALL|PICTURIZE_RESIZE, 32.0f, 32.0f);


PicturizeSingle example for C++ 5.0 and later

   m_Lead2.Load ("c:\\temp\\test.cmp", 0, 1, 1);
   m_Lead1.PicturizeSingle((long)m_Lead2.GetBitmapWidth (), 20, 15, 200);


Pixel example for Visual C++ 4.0
Pixel example for C++ 4.0 and later

This example, using the MouseDown event, gets the value of the current pixel and sets all values in the line to that value. The example shows how to convert mouse coordinates to bitmap pixel coordinates, regardless of how the image is zoomed or scrolled.

void CMfc2Dlg::OnMouseDownLead1(short Button, short Shift, long x, long y)
{
   long xycolor;
   float xfraction;
   float yfraction;
   float xPixel;
   float yPixel;

   // In MFC 4.0 you get pixels; so set the scalemode accordingly.
   m_Lead1.SetScaleMode(3);
   m_Lead1.SetAutoRepaint(FALSE);

   // Translate mouse coordinates to fractions of the destination width and height.
   xfraction = (x - m_Lead1.GetDstLeft()) / m_Lead1.GetDstWidth();
   yfraction = (y - m_Lead1.GetDstTop()) / m_Lead1.GetDstHeight();

   // Convert fractions to bitmap pixel coordinates.
   xPixel = (m_Lead1.GetSrcWidth() * xfraction) + m_Lead1.GetSrcLeft();
   yPixel = (m_Lead1.GetSrcHeight() * yfraction) + m_Lead1.GetSrcTop();

   // Make the whole line the same color as the pixel.
   xycolor = m_Lead1.GetPixel(xPixel, yPixel);

   for(xPixel=0; xPixel<m_Lead1.GetBitmapWidth();xPixel++)
   {
     m_Lead1.SetPixel(xPixel,yPixel,xycolor);
   }
   m_Lead1.ForceRepaint();
}


PixelData example for Visual C++ 4.0
PixelData example for C++ 4.0 and later

This example, using the MouseDown event, gets the value of the current pixel and sets all values in the line to that value. The example shows how to convert mouse coordinates to bitmap pixel coordinates, regardless of how the image is zoomed or scrolled.

void CTestDlg::OnMouseDownLeadctrl1 (short Button, short Shift, long x, long y)
{
   COleVariant xycolor;
   float xfraction;
   float yfraction;
   float xPixel;
   float yPixel;
   // In MFC 4.0 you get pixels; so set the scale mode accordingly.
   m_Lead1.SetScaleMode(3);
   m_Lead1.SetAutoRepaint(FALSE);
   // Translate mouse coordinates to fractions of the destination width and height.
   xfraction = (x - m_Lead1.GetDstLeft()) / m_Lead1.GetDstWidth();
   yfraction = (y - m_Lead1.GetDstTop()) / m_Lead1.GetDstHeight();

   // Convert fractions to bitmap pixel coordinates.
   xPixel = (m_Lead1.GetSrcWidth() * xfraction) + m_Lead1.GetSrcLeft();
   yPixel = (m_Lead1.GetSrcHeight() * yfraction) + m_Lead1.GetSrcTop();
   // Make the whole line the same color as the pixel.
   xycolor = m_Lead1.GetPixelData(xPixel, yPixel);
   //disable repainting
   m_Lead1.SetAutoRepaint(FALSE);
   for(xPixel=0; xPixel<m_Lead1.GetBitmapWidth();xPixel++)
   {
     m_Lead1.SetPixelData(xPixel,yPixel,xycolor);
   }
   // re-enable repainting
   m_Lead1.SetAutoRepaint(TRUE);
}


Posterize example for Visual C++ 4.0
Posterize example for C++ 4.0 and later

This example applies a six-color poster effect and redisplays the image.

m_Lead1.Posterize(6);
m_Lead1.ForceRepaint();


PreferredLoadFormat Example for Visual C++ 4.0
PreferredLoadFormat Example for C++ 4.0 and later

m_LEAD1.SetPreferredLoadFormat(FILE_CMP);


PreLoadFilters Example for Visual C++ 4.0
PreLoadFilters Example for C++ 4.0 and later

This example shows how to preload filters.

// preload the BMP, PCX, FAX, and TIFF filters,
    // and allow 1 filter to be cached, while always
    // keeping 3 loaded.
    m_Lead1.PreLoadFilters(3, 1, "BMP,PCX,FAX,TIF");


PrinterScaleHeight Example for Visual C++ 4.0
PrinterScaleHeight Example for C++ 4.0 and later

long hDC;

   hDC = m_LEAD1.PrintStart();
   //print 1/4 of the printable region
   m_LEAD1.Render(hDC, 0, 0, m_LEAD1.GetPrinterScaleWidth() / 4, m_LEAD1.GetPrinterScaleHeight() / 4);
   m_LEAD1.PrintEnd(hDC);


ProgressivePasses Example for Visual C++ 4.0
ProgressivePasses Example for C++ 4.0 and later

This example shows how to save and load a progressive file.

// Save the current image as a progressive CMP file.
m_Lead1.SetProgressivePasses(8);
m_Lead1.Save("c:\\lead\\images\\tmp.cmp", FILE_CMP, 24, QFACTOR_PQ2, SAVE_OVERWRITE);

// Set properties to show progressive paints when we load.
m_Lead1.SetPaintWhileLoad(TRUE);
m_Lead1.SetAutoSetRects(FALSE);

// Load the file we just saved.
m_Lead1.SetProgressivePasses(PROGRESSIVEPASSES_WHEN_MEANINGFUL);
m_Lead1.Load("c:\\lead\\images\\tmp.cmp", 0, 0, 1);

// Restore the default behavior.
m_Lead1.SetProgressivePasses(0);


ProgressStatus (OLE DB Control) Example for Visual C++ 4.0
ProgressStatus (OLE DB Control) Example for C++ 4.0 and later

void COLEDBDlg::OnProgressStatusLeadoledbctrl1(short nPercent)
{
   CString csOut;
   MSG msg;

   csOut.Format("%d", nPercent);
   csOut = csOut + "%";
   SetWindowText(csOut);

   // are there any messages in the queue (like a button being pressed) ?
   while( PeekMessage(&msg,NULL, 0, 0, PM_REMOVE) )
   {
     TranslateMessage( &msg );      /* Translates virtual key codes.  */
     DispatchMessage( &msg );       /* Dispatches message to window.  */
   }

   //user asked to stop
   if(m_bQuit)
     m_LEADOLEDB1.SetEnableProgressEvent(FALSE);
}


ReadyState Example for Visual C++ 4.0
ReadyState Example for C++ 4.0 and later

This example shows how to use the ReadyState property to test whether an asynchronous load is in progress.

if (m_Lead1.GetReadyState() == READYSTATE_LOADING)
   MessageBox ("Still loading the image", "Notice", MB_OK);


RefBitmapList example for Visual C++ 4.0
RefBitmapList example for C++ 4.0 and later

   // tell m_Lead1 to "steal" the bitmap list from m_Lead2
   m_Lead1.SetRefBitmapList(TRUE);
   // move the bitmap list from m_Lead2 to m_Lead1
   m_Lead1.SetBitmapList(m_Lead2.GetBitmapList());
   // restore the default value for RefBitmapList
   m_Lead1.SetRefBitmapList(FALSE);
   // for safety, let m_Lead2 know that its list has been emptied
   m_Lead2.SetBitmapList(NULL);


Resize event example for Visual C++ 4.0
Resize event example for C++ 4.0 and later

1.	Add a Static Text control as follows:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the tutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_TUTOR_DIALOG to design the dialog box.

e.	Click the Static Text control; then click and drag its shape in the dialog box.

f.	Double-click the new control to edit its properties.

g.	Change the ID to IDC_TEXT1.

h.	Press Ctrl-F4 to close all windows back to the Project Workspace.

2.	Do the following to add m_Text1 to the CTutorDlg class and link the variable to the Static Text control using dynamic data exchange:

a.	Press Ctrl-W to go to the MFC ClassWizard.

b.	Click the Member Variables tab.

c.	In the Class Name box, select CTutorDlg.

d.	In the Control IDs list, select IDC_TEXT1.

e.	Click the Add Variable... button.

f.	Specify m_Text1 as the variable name, Control as the category, and Cstatic as the variable type.

g.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

3.	Add a Command button to your project, and code its click procedure to resize the bitmap by changing the BitmapHeight or BitmapWidth property.

4.	Edit the OnResizeLead1 procedure as follows:

void CTutorDlg::OnResizeLead1()
{
  char szText[128];
  CRect rcWindow;

  if (mLead1.m_hWnd)
  {
    m_Lead1.GetWindowRect(rcWindow);
    wsprintf(szText, "Control size: %u, %u", rcWindow.Width(), rcWindow.Height());
    m_Text1.SetWindowText(szText);
    m_Text1.UpdateWindow();
  }
}


ResizeRgn example for C++ 5.0 and later

   m_Lead1.SetRgnFrameType(RGNFRAME_ANIMATED);
   m_Lead1.SetRgnRect(40, 60, 280, 200, L_RGN_SET);
   AfxMessageBox("About to resize");
   m_Lead1.ResizeRgn(20, RGN_CONTRACT, FALSE);


RemapHue example for Visual C++ 4.0
RemapHue example for C++ 4.0 and later

//This example changes all green hues(and hues near green) to the hue of crNewColor
// The example uses the following macros:

#define INCREMENT(x) ((x+1)%256)
#define DECREMENT(x) ((x+255)%256)
#define ADD(x,y)     ((x+y)%256)

void CColorReplaceDlg::ChangeGreenHues(COLORREF crNewColor)
{
   int i;
   int nHueGreen, nHueNewColor, nHueChange;
   int iCount;
   //Initialize tables
   for (i=0; i<256; i++)
   {
      m_Lead.SetMaskTable(i, 0);
      m_Lead.SetHTable(i,i);
   }

   //Get the hue for green
   nHueGreen = m_Lead.HSV_HfromRGB(RGB(0, 255, 0));

   //Obtain new hue
   nHueNewColor = m_Lead.HSV_HfromRGB(crNewColor);
   nHueChange = nHueNewColor - nHueGreen;

   if (nHueChange < 0)
      nHueChange += 256;

      //Set values in uHueTable, uMaskTable
      m_Lead.SetHTable(nHueGreen, m_Lead.GetHTable(nHueGreen) + nHueChange);
      m_Lead.SetMaskTable(nHueGreen, 1);

   //set the hues near green (+/- 5)
   iCount = 0;
   i = INCREMENT(nHueGreen);
   while (iCount < 5)
   {
      m_Lead.SetHTable(i, ADD(m_Lead.GetHTable(i), nHueChange) );
      m_Lead.SetMaskTable(i, 1);
      i = INCREMENT(i);
      iCount++;
   }

   iCount = 0;
   i = DECREMENT(nHueGreen);
   while (iCount < 5)
   {
      m_Lead.SetHTable(i, ADD(m_Lead.GetHTable(i), nHueChange));
         m_Lead.SetMaskTable(i,1);
      i = DECREMENT(i);
      iCount++;
   }
   m_Lead.RemapHue(TRUE, TRUE, FALSE, FALSE);
}


RemapTableSize example for C++ 4.0 and later

   if((m_Lead1.GetBitmapBits () == 16 && m_Lead1.GetIsGrayscale())
      || m_Lead1.GetBitmapBits() == 64 || m_Lead1.GetBitmapBits() == 48)
      m_Lead1.SetRemapTableSize (65536);
   else if(m_Lead1.GetBitmapBits() == 12)
      m_Lead1.SetRemapTableSize(4096);
   else
      m_Lead1.SetRemapTableSize(256);


Remove (ImageList Control) example for C++ 4.0 and later

   //remove the last item from the ImageList Control
   m_LEADImgList1.Remove(m_LEADImgList1.GetCount() - 1);


RemoveRedeye example for C++ 5.0 and later

   m_Lead1.SetRgnEllipse(80, 55, 35, 30, L_RGN_SET);
   m_Lead1.RemoveRedeye(RGB(5, 20, 10), 125, 100);


RenderCenter example for C++ 5.0 and later

   HDC hdcPrinter;
   PRINTDLG printdlg;
   DOCINFO docinfo;

   // get and prepare the printer DC
   memset( &printdlg, 0, sizeof(printdlg) );
   printdlg.lStructSize = sizeof(printdlg);
   printdlg.Flags = PD_RETURNDC;
   if( !PrintDlg(&printdlg) )
      return;

   if( (hdcPrinter = printdlg.hDC) == NULL )
   {
      if( printdlg.hDevMode ) GlobalFree(printdlg.hDevMode);
      if( printdlg.hDevNames) GlobalFree(printdlg.hDevNames);
      return;
   }

   docinfo.cbSize = sizeof(docinfo);
   docinfo.lpszDocName = "Print example using LEADTOOLS.";
   docinfo.lpszOutput = NULL;
   docinfo.fwType = 0L;

   if( StartDoc(hdcPrinter, &docinfo) <= 0)
   {
      if( printdlg.hDevMode ) GlobalFree(printdlg.hDevMode);
      if( printdlg.hDevNames) GlobalFree(printdlg.hDevNames);
      DeleteDC(hdcPrinter);
   }
   StartPage(hdcPrinter);

   // print the image
   TextOut( hdcPrinter, 0, 0, "Center the image on the page", strlen("Center the image on the page"));

   m_LEAD1.SetRenderCenter(TRUE);
   m_LEAD1.Render((long)hdcPrinter, 0, 0, m_LEAD1.GetBitmapWidth(), m_LEAD1.GetBitmapHeight());

   //Finish the page and finish the print job
   EndPage( hdcPrinter );
   EndDoc( hdcPrinter );

   //clean up
   if( printdlg.hDevMode ) GlobalFree(printdlg.hDevMode);
   if( printdlg.hDevNames) GlobalFree(printdlg.hDevNames);
   DeleteDC(hdcPrinter);


Resize (ImageList Control) example for C++ 4.0 and later

void CTttDlg::OnResize Leadimglistctrl1()
{
   if(::IsWindow(m_LEADImgList1.m_hWnd))
   {
      CString csOut;
      //display new Row/Col counts
      csOut.Format("RowCount: %ld\nColumnCount: %ld",
                   m_LEADImgList1.GetRowCount(),
                   m_LEADImgList1.GetColumnCount());
      AfxMessageBox(csOut);
   }
}


RGBfromHSV example for Visual C++ 4.0
RGBfromHSV example for C++ 4.0 and later

//Takes an HSV, displays the HSV components, and displays the RGB components

void CColorReplaceDlg::HSVtoRGB(int nH, int nS, int nV)
{
   COLORREF cr;
   int nRed, nGreen, nBlue;
   char szMsg[100];

   cr = m_Lead.RGBfromHSV(nH, nS, nV);
   nRed = GetRValue(cr);
   nGreen = GetGValue(cr);
   nBlue = GetBValue(cr);
   wsprintf(szMsg, "HSV(%d,%d,%d) is RGB(%d,%d,%d)", nH, nS, nV, nRed, nGreen, nBlue);
   ::MessageBox(NULL, szMsg, "", MB_OK);
}


RgnChange example for Visual C++ 4.0
RgnChange example for C++ 4.0 and later

This code for the RgnChange event updates a static text control using the GetRgnArea method. You can test it by adding a text box for the lesson described in Outlining, Dragging, and Pasting a Region.

The first two steps describe how to add a static text control. The last step shows the sample code.

1.	Add a Static Text control as follows:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the tutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_TUTOR_DIALOG to design the dialog box.

e.	Click the Static Text control; then click and drag its shape in the dialog box.

f.	Double-click the new control to edit its properties.

g.	Change the ID to IDC_TEXT1.

h.	Press Ctrl-F4 to close all windows back to the Project Workspace.

2.	Do the following to add m_Text1 to the CTutorDlg class and link the variable to the Static Text control using dynamic data exchange:

a.	Press Ctrl-W to go to the MFC ClassWizard.

b.	Click the Member Variables tab.

c.	In the Class Name box, select CTutorDlg.

d.	In the Control IDs list, select IDC_TEXT1.

e.	Click the Add Variable... button.

f.	Specify m_Text1 as the variable name, Control as the category, and Cstatic as the variable type.

g.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

3.	Use the MFC ClassWizard to add the RgnChange event, and code it as follows:

void CTutorDlg::OnRgnChangeLead1()
{
   char szText[128];
   CRect rcWindow;
   m_Lead1.GetWindowRect(rcWindow);
   wsprintf(szText, "Number of pixels in region: %u ", m_Lead1.GetRgnArea());
   m_Text1.SetWindowText(szText);
   m_Text1.UpdateWindow();
}


RgnFrameColor example for Visual C++ 4.0
RgnFrameColor example for C++ 4.0 and later

m_LEAD1.SetRgnFrameColor(RGB(0, 0, 255));
m_LEAD1.SetRgnFrameType(RGNFRAME_COLOR);
m_LEAD1.SetRgnRect(10.0f, 10.0f, 200.0f, 200.0f, L_RGN_SET);


Rotate example for Visual C++ 4.0
Rotate example for C++ 4.0 and later

This example rotates the bitmap 45 degrees and redisplays the image. It resizes the bitmap to accommodate the rotation and uses blue as the fill color.

m_Lead1.Rotate(4500, ROTATE_RESIZE, RGB(0, 0, 255));
m_Lead1.SetAutoSetRects(TRUE); // Make sure the display rectangles are adjusted
m_Lead1.ForceRepaint();


RowCount (ImageList Control) example for C++ 4.0 and later

   long LinesPerPage;
   if(m_LEADImgList1.GetScrollStyle() == SCROLLSTYLE_VERTICAL)
      LinesPerPage = m_LEADImgList1.GetRowCount() / m_LEADImgList1.GetPageCount();
   else
      LinesPerPage = m_LEADImgList1.GetColumnCount() / m_LEADImgList1.GetPageCount();


Saturation example for Visual C++ 4.0
Saturation example for C++ 4.0 and later

This example increases the saturation of colors in the bitmap and redisplays the image.

m_Lead1.Saturation(1000);
m_Lead1.ForceRepaint();


Save example for Visual C++ 4.0
Save example for C++ 4.0 and later

This example saves the image as a PNG file, loads the new file, and redisplays the bitmap.

BeginWaitCursor();
m_Lead1.Save("c:\\lead\\images\\tmp.png", FILE_PNG, 8, 1, SAVE_OVERWRITE);
m_Lead1.Load("c:\\lead\\images\\tmp.png", 0, 0, 1);
m_Lead1.ForceRepaint();
EndWaitCursor();


Save (Mixed Raster Content Control)example for Visual C++ 4.0
Save (Mixed Raster Content Control) example for C++ 4.0 and later

   m_LeadMrc1.SetMaskCoder(MRC_MASK_COMPRESSION_FAX_G4);
   m_LeadMrc1.SetBackgroundCoder(MRC_BACKGROUND_COMPRESSION_JPEG);
   m_LeadMrc1.SetBackgroundQFactor(20);
   m_LeadMrc1.SetEnhanceQuality(FALSE);
   m_LeadMrc1.Save("d:\\temp\\test.mrc", FALSE);
   m_LeadMrc1.SaveT44("d:\\temp\\testT44.mrc", FALSE);


SaveArray example for Visual C++ 4.0
SaveArray example for C++ 4.0 and later

   COleVariant MyVar;
   long lSize;
   HFILE hFile;
   void HUGEP* pData=NULL;

   m_LEAD1.Load("v:\\images\\babe.cmp", 0, 1, 1);

   MyVar.Clear();
   MyVar = m_LEAD1.SaveArray(FILE_CMP, 0, 2);

   _lcreat("d:\\temp\\test.cmp", 0);
   hFile = _lopen("d:\\temp\\test.cmp", OF_READWRITE);
   SafeArrayAccessData(MyVar.parray, &pData);
   lSize = m_LEAD1.ArraySize(&MyVar);
   _lwrite(hFile, (LPCSTR)pData, lSize);
   SafeArrayUnaccessData(MyVar.parray);
   _lclose(hFile);


SaveBuffer example for C++ 5.0 and later

//This sample loads the file 'szFileName', and saves it to memory buffer allocated by the user
//The original memory buffer is 1 bytes, which is too small to accomodate the image
//The SaveBuffer callback gets called as necessary, allowing the user to reallocate the memory buffer as needed
//When the image is completely saved in memory, it is loaded into a second LEAD control
//
//The following variables are member variables of the CVCsampleDlg class
//void * m_pMemAddress

void CVCsampleDlg::SampleLoadSaveBuffer(char *pszFileName)
{
   long lMemInitialSize  = 1;
   int  nRet;

   m_pMemAddress = malloc(lMemInitialSize);

   m_Lead1.Load(pszFileName, 0, 0, 1);
   m_Lead1.SetSaveBufferSize(lMemInitialSize);
   m_Lead1.SetSaveBufferAddress((long)m_pMemAddress);
   m_Lead1.SetEnableSaveBufferEvent(TRUE);
   nRet = m_Lead1.SaveBuffer(FILE_TIF, 24, 0, SAVE_OVERWRITE);
   if (nRet != 0)
   {
      CString csMsg;
      csMsg.Format("SaveBuffer Error: %d\n", nRet);
      MessageBox(csMsg);
      return;
   }
   //Load the file in memory into a second LEAD control
   nRet = m_Lead2.LoadBuffer (m_Lead1.GetSaveBufferAddress (), 24, 0, 1, m_Lead1.GetSaveBufferSize ());

   free(m_pMemAddress);
}

//The SaveBuffer event allows the user to reallocate the buffer as needed
void CVCsampleDlg::OnSaveBufferLeadctrl1 (long uRequiredSize)
{
   {
      char szMsg[100];
      wsprintf(szMsg, "uRequiredSize[%d]\n", uRequiredSize);
      OutputDebugString(szMsg);
   }
   m_pMemAddress = realloc(m_pMemAddress, uRequiredSize);
   if (m_pMemAddress == NULL)
   {
      MessageBox( "realloc error");
      m_Lead1.SetEnableSaveBufferEvent (FALSE);
   }
   else
   {
      m_Lead1.SetSaveBufferSize(uRequiredSize);
      m_Lead1.SetSaveBufferAddress ((long)m_pMemAddress);
   }
}


SaveDatabase Example for Visual C++ 4.0
SaveDatabase Example for C++ 4.0 and later

   //save to db
   m_LEADImgList1.SaveDatabase("c:\\temp\\testdb7.tif", FALSE);


SaveIFD example for Visual C++ 4.0
SaveIFD example for C++ 4.0 and later

// This example will add 100 pages to a file faster by continuously using the IFD of the last page
int nPage;
// Save page 1, to make sure the file exists
m_Lead1.Save("test.tif", FILE_TIF, 0, 0, SAVE_APPEND);
for(nPage = 2; nPage <= 100; nPage++)
{
   // get the IFD of the last page
   m_Lead1.GetFileInfo("test.tif", 100000, 0);
   m_Lead1.SetSaveIFD(m_Lead1.GetInfoIFD());
   m_Lead1.Save("test.tif", FILE_TIF, 0, 0, SAVE_APPEND);
}
// reset the SaveIFD property so the other Save calls will work properly
m_Lead1.SetSaveIFD(0);


SaveInterlaced example for Visual C++ 4.0
SaveInterlaced example for C++ 4.0 and later

This example saves the current image as an interlaced GIF file, then loads the saved image with a paint-while-load effect that shows the interlaced behavior.

//Save the current image as an interlaced GIF file.
m_Lead1.SetSaveInterlaced(TRUE);
m_Lead1.Save("d:\\temp\\tmp.gif", FILE_GIF, 8, 1, SAVE_OVERWRITE);

//Clear the bitmap so that we can see the paint-while-load effect.
m_Lead1.SetBitmap(0);

//Paint the image while loading, showing that it is interlaced.
m_Lead1.SetPaintWhileLoad(TRUE);
m_Lead1.Load("d:\\temp\\tmp.gif", 0, 0, 1);


SaveLayers example for Visual C++ 4.0
SaveLayers example for C++ 4.0 and later

int i;

// Save all the extra bitmaps in the bitmap list as layers
m_Lead1.SetSaveLayers(TRUE);
for(i = 1; i < m_Lead1.GetBitmapListCount(); i++)
{
   // reset the layer info so all the layers are saved from 0,0 offset
   m_Lead1.SetLayerLeft(i, 0);
   m_Lead1.SetLayerTop(i, 0);
   m_Lead1.SetLayerBlendModeKey(i, "dark");
   m_Lead1.SetLayerClipping(i, 0);
   m_Lead1.SetLayerOpacity(i, 40);
   m_Lead1.SetLayerMaskBitmap(i, NULL);
}
m_Lead1.Save("c:\\temp\\layers.psd", FILE_PSD, 0, 0, SAVE_OVERWRITE);


SaveLSB example for Visual C++ 4.0
SaveLSB example for C++ 4.0 and later

   // This example saves a bitmap compatible with the requirements
   // 	of the TIFF Class F format
   // make sure we are using pixels
   m_LEAD1.SetScaleMode(3);
   m_LEAD1.SetSaveLSB(TRUE);
   m_LEAD1.SetSavePageNumberTag(TRUE);
   m_LEAD1.SetBitmapXRes(204);
   m_LEAD1.SetBitmapYRes(196);
   // scale the bitmap (preserving the aspect ratio) to have
   // a width of 1728 pixels
   m_LEAD1.Size(1728.0f,
                m_LEAD1.GetBitmapHeight() * 1728 / m_LEAD1.GetBitmapWidth(),
                0);
   m_LEAD1.Save("d:\\temp\\lsb.tif",
                FILE_CCITT_GROUP3_1DIM,
                1, 0, SAVE_OVERWRITE);


SaveMemory example for Visual C++ 4.0
SaveMemory example for C++ 4.0 and later

This example uses SaveMemory to save a bitmap to a memory-resident file, uses GetMemoryInfo to examine the file size; then uses WIN32 API calls to save the file to disk and free the memory.

void CTutorDlg::OnSaveMemory()
{
   HGLOBAL  hMem;
   long     iSize;
   LPSTR    lpMem;
   HFILE    hf;
   OFSTRUCT of;
   char     szText[256];

   if( m_Lead.SaveMemory( (long FAR *)&hMem, FILE_CMP, 24, -1,
   &iSize ) ) {
    MessageBox( "Error calling SaveMemory" );
    return;
   }

   if( m_Lead.GetMemoryInfo((OLE_HANDLE)hMem, 0, iSize) )
   {
    GlobalFree (hMem);
    MessageBox( "Error calling GetMemoryInfo" );
    return;
   }

   /*  Ask for a confirmation to save this file */
   wsprintf( szText, "File info: \r %u x %u x %u BPP \rSize in memory: %lu
   \rSize on disk %lu",
      (unsigned int)m_Lead.GetInfoWidth(), (unsigned
      int)m_Lead.GetInfoHeight(), (unsigned int)m_Lead.GetInfoBits(),
      (unsigned long)m_Lead.GetInfoSizeMem(), (unsigned
      long)m_Lead.GetInfoSizeDisk()
       );

   if( MessageBox(szText, "Write this file on disk ?", MB_YESNO) != IDYES )
   {
    GlobalFree (hMem);
    return;
   }

   if( (lpMem = (LPSTR)GlobalLock(hMem)) == NULL )
   {
    GlobalFree( hMem );
    MessageBox( "Error calling GlobalLock" );
    return;
   }

   if( (hf = OpenFile( "c:\\lead\\images\\savemem.cmp", &of, OF_CREATE)) ==
   HFILE_ERROR ) {
    GlobalUnlock( hMem );
    GlobalFree( hMem );
    MessageBox( "Error calling GlobalLock" );
    return;
   }

   if( _hwrite( hf, lpMem, iSize ) != iSize )
    MessageBox( "Error calling GlobalLock" );
   else
    MessageBox( "c:\\lead\\images\\savemem.cmp was saved successfully on disk." );

   _lclose( hf );
   GlobalUnlock( hMem );
   GlobalFree( hMem );
}


SavePage example for Visual C++ 4.0
SavePage example for C++ 4.0 and later

// replace page 1 from TEST.TIF
m_Lead1.SetSavePage(1);
m_Lead1.Save("TEST.TIF", FILE_TIF, 8, 0, SAVE_REPLACE);


SaveResolutionCount example for Visual C++ 4.0
SaveResolutionCount example for C++ 4.0 and later

int i;
   CString csOut;
   CString cstmp;

   // assume that our bitmap is 800 x 600
   // save 3 resolutions
   m_LEAD1.SetSaveResolutionCount(3);

   m_LEAD1.SetSaveResolutionWidth(0,800.0f);
   m_LEAD1.SetSaveResolutionHeight(0,600.0f);
   m_LEAD1.SetSaveResolutionWidth(1,400.0f);
   m_LEAD1.SetSaveResolutionHeight(1,300.0f);
   m_LEAD1.SetSaveResolutionWidth(2,200.0f);
   m_LEAD1.SetSaveResolutionHeight(2,150.0f);

   // get the SaveResolution info

   csOut.Format("SaveResolutionCount = %d",
                m_LEAD1.GetSaveResolutionCount());
   AfxMessageBox(csOut);

   csOut.Empty();
   for( i = 0; i<m_LEAD1.GetSaveResolutionCount(); i++ )
   {
      cstmp.Format("SaveResolution(%d) = %.2f x %.2f\n",
                   i,
                   m_LEAD1.GetSaveResolutionWidth(i),
                   m_LEAD1.GetSaveResolutionHeight(i));
      csOut = csOut + cstmp;
   }
   AfxMessageBox(csOut);


SaveTileWidth example for Visual C++ 4.0
SaveTileWidth example for C++ 4.0 and later

// save TIF files with a tile size of 512x512
m_Lead1.SetScaleMode(3);
// use pixels for the tile size
m_Lead1.SetSaveTileWidth(512);
m_Lead1.SetSaveTileHeight(512);
m_Lead1.Save("c:\\temp\\tiled.tif", FILE_CCITT_GROUP4, 0, 0, SAVE_OVERWRITE);


SaveToFile (ImageList Control) example for C++ 4.0 and later

   //save all selected items to a multi-page file
   m_LEADImgList1.SaveToFile("d:\\temp\\testing.tif", FILE_TIF, 0, 0, TRUE);
   //clear list
   m_LEADImgList1.Clear();
   //reload file
   m_LEADImgList1.LoadFromFile("d:\\temp\\testing.tif", 0, 1, -1);


SaveWithStamp example for Visual C++ 4.0
SaveWithStamp example for C++ 4.0 and later

This example saves the image in a JPEG file that includes a thumbnail (stamp) image. It then loads the thumbnail from the new file.

int SavedMode = m_Lead1.GetScaleMode();
m_Lead1.SetScaleMode(3); // Use pixels for sizing the thumbnail
m_Lead1.SaveWithStamp("c:\\lead\\images\\stamp.jpg", FILE_JPEG, 24, 30, 150.0f, 100.0f, 24);
m_Lead1.SetScaleMode(SavedMode);
m_Lead1.LoadStamp("c:\\lead\\images\\stamp.jpg");
m_Lead1.ForceRepaint();


ScaleMode (ImageList Control) example for C++ 4.0 and later

//set the scalemode to pixels
   m_LEADImgList1.SetScaleMode(3);
   //........
   //setup a custom scale
   m_LEADImgList1.SetScaleMode(SCALEMODE_USER);
   m_LEADImgList1.SetScaleWidth(1000.0f);
   m_LEADImgList1.SetScaleHeight(500.0f);


Scroll event example for Visual C++ 4.0
Scroll event example for C++ 4.0 and later

1.	Add a Static Text control as follows:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the tutor resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_TUTOR_DIALOG to design the dialog box.

e.	Click the Static Text control; then click and drag its shape in the dialog box.

f.	Double-click the new control to edit its properties.

g.	Change the ID to IDC_TEXT1.

h.	Press Ctrl-F4 to close all windows back to the Project Workspace.

2.	Do the following to add m_Text1 to the CTutorDlg class and link the variable to the Static Text control using dynamic data exchange:

a.	Press Ctrl-W to go to the MFC ClassWizard.

b.	Click the Member Variables tab.

c.	In the Class Name box, select CTutorDlg.

d.	In the Control IDs list, select IDC_TEXT1.

e.	Click the Add Variable... button.

f.	Specify m_Text1 as the variable name, Control as the category, and Cstatic as the variable type.

g.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

3.	Edit the Lead1_OnScroll procedure as follows:

VOID CSampleDlg::Lead1_OnScroll()
{
  char cStr[128];
  sprintf(cStr, "Image origin: %g, %g", (double) m_Lead1.GetDstLeft(), (double) m_Lead1.GetDstTop());
  m_Text1.SetWindowText(cStr);
  m_Text1.UpdateWindow();
}


ScrollItems (ImageList Control) example for C++ 4.0 and later

//scroll items down 2 lines
   m_LEADImgList1.ScrollItems(2);


ScrollStyle (ImageList Control) example for C++ 4.0 and later

   //Set scroll style to horizontal
   m_LEADImgList1.SetScrollStyle(SCROLLSTYLE_HORIZONTAL);


SelectAll (ImageList Control) example for C++ 4.0 and later

//select all items
   m_LEADImgList1.SelectAll(TRUE);
   AfxMessageBox("wait");
   //deselect allitems
   m_LEADImgList1.SelectAll(FALSE);


SelectedItems example for Visual C++ 4.0
SelectedItems example for C++ 4.0 and later

   long x;
   x = m_LEADImgList1.GetSelectedCount();
   while(x > 0)
   {
      m_LEADImgList1.SelectedItems(0).SetSelected(FALSE);
      x = m_LEADImgList1.GetSelectedCount();
   }


SelectionColor (ImageList Control) example for C++ 4.0 and later

   m_LEADImgList1.SetSelectionColor(RGB(255, 0, 0)); //set to RED


SelectionStyle (ImageList Control) example for C++ 4.0 and later

   //show selected items as pressed buttons
   m_LEADImgList1.SetSelectionStyle(SELECTIONSTYLE_PRESSEDBUTTON);


SetNewStripe (Mixed Raster Content Control)example for Visual C++ 4.0
SetNewStripe (Mixed Raster Content Control) example for C++ 4.0 and later

   long nStripe, nSeg;
   short nRet;
   nStripe = m_LeadMrc1.SetNewStripe(0, 100);
   if(nStripe >= 0)
   {
      nSeg = m_LeadMrc1.SetStripeSegment(nStripe, 10, 10, 140, 80, SEGMENT_PICTURE, 0, 0);
      if(nSeg >= 0)
      {
         nRet = m_LeadMrc1.UpdateSegmentData(nSeg, 5, 5, 150, 90, SEGMENT_TEXT, 0, 0xFFFFFF, TRUE);
         if(nRet == 0)
            AfxMessageBox("Update Successful");
         nRet = m_LeadMrc1.DeleteSegment(nSeg);
         if(nRet == 0)
            AfxMessageBox("Delete Successful");
      }
   }


SetRgn... example for Visual C++ 4.0
SetRgn... example for C++ 4.0 and later

This example demonstrates the SetRgnEllipse, SetRgnRect, SetRgnRoundRect, and SetRgnPolygon methods by simulating client area coordinates. Normally, you would get the coordinates interactively from mouse events and would use Windows GDI functions to outline the shape of each region before it is created.

To create the polygonal region, this example uses the PolygonSize, PolygonX, and PolygonY properties.

Also, to demonstrate the SetRgnColor method, it uses the Fill method to fill the region with a solid color, then uses the fill color to create a new region.

// Declare local variables
float ZoomFactorX, ZoomFactorY; // For translating positioning information
float OffsetX, OffsetY, CurrentX, CurrentY; // To simulate mouse coordinates
float SimLeft, SimTop, SimWidth, SimHeight; // To simulate mouse coordinates
float LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, eW, eH;// For bitmap coordinates
int i; // Loop counter

// Set up some arrays to use as client area grid values for drawing a polygon.
int xPoint[] = {0, -1, 2, 1, 1, 2, -1, -2};
int yPoint[] = {0, -1, -1, 1, -1, 1, 1, 1};

// Initialize the variables that we will manipulate to simulate mouse coordinates.
OffsetX = m_Lead1.GetScaleWidth() / 15;
OffsetY = m_Lead1.GetScaleHeight() / 15;
CurrentX = OffsetX;
CurrentY = OffsetY;

// Set the zoom factors.
ZoomFactorX = m_Lead1.GetDstWidth() / m_Lead1.GetSrcWidth();
ZoomFactorY = m_Lead1.GetDstHeight() / m_Lead1.GetSrcHeight();

// Start by simulating the drawing of a rectangle.
SimLeft = CurrentX;
SimTop = CurrentY;
SimWidth = OffsetX * 2;
SimHeight = OffsetY * 2;

// Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (m_Lead1.GetDstLeft() / ZoomFactorX)
                       + m_Lead1.GetSrcLeft();
LBRgnTop = (SimTop / ZoomFactorY) - (m_Lead1.GetDstTop() / ZoomFactorY)
                       + m_Lead1.GetSrcTop();
LBRgnWidth = SimWidth / ZoomFactorX;
LBRgnHeight = SimHeight / ZoomFactorY;

// Create the rectangular region, outline it, and display a message so that we can see what happened.
m_Lead1.SetRgnRect(LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, L_RGN_SET);
m_Lead1.SetRgnFrameType(RGNFRAME_STATIC);
MessageBox("Here is the rectangular region");

// Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + OffsetX;
CurrentY = CurrentY + OffsetY;

// Next, simulate the drawing of an ellipse.
SimLeft = CurrentX;
SimTop = CurrentY;
SimWidth = OffsetX * 3;
SimHeight = OffsetY * 2;

// Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (m_Lead1.GetDstLeft() / ZoomFactorX)
                       + m_Lead1.GetSrcLeft();
LBRgnTop = (SimTop / ZoomFactorY) - (m_Lead1.GetDstTop() / ZoomFactorY)
                       + m_Lead1.GetSrcTop();
LBRgnWidth = SimWidth / ZoomFactorX;
LBRgnHeight = SimHeight / ZoomFactorY;

// Add the elliptical region, using a Boolean OR,
// and display a message so that we can see what happened.
m_Lead1.SetRgnEllipse(LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight, L_RGN_OR);
m_Lead1.SetRgnFrameType(RGNFRAME_STATIC);
MessageBox("Here is the added ellipse, with a Boolean OR");

// Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + OffsetX;
CurrentY = CurrentY + OffsetY;

// Next, simulate the drawing of a rounded rectangle.
SimLeft = CurrentX;
SimTop = CurrentY;
SimWidth = OffsetX * 3;
SimHeight = OffsetY * 2;

// Translate the simulated client coordinates to bitmap coordinates.
LBRgnLeft = (SimLeft / ZoomFactorX) - (m_Lead1.GetDstLeft() / ZoomFactorX)
                       + m_Lead1.GetSrcLeft();
LBRgnTop = (SimTop / ZoomFactorY) - (m_Lead1.GetDstTop() / ZoomFactorY)
                       + m_Lead1.GetSrcTop();
LBRgnWidth = SimWidth / ZoomFactorX;
LBRgnHeight = SimHeight / ZoomFactorY;

// Define an ellipse to use for the corners.
eW = LBRgnWidth / 4;
eH = LBRgnHeight / 4;

// Add the rounded rectangular region, using a Boolean exclusive OR,
// and display a message so that we can see what happened.
m_Lead1.SetRgnRoundRect(LBRgnLeft, LBRgnTop, LBRgnWidth, LBRgnHeight,
                 eW, eH, L_RGN_XOR);
MessageBox("Here is the rounded rectangle, with a Boolean XOR");

// Move the current mouse position so that we overlap the existing region.
CurrentX = CurrentX + (2 * OffsetX);
CurrentY = CurrentY + (2 * OffsetY);

// Initialize the polygon size using an arbitrary number.
// This number will be increased dynamically.
m_Lead1.SetPolygonSize(5);

// Fill in the array for the polygon. This simulates a user's mouse clicks.
for( i = 0; i <= 7; ++i)
{
    CurrentX = CurrentX + (xPoint[i] * OffsetX);
    CurrentY = CurrentY + (yPoint[i] * OffsetY);
    m_Lead1.SetPolygonX(i, (CurrentX / ZoomFactorX)
                                         - (m_Lead1.GetDstLeft() / ZoomFactorX)
                                         + m_Lead1.GetSrcLeft());
    m_Lead1.SetPolygonY(i, (CurrentY / ZoomFactorY)
                                            - (m_Lead1.GetDstTop() / ZoomFactorY)
                                            + m_Lead1.GetSrcTop());
    if (i + 1 == m_Lead1.GetPolygonSize())
        m_Lead1.SetPolygonSize(m_Lead1.GetPolygonSize() + 5);
}

// Adjust the polygon size to the actual number of points.
m_Lead1.SetPolygonSize(i);

// Add the polygonal region, using a Boolean OR,
// and display a message so that we can see what happened.
m_Lead1.SetRgnPolygon(L_POLY_WINDING, L_RGN_OR);
MessageBox("Here is the added polygon, with a Boolean OR");

// Fill the resulting polygon with red, and display a message.
m_Lead1.Fill(RGB(255, 0, 0));
m_Lead1.SetRgnFrameType(RGNFRAME_NONE);
m_Lead1.ForceRepaint();
MessageBox("Using SetRgnColor and L_RGN_SETNOT, all else will become blue.");

// Clean up memory
m_Lead1.FreeRgn();

// Do the final region.
m_Lead1.SetRgnColor(RGB(255, 0, 0), L_RGN_SETNOT);
m_Lead1.Fill(RGB(0, 0, 255));
m_Lead1.ForceRepaint();

// Clean up memory
m_Lead1.FreeRgn();
m_Lead1.SetPolygonSize(0);


SetRgnColorHSVRange example for Visual C++ 4.0

//This example sets a region corresponding to all pure green (Hue = 85)
//and colors near green (+/- 10)
//where Saturation is at least 40 and Value is at least 40

void CColorReplaceDlg::OnButton5()
{
   int nH0,nS0,nV0,nH1,nS1,nV1;

   nH0 = 75;
   nS0 = 40;
   nV0 = 40;

   nH1 = 95;
   nS1 = 255;
   nV1 = 255;

   m_Lead.SetRgnColorHSVRange(nH0, nS0, nV0, nH1, nS1, nV1, L_RGN_SET);
   m_Lead.SetRgnFrameType(RGNFRAME_ANIMATED);
}


SetRgnColorRGBRange example for Visual C++ 4.0
SetRgnColorRGBRange example for C++ 4.0 and later

//This example sets a region corresponding to all colors that
//have an rgb that includes red but no green and no blue

void CColorReplaceDlg::OnButton6()
{
   COLORREF crLo;
   COLORREF crHi;

   crLo = RGB(1, 0, 0);
   crHi = RGB(255, 0, 0);
   m_Lead.SetRgnColorRGBRange(crLo, crHi, L_RGN_SET);
   m_Lead.SetRgnFrameType(RGNFRAME_ANIMATED);
}


SetRgnMagicWand example for Visual C++ 4.0
SetRgnMagicWand example for C++ 4.0 and later

void CMfcmagDlg::OnMouseUpLeadctrl1(short Button, short Shift, long x, long y)
{
   m_LEAD1.SetScaleMode(3);
   m_LEAD1.SetRgnMagicWand((float)x, (float)y, 10, L_RGN_SET);
   m_LEAD1.SetRgnFrameType(2);
}


SetSelectionBitmap example for Visual C++ 4.0
SetSelectionBitmap example for C++ 4.0 and later

//set the selection bitmap and selection style
    m_LEAD1.Load("d:\\temp\\flagsel.bmp", 0, 0, 1);
    m_LEADImgList1.SetSelectionBitmap(RGB(0, 255, 0), m_LEAD1.GetBitmap());
    m_LEADImgList1.SetSelectionStyle(SELECTIONSTYLE_USERBITMAP);


SetSrcClipRect example for Visual C++ 4.0
SetSrcClipRect example for C++ 4.0 and later

This example crops the image by reducing the source clipping area and repaints the image.

float NewLeft = m_Lead1.GetSrcClipLeft() + (m_Lead1.GetSrcClipWidth() * 0.1f);
float NewTop = m_Lead1.GetSrcClipTop() + (m_Lead1.GetSrcClipHeight() * 0.1f);
float NewWidth = m_Lead1.GetSrcClipWidth() * 0.8f;
float NewHeight = m_Lead1.GetSrcClipHeight() * 0.8f;
if (NewWidth > 1 && NewHeight > 1)
   m_Lead1.SetSrcClipRect(NewLeft, NewTop, NewWidth, NewHeight);
m_Lead1.ForceRepaint();


SetSrcRect example for Visual C++ 4.0
SetSrcRect example for C++ 4.0 and later

This example zooms in on the image by reducing the source rectangle and repaints the image.

float NewLeft = m_Lead1.GetSrcLeft() + (m_Lead1.GetSrcWidth() * 0.1f);
float NewTop = m_Lead1.GetSrcTop() + (m_Lead1.GetSrcHeight() * 0.1f);
float NewWidth = m_Lead1.GetSrcWidth() * 0.8f;
float NewHeight = m_Lead1.GetSrcHeight() * 0.8f;
if (NewWidth > 1 && NewHeight >1)
   m_Lead1.SetSrcRect(NewLeft, NewTop, NewWidth, NewHeight);
m_Lead1.ForceRepaint();


SetTag example for Visual C++ 4.0
SetTag example for C++ 4.0 and later

void CTest4Dlg::OnSetAndReadTag()
{
   COleVariant myArray;
   long *pData;
   SAFEARRAYBOUND rgsabound;

   // create a variant containing 4 elements. Note that this
   //    is needed only if we use the TAG_LONG tags...
   rgsabound.lLbound = 0;
   rgsabound.cElements = 4;
   V_ARRAY(&myArray) = SafeArrayCreate(VT_I4, 1, &rgsabound);
   if(!V_ARRAY(&myArray))
   {
      MessageBox("Not enough memory");
      return;
   }
   // initialize the array
   V_VT(&myArray) = VT_ARRAY|VT_I4;

   SafeArrayAccessData(V_ARRAY(&myArray), (void HUGEP * FAR*)&pData);
   pData[0] = 1;
   pData[1] = 2;
   pData[2] = 3;
   pData[3] = 127;
   SafeArrayUnaccessData(V_ARRAY(&myArray));

//   set a tag using one of the following:
//   m_Lead1.SetTag(32768, TAG_ASCII, 0, COleVariant("My text string"));
//   m_Lead1.SetTag(32768, TAG_BYTE, 4, myArray);
//   m_Lead1.SetTag(32768, TAG_DOUBLE, 4, myArray);
//   m_Lead1.SetTag(32768, TAG_FLOAT, 4, myArray);
//   m_Lead1.SetTag(32768, TAG_LONG, 4, myArray);
//   m_Lead1.SetTag(32768, TAG_RATIONAL, 2, myArray);
//   m_Lead1.SetTag(32768, TAG_SBYTE, 4, myArray);
//   m_Lead1.SetTag(32768, TAG_SHORT, 4, myArray);
//   m_Lead1.SetTag(32768, TAG_SLONG, 4, myArray);
//   m_Lead1.SetTag(32768, TAG_SRATIONAL, 2, myArray);
//   m_Lead1.SetTag(32768, TAG_SSHORT, 4, myArray);
   m_Lead1.SetTag(32768, TAG_UNDEFINED, 4, myArray);

   // Write the tag. This file must already exist
   m_Lead1.WriteTag("Test.tif", 1);

   OnReadTag();
}

void CTestDlg::OnReadTag()
{
   // read the tag back
   m_Lead1.ReadTag("Test.tif", 1, 32768L);

   GetAndDisplayTag(0);
}

void CTestDlg::GetAndDisplayTag(long lTag)
{
   COleVariant myVar(m_Lead1.GetTagData(lTag));
   int   uTagType = m_Lead1.GetTagType(lTag);
   long  lTagCount = m_Lead1.GetTagCount(lTag);
   CString MsgString, Str1;

   MsgString.Format("Type = %d", uTagType);

   Str1.Format("\r\nCount = %ld", lTagCount);
   MsgString += Str1;

   if(uTagType == TAG_ASCII)
   {
      MsgString += "\r\nData = ";
      MsgString += CString(V_BSTR(&myVar));
   }
   else if(uTagType == TAG_RATIONAL || uTagType == TAG_SRATIONAL)
   {
      long *pData;
      SafeArrayAccessData(V_ARRAY(&myVar), (void **)&pData);

      for(long i = 0; i < lTagCount; i++)
      {
         Str1.Format("\r\nData(%d) = %ld/%ld", i, pData[i*2], pData[i*2+1]);
         MsgString += Str1;
      }

      SafeArrayUnaccessData(V_ARRAY(&myVar));
   }
   else
   {
      void *pData;

      SafeArrayAccessData(V_ARRAY(&myVar), &pData);

      for(long i = 0; i < lTagCount; i++)
      {
         switch(uTagType)
         {
         case TAG_LONG:
            Str1.Format("\r\nData(%d) = %u", i, ((unsigned long*)pData)[i]); break;
         case TAG_SLONG:
            Str1.Format("\r\nData(%d) = %d", i, ((signed long*)pData)[i]); break;
         case TAG_SHORT:
            Str1.Format("\r\nData(%d) = %u", i, (int)((unsigned short*)pData)[i]); break;
         case TAG_SSHORT:
            Str1.Format("\r\nData(%d) = %d", i, (int)((signed short*)pData)[i]); break;
         case TAG_BYTE:
         case TAG_UNDEFINED:
            Str1.Format("\r\nData(%d) = %u", i, (int)((unsigned char*)pData)[i]); break;
         case TAG_SBYTE:
            Str1.Format("\r\nData(%d) = %d", i, (int)((signed char*)pData)[i]); break;
         case TAG_FLOAT:
            Str1.Format("\r\nData(%d) = %f", i, (double)((float*)pData)[i]); break;
         case TAG_DOUBLE:
            Str1.Format("\r\nData(%d) = %f", i, ((double*)pData)[i]); break;
         }
         MsgString += Str1;
      }

      SafeArrayUnaccessData(V_ARRAY(&myVar));
   }

   MessageBox(MsgString);
}

void CTestDlg::OnGetTag()
{
   GetAndDisplayTag (32768L);
}


SkipFile example for Visual C++ 4.0
SkipFile example for C++ 4.0 and later

void CXxxxxxDlg::OnThumbnailEventLeadthumbctrl1(long Bitmap, LPCTSTR pszFilename, short nStatusCode, short nPercent)
{
   CString csOut;
   CString cs;
   //in this example, nCount is a global variable used to count the thumbnails
   switch(nStatusCode)
   {
   case 0: //successful thumbnail generation
      //save thumbnails in a multipage TIFF file
      m_LEAD1.SetBitmap(Bitmap);
      m_LEAD1.Save("c:\\temp\\thumbs.tif", FILE_TIF, 24, 0, SAVE_APPEND);
      nCount++;
      if(nCount > 20) //allow max of 20 thumbnails
      {
         m_LEADThumb1.SetContinueBrowse(FALSE); //stop the browse
         return;
      }
      csOut.Format("%s\nFormat: %d\nCompression: %d\nBits: %d\nWidth: %d\nHeight: %d\nPage: %d\nTotalPages: %d\nSizeDisk: %ld\nSizeMem: %ld\nXRes: %d\nYRes: %d",
                   pszFilename,
                   m_LEADThumb1.GetInfoFormat(),
                   m_LEADThumb1.GetInfoCompression(),
                   m_LEADThumb1.GetInfoBits(),
                   m_LEADThumb1.GetInfoWidth(),
                   m_LEADThumb1.GetInfoHeight(),
                   m_LEADThumb1.GetInfoPage(),
                   m_LEADThumb1.GetInfoTotalPages(),
                   m_LEADThumb1.GetInfoSizeDisk(),
                   m_LEADThumb1.GetInfoSizeMem(),
                   m_LEADThumb1.GetInfoXRes(),
                   m_LEADThumb1.GetInfoYRes());
      break;
   case BROWSE_PRELOAD:
      csOut = pszFilename;
      cs = pszFilename;
      cs = cs.Right(4);
      //check the extension, if it is ".DOC", then skip
      if(!cs.CompareNoCase(".DOC"))
      {
         m_LEADThumb1.SetSkipFile(TRUE);
         AfxMessageBox("skipping - " + csOut);
      }
      break;
   }
   m_LEADThumb1.SetContinueBrowse(TRUE); //continue the browse operation
}


Sharpen example for Visual C++ 4.0
Sharpen example for C++ 4.0 and later

This example increases the sharpness of the bitmap and redisplays the image.

m_Lead1.Sharpen(100);
m_Lead1.ForceRepaint();


Shear example for Visual C++ 4.0
Shear example for C++ 4.0 and later

This example shears the bitmap 5 degrees horizontally and redisplays the image. It uses blue as the fill color.

m_Lead1.Shear(500, TRUE, RGB(0, 0, 255));
m_Lead1.ForceRepaint();


ShowMagGlass example for Visual C++ 4.0
ShowMagGlass example for C++ 4.0 and later

BOOL CSampleDlg::OnInitDialog()
{
   .
   .
   .
   bLeftButton = false;
   m_Lead1.SetEnableMethodErrors(false);
   m_Lead1.Load ("Sample1.cmp", 0, 1, 1);
   m_Lead2.Load("Sample2.cmp", 0, 1, 1);
   m_Lead1.SetMagGlassFlags(MAGGLASS_MANUAL_UPDATE);

   // Starting the Magnifying Glass
   m_Lead1.StartMagGlass(100, 100, 400, RGB(255, 0, 0), RGB(128, 128, 128), false, 1, false, CROSSHAIR_FINE, true, true);

   // Updating the Magnifying Glass bitmap of 1st control with bitmap of the
   // 2nd control that has the same width and height.
   m_Lead1.UpdateMagGlassFromHandle(m_Lead2.GetBitmap(), true);

   hMagGlassCursor = LoadCursor(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDC_MAGGLASS_CURSOR));
   .
   .
   .
}

void CSampleDlg::OnMagGlassCursorLeadctrl1()
{
   // Check if the left button is not down and the Magnifying Glass is started
   if (!(bLeftButton) && (m_Lead1.GetHasMagGlass ()))
      ::SetCursor(hMagGlassCursor);
}

void CSampleDlg::OnMouseDownLeadctrl1(short Button, short Shift, long x, long y)
{
   int      nRet;
   CString  szMsg;

   // Check if this is a left button and the Magnifying Glass is started
   if (Button != 1 || !(m_Lead1.GetHasMagGlass()))
      return;

   // Move the Magnifying Glass to the hit position
   nRet = m_Lead1.SetMagGlassPos((float) x, (float) y);
   if (nRet != 0)
   {
      szMsg.Format("Error while displaying Magnifying Glass, Error: %d", nRet);
      AfxMessageBox(szMsg);
      return;
   }

   // Show the Magnifying Glass
   nRet = m_Lead1.ShowMagGlass(true);
   if (nRet != 0)
   {
      szMsg.Format("Error while displaying Magnifying Glass, Error: %d", nRet);
      AfxMessageBox(szMsg);
      return;
   }

   // Left button is currently pressed
   bLeftButton = true;

   // Hide the cursor
   ::ShowCursor(false);
}

void CSampleDlg::OnMouseMoveLeadctrl1(short Button, short Shift, long x, long y)
{
   int      nRet;
   CString  szMsg;

   // Check if this is a left button and the Magnifying Glass is started
   if (Button != 1 || !(m_Lead1.GetHasMagGlass()))
      return;

   // Move the Magnifying Glass to the mouse position
   nRet = m_Lead1.SetMagGlassPos((float) x, (float) y);
   if (nRet != 0)
   {
      szMsg.Format("Error while Moving Magnifying Glass, Error: %d", nRet);
      AfxMessageBox(szMsg);
   }
}

void CSampleDlg::OnMouseUpLeadctrl1(short Button, short Shift, long x, long y)
{
   int      nRet;
   CString  szMsg;

   // Check if this is a left button and the Magnifying Glass is started
   if (Button != 1 || !(m_Lead1.GetHasMagGlass()))
      return;

   // Show the Magnifying Glass
   nRet = m_Lead1.ShowMagGlass(false);
   if (nRet != 0)
   {
      szMsg.Format("Error while Hiding Magnifying Glass, Error: %d", nRet);
      AfxMessageBox(szMsg);
   }

   // Left button is released
   bLeftButton = true;

   // Show the cursor
   ::ShowCursor(true);
}


Solarize example for Visual C++ 4.0
Solarize example for C++ 4.0 and later

This example applies a solarize effect and repaints the image.

m_Lead1.Solarize(100);
m_Lead1.ForceRePaint();


Sort (ImageList Control) example for C++ 4.0 and later

   //Sort the items in ascending order
   m_LEADImgList1.Sort(TRUE);


SpatialFilter example for Visual C++ 4.0
SpatialFilter example for C++ 4.0 and later

This example applies Laplacian line detection and redisplays the image.

m_Lead1.SpatialFilter(FLT_LAPLACE_1);
m_Lead1.ForceRepaint();


Src... example for Visual C++ 4.0
Src... example for C++ 4.0 and later

This example uses the source rectangle properties to zoom in on the image.

// Calculate the values to zoom in by 10 percent and center the image.
if (m_Lead1.GetSrcWidth() > 1 && m_Lead1.GetSrcHeight() > 1)
{
  m_Lead1.SetSrcWidth(m_Lead1.GetSrcWidth() * 0.9f);
  m_Lead1.SetSrcHeight(m_Lead1.GetSrcHeight() * 0.9f);
  m_Lead1.SetSrcTop((m_Lead1.GetBitmapHeight() - m_Lead1.GetSrcHeight()) / 2);
  m_Lead1.SetSrcLeft((m_Lead1.GetBitmapWidth() - m_Lead1.GetSrcWidth()) / 2);
}
// Set the clipping area to the same as the destination rectangle
m_Lead1.SetSrcClipWidth(m_Lead1.GetSrcWidth());
m_Lead1.SetSrcClipHeight(m_Lead1.GetSrcHeight());
m_Lead1.SetSrcClipTop(m_Lead1.GetSrcTop());
m_Lead1.SetSrcClipLeft(m_Lead1.GetSrcLeft());
// Redisplay the image
m_Lead1.ForceRepaint();


STable example for Visual C++ 4.0
STable example for C++ 4.0 and later

//This example remaps the saturation of each color to one half its original

void CColorReplaceDlg::OnButton9()
{
   int i;
   for (i=0; i<256; i++)
      m_Lead.SetSTable(i, i / 2);
   m_Lead.RemapHue(FALSE, FALSE, TRUE, FALSE);
}


StopMagGlass example for Visual C++ 4.0
StopMagGlass example for C++ 4.0 and later

   HRGN hRoundRectRgn;

   m_LEAD1.SetScaleMode(3);

   // Set MagGlass flags
   // In this case the masked colors from the Magnifying Glass area will be all the colors

   // except those colors which will be set using the MagGlassMask property

   m_LEAD1.SetMagGlassFlags(MAGGLASS_MASK_INVERT);

   //set the color mask to mask out all colors except a few shades of black

   m_LEAD1.SetMagGlassMaskCount(3);

   m_LEAD1.SetMagGlassMask(0, RGB(0, 0, 0));

   m_LEAD1.SetMagGlassMask(1, RGB(1, 1, 1));

   m_LEAD1.SetMagGlassMask(2, RGB(2, 2, 2));

   m_LEAD1.SetRgnFrameType(0);

   m_LEAD1.StartMagGlass(100.0f, 100.0f, 400, RGB(255, 0, 0), RGB(128, 128, 128), TRUE, 1.0f, FALSE, CROSSHAIR_FINE, TRUE, TRUE);

   hRoundRectRgn = CreateRoundRectRgn(0, 0, 100, 100, 25, 25);

   m_LEAD1.UpdateMagGlassShape(MAGGLASS_SHAPE_HRGN, (long) hRoundRectRgn);

   DeleteRgn(hRoundRectRgn);

   //.......some other work..............

   //.......some other work..............

   //Stop the MagGlass

   m_LEAD1.StopMagGlass();


StretchIntensity example for Visual C++ 4.0
StretchIntensity example for C++ 4.0 and later

This example stretches the intensity and redisplays the image.

m_Lead1.StretchIntensity();
m_Lead1.ForceRepaint();


SwapColors example for C++ 5.0 and later

   m_Lead1.SwapColors(SWAP_RG);


TextWordWrap example for Visual C++ 4.0
TextWordWrap example for C++ 4.0 and later

This example wraps text inside the rectangle that is specified for the text object.

// Text location
m_Lead1.SetTextTop(10);
m_Lead1.SetTextLeft(10);
m_Lead1.SetTextWidth(150);
m_Lead1.SetTextHeight(150);

// Text alignment and angle
m_Lead1.SetTextAlign(EFX_TEXTALIGN_LEFT_VCENTER);
m_Lead1.SetTextAngle(0);

// Enable word wrap
m_Lead1.SetTextWordWrap(TRUE);

m_Lead1.DrawText("LEADTOOLS 14 Supports WordWrap when drawing text.", NULL);


TransitionEffect example for Visual C++ 4.0
TransitionEffect example for C++ 4.0 and later

This example paints a transition with a 255-step grayscale gradient.

m_Lead1.SetAutoRepaint(FALSE);
m_Lead1.SetEffectDelay(50);
m_Lead1.Load("c:\\lead\\images\\image1.cmp", 0, 0, 1);
m_Lead1.SetTransitionEffect(EFX_EFFECT_WIPE_RECTANGLE_OUT);
m_Lead1.SetTransitionStyle(EFX_TRANSITION_GRADIENT);
m_Lead1.SetGradientStyle(EFX_GRADIENT_ANGLE_TO_LT);
m_Lead1.SetGradientEndColor(RGB(0, 0, 0));
m_Lead1.SetGradientStartColor(RGB(255, 255, 255));
m_Lead1.SetGradientSteps(255);
m_Lead1.SetAutoRepaint(TRUE);


TransparentColor example for Visual C++ 4.0
TransparentColor example for C++ 4.0 and later

This example sets white as a transparent color; then loads a test image and paints it.

m_Lead1.SetAutoRepaint(FALSE);

// Enable transparency
m_Lead1.SetBitmapEnableTransparency(TRUE);

// Make white the transparent color
m_Lead1.SetBitmapTransparentColor(RGB(255, 255, 255));
m_Lead1.Load("d:\\temp\\ctest.bmp", 0, 0, 1);
m_Lead1.ForceRepaint();


Trim example for Visual C++ 4.0
Trim example for C++ 4.0 and later

This example trims one-tenth from the bitmap and repaints the image.

float NewLeft = m_Lead1.GetBitmapWidth() * .1f;
float NewTop = m_Lead1.GetBitmapHeight() * .1f;
float NewWidth = m_Lead1.GetBitmapWidth() * .8f;
float NewHeight = m_Lead1.GetBitmapHeight() * .8f;
m_Lead1.Trim(NewLeft, NewTop, NewWidth, NewHeight);
// Set the image display size to match the LEAD control
m_Lead1.SetDstRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.SetDstClipRect(0.0f, 0.0f, m_Lead1.GetScaleWidth(), m_Lead1.GetScaleHeight());
m_Lead1.ForceRepaint();


Underlay example for Visual C++ 4.0
Underlay example for C++ 4.0 and later

This example loads a bitmap into m_Lead2 and uses it as a tiled underlay for m_Lead1.

m_Lead2.ShowWindow(SW_HIDE);
m_Lead2.Load("c:\\lead\\images\\ulay1.bmp", 0, 0, 1);
m_Lead1.Underlay(m_Lead2.GetBitmap(), UNDERLAY_TILE);
m_Lead1.ForceRepaint();


UnlockSupport (ImageList Control) example for C++ 4.0 and later

BOOL bRet;

   bRet = m_LEADImgList1.IsSupportLocked(L_SUPPORT_DOCUMENT);
   if(bRet == TRUE)
       m_LEADImgList1.UnlockSupport(L_SUPPORT_DOCUMENT, "yourstringhere");


UnlockSupport (ISIS Control) example for Visual C++ 4.0
UnlockSupport (ISIS Control) example for C++ 4.0 and later

    /*Unlock Document support.*/
    /*Note that this is a sample key, which will not work in your toolkit.*/
    m_LEADISIS1.UnlockSupport(L_SUPPORT_DOCUMENT, "TESTKEY");


UnlockSupport (Mixed Raster Content Control)example for Visual C++ 4.0
UnlockSupport (Mixed Raster Content Control) example for C++ 4.0 and later

   m_LeadMrc1.UnlockSupport (L_SUPPORT_DOCUMENT, "TestKey");
   if(m_LeadMrc1.IsSupportLocked(L_SUPPORT_DOCUMENT))
      AfxMessageBox("UnlockSupport did not work with given key");


UnlockSupport (OLE Control) example for Visual C++ 4.0
UnlockSupport (OLE DB Control) example for C++ 4.0 and later

/*Unlock Document support.*/
/*Note that this is a sample key, which will not work in your toolkit.*/
m_LEADOLEDB1.UnlockSupport(L_SUPPORT_DOCUMENT, "TESTKEY");


UnlockSupport (Thumbnail Browser Control) example for C++ 4.0 and later

    BOOL bRet;

   bRet = m_LEADThumb1.IsSupportLocked(L_SUPPORT_DOCUMENT);
   if(bRet == TRUE)
       m_LEADThumb1.UnlockSupport(L_SUPPORT_DOCUMENT, "yourstringhere");


UnsharpMask example for C++ 5.0 and later

   m_Lead1.UnsharpMask(200, 15, 50, RGB_SPACE);


UserPalette and BitmapPalette example for Visual C++ 4.0
UserPalette and BitmapPalette example for C++ 4.0 and later

This example demonstrates the UserPalette and BitmapPalette properties.

// Specify a blue and white user palette
m_Lead1.SetUserPalette(0, RGB(0, 0, 255));
m_Lead1.SetUserPalette(1, RGB(255, 255, 255));
// Implement the user palette
m_Lead1.ColorRes(1, CRP_USERPALETTE, CRD_ORDEREDDITHERING, 2);
// Display the blue and white image
m_Lead1.ForceRepaint();
MessageBox("This is the user palette. Click OK to change the bitmap palette.");
// Change the bitmap palette to red and white
m_Lead1.SetBitmapPalette(0, RGB(255, 0, 0));
m_Lead1.SetBitmapPalette(1, RGB(255, 255, 255));
// Display the red and white image
m_Lead1.ForceRepaint();


Version... example for Visual C++ 4.0
Version... example for C++ 4.0 and later

This example puts the version information into a string and displays the string in a message box.

CString LevelStr;
if (m_Lead1.GetVersionLevel() == VERSIONLEVEL_EXP)
    LevelStr = "Document/Medical ";
else
    LevelStr = "Professional Edition";
CString cMsg = m_Lead1.GetVersionProduct() + "\n" + LevelStr + "\n";
char cStr[16];
wsprintf(cStr, "%u", (int) m_Lead1.GetVersionMajor());
cMsg = cMsg + "Version: " + cStr + ".";
wsprintf(cStr, "%u", (int) m_Lead1.GetVersionMinor());
cMsg = cMsg + cStr + "\n";
cMsg = cMsg + "Date produced: " + m_Lead1.GetVersionDate() + "\n";
cMsg = cMsg + "Time produced: " + m_Lead1.GetVersionTime() + "\n";
// Display the message box
MessageBox(cMsg, "Version Info");


ViewSize example for Visual C++ 4.0
ViewSize example for C++ 4.0 and later

   long nSize;
   long nFirst;
   long nLast;
   long nCols;
   long nCount;

   //NOTE: assume scroll style = SCROLLSTYLE_VERTICAL
   //get the view size
   nSize = m_LEADImgList1.GetViewSize();
   //get the first visible item
   nFirst = m_LEADImgList1.GetFirstVisibleItem();
   //get the column count
   nCols = m_LEADImgList1.GetColumnCount();
   //calculate the index of last visible item
   nLast = nFirst + (nSize * nCols) - 1; //0 based index
   nCount = m_LEADImgList1.GetCount();
   if (nLast > nCount - 1)
      nLast = nCount - 1;


VTable example for Visual C++ 4.0
VTable example for C++ 4.0 and later

//This example remaps the "value" of each color to one half its original

void CColorReplaceDlg::OnButton10()
{
   int i;
   for (i=0; i<256; i++)
      m_Lead.SetVTable(i, i / 2);
   m_Lead.RemapHue(FALSE, FALSE, FALSE, TRUE);
}


Window (ImageList Control) example for C++ 4.0 and later

//hide the control
   ::ShowWindow((HWND)m_LEADImgList1.GetWindow(), SW_HIDE);
   AfxMessageBox("wait");
   //restore the window
   ::ShowWindow((HWND)m_LEADImgList1.GetWindow(), SW_SHOW);


WindowLevel example for Visual C++ 4.0
WindowLevel example for C++ 4.0 and later

This example converts a bitmap to 12-bit grayscale and then performs window leveling on the eight least significant bits of the image.

    m_Lead1.Grayscale(12);      //Grayscale image to 12-bit

    //use least significant 8 bits

    m_Lead1.SetLevelLowBit(0);

    m_Lead1.SetLevelHighBit(7);

    m_Lead1.WindowLevel();


WindowLevelBitmap example for Visual C++ 4.0
WindowLevelBitmap example for C++ 4.0 and later

//This example loads a 16-bit grayscale, fills the window level lookup table,
//and window levels the bitmap for display only
void CMFC42samplesDlg::OnButtonWindowlevel()
{
long min;
long max;
long i;

//Load a 16-bit grayscale image
m_Lead1.Load("d:\\work\\images\\gray16.tif",0,0,1);
m_Lead1.SetAutoRepaint(FALSE);

//use all bits
m_Lead1.SetLevelLowBit(0);
m_Lead1.SetLevelHighBit(m_Lead1.GetBitmapBits() - 1);

m_Lead1.GetMinMaxBits();
m_Lead1.GetMinMaxVal();
max = m_Lead1.GetMaxVal();
min = m_Lead1.GetMinVal();

//set LUT so it ranges from pure blue to pure red
for (i=min; i<max; i++)
m_Lead1.SetLevelLUT(i, RGB(i % 256, 0, 256 - i % 256));

//Window level for display only--leave the bitmap data unchanged
m_Lead1.SetWindowLevelBitmap(TRUE);

m_Lead1.WindowLevel();
m_Lead1.ForceRepaint();
}


WindowLevelFillLUT example for Visual C++ 4.0
WindowLevelFillLUT example for C++ 4.0 and later

   long nHigh;
   long nLow;

   m_Lead1.Grayscale(16);

   m_Lead1.GetMinMaxBits();
   m_Lead1.GetMinMaxVal();

   m_Lead1.SetLevelLowBit(0);
   m_Lead1.SetLevelHighBit(m_Lead1.GetBitmapBits() - 1);

   nLow = m_Lead1.GetMinBit();

   nHigh = 1<<(m_Lead1.GetMaxBit() - m_Lead1.GetMinBit() + 1);

   //allocate the LUT
   m_Lead1.SetLevelLUT(nHigh - 1, 0);

   //fill the entire LUT with gradient from RED to BLUE
   m_Lead1.WindowLevelFillLUT( RGB(255, 0, 0),
                               RGB(0, 0, 255),
                               nLow, nHigh,
                               m_Lead1.GetMinBit(),
                               m_Lead1.GetMaxBit(),
                               m_Lead1.GetMinVal(),
                               m_Lead1.GetMaxVal(),
                               0,
                               FILLLUT_INSIDE | FILLLUT_LINEAR);

   //now use it
   m_Lead1.WindowLevel();


WMFResolution example for Visual C++ 4.0
WMFResolution example for C++ 4.0 and later

//This example displays the default resolution stored in a WMF,
//changes the resolution to 150 dpi, and then loads the image
void CMFC42samplesDlg::OnButtonWmf()
{
CString str;
CString fileName = "D:\\Adobe\\Photoshop\\RegFiles\\row.wmf";

//Display resolution stored in WMF
//Note that InfoXRes and InfoYRes will return the same value
m_Lead1.GetFileInfo(fileName,0, 0 );
str.Format("InfoXRes: %d\nInfoYRes: %d", m_Lead1.GetInfoXRes(), m_Lead1.GetInfoYRes());
AfxMessageBox(str);

//Set resolution so WMF is loaded at 150 dpi
m_Lead1.SetWMFResolution(150);
m_Lead1.Load(fileName,0,0,1);
}


WriteComment example for Visual C++ 4.0
WriteComment example for C++ 4.0 and later

void CTest4Dlg::OnSetComment()
{
   m_Lead1.SetComment(CMNT_SZARTIST, COleVariant("Me"));
   m_Lead1.WriteComment("Test.tif", 1);

   VARIANT Comment = m_Lead1.ReadComment("Test.tif", 1, CMNT_SZARTIST);
   MessageBox(CString(V_BSTR(&Comment)));
}


WriteMarkerAction example for Visual C++ 4.0
WriteMarkerAction example for C++ 4.0 and later

void CTestDlg::OnTransformFile()
{
   // Rotate the file 90 degrees
   m_Lead1.TransformFile("c:\\temp\\1.jpg", "c:\\temp\\2.jpg", FILE_TRANSFORM_ROTATE90, 1);
}

void CTestDlg::OnTransformMarkerLeadctrl1(short iMarker, long lSize, const VARIANT FAR& vData, short iTransform)
{
   // I will replace the comment present in the file with my own comment
   if(iMarker == 0xFE)
   {
      COleVariant MyCommentString = CString("My comment");
      m_Lead1.SetWriteMarkerAction(WRITEMARKER_IGNORE);
      m_Lead1.WriteMarker(iMarker, 10, MyCommentString);
   }
}


ZoomIn example for Visual C++ 4.0
ZoomIn example for C++ 4.0 and later

This example calls ZoomIn() method to zoom in on a captured image.

m_Lead1.ZoomIn();


ZoomInDone example for Visual C++ 4.0
ZoomInDone example for C++ 4.0 and later

This example triggers the ZoomInDone event and displays a message that the ZoomIn image has been captured.

           void CZoomDlg::OnZoomInDoneLeadctrl1(long x, long y)
           {
              CString cs;

              cs.Format("ZoomIn Captured: %ld,%ld", x, y);
              AfxMessageBox(cs);
           }


Tutorial for Delphi 4.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS ActiveX.

Note:	These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.

Loading and Displaying an Image

Zooming Out and Zooming In

Zooming In on a Selection

Using Transparent Controls

Using a PanWindow


Loading and Displaying an Image (Delphi 4.0)

Take the following steps to start a project and to add some code that positions, scales, and displays an image on the main form:

1.	Start Delphi 4.0.

2.	On the Delphi toolbar, click the ActiveX tab, if one is present.  If you have not added any ActiveX controls, there will not be an ActiveX tab present. If you have used a LEAD ActiveX control before, the icon appears on the toolbar. If no ActiveX controls are present, or if this control is not present, add the LEAD control as follows:

a.	On the Component menu, choose Import ActiveX Control.

b.	In the Import ActiveX dialog box, highlight the LEAD Main Control (12). Change the Class name to TLEAD.  Click the Install button.

c.	In the Install dialog, click OK.

d.	In the Confirm dialog, click Yes.  You will also see the Compiling package dclusr40 dialog confirming that dclusr40 will be compiled.  Click Yes.

e.	After compilation has finished, click OK in the Information dialog.

f.	At this point you will be presented with the dclusr40.pas window, with a Contains folder. Within this folder are LEAD .dcr and .pas files. Save the dclusr40 project.

3.	In the File menu, choose New Application.

4.	Select the LEAD control on the ActiveX toolbar. Size and position the control as you want it to appear at run time, and change the name of the control to LEAD1.

5.	Add a command button to your form and name it as follows:

Name	Caption

LoadLead	Load Image

6.	In the Project menu, choose Add to Project, and add the LEADDEF.PAS file from LEAD's \INCLUDE directory.

7.	Select the Unit1 tab in the editor window.  On the File menu, select Use Unit.  Highlight LEADDEF and select OK.

8.	Code the main form's FormShow procedure as follows. In online help, you can copy the block of code and paste it into your application.

procedure TForm1.FormShow(Sender: TObject);
begin

  { Set defaults for displaying the image. }
  { These are all persistent properties that can be set in the properties box. }
  Lead1.Appearance := APPEARANCE_FLAT;
  Lead1.BorderStyle := 1;
  Lead1.BackColor := RGB(255, 255, 125);
  Lead1.PaintDither := PAINTDITHER_DIFFUSION;
  Lead1.PaintPalette := PAINTPALETTE_AUTO;
  Lead1.AutoRepaint := True;
  Lead1.AutoSize := False;
  Lead1.AutoSetRects := True;
  Lead1.PaintSizeMode := PAINTSIZEMODE_FIT;

end;

9.	Code the LoadLead button's click procedure as follows:

procedure TForm1.LeadLoadClick(Sender: TObject);
begin
    Lead1.Load('c:\lead\images\image1.cmp', 0, 0, 1);
end;

10.	Run your program to test it.

11.	Save the project to use as a starting point for other tasks in this tutorial.


Zooming Out and Zooming In (Delphi 4.0)

Take the following steps to add code that can reduce and enlarge the displayed size of the image. This demonstrates the scaling properties that are normally used for zooming in and zooming out. It emphasizes the relationship of the displayed rectangle to the LEAD control.

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

2.	Add two command buttons to your form and name them as follows:

Name	Caption

ZoomIn	Zoom In

ZoomOut	Zoom Out

3.	Code the ZoomIn button's click procedure as follows:

procedure TForm1.ZoomInClick(Sender: TObject);
begin
  Lead1.AutoSetRects := True;
  Lead1.PaintSizeMode := PAINTSIZEMODE_ZOOM;
  Lead1.PaintZoomFactor :=  Lead1.PaintZoomFactor + 10;
end;

4.	Code the ZoomOut button's click procedure as follows:

procedure TForm1.ZoomOutClick(Sender: TObject);
begin
  Lead1.AutoSetRects := True;
  Lead1.PaintSizeMode := PAINTSIZEMODE_ZOOM;
  If Lead1.PaintZoomFactor > 10 Then
  begin
      Lead1.PaintZoomFactor := Lead1.PaintZoomFactor - 10;
  end;
end;

5.	Run your program to test it.


Zooming In on a Selection (Delphi 4.0)

Take the following steps to add code that lets you select an area with a mouse, and zoom in on the selected area.

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

2.	Code the LEAD control's MouseDown procedure as follows.

procedure TForm1.Lead1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
   {enable AutoRubberBand}
   Lead1.AutoRubberBand := True;
   {Set the pointer to a crosshair}
   Lead1.MousePointer := 2;
end;

3.	Code the LEAD control's RubberBand procedure as follows.

procedure TForm1.Lead1RubberBand(Sender: TObject);
var
   zoomleft, zoomtop, zoomwidth, zoomheight : single;
begin
   Lead1.MousePointer := 0;
   {Zoom in on the selection.}
   zoomleft := Lead1.RubberBandLeft;
   zoomtop := Lead1.RubberBandTop;
   zoomwidth := Lead1.RubberBandWidth;
   zoomheight := Lead1.RubberBandHeight;
   Lead1.ZoomToRect(zoomleft, zoomtop, zoomwidth, zoomheight);
   Lead1.ForceRepaint();
end;

4.	Run your program to test it.


Using Transparent Controls (Delphi 4.0)

Take the following steps to add transparent controls, with special effects. The transparent controls are added as child controls so that they will scroll with the parent image.

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

2.	Add two LEAD controls, which you will set to be transparent at run time. (At design time, you can make the controls easier to see by setting the BackColor property of each control to a different color.) Add the controls as follows:

a.	Add a control named Lead2 as a child control to Lead1. In other words, draw it inside the Lead1 control.

b.	Add a control named Lead3 as a child control to Lead2. In other words, draw it inside the Lead2 control.

3.	Add a command button and code its click event as follows:

procedure TForm1.Button1Click(Sender: TObject);
begin
   Lead1.EnableMethodErrors := False;
   Lead1.AutoRepaint := False;
   Lead2.AutoRepaint := False;
   Lead3.AutoRepaint := False;

   {Make Lead2 and Lead3 Transparent}
   Lead2.Transparent := True;
   Lead3.Transparent := True;

   {Give each control a different effect}
   Lead1.PaintEffect := EFX_EFFECT_WIPE_RECTANGLE_OUT;
   Lead2.PaintEffect := EFX_EFFECT_WIPE_RECTANGLE_IN;
   Lead3.PaintEffect := EFX_EFFECT_WIPE4_R_B_L_B;
   Lead1.EffectDelay := 20;
   Lead2.EffectDelay := 20;
   Lead3.EffectDelay := 20;
   Lead1.EffectGrain := 1;
   Lead2.EffectGrain := 5;
   Lead3.EffectGrain := 1;
   Lead1.ScaleMode := 3;
   Lead2.ScaleMode := 3;
   Lead3.ScaleMode := 3;

   {Position Lead2 and Lead3 inside Lead1}
   Lead2.Width := Round(Lead1.Width / 2);
   Lead2.Height := Round(Lead1.Height / 2);
   Lead2.Left := Round((Lead1.Width - Lead2.Width) / 2);
   Lead2.Top := Round((Lead1.Height - Lead2.Height) / 2);
   Lead3.Top := 0;
   Lead3.Left := 0;
   Lead3.Width := Lead2.Width;
   Lead3.Height := Lead2.Height;

{We will be drawing into the bitmaps}
   Lead2.DrawPersistence := True;
   Lead3.DrawPersistence := True;

   {First, we need some bitmaps}
   Lead2.CreateBitmap(Lead2.ScaleWidth, Lead3.ScaleHeight, 24);
   Lead3.CreateBitmap(Lead3.ScaleWidth, Lead3.ScaleHeight, 24);

   {Fill them with black, which we will make transparent}
   Lead2.Fill(RGB(0, 0, 0));
   Lead3.Fill(RGB(0, 0, 0));
   Lead2.UseBitmapEnableTransparency := True;
   Lead3.UseBitmapEnableTransparency := True;
   Lead2.BitmapTransparentColor := RGB(0, 0, 0);
   Lead3.BitmapTransparentColor := RGB(0, 0, 0);

   {Draw a shape into Lead2}
   {Shape background}
   Lead2.ShapeBackgroundStyle := EFX_BACKSTYLE_TRANSLUCENT;

   {Shape location}
   Lead2.ShapeTop := 0;
   Lead2.ShapeLeft := 0;
   Lead2.ShapeWidth := Lead2.BitmapWidth;
   Lead2.ShapeHeight := Lead2.BitmapHeight;

   {Shape border}
   Lead2.ShapeBorderColor := RGB(255, 0, 0);
   Lead2.ShapeBorderStyle := EFX_BORDERSTYLE_SOLID;
   Lead2.ShapeBorderThickness := 5;
   Lead2.PatternStyle := EFX_PATTERN_TRANSPARENT;

   {Draw the shape}
   Lead2.DrawShape(EFX_SHAPE_STAR4, 0);

   {Draw text into Lead3}
   {Specify the text, font, and styles}
   Lead3.Font.Name := 'Arial';
   Lead3.Font.Size := 40;
   Lead3.TextAngle := 450;
   Lead3.DrawFontColor := RGB(0, 0, 255); {Blue}
   Lead3.TextStyle := EFX_TEXTSTYLE_NORMAL;
   Lead3.TextAlign := EFX_TEXTALIGN_HCENTER_VCENTER;

   {Set the location for the text}
   Lead3.TextTop := 0;
   Lead3.TextLeft := 0;
   Lead3.TextWidth := Lead3.BitmapWidth;
   Lead3.TextHeight := Lead3.BitmapHeight;

   {Set the properties for drawing a rectangle behind the text.}
   Lead3.DrawPenStyle := DRAWPENSTYLE_SOLID;
   Lead3.DrawPenColor := RGB(255, 255, 0);
   Lead3.DrawMode := DRAWMODE_COPY_PEN;

   {Draw the rectangle, then draw the text.}
   Lead3.DrawRectangle(0, 0, Lead3.BitmapWidth, Lead3.BitmapHeight);
   Lead3.DrawText('Text', 0);

{Load an image into Lead1}
   Lead1.Load('c:\lead\images\image1.cmp', 0, 0, 1);
   Lead1.PaintSizeMode := PAINTSIZEMODE_ZOOM;
   Lead1.PaintZoomFactor := 150;
   Lead1.ForceRepaint();

   {Turn off the effects.}
   Lead1.PaintEffect := EFX_EFFECT_NONE;
   Lead2.PaintEffect := EFX_EFFECT_NONE;
   Lead3.PaintEffect := EFX_EFFECT_NONE;
end;

4.	Run your program to test it.


Using a PanWindow (Delphi 4.0)

1.	Start Delphi 4.0.

2.	On the Delphi toolbar, click the ActiveX tab, if one is present.  If you have not added any ActiveX controls, there will not be an ActiveX tab present. If you have used a LEAD ActiveX control before, the icon appears on the toolbar. If no ActiveX controls are present, or if this control is not present, add the LEAD control as follows:

a.	On the Component menu, choose Import ActiveX Control.

b.	In the Import ActiveX dialog box, highlight the LEAD Main Control (12). Change the Class name to TLEAD.  Click the Install button.

c.	In the Install dialog, click OK.

d.	In the Confirm dialog, click Yes.  You will also see the Compiling package dclusr40 dialog confirming that dclusr40 will be compiled.  Click Yes.

e.	After compilation has finished, click OK in the Information dialog.

f.	At this point you will be presented with the dclusr40.pas window, with a Contains folder. Within this folder are LEAD .dcr and .pas files. Save the dclusr40 project.

3.	In the File menu, choose New Application.

4.	Select the LEAD control on the ActiveX toolbar. Size and position the control as you want it to appear at run time, and change the name of the control to LEAD1.

5.	Add a command button from the Standard toolbar to your form and name it as follows:
Name	Caption
PanWindow	Show Pan Window

6.	Add a Check box from the Standard toolbar to the form and name it as follows:

Name	Caption

Check1	Pan Window

7.	In the Project menu, choose Add to Project and add the LEADDEF.PAS file.

8.	Select the Unit1 tab in the editor window.  On the File menu, select Use Unit.  Highlight LEADDEF and select OK.

9.	Double click on the Show Pan Window button and code the PanWindowClick procedure as follows:

procedure TForm1.PanWindowClick(Sender: TObject);
begin
 with LEAD1 do
begin
     {set the location of the PanWindow}
     PanWinX := 100;
     PanWinY := 100;
     {set the size of the PanWindow}
     PanWinWidth := 150;
     PanWinHeight := 200;
     {set the type of mouse pointer}
     PanWinPointer := 12;

     PanWinTitle := 'PanWindow';
     PanWinRectColor := RGB(0, 0, 255);
     PanWinSysMenu := True;
     {use the settings for LEAD1}
     PanWinPaintPalette := PaintPalette;
     PanWinBitonalScaling := BitonalScaling;
     PanWinPaintDither := PaintDither;
     ShowPanWin(True);
end;
    Check1.Checked := True;
end;

10.	Code the FormActivate procedure as follows:

procedure TForm1.FormActivate(Sender: TObject);
begin
       {set the paht and name to an image file on your system}
       LEAD1.Load ('e:\ltwin12x\images\image1.cmp', 0, 0, 1);
end;

11.	Code the Lead1PanWin procedure as follows:

procedure TForm1.Lead1PanWin(Sender: TObject; hPanWin: Integer; iFlag: Smallint);
begin
    if (iFlag = PANWIN_DESTROYED) Then
        Check1.Checked := False;
end;

12.	Run your program to test it.


Programming with the LEADTOOLS ActiveX

The following topics provide a systematic approach to understanding and using the LEAD control's properties, methods, and events:

Registering and Unregistering the ActiveX Controls

Unlocking Vector File Format Support

Unlocking Special LEAD Features

Using Cabinet Files for Packaging ActiveX Controls

Concepts and Definitions

Bitmaps and Bitmap Lists

Loading Filters

Input and Output

Implementing Internet Features

Displaying an Image

Scrolling an Image

Cleaning Up 1-Bit Images

Thumbnail Browser

Using the ImageList Control

Using a PanWindow

Implementing Transparency

Implementing TIFF Tags

Using Special Effects When Painting

Using the Magnifying Glass

Playing an Animation

Printing an Image

Marking a Selection with a Rubberband

Drawing Shapes and Text

Copying and Creating Bitmaps

Image Processing

Creating and Using a Bitmap Region

Managing Palettes

Working with MRC Bitmap

Implementing Annotations

Annotation Files

Annotation Menu

Annotation Toolbar

Implementing Annotation Security

Moving the Name of an Annotation

Implementing Annotation Hyperlinks

Changing the Annotation Automation Background Colors

Low-Level Coordinate System for Annotations

Annotation Objects - Default Values

Annotation Objects - Automated Features

Controlling and Detecting Events

Getting LEADTOOLS Toolkit Information

Miscellaneous Methods and Properties

Layers in Files

Super Compressed Bitmaps


Registering and Unregistering the ActiveX Controls

Registering ActiveX Controls

Before any ActiveX Control can be used, it must be registered.  The installation program automatically registers all the LEADTOOLS Controls.  If you would like to manually register the controls run:

REGSVR32.EXE for 32-bit ActiveXs

found in the BIN directory and pass the name of the ActiveX to register as a parameter.

EX.:

REGSVR32 LTOCX14N.OCX will register the Main ActiveX.

REGSVR32 LTDLG14N.OCX will register the Imaging Common Dialog ActiveX.

REGSVR32 LTISI14N.OCX will register the ISIS ActiveX.

Unregistering ActiveX Controls

To unregister ActiveX Controls, include the "/u" switch before the ActiveX name when running:

REGSVR32.EXE for 32-bit ActiveXs

EX.:

REGSVR32 /u LTOCX14N.OCX will unregister the Main 32-bit ActiveX.

REGSVR32 /u LTDLG14N.OCX will unregister the LEAD Imaging Common Dialog ActiveX.

REGSVR32 /u LTISI14N.OCX will unregister the ISIS ActiveX.

NOTE: The LEADTOOLS ActiveXs do not register without certain DLLs.  For a list of required DLLs, refer to Files To Be Included With Your Application.


Unlocking Vector File Format Support

Vector Toolkits

Support for the DXF, DWF, DWG, PCT, PLT, DRW, DGN, WMF, EMF , GBR and CGM file formats is provided in the LEADTOOLS Vector toolkits. This support is unlocked when the Vector features are unlocked by calling UnlockSupport(L_SUPPORT_VECTOR, L_KEY_VECTOR). The L_KEY_VECTOR key is provided when a LEADTOOLS Vector toolkits is purchased.

The LEADTOOLS Vector View features are available in the LEADTOOLS Vector View Plug in. This plug in can be added to any LEADTOOLS product. The LEADTOOLS Vector Viewing features provide vector viewing support without editing support. To use the Vector View features, UnlockSupport must be called with the key found on the Vector View Plug in Unlock Certificate, included in your product packaging. UnlockSupport(L_SUPPORT_VECTOR_VIEW, "Vector View Features Unlock Certificate key") tells the package to unlock support for the Vector View features and passes the key for verification.

Non-vector Toolkits

EMF, WMF and PCT files can be read or written as either vector or raster images. Non-vector toolkits will read and write EMF, WMF and PCT files as raster images.

Read support for the DXF, DWF, DWG, PLT, DRW, DGN , GBR and CGM file formats can be added to any non-vector toolkit by purchasing the LEADTOOLS Vector View plug-in. Once the plug-in has been purchased, the vector view support, including the vector file format read support, must be unlocked. This support will let you read the file formats listed above and perform limited vector image manipulation.

Please note that the L_SUPPORT_VECTOR_DWG, L_SUPPORT_VECTOR_DWF, L_SUPPORT_VECTOR_DXF, L_SUPPORT_VECTOR_MISC and L_SUPPORT_VECTOR_ALL, mentioned below, are now obsolete. If these constants are currently in your code, they will continue to work in LEADTOOLS 14. However, you should consider adding the LEADTOOLS Vector View Plug in or upgrading to the LEADTOOLS Vector Imaging Pro toolkit.

To unlock DWF read support, call UnlockSupport (L_SUPPORT_VECTOR_DWF, L_KEY_VECTOR_DWF). This call tells the package to unlock read support for the DWF file format and passes the key for verification. The L_KEY_VECTOR_DWF value will be provided when the plug-in is purchased. This support will let you read DWF files as rasterized images.

To unlock DWG read support, call UnlockSupport (L_SUPPORT_VECTOR_DWG, L_KEY_VECTOR_DWG). This call tells the package to unlock read support for the DWG file format and passes the key for verification. The L_KEY_VECTOR_DWG value will be provided when the plug-in is purchased. This support will let you read DWG files as rasterized images.

To unlock DXF read support, call UnlockSupport (L_SUPPORT_VECTOR_DXF, L_KEY_VECTOR_DXF). This call tells the package to unlock read support for the DXF file format and passes the key for verification. The L_KEY_VECTOR_DXF value will be provided when the plug-in is purchased. This support will let you read DXF files as rasterized images.

To unlock PLT, DRW, DGN , GBR and CGM read support, call UnlockSupport (L_SUPPORT_VECTOR_MISC, L_KEY_VECTOR_MISC). This call tells the package to unlock read support for the file formats mentioned above, and passes the key for verification. The L_KEY_VECTOR_MISC value will be provided when the plug-in is purchased. This support will let you read PLT, DRW, DGN , GBR and CGM files as rasterized images. Please note that this will not unlock read support for DWF, DWG or DXF.

To unlock read support for all vector file formats, call UnlockSupport (L_SUPPORT_VECTOR_ALL, L_KEY_VECTOR_ALL). This call tells the package to unlock read support for all vector file formats and passes the key for verification. The L_KEY_VECTOR_ALL value will be provided when the plug-in is purchased. This support will let you read all supported vector files as rasterized images.


Unlocking Special LEAD Features

LEAD offers a variety of features, such as Document support, Medical support, Vector support, etc., which are only available in certain toolkits and are locked. To use these features you must:

 purchase a toolkit that supports the desired feature(s).

 print the applicable runtime agreement from the help file. For information on the runtime agreements, go to Topic Selection and click on the LEAD Licensing button.

 complete the Transmittal document and fax it and the runtime agreement to LEAD's Licensing Department at 704 – 372 – 3789. (To view the transmittal document you must have Adobe® Acrobat® installed.)

 if prepaid licenses are desired, include the order form with payment information. You can fax this along with the Transmittal form and the runtime agreement. (To view the order form you must have Adobe® Acrobat® installed.)

 once we have received the signed agreement, we will send instructions for eliminating the license dialogs and the key(s) necessary for unlocking the appropriate features.

 when you have received the instructions and the key(s) call the UnlockSupport method with the appropriate key.

For example, if you have purchased the LEADTOOLS Document Imaging toolkit:

 print the Document Imaging Agreement (or the Document Imaging with OCR Agreement if you have also purchased the LEADTOOLS OCR Module).

 complete the Transmittal document and fax it and the Document Imaging Agreement (or the Document Imaging with OCR Agreement) to LEAD's Licensing Department.

 if you want prepaid licenses, print a copy of the order form, fill it out and send the order form and payment information to LEAD.

 once we have received the signed Document Imaging Agreement (or Document Imaging with OCR Agreement), we will send the instructions for eliminating the license dialogs and any necessary keys.

 when you receive the instructions and the key(s), call UnlockSupport (L_SUPPORT_DOCUMENT, "Document Key") to unlock the Document features. Please note that "Document Key" represents the actual key you will receive from LEAD. Also note that if you also purchased the LEADTOOLS OCR Module, the OCR features will have to be unlocked separately, using the appropriate key.

For information on products and the features available in each product, or for information on licensing, refer to Topic Selection.

To determine if a certain feature is locked, call the IsSupportLocked method.


Using Cabinet Files for Packaging ActiveX Controls

The tools you need to create and sign CAB files are provided on the Visual C++® 5.0 CD in the CAB&SIGN directory. The utilities in the CAB&SIGN directory are not installed automatically when you install Visual C++, so you must copy the contents of the CAB&SIGN directory to your hard drive.

Before you can sign files, you need to get a Software Publisher Certificate. You must apply for your own certificate to a Certification Authority. With the tools in the CAB&SIGN directory, you can create a test certificate for testing purposes, but this certificate cannot be used to sign code for distribution. See Step 1 below for information about applying for a Software Publisher Certificate.

These are the steps used to create a signed CAB file. Each step provides a link to further information concerning that particular step.

Step 1 Get a Software Publisher Certificate (CAB) (you only need to do this once).

Step 2 Create the CAB File.

Step 3 Signing the CAB Files.

Step 4 Embed the Signed CAB File in a Web Page (optional).


Get a Software Publisher Certificate (CAB)
Step 1 Get a Software Publisher Certificate (CAB)

Before you can sign files, you need to obtain a Software Publisher Certificate (SPC). To do this, you must make a request to a Certification Authority. During the application process, you must generate a key pair and provide the Certification Authority with identification information, such as your name, address, and public key. You must also make a legally binding pledge that you cannot and will not distribute software you know or should have known contains viruses or will otherwise maliciously harm the user's machine or code.

To apply for a certificate, see "Digital Certificates for Authenticode" at

http://msdn.microsoft.com/workshop/security/authcode/certs.asp

The Certification Authority generates a Software Publisher Certificate that conforms to the industry standard X.509 certificate format with Version 3 extensions. The certificate identifies you and contains your public key. The Certification Authority stores it for reference and a copy is returned to you via electronic mail. After accepting the certificate, you should include a copy of it in all published software signed with the private key.

Note: For testing purposes a test certificate is used for signing your CAB file. For more information, refer to Making a Test Software Publisher Certificate below.

Making a test Software Publisher Certificate

You can use the MAKECERT and CERT2SPC utilities provided in the CAB&SIGN directory on the Visual C++ 5.0 CD to make a test Software Publisher Certificate. Note that this test SPC is not valid for software publishing, but can be used to test code signing.

To make a private key file called MYKEY.PVK and a company certificate called CERT.CER, run the MAKECERT utility with the following command:

C:\CAB&SIGN\MAKECERT -u:MyKey -n:CN=MySoftwareCompany
 	–k:MYKEY.PVK CERT.CER

MyKey is the name you give to your key and MySoftwareCompany is the name of your company. Note that the MAKECERT utility is case sensitive to command-line options, so you must use lowercase -u, -n, and -k. The value for the -n option must be an uppercase CN=.

To create a test Software Publisher Certificate (SPC) called CERT.SPC, run the CERT2SPC utility with the following command:

C:\CAB&SIGN\CERT2SPC C:\CAB&SIGN\ROOT.CER CERT.CER CERT.SPC

Note that the CERT.SPC file is created from the CERT.CER file you created with MAKECERT and from the ROOT.CER file provided in the CAB&SIGN directory.

Signing Cabinet Files

A .cab file can be digitally signed like an ActiveX control. A digital signature provides accountability for software developers: The signature associates a software vendor’s name with a given file. A signature is applied to a .cab file (or control) using Microsoft Authenticode Technology.

The CAB toolset assists software developers in applying digital signatures to CAB files by allowing a developer to allocate space in the CAB file for the signature (See Step 3 Signing the CAB File).


Create the CAB File
Step 2 Create the CAB File

This section describes creating CAB files for distributing ATL and MFC controls over the Internet. If you need more information about CAB files, see the Cabinet File Reference in the Platform SDK section Setup and System Management Services\Setup API\Overview\Cabinet Files. The Platform SDK is included with the Visual C++ 5.0 online documentation and in the MSDN Library.

To create a CAB file:

1. Create an INF file (see Creating an INF File below).

2. Run the CABARC utility (available in the CAB&SIGN directory on the CD) to make the CAB file.

INF Files

An .inf file contains data that Microsoft® Windows 95/98, Windows NT 4.0, and Windows 2000 and later use to load and register a bundled control (as well as any files required by that control). Each section of the .inf file is described below.

Read Carefully:

Before talking about the sections of the .inf  file let’s take the following scenario:

A developer created an ActiveX control using ATL. The control is called MyCtrl.ocx which, in order to run, needs the dependent DLL called MyFile.DLL.

The developer wants to package the ActiveX control with its related DLL into a .cab file that is distributable over Internet.

Note: since the control was created using ATL then atl.dll is needed on the user machine in order to run the control.

The developer wrote the following MyFile.inf:

 [version]
   signture="$CHICAGO$"
   AdvancedINF=2.0

[Add.Code]
   MyFile.DLL = MyFile.DLL
ATL.DLL = ATL.DLL
   MyCtrl.ocx = MyCtrl.ocx

[MyFile.DLL]
file-win32-x86=thiscab
FileVersion=
DestDir=11
RegisterServer=yes

[ATL.DLL]
file-win32-x86=thiscab
FileVersion=
DestDir=11
RegisterServer=yes

[MyCtrl.ocx]
file-win32-x86=thiscab
clsid={46A5E7C2-3003-11D4-8735-00E0295AF9CE}
FileVersion=
DestDir=11
RegisterServer=yes

All explanations that follow depend on the above mentioned scenario.

Creating the .INF File

The first section in the .inf file is the [version] section. In the sample .inf, this section has the following format:

  [version]
      signature="$CHICAGO$"
      AdvancedINF=2.0

The signature= tag specifies that the .inf version is compatible with Windows 95/98, Windows NT 4.0, and Windows 2000 and later.

The AdvancedINF= tag identifies the version of Advpack.dll that Internet Explorer 4.0 must load in order to parse this .inf file. In this case, version 2.0 is required.

The [Add.Code] Section of the .inf File:

The second section of the .inf file is the largest section. In addition to the section immediately following the [Add.Code] tag, this section includes the subsections that are identified by the  [MyFile.DLL], [atl.dll], [MyCtrl.ocx] tags.

The [Add.Code] section maps files required by a given .ocx file to subsections in the .inf file. In the sample .inf file, this section has the following format:

[Add.Code]
   MyFile.DLL = MyFile.DLL
   ATL.DLL = ATL.DLL
   MyCtrl.ocx = MyCtrl.ocx

The First line in this section maps MyFile.DLL (the file that contains the needed DLL) to a subsection of the same name.

The Second line in this section maps ATL.DLL to a subsection of the same name. The ATL.DLL is required on a user's computer before the control will successfully run.

The Third line in this section maps MyCtrl.OCX (the file that contains the sample control) to a subsection of the same name.

[MyFile.DLL]
   file-win32-x86=thiscab
   FileVersion=
   DestDir=11
   RegisterServer=yes

The first line in this subsection specifies that the x86 binary is found in the same .cab file as the .inf file.

The second line specifies the File’s version.

The Third line in this subsection specifies the destination directory on the user’s machine where the file will be installed.

The fourth line specifies that Internet Explorer 4.0 and later should register the control (using the specified version number).

[ATL.DLL]
   file-win32-x86=thiscab
   FileVersion=
   DestDir=11
   RegisterServer=yes

The first line in this subsection specifies that the x86 binary is found in the same .cab file as the .inf file.

The second line specifies the File’s version.

The Third line in this subsection specifies the destination directory on the user’s machine where the file will be installed.

The fourth line specifies that Internet Explorer 4.0 and later should register the control (using the specified version number).

The [MyCtrl.ocx] subsection of the [Add.Code] section:

The [MyCtrl.ocx] subsection has the following format:

[MyCtrl.ocx]
   file-win32-x86=thiscab
   clsid={46A5E7C2-3003-11D4-8735-00E0295AF9CE}
   FileVersion=
   DestDir=11
   RegisterServer=yes

The first line in this subsection specifies that the x86 binary is found in the same .cab file as the .inf file.

The second line specifies the control's CLSID.

The third line specifies the control's version.

The fourth line in this subsection specifies the destination directory on the user’s machine where the file will be installed.

The fifth line specifies that Internet Explorer 4.0 and later should register the control (using the specified CLSID and version number).

Important Note: Note that if your control requires that a DLL be registered before the control (as required in our scenario), its corresponding entry in the .inf file must precede the control's entry in the file. Also, note that the order of the source files in the command line that is passed to Cabarc.exe must match the order of the file references in the .inf file.

Building the .cab File

Once you have installed Cabarc.exe and built the .inf file for your package, you can build the cab file. In the case of the sample .cab file, this entailed running Cabarc.exe with the following arguments:

C:\cab&sign\Cabarc  –s  6144   n  MyControl.cab   MyFile.DLL   MyCtrl.ocx MyFile.inf

Where  MyControl.cab is the name of the generated .cab file.

(C:\cab&sign\Cabarc can be written at the command prompt for a list of options for the utility Cabarc.exe )

Note:

1.The order of the files is related to the order indicated inside the .inf file.

2.You must run the Cabarc.exe in the directory containing your control .inf files.


Signing the CAB File
Step 3 Signing the CAB File

When IE 4.0 and later versions are running at the default security level, any object identified by the OBJECT object on an HTML page must be digitally signed.

A digital signature associates a software vendor’s name and a unique public key with a file that contains an ActiveX object.

The test certificate generated before can be used to sign the CAB file.

Use the signcode.exe utility (and accompanying wizard), to sign the .cab file

C:\CAB&SIGN\Signcode

If the signcode is successful, it will have embedded a PKCS7 certificate in the cab file.

If you package your control in one or more .cab files, each file must be digitally signed.


Embed the Signed CAB File in a Web Page
Step 4 Embed the Signed CAB File in a Web Page

An ActiveX control is identified by the OBJECT object in an HTML file. If the control is stored in a .cab file, OBJECT must include a CODEBASE= attribute that specifies the URL of this .cab file.

Example:

<OBJECT CLASSID="CLSID:46A5E7C2-3003-11D4-8735-00E0295AF9CE"
codebase="http://webserver/MyControl.cab"
ALIGN ="CENTER" WIDTH=400 HEIGHT=300 ID="MyCtrl2">


Concepts and Definitions

The LEAD control lets you load an image from a file, manipulate it as a bitmap in memory, display it in the control, manipulate the way it is displayed, print the bitmap, and save it to a file.

The following illustrates the fundamental components and their relationships:

The LEAD control is the OLE custom control that you add to your application. In the illustration, the LEAD control is the box inside the window where the image is displayed.

The bitmap is the image data in memory. The LEAD control references the bitmap. Most LEAD methods that alter an image (such as Grayscale or Rotate) actually alter the bitmap. If you alter a bitmap, the changes you make do not appear in the control until the image repaints. When you save a bitmap, the changes you have made are saved in the file.

The displayed image is the rectangle on the screen that shows all or part of the bitmap. It can be positioned, scaled, and cropped without affecting the image data in memory. For information on the source and destination rectangles that control which part of an image is displayed, refer to Specifying Only the Destination Rectangles, Specifying Both the Source and Destination Rectangles, Specifying the Source Clipping Rectangle and Specifying the Destination Clipping Rectangle. For more information about how to position, scale, and crop an image, refer to Displaying an Image.


Bitmaps and Bitmap Lists

To support multipage files and animation, the LEAD control can reference a list of bitmaps. In fact, even a control with only one bitmap has a list, and the list contains only the one bitmap.

The following properties reference the control's entire list of bitmaps:

BitmapList property

BitmapListCount property

The following methods lets you update a bitmap list:

InsertBitmapListItem method

DeleteBitmapListItems method

You can copy an entire list by assigning the BitmapList property from one control to another. You can free all of the bitmaps in the list by setting the property to 0. You can also reference the entire list of bitmaps when you load and save multipage files and when you play the list as an animation.

Most methods and properties reference only one bitmap (the current bitmap). When there is a list of bitmaps, the following property lets you specify the current bitmap:

BitmapListIndex property

The following property references the control's current bitmap:

Bitmap property

You can copy one control's current bitmap to another control's current bitmap by assigning the Bitmap property from one control to the other. You can remove the current bitmap from the list (freeing the bitmap) by setting the Bitmap property to 0. When a control has only one bitmap, you do not have to set the BitmapListIndex property to specify the current bitmap.

When assigning a bitmap of one control to a bitmap of another control, RefBitmap property can be used to indicate whether to perform a copy, or simply reference the source control’s Bitmap property.

When assigning a bitmap list of one control to a bitmap list of another control, RefBitmapList property can be used to indicate whether to perform a copy, or simply move the source control’s BitmapList property to the destination control's BitmapList property.

To delete a specific page from a multipage file that supports delete operations, use the following method:

DeletePage method


Loading Filters

Some operating systems (like Windows 95) have a limit for the number of DLLs that can be loaded at a time and that limit can be quickly reached, especially if there are several different controls on the same page/form or if the programming environments themselves load many DLLs.  By default, LEADTOOLS loads several fixed filters and several cached filters.  The fixed filters are FAX, CMP, TIF, JBG, LMB, BMP and PCX.

Use the following method to specify the file format filters you want LEADTOOLS to load:

PreLoadFilters method

Use the following method to specify the file formats LEADTOOLS should never load:

IgnoreFilters method


Input and Output

The following topics describe the kinds of input and output:

Loading a Bitmap from a File

Loading a Bitmap from Your Own Buffer

Loading Vector Files

Saving a Bitmap to a File

Maintaining File Comments

Implementing PhotoCD and FlashPix Features

Implementing JBIG Plug In Features

Implementing JPEG 2000 Plug in Features

Implementing PDF Plug in Features

Managing Images in a Database

Using a Visual Basic Data Control

Using the OLE DB Control

Using Memory-Resident Image Files

Capturing an Image from the Screen

Using ISIS to Scan Images


Loading a Bitmap from a File

Use the following method to load a file into a bitmap. In most cases, this method is all you need to load a file. Other methods and properties listed in this topic are for optional features and special cases.

Load method

To load an image from a file and resize it as it is being loaded to the desired width, height and bits per pixel, use the following method:

LoadResize method

To load a file asynchronously from an Internet URL or local pathname, refer to Implementing Internet Features.

Use the following properties and event to control loading an image through an OLE drag-and-drop operation:

OLEDropAllowed property

OLEDropAutoLoad property

OLEDropFile event

Use the following method to load a thumbnail (stamp image) into a bitmap from a JFIF or LEAD CMP file:

LoadStamp method

Use the following method to get information about a file before loading it:

GetFileInfo method

Then, read the following properties, which the method updates:

InfoBits property

InfoCompress property

InfoFormat property

InfoHasAlpha property

InfoHeight property

InfoLayers property

InfoXRes property

InfoYRes property

InfoPage property

InfoPCDRes property

InfoSizeDisk property

InfoSizeMem property

InfoTotalPages property

InfoViewPerspective property

InfoWidth property

Use the following property to let the user see the progress when loading a bitmap:

PaintWhileLoad property

The WMFResolution property sets the DPI (dots per inch) value that LEADTOOLS uses when loading WMF files.

When loading multi-page files, the FilePageLoaded event is fired for each page loaded, only if the EnableFilePageLoadedEvent property has been set to TRUE. The FilePageLoaded event can be used to store or get information about individual pages of the multi-page file.

Bitmap data can be signed or unsigned. If the bitmap data is signed, the image processing and paint methods may not work correctly. A bitmap will not be loaded signed unless the LoadSigned property is set to TRUE before loading the image. For more information on this, refer to Examining and Altering Bitmaps.

Use the following property to specify the number of paint-while-load passes when the file is a progressive LEAD or JPEG file, or when it is an interlaced PNG file:

ProgressivePasses property

Use the following property to specify which of the available resolutions in a PCD file to load:

PCDRes property

For PCD and FlashPix files, additional methods and properties are described in Implementing PhotoCD and FlashPix Features.

Use the following property to let a bitmap with a rotated view perspective keep its internal orientation when it is loaded.

LoadUseViewPerspective property

Use the following property to indicates whether to load 1-bit images images compressed or uncompressed:

LoadCompressed property

Use the following properties, if necessary, to supply format information about the image data that is being loaded. You can use this feature for loading input data (such as raw fax) that LEADTOOLS cannot recognize. When loading an image from a file, LEADTOOLS normally determines the file format from the file header, and if the format is unrecognized, the function returns an error. The LoadInfo event occurs before the error, and you can set these properties in that event (or anywhere else in your program) to supply the missing format information and prevent the error. (LEADTOOLS checks for a non-zero value in the LoadInfoFormat property, but to implement this feature, you need to set all of the properties to appropriate values.)

LoadInfoBits property

LoadInfoFlags property

LoadInfoFormat property

LoadInfoHeight property

LoadInfoOffset property

LoadInfoWidth property

LoadInfoXRes property

LoadInfoYRes property

To set the file format to try first when recognizing files for loading, set the PreferredLoadFormat property.


Loading a Bitmap from Your Own Buffer

You can use the following methods to control the input stream in a file-load process. This is especially useful for handling a transmitted image, such as an image received over the Internet. These methods let you collect image data in your own buffer and feed the data to the LEAD control little-by-little, each time your buffer fills.

StartFeedLoad method

FeedLoad method

StopFeedLoad method


Loading Vector Files

LEADTOOLS provides support for working with several vector file formats. The most extensive support is available in selected products only. For more information on the properties, methods and events supported in the Vector Features, refer to the Ltvecocxn.hlp file in your LEADTOOLS \Help directory.

Depending on the toolkit, support for certain vector file formats may require purchasing a file format plug in. In addition, the vector file format support must be unlocked. For more information about vector file format support, refer to Unlocking Vector File Format Support. For more information on available File Format Plug ins, refer to Topic Selection and click on LEAD Products.

When working with Vector files, you can use the Vector features, available in selected products, or you can use the Main OCX. If you use the Main OCX for loading, using the standard loading methods, you can modify the view port and view mode using the following:

RasterizeViewMode property

RasterizeViewportHeight property

RasterizeViewportWidth property


Saving a Bitmap to a File

Use one of the following methods to save the bitmap in a file:

Save method

SaveWithStamp method

If you are saving a progressive JPEG or CMP file, set the following property to specify the number of passes in the file:

ProgressivePasses property

If you are saving a GIF file, set the following property to specify whether it is saved as an interlaced file:

SaveInterlaced property

If you are saving an animated GIF file, information specified in the animation playback properties is saved in the file. For details, refer to the description of the Save method.

When saving a TIFF 1-bit image, you can save it least significant bit first or most significant bit first by setting the SaveLSB property.

TIF files can be saved in strips or they may be saved in tiles. The SaveTileWidth property determines whether a TIF files will be saved in strips or tiles. If it is set to 0, TIF files will be saved in strips. If the SaveTileWidth property is greater than the bitmap width, the TIF file will be saved in strips. If the SaveTileWidth property is less than the bitmap width, the TIF file will be saved in tiles and the SaveTileHeight property will determine the height of the tiles.

When saving a page to a multi-page file, the new page either replaces an existing page or is inserted before an existing page.  Set the following property to determine which page to replace, or where to insert the new page.

SavePage property

The SaveOffset method saves a bitmap to a file, starting at a specified offset. This enables you to embed an image file in another file. After calling the SaveOffset method, the FileSizeWritten property is updated with the length of the file written, in bytes.

When saving RAW uncompressed data, the SavePad4 property can be used to determine whether or not to pad each line so the length is a multiple of four bytes. For more information on saving RAW uncompressed data, refer to Working with the RAW File Filter.

For FlashPix files, additional considerations are described in Implementing PhotoCD and FlashPix Features.


Maintaining File Comments

Some file formats can contain comments, and some cannot, and each file format has its own set of comment types, as described in Types of File Comments.

An array of comments can be maintained in memory. These comments can be written to a file, along with the control's loaded bitmap, when the file is saved. The comments can also be written to an existing file, without overwriting the stored image. You can maintain an array of comments in memory, and when you save a file, the comments from the array are written to the file. There is only one array of comments for your application, regardless of how may LEAD controls your application contains. You control the contents of the array; loading or saving a file does not initialize the array. You can use the following property to get and set the value of any comment in the array:

Comment property

To read the existing comments from a file, use the following method:

ReadComment method

To write comments to an existing file, without overwriting the stored image with the control's loaded bitmap, use the following method:

WriteComment method


Implementing PhotoCD and FlashPix Features

A Kodak PhotoCD or FlashPix file can contain more than one copy of the same image, each at a different physical resolution (width and height in pixels). For PhotoCD files, the resolutions are based on fixed sizes. As a result, all PhotoCD files have the same aspect ratio. For FlashPix files, the aspect ratio can vary; so there is not a list of fixed sizes.

For PhotoCD files, which LEADTOOLS can read but not write, you can use the InfoPCDRes property to examine which of the fixed sizes are available in a file. You can then use the PCDRes property to specify which of the fixed sizes to load.

LEADTOOLS can read and write FlashPix files.

When loading FlashPix files, there are some newer methods and properties, which can also be used with the PhotoCD files. You can use the following method and properties to examine which sizes are available in a file:

ReadLoadResolutions method

LoadResolutionCount property

LoadResolutionHeight property

LoadResolutionWidth property

You can then use the following method to specify which size to load:

SetLoadResolution method

The following method gets the last width and height values that were set with the SetLoadResolution method:

GetLoadResolution method

Special considerations when saving FlashPix files:

LEADTOOLS does not support the multi-resolution update features of the FlashPix format. The LEADTOOLS save functions always create a new file from the current bitmap, and the highest resolution in the new FlashPix file has the dimensions of the current bitmap. Therefore, if you overwrite an existing FlashPix file, you can lose any resolutions with larger dimensions than the current bitmap.

The format constant that you specify when saving a FlashPix file determines the type of compression. The following are the possible choices:

Format Constant	Meaning

FILE_FPX	FlashPix, with no compression

FILE_FPX_SINGLE_COLOR	FlashPix, compressed with the single color method, which is a FlashPix-specific compression method

FILE_FPX_JPEG	FlashPix, compressed with JPEG, using the FlashPix default Q factor

FILE_FPX_JPEG_QFACTOR	FlashPix, compressed with JPEG, using the specified Q factor

The compression is done by the Kodak support DLLs (LFKODAK.DLL and LFFPX7.DLL). You can use the same Q factors as with LEAD's JPEG engine (setting a value from 2 to 255, where 2 is the highest quality and 255 is the most compression), but the compression engine is not the same as LEAD's. You cannot use the InfoCompress property to determine the compression method in a FlashPix file.

Other considerations for PhotoCD and FlashPix files:

LEADTOOLS can only read PhotoCD and FlashPix files directly from disk files. Therefore, the methods for loading files from memory and saving files to memory are not applicable.

The FlashPix format requires OLE support. Therefore, you may need to include OLE support files, such as MSVCRT40.DLL, MFC40.DLL, and OLEPRO32.DLL, with your application.

Implementing PhotoCD and FlashPix Features


Implementing JBIG Plug In Features

JBIG defines a method for lossless compression encoding of a bi-level image (two color image). This method can also be used for coding grayscale and color images. LEADTOOLS now completely supports all three types of images, giving you the ability to make full use of this powerful compression.

LEADTOOLS also supports the Progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead. You can use the ReadLoadResolutions method to examine which sizes are available in a file. You can then use the SetLoadResolution method to specify which size to load. (The GetLoadResolution method only gets the last width and height values that were set with the SetLoadResolution method.). When saving a file, you can use the SaveResolutionHeight and SaveResolutionWidth properties to set resolutions for the next save operation . To set the number of resolutions to save, set the SaveResolutionCount property.

To achieve the highest compression ratios available in the JBIG format, LEAD now takes full advantage of all the functional blocks of this robust standard:

 The Adaptive Arithmetic Encoder , which presents the heart of this format, has the ability to predict and hence encode future data symbols based on the data which is being currently encoded.

 The Adaptive Template Block provides real coding gain for images rendered by grayscale with halftoning. This gain ratio approaches 80% in some situations.

This feature is useful for dealing with grayscale image data.

 The Typical Prediction Block speeds implementations and provides some coding gain.

 The Resolution Reduction Block is used to get a lower resolution version of an image so that no loss of data is encountered. This is mainly important for bi-level images, to avoid any deletion of thin lines.

 The Deterministic Prediction Block provides good coding gain when saving more than one resolution layer in the same file.

All the free parameters specified by the JBIG standard are applied in LEAD to achieve maximal compression and the highest speed for any saving or loading operation.

LEADTOOLS currently supports more than 1 bit plane and more than 1 resolution layer in JBIG files.  However, we do not support saving different ordering of strips inside the JBIG file.  The JBIG filter is built now such that it supports the optimum ordering of strips inside the JBIG file such that as soon as you open the file you find the lowest resolution layer.

JBIG supports progressive loading of an image.  This is done by loading the lowest resolution available in a file and then loading the next resolution, and so on, up to the last available resolution. To implement progressive loading of a JBIG image, use the ProgressivePasses property. Progressive loading will be implemented as follows:

1) If only one resolution exists in the JBIG File, then the ProgressStatus event will be called for that resolution as it is decompressed. The percentages sent to the ProgressStatus event will be 0 to 100.

2) If the image contains more than one resolution and (ProgressivePasses >= nResolutions, where nResolutions represents the number of resolutions present in the file) then the ProgressStatus event will be generated for each resolution layer that is loaded.  The image data will be padded to the remaining width (that is, the size of the last resolution available in the file) with 0s. This will be repeated nResolution times, until the entire image (that is, the last resolution available) is loaded.  Setting ProgressivePasses to PROGRESSIVEPASSES_WHEN_MEANINGFUL or PROGRESSIVEPASSES_ALWAYS has the same effect.

The percentages passed to the ProgressStatus event represent what percentage that resolution is of the whole. For example, if there are three resolutions present in the file (nResolutions = 3), the dimensions of the first resolution layer are one-fourth the dimensions of the top resolution layer. The dimensions of the second resolution layer are one-half the dimensions of the top resolution layer. Consequently, when the first resolution layer is loaded, the percentages sent to the ProgressStatus event are from 0 to 25. When the second resolution layer is loaded, the percentages sent to the ProgressStatus event are from 0 to 50. When the top resolution layer is loaded, the percentages sent to the ProgressStatus event are 0 to 100.

3) If the image contains more than one resolution and (ProgressivePasses is < nResolutions) then the process is the same as in case 2, except loading starts with the first resolution available, continues with the 2nd resolution, and so on, up to resolution Passes-1, and then loading is completed with the decompression of the last resolution available in the file. Again, the percentages sent to the ProgressStatus event represent what percentage that resolution is of the whole.  For example, if there are three resolutions present in the file, (nResolutions = 3), and the ProgressivePasses property is 2, the smallest resolution will be loaded first. The percentages sent to the ProgressStatus event will be 0 to 25. The second resolution level will be skipped and the top resolution level loaded. The percentages sent to the ProgressStatus event for the top resolution level will be 0 to 100.

JBIG support is available only with the JBIG Module. To unlock JBIG support, UnlockSupport must be called with the key found on the JBIG Module Certificate, which will be e-mailed to you. UnlockSupport(L_SUPPORT_JBIG, "JBIG Certificate key") tells the package to unlock JBIG support and passes the key for verification. For more information about required files, refer to Files To Be Included With Your Application.


Implementing JPEG 2000 Plug in Features

JPEG 2000 is a wavelet based compression stored in a hierarchical format which contains several stored resolutions of the image in the same file without duplication. For that reason, a JPEG 2000 compressed image can then be sent to a device in the resolution that best fits, without additional storage overhead.

The LEADTOOLS JPEG 2000 Plug in provides support for loading and saving the JPEG 2000 file formats. The JPEG 2000 file formats provide greater flexibility and better image quality, especially at higher compression, than standard JPEG. The greater flexibility includes the ability to control:

 whether or not to transform RGB images to YUV prior to compression

 the type of quantization to use when determining the quantization step size

 the amount of compression

 the size and location of tiles

 the number of resolution levels in the file

 the progression order

 the code block height and width

 whether to use markers to help detect corruption during transmission

 etc.

LEADTOOLS provides a several properties for controlling the JPEG 2000 features listed above. These properties are:

J2KCBS_ErrorResilienceSymbol property

J2KCBS_PredictableTermination property

J2KCBS_ResetContextOnBoundaries property

J2KCBS_SelectiveACBypass property

J2KCBS_TerminationOnEachPass property

J2KCBS_VerticallyCausalContext property

J2KCodBlockHeight property

J2KCodBlockWidth property

J2KCompressionControl property

J2KCompressionRatio property

J2KDecompLevel property

J2KDerivedBaseExponent property

J2KDerivedBaseMantissa property

J2KDerivedQuantization property

J2KGuardBits property

J2KProgressOrder property

J2KSetDefaults method

J2KTargetFileSize property

J2KUseColorTransform property

J2KUseEPHMarker property

J2KUseSOPMarker property

J2KXOsiz property

J2KXTOsiz property

J2KXTsiz property

J2KYOsiz property

J2KYTOsiz property

J2KYTsiz property

To update the properties listed above with the default values used when saving a JPEG 2000 file, call the J2KSetDefaults method. To change the JPEG 2000 features, set the properties themselves.

A region of interest can now be used for a J2K image. The J2KUseROI property indicates whether or not to use a region of interest. If this is TRUE, then the region of interest is defined based on the J2KROIControl property. If the J2KUseROI property is TRUE and the J2KROIControl property is set to J2K_USELEAD_REGION, then the region of interest is designated by the LEAD bitmap region. If the J2KUseROI property is TRUE and the J2KROIControl property is set to J2K_USEOPTION_RECT, then the region of interest is designated by the rectangle defined by the J2KROILeft, J2KROITop, J2KROIHeight, and J2KROIWidth properties.

This support is available only in the LEADTOOLS JPEG 2000 Plug in, and must be unlocked. For more information on unlocking this support, refer to JPEG 2000 Plug In Support Instructions.

Please note that LEAD also offers the LEADTOOLS JPEG 2000 COM Object for IE, which lets you view JPEG 2000 images in ActiveX enabled web browsers, such as Internet Explorer. For more information, refer to LEADTOOLS JPEG 2000 COM Object for IE in the Products help file.


Implementing PDF Plug in Features

Overview:

The PDF module enhances the input/output functionality in LEADTOOLS by supporting a number of new powerful and complex file formats including:

 PDF PDF stands for Portable Document Format. It was developed by Adobe Corporation to allow users to exchange and view their electronic documents in an easy and reliable way , independent of the environment in which these documents were created. A PDF file will look the same on the screen and in print regardless of what kind of machine you are using or which software package was used to create that file. One major advantage of PDF is that a large document can be compressed small enough to download very quickly, and still displays content as if you were looking at the original source such as a book or magazine.

PDF is emerging as a powerful format for reproducing documents over the web. Because of its high precision and accuracy in representing text and pictures along with its "hyper" nature, PDF is becoming a popular alternative to HTML and Postscript.

 PS Postscript is a simple interpretive page description language. Its primary application is to describe the appearance of text, graphical shapes, and sampled images on printed or displayed pages. Some of the page description and interactive graphics capabilities of the PostScript language include arbitrary shapes, painting operators, text fully integrated with graphics and sampled images derived from natural sources. Postscript is the language that most advanced laser printers use in order to render electronic information on a printed page.

 EPS EPS stands for encapsulated PostScript .An EPS file is a PostScript language program describing the appearance of a single page. Usually, the purpose of the EPS file is to be embedded inside another PostScript language page description. The EPS file can contain any combination of text, graphics, and images, and it is the same as any other PostScript language page description with only a few limitations.

Loading Capabilities.

The LEADTOOLS PDF plug-in has the following import capabilities:

1.	Loads essentially all PDF 1.3 (Acrobat 4.x compatible) files.
2.	Loads all PostScript Language Level 3 files.
3.	Loads any EPS file.
The loading support is of course multi-page, where you can specify which page to load from the file and to find the number of pages in a certain document.

The plug-in gives the user a number of control options in order to customize the resulting rasterized page. These options include:

1.	Pixel depth. Valid values are 1,4,8 and 24 .The default value for this control parameter is 24. This value is set in the PDFDisplayDepth property.
2.	Horizontal resolution in dots per inch with a default value of 96. This value is set in the PDFXResolution property.
3.	Vertical resolution in dots per inch with a default value of 96. This value is set in the PDFYResolution property.
4.	Ability to use either library installed fonts (fonts installed by the plug in) or system fonts. The default value of this control option is to use library installed fonts. This value is set in the PDFUseLibFonts property.
5.	Font anti-aliasing. Valid values are 1bit(no anti-aliasing) , 2 and 4-bit anti-aliasing. The default value is 4, which gives maximum anti-aliasing. This value is set in the PDFTextAlpha property.
6.	Graphics anti-aliasing. Valid values are 1bit(no anti-aliasing) , 2 and 4-bit anti-aliasing. The default value is 1. This value is set in the PDFGraphicsAlpha property.
Saving Capabilities.

Full multi-page write support is provided by this module for the PDF format. This plug in lets you append, insert, replace or delete specific pages in a PDF file.

The plug-in gives you a wide range of control options for the resulting image data in terms of compression, including:

1.	No compression
2.	Compressed using CCITT Group 3, 1 dimension. For 1-bit images.
3.	Compressed using CCITT Group 3, 2 dimensions. For 1-bit images.
4.	Compressed using CCITT Group 4. For 1-bit images.
5.	JPEG compression and YUV 4:4:4 color space loss-less. Bits per pixel: 8 for grayscale, 24 for color.
6.	JPEG compression and YUV 4:2:2 color space. Bits per pixel: 8 for grayscale, 24 for color.
7.	JPEG compression and YUV 4:1:1 color space. Bits per pixel: 8 for grayscale, 24 for color.
To save a PDF file using the DPI values of the loaded bitmap, set the PDFSaveUseDPI property to TRUE.

To try to use less memory when creating PDF files with either JPEG or Fax compression, set the PDFSaveLowMemory property to TRUE before saving the file.

A number of new save format constants have been added to LEADTOOLS in order to support types of files created by the PDF plug-in. For a list of these, please refer to Formats of Output Files.

Distributing an application built using the PDF Module

The PDF plug-in needs some initialization files in order to work properly. Before distributing an application built using this plug-in, you need to setup the end-user machine with appropriate directories and files. Please follow the steps below:

1.	Create a main directory (referred to later as MAIN) on the hard-drive to contain the files. For example "C:\Pdf".
2.	Create 3 subdirectories within this "MAIN" directory, please name them "Lib, "Fonts", and "Resource".
3.	Copy the contents of the directory "Redist\Pdf\Fonts" to the "Fonts" directory.
4.	Copy the contents of the directory "Redist\Pdf\Lib" to the "Lib" directory.
5.	Copy the contents of the directory "Redist\Pdf\Resource" to the "Resource" directory.
6.	Setup the registry configuration below:
	a.	Create the following registry key:
"HKEY_LOCAL_MACHINE\SOFTWARE\LEAD Technologies, Inc.\Pdf"

b.	Under this key create a string value and give it the name "GS_LIB".
c.	Now set the value data of the "GS_LIB" value as follows:
"MAIN\Lib;MAIN\Fonts;MAIN\Resource"

	If MAIN stands for "C:\Pdf" then this would become
"C:\ Pdf\Lib;C:\ Pdf\Fonts;C:\Resource"


Managing Images in a Database

The LEADTOOLS ActiveX supports database access using Open Database Connectivity (ODBC). For more information about the ODBC requirements, refer to Using ODBC.

Note:	For an alternative, refer to Using a Visual Basic Data Control.

Use the following methods to open and close the database. (The dbOpen method identifies not only the database, but also the recordset to be accessed and the field that is used for LEADTOOLS images.)

dbOpen method

dbClose method

Use the following methods to access an existing record:

dbMove method

dbMoveFirst method

dbMoveLast method

dbMoveNext method

dbMovePrev method

Use the following property to control how the image is loaded from the database field into the bitmap:

dbLoadBits property

Use one of the following methods to indicate whether you are adding a new record or editing the current one:

dbAddNew method

dbEdit method

When updating an existing record, use the following property to control record locking:

dbLockingMode property

When adding or updating an image, use the following method to store the image in the field:

dbUpdate method

Use the following method to delete the current record:

dbDelete method

Use the following method to verify your changes in the database:

dbRequery method

Use the following properties to get information about the database and your connection to it:

dbCanAppend property

dbCanRestart property

dbCanScroll property

dbCanUpdate property

dbCurrentRecord property

dbEditMode property

dbIsBOF property

dbIsDeleted property

dbIsEOF property

dbIsOpen property

dbRecordCount property


Using a Visual Basic Data Control

In Visual Basic, the LEAD control is a data bound control. This means you can associate the LEAD control with a data control so that the LEAD control's bitmap is bound to a specified field in the data control's recordset.

Note:	This way of accessing a database works only in Visual Basic. You can use ODBC as an alternative in Visual Basic and other development systems. Refer to Managing Images in a Database.

Note:	You can also use the OLE DB Control to bind to OLE DB Datasources such as the ADO Data Control. For more information, refer to  Using the OLE DB Control.

Use the following properties to specify the data control and field to which the LEAD control is bound:

DataSource property

DataField property

Use the following properties to specify how images are stored in the data field:

DataSaveBits property

DataSaveFormat property

DataSaveQuality property

Use the following property to specify the bits per pixel of the bitmap in memory:

DataLoadBits property

Use the following property to see whether the bitmap is current with the database field:

DataChanged property


Using the OLE DB Control

You can associate the OLE DB Control with an OLE DB DataSource such as the ADO Data control so that the LEAD control's bitmap is bound to a specified field in the data control's recordset.

Use the following properties to specify the data control and field to which the OLE DB Control is bound:

DataSource property

DataMember property

DataField property

Use the following properties to specify how images are stored in the data field:

DataSaveBits property

DataSaveFormat property

DataSaveQuality property

Use the following property to specify the bits per pixel of the bitmap in memory:

DataLoadBits property

Use the following property to indicate that the database field should be updated:

DataDirty property

Use the following properties to copy the data to/from the Main Control and the OLE DB Control:

Bitmap property

AnnContainer property

Use the following events to be notified when data is loaded from or saved to the recordset:

DataLoaded event

DataSaved event


Using Memory-Resident Image Files

The following properties, methods and events let you work with files that are stored in memory in their original formats:

EnableSaveBufferEvent property

GetArrayInfo method

GetMemoryInfo method

LoadArray method

LoadBuffer method

LoadMemory method

SaveArray method

SaveBuffer event

SaveBuffer method

SaveBufferAddress property

SaveBufferSize property

SaveMemory method


Capturing an Image from the Screen

Use the following method to capture an image from a device context (usually the screen) and load it into the bitmap:

Capture method

Use the following to capture and zoom in on an image:

EnableZoomInRect property

ZoomIn method

ZoomInDone event

LEAD also provides a LEAD Screen Capture control that provides more versatility in capturing images from the screen.  For more information, refer to the Screen Capture Help File (Ltscrocxn.hlp, Ltscrocxe.hlp or Ltscrocxc.hlp).


Using ISIS to Scan Images
Using ISIS to Scan Images (Document/Medical only)

IMPORTANT NOTICE CONCERNING SUPPORT FOR ISIS DRIVERS:

LEADTOOLS TOOLKITS CONTAIN SUPPORT FOR ISIS® DRIVERS USING PIXEL TRANSLATIONS RUNTIME (PIXDFLTN. DLL) VERSION NUMBER 55.1.260.832 OR EARLIER ALLOWING LEADTOOLS TO DIRECTLY INTERFACE WITH THE ISIS DRIVERS.

LEADTOOLS TOOLKITS DO NOT DIRECTLY COMMUNICATE WITH ISIS ® DRIVERS USING PIXEL TRANSLATIONS RUNTIME (PIXDFLTN) VERSION NUMBER 56.*.*.* OR HIGHER.  A LEADTOOLS APPLICATION WHICH OPERATES PROPERLY WITH THE EARLIER VINTAGE ISIS DRIVERS WILL CEASE TO OPERATE PROPERLY IF THE OLDER ISIS DRIVER IS REPLACED WITH A NEWER ISIS DRIVER REQUIRING THE PIXEL TRANSLATIONS RUNTIME DLL VERSION NUMBER 56.*.*.* OR HIGHER.

ISIS is a standard used with certain scanners.  The software includes support for ISIS scanning one or more images through its LEADTOOLS ISISAcquire method and ISISAcquireMulti method, provided an ISIS driver is present.  (The LEADTOOLS software does not include ISIS Drivers).  Prior to scanning however, other methods, properties and events must be used to prepare for scanning.  The IsISISAvailable property indicates whether ISIS support DLLs are even available for use. If so, load the ISIS Scanner Driver using the ISISLoadDriver method.  ISISSelect method displays a dialog box for selecting the desired ISIS driver, if there is more than one.  New ISIS drivers can also be added using this dialog box.  To set scanner options, use ISISSetScanOptions.  The current driver is set in the DriverName property.

LEADTOOLS also provides the ISISGetTag method, ISISSetTag method, ISISGetASCIITag method and ISISSetASCIITag method to help determine the current settings for the scanner and set new values for certain tags. ISIS tags can have multiple values, also called choices. LEADTOOLS provides the ISISGetASCIITagChoice method, ISISGetASCIITagChoiceCount method, ISISGetTagChoice method and ISISGetTagChoiceCount method for determining the number of values or choices available for a specific tag and retrieving individual values/choices for a specific tag.

To scan a single image, use the ISISAcquire method.  This will set the Bitmap property with the bitmap created when the image was scanned.  If you wish to scan more than one image, you may wish to set EnableISISEvent property to true so the ISISPage event will be called after each page is scanned.  To scan more than one image use ISISAcquireMulti method.  If you set the ScanAhead tag prior to scanning multiple images, PagesDiscarded will contain the number of pages discarded if scanning is canceled by setting EnableISISEvent to FALSE.  Once you have finished with ISIS support, unload the ISIS driver using ISISUnloadDriver method.

For more information, refer to the individual entries for the properties, methods and events.  You may also refer to ISIS Tags to learn more about the scanner settings and scanning options.

Note: Please note that you must get the ISIS driver from the scanner manufacturer or from Pixel Translations.  The .chn or .chw file must be in your path for ISIS scanning to work.


Implementing Internet Features

LEADTOOLS offers the following alternatives for Internet support:

 To support your own input stream you can use the ActiveX with the methods described in Loading a Bitmap from Your Own Buffer.

 For asynchronous loading through Microsoft Internet Explorer you can use the capabilities described in the remainder of this topic.

Loading a Bitmap over the Internet

The LEADTOOLS ActiveX is a net-aware ActiveX. This means you can support new image formats and image processing on your web pages by adding the LEADTOOLS ActiveX to your HTML code. For examples using HTML with Java and VB Script, refer to the EXAMPLES\OCX\INTERNET subdirectory.

Use the following elements to manage asynchronous loading of a bitmap from a local file or from an Internet URL. Note that these elements require version 3.01 of the Microsoft Internet Explorer, which is available from http://www.microsoft.com.

BitmapDataPath property

BitmapDataPathClosed event

ReadyStateChange event

ReadyState property

Use the AutoSetRects property and its related properties to simplify the display rectangles when loading an image from the Internet.

Note: When using the LEAD ActiveX control on a web page, you should set the OLEDropAllowed property to False (0) in the Unload Event.  For example, in VBScript this is done as follows:

Sub Window_OnUnload
     LEAD1.OLEDropAllowed = False
end Sub

Using the LTOCX14.LIC file on the Internet

The LEADTOOLS ActiveX requires the correct license string in order to load properly. In a development environment, the string is made available to the ActiveX control when the LTOCX14.LIC file is placed in the same directory as the ActiveX control. When creating an executable program, the development environment will extract the correct string from the ActiveX control and place it in the generated code. When the executable code is run, it provides the license string to the control. This allows the executable program to function properly without the LTOCX14.LIC file.

Since you cannot redistribute the LTOCX14.LIC file with HTML script, special handling is required for Internet web page development to insure proper operation. You can unlock support for certain LEADTOOLS features by including the keys in the .LIC file. Edit the LTOCX14.LIC file and append at the end of a line, and on the same line, one or more pairs in the form |L_SUPPORT_xxx=key. The keys that you can specify are the same as the UnlockSupport method:

For example, if you wanted to unlock Document Imaging support and OCR support, you would include the following at the end of the first line:

|L_SUPPORT_DOCUMENT=dockey|L_SUPPORT_OCR=ocrkey

After editing the LTOCX14.LIC file, you must create an LPK file using Microsoft's LPK_TOOL.EXE (Available in the ActiveX SDK from Microsoft at http://www.microsoft.com/intdev/default.htm). This helps generate an encrypted LPK file containing all of the license strings that are required by your script's controls. This allows the use of the ActiveX and certain features in web pages, without putting the license keys in the web page. Microsoft's Internet Explorer only honors one LPK file per page, so you should generate a LPK file including license strings for every control that you intend to use. You should then insert the following into your HTML script:

<object classid="clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
<param name="LPKPath" value="Relative URL path to LPK file">
</object>

Using a Cabinet File

LEADTOOLS provides a cabinet file (LTOCX14N.CAB) that packages the LEADTOOLS ActiveX, its dependent DLLs, and the required code-signing information. You can reference this cabinet file in the CODEBASE attribute of the <OBJECT> tag of your HTML code as shown in the following example:

<OBJECT ID="Lead1" WIDTH=100 HEIGHT=100
   CLASSID="CLSID:00140000-B1BA-11CE-ABC6-F5B2E79D9E3F"
   CODEBASE="URLPATH/LTOCX14N.CAB">
</OBJECT>

The LTOCX14N.CAB cabinet includes the following files:

LTOCX14N.OCX
LTKRN14N.DLL
LTDIS14N.DLL
LTEFX14N.DLL
LTFIL14N.DLL
LTIMG14N.DLL
LTTWN14N.DLL
LFCMP14N.DLL
LFTIF14N.DLL
LFFAX14N.DLLMSVCRT.DLL via MFC42INSTALLER

MFC42.DLL via MFC42INSTALLER

OLEPRO32.DLL via MFC42INSTALLER

For the MFC42INSTALLER, refer to http://activex.microsoft.com/controls/vc/mfc42.cab.

For information about these files, refer to Files To Be Included With Your Application.


Displaying an Image

Set the following properties (possibly at design time) to control the style of display:

Appearance property

AutoRepaint property

BackColor property

BackErase property

BitonalScaling property

BorderStyle property

ForePalette property

PaintDither property

PaintPalette property

PaintRgnOnly property

PaintROP3 property

PaintGamma property

PaintIntensity property

PaintContrast property

PaintScaling property

Transparent property

For additional settings, refer to Using Special Effects When Painting. and Adding a Frame to the Control.

Use the following properties to implement automated scaling and positioning of an image.

AutoSetRects property

CenterImage property

EnableKeyboard property

EnableScroll property

PaintSizeUseDPI property

PaintSizeMode property

PaintZoomFactor property

ZoomToRect method

AutoScroll property

AutoSize property

If you do not use the automated scaling properties, other properties and methods let you specify exactly which part of an image to paint and how big to make it.

When painting an image, LEADTOOLS uses the following four rectangles that determine how the image is scaled, positioned, and cropped:

 The source rectangle determines which part of the bitmap LEADTOOLS treats as the source image. By default, it is the whole bitmap. (In fact, by default, all four rectangles are initialized to the size of the bitmap.)

 The destination rectangle positions the displayed image relative to the LEAD control and determines the displayed size. If the destination rectangle is larger or smaller than the source rectangle, LEADTOOLS scales the image to fit the destination rectangle. You can view the following illustrations in a separate window:
Specifying Only the Destination Rectangles
Specifying Both the Source and Destination Rectangles

 The source clipping rectangle limits the part of the source rectangle that LEADTOOLS paints. This rectangle does not affect scaling. You can view the following illustration in a separate window:
Specifying the Source Clipping Rectangle

 The destination clipping rectangle limits the part of the destination rectangle that LEADTOOLS paints. This rectangle does not affect scaling, but if the image is scaled, you should set it to match the destination rectangle. You can view the following illustration in a separate window:
Specifying the Destination Clipping Rectangle

If you set the AutoSetRects property to true, when a bitmap is loaded or resized, LEADTOOLS initializes all four rectangles to a 0, 0 position and to the same width and height as the bitmap. If you set the AutoScroll property, LEADTOOLS automatically adjusts the origin of the destination rectangles when the user scrolls the image.

The size of the LEAD control also can limit how much of the image is displayed. The way you size and position the LEAD control depends on your programming environment, but you can set the destination rectangle to fit the size of the control.

Use the following property to specify the unit of measure for the LEAD control:

ScaleMode property

Use the following properties to get the current client area of the LEAD control or to implement a custom coordinate system. Typically, you would use these properties to fit the destination rectangle to the size of the control.

ScaleHeight property

ScaleLeft property

ScaleTop property

ScaleWidth property

Use the following methods to set the rectangle specifications:

SetDstClipRect method

SetDstRect method

SetSrcClipRect method

SetSrcRect method

Alternatively, you can read or write the following properties that define the rectangles:

DstClipHeight property

DstClipLeft property

DstClipTop property

DstClipWidth property

DstHeight property

DstLeft property

DstTop property

DstWidth property

SrcClipHeight property

SrcClipLeft property

SrcClipTop property

SrcClipWidth property

SrcHeight property

SrcLeft property

SrcTop property

SrcWidth property

Occasionally it is necessary to convert between bitmap coordinates and client area coordinates. LEADTOOLS provides the BitmapToClient and ClientToBitmap methods for converting coordinates. Each of these methods takes as parameters the X and Y coordinates to be converted, and updates the ConvertX and ConvertY properties with the newly converted coordinates.

Use the following method to force repainting of the image. (If the AutoRepaint property is set to TRUE, you do not have to force a repaint.)

ForceRepaint method

The following property enables or disables painting of the control's window:

EnablePaint property

Use the following method to force repainting of a specified rectangle in the LEAD control's client area.

RepaintRect method

When repainting invalidated areas of a bitmap, flickering may occur. To avoid this flicker, enable double buffer image display by setting the DoubleBuffer property to TRUE. This may be particularly helpful when displaying annotations on a bitmap.

Use the following properties and methods to apply window leveling to a 12 or 16-bit grayscale image. (Support for 12 and 16-bit grayscale images is available only in the Document/Medical toolkits. Window leveling is available only in the Medical toolkits.):

WindowLevel method

LevelLUT property

LevelLUTLength property


Scrolling an Image

LEADTOOLS provides the following for scrolling images in the Main Control:

AutoScroll property

HScrollInfo property

Scroll event

VScrollInfo property

To enable the implementation of automatic scrollbars, the AutoScroll property must be set to TRUE. Is this property is set to TRUE, then whenever the user drags the box on a Main Control's scrollbar, a Scroll event occurs, notifying the user that the image has been scrolled. Information about the horizontal and vertical scrollbars can be obtained in the HScrollInfo property and VScrollInfo property.


Cleaning Up 1-Bit Images

(Document/Medical) Scanned documents often contain a number of undesirable elements, including dots, blobs, lines, borders and hole punches. LEADTOOLS provides a number of properties, methods and events that will improve the appearance of scanned documents by removing dots, blobs, lines, borders, hole punches, inverted text, bumps and nicks. The properties and methods are listed below:

BorderRemove method

DocCleanBitmap property

DocCleanSuccess property

hDocCleanRgn property

DotRemove method

HolePunchRemove method

InvertedText method

LineRemove method

Smooth method

The methods listed above each takes a number of parameters that control the performance of the corresponding removal process. Included in the parameters is a set of flags that allows you to obtain a LEAD region or a Windows region that contains all the elements removed from a document. For each element found by one of the removal methods, a corresponding event is triggered. These events provide a means of customizing the removal process, as well as creating your composite of the removed regions. These events are given below:

BorderRemove event

DotRemove event

HolePunchRemove event

InvertedText event

LevelLUTLengthproperty

LineRemove event

Smooth event


Thumbnail Browser

LEADTOOLS Thumbnail Browser ActiveX provides a thumbnail browser that browses a specified directory for images supported by LEADTOOLS. For each supported image, a thumbnail image is generated. In addition, the Thumbnail Browser also lets you create a thumbnail from a specific image file.

To browse a directory, call the BrowseDir method. For each thumbnail image generated, a ThumbnailEvent event occurs. To generate a thumbnail from a specific image file, call the CreateThumbnailFromFile method. The thumbnail image generated using this method can also be processed through the ThumbnailEvent event.

The browse process can be modified using the following properties:

ContinueBrowse property

ExpandMultipage property

Filter property

IncludeSubDirectories property

LoadStamp property

MaxSizeDisk property

MaxSizeMem property

SkipFile property

StopOnError property

In addition, you can modify thumbnail characteristics using these properties:

DitherFlags property

ForceSize property

MaintainAspect property

PaletteFlags property

Resample property

ThumbnailBackgroundColor property

ThumbnailBitsPerPixel property

ThumbnailHeight property

ThumbnailWidth property

To gain information about the file, from which the thumbnail images were generated, use the following properties:

InfoBits property

InfoCompression property

InfoFormat property

InfoHeight property

InfoPage property

InfoSizeDisk property

InfoSizeMem property

InfoTotalPages property

InfoWidth property

InfoXRes property

InfoYRes property

The following are provided as general support for the thumbnail browser:

EnableMethodErrors property

IsSupportLocked method

UnlockSupport method


Using the ImageList Control

LEADTOOLS ActiveX provides an image list control that lets you display and manipulate a list of images. The ImageList properties, methods and events let you do the following with a list of images:

You can load and save image lists using these methods:

LoadDatabase method

SaveDatabase method

LoadFromFile method

SaveToFile method

To insert and delete images, use the following:

Clear method

Insert method

InsertAt method

InsertFromBitmapList method

Remove method

To specialize mouse and keyboard input, use the following:

Click event

DblClick event

EnableKeyboard property

KeyDown event

KeyPress event

KeyUp event

MouseDown event

MouseIcon property

MouseMove event

MousePointer property

MouseUp event

You can modify the display characteristics, or item characteristics, using the following:

AllowSelection property

Appearance property

BackColor property

BitonalScaling property

BorderColor property

BorderStyle property

DisplayItemText property

FirstVisibleItem property

Font property

ForeColor property

Item property

ItemBackgroundColor property

ItemHeight property

ItemHorizontalSpacing property

ItemSelected event

ItemUnSelected event

ItemVerticalSpacing property

ItemWidth property

PaintDither property

PaintScaling property

Resize event

ScaleHeight property

ScaleLeft property

ScaleMode property

ScaleTop property

ScaleWidth property

SelectAll method

SelectedCount property

SelectedItems property

SelectionColor property

SelectionStyle property

Sort method

SetSelectionBitmap method

ViewSize property

The following provide support for user-defined or custom painting of the ImageList items:

OwnerDrawItem event

OwnerDrawItems property

The following elements let you scroll through the image list:

EnsureVisible method

Scroll event

ScrollItems method

ScrollStyle property

To obtain information about the image list, use the following:

ColumnCount property

Count property

CurrentPage property

HitTest method

PageCount property

RowCount property

LEADTOOLS also provides the following general elements:

ControlWindow property

EnableMethodErrors property

IsSupportLocked method

UnlockSupport method

Window property


Drag and Drop

LEADTOOLS provides properties and events that support the drag and drop process in the ImageList control and in the Main control. The properties and events of the ImageList control let you drag an image that is open in one ImageList control and drop it in another ImageList control. The properties and events of the Main control let you drag an image that is open in one Main control and drop it in another Main control.

To begin the drag and drop process, you must enable the process by setting the EnableOLEDragMethod property (Main Control) or the EnableOLEDragMethod property (ImageList Control) to TRUE, depending on the control you are using. If you are working with the ImageList control you must also set the AllowSelection property to ALLOWSELECTION_SINGLE.

With the drag and drop process enabled, select an image within the ImageList control or press the left mouse button within the Main control and begin dragging. This will generate the OLEStartDrag event (ImageList control) if you are working with the ImageList control, or it will generate the OLEStartDrag event (Main Control) if you re working with the Main control.

As you continue to drag the image, two more events are generated repeatedly for each control. If you are working in the ImageList control the OLEDragOver event (ImageList Control) and the OLEGiveFeedback event (ImageList Control) are generated. If you are working with the Main Control, the OLEDragOver event (Main Control) and the OLEGiveFeedback event (Main Control) are generated. The OLEDragOver event receives information concerning the button(s) used in the dragging process and the location of the cursor during the dragging process. The OLEGiveFeedback event receives a parameter that is used to indicate which cursor to use during the dragging process. By setting the parameter received by the OLEGiveFeedback event to FALSE, a custom cursor can be displayed during the dragging process. The custom cursor that will be used in this case is set in the OLEDragCursor property (Main Control). Custom cursors can also be used for the ImageList Control. However, in the ImageList control the EnableUseDefaultCursor property must be set to FALSE for the custom cursor in the  OLEDragCursor property (ImageList Control) to be used.

When the dragging process is finished and you drop the image into the target control, an OLECompleteDrag event (Main Control) or OLECompleteDrag event (ImageList Control) is generated.


A Special Note About Loading 12 and 16-Bit Grayscale Images

If the image to be loaded is 12 or 16-bit grayscale and 0 is passed for the parameter that controls the number of bits per pixel at which to load the image, then if L_SUPPORT_EXTGRAY support is locked, the image will be loaded as 8-bit grayscale, instead of the original bits per pixel.

For more information on the L_SUPPORT_EXTGRAY support, refer to the UnlockSupport method.


Adding a Frame to the Control

The following properties let you add a three-dimensional frame to the LEAD control:

FrameThickness property

FrameColor property

You can turn the frame off by specifying a thickness of 0. When the frame is turned on, the ScaleHeight and ScaleWidth properties are updated to reflect the smaller size of the client area. The automated fit modes also fit the image into the smaller client area.

The following properties specify the inner and outer bands that give the frame a three-dimensional appearance:

FrameInnerStyle property

FrameInnerThickness property

FrameInnerHiliteColor property

FrameInnerShadowColor property

FrameOuterStyle property

FrameOuterThickness property

FrameOuterHiliteColor property

FrameOuterShadowColor property


Using a PanWindow

The Pan Window is a small window which will display a scaled view of a bitmap, which is also being displayed in the Main Control's window at a size that would require scrolling.  The Pan Window will maintain the image’s aspect ratio.  In the Pan Window, a colored Pan Rect will be displayed to indicate the portion of the image currently being displayed in the main window.  When a user clicks inside the Pan Window and moves the mouse, while holding down the button, the Pan Rect will move with the mouse pointer.

To set the location of the PanWindow, use:

PanWinX property

PanWinY property

To set the dimensions of the PanWindow, use:

PanWinWidth property

PanWinHeight property

The following properties can be set to control image quality in the PanWindow:

PanWinPaintPalette property

PanWinBitonalScaling property

PanWinPaintDither property

PanWinPaintScaling property

To make the PanWindow visible (or invisible) use:

ShowPanWin method

When the PanWindow is created, updated, destroyed or moved, the following event is generated:

PanWin event

Other PanWindow characteristics which can be set are:

AutoPan property

PanWinTitle property

PanWinRectColor property

PanWinSysMenu property

PanWinPointer property

In Visual Basic only, the following properties can be set to use Picture objects for the PanWindow cursor and icon:

PanWinCursor property

PanWinIcon property


Implementing Transparency

You can implement transparency when doing any of the following:

 Animation. When playing an animation, the playback process recognizes the transparent color specified in the BitmapTransparentColor property if the BitmapEnableTransparency property is set to TRUE. The transparent color is loaded from and saved to GIF files. If you save animated files in other multi-page formats, you must maintain the color yourself. For more information, refer to Playing an Animation.

 Paint effects. When painting a bitmap or other object, you can specify a transparent color in the BitmapTransparentColor property and set the BitmapEnableTransparency property. For more information about painting images, refer to Displaying an Image. For painting other objects, refer to Drawing Three-Dimensional Shapes and Text.

 Displaying an image with transparent color. When painting a bitmap, you can specify a transparent color in the BitmapTransparentColor property and set the BitmapEnableTransparency property to TRUE. LEAD will then paint the bitmap without the color set in the TransparentColor property.

Note: When loading an image file of any supported file format, LEADTOOLS ActiveX control will load the transparent color information into the BitmapTransparentColor property. You must set BitmapEnableTransparency property to TRUE for proper display. For example:

VB Example:

Dim value As Long
Dim Index As Long

'LEAD1.Load "c:\ltwin14x\images\Attention.gif", 0, 0, 1

value = LEAD1.BitmapTransparentColor
'Account for the COLORREF, which can be a palette index or an RGB value
If value >= 16777216 Then ' Palette index
Index = value - 16777216
LEAD1.BitmapTransparentColor = LEAD1.BitmapPalette(Index)
Else  ' RGB value
LEAD1.BitmapTransparentColor = value
End If

LEAD1.BitmapEnableTransparency = True
LEAD1.ForceRepaint

 Region processing. Defining a region in a bitmap makes it possible to treat the area outside the region as transparent. You can set the PaintRgnOnly property to TRUE to paint only the region that is defined for a bitmap. When combining images with the Combine method, if a region is defined for the target bitmap, the combine applies only to the region. (Any region defined in the source bitmap is ignored.). For example, if a transparent color is defined for a bitmap, you can create a region that omits pixels of that color. For details, refer to Combining Images.

Once a region is defined, you can create a mask from it, which you can save in the alpha channel of a 16- or 32-bit file. Refer to the BitmapAlpha property for an example of how to save a region in an alpha channel.

 Transparent control. You can make the background of the LEAD control transparent by setting the Transparent property to TRUE. This lets you take advantage of related transparency properties when one control is positioned on top of another one.

When specifying a transparent color, you can refer to a particular palette index, instead of the RGB value. This can be useful in cases where a color is used for transparency and the palette may contain the same color in more than one palette position.

When specifying a palette index as a color value, use the following formula:

16777216 + index

When evaluating a value to see if it is a palette index, you can use the following logic:

if value >= 16777216 then
    index = value – 16777216


PNG Files and Transparency

Bitmaps may or may not contain transparency. The transparent color is a RGB color for bitmaps that are not palettized (> 8 bits per pixel). For palettized bitmaps, the transparent color is an index to a color within the palette.

PNG supports transparent bitmaps that have one or more transparent colors. However, currently LEADTOOLS cannot handle more than one transparent color. Therefore, the first transparent color encountered by LEADTOOLS is used as the transparent color for the bitmap.

When loading PNG bitmaps that have transparency, LEADTOOLS sets the BitmapEnableTransparency property to TRUE and BitmapTransparentColor property to the transparent color. Please note that if the loaded PNG bitmap is not palettized, then the BitmapTransparentColor property is set to an RGB color. If the loaded PNG bitmap is palettized, the BitmapTransparentColor property is set to 0x010000XX, where XX is the index of the transparent color.

When a bitmap that contains transparency (i.e. BitmapEnableTransparency property is set to TRUE) is saved as PNG, the transparency information is saved automatically. This is true for all bitmaps, regardless of their bits/pixel.

Please note that some developers consider the alpha channel to contain transparency information. Transparency is implemented in LEADTOOLS as explained above. If a PNG file contains an alpha bitmap, the InfoHasAlpha property will be set to TRUE when the GetFileInfo method is called. You can access the alpha channel information through the BitmapAlpha property.

Some PNG files have an 8-bit palettized component (for the image) and 8-bit alpha information. When you get the information for these files, InfoBits property gets set to 8 and the InfoHasAlpha property gets set to TRUE. By default (when passing 0 for iBitsPerPixel to the Load methods), the image is loaded as 8 bits (the alpha information is ignored). To get the alpha information from these files, you need to load the image as 32 or 64-bit. In this case, the alpha information can be accessed with the BitmapAlpha property. LEADTOOLS does not save these 8+8 files.


Working with the RAW File Filter

The RAW File Filter can be used to load and save raw uncompressed data.  The raw data can have

 any offset in the file

 any bits per pixel

 any width/height

 each line padded to 4 bytes

 any view perspective

 BGR or RGB color order

Loading a file with the RAW filter

Parameters for loading raw uncompressed data are set through the LoadInfo event in the Main Control.

Inside the LoadInfo event (or prior to the call of the LoadInfo event),set the LoadInfoBits property to FILE_RAW. Valid values must also be set for the following properties:  LoadInfoWidth, LoadInfoHeight, LoadInfoBits, and LoadInfoOffset (byte location in the file where the raw data begins). If each line of RAW data is padded so that the number of bytes is a multiple of 4 (as is the case with raw Windows BMP data), include LOADINFO_PAD4 in the LoadInfoFlags property.  Include an orientation flag in the LoadInfoFlags property to load the image with the proper orientation. For example, raw Windows BMP data is stored with a BOTTOM_LEFT orientation. If the orientation is unknown, include the TOP_LEFT flag. If the raw data is 8 bits per pixel or less, then the image is palettized and a palette must be generated. If this is the case, include the LOADINFO_PALETTE flag, and fill in the first (2 bits per pixel) entries of the UserPalette property.

If the color order is ORDER_RGB then include this flag. If the ORDER_RGB flag is not included, the data will be loaded as ORDER_BGR.

Saving a file with the RAW filter

To save raw uncompressed data, an image must already be loaded into a LEAD control. When saving raw uncompressed data, the raw data will correspond to the width, height, bits per pixel, and view perspective of the image when it was loaded. For example, if a Window BMP file that is 300x400 24-bit color is loaded and then saved as raw uncompressed data, the raw data is 24-bit, ORDER_BGR, with a view perspective BOTTOM_LEFT (the first bytes in the file correspond to the bottom-left of the image). The total size of the raw data file will be 300x400x3 = 360,000 bytes.

You can affect the way the raw data is saved by setting certain properties.  The bits in each byte can be reversed by setting the SaveLSB property to TRUE. Each line of raw data can be padded so that the length is a multiple of four bytes by setting the SavePad4 property to TRUE. The raw data can be saved at any offset in the file by using the SaveOffset method.

When using the Save method or the SaveOffset method to save RAW data that is 8 bits per pixel or less, no palette information is saved.  Consequently, after loading RAW data, it is necessary to supply a palette.(see Loading a file with the RAW filter above.)

For examples that demonstrate how to load and save raw uncompressed data, refer to:

RawLoad example for Visual Basic

RawLoad example for Visual C++ 4.0 and later

RawSave example for Visual Basic

RawSave example for Visual C++ 4.0 and later


Implementing TIFF Tags

The TIFF 6.0 Specification sets aside a range of private tags that developers can define. To avoid conflicts with files created by other developers, you can register your tag by contacting Adobe Developer Relations. (The E-Mail address posted on The Unofficial TIFF Home Page is gapdevsup@adobe.com.)

To define and set a tag use the SetTag method.

To read tag data from a file, use the ReadTag method.

To get information about a tag, use the following:

GetTagData method

GetTagType method

GetTagCount method

To write tag(s) to a file, use the WriteTag method.


Using Special Effects When Painting

You can specify a special effect to be applied when painting an image, and you can specify a transitional effect that occurs before the image is painted. Other aspects of painting (such as zooming) are automated or controlled as explained in Displaying an Image.

The following property lets you specify a special effect when painting an image:

PaintEffect property

The following properties let you implement a transitional effect that paints before the image paints:

TransitionStyle property

TransitionEffect property

The TransitionStyle property determines whether a transitional effect is used, and it determines whether the transition is based on pattern properties or gradient color properties. Refer to Gradients and Patterns for related properties.

The following properties let you specify the speed and granularity of the effect:

EffectDelay property

EffectGrain property

The following properties and event let you control the number of passes when painting an image or transition. If you specify more than one pass, a pattern brush paints some of the pixels on each pass, and the painting is complete when you finish all of the passes.

PaintMaxPasses property

PaintPass property

PaintNotificationDelay property

PaintNotification event

The first PaintNotification event occurs before the first pass and after each pass when painting a transition or an image. Therefore, you can use the event to change other properties between passes, or after the transition paints and before the image paints.

The following properties let you specify a transparent color (a color that is not painted):

BitmapEnableTransparency property

BitmapTransparentColor property

The following properties let you specify a wand (a band of color that is used at the leading edge of some effects):

WandColor property

WandSize property

To add a three-dimensional shape or text object, refer to Drawing Shapes and Text.


Gradients and Patterns

You can specify a gradient color or a pattern when you implement a transitional paint effect or when you draw a three-dimensional shape or text object.

The following properties let you specify a gradient color, which starts as one color and ends as another, with the specified number of transitional colors from start to end. The direction of the transition depends on the gradient style.

GradientStyle property

GradientStartColor property

GradientEndColor property

GradientSteps property

The following properties let you specify a pattern or solid color:

PatternStyle property

PatternBackColor property

PatternForeColor property

The usage of gradients and patterns varies as follows:

 For painting transitions, described in Using Special Effects When Painting, you always use a gradient or pattern to achieve the effect.

 For a three-dimensional shape, described in Drawing Three-Dimensional Shapes and Text, you can use these properties for a fill pattern or a background bitmap, as follows:

-	The pattern properties (but not the gradient properties) specify the shape's fill style.

-	If the ShapeBackgroundStyle property specifies an image in the background, you can draw a patterned or gradient rectangle to another control's bitmap, then use that bitmap as the background of the shape when drawing to the main control.

 For a text object, described in Drawing Three-Dimensional Shapes and Text, you can only use a pattern or gradient to create a bitmap that you use as the foreground of the text. First you draw a patterned or gradient rectangle to another control's bitmap. Then you use that bitmap as foreground of a text object when drawing to the main control.


Using the Magnifying Glass

LEADTOOLS provides a "magnifying glass" for the Main Control. This magnifying glass provides a means of "zooming in" on the image loaded into the Main Control. To start the magnifying glass procedure, call the StartMagGlass method. The user can check the HasMagGlass property to determine whether the control has a magnifying glass attached to it. As the magnifying glass is moved over an image, the zoomed - in view is also displayed.

One of three scenarios can be followed when working with the magnifying glass:

1.	The user can work with an ordinary magnifying glass that will be attached to the control’s window. There is no need to write any code to show the magnifying glass or to move it over the image, since this will be handled internally by LEADTOOLS. This scenario can be achieved by calling the StartMagGlass method, but without enabling the firing of the MagGlass event (i.e Set the EnableMagGlassEvent property to FALSE), and without setting MAGGLASS_MANUAL_UPDATE in the MagGlassFlags property.

2.	The user can work with a magnifying glass for which the MagGlass event has been enabled by setting the EnableMagGlassEvent property to TRUE. By setting this property to TRUE, information about non-updated parts of the bitmap can be obtained from the MagGlass event. This event will occur each time the left button is pressed, the left button is released or the mouse is moved with the left button pressed in the control with the attached magnifying glass. By repeatedly calling the MagGlass event, the user can get information about parts of the bitmap that need to be updated using the Pixel property to get this information. This event works more efficiently when working with a Client/Server model, available in the Multimedia/Internet toolkits, and using Internet methods to get the needed information. The user can then pass this needed information to the UpdateMagGlass method to update the magnifying glass's zoomed display area. This enables the magnifying glass to paint the zoomed area more clearly.

If the EnableMagGlassEvent property has been set to TRUE, the UpdateMagGlass method must be used to update the magnifying glass display area with the zoomed image. Information on the area to be zoomed and displayed is passed to the MagGlass event.

3.	In the third scenario, the user is responsible for handling WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, WM_LBUTTONUP, WM_MOUSEMOVE, WM_SETCURSOR and WM_KILLFOCUS messages instead of handling them internally by LEADTOOLS. This scenario requires that MAGGLASS_MANUAL_UPDATE be set in the MagGlassFlags property. When updating the magnifying glass manually, the ShowMagGlass method will show/hide the magnifying glass while the SetMagGlassPos method will move the magnifying glass to a specified position. The UpdateMagGlassFromHandle method can be used to update the bitmap that the magnifying glass displays in the zoomed display area.

The following can be set using the StartMagGlass method:

 size of the magnifying glass

 shape of the magnifying glass

 magnifying glass border (color, thickness, appearance)

 magnification level

 section of the pixel on which to center the zoomed image

To set masks for certain colors to be masked from the zoomed - in display, LEADTOOLS provides the MagGlassMaskCount property and the MagGlassMask property. Setting the MagGlassMaskCount allocates the array of the MagGlassMask property.

The MagGlassFlags property controls two behaviors of the magnifying glass:

1.	which colors in the bitmap to display and which to mask.

2.	enables or disables the manual updating of the magnifying glass

LEADTOOLS provides two defined shapes for the Magnifying Glass: Rectangle and Ellipse. The UpdateMagGlassShape method lets you update the shape of the magnifying glass to one of the previously listed shapes, or to a custom shape.

To control the painting options for the zoomed display, use the following:

PanWinPaintPalette property

PanWinBitonalScaling property

PanWinPaintDither property

PanWinPaintScaling property

To control the contrast, gamma and intensity of the zoomed area, use the following:

MagGlassPaintContrast property

MagGlassPaintGamma property

MagGlassPaintIntensity property

To use a custom shape for the magnifying glass, use the following:

PanWinPointer = 99 ' custom pointer
PanWinCursor = the custom cursor image

When the magnifying glass is no longer needed, call the StopMagGlass method to stop the magnifying glass procedure.


Playing an Animation

When you play an animation, you display a sequence of images from a list of bitmaps. This list of bitmaps can be in a multipage file that plays as it loads, or they can be already loaded in a control. For an explanation of bitmap lists, refer to Bitmaps and Bitmap Lists.

To execute a playback, LEADTOOLS creates a temporary target bitmap, renders the listed bitmaps to the target, and displays the target bitmap. An animated GIF file can specify properties of this target bitmap. With images from other sources, LEADTOOLS uses default values that are based on bitmaps in the list.

Before playing an animation from a file, you can use the GetFileInfo method to find out whether the file is an animated file and to find out the height and width of the target bitmap. The GetFileInfo method updates the following properties that contain this information:

InfoAnimation property

InfoAnimationHeight property

InfoAnimationWidth property

To determine how a particular bitmap in a list behaves during playback, you can get and set the following properties:

BitmapDelay property

BitmapDisposalMethod property

BitmapEnableTransparency property

BitmapTransparentColor property

To determine how a particular bitmap in a list is positioned relative to the temporary target bitmap, you can get and set the following properties:

BitmapLeft property

BitmapTop property

You can get and set the following properties of the temporary target bitmap:

AnimationBackColor property

AnimationBitsPerPixel property

AnimationPalette property

AnimationWidth property

AnimationHeight property

AnimationFrameIndex property

Use the following properties to control the playback execution:

AnimationLoop property

AnimationEnable property

AutoAnimate property

AutoAnimationLoop property

AnimationPause property

Use the following event to add code that executes when an animation playback starts or stops:

Animate event


Printing an Image

Use the following method to print an image in any device context:

Render method

The fLeft and fTop parameters of the Render method specify the point at which to start rendering the image. If either of these parameters is 0, or if both of these parameters are 0, the RenderCenter property can be used to indicate whether the image should be centered.

If you are using FoxPro or Access, you can use the following methods to get the device context of the printer and to control the print job.

PrintEnd method

PrintStart method

With Access, you can also print images in a report, as described in Including Images in a Report.

If you are using Visual Basic you can use the PrintNewPage method to eject a page and start a new page without ending the print job.

LEADTOOLS also provides the EnableFastRender property, which lets the user enable or disable "Fast Printing". Fast printing allows the OCX to render/print the bitmap to any device without any preprocessing, thus speeding up the printing process. This property may be used in any environment.


Marking a Selection with a Rubberband

You can mark a selection area by using a rubberband, which is a one-pixel rectangle on the display surface.

The following property lets you automate the rubberband so that it appears whenever the mouse is moved with the left button down:

AutoRubberBand property

Alternatively, you can control the rubberband by adding code to the mouse events. You can use the following method to set the size and position of the rubberband:

SetRubberBandRect method

You can use the following property to change the visibility of the rectangle, effectively turning it on or off:

RubberBandVisible property

You can use the following properties to get or set the current size and position of the rectangle:

RubberBandHeight property

RubberBandLeft property

RubberBandTop property

RubberBandWidth property

The following event occurs before the MouseUp event when the rubberband is turned on:

RubberBand event


Drawing Shapes and Text

You can draw simple lines, rectangles, or ellipses using methods and properties that implement standard Windows drawing functions. The available drawing modes, pen styles, and fill styles make it easy to use these methods and properties with the MouseMove event for interactive drawing. For these methods and properties, refer to Drawing Simple Objects.

You can also draw more sophisticated three-dimensional shapes and text. However, it is not a good idea to draw these shapes and text objects in the MouseMove event, because they do not support the inverted draw mode that lets you effectively erase an old object before drawing a new one. For these methods and properties, refer to Drawing Three-Dimensional Shapes and Text.

You can draw any of the shapes or text objects in the client area of the control or directly on the bitmap.


Drawing Simple Objects

You can draw a line, rectangle, or ellipse on the current bitmap or on the screen. Whether you draw to the bitmap or to the screen, drawing objects and text strings are always positioned in the LEAD control's client area. If the target is the bitmap, LEADTOOLS translates the values to bitmap coordinates.

Use the following property to specify whether to draw on the bitmap or the screen:

DrawPersistence property

Use the following properties to specify object styles and colors:

DrawMode property

DrawPenColor property

DrawPenStyle property

DrawPenWidth property

DrawFillColor property

DrawFillStyle property

Use the following methods to draw objects:

DrawLine method

DrawRectangle method

DrawEllipse method


Drawing Three-Dimensional Shapes and Text

You can draw a variety of three-dimensional shapes and text objects in the LEAD control's client area or directly on the bitmap. Possible shapes are stars, rectangles, triangles, and so forth. For a complete list, refer to the DrawShape method. The text objects can be rotated to any angle, specified in tenths of degrees.

For shapes and text:

The following property determines whether the shape or text object is drawn to the control's client area or to the bitmap:

DrawPersistence property

The following properties specify the color and offsets that apply a drop shadow to the shape or text object:

ShadowColor property

ShadowXDepth property

ShadowYDepth property

To turn off the shadow, set the X and Y depths to 0.

With text objects, the drop shadow is disabled with some styles, as shown in the following examples: Style with a Shadow and Style without a Shadow.

For shapes only:

Use the following method (with related properties) to draw a specified shape.

DrawShape method

The following properties specify the position and size of the shape:

ShapeLeft property

ShapeTop property

ShapeWidth property

ShapeHeight property

The following property specifies the background style of the shape:

ShapeBackgroundStyle property

For foreground patterns and colors, use the pattern properties described in to Gradients and Patterns. The following example shows how a fill pattern can be implemented: Shape with a Fill Pattern and Drop Shadow.

If the shape uses an image as its background, the following properties specify the source rectangle that defines which part of the bitmap to use for the background:

BackgroundImageHeight property

BackgroundImageLeft property

BackgroundImageTop property

BackgroundImageWidth property

The following properties specify the primary lines of the shape:

ShapeBorderColor property

ShapeBorderStyle property

ShapeBorderThickness property

The following properties specify the inner and outer bands that give the lines of the shape a three-dimensional appearance:

ShapeInnerBandHiliteColor property

ShapeInnerBandShadowColor property

ShapeInnerBandStyle property

ShapeInnerBandThickness property

ShapeOuterBandHiliteColor property

ShapeOuterBandShadowColor property

ShapeOuterBandStyle property

ShapeOuterBandThickness property

Inner bands apply only to rectangles and squares (not other shapes). The three-dimensional effects are most effective when you specify the inner band or outer band (but not both), as shown in the following examples: Inner band raised, Inner band inset, Outer band raised, and Outer band inset.

For text only:

Use the following method (with related properties) to draw a text object:

DrawText method

DrawTextOut method (limited support for related properties)

You can create an image that consists of a pattern or gradient color to use as a foreground of the text. Refer to Gradients and Patterns for related properties.

The following properties specify the bounding rectangle for the text object and the alignment of the text object in the rectangle:

TextLeft property

TextTop property

TextWidth property

TextHeight property

TextAlign property

The following properties specify the font and style of the text object:

Font property

DrawFontColor property

TextStyle property

TextWordWrap property

TextAngle property

TextHiliteColor property

Use the following methods to get the width and height that are required for a specified text string using the current property settings for text objects:

DrawTextHeight method

DrawTextWidth method

These methods measure a single line of text (rotated or unrotated). They disregard the TextWordWrap property.


Text with an Outline and Drop Shadow

The following properties are set in this example:

TextStyle	EFX_TEXTSTYLE_OUTLINEBLOCK

DrawFontColor	Blue

TextHiliteColor	Magenta

ShadowColor	Black

ShadowXDepth	5

ShadowYDepth	5


Text Where the Effect Disables the Drop Shadow

The following properties are set in this example:

TextStyle	EFX_TEXTSTYLE_RAISEDHEAVY

DrawFontColor	Blue

TextHiliteColor	Magenta

ShadowColor	Black

ShadowXDepth	5 (disabled by the effect)

ShadowYDepth	5 (disabled by the effect)


Shape with a Raised Inner Band

The following properties are set in this example:

ShapeInnerBandHiliteColor	Light blue

ShapeInnerBandShadowColor	Dark blue

ShapeInnerBandStyle	EFX_INNERSTYLE_RAISED

ShapeBorderColor	Black

PatternStyle	EFX_PATTERN_SOLID

PatternForeColor	Blue


Shape with an Inset Inner Band

The following properties are set in this example:

ShapeInnerBandHiliteColor	Light blue

ShapeInnerBandShadowColor	Dark blue

ShapeInnerBandStyle	EFX_INNERSTYLE_INSET

ShapeBorderColor	Black

PatternStyle	EFX_PATTERN_SOLID

PatternForeColor	Blue


Shape with a Raised Outer Band

The following properties are set in this example:

ShapeOuterBandHiliteColor	Light blue

ShapeOuterBandShadowColor	Dark blue

ShapeOuterBandStyle	EFX_OUTERSTYLE_RAISED

ShapeBorderColor	Black

PatternStyle	EFX_PATTERN_SOLID

PatternForeColor	Blue


Shape with an Inset Outer Band

The following properties are set in this example:

ShapeOuterBandHiliteColor	Light blue

ShapeOuterBandShadowColor	Dark blue

ShapeOuterBandStyle	EFX_OUTERSTYLE_INSET

ShapeBorderColor	Black

PatternStyle	EFX_PATTERN_SOLID

PatternForeColor	Blue


Shape with a Fill Pattern and Drop Shadow

The following properties are set in this example:

ShapeBorderColor	Blue

ShadowColor	Black

ShadowXDepth	5

ShadowYDepth	7

ShapeBackgroundStyle	EFX_BACKSTYLE_OPAQUE

PatternStyle	EFX_PATTERN_CROSS

PatternForeColor	Red

PatternBackColor	Light blue


Copying and Creating Bitmaps

Use the following methods for Clipboard input and output:

Copy method

Paste method

Use the following methods to copy the bitmap to or from a LEAD OLE Server control.

GetServerBitmap method

SetServerBitmap method

Use the following methods to copy the bitmap to or from a Picture object:

GetPicture method

SetPicture method

Use the following methods to copy the bitmap to or from a DIB or DDB:

GetDDB method

GetDIB method

SetDDB method

SetDIB method

Use the following property to create a bitmap from scratch:

CreateBitmap method

To create a user bitmap, use the CreateUserBitmap method. The user is responsible for allocating and maintaining the bitmap data pointer. The bitmap data pointer is set using the SetBitmapDataPointer method. These methods are useful when using images obtained from the LEADTOOLS Multimedia toolkit with the Main LEADTOOLS OCX.

You can copy a control's entire list of bitmaps by assigning the BitmapList property from one control to another. You can free all of the bitmaps in the list by setting the property to 0.

You can copy one control's current bitmap to another control's current bitmap by assigning the Bitmap property from one control to the other. You can remove the current bitmap from the list (freeing the bitmap) by setting the Bitmap property to 0. When a control has only one bitmap, you do not have to set the BitmapListIndex property to specify the current bitmap.


Image Processing

The following topics describe the kinds of image processing:

Examining and Altering Bitmaps

Managing Color Separations

Combining Images

Using the Windows API

Using Histograms

Working with the Alpha Channel


Examining and Altering Bitmaps

You can make many changes to the bitmap in memory, but keep in mind that the changes do not appear on the screen until the image repaints.

Getting Bitmap Information

Get information about the bitmap from the following properties and method:

BitmapBits property

BitmapHeight property

BitmapWidth property

BitmapXRes property

BitmapYRes property

IsGrayscale property

IsSigned property

GetColorCount method

GrayscaleExt method

ConvertToColoredGray method

Getting and Setting Pixel Values

Use the following method to get and set the values of individual pixels:

Pixel property

Fill method

Changing the Data Format

Use the following methods to change the bits per pixel and palette of a bitmap or bitmap list:

ColorRes method

ColorResList method

Use the following methods to change a bitmap to 8-bit grayscale or to a 1-bit halftone:

Grayscale method

Halftone method

Bitmap data can be signed or unsigned. If the bitmap data is signed, image processing and paint functions may not work correctly. A bitmap will not be loaded signed unless the LoadSigned property is set to TRUE before loading the image. To determine whether the bitmap loaded into the control is signed or not, check the IsSigned property. If this property is TRUE, the bitmap data is signed and should be converted to unsigned by calling the ConvertSignedToUnsigned method.

Windows always uses the RGB color-space model, and when loading or saving a file, LEADTOOLS converts image data to or from RGB, as necessary. Nevertheless, LEADTOOLS lets you create and merge color separations using a number of color-space models, including RGB, CMYK, CMY, HSV, and HLS. Use the ColorSeparate method to create separations, use the ColorMerge method to merge separations, and use the ColorPlanes property to access the separated planes.

Updating the Line Profiles

LineProfile method

LineProfileSize property

LineProfileRed property

LineProfileGreen property

LineProfileBlue property

Doing Geometric Transformations

Geometric transformations include resizing, trimming, rotating, shearing, flipping, or reversing a bitmap. The following geometric transformation functions are designed mainly for document imaging:

AutoTrim method

Deskew method (Document/Medical only)

FastRotate method (Document/Medical only)

Use the following method to resize the bitmap. Keep in mind that this changes the amount of memory required for the bitmap, and it is not necessary to do this for zooming in or out.

Size method

Use the following methods to alter a bitmap in various ways:

Trim method

Rotate method

Shear method

Flip method

Reverse method

LEADTOOLS also provides the TransformFile method for performing lossless flips, rotations and reversals. However, only certain file formats are supported at this time. This function provides better results than loading an image, transforming it using the Rotate method, Flip method or Reverse method and then resaving it. For each marker that the TransformFile method encounters within a file, the TransformMarker event is triggered. Within this event the user sets the WriteMarkerAction property to indicate what action to take with the marker. If the marker is to be written to the output file, the user calls the WriteMarker method.

Lightening, Darkening, Filtering, and So Forth

A number of image processing functions let you change the values of pixels across a bitmap (or a region in the bitmap) using various algorithms and filters. You might do this to improve the appearance of the image, to analyze details in the image, or to apply artistic effects. The following topics provide details:

Changing Brightness and Contrast

Removing Noise

Detecting and Enhancing Edges and Lines

Applying Artistic Effects

Correcting Colors

Adding Another Image to a Bitmap

The Combine method lets you add all or part of another bitmap to the target bitmap. You can pass flags to control whether the new pixels simply replace the old ones or are combined with the old ones in a specified way. You can also define a region in the target bitmap, and if you do, the function affects only the specified region. For information about regions, refer to Creating and Using a Bitmap Region. For more information on combining images, refer to Combining Images.

The Underlay method also combines images, but it has a much more specific purpose. It combines two bitmaps so that one appears to be an underlying texture for the other.

Treating the bitmap as a device context opens up many possibilities. You can set the DrawPersistence property to TRUE to draw text or objects on the bitmap. For details, refer to Drawing Simple Objects and Drawing Three-Dimensional Shapes and Text.

Also, the GetBitmapDC method lets you access the bitmap as a device context. You can then use Windows GDI functions to draw lines, text, or images on the bitmap. For more information, refer to Using the Windows API.

To replace an image with an image created from images in a specified directory, use the Picturize method.

Window leveling (Medical Imaging only)

Window leveling is only valid for 12 and 16-bit grayscale images and is used to map grayscale intensities by specifying the bit range and/or a user defined color map.  The bit range is specified by LevelLowBit property and LevelHighBit property.  The user defined color map is defined by LevelLUT property. The LevelLUT property can be filled by calling the WindowLevelFillLUT method. This method maps grayscale intensities to a specific color range. The LevelLowBit property, LevelHighBit property and LevelLUT property will only affect the way the image is painted and will not affect the image data.  To affect the image data, you must call the WindowLevel method. The WindowLevelBitmap property determines whether the WindowLevel method creates a new 8 or 24-bit bitmap, or leaves the bitmap as a 12 or 16-bit grayscale. The WindowLevel method applies window leveling to the bitmap, and resets LevelLowBit property, LevelHighBit property, LevelLUTLength property and LevelLUT property if a new 8 or 24-bit bitmap is created. LevelLowBit property and LevelHighBit property indicate which bits are considered image data.  LevelLUT is a remapping palette that provides the colors to use when remapping the image. MinBit property, MaxBit property, MinVal property and MaxVal property can aid in setting up the LevelLUT by providing information concerning the bitmap.  These values are retrieved using GetMinMaxBits method and GetMinMaxVal method.  For more information, refer to the individual entries for the properties and methods.


Changing Brightness and Contrast

Basic Brightness and Contrast Functions

With the basic brightness and contrast functions you can change the intensity or contrast using a flat scale, or you can adjust the gamma correction. Gamma correction changes brightness using a logarithmic scale to account for visual perception. You can apply the basic brightness and contrast functions either to the display or to a bitmap.

To adjust the display, use the PaintGamma, PaintIntensity, PaintContrast properties. These properties affect the display of all bitmaps. They are not really part of the image processing group, because they do not affect the bitmap. Nevertheless, these properties can be useful when the need for brightness and contrast improvement is device-specific, rather than image-specific.

To change the brightness and contrast of a bitmap, use the following methods:

GammaCorrect method

Intensity method

Contrast method

Histogram-Based Contrast Functions

Some image processing functions use an internally generated histogram for more sophisticated contrast improvements. The histogram is a table that reflects how many times each intensity value occurs in the bitmap.

The following high-level methods are based on histograms:

HistoContrast method

StretchIntensity method

HistoEqualize method

The HistoContrast method is similar to the ordinary Contrast method, except that it uses a bitmap-specific middle value. The ordinary contrast method raises all intensity values above 128 and lowers all values below 128. The HistoContrast method first finds the median intensity value in the bitmap. It then uses that median value, instead of 128, as the middle value. With either of these methods, you pass a parameter to indicate how much to increase the contrast.

The StretchIntensity method improves the contrast of a flat image, while preserving the original number of different intensity values. Other contrast methods, where you specify the increase, can lose values at the top and bottom of the scale. This method, instead, sets the lowest intensity value to 0 and the highest to 255, then remaps the original values proportionally. If the original values already range from 0 to 255, this method has no effect.

The HistoEqualize method is often the most effective function for bringing out hidden details through contrast improvement. Like the StretchIntensity method, it remaps the intensity values to use the full range of 0 to 255. But instead of remapping the values proportionally, it uniformly redistributes the values to balance the number of pixels across the range of intensities. Thus, clusters of similar intensity values in the original image are spread out, enabling you to see differences that were too subtle in the original.

The following elements let you create your own histogram-based function:

GetHistogram method

HistogramTable property

RemapIntensity method

RemapTable property

You can use the GetHistogram method to get a bitmap's histogram. You can then create a lookup table (RemapTable) based on the entries in the HistogramTable and call the RemapIntensity method to change the bitmap's intensities through the lookup table.

The intensity values are gray-level values. When changing the intensity values of a color image, the LEADTOOLS functions are actually changing the value of each color plane. The high-level methods automatically change the values of all planes, but if you create your own function, the decision is up to you. With the GetHistogram and RemapIntensity methods, you can manipulate an individual color plane, or you can manipulate all color planes by specifying the master channel.

For 12 or 16-bit grayscale images, use the GetHistogramGray method to get the bitmap's histogram.  The HistogramGrayTable property and the HistogramGrayTableSize property provide information about the histogram itself.

With color images, you can preserve more natural colors by first using the ColorSeparate method to do an HSV separation. You can then manipulate the value plane and recombine the color planes with the ColorMerge method.

In HSV color space, a color is represented by a hue, saturation (amount of white) and a value (amount of darkness). These can be remapped using the RemapHue method. This method uses several tables in the remapping process, depending on the bits per pixel of the image. For a 16-bit grayscale image or a 48-bit color image, the tables used are the HTableL, MaskTableL, STableL and the VTableL properties. For an image of any other bits per pixel the tables are the HTable property, the MaskTable property, the STable property and the VTable property. The RemapHueTablesSize property indicates the number of entries in the remapping tables. To convert between the HSV and RGB color space, use the following:

HSV_HfromRGB method

HSV_SfromRGB method

HSV_VfromRGB method

RGBfromHSV method


Removing Noise

One-Step Noise Removal

The following methods let you remove noise in one step:

Despeckle method (Document/Medical only)

Median method

Average method

The Despeckle method is designed specifically for removing specks from 1-bit images, such as FAX transmissions or scanned documents.

The Median method is an effective general function for removing salt-and-pepper noise from any kind of image. You control the strength of the method by specifying the size of the neighborhood (the surrounding pixels used for calculating the median value). This method causes minimal blurring of the image.

The Average method can be used to remove uniform and Gausian noise, but there is more blurring of the image than with the median filter. You control the strength of the method by specifying the size of the neighborhood (the surrounding pixels used for calculating the arithmetic mean).

The GaussianFilter method smoothes or blurs an image by applying a Gaussian filter to each pixel of the bitmap. The amount of blur is determined by the size of the neighborhood used by the method.

Creating Your Own Noise Removal Function

The following methods let you create your own function for noise removal:

BinaryFilter method (Document/Medical only)

MaxFilter method (Document/Medical only)

MinFilter method (Document/Medical only)

The binary filters (for erosion and dilation of black objects) can be used for noise removal. The BinaryFilter method applies directional binary filters. The MaxFilter and MinFilter methods let you control the neighborhood size for erosion or dilation. One noise removal technique with these functions is to create two copies of a bitmap, apply a dilation filter to one of them and an erosion filter to the other, then combine the two using Combine with the CB_OP_AVG (averaging) flag.  For more information on combining images, refer to Combining Images.


Detecting and Enhancing Edges and Lines

The following methods let you detect and enhance edges and lines:

EdgeDetector method

Sharpen method

SpatialFilter method

IntensityDetect method

UnsharpMask method

The Sharpen method is designed specifically to emphasize the edges (shifts in intensity) in a bitmap. It is a high-level method that can be used alone for the desired effect.

The SpatialFilter method provides several predefined filters for detecting edges or lines. These filters can be used alone in applications, such as industrial inspection systems, that analyze images. They can also be used to create an image that is combined with the original to change the appearance of lines or edges.

Choosing a filter is a subjective, application-specific decision. The filters use standard algorithms, some of which have similar purposes. You may need to experiment with them to choose the appropriate filter for your application. The following is a summary of the available filters:

Filter	Purpose

Emboss	Creates an image with an embossed appearance. (This is used for artistic effect, but is listed here because it is one of the predefined filters.)

Gradient directional	Detects edges, starting from any of eight specified directions. All pixels not on the detected edges are changed to black.

Prewitt	Detects horizontal or vertical edges. All pixels not on the detected edges are changed to black.

Sobel	Detects horizontal or vertical edges. All pixels not on the detected edges are changed to black. (The usage is the same as Prewitt, but the algorithm is different.)

Shift-and-difference	Detects horizontal, vertical, or diagonal edges. All pixels not on the detected edges are changed to black.

Laplacian	Detects lines. There are three omnidirectional filters and three bi-directional ones. All pixels not on the detected lines are changed to black.

Line-segment	Detects line segments. Possible directions are horizontal, vertical, left-to-right diagonal, and right-to-left diagonal. You can use this filter to find line discontinuities in an image. All pixels not on the detected line segments are changed to black.

To overcome the directional limitations of these filters, you can combine images that have been filtered in different ways. For example, you could make three copies of a bitmap, filter each one with a different Laplacian directional filter, and use the Combine method to create a bitmap with all of the detected lines. You could then combine this resulting bitmap with the original to enhance the lines in the original. For more information on combining images, refer to Combining Images.

The IntensityDetect method does not use a filter to detect edges or lines, but for some images it is more effective than the filters in detecting lines that are lighter or darker than other parts of the image.

The ContourFilter method applies a contour segment filter to the bitmap, creating a "contour map" of the bitmap.


Applying Artistic Effects

The following methods are designed specifically for artistic effects:

AddNoise method

Emboss method

Mosaic method

MotionBlur method

Oilify method

Posterize method

RemoveRedeye method

Solarize method

Underlay method

With any of these methods, except Underlay, you can limit the effect to a specified region of interest. For information about regions, refer to Creating and Using a Bitmap Region.


Correcting Colors

The following methods are designed specifically for adjusting colors in an image:

AntiAlias method

BalanceColors method

Hue method

Invert method

Saturation method

SwapColors method


Managing Color Separations

Use the following methods to create color separations or to combine existing color separations:

ColorSeparate method

ColorMerge method

Use the following property to access the color separations:

ColorPlanes property


Combining Images

Use the following methods to combine images from two bitmaps:

AlphaBlend method

Combine method

CombineBitmapWarp method

CombineExt method

FeatherAlphaBlend method

Underlay method

To combine image data from the source bitmap (the slave) into the destination bitmap (master) using a perspective warp, use the CombineBitmapWarp method.  If you want to specify the areas to be combined, the operations to be performed when combining the data, and which color planes (R or G or B or R, G, and B) are used, use the CombineExt method.

Use the following methods to add or average the bitmaps:

AddBitmaps method

Use the following method to create a fade mask bitmap:

CreateFadedMask method

Use the following methods to picturize the bitmap:

PicturizeBitmapList method

PicturizeSingle method

Use the following method to replace an image with an image created from images present in a specific directory:

Picturize method


Using the Windows API

You can get the device context for the LEAD control's client area or for the bitmap in memory. Thus, you can use Windows API functions that require a device context. For example, you can use GDI drawing functions to add lines, shapes, or text to the bitmap.

Use the following methods to create and release a device context for the bitmap in memory:

GetBitmapDC method

ReleaseBitmapDC method

Use the following methods to create and release a device context for the LEAD control's client area:

GetClientDC method

ReleaseClientDC method


Using Histograms

The following elements let you create and use a histogram, which charts the intensity levels in a bitmap:

GetHistogram method

HistogramTable property

When working with 12 or 16-bit grayscale images, use the following to create a histogram and to determine the size of the histogram:

GetHistogramGray method

HistogramGrayTable property

HistogramGrayTableSize property

Please note that support for 12 and 16-bit grayscale images is only available in the Document/Medical toolkits.


Working with the Alpha Channel

Use the following property to work with a bitmap's alpha channel:

BitmapAlpha property

Typically, an alpha channel contains a mask that is used for transparency. This property, used with the region processing methods, lets you implement transparency in saved images.


Creating and Using a Bitmap Region

A bitmap region is an area of interest within a bitmap. A bitmap can have only one region at a time, but the region can be complex, including, for example, multiple noncontiguous shapes.

When a bitmap has a region, the LEADTOOLS methods that modify the pixel values (for example Posterize method) act on the region, rather than the whole bitmap. For a list of these methods, refer to Raster Images: Where the Region Preempts the Bitmap.

In addition, the LEADTOOLS methods that flip, reverse, rotate, shear, or resize a bitmap also transform the region to match the bitmap. For example, if you were to shear a bitmap that had a rectangular region, the region would become a parallelogram. For a list of these methods, refer to Raster Images: Methods That Transform the Region and the Bitmap.

By default, a bitmap does not have a region. You can create a simple bitmap region using the RgnMarkingMode property, which automates region creation.  You can create a more complex bitmap region by calling one or more of the SetRgn... methods. Each time you call one of these methods, you specify how the new region is to be added to the existing bitmap region (if there is one). For a description of the possibilities, refer to Flags for Setting a Region.

To create a new region, or update an existing region, based on either an HSV range or an RGB range, use SetRgnColorHSVRange method or the SetRgnColorRGBRange method. To convert between HSV and RGB color space, use the following:

HSV_HfromRGB method

HSV_SfromRGB method

HSV_VfromRGB method

RGBfromHSV method

Automatic Creation of a Region

Use the RgnMarkingMode property to enable automatic creation of a region, based on MouseDown, MouseMove, and MouseUp events. This method supports creation of a rectangle, rounded rectangle, ellipse, or freehand region. It automatically handles scaling differences between the displayed image and the bitmap. On the MouseDown event, it begins outlining where the region will appear on the screen. It updates the outline on each MouseMove event. Then, on the MouseUp event, it deletes the displayed outline and creates the bitmap region. To make an outline of the region visible at that point, you must set the RgnFrameType property.

RgnMarkingMode property

The following event occurs each time the bitmap region is created or updated. It is especially useful with the RgnMarkingMode property, which automates the creation of regions.

RgnChange event

Use the following property to display an outline of the current region:

RgnFrameType property

Creating and Using a Floater

A floater is an additional bitmap that is associated with the LEAD control. Its common application is to implement the interactive visual aspects of an outline-drag-and-paste operation. You use it to get a copy of the image in the current bitmap region, which the user can drag to another position in the LEAD control's client area.

The following property lets you create the floater bitmap by assigning the LEAD control's Bitmap property to it. The floater bitmap that this creates is the size of the bounding rectangle of the main bitmap's region, and it contains the same region as the main bitmap.

Floater property

The following property lets you display or hide the floater:

FloaterVisible property

If you want to paste a floater into a new position, you must assign the floater to a second LEAD control, move the first LEAD control's region to the floater's position, then use the Combine method to paste the second control's bitmap at that position. The region acts as a mask with the combine operation.

The following method lets you see whether a point in the LEAD control's client area is in the floater. It is commonly used in the MouseDown event to test whether the mouse click selects the floater.

IsPtInFloater method

Use the following methods to position and size the display of the floater by setting destination rectangles. These methods are commonly used in the MouseMove event to reposition the floater in the LEAD control's client area. If the floater is visible, its region is automatically repainted when you set the destination rectangle. If the AutoSetRects property is set to True, the destination rectangle defaults to the size of the floater bitmap, and the clipping rectangle defaults to the size of the LEAD control's client area. Therefore, you must set the destination rectangle to the desired position, but you do not have to set the clipping rectangle unless you want to display only part of the floater.

SetFloaterDstRect method

SetFloaterDstClipRect method

Use the following properties to get the current destination rectangles of the floater. (You can also set these properties, but the floater will repaint each time you set one of the properties.)

FloaterDstHeight property

FloaterDstLeft property

FloaterDstTop property

FloaterDstWidth property

FloaterDstClipHeight property

FloaterDstClipLeft property

FloaterDstClipTop property

FloaterDstClipWidth property

Use the following read-only properties to get the size of the floater bitmap:

FloaterHeight property

FloaterWidth property

If you want to paste a floater into a new position, you must assign the floater to a second LEAD control, move the first LEAD control's region to the floater's position, then use the Combine method to paste the second control's bitmap at that position. The region acts as a mask with the combine operation.

Storing, Retrieving, and Deleting Regions

Use the following methods to store a copy of the region from the floater or main bitmap, and to delete the stored region when you no longer need it. Keep in mind that the region data contains only positioning information, not the bitmap's pixel values.

GetFloaterHandle method

GetRgnHandle method

DeleteRgnHandle method

Use the following method to remove the current bitmap region and free the region data from memory:

FreeRgn method

Use the following method to add a stored region to the current bitmap region. You can either replace the current region or create a complex region by setting a Boolean flag that determines how the added region interacts with the existing region.

SetRgnHandle method

Getting Region Information

Use the following methods and properties to get information about the current bitmap region.

HasRgn property

IsPtInRgn method

GetRgnArea method

RgnHeight property

RgnLeft property

RgnTop property

RgnWidth property

Rows within a region can have 0, 1, or more segments per row. To get the segments contained within the region for a particular row, call the GetBitmapClipSegments method.

Low-Level Methods for Creating Regions

Use the following methods to add a new region to the bitmap. You can either replace the current region or create a complex region by setting a Boolean flag that determines how the added region interacts with the existing region. For a description of the possibilities, refer to Flags for Setting a Region.

The coordinates that you use with these methods are relative to the LEAD bitmap in memory, not to the client area.

These methods are for a new region with a simple shape:

SetRgnEllipse method

SetRgnRect method

SetRgnRoundRect method

This method is for a new region that consists of all pixels of a specified color:

SetRgnColor method

Use the SetRgnMagicWand method to set a region based on the color of a specified point.

These methods are for a new polygonal region. You build an ordered array of points for the vertices of the polygon; then create the region based on the array. The PolygonSize property specifies the size of the array. You can either specify a large array to start with, or you can increase the size of the array when necessary (without losing the existing points).

PolygonSize property

PolygonX property

PolygonY property

SetRgnPolygon method

LEADTOOLS also provides a number of methods and properties for creating a curve region or adding a curve region to an existing bitmap region. To create a curve region, first build an ordered array of points for the curve. Then create the region based on the array. The CurveSize property specifies the size of the array. Either specify a large array to start with, or increase the size of the array as needed, without losing existing points. For each point, update the following indexed properties:

 CurveX property

 CurveY property

and define the characteristics of the curve by setting the following properties:

 CurveType property

 CurveTension property

 CurveClose property

Then call the SetRgnCurve method to add the region to the bitmap.

A standard curve can be converted to a series of Bezier points using the CurveToBezier method. This method updates the following properties with information about the Bezier points created:

BezierSize property

BezierX property

BezierY property

Moving a Region

Use the following method to move the current bitmap region. The values that you use are relative to the LEAD bitmap in memory, not to the client area.

OffsetRgn method

Coloring a Region

Set the RgnFrameColor property to display a filled, color representation of a region.

Resizes the Bitmap Region

ResizeRgn method


Managing Palettes

Use the following properties to modify a palette that is used to display an image on a device that is 8 bits per pixel or less:

BitmapPalette property

UserPalette property

Use the following method to get the palette used in a particular device context:

GetPalette method

For related information about palette usage, refer to the ColorRes and ColorResList methods, and to the PaintPalette property.


Implementing Annotations

Note: This topic is for Document/Medical only.

LEADTOOLS maintains annotations separately from bitmaps. Annotations, which are based on vectored drawing functions, are associated with a bitmap only as an overlay of the displayed image. Ordinarily, your application code is responsible for maintaining the relationships between images and annotations. For example, the annotation example that ships with LEADTOOLS, creates an annotation file that has the same name as its associated image file, but with a different extension. When the image file is loaded, the program looks for an associated annotation file and loads it as well.

Database operations are an exception. When binding to a data control in Visual Basic, if a LEAD control has annotations, they are automatically stored with the bitmap. With ODBC operations, annotations are not supported.

The LEAD control implements annotations by turning on automated features. You can set the following property to let a user add annotations (in design mode) or view annotations (in run mode). You can also use this property to make the annotations invisible.

AnnUserMode property

The following property lets you automatically rotate annotations to match the bitmap's rotation:

AnnAutoRotate property

The following property lets you automatically resize annotations to match the bitmap, after the bitmap has been resized:

AnnAutoResize property

In design mode, the following property lets you select an annotation tool:

AnnTool property

Run mode activation of a hot spot or button annotation generates the following event where you can add your own code:

AnnClicked event

If your application requires you to uniquely identify an annotation object, you can use the following methods to maintain numeric tags, and retrieve an object based on that tag:

AnnSetTag method

AnnGetTag method

AnnGetObjectFromTag method

The following method lets you identify the type of the specified annotation object:

AnnGetType method

To determine the number of items present in an object, use the following:

AnnEnumerate event

AnnEnumerate method

The following events let you add code to adapt your application to the automated annotation features:

AnnCreate event

AnnDestroy event

AnnDrawn event

AnnChange event

AnnSelect event

The following methods let you flip, reverse, rotate, or move annotations programmatically:

AnnFlip method

AnnReverse method

AnnRotate method

AnnMove method

AnnRectHeight property

AnnRectLeft property

AnnRectTop property

AnnRectWidth property

AnnBringToFront method

AnnSendToBack method

The following properties and methods let you create, manipulate, and remove annotation objects:

AnnCreate method

AnnCreateItem method

AnnInsert method

AnnSetAutoDefaults method

AnnRectLeft property

AnnRectHeight property

AnnRectLeft property

AnnRectWidth property

AnnSetVisible method

AnnGetVisible method

AnnSetSelected method

AnnRemove method

The following properties let you get the boundaries of the bounding rectangle of the specified annotation object:

AnnBoundingRectHeight property

AnnBoundingRectLeft property

AnnBoundingRectTop property

AnnBoundingRectWidth property

The following methods let you handle a region:

AnnGetArea method

AnnGetRgnHandle method

The following methods let you work with the Ruler object:

AnnGetDistance method

AnnGetBitmapDpiX method

AnnGetBitmapDpiY method

AnnGetGaugeLength method

AnnSetGaugeLength method

The following methods let you handle the annotation object characterstics:

AnnGetAutoBackColor method

AnnGetBackColor method

AnnGetForeColor method

AnnSetAutoBackColor method

AnnSetBackColor method

AnnSetForeColor method

AnnGetFillMode method

AnnGetFillPattern method

AnnGetLineStyle method

AnnGetLineWidth method

AnnGetMetafile method

AnnGetName method

AnnGetNodes method

AnnGetPolyFillMode method

AnnGetPredefinedMetafile method

AnnGetSelected method

AnnGetText method

AnnGetUnit method

AnnHitTest method

AnnSetFillMode method

AnnSetFillPattern method

AnnSetLineStyle method

AnnSetLineWidth method

AnnSetMetafile method

AnnSetName method

AnnSetNodes method

AnnSetPolyFillMode method

AnnSetPredefinedMetafile method

AnnSetText method

AnnGetFontBold method

AnnGetFontItalic method

AnnGetFontName method

AnnGetFontSize method

AnnGetFontStrikeThrough method

AnnGetFontUnderline method

AnnSelectPoint method

AnnSetFontBold method

AnnSetFontItalic method

AnnSetFontName method

AnnSetFontSize method

AnnSetFontStrikeThrough method

AnnSetFontUnderline method

The following methods let you use ROP2:

AnnGetROP2 method

AnnSetROP2 method

The following methods let you handle the bitmap:

AnnGetBitmap method

AnnGetTransparentColor method

AnnSetBitmap method

AnnSetBitmapDpiX method

AnnSetBitmapDpiY method

AnnSetTransparentColor method

AnnGetTransparent method

AnnSetTransparent method

AnnGetSecondaryBitmap method

AnnSetSecondaryBitmap method

When painting annotations on a bitmap, normally, the image is painted first, and then the annotations are rendered. This can cause flicker, and, it allows the portion under the annotation objects, for example a Redact object, to be visible. To avoid this flicker, enable double buffer image display by setting the DoubleBuffer property to TRUE.

The following methods and properties let you select annotation objects relative to a window:

AnnSelectPoint method

AnnSelectRect method

AnnSelectRectHeight property

AnnSelectRectLeft property

AnnSelectRectTop property

AnnSelectRectWidth property

The following methods let you group or ungroup annotations:

AnnGetGrouping method

AnnGroup method

AnnSetGrouping method

AnnUngroup method

For more information on grouping and ungrouping annotations, refer to Grouping and Ungrouping Annotation Objects.

You can manipulate the mouse when working with annotations using the following:

AnnMouseDown event

AnnMouseMove event

AnnMouseUp event

SetMousePos method

The following method lets you apply annotations to the bitmap, itself.

AnnRealize method

The following method lets you restore the background of redact objects.

AnnUnrealize method

The following methods let you load annotations from a file or save them to a file:

AnnLoad method

AnnDataPath property

AnnLoadArray method

AnnLoadMemory method

AnnSave method

AnnSaveArray method

AnnSaveMemory method

AnnSaveOffset method

The following method lets you save annotations in a Wang compatible TIFF tag:

AnnSaveTag method

The following methods and property support Windows clipboard operations:

AnnCopy method

AnnCut method

AnnPasteReady property

AnnPaste method

The following property and methods let you control and customize the menus and other text strings that appear in automation mode:

AnnAutoDialogFontSize property

AnnAutoMenuEnable property

AnnAutoDrawEnable property

AnnGetAutoText method

AnnSetAutoText method

AnnGetAutoMenuItemEnable method

AnnSetAutoMenuItemEnable method

For information on modifying the annotation automation menu through the AnnMenu object, refer to Annotation Menu.

To undo changes made to objects or automation operations, use the following methods and properties:

AnnAddUndoNode method

AnnUndo method

AnnUndoDepth property

AnnUndoEnable property

For more information on undoing operations, refer to Undoing Automation Operations.

You can use LEADTOOLS DLL functions to further customize the automated annotation features. Keep in mind, however, that the ActiveX relies on particular ways of identifying, scaling and positioning annotation objects. Modifying the behavior with DLL functions can break the automated features. The following methods, properties, and events can be helpful when using DLL functions:

AnnContainer property

AnnGetContainer method

AnnGetTopContainer method

AnnAutomation property

AnnGetSelectCount method

AnnGetSelectList method

AnnSelect event

AnnGetPointCount method

AnnGetPointX method

AnnGetPointY method

User Interface for Annotations

In design mode, you can select tools using the AnnTool property and draw annotation objects over the image in the window. You can then use the right mouse button to get a pop-up menu that is tailored to each object type. You can include the Annotation Toolbar to make tool selection easier. The toolbar and the pop-up menu appear as shown in the following example:

The popup menu is context sensitive. It lists only the properties that can be changed on the selected object or objects. If you use the popup menu to change a property, the value that you specify is applied to the current selection, and it becomes the default for the next object.

The following topics describe the automated annotation features for particular objects and tools:

 Setting Defaults

 Selection Pointer Tool

 Line Tool

 Rectangle Tool

 Ellipse Tool

 Polyline Tool

 Polygon Tool

 Pointer Tool

 Freehand Line Tool

 Highlight Tool

 Redaction Tool

 Text Tool

 Note Tool

 Stamp Tool

 Hot spot Tool

 Button Tool

 Audio Clip Tool

 Ruler Tool

 Cross product Tool

 Point Tool

 Protractor Tool

 Video Tool

 PushPin Tool

 Freehand Hot Spot Tool

 Rubber Stamp Tools

See Also

Grouping and Ungrouping Annotation Objects

Annotation Toolbar

Annotation Menu


Annotation Files

Note:	This topic is for Document/Medical only.

LEADTOOLS maintains annotations separately from bitmaps. The user's application code is responsible for maintaining the relationships between images and annotations. For example, the annotation example that ships with LEADTOOLS creates an annotation file that has the same name as its associated image file, but with a different extension. When the image file is loaded, the program looks for an associated annotation file and loads it as well.

LEADTOOLS provides several properties and methods for handling annotation files.  Annotation files can be stored on a disk, in memory or they may be embedded in another file. To load annotation files in these varied locations, LEAD provides the following:

AnnLoad method

AnnLoadArray method

AnnLoadMemory method

Each annotation file contains information about the annotations stored in that file. This information can be obtained using the following functions:

AnnFileInfo method

AnnFileInfoMemory method

AnnFileInfoArray method

These methods each update the following properties:

AnnInfoFormat property

AnnInfoTotalPages property

AnnInfoVersion property

Annotation files may contain a single page, or they may be multi-page. In a multi-page file, pages may be deleted using the following methods:

AnnDeletePage method

AnnDeletePageMemory method

AnnDeletePageArray method

Finally, annotation files may be saved to disk, to memory, or embedded within another file, using the following methods:

AnnSave method

AnnSaveMemory method

AnnSaveArray method


Annotation Toolbar

Note: This topic is for Document/Medical only.

LEADTOOLS provides properties, methods, and events for creating and modifying an annotation toolbar.

To create the toolbar call the Create method.

To make the toolbar visible or invisible, set the Visible property.

For determining the number of toolbar buttons present and the orientation, use the following:

ButtonCount property

ButtonColumns property

ButtonRows property

To modify individual buttons on the toolbar, use the following:

ButtonTool

ButtonToolCount

ButtonMenuTool

ButtonMenuText

ButtonMenuTextID

ButtonBitmapDown

ButtonBitmapUp

ButtonToolTipText

ButtonToolTipTextID

ButtonVisible

Events associated with the toolbar:

AnnToolChecked event

AnnToolDestroy event


Annotation Menu

Note: This topic is for Document/Medical only.

LEADTOOLS provides an AnnMenu object, accessible through the AnnMenu event, which lets you modify the annotation automation menu. A pointer to an AnnMenu object is passed to the AnnMenu event. At this point you can modify this object using the following methods and properties:

AddItem

Count

DeleteItem

GetSubMenu

ItemChecked

ItemEnabled

ItemID

ItemString

ItemType

When a user-defined annotation automation menu item is clicked, an AnnUserMenu event is fired. If the user-defined menu item was added using the AddItem method, then the AnnUserMenu event receives the same item ID that was passed to the AddItem method.


Implementing Annotation Security

Note: This topic is for Document/Medical only.

LEADTOOLS provides annotation security through a number of properties, methods and events.  AnnLock method and AnnUnlock method let you lock and unlock annotations using a key.  Locking an object through the automated mode generates an AnnLocked event and unlocking an object through the automated mode generates an AnnUnlocked event.  If AnnShowLockedIcon property is set to TRUE, any locked object will be drawn with a padlock icon on top of it.  AnnGetLocked method also provides a means of determining if an object is locked.

You can also secure annotations by using AnnSetUser method. By setting the user for an annotation, modification to the annotation cannot be made unless the correct user is known.


Moving the Name of an Annotation

LEADTOOLS provides a number of properties and methods for positioning the name of an annotation object. First, the name may be restricted. If a name is restricted, then it will fully appear on the bitmap. By restricting the name, the offsets used to position the name are therefore limited, based on the name of the annotation object and the font that is being used.

To get the current restriction status for an annotation object, call the AnnGetNameRestrict method. To change the restriction status of an annotation object, call the AnnSetNameRestrict method.

The annotation name can be positioned by setting its offset values. These values are relative to the upper left corner of the bounding box of the annotation object. To get the current offset values of the name of an annotation object call the AnnGetNameOffsetX method and the AnnGetNameOffsetY method. To change the position of the name of the annotation object, call the AnnSetNameOffsetX method and the AnnSetNameOffsetY method.

The name of an annotation has both a defining rectangle and a bounding rectangle. The defining rectangle is specified by the following read only properties:

AnnNameRectHeight property

AnnNameRectLeft property

AnnNameRectTop property

AnnNameRectWidth property

The bounding rectangle is specified by the following read only properties:

AnnNameBoundingRectHeight property

AnnNameBoundingRectLeft property

AnnNameBoundingRectTop property

AnnNameBoundingRectWidth property

For an explanation of the difference between the defining rectangle and the bounding rectangle, refer to any of the AnnNameBoundingRectXXX properties.


Implementing Annotation Hyperlinks

Note: This topic is for Document/Medical only.

LEADTOOLS provides several properties, methods and events that allow you to hyperlink annotations.  Annotations may be hyperlinked to run a program, access a Web page, or send a user-defined message.  Hyperlinks that run a program or access a Web page are generated using AnnSetHyperlinkString method.  AnnSetHyperlinkMsg method lets you create a hyperlink to send a user defined message to the AnnHyperlink event.  To determine the type of hyperlink associated with an annotation use AnnGetHyperlinkType method.  If the hyperlink runs a program or accesses a Web page, you can retrieve the name of the program, with all required command line parameters, or you can retrieve the URL of the Web page using AnnGetHyperlinkString method.  Hyperlinks to the AnnHyperlink event may have parameters.  AnnGetHyperlinkParam method lets you retrieve the parameters.  AnnHyperlinkMenuEnable property enables or disables the hyperlink menu item for automated annotations.  AnnHyperlinkMenu event occurs when the user selects the hyperlink menu item for automated annotations.


Converting Annotation Automation Dialogs to Other Languages

Note: This topic is for Document/Medical only.

The annotation DLL provided with the English version of LEADTOOLS produces annotation automation dialogs with English strings. To convert the annotation automation dialogs to other languages, it is necessary to modify the dialog strings and, depending on the language, the font size and name. For languages that use English characters, the dialogs can be translated by just changing the dialog strings. This can be done as follows:

LEAD1.AnnAutoDialogFontSize = 15

For some languages, such as Japanese and Chinese, special fonts are required to display the characters of that language. These characters are often larger than English characters. Consequently, it is necessary to change the dialog strings, the font name and the font size. For example, to use Japanese strings with the English annotation DLL, the following must be done:

1.	Change the font size and name for the automation dialogs as follows:

// Change the font size.
// The English version uses 8 as a default.
// The Japanese version uses 9.
LEAD1.AnnAutoDialogFontSize = 9;

//Change the font name.
AnnSetAutoText ANNAUTOTEXT_DIALOG_FONT, "Japanese Font Name"

2.	Change all the automation strings as follows:

AnnSetAutoText ANNAUTOTEXT_XXX, "New Japanese String."


Grouping and Ungrouping Annotation Objects

Note: This topic is for Document/Medical only.

If more than one object is selected when the right mouse button is pressed, the "Group" menu option appears and lets you group the selected objects. From that moment on, all the grouped objects are acted on as one in automation mode. When you select one object, all objects become selected. When you unselect an object belonging to a group, all objects in that group are unselected.

To select only one object in a group, you must ungroup them. When you select a "grouped" set of objects and press the right mouse button, the "Ungroup" option appears in the menu. Selecting that option "ungroups" the objects. After that, objects are independent (you can select one without selecting the others).

Each container has a "Grouping" feature, which determines whether the objects contained in that container are treated as a group by the automation. If the "Grouping" feature is TRUE, then all the objects in the container should be treated as a group. If the "Grouping" feature is FALSE, then the objects in the container can be selected and changed independently. The "Grouping" feature of a container can be set using the AnnSetGrouping method. To determine the status of the "Grouping" feature of a container, call the AnnGetGrouping method.

The AnnGroup method does the following:

 creates a sub-container

 moves the objects to this sub-container

 sets the Grouping feature for the sub-container to TRUE

Setting the Grouping feature to FALSE by calling the AnnSetGrouping method with bAutoGroup set to FALSE is similar to calling the AnnUngroup method.

To change only one object within a group, do the following:

 find the object's container.

 set the grouping property to FALSE for the container.

 change the object.

 set the grouping feature to TRUE for the container.

To programmatically move all the objects belonging to a group you have two choices:

1. Move the subcontainer, which contains all the objects (not the best solution)

2. Move all the objects present in that container (the better solution).

The problem with moving the container is that objects are clipped to their container. So if the subcontainer has an offset of 100 and you try to move the objects in the automated mode, then you cannot move the objects all the way to the left. You will be able to move the objects in the automated mode, but their left side will disappear.

This means that if you are going to use subcontainers and automated mode at the same time, then you should create the subcontainers so that they have the same size as the main container. Or, you can keep track of the mouse notifications. And move the subcontainer whenever the mouse moves.

To create a group of objects, you can create a container, insert all the objects in it and insert that container in the main container (without stripping the container).


Setting Defaults

Note: This topic is for Document/Medical  only.

When using annotations in design mode, you can change the default properties by clicking with the right mouse button on an empty spot (a place on the image without any annotations). The popup menu lets you do the following:

 Undo the last user action.

 Select all annotation objects in the container.

 Delete all selected objects.

 Change the default line width and style properties. See Line Dialog Box for Annotations.

 Change the default fill mode (transparent, translucent, or opaque) and the fill pattern. See Fill Dialog Box for Annotations.

 Change the polygonal fill mode, which controls which areas are filled when lines cross. See Fill Dialog Box for Annotations.

 Change the default foreground and background colors. See Color Dialog Box for Annotations.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

The default background color does not affect highlight, redaction, and note objects.  To change the default background color for these objects, you have to use the appropriate menu item, such as Redact Background Color.


Undoing Automation Operations:

The LEADTOOLS OCX features include an Undo engine for undoing annotation automation operations. The undo depth determines the number of operations that can be undone. There is only one undo depth value per root container. Subcontainers do not have their own separate values.

LEADTOOLS provides a number of methods and properties for handling the undo capabilities.

The undo depth for the automation handle is contained in the AnnUndoDepth property.

The AnnUndo method undoes the last automation operation performed, including changes made to object properties.

Generally, operations are undone one operation at a time. If the last operation performed cut several objects from a container, undoing that operation would return the objects to the container. Occasionally, it may be best to group several operations, such as object additions or property changes, together so that calling AnnUndo undoes the whole group of operations and not just the last operation performed. This can be accomplished by:

1.	Set the number of undo actions that can take place using the AnnUndoDepth property. This property defaults to 5.

2.	Call the AnnAddUndoNode method to add an undo node to the automation object.

3.	Disable the undo feature by setting the AnnUndoEnable property to FALSE.

4.	Perform the operations or changes to be combined into one undo.

5.	Re-enable the undo feature by setting the AnnUndoEnable property to TRUE.

Now, all three operations can be undone with one call to the AnnUndo method instead of several calls to the AnnUndo method.


  Selection Pointer Tool

Note: This topic is for Document/Medical  only.

The selection pointer is the mouse pointer for selecting and manipulating annotation objects in design mode.

With the selection pointer, you can select one or more objects as follows:

 You can select a single object by clicking on the object.

 You can click and drag to form a rectangular selection area that will select all objects that are completely contained within it.

 You can hold down the shift key and click on several objects one-at-a-time to select them all.

When an object is selected, handles appear on the corners of its bounding rectangle. You can click on the body of the object and drag it to another position. You can click on a handle and drag to resize the object. If more than one object is selected, all of them are moved or resized.

In addition, you can use this pointer to rotate an object. If you hold down the shift key, click on a handle, and drag the mouse, the object rotates. If more than one object is selected, all of them are rotated, using the center of the group as the center of rotation. You cannot rotate a note, button, or audio clip. If you rotate a group that includes one of these objects, the object will move to the new position, but will retain its orientation.

The popup menu is also affected if more than one object is selected. In that case, when you click the right mouse button, the popup menu lets you change the properties of all the selected objects, and it lets you delete all the selected objects.


  Line Tool

Note: This topic is for Document/Medical  only.

The line annotation object is a simple line. In design mode, the line is started on a mouse-down event and completed on a mouse-up event. Holding down the Shift key while drawing the line will draw the line at an angle that is a multiple of 45 degrees.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the foreground color. See Color Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

For low-level implementation details, refer to Line Annotation Object.


  Rectangle Tool

Note: This topic is for Document/Medical  only.

The rectangle annotation object is a simple rectangle. In design mode, click and drag to specify the rectangle in the current window. Holding down the Shift key while drawing the rectangle will make the rectangle annotation square.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the fill mode (transparent, translucent, or opaque) and the fill pattern. See Fill Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

For low-level implementation details, refer to Rectangle Annotation Object.


  Ellipse Tool

Note: This topic is for Document/Medical  only.

The ellipse annotation object is a simple ellipse. In design mode, click and drag to specify the ellipse in the current window. Holding down the Shift key while drawing the ellipse will make the ellipse annotation circular.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the fill mode (transparent, translucent, or opaque) and the fill pattern. See Fill Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

For low-level implementation details, refer to Ellipse Annotation Object.


  Polyline Tool

Note: This topic is for Document/Medical  only.

The polyline annotation object is an array of points that create a sequence of joined lines. In design mode, each line segment is formed with a mouse click, and the object is completed on a double click.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the foreground color. See Color Dialog Box for Annotations.

 Change the foreground color. See Color Dialog Box for Annotations.  Change the ROP2 code. See ROP2 Dialog Box for Annotations

 Add or delete nodes. Add a node by clicking on the spot where you wish to add a node, then select Add Node. To delete a node, click on the node you wish to delete and select Delete Node.

For low-level implementation details, refer to Polyline Annotation Object.


  Polygon Tool

Note: This topic is for Document/Medical  only.

The polygon annotation object is an array of points that define the vertices of a polygon. In design mode, each line segment is formed with a mouse click, and the object is completed on a double click, which closes the polygon with a line from the last point to the first point.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the fill mode (transparent, translucent, or opaque) and the fill pattern. See Fill Dialog Box for Annotations.

 Change the polygonal fill mode, which controls which areas are filled when lines cross. See Fill Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

 Add or delete nodes. Add a node by clicking on the spot where you wish to add a node, then select Add Node. To delete a node, click on the node you wish to delete and select Delete Node.

For low-level implementation details, refer to Polygon Annotation Object.


  Pointer Tool

Note: This topic is for Document/Medical  only.

The pointer annotation object is defined by two points, with the an arrow at the first point. . In design mode, click and drag to specify the points in the current window. Holding down the Shift key while drawing the pointer will draw the pointer annotation object at an angle that is a multiple of 45 degrees.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the foreground color. See Color Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

For low-level implementation details, refer to Pointer Annotation Object.


  Freehand Line Tool

Note: This topic is for Document/Medical  only.

The freehand line annotation object is an array of points that create a sequence of joined lines. In design mode, each line segment is formed with a mouse move event when the left button is down, and the object is completed on a mouse up event.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the foreground color. See Color Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

 Add or delete nodes. Add a node by clicking on the spot where you wish to add a node, then select Add Node. To delete a node, click on the node you wish to delete and select Delete Node.

For low-level implementation details, refer to Freehand Line Annotation Object.


  Highlight Tool

Note: This topic is for Document/Medical  only.

The highlight annotation object is a rectangle with default properties that are appropriate for highlighting an area. . In design mode, click and drag to specify the rectangle in the current window. Holding down the Shift key while drawing the rectangle will make the highlight annotation square.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the background color. See Color Dialog Box for Annotations.

For low-level implementation details, refer to Highlight Annotation Object.


  Redaction Tool

Note: This topic is for Document/Medical  only.

The redaction annotation object is a rectangle with default properties that are appropriate for blacking out an area. In design mode, click and drag to specify the rectangle in the current window. Holding down the Shift key while drawing the rectangle will make the redact annotation square.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the background color. See Color Dialog Box for Annotations.

For low-level implementation details, refer to Redaction Annotation Object.


  Text Tool

Note: This topic is for Document/Medical  only.

The text annotation object is a rectangle containing a character string with font properties. The text will wrap on word breaks within the object's specified rectangle. In design mode, click and drag to specify the rectangle in the current window. Holding down the Shift key while drawing the rectangle will make the text annotation square. A dialog box then lets the user enter the text.

As soon as the Text object is created, the text will be highlighted. The text may be edited immediately. While in design mode double click on a text object to edit the text.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the fill mode. (You can make it transparent or opaque, but not translucent). See Fill Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations.

 Edit the text. See Text Dialog Box for Annotations.

You cannot flip or reverse a text object, but you can rotate it. If you flip or reverse a container that includes a text object, the text will move to the new position, but will retain its orientation.

For low-level implementation details, refer to Text Annotation Object.


  Note Tool

Note: This topic is for Document/Medical  only.

The note annotation object is a rectangle with a shadow border and color background (yellow by default). It contains a character string with font properties. The text will wrap on word breaks within the object's specified rectangle. In design mode, click and drag to specify the rectangle in the current window. Holding down the Shift key while drawing the note will make the note annotation square. A dialog box then lets the user enter the text.

As soon as the Note object is created, the text will be highlighted. The text may be edited immediately. While in design mode double click on a note object to edit the text.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations.

 Edit the text .See Text Dialog Box for Annotations.

You cannot flip, reverse, or rotate a note. If you flip, reverse, or rotate a container that includes a note, the note will move to the new position, but will retain its orientation.

For low-level implementation details, refer to Note Annotation Object.


  Stamp Tool

Note: This topic is for Document/Medical  only.

The stamp annotation object can be a bitmap image or a text string in a rectangular frame. In design mode, click and drag to specify a rectangle. Holding down the Shift key while drawing the rectangle will make the stamp annotation square. Then, if a text string is specified, the text is centered in the rectangle. If a bitmap is specified, the bitmap is scaled to fit the rectangle.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the frame's line width and style properties. See Line Dialog Box for Annotations.

 Change the fill mode (transparent, translucent, or opaque) and the fill pattern. See Fill Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations.

 Edit the text .See Text Dialog Box for Annotations.

 Select an image file to load into the stamp. See Stamp Bitmap Dialog Box for Annotations.

On a device that displays 256 colors or less, you should use a fixed palette when displaying bitmaps. Otherwise, a palette shift will occur on stamp objects that contain bitmaps.

You cannot flip or reverse a stamp object, but you can rotate it. If you flip or reverse a container that includes a stamp, the object will move to the new position, but will retain its orientation.

For low-level implementation details, refer to Stamp Annotation Object.


  Button Tool

Note: This topic is for Document/Medical  only.

The button annotation object is an image of a standard Windows button that can be activated. In design mode, click and drag to specify the size of the button in the current window. Holding down the Shift key while drawing the button will make the button annotation square. A dialog box then lets the user enter the text for the button. In run mode, clicking on the button triggers an AnnClicked event. The user can add code to process the event. (The example program merely pops up a message box.)

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the foreground color. See Color Dialog Box for Annotations.

 Edit the text. See Text Dialog Box for Annotations.

 Change certain aspects of the font.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations. Note: Only certain font characteristics can be changed for the button tool.

You cannot flip, reverse, or rotate a button. If you flip, reverse, or rotate a container that includes a button, the button will move to the new position, but will retain its orientation.

For low-level implementation details, refer to Button Annotation Object.


  Hot Spot Tool

Note: This topic is for Document/Medical  only.

The hot spot annotation object is a rectangle that can be activated for an application-defined purpose. In design mode, the rectangle contains a scaled image. Click and drag to specify the rectangle. Holding down the Shift key while drawing the hotspot will make the hotspot annotation square. In run mode, the object is transparent, but the mouse pointer changes to a hand when it is over the object. In run mode, clicking on the button triggers an AnnClicked event. Code can be added to process the event. (The example program merely pops up a message box.)

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

You cannot flip, reverse, or rotate a hot spot. If you flip, reverse, or rotate a container that includes a hot spot, the object will move to the new position, but will retain its orientation.

For low-level implementation details, refer to Hot Spot Annotation Object.


  Audio Clip Tool

Note: This topic is for Document/Medical  only.

The audio clip annotation object is a rectangle containing a scaled image that can be activated to play a WAV file. In design mode, click and drag to specify the rectangle in the current window. Then, specify the WAV file in the dialog box. Holding down the Shift key while drawing the audio clip will make the audio clip annotation square. In run mode, clicking on the icon plays the WAV file.

In design mode, you can click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Bring the object to the front or send it to the back.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Select a WAV file to load into the object. See Audio File Dialog Box for Annotations.

When you save this type of annotation, the WAV file is not saved. Only its path is saved.

You cannot flip, reverse, or rotate an audio clip. If you flip, reverse, or rotate a container that includes an audio clip, the object will move to the new position, but will retain its orientation.

For low-level implementation details, refer to Audio Clip Annotation Object.


  Ruler Tool

Note: This topic is for Document/Medical s only.

The ruler annotation object is a line that can be used to measure the distance between two points of the original image. Holding down the Shift key while drawing the ruler will draw the ruler annotation object at an angle that is a multiple of 45 degrees.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Bring the object to the front or send it to the back.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the foreground color. See Color Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

 Change the measurement units, precision and gauge length. See Ruler Dialog Box for Annotations

You cannot flip, reverse, or rotate a ruler clip. If you flip, reverse, or rotate a container that includes a ruler, the object will move to the new position, but will retain its orientation.

For low-level implementation details, refer to Ruler Annotation Object.


 Video Tool

Note: This topic is for Document/Medical only.

The video annotation object (ANNOBJECT_VIDEO) is a rectangle containing a scaled image that can be activated to play an AVI file or capture a multimedia file. With the automated functions, in design mode, the user clicks and drags to specify the rectangle in the current window. .Holding down the Shift key while drawing the rectangle will make the video annotation square. A dialog box then lets the user specify the preferred options. In run mode, clicking on the icon plays the AVI file.

To capture an AVI file from a video card, LTCAP14N.DLL is required.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the name. See Name Dialog Box for Annotations.

 Change the fill mode. See Fill Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations.

 Set the video file. See Video File Dialog Box for Annotations.

 Perform a capture. See Capture Dialog Box for Annotations.

For low-level implementation details, refer to Video Annotation Object.


  Push Pin Tool

Note: This topic is for Document/Medical only.

The PushPin annotation object (ANNOBJECT_PUSHPIN) is a rectangle containing a scaled image that can be activated to show a hidden note. With the automated functions, in design mode, the user clicks and drags to specify the rectangle in the current window. Holding down the Shift key while drawing the pushpin will make the pushpin annotation square. A dialog box then lets the user specify the preferred options. In run mode, clicking on the icon display the hidden note.

A pushpin object has a primary bitmap and a secondary bitmap. The primary bitmap is shown with the note text. The secondary bitmap is shown by itself when the note is minimized.

In design mode, the PushPin object shows the text and displays the primary bitmap. In run mode, the object shows/hides the text when clicked. The pushpin object has the active mode property. When the mode is ANNACTIVE_ENABLED, the text is shown and the primary bitmap is painted in the top-left corner of the note.

When the mode is ANNACTIVE_DISABLED, the text is hidden and the secondary bitmap is displayed.

As soon as the Push pin object is created, the text will be highlighted. The text may be edited immediately. While in design mode double click on a push pin object to edit the text. To get out of edit mode:

Press escape. This cancels the changes.

Press Ctrl-Enter. This accepts the changes.

Click outside the edit box. This accepts the changes.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the name. See Name Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations.

 Edit the text. See Text Dialog Box for Annotations.

 Set the primary and secondary bitmaps. See Push pin Dialog Box for Annotations.

For low-level implementation details, refer to Push pin Annotation Object.


  Protractor Tool

Note: This topic is for Document/Medical only.

The protractor annotation object (ANNOBJECT_PROTRACTOR) consists of two simple lines joined at a vertex to create an angle. With the automated functions, the first line of the protractor is started on a mouse-down event and completed on a second mouse-down event. Holding down the Shift key while drawing either of the two lines will draw the line at an angle that is a multiple of 45 degrees.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the name. See Name Dialog Box for Annotations.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the fill mode. See Fill Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

 Change the measurement units, precision and gauge length. Set show flags See Ruler Dialog Box for Annotations

 Set the protractor options. See Protractor Dialog Box for Annotations

For low-level implementation details, refer to Protractor Annotation Object.


  Crossproduct Tool

Note: This topic is for Document/Medical only.

The cross product annotation object (ANNOBJECT_CROSSPRODUCT) consists of two simple lines intersecting at right angles. With the automated functions, the cross product is started on a mouse-down event and completed on a mouse-up event. Holding down the Shift key while drawing the cross product will make the cross product annotation square.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the name. See Name Dialog Box for Annotations.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the fill mode. See Fill Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

 Change the measurement units, precision and gauge length. Set show flags See Ruler Dialog Box for Annotations

For low-level implementation details, refer to Crossproduct Annotation Object.


  Freehand Hot Spot Tool

Note: This topic is for Document/Medical only.

The freehand hot spot annotation object (ANNOBJECT_FREEHANDHOTSPOT) is an array of points that create a sequence of joined lines. With the automated functions, in design mode, each line segment is formed with a mouse move event when the left button is down, and the object is completed on a mouse up event. In run mode, the object is transparent, but the mouse pointer changes to a hand when it is over the object. Clicking on the button sends a WM_LTANNEVENT message that indicates an activation event.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Add or delete nodes. Add a node by clicking on the spot where you wish to add a node, then select Add Node. To delete a node, click on the node you wish to delete and select Delete Node.

 Change the name. See Name Dialog Box for Annotations.

 Change the line width and style properties. See Line Dialog Box for Annotations.

 Change the fill mode. See Fill Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations.

 Change the ROP2 code. See ROP2 Dialog Box for Annotations

 Set options for displaying nodes. See NodesDialog Box for Annotations.

For low-level implementation details, refer to Freehand Hot Spot Annotation Object.


  Point Tool

Note: This topic is for Document/Medical only.

The point annotation object (ANNOBJECT_POINT) is a single point. With the automated functions, in design mode, each point is formed with a mouse click event.

In design mode, click on the object with the right mouse button to do the following:

 Undo the last user action.

 Cut or copy the object to the clipboard.

 Delete the object.

 Select all objects.

 Lock and unlock annotation objects. See Password Dialog Box for Annotations

 Set and manage hyperlink properties for an object or group of objects.  Note: The actual management of a hyperlink must be done through low-level implementation.  Only the Menu Item "Hyperlink" and an associated event are provided through the automation object.  For more information, refer to Implementing Annotation Hyperlinks.

 Bring the object to the front or send it to the back.

 Change the name. See Name Dialog Box for Annotations.

 Change the fill mode. See Fill Dialog Box for Annotations.

 Change the foreground and background colors. See Color Dialog Box for Annotations.

 Change the font selection and font characteristics. See Font Dialog Box for Annotations.

 Set the bitmap. See Point File Dialog Box for Annotations.

For low-level implementation details, refer to Point Annotation Object.


  Rubber Stamp Tool

Note: This topic is for Document/Medical only.

The rubber stamp annotation object (ANNOBJECT_STAMP_XXX) is a stamp object that has a metafile. For more information about the stamp tool, refer to Stamp Tool.

For each Rubber Stamp, there is a corresponding tool that can be set using AnnTool property. The Rubber Stamp tools are ANNTOOL_STAMP_XXX.


Line Dialog Box for Annotations

Note: This topic is for Document/Medical  only.

The following dialog box appears in automation mode when you change the line properties of an annotation object. The line width is based on the associated bitmap's physical resolution (DPI), so that it matches the scale of the original scanned image. Setting the width to a small number will not make the line disappear. On any output device, lines will always be at least one pixel wide. To see the possible line styles, refer to Illustration of Line Styles for Annotations.


Fill Dialog Box for Annotations

Note: This topic is for Document/Medical  only.

The following dialog box appears in automation mode when you change the fill properties of an annotation object. To see the possible modes and patterns, refer to Illustration of Fill Options for Annotations. For possible polygon fill modes, refer to Illustration of the Polygon Fill Mode for Annotations.


Color Dialog Box for Annotations

Note: This topic is for Document/Medical  only.

The following dialog box appears in automation mode when you change the foreground or background color property of an annotation object. It is implemented using the Windows common dialog box. To see how the foreground and background colors affect the appearance of an object, refer to Illustration of Fill Options for Annotations.


Font Dialog Box for Annotations

Note: This topic is for Document/Medical  only.

The following dialog box appears in automation mode when you change the font properties of an annotation object. It is implemented using the Windows common dialog box. The font size is based on the associated bitmap's physical resolution (DPI), so that it matches the scale of the original scanned image.


Text Dialog Box for Annotations

Note: This topic is for Document/Medical  only.

The following dialog box appears in automation mode when you change the text property of an annotation object. Word wrap is implemented in the dialog box and in the rectangle that defines the annotation object.


Stamp Bitmap Dialog Box for Annotations

Note: This topic is for Document/Medical  only.

The following dialog box appears in automation mode when you update the bitmap property of a stamp annotation object. It is implemented using the Windows common dialog box.


Audio File Dialog Box for Annotations

Note: This topic is for Document/Medical  only.

The following dialog box appears in automation mode when you specify the WAV file for an audio clip annotation object. It is implemented using the Windows common dialog box.


Password Dialog Box for Annotations

Note: This topic is for Document/Medical only.

The following dialog box appears in Automation mode when you lock or unlock an object or group of objects.


ROP2 Dialog Box for Annotations

Note: This topic is for Document/Medical only.

The following dialog box appears in Automation mode when you select the ROP2 option on the "Default properties" menu item.

Selecting "Copy" draws the object using the object's color.

Selecting "And" draws the object, performing an AND between the object's color and the background color. This creates a highlight effect. White objects become transparent.

Selecting "XOR" draws the object, performing an XOR between the object's color and the background color. This creates an inverted effect. Black objects become transparent.


Name Dialog Box for Annotations

Note: This topic is for Document/Medical only.

The following dialog box appears in automation mode when you change the name properties of an annotation object.


Video File Dialog Box for Annotations

Note: This topic is for Document/Medical only.

The following dialog box appears in automation mode when you select File on the Video properties menu of a video annotation object.


Capture Dialog Box for Annotations

Note: This topic is for Document/Medical only.

The following dialog box appears in automation mode when you select Capture on the Video properties menu of a video annotation object.


Push pin File Dialog Box for Annotations

Note: This topic is for Document/Medical only.

The following dialog box appears in automation mode when you select Bitmap on the Push pin properties menu of a push pin annotation object. This dialog is used to set the primary bitmap for the object.

The following dialog box appears in automation mode when you select Secondary Bitmap on the Push pin properties menu of a push pin annotation object. This dialog is used for setting the secondary bitmap for the object.


Protractor Dialog Box for Annotations

Note: This topic is for Document/Medical only.

The following dialog box appears in automation mode when you select Protractor on the Protractor properties menu of a protractor annotation object. This dialog is used to set the protractor options for the object.


Nodes Dialog Box for Annotations

Note: This topic is for Document/Medical only.

The following dialog box appears in automation mode when you select Nodes on the automation menu of an annotation object. This dialog is used to set the options displaying nodes for the object.


Point File Dialog Box for Annotations

Note: This topic is for Document/Medical only.

The following dialog box appears in automation mode when you select File on the Point properties menu of a point annotation object.


Ruler Dialog Box for Annotations

Note: This topic is for Document/Medical only.

The following dialog box appears in Automation mode when you select the Ruler option on the "Default properties" menu item.


Illustration of Line Styles for Annotations

Note: This topic is for Document/Medical  only.

The following rectangle annotation objects illustrate the available line styles. Note that  Windows displays all lines greater than 1 pixel as solid.

Back row:	Solid	Dash	Dot
Front row:	Dash-dot	Dash-dot-dot	Null


Illustration of Fill Options for Annotations

Note: This topic is for Document/Medical  only.

The following rectangle annotation objects illustrate the available fill modes and patterns. The foreground and background colors help to illustrate the effects.

Back row:

Fill mode: Opaque Fill pattern: Solid Fore color: Black Back color: Yellow	Fill mode: Opaque Fill pattern: Cross Fore color: Black Back color: Yellow	Fill mode: Opaque Fill pattern: Backward diagonal Fore color: Black Back color: Yellow	Fill mode: Opaque Fill pattern: Vertical Fore color: Black Back color: Yellow
Front row:

Fill mode: Translucent Fill pattern: Forward diagonal Fore color: Black Back color: Green	Fill mode: Transparent Fill pattern: Diagonal cross Fore color: Black Back color: Green	Fill mode: Opaque Fill pattern: Horizontal Fore color: Red Back color: Green


Illustration of the Polygon Fill Mode for Annotations

Note: This topic is for Document/Medical  only.

The following polygon annotation objects illustrate the available polygon fill modes.

Winding	The area inside the resulting exterior lines is filled.

Alternate	The filled area includes the area between odd-numbered and even-numbered polygon sides on each scan line.


Controlling and Detecting Events

The following topics describe how to control and detect events:

Controlling Events

Detecting Events


Controlling Events

Use the following properties to control the generation of error and status events:

EnableFilePageLoadedEvent property

EnableMethodErrors property

EnableSaveBufferEvent property

EnableProgressEvent property


Detecting Events

The LEAD control recognizes the following events and provides the following properties to control those events:

Animate event

AutoRubberBand property

AutoScroll property

Change event

Click event

DblClick event

EnableFilePageLoadedEvent property

EnableProgressEvent property

EnableSaveBufferEvent property

EnableMouseWheel property

FilePage event

FilePageLoaded event

KeyDown event

KeyPress event

KeyUp event

LoadInfo event

MouseDown event

MouseMove event

MouseUp event

MouseWheel event

Paint event

ProgressStatus event

Resize event

RubberBand event

SaveBuffer event

Scroll event

For annotation events, refer to Implementing Annotations.


Getting LEADTOOLS Toolkit Information

Use the following to get information about the LEADTOOLS toolkit:

AboutBox method

VersionDate property

VersionLevel property

VersionMajor property

VersionMinor property

VersionProduct property

VersionTime property


Miscellaneous Methods and Properties

UnlockSupport method

IsSupportLocked method

MouseIcon property

MousePointer property

Enabled property

hWnd property


Loading and Saving Large TIFF Files

TIFF files can contain large numbers of pages. This can make loading and saving these TIFF files very time consuming. To speed-up both the loading and saving of very large TIFF files, LEADTOOLS provides several properties.

The InfoIFD property contains an offset to the current page of a TIFF file. The page starting at this offset is considered page one, the next page is considered page 2, and so forth. The value of the InfoIFD property can be used for the LoadIFD and SaveIFD properties.

When loading a page from a TIFF file, setting the LoadIFD property tells the control to treat the page beginning at the specified offset as page 1. Therefore, the control does not have to go through all pages from the beginning of the file prior to loading the desired page.

Similarly, when saving a page to a TIFF file, setting the SaveIFD property tells the control to treat the page beginning at the specified offset as page 1. Pages after this offset can be replaced, appended or deleted more quickly, since the control does not have to go through all pages from the beginning of the file.


Container Annotation Object

Note:	This topic is for Document/Medical only.

The container annotation object (ANNOBJECT_CONTAINER) is a rectangle that is normally transparent, with a NULL line style. With the automated functions, its only purpose is to group other objects, including other container objects.

With low-level functions, you can insert and remove objects from a container, and you must specify the coordinates of an object relative to the container that it is in. The outermost (root) container establishes the frame of reference for all other objects, as explained in Low-Level Coordinate System for Annotations.

With low-level functions, you must specify the defining rectangle. Other applicable properties for the container have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to NULL. It can be changed using the AnnSetLineStyle method.

Fill pattern	Defaults to solid. It can be changed using the AnnSetFillPattern method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Text Annotation Object

Note:	This topic is for Document/Medical only.

The text annotation object (ANNOBJECT_TEXT) is a rectangle containing a character string with font properties. The text will wrap on word breaks within the object's specified rectangle. With the automated functions, the user clicks and drags to specify the rectangle in the current window. A dialog box then lets the user enter the text.

You cannot flip or reverse a text object. If you flip or reverse a container that includes a text object, the text will move to the new position, but will retain its orientation.

With low-level functions, you must specify the rectangle that contains the text. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikethrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Fill mode	Defaults to transparent. It can be changed to opaque using the AnnSetFillMode method.

Text	Defaults to an empty string. It can be changed using the AnnSetText method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Note Annotation Object

Note:	This topic is for Document/Medical only.

The note annotation object (ANNOBJECT_NOTE) is a rectangle with a shadow border and color background (yellow by default). It contains a character string with font properties. The text will wrap on word breaks within the object's specified rectangle. With the automated functions, the user clicks and drags to specify the rectangle in the current window. A dialog box then lets the user enter the text.

You cannot flip, reverse, or rotate a note. If you flip, reverse, or rotate a container that includes a note, the note will move to the new position, but will retain its orientation.

With low-level functions, you must specify the defining rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikeThrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to yellow - RGB(255, 555, 0). It can be changed using the AnnSetBackColor method.

Text	Defaults to an empty string. It can be changed using the AnnSetText method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Line Annotation Object

Note:	This topic is for Document/Medical only.

The line annotation object (ANNOBJECT_LINE) is a simple line. With the automated functions, the line is started on a mouse-down event and completed on a mouse-up event.

With low-level functions, you must provide the points that define the line. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Polyline Annotation Object

Note:	This topic is for Document/Medical only.

The polyline annotation object (ANNOBJECT_POLYLINE) is an array of points that create a sequence of joined lines. With the automated functions, each line segment is formed with a mouse click, and the object is completed on a double click.

The points can be changed using the AnnGetPointX method, AnnGetPointY method and AnnSetPoints method.

With low-level functions, you must provide the points that define the shape of the object. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Freehand Line Annotation Object

Note:	This topic is for Document/Medical only.

The freehand annotation object (ANNOBJECT_FREEHAND) is an array of points that create a sequence of joined lines. With the automated functions, each line segment is formed with a mouse move event when the left button is down, and the object is completed on a mouse up event.

The points can be changed using the AnnGetPointX method, AnnGetPointY method and AnnSetPoints method.

With low-level functions, you must provide the points that define the shape of the object. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Rectangle Annotation Object

Note:	This topic is for Document/Medical only.

The rectangle annotation object (ANNOBJECT_RECT) is a simple rectangle. With the automated functions, the user clicks and drags to specify the rectangle in the current window.

With low-level functions, you must define the size and position of the rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

Fill pattern	Defaults to solid. It can be changed using the AnnSetFillPattern method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Ellipse Annotation Object

Note:	This topic is for Document/Medical only.

The ellipse annotation object (ANNOBJECT_ELLIPSE) is a simple ellipse. With the automated functions, the user clicks and drags to specify the ellipse in the current window.

With low-level functions, you must specify the defining rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

Fill pattern	Defaults to solid. It can be changed using the AnnSetFillPattern method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Polygon Annotation Object

Note:	This topic is for Document/Medical only.

The polygon annotation object (ANNOBJECT_POLYGON) is an array of points that define the vertices of a polygon. With the automated functions, each line segment is formed with a mouse click, and the object is completed on a double click, which closes the polygon with a line from the last point to the first point.

The points can be changed using the AnnGetPointX method, AnnGetPointY method and AnnSetPoints method.

With low-level functions, you must provide the points that define the shape of the object. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

Fill pattern	Defaults to solid. It can be changed using the AnnSetFillPattern method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Polygon fill mode	Defaults to winding. It can be changed using the AnnSetPolyFillMode method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Pointer Annotation Object

Note:	This topic is for Document/Medical only.

The pointer annotation object (ANNOBJECT_POINTER) is defined by two points, with an arrow at the first point. With the automated functions, the user clicks and drags to specify the points in the current window.

With low-level functions, you must provide the points that define the points of the object. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Button Annotation Object

Note:	This topic is for Document/Medical only.

The button annotation object (ANNOBJECT_BUTTON) is an image of a standard Windows button that can be activated. With the automated functions, the user clicks and drags to specify the rectangle in the current window. A dialog box then lets the user enter the text for the button. In run mode, clicking on the button triggers an AnnClicked event.

You cannot flip, reverse, or rotate a button. If you flip, reverse, or rotate a container that includes a button, the button will move to the new position, but will retain its orientation.

With low-level functions, you must specify the defining rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Text	Defaults to an empty string. It can be changed using the AnnSetText method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Stamp Annotation Object

Note:	This topic is for Document/Medical only.

The stamp annotation object (ANNOBJECT_STAMP) can be a bitmap image or a text string in a rectangular frame. With the automated functions, the user clicks and drags to specify a rectangle. Then, if the user specifies a text string, the text is centered in the rectangle. If the user specifies a bitmap, the bitmap is scaled to fit the rectangle.

On a device that displays 256 colors or less, you should use a fixed palette when displaying bitmaps. Otherwise, a palette shift will occur on stamp objects containing bitmaps.

You cannot flip or reverse a stamp object. If you flip or reverse a container that includes a stamp, the object will move to the new position, but will retain its orientation.

With low-level functions, you must specify the defining rectangle. Other applicable properties have the following defaults, which you can change:

Bitmap	Defaults to Empty. It can be changed using the AnnSetBitmap method.

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikeThrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Text	Defaults to an empty string. It can be changed using the AnnSetText method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

Fill pattern	Defaults to solid. It can be changed using the AnnSetFillPattern method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Highlight Annotation Object

Note:	This topic is for Document/Medical only.

The highlight annotation object (ANNOBJECT_HILITE) is a rectangle with default properties that are appropriate for highlighting an area. With the automated functions, the user clicks and drags to specify the rectangle in the current window.

With low-level functions, you must specify the defining rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Background color	Defaults to Yellow - RGB(255, 255, 0)

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Redaction Annotation Object

Note:	This topic is for Document/Medical only.

The redaction annotation object (ANNOBJECT_REDACT) is a rectangle with default properties that are appropriate for blacking out an area. With the automated functions, the user clicks and drags to specify the rectangle in the current window.

With low-level functions, you must specify the defining rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Background color	Defaults to Black

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Audio Clip Annotation Object

Note:	This topic is for Document/Medical only.

The audio clip annotation object (ANNOBJECT_AUDIO) is a rectangle containing a scaled image that can be activated to play a WAV file. With the automated functions, in design mode, the user clicks and drags to specify the rectangle in the current window. A dialog box then lets the user specify the WAV file. In run mode, clicking on the icon plays the WAV file.

When you save this type of annotation, the WAV file is not saved. Only its path, specified in the text property, is saved.

You cannot flip, reverse, or rotate an audio clip. If you flip, reverse, or rotate a container that includes an audio clip, the object will move to the new position, but will retain its orientation.

With low-level functions, you must specify the defining rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Text	Defaults to an empty string. It can be changed to the path of the WAV file using the AnnSetText method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Hot Spot Annotation Object

Note:	This topic is for Document/Medical only.

The hot spot annotation object (ANNOBJECT_HOTSPOT) is a rectangle that can be activated for an application-defined purpose. With the automated functions, in design mode, the rectangle contains a scaled image. The user clicks and drags to specify the rectangle in the current window. In run mode, the object is transparent, but the mouse pointer changes to a hand when it is over the object. Clicking on the button triggers an AnnClicked event.

You cannot flip, reverse, or rotate a hot spot. If you flip, reverse, or rotate a container that includes a hot spot, the object will move to the new position, but will retain its orientation.

With low-level functions, you must specify the defining rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Annotation Automation Object

Note:	This topic is for Document/Medical only.

The annotation automation object (ANNOBJECT_AUTOMATION) is an object that lets you maintain default properties when using the automated annotation functions. This object has no position or dimensions. It is never placed in a container, but is associated with a root container accessed through the AnnContainer property.

Any properties that you set in the automation object become the default values for any new objects that are inserted into the associated container. In addition to the properties of other object types, the automation object also has properties, such as the default toolbar selection, that control the automated user interface.

This object has an automation tool property that you can use without implementing the toolbar. For example, if you want to supply your own toolbar or menu options, you can use the automation object alone to keep track of the tool selection.

Applicable properties have the following defaults, which you can change:

Automation tool	Defaults to the selection pointer. It can be changed using AnnTool property.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikeThrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method. The default does not affect highlight, redaction, or note objects.

Fill pattern	Defaults to solid. It can be changed using the AnnSetFillPattern method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Polygon fill mode	Defaults to winding. It can be changed using the AnnSetPolyFillMode method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

Menus enabled	Defaults to TRUE. It can be changed using the AnnAutoMenuEnable property.

Automation text strings	Default to hard-coded strings for menus and dialog boxes. Strings can be changed using the AnnSetAutoText method.

Related topics:

 Implementing Annotations

 Types of Annotations

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Ruler Annotation Object

Note:	This topic is for Document/Medical only.

The ruler annotation object (ANNOBJECT_RULER) is a simple line with gauges on both ends for measuring distance. With the automated functions, the ruler is started on a mouse-down event and completed on a mouse-up event.

With low-level functions, you must provide the points that define the ruler. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikethrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

Gauge length	Defaults to 30. It can be changed using the AnnSetGaugeLength method.

Unit	Defaults to ANNUNIT_MILIMETERS. It can be changed using AnnSetUnit method.

Unit abbreviation	Defaults to "mm". It can be changed using the AnnSetUnit method.

Precision	Defaults to 2. It can be changed using the AnnSetUnit method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container.

User mode	Defaults to design mode or the mode inherited from the container.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Video Annotation Object

Note:	This topic is for Document/Medical only.

The video annotation object (ANNOBJECT_VIDEO) is a rectangle containing a scaled image that can be activated to play an AVI file or capture a multimedia file. With the automated functions, in design mode, the user clicks and drags to specify the rectangle in the current window. A dialog box then lets the user specify the preferred options. In run mode, clicking on the icon plays the AVI file.

To capture an AVI file from a video card, LTCAP14N.DLL is required.

With low-level functions, you must define the size and position of the rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Name	Defaults to show the name, with the name as the empty string. It can be changed using the AnnSetName method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikethrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

File	Defaults to the empty string. This can be changed using the AnnSetText method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


PushPin Annotation Object

Note:	This topic is for Document/Medical only.

The PushPin annotation object (ANNOBJECT_PUSHPIN) is a rectangle containing a scaled image that can be activated to show a hidden note. With the automated functions, in design mode, the user clicks and drags to specify the rectangle in the current window. A dialog box then lets the user specify the preferred options. In run mode, clicking on the icon display the hidden note.

A pushpin object has a primary bitmap, (manipulated using the AnnSetBitmap method/AnnGetBitmap method) when the text is shown, and a secondary bitmap, changed using AnnSetSecondaryBitmap method. The primary bitmap is shown with the note text. The secondary bitmap is shown by itself when the note is minimized.

In design mode, the PushPin object shows the text and displays the primary bitmap. In run mode, the object shows/hides the text when clicked. The pushpin object has the active mode property. When the mode is ANNACTIVE_ENABLED, the text is shown and the primary bitmap is painted in the top-left corner of the note.

When the mode is ANNACTIVE_DISABLED, the text is hidden and the secondary bitmap is displayed.

With low-level functions, you must define the size and position of the rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Name	Defaults to show the name, with the name as the empty string. It can be changed using the AnnSetName method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikethrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Bitmap	Defaults to NULL. It can be changed using the AnnSetBitmap method.

Text	Defaults to "AaBbYyZz". It can be changed using the AnnSetText method.

SecondaryBitmap	Defaults to a Push pin bitmap. It can be changed using the AnnSetSecondaryBitmap method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Protractor Annotation Object

Note:	This topic is for Document/Medical only.

The protractor annotation object (ANNOBJECT_PROTRACTOR) consists of two simple lines joined at a vertex to create an angle. With the automated functions, the first line of the protractor is started on a mouse-down event and completed on a second mouse-down event. The second line is completed on a third mouse-down event.

With low-level functions, you must define the size and position of the rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Name	Defaults to show the name, with the name as the empty string. It can be changed using the AnnSetName method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

ROP2 	Defaults to Copy. See ROP2 Dialog Box for Annotations

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikethrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Ruler	Defaults to not showing the length or the gauge. It can be changed using the AnnSetShowFlags method.

Protractor	Defaults to the acute angle, measured in degrees, to a precision of two places right of the decimal, and an arc radius of 30. These can be changed using the AnnSetProtractorOptions method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

To get the angle of the Protractor object in the object's unit of measurement, use AnnGetAngle method.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Crossproduct Annotation Object

Note:	This topic is for Document/Medical only.

The cross-product annotation object (ANNOBJECT_CROSSPRODUCT) consists of two rulers intersecting at right angles. With the automated functions, the cross product is started on a mouse-down event and completed on a mouse-up event.

With low-level functions, the pointsmust be defined by calling the AnnSetPoints method. The points are ordered as follows:

Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Name	Defaults to show the name, with the name as the empty string. It can be changed using the AnnSetName method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

ROP2 	Defaults to Copy. See ROP2 Dialog Box for Annotations

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikethrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Ruler	Defaults to not showing the length or the gauge. It can be changed using the AnnSetShowFlags method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Freehand Hot Spot Annotation Object

Note:	This topic is for Document/Medical only.

The freehand hot spot annotation object (ANNOBJECT_FREEHANDHOTSPOT) is an array of points that create a sequence of joined lines. With the automated functions, in design mode, each line segment is formed with a mouse move event when the left button is down, and the object is completed on a mouse up event. In run mode, the object is transparent, but the mouse pointer changes to a hand when it is over the object. Clicking on the button triggers an AnnClicked event.

You cannot flip, reverse, or rotate a hot spot. If you flip, reverse, or rotate a container that includes a hot spot, the object will move to the new position, but will retain its orientation.

The points can be changed using the AnnGetPointX method, AnnGetPointY method and AnnSetPoints method.

With low-level functions, you must define the size and position of the rectangle. Other applicable properties have the following defaults, which you can change:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Name	Defaults to show the name, with the name as the empty string. It can be changed using the AnnSetName method.

Line width	Defaults to 1. It can be changed using the AnnSetLineWidth method. (Values equate to a minimum of 1 pixel when displayed.)

Line style	Defaults to solid. It can be changed using the AnnSetLineStyle method.

ROP2 	Defaults to Copy. See ROP2 Dialog Box for Annotations

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikethrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Nodes	Defaults to displaying all nodes. It can be changed using the AnnSetNodes method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Point Annotation Object

Note:	This topic is for Document/Medical only.

The hot spot annotation object (ANNOBJECT_POINT) is single point. With the automated functions, in design mode, each point is formed with a mouse click event.

With low-level functions, the point must be defined by calling the AnnSetPoints method. Other applicable properties have the following defaults, which can be changed:

Visible	Defaults to FALSE. It can be changed using the AnnSetVisible method.

Selected	Defaults to FALSE. It can be changed using the AnnSetSelected method.

Name	Defaults to show the name, with the name as the empty string. It can be changed using the AnnSetName method.

Foreground color	Defaults to black. It can be changed using the AnnSetForeColor method.

Background color	Defaults to white. It can be changed using the AnnSetBackColor method.

Font size	Defaults to 10 point, translated with a scaling factor of 1. It can be changed using the AnnSetFontSize method.

Font underline	Defaults to FALSE. It can be changed using the AnnSetFontUnderline method.

Font strikethrough	Defaults to FALSE. It can be changed using the AnnSetFontStrikethrough method.

Font italic	Defaults to FALSE. It can be changed using the AnnSetFontItalic method.

Font bold	Defaults to FALSE. It can be changed using the AnnSetFontBold method.

Font name	Defaults to "Arial". It can be changed using the AnnSetFontName method.

Fill mode	Defaults to transparent. It can be changed using the AnnSetFillMode method.

Bitmap	Defaults to NULL. It can be changed using the AnnSetBitmap method.

Transparent	Defaults to transparent. It can be changed using the AnnSetTransparent method.

Transparent Color	Defaults to white. It can be changed using the AnnSetTransparentColor method.

Tag (identifier)	Defaults to 0. It can be changed using the AnnSetTag method.

Window handle	Defaults to NULL or the handle inherited from the container. It can be changed for all objects using the AnnSetWnd method.

User mode	Defaults to design mode or the mode inherited from the container. It can be changed for all objects using the AnnUserMode property.

Related topics:

 Implementing Annotations.

 Types of Annotations.

 Low-Level Coordinate System for Annotations.

 Annotation Objects - Automated Features


Rubber Stamp Annotation Object

Note:	This topic is for Document/Medical only.

The rubber stamp annotation object (ANNOBJECT_STAMP_XXX) is a stamp object that has a metafile. For information on creating a stamp annotation object, refer to Stamp Annotation Object.


Changing the Annotation Automation Background Colors

When working with automated annotations, the background color of most objects created by a particular automation object can be changed by calling the AnnSetBackColor method for that automation object. However, the Note, Push-pin, Redact and Hilite objects cannot be changed using this method and must be handled differently.

The automation object contains 4 background color values:

 one color for the Note and Push-pin objects

 one color for the Hilite object

 one color for the Redact object

 one color for all other objects

When the automation object creates an object, it uses the corresponding background color. For example, if the automation object creates a Redact object, it uses the color stored for Redact objects. If the background for an object type is changed using the automation, the corresponding background color value stored for that object type is updated. Consequently, the next time the automation object creates an object of that type, the updated background color is used.

To change the background colors stored in the automation object:

 right click with no objects selected. All the default properties for objects created by the automation object can then be changed.

OR

 call the AnnSetAutoBackColor method. This lets the user programmatically change the background color of objects created by the automation object.

To determine the current background colors stored within the automation object, use the AnnGetAutoBackColor method.


Low-Level Coordinate System for Annotations

Note:	This topic is for Document/Medical only.

The coordinates for defining and positioning LEADTOOLS annotations are stored in floating point values that are translated to device coordinates only when the annotations are displayed. Each annotation object is defined and positioned relative to its container. The root container sets the frame of reference.

At the time of display, the coordinates are first multiplied by the values of the X and Y scalar properties (scaling factors), and are then offset by the values of the X and Y offset properties. Thus, the scaling factors translate the internal values to the coordinate system of the display space, and the offsets position the scaled object in the display space.

The LEADTOOLS automated annotation functions use this system to match annotations to a displayed image as follows:

1.	The root container's coordinates are set as follows: 0, 0, bitmap width -1, bitmap height -1.

2.	The X and Y scaling factors of the root container are set using the source and destination rectangles of the LEADTOOLS painting function. For example, the X scaling factor would be calculated by dividing the width of the destination rectangle by the width of the source rectangle. For an explanation of the source and destination rectangles, refer to Concepts and Definitions.

3.	The X and Y offsets of the root container are set to the same values as the left and top fields of the painting function's destination rectangle.

4.	Each time the image is zoomed or scrolled, the scaling factors and offsets of the root container are updated, and annotation objects are redrawn in the window.

This system provides flexibility in storing and transporting annotations. You can adapt the annotations to any unit of measure, such as twips or millimeters. You can also set the root container's width and height to arbitrary measurements, such as 1000 by 1000, that you adjust when applying the container's annotations to a bitmap image.

Note: Scaling factors and offsets can be applied to objects other than the root container, but that is not necessary for matching the annotations to the displayed image. The scaling factors and offsets of a container apply to all objects within the container.

Scaling factors:

AnnSetScalarX method

AnnSetScalarY method

AnnGetScalarX method

AnnGetScalarY method

Offsets:

AnnGetOffsetX method

AnnGetOffsetY method

AnnSetOffsetX method

AnnSetOffsetY method

Related topics:

 Implementing Annotations

 Types of Annotations


Annotation Objects - Default Values

Note:	This topic is for Document/Medical only.

LEADTOOLS supports a number of annotation types. Each annotation type has certain properties associated with it. For a brief explanation of the annotation type or tool, and a list of associated defaults, refer to the following list:

 Container Annotation Object

 Annotation Automation Object

 Line Annotation Object

 Rectangle Annotation Object

 Ellipse Annotation Object

 Polyline Annotation Object

 Polygon Annotation Object

 Pointer Annotation Object

 Freehand Line Annotation Object

 Highlight Annotation Object

 Redaction Annotation Object

 Text Annotation Object

 Note Annotation Object

 Stamp Annotation Object

 Hot Spot Annotation Object

 Button Annotation Object

 Audio Clip Annotation Object

 Ruler Annotation Object

 Video Annotation Object

 PushPin Annotation Object

 Protractor Annotation Object

 Cross product Annotation Object

 Freehand Hot Spot Annotation Object

 Point Annotation Object

 Rubber Stamp Annotation Object


Annotation Objects - Automated Features

Note:	This topic is for Document/Medical only.

When working with automated annotations, you have the option of using automated pop-up menus when you right click in design mode. These menus allow you to set certain properties of the annotation object. The following topics describe the automated annotation features for particular objects and tools:

 User Interface for Container and Automation Objects

 Selection Pointer Tool

 Line Tool

 Rectangle Tool

 Ellipse Tool

 Polyline Tool

 Polygon Tool

 Pointer Tool

 Freehand Line Tool

 Highlight Tool

 Redaction Tool

 Text Tool

 Note Tool

 Stamp Tool

 Hot spot Tool

 Button Tool

 Audio Clip Tool

 Ruler Tool

 Video Tool

 PushPin Tool

 Protractor Tool

 Cross product Tool

 Freehand Hot Spot Tool

 Point Tool

 Rubber Stamp Tool


Working with MRC Bitmap

The LEADTOOLS MRC (Mixed Raster Content) Control enhances LEADTOOLS input/output functionality by adding support for color documents containing mixed image and text components.

The advantage of the MRC model is that optimal compression methods can be selected for the various image and text components of documents, resulting in both high compression factors and high detail retention. Image and text components may be mixed on the same page.

The MRC compression breaks an image into three kinds of layers: foreground, background, and mask layers, each of which is compressed separately. These layers can be uncompressed and combined to restore the original image.

A foreground layer contains color data for the text and line art, and may also contain photographic or continuous tone color data. The background layer generally contains low-resolution color image data, such as a background image, a wash or other pattern that would have text overlaid on it. The mask layer or the selector layer that controls the process of image regeneration contains binary image data that is high spatial resolution, such as text and line art. This layer is used for drawing the corresponding foreground layer where the selector value is 1 and drawing the corresponding background layer where the selector value is 0. (For example:  a high-resolution color font can be represented using significantly less space, since the color information is stored at a lower resolution.)

The segmentation can be performed automatically with the option to optimize it manually or it can be done only manually. The applicable segment types are text and image. The user can set up which compression will be applied for each area type.  The compression for 1-bit schemes can be Fax G3 1D, Fax G3 2D, Fax G4 or JBIG, the compression for images can be JPEG for T44 standard format, and can be JPEG, LEAD CMP, or LEAD CMW for LEAD proprietary T44 format. The user can also set up the quality parameters of some of these compressions.

Note:	The characteristics of individual images differ greatly and not every image compresses well as mixed raster content.

For more information refer to:

Loading Capabilities

Saving Capabilities

General Segmentation

Auto-Segmentation

Manual Segmentation

Auxiliary Elements


Loading Capabilities

To load the MRC bitmap call Load. This method loads a single page from a MRC file. When loading from a multi-page document, page number is specified as an input parameter. To get the total pages in the MRC file call GetPagesCount.


Saving Capabilities

The MRC file can be saved using LEAD Proprietary T44 Format or T.44 standard format. To save the bitmap in LEAD Proprietary T44 Format, use the Save method. To save the bitmap in Standard T44 Format call SaveT44.  Using LEADTOOLS T.44 it is easy to handle the segmentation process using either auto-segmentation or manual selection of stripes and segments with manual segmentation.


General Segmentation

Before starting the segmentation process, a valid image should be provided to the Control through the Bitmap property.

A stripe is a rectangle defined on the bitmap area encompassing the full bitmap width. With auto-segmentation, the stripes are non-overlapping and contiguous, covering the entire bitmap.

A segment is a rectangular area on the bitmap that is defined to be of either text or picture type. The type of the segment depends on the content of this area.

A stripe can contain any number of segments. With auto-segmentation, segments are completely inside of stripes. With manual segmentation, stripes and segments can intersect.


Auto-Segmentation

Calling the AutoSegment method will perform the auto-segmentation using the LEADTOOLS MRC engine. LEADTOOLS then segments the bitmap, classifying the segments as text or picture, and determines the stripes. The resulting segments information is sent through the AutoSegment event.  To specify the maximum height of the stripes, set the StripeMaxHeight property before calling AutoSegment. (The StripeMaxHeight property is only available with the auto-segmentation process.) To enumerate the segments, call EnumSegments.  This method provides the segment coordinates and their IDs. To modify a segment type or its coordinates, use the UpdateSegmentData method. This method will update only one segment’s data each time it is called. To delete a segment, call the DeleteSegment method.


Manual Segmentation

To use manual segmentation, call the SetNewStripe method first to add a new stripe position to the control. This method will return the new stripe index. This index is used in SetStripeSegment to add a new segment to that stripe. Using the SetStripeSegment method lets you customize segment coordinates and types.


Auxiliary Elements

To use an additional feature, such as JBIG compression for the mask layer, it must be enabled with the UnlockSupport method.  To test for the availability of a feature, use the IsSupportLocked method.  To control generating run-time exceptions with method error conditions, use the EnableMethodErrors property.


Layers in Files

Certain files may contain layers. Currently, only PSD files support layers, although not all PSD files contain layers. Layers are numbered starting with 0. Therefore, the first layer in the file is layer 0. The next layer in the file is layer 1, etc. To load a layer from a file, call the LoadLayer method. Once the layer is loaded, the LayerLeft(0) and LayerTop(0) properties are updated with positioning information on the loaded layer.

The number of layers present in a file can be determined by calling the GetFileInfo method for a particular file. This method updates the InfoLayers property with the number of layers present in the file.

Each layer may have certain properties associated with it. These can be set or retrieved using the following properties:

LayerBlendModeKey property

LayerClipping property

LayerMaskBitmap property

LayerOpacity property

Bitmaps may also be saved to a file as layers by setting the SaveLayers property to TRUE. If the SaveLayers property is set to TRUE, then the next time a PSD file is saved, all bitmaps are saved as layers. Prior to saving a PSD file, the LayerLeft(x) and LayerTop(x) properties can be set to contain the positioning information for each layer. When the PSD file is saved, this positioning information is used to save the layers.


Super Compressed Bitmaps

(Document/Medical only) Super compressed bitmaps are kept compressed in memory. Only 24-bit or 1-bit bitmaps can be kept super compressed. The memory requirements for super compressed bitmaps are greatly reduced compared to uncompressed bitmaps or RLE-compressed bitmaps.

The data access for super compressed bitmaps is usually slower, compared to uncompressed bitmaps. The compression used for 24-bit bitmaps is lossy, which means multiple changes to the bitmap can produce some visual loss.

The data access is usually slower for super compressed bitmaps, but there are situations in which the data access is faster than for uncompressed bitmaps. When dealing with very large bitmaps, the O/S might swap to disk the bitmap data. In this case, the access for uncompressed bitmaps can be a lot slower than for super compressed bitmaps.

Any application that deals with large bitmaps of tens or hundreds of MB should consider using super compressed bitmaps.

The BitmapCompression property can be read to determine the current bitmap's current compression. Setting this property will change the compression of the bitmap to super compress 1-bit or 24-bit bitmaps, as well as, uncompress bitmaps and compress 1-bit bitmaps using RLE compression.

The size of the bitmap, in bytes, can be determined by reading the BitmapSize property.


Using ICC Profile Methods

The ICC Profile format is defined by the International Color Consortium (ICC). For background on the origination and purpose of this format, refer to www.color.org.

Loading an ICC Profile

To load an ICC profile from an image file, call the LoadICCProfile method This method fills the pData parameter with a pointer to one block of memory that contains the entire ICC profile.