新建了一個對話框,在里面自繪圖形了,使用模態對話框沒事,里面有定時器想實作動態曲線,使用模態對話框有的時候點出來容易崩潰,現在想改成非模態對話框,為啥會出現非定義的型別

void Ccurve::addtaxis(int data,int *path) //data為畫圖資料的幀數
{
//記憶體繪圖相關
pWnd1 = GetDlgItem(IDC_STATIC_view);//控制元件ID
pDC1=pWnd1->GetDC();
pWnd1->GetWindowRect(&rect1);//rc為控制元件的大小
W=rect1.Width()-50;
H=rect1.Height();
m=H/40;
bmp1=new Bitmap(W+50-2,H-1); //記憶體位圖H
Pen pen(Color(0,0, 0), 3);//邊框粗線
Pen spen(Color(0,0, 0), 1);//邊框細線
Gdiplus::Font myFont(L"Arial", 8);
SolidBrush brushB(Color(255,0,0,0));
Graphics graphics(bmp1);
HatchBrush newBrush( HatchStyleCross, Color(2555, 255, 255, 255), Color(255, 255, 255,255));//白色
graphics.FillRectangle(&newBrush, 0, 0, rect1.Width(),H);//給畫圖區域填充白色背
for(int i=0;i<25;i++)
{
graphics.DrawLine(&spen,W*i/24+40,0,W*i/24+40,H); //豎細線
if(i%4==0)
graphics.DrawLine(&pen,W*i/24+40,0,W*i/24+40,H); //縱向粗線
}
for(int j=1;j<=400;j++)
{
if(0==(deepth- data+j)%10) //整數米的位置
{
graphics.DrawLine(&spen,40,H*j/400,W+40,H*j/400); //橫細線
if((deepth- data+j)%100==0) //十米整的位置
{
graphics.DrawLine(&pen,40,H*j/400,W+40,H*j/400); //橫粗線
WCHAR buf[160];
wsprintfW(buf, L"%d", (deepth- data+j)/10); //注意是反圖,上面數字大,下面數字小,+40是因最開始一屏是空的,附加上去沒用
graphics.DrawString(buf, -1, &myFont, PointF(0,H*j/400-10), &brushB); //每一個格十米,添加縱向坐標資料
}
}
}
addcurve(graphics , pen0,0,path,data);
addcurve(graphics , pen1,1,path+1,data);
addcurve(graphics , pen2,2,path+2,data);
addcurve(graphics , pen3,3,path+3,data);
addcurve(graphics , pen4,4,path+4,data);
addcurve(graphics , pen5,5,path+5,data);
addcurve(graphics , pen6,6,path+6,data);
addcurve(graphics , pen7,7,path+7,data);
addcurve(graphics , pen8,8,path+8,data);
addcurve(graphics , pen9,9,path+9,data);
addcurve(graphics , pen10,10,path+10,data);
addcurve(graphics , pen11,11,path+11,data);
Graphics gr(pDC1->m_hDC);
gr.DrawImage(bmp1,1,1,0,0,W+50,H-2,UnitPixel);
ReleaseDC(pDC1); //釋放DC;
delete bmp1;
bmp1 =NULL;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/10456.html
標籤:圖形處理/算法
