我做了一个多文档程序,其中一个窗口绘制了一副伪彩图,我现在想实现对选中区域进行放大重绘工作。比如放大三倍
以下是我绘制伪彩小矩形块的代码:
void CMyView::plot(double *depth)
{
    CMyDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
    //LorR++;//标记左阵还是右阵
pDoc->WeiCai_change=0;
CRect rectCleanUp;
    CRect rectDraw;    int nPlotHeight=nBottom-nTop-2;
    int nPlotWidth=nRight-nLeft; ////////////控制每次瀑布图的显示
int nShiftPixels=(int)nPlotHeight/12;//注意除数应能整除nPlotHeight
//m_nPlotHeight的大小要设计? if (m_dcPlot.GetSafeHdc() != NULL)
{
m_dcPlot.BitBlt(nLeft, nTop+nShiftPixels, 
  nPlotWidth, nPlotHeight-nShiftPixels, &m_dcPlot, 
  nLeft, nTop, SRCCOPY) ;//把原图变矮后重新载入 rectCleanUp.left = nLeft ;//要清除的区域
rectCleanUp.right=nRight;
rectCleanUp.top=nTop;
rectCleanUp.bottom=nTop+nShiftPixels ;     
     double dRange=pDoc->max_depth-pDoc->min_depth; rectDraw.top=rectCleanUp.top+1;//重新画
rectDraw.bottom=rectCleanUp.bottom-1;
rectDraw.left=rectCleanUp.left+3;
rectDraw.right=rectCleanUp.right-10;        int    nHeight=rectDraw.Height();
int    nWidthPixel=rectDraw.Width()/22-3;

double scale=nHeight/dRange;
CPoint  LTpoint[12];
CPoint  RBpoint[12];
int i,biaozhi;
if((pDoc->LorR%2)==1)//左右阵??
{
for(i=0;i<12;i++)
{
               LTpoint[i].x=rectDraw.left+i*nWidthPixel;
           LTpoint[i].y=rectDraw.top;
   RBpoint[i].x=rectDraw.left+(i+1)*nWidthPixel;
   RBpoint[i].y=rectDraw.bottom-1;
}
CRect rectRight;
rectRight.left=rectDraw.left+(rectDraw.Width()/2)-3;
            rectRight.right=rectDraw.right;
rectRight.top=rectDraw.top;
rectRight.bottom=rectDraw.bottom-1;
COLORREF m_cleanRColor;//伪彩小矩形背景颜色变量            
            m_cleanRColor=RGB(45,62,92);//设置背景颜色
CBrush bkBrush;//声明并建立画笔
            bkBrush.CreateSolidBrush(m_cleanRColor);    
            m_dcPlot.FillRect(&rectRight,&bkBrush);
//-------------0#
COLORREF m_crVColor;
        m_crVColor=RGB(128,0,0);
            CPen VPen;//生成并建立画笔
        VPen.CreatePen(PS_SOLID,2,m_crVColor);
        m_dcPlot.SelectObject(&VPen);
        int x;
        x=(nRight-nLeft)/2+10;
        m_dcPlot.MoveTo(x,nTop);
        m_dcPlot.LineTo(x,nBottom);
}
else
{
             for(i=0;i<12;i++)
{
               LTpoint[i].x=rectDraw.left+(i+12)*nWidthPixel+20;
           LTpoint[i].y=rectDraw.top;
   RBpoint[i].x=rectDraw.left+(i+13)*nWidthPixel+20;
   RBpoint[i].y=rectDraw.bottom-1;
}
CRect rectLeft;
rectLeft.left=rectDraw.left;
            rectLeft.right=rectDraw.right-(rectDraw.Width()/2)-4;
rectLeft.top=rectDraw.top;
rectLeft.bottom=rectDraw.bottom;
COLORREF m_cleanLColor;//伪彩小矩形背景颜色变量            
            m_cleanLColor=RGB(45,62,92);//设置背景颜色
CBrush bkBrush;//声明并建立画笔
            bkBrush.CreateSolidBrush(m_cleanLColor);    
            m_dcPlot.FillRect(&rectLeft,&bkBrush);

//-------------0#
COLORREF m_crVColor1;
        m_crVColor1=RGB(128,0,0);
            CPen VPen1;//生成并建立画笔
        VPen1.CreatePen(PS_SOLID,2,m_crVColor1);
        m_dcPlot.SelectObject(&VPen1);
        int x;
        x=(nRight-nLeft)/2+10;
        m_dcPlot.MoveTo(x,nTop);
        m_dcPlot.LineTo(x,nBottom);
}
for(i=0;i<12;i++)
{
if(i<12)
{
double temp=pDoc->m_depths[i];
        for(int j=0;j<11;j++)
{
   if(temp>=ReferBarVal[j]&&temp<ReferBarVal[j+1])
   {    
  biaozhi=j;//标志溢出了!!!!深度值大于100了
   }
}
CPen  pen;
    CPen* pOldPen;  
    pen.CreatePen(PS_SOLID,1,RGB(0,0,0));
    pOldPen=m_dcPlot.SelectObject(&pen);
    m_dcPlot.Rectangle(LTpoint[i].x,LTpoint[i].y,RBpoint[i].x,RBpoint[i].y);
m_dcPlot.SelectObject(pOldPen);
            CRect rectWeiCai;
rectWeiCai.left=LTpoint[i].x+1;
            rectWeiCai.right=RBpoint[i].x-1;
rectWeiCai.top=LTpoint[i].y+1;
rectWeiCai.bottom=RBpoint[i].y-1;
COLORREF m_WeicaiColor;//伪彩小矩形背景颜色变量            
            m_WeicaiColor=BarColor[biaozhi];//设置背景颜色            
        CBrush bkBrush;//声明并建立画笔
            bkBrush.CreateSolidBrush(m_WeicaiColor);    
            m_dcPlot.FillRect(&rectWeiCai,&bkBrush);//填充背景颜色
    
}
 }
}
}