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

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. android 底部菜单栏实现(转)

    1.Android学习之BottomNavigationBar实现Android特色底部导航栏 2.Android底部导航栏的四种实现 3.Android BottomNavigationBar底部导 ...

  2. html 锚点定位

    在html中设置锚点定位我知道的有几种方法.在此和大家分享一下: 1.使用id定位: <a href="#1F" name="1F">锚点1< ...

  3. WCF探索之旅(三)——IIS公布WCF服务

    在之前的博客已经对WCF的基础知识做了介绍.而且做了一个简单的小样例. 假设你看了之前的博客,相信你已经对WCF有了一定的掌握.这篇博客主要说一下怎样把WCF服务公布的IISserver上. 在上篇博 ...

  4. inclusion_tag 看图

  5. SQL 经验总结

    总结日常工作中使用SQL遇到的坑和技巧,一是加深印象,二是方便回顾.会不定期更新. 坑 1.多表联查时要使用表名,如果两个表的有列名相同的情况你没有加别名,那么sql编译器就不知道使用哪个列.这时进行 ...

  6. Chrome性能分析工具lightHouse用法指南

    本文主要讲如何使用Chrome开发者工具linghtHouse进行页面性能分析. 1.安装插件 非常简单,点击右上角的“添加至Chrome”即可. 2.使用方式 1)打开要测试的页面,点击浏览器右上角 ...

  7. 观察OnPaint与OnIdle与OnSize事件

    import wx class SketchWindow(wx.Window): def __init__(self, parent, ID): wx.Window.__init__(self, pa ...

  8. 如何在MySQL中分配innodb_buffer_pool_size

    如何在MySQL中分配innodb_buffer_pool_size innodb_buffer_pool_size是整个MySQL服务器最重要的变量. 1. 为什么需要innodb buffer p ...

  9. ABAP upload file(*.txt *.csv *.xls)

    转自:http://blog.csdn.net/jy00873757/article/details/8534492 在SAP我们经常会用到*.txt, *.csv, *.xls三种文件格式 *.TX ...

  10. AnkhSVN

    安装和配置 签入签出问题 1.安装和配置 ①安装.(貌似默认的安装到C:\Program Files\AnkhSVN 2下,开始菜单也没快捷?) ②源代码管理器设置:打开vs2012,工具→选项→源代 ...