Initial commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "BackgroundForm.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
|
||||
TPngImage *u_pImgCellTile = NULL;
|
||||
|
||||
__fastcall TBackgroundForm::TBackgroundForm(TComponent* AOwner)
|
||||
: TForm(AOwner)
|
||||
{
|
||||
m_yLeftSide = -1;
|
||||
|
||||
if( !u_pImgCellTile ){
|
||||
u_pImgCellTile = new TPngImage();
|
||||
u_pImgCellTile->LoadFromResourceName(int(HInstance), L"PngBackTile");
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TBackgroundForm::~TBackgroundForm()
|
||||
{
|
||||
if( u_pImgCellTile ){
|
||||
delete u_pImgCellTile;
|
||||
u_pImgCellTile = NULL;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TBackgroundForm::WMEraseBkgnd(Winapi::Messages::TWMEraseBkgnd &Message)
|
||||
{
|
||||
if( u_pImgCellTile ){
|
||||
TCanvas* tempCanvas = new TCanvas;
|
||||
tempCanvas->Handle = Message.DC;
|
||||
|
||||
int nBottom = ClientHeight - u_pImgCellTile->Height;
|
||||
//绘制面板上下部分
|
||||
for (int i=0; i<2; i++){
|
||||
int y = i==0 ? 0 : nBottom;
|
||||
|
||||
for (int x=0; x<ClientWidth; x+=u_pImgCellTile->Width){
|
||||
tempCanvas->Draw( x, y, u_pImgCellTile );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_yLeftSide>=0 ){ //ComposeForm列表框最小化时须填充左侧
|
||||
for(int y=m_yLeftSide; y<nBottom; y+=u_pImgCellTile->Height ){
|
||||
tempCanvas->Draw( 0, y, u_pImgCellTile );
|
||||
}
|
||||
}
|
||||
|
||||
delete tempCanvas;
|
||||
|
||||
Message.Result = true;
|
||||
}
|
||||
else{
|
||||
DefaultHandler( &Message );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user