VC++ 窗口重绘
voidCTest3View::OnKeyDown(UINTnChar,UINTnRepCnt,UINTnFlags){//TODO:Addyourmessagehand...
void CTest3View::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
switch(nChar)
{
case VK_DOWN:
pos_y += 100;
OnPaint();
break;
case 'A':
MessageBox("Click: A","O",0);
break;
}
CView::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CTest3View::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
dc.TextOut(pos_x,pos_y,"这里");//sprintf("%s.%s[%s]",pos_x,pos_y,"这里"));
// Do not call CView::OnPaint() for painting messages
}
为什么在按下"方向键下"的时候,不发生重绘?
而在改变窗口大小时才重绘? 展开
{
// TODO: Add your message handler code here and/or call default
switch(nChar)
{
case VK_DOWN:
pos_y += 100;
OnPaint();
break;
case 'A':
MessageBox("Click: A","O",0);
break;
}
CView::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CTest3View::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
dc.TextOut(pos_x,pos_y,"这里");//sprintf("%s.%s[%s]",pos_x,pos_y,"这里"));
// Do not call CView::OnPaint() for painting messages
}
为什么在按下"方向键下"的时候,不发生重绘?
而在改变窗口大小时才重绘? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询