• 【Demo 0016】Windows 基本数据结构


    由于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;

    演示代码

  • 相关阅读:
    date format记录
    python同时遍历两个list
    Windbg分析DMP文件
    DNS原理及其解析过程(转)
    有关正则表达式的详细内容
    sizeof _countof _tcslen的比较
    关于androidX
    UML类图
    springBoot 访问html页面遇到的坑
    hashmap 的实现原理
  • 原文地址:https://www.cnblogs.com/ztercel/p/2130342.html
Copyright © 2020-2023  润新知