Welcome
Contents of ctImage

 The ctImage object is a image list control.

The ctImage control is able to store up to 50 different bitmaps, icons, or meta-files. The control then passes these images to other controls that may require multiple images. The control is also able to store up to 50 different paths to an image. This becomes useful if you need to use images on a web page. If an image is stored via a path, it will be loaded asynchronously (in the background after the ctImage control has been instantiated). This component is invisible at run-time.

Features

•	Stores up to 50 image files (bitmaps, icons, or meta-files) of any size.

•	Stores up to 50 paths to image files.

•	Path information can be part of a web address.

•	Load path images asynchronously.

File Names

Control File 	: CTIMAGE.OCX

License File 	: ctImage.lic

Class Name

CctImageCtrl

See Also :

Using the Control in a Web Page

Error Messages

Events

Methods

Properties

ctImage © 2001 DBI Technologies Inc.


Events

ctImage Event	Occurs
CtrlError	Occurs when an error takes place within the control.
ImageLoaded	Occurs when an image described by an image path is loaded into the control.
LoadComplete	Occurs when all images described by the image paths have been loaded into the control.


Methods

ctImage Method	Return Type	Description
AddImage	integer	Add a new picture to the internal image list of the control.
LoadFileImages	integer	Load all file images based on the specified file path names.
RemoveImage	boolean	Delete a picture from the internal image list of the control.


Properties

ctImage Property	Data Type	Description
AutoLoadFiles	boolean	Specifies whether any image defined within a path will be automatically loaded when the ctImage control becomes instantiated.
ImageListCount	integer	Returns the number of images or paths to images currently defined in the control.
ImagePath1-50	string	Specifies the full path to an image file.
ListImage	Picture	Specifies an image or picture within the internal image list.
LoadFromFile	boolean	Specifies whether the images from the control will be loaded from the path names (asynchronously), or loaded normally from host form.
LoadState	integer	Returns current load state of the control.
ValidImage	boolean	Returns a value determining whether a picture in the internal image list is valid or not.


Error Messages

There are a variety of different errors that can be trapped when using this control. All error messages are sent directly to the CtrlError event and are sent as an integer value. These include…

2000 - Bad Picture : An attempt was made to load a file that was not a valid picture.

2001 - File Not Found : An attempt was made load an image with an invalid image name.

2002 - Bad Picture Index : An attempt was made to access an image that is outside the range of the present images.

2100 - Too Many Images : An attempt was made to add a new image past the 50 image limit.


Using the Control in a Web Page

When you attempt to use a traditional ActiveX control on a web page, the page will store many of the controls property values within the page. However, it does not usually store a controls picture information. In fact, when a web page is viewed, it usually loads the text first, and then goes back and loads any images assigned to it. By going back and loading the images after the text and format of the page have been read, the images are being loaded asynchronously (after everything else). In order for images to appear in an ActiveX control, the images must also be loaded after the controls have been instantiated.

In order to accomplish this, perform the following steps....

•	Set the ctImage control into a web page.

•	Load the path to a series of images (bitmaps, icons, or meta-files) into the control using the "Paths" property pages.

•	Set the LoadFromFile property to True and the AutoLoadFiles property to True. If you do not set the AutoLoadFiles property to True, you will have to use the LoadFileImages method somewhere in your web page script.

•	In the LoadComplete event, place code in your program to transfer the images within the ctImage control to another ActiveX control. For instance....

ctButton1.Picture = ctImage1.ListImage(1)

ctButton2.Picture = ctImage1.ListImage(2)


AutoLoadFiles
AutoLoadFiles Property

Description

Specifies whether any image defined within a path will be automatically loaded when the ctImage control becomes instantiated. If this property is not set to a value of True, images from paths will have to loaded using the LoadFileImages method. This property will have no effect unless the LoadFromFile property is set to a value of True.

Syntax

[form.]ctImage.AutoLoadFiles [ = { True | False } ]

Data Type

Boolean

Example

ctImage.AutoLoadFiles = TRUE


ImageListCount
ImageListCount Property

Description

Returns the number of images or paths to images currently defined in the control.

Syntax

[form.]ctImage.ImageListCount

Data Type

Integer

Example

nCount = ctImage.ImageListCount


ImagePath1-50
ImagePath1-50 Property

Description

Specifies the full path to an image file. These paths can be on a local drive, network drive, or internet address. Image files can consist of bitmaps, icons, and meta-files.

Syntax

[form.]ctImage.ImagePath1 [ = string% ]

Data Type

string

Example

ctImage.ImagePath1 = "http://www.dbi-tech.com/main.bmp"


ListImage
ListImage Property

Description

Specifies an image or picture within the internal image list. This is an actual picture or image, and not a path to that image.

It should be noted that this property cannot be used to add additional pictures to the image list. For example, if only five images have been assigned to the list with the AddImage method, this property cannot access any images except for those five.

Syntax

[form.]ctImage.ListImage( Index )  [ = Picture ]

Data Type

Picture

Parameters

•	1 - Index	: ( integer ) The index value of the list.

•	2 - Picture	: ( integer ) The icon size setting for the list.

Example

ctImage.ListImage(nIndex) = OLE_Object.Picture


LoadFromFile
LoadFromFile Property

Description

Specifies whether the images from the control will be loaded from the path names (asynchronously), or loaded normally from host form.

Syntax

[form.]ctImage.LoadFromFile [ = { True | False } ]

Data Type

Boolean

Example

ctImage.LoadFromFile = TRUE


LoadState
LoadState Property

Description

Returns current load state of the control. Load states occur when the control attempts to load images from the file path names. The different load states include...

•	0 - Uninitialized : The default initialization state.

•	1 - Loading : The object is currently loading its properties.

•	2 - Loaded : The object has been initialized.

•	3 - Interactive : The object is interactive, but not all of its data is available.

•	4 - Complete : The object has received all of its data.

Syntax

[form.]ctImage.LoadState

Data Type

Integer

Example

nState = ctImage.LoadState


ValidImage
ValidImage Property

Description

Returns a value determining whether a picture in the internal image list is valid or not. Valid pictures include bitmaps, icons, and meta-files.

Syntax

[form.]ctImage.ValidImage( index% )

Data Type

boolean

Parameters

•	1 - nIndex	: ( integer ) The index of the image to be accessed

Example

bValid = ctImage.ValidImage( 1 )


AddImage
AddImage Method

Description

Add a new picture to the internal image list of the control. A return value of 0 indicated that the picture was not added.

Syntax

[form.]ctImage.AddImage( pPict )

Return Type

integer : The index value of the new picture. 0 if not added.

Parameters

•	1 - pPict	: ( Picture ) A picture property from another control

Example

      ctImage.AddImage Image1.Picture


LoadFileImages
LoadFileImages Method

Description

Load all file images based on the specified file path names. This method will have no effect unless the LoadFromFile property is set to True. This method is not necessary if the AutoLoadFiles property is set to a value of True.

Syntax

[form.]ctImage.LoadFileImages

Return Type

integer : The number of files loaded. 0 if none were loaded.

Parameters

None

Example

ctImage.LoadFileImages


RemoveImage
RemoveImage Property

Description

Delete a picture from the internal image list of the control.

Syntax

[form.]ctImage.RemoveImage( nIndex )

Return Type

Boolean : Determines whether the operation was successful or not.

Parameters

•	1 - nIndex	: ( integer ) The index value of the picture to be removed

Example

ctImage.RemoveImage(nIndex)


CtrlError
CtrlError Event

Description

Occurs when an error takes place within the control.

Parameters

This event has two parameters sent to it. These include ...

•	1 - nError	( integer )	Error code used to identify the error

•	2 - nIndex	( integer )	Index value of where the error occurred

Note

See Error Messages for more details


ImageLoaded
ImageLoaded Event

Description

Occurs when an image described by an image path is loaded into the control.

Parameters

This event has two parameters sent to it. These include ...

•	1 - nIndex	( integer )	Index value of the image

•	2 - bStatus	( boolean )	Status of the load (successful or not)


LoadComplete
LoadComplete Event

Description

Occurs when all images described by the image paths have been loaded into the control..

Parameters

None