unit1.pas

来自「双色球分析软件」· PAS 代码 · 共 98 行

PAS
98 行
字号
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Paint1: TPaintBox;
    Grid1: TDrawGrid;
    procedure Paint1Paint(Sender: TObject);
    procedure Paint1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Grid1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  bPress:boolean;
  bPress1:boolean;
implementation

{$R *.dfm}

procedure TForm1.Paint1Paint(Sender: TObject);
begin
     with  paint1 do
     begin
          canvas.Pen.Style:=pssolid;
          canvas.MoveTo(10,10);
          canvas.LineTo(10,40);
          canvas.MoveTo(50,10);
          canvas.LineTo(50,40);
          canvas.MoveTo(10,10);
          canvas.LineTo(50,10);
          canvas.MoveTo(10,40);
          canvas.LineTo(50,40);
     end;
end;

procedure TForm1.Paint1Click(Sender: TObject);
begin
     with paint1 do
     begin
         if not bPress then
         begin
            canvas.Brush.Color:=rgb(255,0,0);
            canvas.Ellipse(rect(10,10,50,40));
            bpress:=not bPress;
         end
         else
         begin
            canvas.Brush.Color:=rgb(255,255,0);
            canvas.Ellipse(rect(10,10,50,40));
            bPress:=not bPress;
         end;
     end;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
     bPress:=false;
     bPress1:=false;
      
end;

procedure TForm1.Grid1Click(Sender: TObject);
begin
      if not bPress1 then
      begin
         grid1.Canvas.Pen.color:=rgb(255,255,255);
         grid1.Canvas.Brush.Color:=rgb(255,0,0);
         grid1.Canvas.Ellipse(grid1.CellRect(1,1));
         //grid1.Canvas.Ellipse(grid1.CellRect(4,1));
         grid1.Canvas.TextOut(45,45,'1');
         bpress1:=not bpress1;
      end
      else
      begin
         grid1.Canvas.Pen.color:=rgb(255,255,255);
         grid1.Canvas.Brush.Color:=rgb(255,255,255);
         grid1.Canvas.Ellipse(grid1.CellRect(1,1));
         //grid1.Canvas.Ellipse(grid1.CellRect(4,1));
         grid1.Canvas.TextOut(45,45,'1');
         bpress1:=not bpress1;
      end;
      //grid1.Canvas.CopyRect(grid1.CellRect(4,1),canvas,grid1.CellRect(1,1));
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?