Unit1.cpp
上传用户:lhxd_sz
上传日期:2014-10-02
资源大小:38814k
文件大小:1k
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::BitBtn1Click(TObject *Sender)
- {
- if(BitBtn1->Tag==0)
- BitBtn1->Glyph->Assign(Image1->Picture->Bitmap);
- else if(BitBtn1->Tag==1)
- BitBtn1->Glyph->Assign(Image2->Picture->Bitmap);
- else
- BitBtn1->Glyph->Assign(Image3->Picture->Bitmap);
- BitBtn1->Tag++;
- if(BitBtn1->Tag>=3)BitBtn1->Tag=0;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::BitBtn2Click(TObject *Sender)
- {
- AnsiString bmpfile;
- Graphics::TBitmap *Bitmap1 = new Graphics::TBitmap();
- if(BitBtn2->Tag==0)
- bmpfile="te1.bmp";
- else if(BitBtn2->Tag==1)
- bmpfile="te2.bmp";
- else
- bmpfile="te3.bmp";
- try
- {
- Bitmap1->LoadFromFile(bmpfile);
- BitBtn2->Glyph->Assign(Bitmap1);
- }
- catch (...)
- {
- ShowMessage("打开文件错误!");
- }
- BitBtn2->Tag++;
- if(BitBtn2->Tag>=3)BitBtn2->Tag=0;
- delete Bitmap1;
- }
- //---------------------------------------------------------------------------