| |

VerySource

 Forgot password?
 Register
Search
View: 874|Reply: 4

How do you draw a circle? Wait online! !!

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Thailand

Post time: 2020-1-23 22:00:01
| Show all posts |Read mode
The requirement is that the point where the mouse starts to depress is the center coordinate, the point after moving is a point on the circle, and the radius is the distance between these two points!
Thank you!
Reply

Use magic Report

0

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-2-20 11:45:03
| Show all posts
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, jpeg, ExtCtrls, StdCtrls;

type
  TForm1 = class (TForm)
    procedure FormMouseDown (Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormMouseUp (Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormMouseMove (Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
  private
    fselecting: boolean;
    fbeginpt, fendpt: tpoint;
    {Private declarations}
  public
    {Public declarations}
  end;

var
  Form1: TForm1;

implementation

{$ R * .dfm}

procedure TForm1.FormMouseDown (Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  fselecting: = true;
  fbeginpt: = Form1.ScreenToClient (mouse.CursorPos);
end;
procedure TForm1.FormMouseUp (Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  fselecting: = false;
  fendpt: = Form1.ScreenToClient (mouse.CursorPos);
  Self.Repaint;
end;
procedure TForm1.FormMouseMove (Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
 fendpt: = Form1.ScreenToClient (mouse.CursorPos);
 if fselecting then
 begin
   Canvas.FillRect (Canvas.ClipRect);
   //Canvas.Rectangle(rect(fbeginpt,fendpt));
   canvas.Ellipse (rect (fbeginpt, fendpt));
   canvas.Pen.Color: = clred;
   Canvas.Pen.Width: = 1;
 end;
end;

end.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-12 18:30:01
| Show all posts
Agree upstairs
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-24 14:45:01
| Show all posts
Just drag and drop with controls. It's that simple
Use visual graph to do
Reply

Use magic Report

0

Threads

5

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 18:45:01
| Show all posts
All good suggestions! Worth learning
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list