zoukankan      html  css  js  c++  java
  • 【Demo 0017】Win32 基本结构体(1)

    由于Windows系统是由C开发而来的,而C语言又是一种面向过程的语言,为了实现一些数据的封装采用了许多结构体并定义了操作结构体相关的函数;

    我们今天选出几个与绘图有关的二个数据结构: RECT, POINT 随便也看看SIZE

    1. RECT – 定义一个矩形的左上角以及右下角座标,此结构体主要用于表示一个矩形区域如: 存储窗体的位置

       

    typedef struct _RECTL       /* rcl */
    {
        LONG    left;
        LONG    top;
        LONG    right;
        LONG    bottom;
    } RECTL, *PRECTL, *LPRECTL;

        相关函数:

        SetRectEmpty Creates an empty rectangle in which all coordinates are set to zero.

        SetRect Sets the coordinates of the specified rectangle.

        CopyRect Copies the coordinates of one rectangle to another.

       

        EqualRect Determines whether the two specified rectangles are equal by comparing the coordinates of their upper-left and lower-right corners.

        IsRectEmpty Determines whether the specified rectangle is empty.

        PtInRect Determines whether the specified point lies within the specified rectangle.

        InflateRect Increases or decreases the width and height of the specified rectangle.

        OffsetRect Moves the specified rectangle by the specified offsets.

        IntersectRect Calculates the intersection of two source rectangles and places the coordinates of the intersection rectangle into the destination rectangle.

        SubtractRect Determines the coordinates of a rectangle formed by subtracting one rectangle from another.

        UnionRect Creates the union of two rectangles.

    2.  POINT – 主要用于存储一个点在坐标系中位置即(x, y)

    typedef struct tagPOINT
    {
        LONG  x;
        LONG  y;
    } POINT, *PPOINT, NEAR *NPPOINT, FAR *LPPOINT;

    3.  SIZE   – 主要用户存放大小即(width, height)

    typedef struct tagSIZE
    {
        LONG        cx;
        LONG        cy;
    } SIZE, *PSIZE, *LPSIZE;

    演示代码

  • 相关阅读:
    深度学习中的激活函数
    23.从上往下打印二叉树
    22.栈的压入、弹出序列
    使用TensorFlow实现DNN
    shell按行读取文件
    linux集群批量执行命令
    CDH升级
    自动微分方法(auto diff)
    快速了解负载均衡
    拼写纠错的利器,BK树算法
  • 原文地址:https://www.cnblogs.com/ztercel/p/2130469.html
Copyright © 2011-2022 走看看