把窗体上的控件保存为图片
如题,怎么把窗体上的控件保存成bitmap显示在Image上
有3个panel,里面分别是一个Form,控件button,控件TChart
请问,怎么把panel里的信息保存成图片形式。
[解决办法]
将代码改进一下:
Graphics::TBitmap *bmp = new Graphics::TBitmap;TControlCanvas *cc = new TControlCanvas;bmp->PixelFormat = pf24bit;bmp->Width = Chart1->Width;bmp->Height = Chart1->Height;cc->Control = Chart1;TRect rct(0, 0, Chart1->Width, Chart1->Height);bmp->Canvas->CopyRect(rct, cc, rct);Image1->Width = bmp->Width;Image1->Height = bmp->Height;Image1->Picture->Bitmap->Assign(bmp);delete bmp;delete cc;