全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:924
推到 Plurk!
推到 Facebook!

PaintBox Polyline的問題

尚未結案
rocha
一般會員


發表:6
回覆:1
積分:1
註冊:2005-01-19

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-02-03 23:29:07 IP:211.21.xxx.xxx 未訂閱
各位大師    如圖所示,我是將每次取的值由PaintBox顯示出來,但我使用Polyline會有一條怪的斜線回顯示出來,請各位大師幫我看看到底哪裡出了問題    下面是我的程式碼:    void __fastcall TForm1::Timer2Timer(TObject *Sender) {         TPoint pt;         int MaxRpm,MinRpm;            pt.x=0;         pt.y=0;         Status=aio3320_read_GPT(CardId,0,&Counter,0);         New_Counter=Old_Counter-Counter;         Rpm_Sum=(Rpm_Sum-Rpm_Average[Ptr_Count])+New_Counter;         Rpm_Average[Ptr_Count]=New_Counter;         Old_Counter=Counter;         Ptr_Count=Ptr_Count+1;         if (Ptr_Count>=3) Ptr_Count=0;         Rpm=Rpm_Sum;         Edit3->Text =Rpm;            MaxRpm=100;         MinRpm=-100;         Show_Rpm[Ptr_Pic]=Rpm;         pt.x=(int)(Ptr_Pic*(rt.Right/59));         pt.y=(int)((rt.Bottom/2)-(Show_Rpm[Ptr_Pic]/((float)(MaxRpm-MinRpm)/rt.Bottom)));         Label33->Caption =pt.x;         Label34->Caption=pt.y;         PointArray[Ptr_Pic]= pt;         Ptr_Pic=Ptr_Pic+1;         if (Ptr_Pic>=60) Ptr_Pic=0;         PaintBox1Paint(Sender);    } //---------------------------------------------------------------------------    void __fastcall TForm1::PaintBox1Paint(TObject *Sender) {         PaintBox1->Canvas->Pen->Color=clBlack;         PaintBox1->Canvas->Brush->Color=clWhite;         PaintBox1->Canvas->Rectangle(rt);         PaintBox1->Canvas->MoveTo(0,(PaintBox1->Height/2));         PaintBox1->Canvas->LineTo(PaintBox1->Width,(PaintBox1->Height/2));            //PaintBox1->Canvas->Pen->Mode=pmCopy;         PaintBox1->Canvas->Pen->Color=clRed;         PaintBox1->Canvas->Polyline(PointArray,59); } void __fastcall TForm1::FormCreate(TObject *Sender) {         Ptr=0;                          //AD濾波器指標初始值         Ptr_Count=0;                    //計數濾波器指標初始值         Ptr_Pic=0;         Ad_Average=0;                   //平均和初始值         New_Counter=0;         Old_Counter=4294967295;         Status=aio3320_initial();         Label4->Caption=CardId;         Status=aio3320_info(CardId,&PortAddress);         Status=aio3320_set_dedicate_IO(CardId,1);         Status=aio3320_load_GPT(CardId,0,Counter,0);         Status=aio3320_set_counter(CardId,0,3,3);         Status=aio3320_GPT_enable(CardId,0,1);            /*十進制轉十六進制固定4位數*/         Label6->Caption=Label6->Caption.IntToHex(PortAddress,4);         Reset_Da(Da_C0);         Offset=AD_Offset(Ad_C0); //---------------------------------------------------------------------------            PaintBox1->Canvas->Rectangle(0,0,PaintBox1->Width,PaintBox1->Height);         rt=PaintBox1->ClientRect; //---------------------------------------------------------------------------         Label29->Caption =Offset;         Timer1->Enabled =1; }     發表人 - rocha 於 2005/02/03 23:31:25
系統時間:2024-05-19 17:12:37
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!