NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

http://dropmefiles.com/GXK9h


paintColor.h

//---------------------------------------------------------------------------

#ifndef paintColorH
#define paintColorH
//---------------------------------------------------------------------------
#include <ExtCtrls.hpp> // для графики - TColor, TCanvas
class TMyFigure
{
private:
//
protected:
int fx,fy;
TColor fcol;
public:
TMyFigure(int Ax,int Ay,TColor Acol);
~TMyFigure();
virtual void Paint(TCanvas *ACanvas); // Виртуальный метод
virtual void MovePaint(int Ax1,int Ay1,int Ax2,int Ay2,TCanvas *ACanvas);
__property int koordX={read=fx,write=fx};
__property int koordY={read=fy,write=fy};
__property TColor Color={read=fcol,write=fcol};
};
#endif

paintColor.cpp

//---------------------------------------------------------------------------


#pragma hdrstop

#include "paintColor.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)

TMyFigure::TMyFigure(int Ax,int Ay,TColor Acol)
{
fx=Ax;
fy=Ay;
fcol=Acol;
}
TMyFigure::~TMyFigure()
{
fx=fy=0;
}
void TMyFigure::Paint(TCanvas *ACanvas)
{
ACanvas->Brush->Color=fcol;
ACanvas->Pen->Color=fcol;
ACanvas->Pen->Mode=pmNotXor;//для закраски изображения при перемещении
}
void TMyFigure::MovePaint(int Ax1,int Ay1,int Ax2,int Ay2,TCanvas *ACanvas)
{
koordX=Ax1;
koordY=Ay1;
Paint(ACanvas);//закраска изображения инверсным способом
koordX=Ax2;
koordY=Ay2;
Paint(ACanvas); //закраска изображения инверсным способом
}

paintColor123.h

//---------------------------------------------------------------------------

#ifndef paintColor123H
#define paintColor123H
//---------------------------------------------------------------------------
#include <ExtCtrls.hpp> // для графики - TColor, TCanvas
#include "paintColor.h" // модуль базового класса
class TMyRect:public TMyFigure
{
private:
int fsize;
public:
TMyRect(int Ax,int Ay,int Asize, TColor Acol);
~TMyRect();
virtual void Paint(TCanvas *ACanvas);
};
class TMyCircle:public TMyFigure
{
private:
int frad; // радиус
public:
TMyCircle(int Ax,int Ay,int Arad, TColor Acol);
~TMyCircle();
virtual void Paint(TCanvas *ACanvas);
};
class TMyTreug:public TMyFigure
{
private:
int fro; // радиус описанной окружности
public:
TMyTreug(int Ax,int Ay,int Aro, TColor Acol);
~TMyTreug();
virtual void Paint(TCanvas *ACanvas);
};
#endif


paintColor123.cpp


//---------------------------------------------------------------------------


#pragma hdrstop

#include "paintColor123.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)

TMyRect::TMyRect(int Ax,int Ay,int Asize,TColor Acol):TMyFigure(Ax,Ay,Acol)
{
fsize=Asize;
}
TMyRect::~TMyRect(){fsize=0;}
void TMyRect::Paint(TCanvas *ACanvas)
{
TMyFigure::Paint(ACanvas) ; //вызов перекрытого метода предка
ACanvas->Rectangle(fx-fsize,fy-fsize,fx+fsize,fy+fsize);
}
TMyCircle::TMyCircle(int Ax,int Ay,int Arad,TColor Acol):TMyFigure(Ax,Ay,Acol)
{
frad=Arad;
}
TMyCircle::~TMyCircle(){frad=0;}
void TMyCircle::Paint(TCanvas *ACanvas)
{
TMyFigure::Paint(ACanvas) ; //вызов перекрытого метода предка
ACanvas->Ellipse(fx-frad,fy-frad,fx+frad,fy+frad);
}
TMyTreug::TMyTreug(int Ax,int Ay,int Aro,TColor Acol):TMyFigure(Ax,Ay,Acol)
{
fro=Aro;
}
TMyTreug::~TMyTreug(){fro=0;}
void TMyTreug::Paint(TCanvas *ACanvas)
{ TPoint p[2];
TMyFigure::Paint(ACanvas) ; //вызов перекрытого метода предка
p[0]=Point(fx-fro,fy);
p[1]=Point(fx+fro,fy);
p[2]=Point(fx,fy-fro);
ACanvas->Polygon(p,2);
}


UpaintColor.cpp


//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "UpaintColor.h"
#include "paintColor.h"
#include "paintColor123.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int r,x0,y0;
TMyFigure *fig;
TList *FigList;
TColor cfon,cfig;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
r=20;
x0=y0=0;
FigList=new TList;
randomize;
cfon=clWhite;
cfig=clBlue;


}
//---------------------------------------------------------------------------
void __fastcall TForm1::circle1Click(TObject *Sender)
{ x0=y0=-100;
fig=new TMyCircle(x0,y0,random(20)+20,cfig);
fig->Color=(TColor)(random(0xff0000));
}
//---------------------------------------------------------------------------
void __fastcall TForm1::treug1Click(TObject *Sender)
{ x0=y0=-100;
fig=new TMyTreug(x0,y0,random(20)+20,cfig);
fig->Color=(TColor)(random(0x00ff00));
}
//---------------------------------------------------------------------------
void __fastcall TForm1::rect1Click(TObject *Sender)
{ x0=y0=-100;
fig=new TMyRect(x0,y0,random(20)+20,cfig);
fig->Color=(TColor)(random(0x0000ff));
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
if (Shift.Contains(ssLeft)) {
// fig->koordX=x0=X;
// fig->koordY=y0=Y;
//fig->Color=(TColor)random(0xffffff);
//fig->Paint(Image1->Canvas);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image1MouseMove(TObject *Sender, TShiftState Shift, int X,
int Y)
{
if (Shift.Contains(ssLeft)) {
fig->MovePaint(x0,y0,X,Y,Image1->Canvas);
x0=X;
y0=Y;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image1MouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
fig->koordX=X;
fig->koordY=Y;
FigList->Add(fig);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::clear1Click(TObject *Sender)
{
Image1->Canvas->Brush->Color=cfon;
Image1->Canvas->FillRect(Rect(0,0,Image1->Width,Image1->Height));
}
//---------------------------------------------------------------------------

void __fastcall TForm1::restoreClick(TObject *Sender)
{
for (int i = 0; i < FigList->Count; i++) {
fig=(TMyFigure*)FigList->Items[i];
fig->Paint(Image1->Canvas) ;
}
}
//---------------------------------------------------------------------------


     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.