MFC中的一个简单问题

genganpeng 2009-07-13 11:10:02

void CGDIplusDemoView::OnMouseMove(UINT nFlags,CPoint pos) {
if (nFlags != MK_LBUTTON ) {return;}
Graphics graphics(this->m_hWnd);
//this->RedrawWindow();
SolidBrush solidBrush(Color(255,255,0,0));
PointF points[] = {
PointF(20,20),
PointF(160,100),
PointF(140,60),
PointF(60,100)
};
GraphicsPath path;
path.AddClosedCurve(points,4);
Matrix matrix;
matrix.Scale(2,1);
path.Transform(&matrix);
Region pathRegion(&path);
graphics.FillRegion(&solidBrush,&pathRegion);
Point testPoint(pos.x,pos.y);
if (pathRegion.IsVisible(testPoint,&graphics)) {return;}
SolidBrush brush(Color(255,0,0,0));
graphics.FillEllipse(&brush,testPoint.X - 4,testPoint.Y - 4,8,8);
}
// CGDIplusDemoView 绘制

void CGDIplusDemoView::OnDraw(CDC *pDC) {
}

这是MFC中的CGDIplusDemoView.cpp中的两个函数,如何才能将OnMouseMove中的代码实现到输出界面上啊??
...全文
59 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ouyh12345 2009-07-14
  • 打赏
  • 举报
回复
获得输出设备的hwnd,然后用hdc来画
lwykj 2009-07-14
  • 打赏
  • 举报
回复
CDC* dc= GetDC();
再dc 上面画
ReleaseDC(dc);
genganpeng 2009-07-14
  • 打赏
  • 举报
回复
顶一个!!!

19,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧