//---------------------------------------------------------------------------
#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 (OpenPictureDialog1->Execute()){
Image1->Picture->LoadFromFile("OpenPictureDialog1->GetNamePath()");
}
}
//---------------------------------------------------------------------------
Image1->Picture->LoadFromFile("OpenPictureDialog1->GetNamePath()");
이부분이 잘못된거맞죠 ?
어떻게 고쳐야하나요 ?
파일을 불러와서 이미지 박스에 열고싶은데요
|