Home > Back-end > Small white consult! The circle is drawn on the rectangle in the picture!
Small white consult! The circle is drawn on the rectangle in the picture!
Time:11-09
On rectangular images to the same point (rectangle diagonal intersection of) is a circle, draw more identical radius of concentric circles! How to programming,
CodePudding user response:
TImage can be used as a canvas, put a TImage on the form controls, set the Image as the rectangle, Drawing code is as follows:
Procedure TFmMain. BtnDrawClick (Sender: TObject); Var I, r: integer; The begin //draw a rectangle ImgCanvas. Canvas. Pen. Color:=clBlack; ImgCanvas. Canvas. MoveTo (0, 0); ImgCanvas. Canvas. LineTo (imgCanvas. Width - 1, 0); ImgCanvas. Canvas. LineTo (imgCanvas. Width - 1, imgCanvas Height - 1); ImgCanvas. Canvas. LineTo (0, imgCanvas. Height - 1); ImgCanvas. Canvas. LineTo (0, 0); //draw round R:=imgCanvas Height div 2-2; For I:=10 downto 1 do The begin //USES random color circle ImgCanvas. Canvas. Pen. Color:=the Random ($FFFFFF); ImgCanvas. Canvas. The Ellipse (imgCanvas Width div 2 - r, ImgCanvas. Height div 2 - r, ImgCanvas. Width div 2 + r, ImgCanvas. Height div 2 + r); R:=r - 10; end; end;
Put the drawing code in the timer implementation, there will be animation