19,468
社区成员
发帖
与我相关
我的任务
分享
void CLoEnglishView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
static BOOL sw=FALSE;
CClientDC dc(this);
//back color
CRect rect;
GetClientRect(&rect);
dc.SetMapMode(MM_TEXT);
SetWindowOrgEx(dc, 0, 0,NULL);
SetViewportOrgEx(dc, 0, 0,NULL);
if(sw)
dc.FillSolidRect(0, 0, rect.Width(),rect.Height(), RGB(255, 128, 255));
else
dc.FillSolidRect(0, 0, rect.Width(),rect.Height(), RGB(255, 255, 128));
if(!sw)
{
sw=TRUE;
dc.SetMapMode(MM_LOENGLISH);
SetWindowOrgEx(dc, 0, 0, NULL);
SetViewportOrgEx(dc, rect.right/2, rect.bottom/2,NULL);
}
else
{
sw=FALSE;
dc.SetMapMode(MM_TEXT);
SetWindowOrgEx(dc, 0, 0 ,NULL);
SetViewportOrgEx(dc, rect.right/2, rect.bottom/2,NULL);
}
CPoint pp;
GetViewportOrgEx(dc,&pp);//
rect.OffsetRect(pp.x,pp.y);//
dc.DPtoLP(&rect);
dc.MoveTo(0,0);
dc.LineTo(-rect.Width() / 2, -(rect.Height() / 2));
dc.MoveTo(0,0);
dc.LineTo(rect.Width() / 2, (rect.Height() / 2));
dc.MoveTo(0, 0);
dc.LineTo(-rect.Width() / 2, (rect.Height() / 2));
dc.MoveTo(0, 0);
dc.LineTo(rect.Width() / 2, -(rect.Height() / 2));
CRect rc(-80,-80,80,80);
rc.OffsetRect(pp.x,pp.y);//
dc.DPtoLP(&rc);//
dc.SelectObject(GetStockObject(NULL_BRUSH));
dc.Ellipse(rc);
// CScrollView::OnLButtonDown(nFlags, point);
}