Category : Windows 3.X Files
Archive   : GRAF20.ZIP
Filename : GRAPHIC.WRI

Output of file : GRAPHIC.WRI contained in archive : GRAF20.ZIP



A Color Graphic Custom Control
for Visual Basic 1.00

Version 2.0
January 1992

This program and associated documentation is copyrighted by
Stephen Cramp
13584 Kennedy Rd. N.,
Inglewood, Ont


Microsoft Visual Basic provides for the inclusion of third-party custom controls. These controls can be used to expand the capabilities of Visual Basic (VB) or add entirely new functionality. The custom controls are incorporated into the VB Toolbox at design time and used in the same way as the standard VB controls.

The Graphic Custom Control (Graphic) provides the capability of displaying Windows 3.0 and OS/2 bitmap picture files (BMP's) and PCX picture files in monochrome, 16-color, 256-color or 24-bit color . The properties and events associated with Graphic are detailed in the Properties section.

Loading the Control

The Graphic custom control is distributed in two different file formats. The file RGRAPHIC.VBX is the run-time version of the control. This is the file that would be distributed with an application. The file DGRAPHIC.VBX is the design-mode version of the control.

Installing the Graphic custom control files involves copying these two files to directories on the hard disk. The following commands will copy the files.


These commands are examples and should be altered to reflect the directories where your main Windows 3.0 files are ( the value shown as WIN30 ) and the location of VB.EXE ( the value shown as VB ). Although both the run-time and design mode versions of the control have the same filename, you can still determine which is which. Use the DOS command TYPE to list the GRAPHIC.VBX file to the display. Within the first screen of information will be seen the file header. It will show "RunTime" for the run-time version and "Design" for the design-mode version of the file.

Before Graphic can be used in a VB program, it must be loaded into the Toolbox. To load the Graphic custom control, perform the following steps.

1. Run VB development environment
2. Select 'Add File' (Ctlr-F12)
3. Use the file dialog box to open the VB directory and select the file GRAPHIC.VBX
4. The icon of three colored squares will appear on the Toolbox.

Using Graphic

The control acts similar to the standard 16-color Picture control. A control is placed on the form by selecting the icon and then dragging to select the size of the window. The control can be stretched to the size required and moved about the form in the same way as the standard controls.

To load a BMP file into the control, set the "Filename'' property to a valid BMP file specifier. Include the file path if necessary. The picture will display in the control. It will be clipped if it is larger than the defined size of the control on the form. When saving VB project and form files, the Filename property value is not saved. If a picture image is required when the form is loaded, the Filename property has to be set in the Form_Load subroutine.

Within an application you can load a picture by simply setting the property to a valid BMP filename (e.g. Graphic1.Filename = "C:\PICTURES\MYDOG.BMP" ).

Error codes are returned by Graphic when the Filename property is set, therefore it is necessary that error handling be performed to handle these errors (see sample code). The error codes are detailed further in this document.


Graphic provides properties for the loading of the bitmap file as well as for returning information about the picture.

[ctlname].Filename = "[drive:path\filename.BMP]"

Setting this property with a string value will pass a bitmap file specifier to the Graphic custom control. The control determines the file type and displays it within the allocated window space. The value of this property is not saved with the VB application. Therefore if a picture is to be displayed at runtime, the property must be explicitly set in the Form_Load procedure and the picture file (.BMP or .PCX) must be available on the system that is running the application. Setting this value to a null string ("") will clear the picture from the display area.

[variable] = [ctlname].PicWidth

This property is read-only. When read, it will return the width of the loaded picture in pixels.

[variable] = [ctlname].PicHeight

This property is read-only. When read, it will return the height of the loaded picture in pixels.

[variable] = [ctlname].PicColorBits

This property is read-only. When read, it will return the number of color bits in the loaded picture. The value is the BitCount in the BMP or PCX file header, not the actual color bits used in the picture. It will return a value of either 1, 4, 8 or 24. This relates to monchrome, 16-color, 256-color and 16.7million-color picture respectively.

[ctlname].ScrollBars = [0/1/2/3]

This property is read or write. Setting the value to 0 will disable the display and use of scrollbars. Setting the value to 1 will enable the display and use of horizontal scrollbars only. Setting the value to 2 will enable the display and use of vertical scrollbars only. Setting the value to 3 will enable the display and use of horizontal and vertical scrollbars. If either or both scrollbars are enabled, they will only be displayed if the picture exceeds the size of the display area.

Error Codes

30000 Unable to open file
30001 File open error
30002 Out of memory
30003 General memory error
30004 Error in file format
30005 Error reading file
30006 Error in palette


Visual Basic does not pass Palette messages to controls. Therefore if another application is running in foreground that uses a logical palette, the colors on the back picture will be wrong. Similarily, if two Graphic controls are placed on one form, only one can have the correct palette loaded. This is not a factor when using a video controller supporting 32,768 colors or more.

Revision History

Version 2.0: Adds support for the display of 24-bit images when using a suitable display controller. Adds events for supporting the mouse and other functions. Adds scrollbar support. Adds support for PCX image files.

Version 1.1: Fixes problem with monochrome and 16-color bitmap files. Also provides support for OS/2 v1.1 and v1.2 bitmap files.


C/Systems can be contacted via Compuserve at User ID 70471,137. Telephone support will be provided to registered users. Calls will be accepted between 7:30PM EST and 10:30PM EST at (416) 838-2896.

Order Form for Graphic Custom Control

Name: _______________________________

Company: _______________________________

Address: _______________________________

Phone: ________________( not required )

Where did you find out about Graphic? _______________________________

Comments: ________________________________________________

Shipping Information:

Disk Size: ____ 3 1/2" ____ 5 1/4"

Qty Item Price Total

____ Software Registration for Graphic CC and manual @ US$25.00 $_____
____ Software Registration for Graphic CC and manual @CAN$30.00 $_____
Add $1.00 each for 3 1/2" disks $_____
Shipping and Handling @(US / CDN)$3.00 $_____
Provincial Sales Tax @8% (Ont residents only) $_____
GST @7%(Cdn residents only) $_____
Total $_____
Remit in US or CDN Funds to:
Stephen Cramp Make payment in Cheque or Money Order
C/Systems only please. DO NOT send cash.
13584 Kennedy Rd. N., Please allow 3 to 4 weeks for delivery.
Inglewood, Ont,

I ______________________ (name) agree to that I may not redistribute the registered version of Graphic Custom Control (CC) in any way other than with my own application. I do not have the right to distribute the design-mode version of the CC in any way, shape or form. I am licensed for the use of the design-mode CC on one CPU only and cannot make copies except for backup purposes. I have the right to distribute the run-time version of the CC with my application on a royalty-free basis.

I agree with this statement __________________________ (signature)
not t€ŸwÖt¦r¸o#m8j
o2l‚j™gÂeàbz"`_[+Y5V €‚4„4†4ˆ4Š4Œ4Ž4™gÂFðРpŒ
¨ j†èl–Ž4’4›44Ÿ4¿4Ö4™gÂFpðРpŒ
¨ j†èl–ÖØ4Ú4Ü4Þ4à4â4ä4æ4ÂFpðРpŒ
¨ j†èl–æè4ê4ì4î4ð4ò4ô4ö4ÂFpðРpŒ
¨ j†èl–öø4ú4444T4ô4ö4ÂFpðРpŒ
¨ j†èl–Tc4n4…4•4¥4T4ô4ö4ÂFp ðРpŒ
¨ j†èl–¥¦4¨4ª4¬4¶4¸4ô4ö4ÂF<pðРpŒ
¨ j†èl–¸ù4¨4ª4¬4¶4¸4ô4ö4ÂF<pÐðРpŒ
¨ j†èl–ùû4¨4ª4¬4¶4¸4ô4ö4ÂF<pðРpŒ
¨ j†èl–û4¨4ª4¬4¶4¸4ô4ö4ÂF<pÐðРpŒ
¨ j†èl–!4¨4ª4¬4¶4¸4ô4ö4ÂF=ðРpŒ
¨ j†èl–!#484:4¬4¶4¸4ô4ö4ÂF<pðРpŒ
¨ j†èl–:F4H4ä4¬4¶4¸4ô4ö4ÂF<pÐðРpŒ
¨ j†èl–äæ44U4W4¶4¸4ô4ö4ÂF<pðРpŒ
¨ j†èl–W–44U4W4¶4¸4ô4ö4ÂF<pÐðРpŒ
¨ j†èl––˜44U4W4¶4¸4ô4ö4ÂF<pðРpŒ
¨ j†èl–˜+ 44U4W4¶4¸4ô4ö4ÂF<pÐðРpŒ
¨ j†èl–+ - 4Q 4x 4W4¶4¸4ô4ö4ÂF<pðРpŒ
¨ j†èl–x Î 4Q 4x 4W4¶4¸4ô4ö4ÂF<pøøðРpŒ
¨ j†èl–Î 
¨ j†èl–'
L 4N 4!

¨ j†èl–¦¨4N 4!

¨ j†èl–¨´4N 4!

¨ j†èl–´¶4.404b4d4¿
¨ j†èl–dž4 404b4d4¿
¨ j†èl– Á4 404b4d4¿
¨ j†èl–ÁÃ4&404b4d4¿
¨ j†èl–&(4&404b4d4¿
¨ j†èl–(J4&404b4d4¿
¨ j†èl–JL4°404b4d4¿
¨ j†èl–°±4³404b4d4¿
¨ j†èl–³Ø4³404b4d4¿
¨ j†èl–ØÚ48404b4d4¿
¨ j†èl–8:48404b4d4¿
¨ j†èl–:\48404b4d4¿
¨ j†èl–\^48404b4d4¿
¨ j†èl–^N4P404b4d4¿
¨ j†èl–PR4_4a44™4±4Ð4ï4ÂF<pðРpŒ
¨ j†èl–ï 4'4)4+45474Ð4ï4ÂF<pðРpŒ
¨ j†èl–7¹4»4½4+45474Ð4ï4ÂFpÐðРpŒ
¨ j†èl–½Ï4Ñ4½4+45474Ð4ï4ÂFpðРpŒ
¨ j†èl–ѯ4±444+45474Ð4ï4ÂFpp`úðРpŒ
¨ j†èl–4547444+45474Ð4ï4ÂFpÐðРpŒ
¨ j†èl–7@47444+45474Ð4ï4ÂFpðРpŒ
¨ j†èl–@B4
4 4+45474Ð4ï4ÂFpÐðРpŒ
¨ j†èl– 
¨ j†èl–¶Ù4ü4ÿ4)4+4r4t4°4ÂF<ðРpŒ
¨ j†èl–°ä44L4€4‚4™4›4À4ÂF<ðРpŒ
¨ j†èl–ÀÂ4à4â4€4‚4™4›4À4ÂF<ðРpŒ
¨ j†èl–â*4r4¡4×44;4S4À4ÂF<ðРpŒ
¨ j†èl–Sq4ª4Ú4 4. 4B 4D 4À4ÂF<ðРpŒ
¨ j†èl–D 3"45"4z"4|"4. 4B 4D 4À4ÂF<ðРpŒ
¨ j†èl–fà=Ð/°€: €(Ð;ÐÐØ6†èl–ú!€=û!ÿÿÿÿÿ4d4¿
¨ j†èl–&’ 1µ‹¤4¦4ÂFpìðРpŒ
¨ j†èl– Tms Rmn04b4d4¿
¨ j†èl–