用当前的笔绘制一个由两个或多个点(顶点)连接的多边形。

BOOL Polygon(
LPPOINT lpPoints,
int nCount
);

lpPoints

指向一个指定多边形顶点的点。数组中的每一点都是一个点结构或一个CPoint对象。

nCount

指定数组中顶点的数量。

返回值

如果函数成功,则非零;否则0。

 void CDCView::DrawPolygon(CDC* pDC)
{
// find the client area
CRect rect;
GetClientRect(rect); // draw with a thick blue pen
CPen penBlue(PS_SOLID, , RGB(, , ));
CPen* pOldPen = pDC->SelectObject(&penBlue); // and a solid red brush
CBrush brushRed(RGB(, , ));
CBrush* pOldBrush = pDC->SelectObject(&brushRed); // Find the midpoints of the top, right, left, and bottom
// of the client area. They will be the vertices of our polygon.
CPoint pts[];
pts[].x = rect.left + rect.Width()/;
pts[].y = rect.top; pts[].x = rect.right;
pts[].y = rect.top + rect.Height()/; pts[].x = pts[].x;
pts[].y = rect.bottom; pts[].x = rect.left;
pts[].y = pts[].y; // Calling Polygon() on that array will draw three lines
// between the points, as well as an additional line to
// close the shape--from the last point to the first point
// we specified.
pDC->Polygon(pts, ); // Put back the old objects.
pDC->SelectObject(pOldPen);
pDC->SelectObject(pOldBrush);
}

Polygon的更多相关文章

  1. [LeetCode] Convex Polygon 凸多边形

    Given a list of points that form a polygon when joined sequentially, find if this polygon is convex ...

  2. 结合谷歌地图多边形(polygon)与Sql Server 2008的空间数据类型计算某个点是否在多边形内的注意事项

    首先在利用 GEOGRAPHY::STPolyFromText(@GeoStr, 4326) 这样的函数把字符串转换为Geography类型时,字符串里经纬度的顺序是 “经度[空格]纬度”,即“lon ...

  3. [svg 翻译教程]Polyline(折线)polygon(多边形)

    原文: http://tutorials.jenkov.com/svg/polygon-element.html Polyline 虽然说这个 元素我没用过,但是还是蛮强大的,也翻译下 示例 < ...

  4. [OpenGL][SharpGL]用Polygon Offset解决z-fighting和stitching问题

    [OpenGL][SharpGL]用Polygon Offset解决z-fighting和stitching问题 本文参考了(http://www.zeuscmd.com/tutorials/open ...

  5. WebGIS中基于AGS的画圆查询简析以及通过Polygon来构造圆的算法

    文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/. 1.背景 某个项目需求中需要在前端进行画圆查询,将圆范围上的多边形要素 ...

  6. 【ASC 23】G. ACdream 1429 Rectangular Polygon --DP

    题意:有很多棍子,从棍子中选出两个棍子集合,使他们的和相等,求能取得的最多棍子数. 解法:容易看出有一个多阶段决策的过程,对于每个棍子,我们有 可以不选,或是选在第一个集合,或是选在第二个集合 这三种 ...

  7. libgdx 裁剪多边形(clip polygon、masking polygon)

    直接放例子代码,代码中以任意四边形为例,如果需要做任意多边形,注意libgdx不能直接用ShapeRender填充多边形,需要先切割成三角形. public static void drawClip( ...

  8. Leetcode: Convex Polygon

    Given a list of points that form a polygon when joined sequentially, find if this polygon is convex ...

  9. 十五、polygon API

    How polygons are handled internally The five basic polygonal API classes Construction History and Tw ...

  10. [javascript svg fill stroke stroke-width points polygon属性讲解] svg fill stroke stroke-width points polygon绘制多边形属性并且演示polyline和polygon区别讲解

    <!DOCTYPE html> <html lang='zh-cn'> <head> <title>Insert you title</title ...

随机推荐

  1. 模式识别之基础---mqdf分类器==MQDF改进的二次分类器

    QDF假设样本符合高斯分布,通过估计均值与协方差矩阵,训练分类器.但是由于特征维数较高,时空复杂度较高.(协方差矩阵的维数为 特征维数*特征维数).而且协方差矩阵往往存在不满秩无法求逆的情况(样本数& ...

  2. jQuery+bootstrap实现美化警告/确认/提示对话框插件

    http://www.html580.com/12067/demo http://craftpip.github.io/jquery-confirm/

  3. linux find 根据条件查找文件

    版权为个人所有,欢迎转载如转载请说明出处.(东北大亨) http://www.cnblogs.com/northeastTycoon/p/5513231.html 1. 实现说明 按照某一个时间点查找 ...

  4. Android中RelativeLayout各个属性及其含义

    android:layout_above="@id/xxx"  --将控件置于给定ID控件之上android:layout_below="@id/xxx"  - ...

  5. 在ios中使用单例模式编程

    本文转载至 http://blog.csdn.net/remote_roamer/article/details/7107007     1.    @implementation Singleton ...

  6. 九度OJ 1171:C翻转 (矩阵计算)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4649 解决:1530 题目描述: 首先输入一个5 * 5的数组,然后输入一行,这一行有四个数,前两个代表操作类型,后两个数x y代表需操作 ...

  7. 九度OJ 1164:旋转矩阵 (矩阵运算)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3188 解决:1245 题目描述: 任意输入两个9阶以下矩阵,要求判断第二个是否是第一个的旋转矩阵,如果是,输出旋转角度(0.90.180. ...

  8. var foo = "11"+2+"1"; console.log(foo); //1121 好多文章答案写错了,我发下给初学的朋友看到,以免一开始就学错了

    体会加一个字符串'1' 和 减去一个字符串'1'的不同 var foo = "11"+2-"1"; console.log(foo); //111 consol ...

  9. 题解 P1387 【最大正方形】

    传送门 搞不清楚为什么这一题要DP . . . . . . 思路: \(n\le100\),考虑暴力. 要求一大块区间内都是1,考虑前缀和. 在矩阵中求一个符合条件的子矩阵,考虑\(n^3\)的&qu ...

  10. SAP 4代增强

    *20170325 160000 以下之外, 还有:.替代, -用过一次:.BTE -没用过,需要学习: 第二代增强和第三代增强的差别: 1.Tcode 不同:第二代: CMOD 增强管理,SMOD ...