Coding Corner


      What's New


Contact Us

Design Background

Curriculum Vitae





Quick Jumps:

Overview - Download - Purchase - Contact - FAQ - What's New!

DtpDocuments Frequently Asked Questions (FAQ)
Added: 11Dec2003
Updated: 15Feb2010



I need to be able to draw some parts directly on a device canvas, is there a way to get the handle of the canvas used in TDtpDocument?

Yes, there is a OnPaintBefore and OnPaintAfter event with a TCanvas parameter. The TCanvas.Handle is the HDC. You can use it to do your default
(GIS) drawing on the page, and then, after that, the shapes of DtpDocuments
(if any) are drawn. An example is available.

How can I draw my own derived shapes?

There is a way to draw directly to a shape's canvas. In this case, derive your own shape from TDtpEffectShape (if you want to be able to use effects, like shadow, later), or from TDtpShape.

There are two different methods you can override to draw your own shapes:

procedure TDtpShape.Paint(Canvas: TCanvas); virtual;

Override this method if you want to draw on a TCanvas with VCL or GDI commands. TCanvas.Handle is the HDC. See TCanvas in the Delphi docs for more info too. Since GDI has no understanding of alpha-channel information, each pixel drawn will be considered fully opaque, and each untouched pixel will
be considered fully transparent.

procedure TDtpShape.PaintDIB(DIB: TBitmap32); virtual;

Override this method if you want to draw directly to the RGBA 32-bits Device
Independent Bitmap. This bitmap object is defined in the Graphics32 package
that is used for lowlevel bitmapping operations. Graphics32 comes with a
wealth of drawing methods that work directly on the DIB. This method is more
efficient, and the drawing methods of the Graphics32 library are usually optimized very well. Transparency can be set per pixel, ranging from 0 (fully transparent) to 255 (fully opaque).

In both cases, you can use the properties below to aid you in drawing onto
the shape's rectangle:

CanvasLeft: The position of the left edge (integer) of the shape.
CanvasTop: The position of the top edge (integer) of the shape.
CanvasRight: The position of the right edge (integer) of the shape.
CanvasBottom: The position of the bottom edge (integer) of the shape.

So, to draw a rectangle on the shape in the Paint event:

procedure TMyShape.Paint(Canvas: TCanvas);
  Canvas.Pen.Color := clBlue;
  Canvas.Brush.Style := bsClear;
  Canvas.Rectangle(CanvasLeft, CanvasTop, CanvasRight,     CanvasBottom);

If you are drawing complex shapes, you can analyse the TCanvas.Cliprect
property to find out which part must be drawn.

I printed some documents and a grey text is printed on the white background. Does this happen because it is the trial version?

Yes. The trial version always prints"TRIAL VERSION DTPDOCUMENTS", a few lines of gray text. Of course the registered versions do not have this.

If I purchase the DCU version will I be able to customise the captions of the shape editors used or do I have to purchase the full source code version instead?

The editor uses frames for which you will get the full source even in the
DCU version.

Is it possible to create my own editing interface?

The document itself (document, pages, shapes, drawing surface) is completely
isolated from the interface, through events and methods. So you can always
build your own editor on top of them. The editor that is shipped with the
trial is just an example.

What are your future upgrade plans, in terms of the features you intend to implement?

DtpDocuments is relatively new and therefore very much dependent on input from its current user base. We have plans for these enhancements:

  • Import/Export to/from PDF and SVG

  • Addition of shape types

  • Addition of "magnets" (so lines will automatically attach to shapes and move with them)

  • Addition of effects for shapes (especially useful for text), like bevel, outline, bumpmap, etcetera.

  • Addition of raster operations and extended alpha masking (e.g. floodfill, magic wand, etc)

  • Additions of import/export of image file formats (tiff, jp2, etc)

  • Addition of scripting (so you - or the enduser - can write an animation or reporting script instead of having to write it in code)

  • Continuous bugfixes when neccesary

  • Any reasonable user requests.. We strive to make this a very versatile, easy-to-use component for the end user.

Since the component is still very much in development we are very happy with customers that will give us good feedback.

Updates to the library will be totally free for 2 years after purchase, and after that, a small upgrade price will be asked (much less than the original purchase price).

   Page last changed: 15Feb2010 © Copyright 2002-2010 SimDesign BV