//Global Variable
int i,j;
int k,l;
// CFaceView drawing
void CFaceView::OnDraw(CDC* pDC)
{
CFaceDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CClientDC *abc = new CClientDC(this);
CPen pen;
pen.CreatePen(PS_SOLID,2,RGB(255,0,0));
abc->SelectObject(pen);
CRect rc;
GetClientRect(rc);
j= rc.bottom/2;
i = rc.right/2;
abc->Ellipse(i-100,j-100,i+100,j+100);
abc->Ellipse(i-60,j-60,i-30,j-30);
abc->Ellipse(i+60,j-60,i+30,j-30);
//abc->Ellipse(i-60,j-60,i-50,j-50);
//abc->Ellipse(i-10,j-10,i+10,j+10);
}
void CFaceView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CClientDC *abc = new CClientDC(this);
CPen pen;
pen.CreatePen(PS_SOLID,2,RGB(255,0,0));
abc->SelectObject(pen);
// For Left and Right
if(point.x > i)
{
RedrawWindow();
abc->Ellipse(i-30,j-50,i-40,j-40);
abc->Ellipse(i+50,j-50,i+60,j-40);
}
else
{
RedrawWindow();
abc->Ellipse(i-50,j-50,i-60,j-40);
abc->Ellipse(i+30,j-50,i+40,j-40);
}
//For up and Down
/*
if(point.y <>
{
RedrawWindow();
abc->Ellipse(i-40,j-60,i-50,j-50);
abc->Ellipse(i+40,j-60,i+50,j-50);
}
else
{
RedrawWindow();
abc->Ellipse(i-40,j-40,i-50,j-30);
abc->Ellipse(i+40,j-40,i+50,j-30);
}
*/
CView::OnMouseMove(nFlags, point);
}
Friday, November 6, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment