Promotic
WikipediaLinkedInYoutubeTwitterFacebook

rect - method of the CanvasCtx object

Description:
Creates a rectangle.
Syntax:
Object rect(Long x, Long y, Long width, Long height)
Parameters:
x(Long) The x-coordinate of the upper-left corner of the rectangle
y(Long) The y-coordinate of the upper-left corner of the rectangle
width(Long) The rectangle width (in pixels).
height(Long) The rectangle height (in pixels).
Note:
The method creates a path. Therefore before this method is called the beginPath method should be called. For the rendering itself the stroke or fill method is used.
 
This method is also functional in Web panels.
See also:
Example:
The ctx variable represents the drawing canvas (CanvasCtx). The setup is done on the "Draw" tab at the beginning of the script of drawing event onDraw as follows:
 
var ctx = pEvent.GetCtx(1);
JavaScriptSelect and copy to clipboard

ctx.beginPath();
ctx.lineWidth = 10;
ctx.strokeStyle = "blue";
ctx.rect(50, 50, 150, 80);
ctx.stroke();

History:
Pm8.02.06: Created
PROMOTIC 9.0.13 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice