因为有这样的设置: DT_LEFT | DT_VCENTER | DT_SINGLELINE所以总在一个位置显示

解决方案 »

  1.   

    yPix 是从 0 开始循环吗?
    代码帖多一点出来
      

  2.   

    yPix是1mm的像素个数
    DT_LEFT 是水平从左开始
    DT_VCENTER 是纵向居中
    DT_SINGLELINE 是显示单行
      

  3.   

    doubleByte = csViewTemp.GetAt(subIndex);
    //判断是否是汉字
    if(IsDBCSLeadByte(doubleByte) != 0)
    {
       if(subIndex == 0)
       {
           subIndex = subIndex + 1;
       }
       else if(subIndex != 65 && subIndex != 66)
    {
    subIndex = subIndex + 1;
    }
    else if(subIndex == 66)
    {
    memDC.SelectObject(&DetailFont);
    rc.SetRect(nLeft, yAxis, nRight, yAxis + yPix * 5);
    yAxis = yAxis + yPix * 5;
    memDC.DrawText((LPCTSTR)csViewTemp.Mid(0, 66), &rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
    csViewTemp.Delete(0, 66);
    subIndex = 0;
    }
    else
    {
    memDC.SelectObject(&DetailFont);
    rc.SetRect(nLeft, yAxis, nRight, yAxis + yPix * 5);
    yAxis = yAxis + yPix * 5;
    memDC.DrawText((LPCTSTR)csViewTemp.Mid(0, 67), &rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
    csViewTemp.Delete(0, 67);
    subIndex = 0;
    }

    }
    else
    {
    if(subIndex == 0)
    {
    }
    else if(subIndex == 66)
    {
    memDC.SelectObject(&DetailFont);
    rc.SetRect(nLeft, yAxis, nRight, yAxis + yPix * 5);
    yAxis = yAxis + yPix * 5;
    memDC.DrawText((LPCTSTR)csViewTemp.Mid(0, 67), &rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
    csViewTemp.Delete(0, 67);
    subIndex = 0;
    }
    }
    if(csViewTemp.GetLength() <= 67)
    {memDC.SelectObject(&DetailFont);
    rc.SetRect(nLeft, yAxis, nRight, yAxis + yPix * 5);
    yAxis = yAxis + yPix * 5;
    memDC.DrawText((LPCTSTR)csViewTemp, &rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
    subIndex = csViewTemp.GetLength();
    }
      

  4.   

    外层是个循环我发现个问题我加上CString的Delete的方法就出现不显示第一段的现象Delete这个方法是不是影响memDC的操作了
      

  5.   

    我找出问题了
    我用CString的Delete函数就会画不出来
    不知道是什么原因哪位高手知道呢