mainform.cpp
来自「C++ BUILDER精彩编程实例集锦(源码)2 第三部分 文件操作 第四部」· C++ 代码 · 共 40 行
CPP
40 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Mainform.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{ //镜像图像
Graphics::TBitmap *pBmp1=new Graphics::TBitmap();
Graphics::TBitmap *pBmp2=new Graphics::TBitmap();
Byte *pB1,*pB2;
pBmp1->Assign(this->Image1->Picture->Bitmap);
pBmp2->Assign(this->Image1->Picture->Bitmap);
for(int y=0;y<pBmp1->Height;y++)
{
pB1=(Byte*)pBmp1->ScanLine[y];
pB2=(Byte*)pBmp2->ScanLine[y];
for(int x=0;x<pBmp1->Width*3/2;x++)
{
pB2[x]=pB1[pBmp1->Width*3-1-x];
pB2[pBmp1->Width*3-1-x]=pB1[x];
}
}
this->Image1->Canvas->Draw(0,0,pBmp2);
delete pBmp1;
delete pBmp2;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?