TForm *temp_form=new TForm(this);
TChart *cht_temp_hum=new TChart(this);
cht_temp_hum->Parent=temp_form;
temp_form->Color=clWhite;
cht_temp_hum->Color=clWhite;
cht_temp_hum->Legend->ColorWidth=80;
cht_temp_hum->View3D=false;
cht_temp_hum->View3DWalls=false;
temp_form->Width=chart_Width+50;
temp_form->Height=chart_height+50;
///-
/
cht_temp_hum->Width=chart_Width;
cht_temp_hum->Height=chart_height;
//---?-?ú??
cht_temp_hum->AddSeries(new TLineSeries(cht_temp_hum));
TLineSeries *line_p;
line_p=(TLineSeries *)cht_temp_hum->Series[0];
//cht_temp_hum->LeftAxis=b;
line_p->HorizAxis=aBottomAxis;
line_p->VertAxis=aLeftAxis;
for(int point_cnt=0;point_cnt<sample_num;point_cnt++)
{
line_p->AddXY(point_cnt+1,log10(dust_var[point_cnt]),"");
}
/* temp_chart_dis(cht_temp_hum,source_p);
hum_chart_dis(cht_temp_hum,source_p);*/
//cht_temp_hum->Update(); ///這段代碼強行重繪控制元件,可以粘貼到EXCEL里就是沒有曲線, 只有一個框, 我想是復制的時間,控制元件還沒有重畫完,
cht_temp_hum->Refresh();
temp_form->Refresh();
temp_form->Update();
cht_temp_hum->Update();
cht_temp_hum->Repaint();
//temp_form->ShowModal();
Graphics::TBitmap *bmp = new Graphics::TBitmap;
bmp->Width = cht_temp_hum->Width;
bmp->Height = cht_temp_hum->Height;
TControlCanvas *c = new TControlCanvas;
c->Control = cht_temp_hum;
TRect rct(0, 0, cht_temp_hum->Width, cht_temp_hum->Height);
bmp->Canvas->CopyRect(rct, c, rct);
TClipboard *clip_p=new TClipboard();
clip_p->Clear();
clip_p->Assign(bmp);
HANDLE wait_p= CreateEvent(NULL,true,false,NULL);
ResetEvent(wait_p);
WaitForSingleObject(wait_p,500);
//
delete c;
delete bmp;
delete temp_form;
delete clip_p;
這個有些代碼有看了妖哥的貼子來的
uj5u.com熱心網友回復:
搞得太復雜了, chart->CopyToClipboardBitmap就可以了轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/78710.html
標籤:VCL組件使用和開發
