用Delphi写了一个CPU监控的程序,得到了即时CPU的使用率,
但要用曲线表示出来,就像WINDOWS中的CPU使用率一样,也是放在托盘中的一个小方框,
只不过里面的内容用曲线来表示CPU使用率的变化。好象Delphi中有一个做曲线的控件TChart,
但不知道怎么用?请教一下,或者还有其他方法以及更好的控件,也请介绍,谢谢
但要用曲线表示出来,就像WINDOWS中的CPU使用率一样,也是放在托盘中的一个小方框,
只不过里面的内容用曲线来表示CPU使用率的变化。好象Delphi中有一个做曲线的控件TChart,
但不知道怎么用?请教一下,或者还有其他方法以及更好的控件,也请介绍,谢谢
Canvas.Pen.Color := clRed;
Canvas.MoveTo(10, 10);
Canvas.LineTo( 222, 333 );
好像有一個DEMO的吧,自己看看,不難的。
var
Pn:string;
iLoop:Integer;
begin
inherited;
Pn:=adoq_chart.FieldByName('PN').AsString;
cx_pn.Text:=pn;
adoq_chart.Close;
adoq_chart.SQL.Text:='select * from PRO_QUANTITY where Model='''+ VarToStr(cx_order.EditValue) +''' and PN='''+pn+'''';
adoq_chart.Open;
adoq_chart.First;
BarSeries1.Clear;
for iLoop:=0 to adoq_chart.RecordCount -1 do
begin
BarSeries1.Add(adoq_chart.FieldValues['NewHR'],VarToStr(adoq_chart.FieldValues['Dt']));
adoq_chart.Next;
end;
end;procedure TPRO_EFFPLATO_F.cxGrid1DBTableView1FocusedRecordChanged(
Sender: TcxCustomGridTableView; APrevFocusedRecord,
AFocusedRecord: TcxCustomGridRecord;
ANewItemRecordFocusingChanged: Boolean);
var
StrAccount:string;
i:Integer;
sl:TStrings;
begin
inherited;
if not Firstchecked then
begin
if AFocusedRecord<>nil then
begin
StrAccount:=VarToStr(AFocusedRecord.Values[5])+','+VarToStr(AFocusedRecord.Values[6]);
if AFocusedRecord.Values[0]=0 then
begin
AFocusedRecord.Values[0]:=1;
if ListBox1.Items.IndexOf(StrAccount)= -1 then
ListBox1.Items.Insert(0,StrAccount);
Chart1.Series[0].Clear;
for i:=0 to ListBox1.Items.Count -1 do
begin
if cx_order.ItemIndex<>0 then
sl:=TStringList.Create;
sl.Delimiter:=',';
sl.DelimitedText:=ListBox1.Items[i];
Chart1.Series[0].Add(trunc(StrToFloat(sl.Strings[1])),sl.Strings[0]);
end;
end
else
begin
AFocusedRecord.Values[0]:=0;
i:=ListBox1.Items.IndexOf(StrAccount);
ListBox1.Items.Delete(i);
Chart1.Series[0].Clear;
for i:=0 to ListBox1.Items.Count -1 do
begin
sl:=TStringList.Create;
sl.Delimiter:=',';
sl.DelimitedText:=ListBox1.Items[i];
Chart1.Series[0].Add(trunc(StrToFloat(sl.Strings[1])),sl.Strings[0]);
end;
end;
end;
end;
Firstchecked:=False;
end;
呵呵