📄 unit1.cpp
字号:
//---------------------------------------------------------------------------
#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::OpenClick(TObject *Sender)
{
if(OpenPictureDialog1->Execute())
{
Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
Vertical->Enabled=true;
Horizontal->Enabled=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ExitClick(TObject *Sender)
{
Form1->Close();
}
//---------------------------------------------------------------------------
//水平百叶窗效果
void __fastcall TForm1::HorizontalClick(TObject *Sender)
{
Graphics::TBitmap* myBitmap;
myBitmap=new Graphics::TBitmap;
myBitmap->Width=Image1->Width;
myBitmap->Height=Image1->Height;
int width,height;
width=Image1->Width;
height=Image1->Height;
int x_step,x_count;
x_step=30;
x_count=width/x_step;
for(int i=0;i<=x_count;i++)
for(int j=0;j<=x_step;j++)
{
myBitmap->Canvas->CopyRect(Rect(x_count*j+i-1,0,x_count*j+i,height),
Image1->Canvas,Rect(x_count*j+i-1,0,x_count*j+i,height));
Form1->Canvas->Draw(18,18,myBitmap);
Application->ProcessMessages();
Sleep(8);
}
delete myBitmap;
}
//---------------------------------------------------------------------------
//垂直百叶窗效果
void __fastcall TForm1::VerticalClick(TObject *Sender)
{
Graphics::TBitmap* myBitmap;
myBitmap=new Graphics::TBitmap;
myBitmap->Width=Image1->Width;
myBitmap->Height=Image1->Height;
int width,height;
width=Image1->Width;
height=Image1->Height;
int y_step,y_count;
y_step=25;
y_count=height/y_step;
for(int i=0;i<=y_count;i++)
for(int j=0;j<=y_step;j++)
{
myBitmap->Canvas->CopyRect(Rect(0,y_count*j+i-1,width,y_count*j+i),
Image1->Canvas,Rect(0,y_count*j+i-1,width,y_count*j+i));
Form1->Canvas->Draw(18,18,myBitmap);
Application->ProcessMessages();
Sleep(8);
}
delete myBitmap;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -