CanvasDrawRect

Top  Previous  Next

Prototype

 

CanvasDrawRect (intHandle,intX1,intY1,intX2,intY2)

 

Description

 

Draws a rectangular setting the opposite vertex X1,Y1 and X2,Y2 by pen and brush set in canvas.

 

Parameters

 

IntHandle: integer value corresponding to the canvas handle.

 

IntX1: integer value corresponding to the left rectangular coordinate.

 

IntY1: integer value corresponding to the top rectangular coordinate..

 

IntX2: integer value corresponding to the right rectangular coordinate.

 

IntY2: integer value corresponding to the bottom rectangular coordinate.

 

Returned value

 

None.

 

Notes

 

None.

 

Example

 

// It selects printer

PrinterSelect('HP LaserJet III');

 

// Start print

if not PrinterStart('Test print',1) then

 begin

   // Abort sprint if there are errors

   PrinterAbort;

   PrinterStart('Test print',1);

 end;

 

//It gets canvas handle

Paper:=PrinterGetCanvas;

 

//It gets print area size

WidthArea:=CanvasGetHorzSize(Paper);

HeightArea:=CanvasGetVertSize(Paper);

 

// It calculates distance among grid cells to draw

StepV:=HeightArea div 10;

StepH:=WidthArea div 10;

 

// Draw grid

CanvasSetPen(Paper,3,0,$000000);

For L:=0 to 10 do

 begin

  CanvasDrawLine(Foglio,L*StepH,0,L*StepH,HeightArea);

  CanvasDrawLine(Paper,0,L*StepV,WidthArea,L*StepV);

 end;

 

// Rectangular draw

CanvasDrawRect(Paper,0,0,200,HeightArea);

 

// End print operation

PrinterEnd;