Unit1.cpp
上传用户:lhxd_sz
上传日期:2014-10-02
资源大小:38814k
文件大小:1k
源码类别:

VC书籍

开发平台:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <Jpeg.hpp>
  4. #pragma hdrstop
  5. #include "Unit1.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma resource "*.dfm"
  9. TForm1 *Form1;
  10. //---------------------------------------------------------------------------
  11. __fastcall TForm1::TForm1(TComponent* Owner)
  12.         : TForm(Owner)
  13. {
  14. }
  15. //---------------------------------------------------------------------------
  16. void __fastcall TForm1::Button1Click(TObject *Sender)
  17. {
  18.   if(OpenPictureDialog1->Execute())
  19.   {
  20.     Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
  21.   }
  22. }
  23. //---------------------------------------------------------------------------
  24. void __fastcall TForm1::Button2Click(TObject *Sender)
  25. {
  26.   TJPEGImage *jp;
  27.   if(SavePictureDialog1->Execute())
  28.   {
  29.     jp=new TJPEGImage();
  30.     jp->Assign(Image1->Picture->Bitmap);
  31.     Image2->Picture->Bitmap->Assign(jp);
  32.     jp->SaveToFile(SavePictureDialog1->FileName);
  33.     delete jp;
  34.   }
  35. }
  36. //---------------------------------------------------------------------------