Programming C++Builder How to Use the Graphic Controls to Include Graphics in Your CBuilder or Delphi Applications?
Notice: Undefined variable: relatedArticlesCount in /home/wwwroot/ on line 149

How to use the graphic controls in C++Builder or Delphi?

How many graphic controls does CBuilder or Delphi supply? The following components make it easy to incorporate graphics into an application.

Use this component: To display:
TImage Graphics files
TShape Geometric shapes
TBevel 3-D lines and frames
TPaintBox Graphics drawn by your program at runtime
TAnimate AVI files (VCL only)

Notice that these include common paint routines (Repaint, Invalidate, and so on) that never need to receive focus.

How to use TImage component in CBuilder or Delphi?

The image component displays a graphical image, like a bitmap, icon, or metafile. The Picture property determines the graphic to be displayed. Use Center, AutoSize, Stretch, and Transparent to set display options. For more information, see Overview of graphics programming.

How to use TShap component in CBuilder or Delphi?

The shape component displays a geometric shape. It is a nonwindowed control (not widget-based in CLX) and therefore, cannot receive user input. The Shape property determines which shape the control assumes. To change the shape's color or add a pattern, use the Brush property, which holds a TBrush object. How the shape is painted depends on the Color and Style properties of TBrush.

How to use TBevel component in CBuilder?

The bevel component (TBevel) is a line that can appear raised or lowered. Some components, such as TPanel, have built-in properties to create beveled borders. When such properties are unavailable, use TBevel to create beveled outlines, boxes, or frames.

How to use TPaintBox component in CBuilder?

The paint box (TPaintBox) allows your application to draw on a form. Write an OnPaint event handler to render an image directly on the paint box's Canvas. Drawing outside the boundaries of the paint box is prevented. For more information, see Overview of graphics programming.

How to use TAnimate component in CBuilder or Dephi?

The animation component is a window that silently displays an Audio Video Interleaved (AVI) clip. An AVI clip is a series of bitmap frames, like a movie. Although AVI clips can have sound, animation controls work only with silent AVI clips. The files you use must be either uncompressed AVI files or AVI clips compressed using run-length encoding (RLE). Animation control cannot be used in cross-platform programming.

Following are some of the properties of an animation component:

  1. ResHandle is the Windows handle for the module that contains the AVI clip as a resource. Set ResHandle at runtime to the instance handle or module handle of the module that includes the animation resource. After setting ResHandle, set the ResID or ResName property to specify which resource in the indicated module is the AVI clip that should be displayed by the animation control.
  2. Set AutoSize to true to have the animation control adjust its size to the size of the frames in the AVI clip.
  3. StartFrame and StopFrame specify in which frames to start and stop the clip.
  4. Set CommonAVI to display one of the common Windows AVI clips provided in Shell32.DLL.
  5. Specify when to start and interrupt the animation by setting the Active property to true and false, respectively, and how many repetitions to play by setting the Repetitions property.
  6. The Timers property lets you display the frames using a timer. This is useful for synchronizing the animation sequence with other actions, such as playing a sound track.

Add comment

Security code

Programming - C++Builder