Scalabium Software

SMExport/SMImport suites
Knowledge for your independence'.
Home Delphi and C++Builder tips


#72: How can I change a line type for drawing?

In some applications you must draw the line where each pixel is some shape. The MS Windows allows to draw line of such type - you must use the LineDDA funtion. This function needs a callback function that is called for each pixel drawing. Of course, in this callback function you can realize the any drawing routines.

For example, the next code allows to draw the ellipse every 10 pixels:

var
  i: Integer;

procedure DrawEllipse(X, Y: Integer; lpData: LParam); stdcall;

implementation

procedure DrawEllipse(X, Y: Integer; lpData: LParam);
begin
  with TObject(lpData) as TForm do
  begin
    if (i mod 10 = 0) then 
      Canvas.Ellipse(x-5, y-5, x+5, y+5);
    Inc(i);
  end;
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  i := 0;
  LineDDA(0, 0, Width, Height, @DrawEllipse, Integer(yourForm));
end;


Published: April 3, 2000

See also
 
Excel Reader (dll)
SMMsg suite
ABA Picture Convert
Viewer for TNEF-files (winmail.dat)
Metafile Convert
Clarion to Text converter
Excel Web-stream
DBISAM Viewer
ExcelFile Viewer
Fast Document Viewer
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2025, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMExport/SMImport suites