• 【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;

    演示代码

  • 相关阅读:
    跑酷游戏的一些bug总结(滥用FixedUpdate的坑)
    Unity在编辑器状态下清空控制台信息
    Unity脚本在层级面板中的执行顺序测试3
    IronPython使用
    RSA加密的测试demo
    常用加密算法学习
    c#读写ini文件
    Jrebel激活方法(转)
    ThreadLocal Memory Leak in Java web application
    Java Thread Local – How to use and code sample(转)
  • 原文地址:https://www.cnblogs.com/ztercel/p/2130469.html
Copyright © 2020-2023  润新知