Home > Back-end >  For help, C BUILDER6.0 CHART cannot be copied to the clipboard, only copy a box, no curve
For help, C BUILDER6.0 CHART cannot be copied to the clipboard, only copy a box, no curve

Time:09-26


TForm * temp_form=new TForm (this);
TChart * cht_temp_hum=new TChart (this);
Cht_temp_hum - & gt; The Parent=temp_form;
Temp_form - & gt; Color=clWhite;
Cht_temp_hum - & gt; Color=clWhite;
Cht_temp_hum - & gt; Legend - & gt; ColorWidth=80;

Cht_temp_hum - & gt; View3D=false;
Cht_temp_hum - & gt; View3DWalls=false;

Temp_form - & gt; Width=chart_Width + 50;
Temp_form - & gt; Height=chart_height + 50;
///




Cht_temp_hum - & gt; Width=chart_Width;
Cht_temp_hum - & gt; Height=chart_height;

//-- -? -? U??
Cht_temp_hum - & gt; AddSeries (new TLineSeries (cht_temp_hum));
TLineSeries * line_p;
Line_p=(TLineSeries *) cht_temp_hum - & gt; The Series [0].
//cht_temp_hum - & gt; LeftAxis=b;
Line_p - & gt; HorizAxis=aBottomAxis;
Line_p - & gt; VertAxis=aLeftAxis;


For (int point_cnt=0; Point_cnt & lt; Sample_num; Point_cnt + +)
{
Line_p - & gt; 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 - & gt; The Update ();///this code to refresh the controls, you can paste to the EXCEL is no curve, there is only one box, I think it's time, copy control has not yet finished,
Cht_temp_hum - & gt; The Refresh ();
Temp_form - & gt; The Refresh ();
Temp_form - & gt; The Update ();
Cht_temp_hum - & gt; The Update ();
Cht_temp_hum - & gt; Repaint ();

//temp_form - & gt; ShowModal ();

Graphics: : TBitmap * BMP=new Graphics: : TBitmap;
BMP - & gt; Width=cht_temp_hum - & gt; Width;
BMP - & gt; Height=cht_temp_hum - & gt; Height;


TControlCanvas * c=new TControlCanvas;
C - & gt; The Control=cht_temp_hum;


TRect RCT (0, 0, cht_temp_hum - & gt; Width, cht_temp_hum - & gt; Height);
BMP - & gt; Canvas - & gt; CopyRect (RCT, c, RCT);


TClipboard * clip_p=new TClipboard ();
Clip_p - & gt; The Clear ();
Clip_p - & gt; The Assign (BMP);

HANDLE wait_p=CreateEvent (NULL, true, false, NULL);
ResetEvent (wait_p);
The WaitForSingleObject (wait_p, 500);

//

The delete c;
The delete BMP.
The delete temp_form;
The delete clip_p;


This some code has watched the demon elder brother posts

CodePudding user response:

Too complicated, chart - & gt; CopyToClipboardBitmap is ok
  • Related