K
K
Kezzya2020-04-30 11:56:04
Delphi
Kezzya, 2020-04-30 11:56:04

Is there a MoveTo equivalent for Ellipse - Canvas Delphi?

It is necessary that the ellipse be displaced by some X and Y, but it is always built "around the rectangle describing it". Is there any way to move the ellipse?
Everything is simple with lines, Canvas.MoveTo and they are shifted.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hemul GM, 2020-04-30
@Kezzya

MoveTo doesn't move anything. This method sets the point at which the line will be drawn. And it is used for line drawing. MoveTo, LineTo.
To draw an ellipse, you need to specify the coordinates of the rectangle. And it's not just width and height. It's also a position.

procedure Ellipse(X1, Y1, X2, Y2: Integer); overload; virtual; abstract;
procedure Ellipse(const Rect: TRect); overload;

X1, Y2 are left and top coordinates
X2, Y2 are right and bottom coordinates
Rect - similar, but one variable.
Rect.Left, Rect.Top, Rect.Right, Rect.Bottom
If this is not enough for you to understand, then here is an example:
Canvas.Ellipse(10, 20, 10 + 40, 20 + 40);
An ellipse will be drawn at coordinates 10;20 with dimensions 40 by 40

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question