![]() ![]() |
![]() |
Using paintX paintX is actually pretty easy to use. Basically, you need to call PicDecoder.LoadPicture(FileName). The decoder does (almost) everything else, if it's installed. Installation To install paintX, you need to download paintX.zip and unpack it to the directory you'd like it to be in. WinZip is a good choice for a program to use to unpack it. After it's unpacked, paintX needs to be registered with windows. To do this, choose "Run..." from the start menu. Type 'c:\windows\system\regsvr32 c:\paintlib\paintX.dll', replacing the path names with the appropriate values for your system. To verify that it's installed, open paintX.xls with Excel97 and click on the bitmap. You should get a dialog asking for a directory. After you press 'go', all images in that directory should get displayed. Usage The following code displays an image from Visual Basic: Rem Create the Decoder Set PicDecoder = CreateObject("PaintX.PictureDecoder.1") Rem Get the Picture Set MyImage.Picture = PicDecoder.LoadPicture(Filename) DoEvents Rem Dispose the Decoder Set PicDecoder = Nothing Rem Redraw the form Repaint In this sample, MyImage is the image control that will display the picture. The pictures are always delivered in 256-color (8 bit) or true-color (32 bit) format. Pictures in other formats get promoted to the next higher format. For instance, 16-color pictures are delivered as 256-color pictures. As an exception, black-and-white tiff images are delivered as 2-color pictures. (This exception was coded because of the large number of fax viewers which need to display b/w tiffs.) You can also load a picture from a windows resource using LoadResPicture (ID). The standard error handling methods work with paintX. This means that from Visual Basic, you can use On Error GoTo to specify a routine that will be called when something goes wrong while decoding.
|
![]() |