首页 > 技术文章 > GDI 函数

xyyh 2014-02-07 12:36 原文

SetPixel 画像素
COLORREF crColor;
SetPixel (hdc, x, y, crColor) ;
crColor = GetPixel (hdc, x, y) ;


GetCurrentPositionEx (hdc, &pt) ;


LineTo 画直线。
   MoveToEx (hdc, xBeg, yBeg, NULL) ;
  LineTo (hdc, xEnd, yEnd) ;


Polyline和PolylineTo 画一系列相连的直线。
  Polyline (hdc, apt, 5) ;
Polyline与一个MoveToEx函数后面加几个LineTo函数的效果相同,但是,Polyline既不使用也不改变目前位置。PolylineTo有些不同,这个函数使用目前位置作为开始点,并将目前位置设定为最后一根线的终点。


PolyPolyline 画多组相连的线。
  
Arc 画椭圆线。
  Arc(hdc, xLeft, yTop, xRight, yBottom, xStart, yStart, xEnd, yEnd) ;


PolyBezier和PolyBezierTo 画贝塞尔曲线。
 PolyBezier (HDC ,POINT *, int iCount);
既画线也填入所画图形的封闭区域的函数,这些函数是:


Rectangle 画矩形。
  Rectangle (hdc, xLeft, yTop, xRight, yBottom) ;


Ellipse 画椭圆。
  Ellipse (hdc, xLeft, yTop, xRight, yBottom) ;


RoundRect 画带圆角的矩形。
  RoundRect (hdc, xLeft, yTop, xRight, yBottom,
           xCornerEllipse, yCornerEllipse) ;


Pie 画椭圆的一部分,使其看起来像一个扇形。
  Pie(hdc, xLeft, yTop, xRight, yBottom, xStart, yStart, xEnd, yEnd) ;


Chord 画椭圆的一部分,以呈弓形。
   Chord       (hdc, xLeft, yTop, xRight, yBottom, xStart, yStart, xEnd, yEnd) ;


Polygon 和PolyPolygon  画多边形和多个多边形
   Polygon (hdc, apt, iCount);   //若数组中最后一点与第一点不同,windows会加一条线连上两点
   PolyPolygon (hdc, apt, aiCounts, iPolyCount);  //aiCounts是存放每个多边形定点数的数组
多边形的填充模式
SetPolyFillMode (hdc, iMode);
iMode:
ALTERNATE 交替   从一个点发射射线,穿过奇数条边框的区域被填充
WINDING 螺旋   假想的线穿过了奇数条边界线,区域被填入。穿过了偶数条边界线,不同方向的边框线(相对于射线方向)的数目若相等则不填充,若不等则填充。

推荐阅读