소스코드는 이거구요
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "CGRID"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Image1->Picture->Bitmap->Height = 305;
Image1->Picture->Bitmap->Width = 320;
ListBox1->ItemIndex = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image1MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if(Shift.Contains(ssLeft))
Image1->Picture->Bitmap->Canvas->LineTo(X,Y);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
Image1->Picture->Bitmap->Canvas->Pen->Color = CColorGrid1->ForegroundColor;
Image1->Picture->Bitmap->Canvas->Pen->Width = ListBox1->ItemIndex+1;
Image1->Picture->Bitmap->Canvas->MoveTo(X,Y);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (SaveDialog1->Execute())
Image1->Picture->Bitmap->SaveToFile(SaveDialog1->FileName);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if (OpenDialog1->Execute())
Image1->Picture->Bitmap->LoadFromFile(OpenDialog1->FileName);
}
//---------------------------------------------------------------------------
그림판을 만들었습니다 .
기본적으로 펜만 사용가능한데요
어떻게하면 도형그릴수 있나요 ㅠㅠ
|