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

    演示代码

  • 相关阅读:
    java timer 指定某时间点执行
    java jdbc 同时操作查询删除操作
    java ResultSet获得总行数
    c# 根据枚举Value 获得名称
    c# 备份数据
    MySQL主从集群搭建
    单机安装MySQL多实例
    2019年度总结
    go goroutine id
    go语言中 json转换--nil
  • 原文地址:https://www.cnblogs.com/ztercel/p/2130469.html
Copyright © 2020-2023  润新知