You are currently offline, waiting for your internet to reconnect

How to Customize Icons & Mouse Pointers in Forms Designer

This article was previously published under Q130407
A Visual FoxPro form contains several properties that make it easy tocustomize icons and mouse pointers displayed when a form is running.
NOTE: For backward compatibility, Visual FoxPro still supports FOXTOOLS.FLL(included in earlier FoxPro versions), the Visual FoxPro API library thatallows calls to 16-bit .DLL functions. However, in Visual FoxPro, theDECLARE command is the preferred method for calling .DLL functions.

For more information about using the DECLARE command, search the onlineHelp.

Mouse Pointers

There are two properties (DragIcon and MousePointer) that control mousepointers:
   Property         Value   ---------------------------------------------------------------------   DragIcon         <cFilename> - the name of any .CUR file created with                    a cursor editing program such as IMAGEDIT   MousePointer     0 - Default                    1 - Arrow                    2 - Cross                    3 - I-Beam                    4 - Icon                    5 - Size                    6 - Size NE SW                    7 - Size NS                    8 - Size NW SE                    9 - Size WE                   10 - Up Arrow                   11 - Hourglass                   12 - No Drop				
The DragIcon property controls the shape of the mouse pointer while anobject is being dragged to a new location. The MousePointer propertycontrols the shape of an object while the mouse is located over thatobject. These two properties may be set in tandem to achieve a desiredeffect.

For example, in an object that may be dragged, set the following propertiesthrough the Forms Designer Properties Sheet:

  1. Set the DragIcon property to:
  2. Place the following code in the Drag event to have all controls, except EditBoxes, display a No Drop pointer:
       ThisForm.setall("MousePointer",12)   ThisForm.setall("MousePointer", 0, "EditBox")							
  3. Place the following code in the DragDrop event to reset the mouse pointer for all controls back to the default:
This example allows the mouse pointer to remain at the default until a dragand drop operation is performed. Once the drag starts, the mouse pointerfor every control on the form is set to a "No Drop" icon. Then all the editboxes are set back to the default icon for edit boxes.

After the object is dropped, all controls on the form are set back to thedefault.


There are two properties (Icon and Picture) that control icons:
   Property      Value   ----------------------------------------------------------------------   Icon          The name of any valid .ICO file   Picture       The name of any valid .BMP or .ICO file, or the name of a                 general field which contains a .BMP or .ICO.				
The Icon property controls the icon displayed when a form is minimized. ThePicture property controls the icon displayed for the following controlscontained within a formset: check box, CommandButton, Form, Image,OptionButton, and Page.

The Form.Picture property acts as a wallpaper behind all the controlsplaced on a form. The Form.PageFrame.Page.Picture property creates awallpaper effect for a specific page within a pageframe.

Version 2.x Compatibility

The following compares the version 3.0 property functionality with thefunctionality available in FoxPro version 2.x commands.
Version 3.0 Property        Version 2.x Commands-------------------------------------------------------------------------DragIcon                    No drag and drop functionality was availableMousePointer                SET LIBRARY TO FOXTOOLS                            Use REGFN and CALLFN to access the Windows                            LoadCursor API callForm.Picture                DEFINE WINDOW ... FILL <bmp file name>Page.Picture                No page frame functionality was availableCheck box.Picture           Specify the picture as part of an @ GETCommandButton.Picture       command, or use the SHOW GET PROMPT commandOptionButton.Picture        to change the picture associated with an                            existing controlImage.Picture               Specify the picture as part of an @ SAY                            BITMAP command.Form.Icon                   MODIFY WINDOW ... ICON <icon file name> or                            specify the filename in the Window Style dialog                            from the Screen, Screen Layout menu.				

Advantages of Version 3.0 Functionality

Visual FoxPro offers the advantage of built-in mouse pointer functionality.You can easily change the shape of the mouse pointer without using WindowsAPI calls or loading the FOXTOOLS.FLL file with its memory overhead.

In version 2.x, the developer had to be familar with a number of differentcommands to control the image displayed. In Visual FoxPro, thesecapabilities are consistently under the control of the picture property.

In some cases in version 2.x, bitmaps were not refreshed if the image waschanged in Paintbrush during an application session. An undocumented sysfunction was used to reorganize memory and cause the bitmap to be rereadfrom disk. The image.picture property eliminates this problem in VisualFoxPro version 3.0.

Sample Files

Visual FoxPro version 3.0 offers a large number of sample cursor (.CUR),bitmap (.BMP), and icon (.ICO) files in \VFP\SAMPLES\GRAPHICS.

Article ID: 130407 - Last Review: 08/19/1999 11:01:00 - Revision: 1.1

  • Microsoft Visual FoxPro 3.0 Standard Edition
  • KB130407