BMP.cpp
上传用户:lulishicai
上传日期:2010-03-01
资源大小:13202k
文件大小:2k
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "BMP.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormCreate(TObject *Sender)
- {
- Form1->DirectoryListBox1->Drive='c';
- //设置控件的缺省路径
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FileListBox1Click(TObject *Sender)
- {
- Form1->Image1->Picture->LoadFromFile(Form1->FileListBox1->FileName);
- Form1->Image2->Picture->LoadFromFile(Form1->FileListBox1->FileName);
- //读取图象信息
- if (Form1->Image1->Width>Form1->Image2->Width)
- {
- Form1->ScrollBar1->Visible=true;
- Form1->ScrollBar1->Max=Form1->Image1->Width-Image2->Width;
- }
- //如果图象尺寸比显示区域大,那么显示滚动条
- else
- Form1->ScrollBar1->Visible=false;
- if (Form1->Image1->Height>Form1->Image2->Height)
- {
- Form1->ScrollBar2->Visible=true;
- Form1->ScrollBar2->Max=Form1->Image1->Height-Image2->Height;
- }
- //如果图象尺寸比显示区域大,那么显示滚动条
- else
- Form1->ScrollBar2->Visible=false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::ScrollBar1Scroll(TObject *Sender,
- TScrollCode ScrollCode, int &ScrollPos)
- {
- Form1->Image1->Left=-Form1->ScrollBar1->Position;
- //滚动显示图象
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::ScrollBar2Scroll(TObject *Sender,
- TScrollCode ScrollCode, int &ScrollPos)
- {
- Form1->Image1->Top=-Form1->ScrollBar2->Position;
- //滚动显示图象
- }
- //---------------------------------------------------------------------------
-