ㅡㅡ;; 파일경로에 OpenPictureDialog1->FileName를 넣으면 됩니다.
Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
김준석 님이 쓰신 글 :
: 죄송합니다.
: 답변 너무 감사한데요 .
: 다시 질문 드립니다 .
: 제 질문은 그림판은 지금 완성 되었구요
: 그림파일을 이미지박스에 불러와서
: 그림파일에다가 그림을 그리고 그걸 저장하고 싶습니다 .
: 그런데 그림파일을 불러오고 싶을때 불러오는건데 .
: 님은 애초에 그림파일을 바로 지정해주셨네요 ...
:
:
:
: : :
: : : 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()){
: : : ???????????????=OpenPictureDialog1->FileName;
: : : } }
: : : //---------------------------------------------------------------------------
: : :
: : : |