Core idea: Because Windows Forms redraws its form background every time, we can block the form from redrawing the background message (WM_ERASEBKGND), and customize the method to implement the redraw of the form background. The Timage component can also be implemented, but overriding the WM_ERASEBKGND message is more efficient, so it is recommended to use this method.
(2) Declaration Redraw background Message response function
void Fastcall Onwmerasebkgnd (twmerasebkgnd& Msg);
(3) Adding a message map
Begin_message_map
Intercept the redraw background event
Message_handler (WM_ERASEBKGND,TWMERASEBKGND,ONWMERASEBKGND);
End_message_map (Tform);
(4) code to write a custom background message response function
void Fastcall Tformmain::onwmerasebkgnd (twmerasebkgnd& Msg)
{
Re-painting background
tcanvas* canvas = new Tcanvas;
Canvas->handle = MSG.DC;
int cx = clientwidth/bmpformbk->width + 1;
int cy = clientheight/bmpformbk->height + 1;
for (int i=0; i<cy; i++)
for (int j=0; j<cx; j + +)
{
Canvas->draw (J*bmpformbk->width, I*BMPFORMBK->HEIGHT,BMPFORMBK); Msg.result = true;
}
Delete canvas;
}
Http://www.cnblogs.com/songsu/articles/1336653.html
Drawing of the form background (the Windows Form redraws its form background every time, so we can stop the form from redrawing the background message (WM_ERASEBKGND) and customize the method to achieve redrawing of the form background)