Share via


How to: Specify Design-Time Appearance for Classes

In Visual FoxPro, objects and controls created from visual classes display a visual element at design time and run time. However, objects and controls based on non-visual classes, such as the Custom class and Timer control, display a visual element at design time but not at run time.

At design time, Visual FoxPro displays objects created from non-visual classes with a default graphic. However, you can change the default graphic so that you can distinguish one non-visual class from another at design time. However, objects created from non-visual classes do not display these graphics at run time.

You can also specify toolbar and container icons that appear for classes in the Visual FoxPro IDE. You can specify icons that appear in the Forms Control toolbar and Toolbox after you add classes to them. You can also specify container icons that appear in the Project Manager and Class Browser.

To specify a visual element for a non-visual class

  1. Open the class in the Class Designer.

    For more information about opening classes, see How to: Modify Classes.

  2. On the Visual FoxPro toolbar, click Properties Window.

  3. In the Properties window, specify an image file, such as a bitmap (.bmp) file, for the Picture property.

  4. Save the class.

You can specify a toolbar icon for a class. After you add the class to the Form Controls toolbar or the Toolbox, the icon for the class appears on the toolbar or in the Toolbox.

To specify a toolbar icon for a class

  1. Open the class in the Class Designer.

    For more information about opening classes, see How to: Modify Classes.

    When the class opens in the Class Designer, the Class menu appears.

  2. On the Class menu, choose Class Info.

  3. In the Toolbar icon box in the Class Info dialog box, type the name and path of the icon (.ico) or bitmap (.bmp) file.

    -OR-

    Click the ellipsis (...) button to browse for an .ico or .bmp file.

  4. Click OK and save the class.

Note

The bitmap (.bmp file) for a toolbar icon is 15 by 16 pixels. If the picture is larger or smaller, it is sized to 15 by 16 pixels and might not look the way you want it to.

You can specify a container icon for a class. The icon for the class appears in containers such as the Project Manager and Class Browser. In the Class Browser, the icon for the class appears next to the class in the class list and next to the type box when the class is selected. By default, the container icon and toolbar icon for the class are the same as those for the parent class.

To specify a container icon for a class

  1. Open the class in the Class Designer.

    For more information about opening classes, see How to: Modify Classes.

    When the class opens in the Class Designer, the Class menu appears.

  2. On the Class menu, choose Class Info.

  3. In the Container icon box of the Class Info dialog box, type the name and path of the icon (.ico) or bitmap (.bmp) file.

    -OR-

    Click the ellipsis (...) button to browse for an .ico or .bmp file.

  4. Click OK and save the class.

You can also specify the container icon in the Class Browser by right-clicking the class in the class list, choosing Container icon, selecting an .ico or .bmp file, and clicking OK.

Tip

If you click Cancel instead of OK, Visual FoxPro displays a message prompting whether you want to reset the icon to the default, which is the icon Visual FoxPro uses for its base classes. If you want the icon to match its base class, choose Yes.

The new icon replaces the previous icon in the class list. The icon that appears next to the class list refreshes when you select the class in the class list.

Note

If the previous icon for the container and toolbar are the same, then the new icon replaces both the container and toolbar icon. Otherwise, if the previous toolbar icon differed from the container icon, only the container icon changes.

See Also

Tasks

How to: Create Classes and Subclasses

Concepts

Classes in Visual FoxPro

Working with Classes in Visual FoxPro