我创建了一个矩形区域用于作图,我想在窗口放大或缩小时这个矩形区域的图素不变,我现在的问题是放大窗口时矩形区域内的笔画变粗,而且之前矩形区域外的作图(就是鼠标划过的笔画)也出现了(之前是不会显示的,但放大窗口就会出现),请教大家我该怎么弄?谢谢!

解决方案 »

  1.   

    可以把问题再说清楚些,在window/view哪个上绘图?怎么绘的,放大缩小什么意思?
      

  2.   

    回1楼,在view上绘图,放大缩小是点击窗口的放大缩小按钮
      

  3.   

    我是直接在scribble代码中改的
    首先在ondraw里:
    void CScribbleView::OnDraw(CDC* pDC)
    {
    CScribbleDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc); // The view delegates the drawing of individual strokes to
    // CStroke::DrawStroke().
    CTypedPtrList<CObList,CStroke*>& strokeList = pDoc->m_strokeList;
    POSITION pos = strokeList.GetHeadPosition();
    while (pos != NULL)
    {
    CStroke* pStroke = strokeList.GetNext(pos);
    pStroke->DrawStroke(pDC);
    }
            }
    然后就是在void CScribbleView::OnMouseMove(UINT, CPoint point)
    {
    // Mouse movement is interesting in the Scribble application
    // only if the user is currently drawing a new stroke by dragging
    // the captured mouse. if (GetCapture() != this)
    return; // If this window (view) didn't capture the mouse,
    // then the user isn't drawing in this window.
    CRgn Rgn;
    Rgn.CreateRectRgn(100,100,400,400); 
    CDC *pDC=GetDC();
    pDC->SelectClipRgn(&Rgn);
    m_pStrokeCur->m_pointArray.Add(point);
    pDC->MoveTo(m_ptPrev);
    pDC->LineTo(point);
    m_ptPrev = point;
    return;
    }
    我是想在窗口放大的时候这个作图的矩形区域不放大,比如原来在小窗口里面100x100的矩形区域,放大窗口后那个矩形区域还是100x100.