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

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::Button1Click(TObject *Sender)
  16. {
  17.   HPEN pen;
  18.   TPoint po;
  19.   HDC ddc;
  20.   ddc=GetDC(GroupBox1->Handle);
  21.   BitBlt(ddc,0,0,GroupBox1->Width,GroupBox1->Height,Image1->Picture->Bitmap->Canvas->Handle,0,0,SRCCOPY);
  22.   MoveToEx(ddc,5,5,&po);
  23.   LineTo(ddc,GroupBox1->Width-5,5);
  24.   LineTo(ddc,GroupBox1->Width-5,GroupBox1->Height-5);
  25.   LineTo(ddc,5,GroupBox1->Height-5);
  26.   LineTo(ddc,5,5);
  27.   pen=CreatePen(0,1,0x00ffffff);
  28.   SelectObject(ddc,pen);
  29.   MoveToEx(ddc,6,6,&po);
  30.   LineTo(ddc,GroupBox1->Width-4,6);
  31.   LineTo(ddc,GroupBox1->Width-4,GroupBox1->Height-4);
  32.   LineTo(ddc,6,GroupBox1->Height-4);
  33.   LineTo(ddc,6,6);
  34.   TextOut(ddc,10,0,GroupBox1->Caption.c_str(),GroupBox1->Caption.Length());
  35. }
  36. //---------------------------------------------------------------------------