Добавил:
korayakov
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабы / ООП.Builder / Лабы / laba3 / Bezier / Unit1
.cpp//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
bool p1,p3,p4;
int P0x, P1x, P2x, P0y, P1y, P2y;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
p1=false;
p3=false;
p4=false;
Krivaya = new Cbez(Image1);
Panel1->Top=P0x = 40;
Panel1->Left=P0y=50;
Panel3->Top=P1x = 80;
Panel3->Left=P1y=150;
Panel4->Top=P2x = 100;
Panel4->Left=P2y=50;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
p1=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel3MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
p3=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel4MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
p4=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel1MouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
p1=false;
p3=false;
p4=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel4MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if(p4==true)
{
Form1->Image1->Canvas->Pen->Color = clWhite;
Form1->Image1->Canvas->Rectangle(0,0,500,500);
((TPanel*)Sender)->Top=((TPanel*)Sender)->Top+Y;
((TPanel*)Sender)->Left=((TPanel*)Sender)->Left+X;
P2x =((TPanel*)Sender)->Top ;
P2y = ((TPanel*)Sender)->Left;
Krivaya->Cur(P0x, P1x, P2x, P0y, P1y, P2y);
}
if (p3==true)
{
Form1->Image1->Canvas->Pen->Color = clWhite;
Form1->Image1->Canvas->Rectangle(0,0,500,500);
((TPanel*)Sender)->Top=((TPanel*)Sender)->Top+Y;
((TPanel*)Sender)->Left=((TPanel*)Sender)->Left+X;
P1x =((TPanel*)Sender)->Top ;
P1y = ((TPanel*)Sender)->Left;
Krivaya->Cur(P0x, P1x, P2x, P0y, P1y, P2y);
}
if (p1==true)
{
Form1->Image1->Canvas->Pen->Color = clWhite;
Form1->Image1->Canvas->Rectangle(0,0,500,500);
((TPanel*)Sender)->Top=((TPanel*)Sender)->Top+Y;
((TPanel*)Sender)->Left=((TPanel*)Sender)->Left+X;
P0x =((TPanel*)Sender)->Top ;
P0y = ((TPanel*)Sender)->Left;
Krivaya->Cur(P0x, P1x, P2x, P0y, P1y, P2y);
}
}
//---------------------------------------------------------------------------
Соседние файлы в папке Bezier