unit1.cpp

来自「BCB 的数控实验的子程序」· C++ 代码 · 共 58 行

CPP
58
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "math.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
#define PI=3.1415926  ;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)
{
    Width = 640;

    Height = 480;

    Canvas->Pen->Color = clTeal;

    Canvas->Brush->Style = bsClear  ;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormPaint(TObject *Sender)
{
   double AL,x1,y1,x2,y2;

    int L=120;

    for (int i=0; i<48; i++)

    {

        AL = i*M_PI/24;

        x1 = L*cos(AL);

        y1 = L*sin(AL);

        x2 = x1+320;

        y2 = -y1+240;

        Canvas->Ellipse(x2-90,y2-90,x2+90,y2+90);


}
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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