CWnd::SetScrollPos This method sets the current position of a scroll box and, optionally, redraws the scroll bar to reflect the new position of the scroll box. Setting bRedraw to FALSE is useful whenever the scroll bar will be redrawn by a subsequent call to another function. 这个设置不会影响DC坐标原点
This method sets the current position of a scroll box and, optionally, redraws the scroll bar to reflect the new position of the scroll box. Setting bRedraw to FALSE is useful whenever the scroll bar will be redrawn by a subsequent call to another function.
这个设置不会影响DC坐标原点
我的意思是下面这样,放到我程序里,达到效果了。 CPaintDC dc(this); // device context for painting
dc.SetWindowOrg( GetScrollPos( SB_HORZ), GetScrollPos( SB_VERT));
// TODO: Add your message handler code here
CBrush * pOldBr = dc.SelectObject( &m_brBg);
CRect rcClip;
dc.GetClipBox( rcClip);// dc.FillRect( rcClip, &m_brBg);
dc.Rectangle( CRect( 0, 0, 200 , 200));
dc.SelectObject( pOldBr);
void CLogiShowArea::OnPaint()
{
CPaintDC dc(this); // device context for painting
dc.SetWindowOrg( GetScrollPos( SB_HORZ), GetScrollPos( SB_VERT));
// TODO: Add your message handler code here
CBrush * pOldBr = dc.SelectObject( &m_brBg);
CRect rcClip;
dc.GetClipBox( rcClip);// dc.FillRect( rcClip, &m_brBg);
dc.Rectangle( CRect( 0, 0, 200 , 200));
dc.SelectObject( pOldBr);
}
// TODO: Add your message handler code here
CBrush * pOldBr = dc.SelectObject( &m_brBg);
CRect rcClip(0,0,200,200);
dc.LPToDP(&rcClip);
dc.FillRect( rcClip, &m_brBg);
dc.SelectObject( pOldBr);
这样行不行?