Tags:BitmapCbuilderGraphicsHow to make a 'rubber banding' effect in C++Builder?

This example describes the details of implementing the 'Rubber banding' effect in an graphics application that tracks mouse movements as the user draws a graphic at runtime. The example code in this section is taken from a sample application located in the Examples\Doc\GraphEx directory. The application draws lines and shapes on a window's canvas in response to clicks and drags: pressing a mouse button starts...

Programming - C++Builder

Tags:CbuilderCopyCutGraphicsPasteHow to use the clipboard with graphics?

You can use the Windows clipboard to copy and paste graphics within your applications or to exchange graphics with other applications. The VCL's clipboard object makes it easy to handle different kinds of information, including graphics.

Before you can use the clipboard object in your application, you must add an include statement for Clipbrd.hpp to any .cpp file that needs to access clipboard data.
For cross-platform...

Programming - C++Builder

How to load and save graphics files?

Graphic images that exist only for the duration of one running of an application are of very limited value. Often, you either want to use the same picture every time, or you want to save a created picture for later use. The image component makes it easy to load pictures from a file and save them again.

The components you use to load, save, and replace graphic images support many graphic formats including bitmap files, metafiles, glyphs, and so on. They...

Programming - C++Builder

Tags:BitmapCbuilderDrawingGraphicsImage ControlImagesPictureScanlineHow to set the initial bitmap size?

When you place an image control, it is simply a container. However, you can set the image control's Picture property at design time to contain a static graphic. The control can also load its picture from a file at runtime, as described in .

To create a blank bitmap when the application starts, Attach a handler to the OnCreate event for the form that contains the image. Create a bitmap...

Programming - C++Builder

Tags:BitmapCanvasCbuilderImage ControlHow to draw on a graphic?

You don't need any components to manipulate your application't graphic objects. You can construct, draw on, save, and destroy graphic objects without ever drawing anything on screen. In fact, your applications rarely draw directly on a form. More often, an application operates on graphics and then uses an image control component to display the graphic on a form.

Once you move the application's drawing to the graphic in the image...

Programming - C++Builder

How to use the drawing tools?

Now that you can tell what tool to use, you must indicate how to draw the different shapes. The only methods that perform any drawing are the mouse-move and mouse-up handlers, and the only drawing code draws lines, no matter what tool is selected.

To use different drawing tools, your code needs to specify how to draw, based on the selected tool. You add this instruction to each tool's event handler.
This section describes: Drawing shapes. Sharing code among...

Programming - C++Builder

Tags:CbuilderGraphicsHow to handle multiple drawing objects in your application?

In a real application, the graphics always comes complex, you have to handle more than one drawing objects to achieve your purpose. This article tells you how to do it.

Various drawing methods (rectangle, shape, line, and so on) are typically available on the toolbar and button panel. Applications can respond to clicks on speed buttons to set the desired drawing objects. This section describes how to: Keep...

Programming - C++Builder

How to use canvas to draw graphic objects such as lines, polylines, shapes, rectangles, and polygons?

This section shows how to use some common methods to draw graphic objects. It covers: Drawing lines. Drawing polylines. Drawing shapes. Drawing rounded rectangles. Drawing polygons.How to draw lines?

A canvas can draw straight lines and polylines. A straight line is just a line of pixels connecting two points. A polyline is a series of straight lines, connected end-to-end. The...

Programming - C++Builder

Tags:CanvasCbuilderWhat's the brush and how to use the brushes?

The Brush property of a canvas controls the way you fill areas, including the interior of shapes. Filling an area with a brush is a way of changing a large number of adjacent pixels in a specified way.

The brush has three properties you can manipulate: Color property changes the fill color. Style property changes the brush style. Bitmap property uses a bitmap as a brush pattern.

The values of these properties determine...

Programming - C++Builder

More Articles...

Page 2 of 13