菜鸟求助!各位!如何用MFC给平行四边形填充颜色?有没有现成的类?

super_chris 2009-02-11 03:53:00
RT
菜鸟求助!各位!如何用MFC给平行四边形填充颜色?有没有现成的类?
是在做一个魔方程序,有这个四边形的四个点的CPoint对象,如何填充它的颜色?谢谢!
...全文
394 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
super_chris 2009-02-11
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 liuzxchina 的回复:]
C/C++ code
BeginPath(hdc);

MoveToEx(hdc, Point1.x, Point1.y, NULL);
LineTo(hdc, Point2.x, Point2.y);
LineTo(hdc, Point3.x, Point3.y);
LineTo(hdc, Point4.x, Point4.y);
LineTo(hdc, Point1.x, Point1.y);

EndPath(hdc);

StrokeAndFillPath(hdc);
[/Quote]原来还可以这样。。谢谢:)
liuzxchina 2009-02-11
  • 打赏
  • 举报
回复

BeginPath(hdc);

MoveToEx(hdc, Point1.x, Point1.y, NULL);
LineTo(hdc, Point2.x, Point2.y);
LineTo(hdc, Point3.x, Point3.y);
LineTo(hdc, Point4.x, Point4.y);
LineTo(hdc, Point1.x, Point1.y);

EndPath(hdc);

StrokeAndFillPath(hdc);
zzz822163 2009-02-11
  • 打赏
  • 举报
回复
可以使用opengl或者directx,用纹理贴图
super_chris 2009-02-11
  • 打赏
  • 举报
回复
up up up up up
super_chris 2009-02-11
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 beyonld 的回复:]
创建一CBrush,再DC.FILLRECT()
[/Quote]这个只能填充矩形吧?我猜
super_chris 2009-02-11
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 fish_gao 的回复:]
这里提供一个简单的方法:
利用CRgn类创建一个区域,然后FillRgn就可以了,FillRgn函数用法参考CDC::FillRgn
[/Quote]那请问 我这个魔方转动之后,这个区域也就变了,那是重新创建CRgn对象呢?还是说CRgn有没有自己更新的功能?谢谢
beyonld 2009-02-11
  • 打赏
  • 举报
回复
创建一CBrush,再DC.FILLRECT()
fish_gao 2009-02-11
  • 打赏
  • 举报
回复
这里提供一个简单的方法:
利用CRgn类创建一个区域,然后FillRgn就可以了,FillRgn函数用法参考CDC::FillRgn

19,464

社区成员

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

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