2 hongshiya HONGSHIYA 于 2013.10.18 11:19 提问

谁能帮忙把这个VC++程序上运行的纵坐标改动一下啊,跪求,急用……

把第一个纵坐标改成0-20,第二个改成0-500,现在不能改动,而且已改动两个都会同时变化,且图形并不随改动值的变化而变化,急用,跪求了……不胜感激……
void CScope::DrawAxis(CDC *pDC)
{
CFont *pOldFont;
int i,nPosY;
CString str;
pOldFont = pDC->SelectObject(&m_FontAxis);
pDC->SetTextColor(RGB(255,255,0));
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextAlign(TA_RIGHT|TA_BASELINE);
int nCenterY = m_rectCurve.top+(int)((double)m_nBase/(double)m_nRange*m_rectCurve.Height());
nPosY = nCenterY;
if(nPosY<=m_rectCurve.top+10)
nPosY += 10;
if(m_dDimY pDC->TextOut(m_rectCurve.left-2,nPosY,CString("0.0"));
else
pDC->TextOut(m_rectCurve.left-2,nPosY,CString("0"));

for(i=1;i<=14;i++)
{
    nPosY =nCenterY+i*m_rectCurve.Height()/14;
    if(nPosY<=m_rectCurve.bottom)
    {
        if(m_dDimY<1)
            str.Format("%.1f",-i*m_dDimY);
        else if(m_dDimY<1000)
            str.Format("%.0f",-i*m_dDimY);
        else
            str.Format("%.0fK",-i*m_dDimY/1000);
        pDC->TextOut(m_rectCurve.left-2,nPosY,str);
    }
}

for(i=1;i<=14;i++)
{
    nPosY = nCenterY-i*m_rectCurve.Height()/14;
    if(nPosY>=m_rectCurve.top)
    {
        if(nPosY<=m_rectCurve.top+10)
            nPosY += 10;
        if(m_dDimY<1)
            str.Format("%.1f",i*m_dDimY);
        else if(m_dDimY<1000)
            str.Format("%.0f",i*m_dDimY);
        else
            str.Format("%.0fK",i*m_dDimY/1000);
        pDC->TextOut(m_rectCurve.left-2,nPosY,str);
    }
}


//横坐标
pDC->SetTextAlign(TA_LEFT|TA_TOP);
pDC->TextOut(m_rectCurve.left,m_rectCurve.bottom+2,CString("0"));
pDC->SetTextAlign(TA_CENTER|TA_TOP);
for(i=1;i<=13;i++)
{
    str.Format("%.0f",2*i*m_dDimT);
    pDC->TextOut(m_rectCurve.left+i*m_rectCurve.Width()/14,m_rectCurve.bottom+2,str);
}

pDC->SetTextAlign(TA_RIGHT|TA_TOP);
//str.Format("%.0f",2*14*m_dDimT);
str.Format("T(s)");
pDC->TextOut(m_rectCurve.right+4,m_rectCurve.bottom+2,str);
pDC->SelectObject(&pOldFont);

}

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!