zoukankan      html  css  js  c++  java
  • 【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;

    演示代码

  • 相关阅读:
    定位IO瓶颈的方法,iowait低,IO就没有到瓶颈?
    10分钟检查自己的系统性能数据
    netperf使用指南
    如何看内核源码
    xxx
    os.path 模块
    目前中国智能语音产业的格局、现状
    NLP-python 自然语言处理01
    15本经典金融投资著作
    写给步入工作的自己
  • 原文地址:https://www.cnblogs.com/ztercel/p/2130342.html
Copyright © 2011-2022 走看看