我有大量数据需要以函数曲线的形式描出来,而且还是随着时间而增多,
为了避免闪烁,我现在内存里先描出来,再贴上,但是CBitmap::CreateCompatibleBitmap(CDC* pDC, int nWidth, int nHeight )
函数似乎有大小限制,参数nWidth到了30000多就该函数就会失败,不知道哪位高人有好办法解决,谢谢!!#define orgx 0#define bmpsizex 30000
#define bmpsizey 600
#define orgy bmpsizey - 50
void CDisplayView::Draw(CDC *_pDC)
{
CDC memDC; CBitmap *poldbitmap;
CPen *poldpen;
memDC.CreateCompatibleDC(_pDC);
if (m_bmpcurve == NULL)
{
m_bmpcurve = new CBitmap; //m_bmpcurve为CBitmap *;
CPen tmppen(PS_SOLID ,0,RGB(0,255,0)); if(0==m_bmpcurve->CreateCompatibleBitmap(_pDC,bmpsizex,bmpsizey))
TRACE("\nThe bitmap creating failed\n");
poldbitmap=memDC.SelectObject(m_bmpcurve);
memDC.FillSolidRect(0,0,bmpsizex,bmpsizey,RGB(255,255,255));
poldpen = memDC.SelectObject(&tmppen);
memDC.MoveTo(orgx,bmpsizey - 50);
memDC.LineTo(bmpsizex,orgy);
memDC.MoveTo(orgx,orgy);
memDC.LineTo(orgx,0);
for (unsigned long cx = 50;cx < bmpsizex; cx += 50)//横轴50个像素/格
{
memDC.MoveTo(cx,orgy);
if ((cx-50)%500 == 0 )
{
memDC.LineTo(cx,orgy - 20);
}
else
{
// memDC.MoveTo(cx,orgy);
memDC.LineTo(cx,orgy - 10);
}
}
for (unsigned long cy = orgy;cy >0; cy -= 10) //纵轴10个像素一格
{
memDC.MoveTo(orgx,cy);
if ((orgy-cy) % 100 == 0)
{
memDC.LineTo(orgx+20,cy); }
else
{
memDC.LineTo(orgx+10,cy);
}
}
.................
为了避免闪烁,我现在内存里先描出来,再贴上,但是CBitmap::CreateCompatibleBitmap(CDC* pDC, int nWidth, int nHeight )
函数似乎有大小限制,参数nWidth到了30000多就该函数就会失败,不知道哪位高人有好办法解决,谢谢!!#define orgx 0#define bmpsizex 30000
#define bmpsizey 600
#define orgy bmpsizey - 50
void CDisplayView::Draw(CDC *_pDC)
{
CDC memDC; CBitmap *poldbitmap;
CPen *poldpen;
memDC.CreateCompatibleDC(_pDC);
if (m_bmpcurve == NULL)
{
m_bmpcurve = new CBitmap; //m_bmpcurve为CBitmap *;
CPen tmppen(PS_SOLID ,0,RGB(0,255,0)); if(0==m_bmpcurve->CreateCompatibleBitmap(_pDC,bmpsizex,bmpsizey))
TRACE("\nThe bitmap creating failed\n");
poldbitmap=memDC.SelectObject(m_bmpcurve);
memDC.FillSolidRect(0,0,bmpsizex,bmpsizey,RGB(255,255,255));
poldpen = memDC.SelectObject(&tmppen);
memDC.MoveTo(orgx,bmpsizey - 50);
memDC.LineTo(bmpsizex,orgy);
memDC.MoveTo(orgx,orgy);
memDC.LineTo(orgx,0);
for (unsigned long cx = 50;cx < bmpsizex; cx += 50)//横轴50个像素/格
{
memDC.MoveTo(cx,orgy);
if ((cx-50)%500 == 0 )
{
memDC.LineTo(cx,orgy - 20);
}
else
{
// memDC.MoveTo(cx,orgy);
memDC.LineTo(cx,orgy - 10);
}
}
for (unsigned long cy = orgy;cy >0; cy -= 10) //纵轴10个像素一格
{
memDC.MoveTo(orgx,cy);
if ((orgy-cy) % 100 == 0)
{
memDC.LineTo(orgx+20,cy); }
else
{
memDC.LineTo(orgx+10,cy);
}
}
.................
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货