Partager via


Displaying Information

One of the principles of good design is to make relevant information visible. You can use the following controls to display information to your users:

  • Images
  • Labels
  • Text Boxes
  • Edit Boxes
  • Shapes

Using Images

The Image control makes it possible for you to add pictures (.bmp and other graphics files) to your form. An Image control has the full range of properties, events, and methods that other controls have, so an Image control can be changed dynamically at run time, Users can interact with images by clicking, double-clicking, and so on. For details on valid graphic file types, see Graphics Support in Visual FoxPro.

The following table lists some of the key properties of an Image control.

Property Description
Picture The picture (.bmp file) to display.
BorderStyle Whether there is a visible border for the image.
Stretch If Stretch is set to 0 – Clip, portions of the picture that extend beyond the dimensions of the Image control are not displayed. If Stretch is set to 1 - Isometric, the Image control preserves the original dimensions of the picture and displays as much of the picture as the dimensions of the Image control will allow. If Stretch is set to 2 - Stretch, the picture is adjusted to exactly match the height and width of the Image control.

Using Labels

Labels differ from text boxes in that they:

  • Cannot have a data source.
  • Cannot be directly edited.
  • Cannot be tabbed to.

You can programmatically change the Caption and Visible properties of labels to tailor the label display to the situation at hand.

Common Label Properties

The following label properties are commonly set at design time.

Property Description
Caption The text displayed by the label.
AutoSize Whether the size of the label is adjusted to the length of the Caption.
BackStyle Whether the label is Opaque or Transparent.
WordWrap Whether the text displayed on the label can wrap to additional lines.

Using Text and Edit Boxes to Display Information

Set the ReadOnly property of text and edit boxes to display information that the user can view but not edit. If you only disable an edit box, the user won't be able to scroll through the text.

Using Shapes and Lines

Shapes and lines help you visually group elements of your form together. Research has shown that associating related items helps users to learn and understand an interface, which makes it easier for them to use your application.

The following Shape properties are commonly set at design time.

Property Description
Curvature A value between 0 (90 degree angles) and 99 (circle or oval).
FillStyle Whether the shape is transparent or has a specified background fill pattern.
SpecialEffect Whether the shape is plain or 3D. This only has an effect when the Curvature property is set to 0.

The following Line properties are commonly set at design time.

Property Description
BorderWidth How many pixels wide the line is.
LineSlant When the line is not horizontal or vertical, the direction of the slant. Valid values for this property are a slash ( / ) and a backslash ( \ ).

Using Form Graphics to Display Information

You can graphically display information on a form by using the following form methods.

Method Description
Circle Draws a circular figure or arc on a form.
Cls Clears graphics and text from a form.
Line Draws a line on a form.
Pset Sets a point on a form to a specific color.
Print Prints a character string on a form.

To see examples that demonstrate form graphics

  1. Run Solution.app in the Visual FoxPro \Samples\Solution directory.
  2. In the tree view, click Forms, and then click Form graphics.

See Also

Performing Specific Actions at Given Intervals | Enhancing Control Display | Using Controls | Caption | Controls and Objects