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

VC书籍

开发平台:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma resource "*.dfm"
  8. TForm1 *Form1;
  9. //---------------------------------------------------------------------------
  10. __fastcall TForm1::TForm1(TComponent* Owner)
  11.         : TForm(Owner)
  12. {
  13. }
  14. //---------------------------------------------------------------------------
  15. void __fastcall TForm1::CanvasCopy(TCanvas *SCv,int x1,int y1,int w,int h,TCanvas *DCv,int x2,int y2)
  16. {
  17.   TColor cl,cl1;
  18.   int ii,jj,ww,hh;
  19.   ww=w-x1;hh=h-y1;
  20.   for(ii=0;ii<ww;ii++)
  21.     for(jj=0;jj<hh;jj++)
  22.     {
  23.       cl=SCv->Pixels[x1+ii][y1+jj];
  24.       cl1=DCv->Pixels[x2+ii][y2+jj];
  25.       if(cl1!=clWhite)
  26.         SCv->Pixels[x1+ii][y1+jj]=cl1;
  27.     }
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TForm1::Button1Click(TObject *Sender)
  31. {
  32.   int ww,hh;
  33.   ww=Image1->Width;hh=Image1->Height;
  34.   BitBlt(PaintBox1->Canvas->Handle,0,0,ww,hh,Image1->Canvas->Handle,0,0,SRCCOPY);
  35.   ww=Image2->Width;hh=Image2->Height;
  36.   CanvasCopy(PaintBox1->Canvas,0,0,ww,hh,Image2->Canvas,0,0);
  37.   ww=Image3->Width;hh=Image3->Height;
  38.   Image3->Canvas->Font->Size=24;
  39.   Image3->Canvas->TextOut(12,62,"中华人民共和国");
  40.   CanvasCopy(PaintBox1->Canvas,0,0,ww,hh,Image3->Canvas,0,0);
  41. }
  42. //---------------------------------------------------------------------------
  43.