首先用VC 2005编写的代码,低于20帧 CDC* pDC = this->GetDC(); 
static bool nFlag = true; 
Graphics graphics(pDC->m_hDC); 
Bitmap bmp(600, 600); 
Graphics g(&bmp); LinearGradientBrush* brush; 
long start = clock(), end(0); if(nFlag) 

brush = new LinearGradientBrush(PointF(0.0f, 0.0f), 
PointF(700.0f, 300.0f), Color::Red, Color::Blue); 
nFlag = false; 

else 

brush = new LinearGradientBrush(PointF(0.0f, 0.0f), 
PointF(700.0f, 300.0f), Color::Blue, Color::Red); 
nFlag = true; 

for(int j = 0; j < 60; j ++) 

for(int i = 0; i < 60; i++) 

g.FillEllipse(brush, i * 10, j * 10, 10, 10); 


graphics.DrawImage(&bmp, 0, 0); 
delete brush; end = clock(); 
long result = end - start; CString strMsg; 
strMsg.Format("%d 帧", 1000 / result); pDC->DrawText(strMsg, CRect(700, 10, 750, 50), DT_BOTTOM); 
this->ReleaseDC(pDC); 下面的是C# 2005编写的,稳定在25帧左右: 
            DateTime t1 = DateTime.Now; 
            Bitmap bmp = new Bitmap(600, 600); 
            Graphics g = Graphics.FromImage(bmp); 
            if (flag) 
            { 
                brush = new LinearGradientBrush(new PointF(0.0f, 0.0f), 
                        new PointF(700.0f, 300.0f), Color.Red, Color.Blue); 
                flag = false; 
            } 
            else 
            { 
                brush = new LinearGradientBrush(new PointF(0.0f, 0.0f), 
                        new PointF(700.0f, 300.0f), Color.Blue, Color.Red); 
                flag = true; 
            } 
            for (int j = 0; j < 60; j++) 
            { 
                for (int i = 0; i < 60; i++) 
                { 
                    g.FillEllipse(brush, i * 10, j * 10, 10, 10); 
                } 
            } 
            this.CreateGraphics().DrawImage(bmp, 0, 0); 
            DateTime t2 = DateTime.Now; 
            TimeSpan sp = t2 - t1; 
            float per = 1000 / sp.Milliseconds; 
            this.label1.Text = "速度:" + per.ToString() + "帧/秒"; 这两段代码都是使用的定时器,定时时间在10毫秒,为什么他们跑的帧数差别怎么大?还是我写的代码有问题?