Minigui学习--RECT

来源:互联网 发布:paperpass 淘宝 编辑:程序博客网 时间:2024/05/17 09:44

1.RECT

(1)定义:

在common.h文件中有如下定义:

typedef struct _RECT
{
    /**
     * The x coordinate of the upper-left corner of the rectangle.
     */
    int left;
    /**
     * The y coordinate of the upper-left corner of the rectangle.
     */
    int top;
    /**
     * The x coordinate of the lower-right corner of the rectangle.
     */
    int right;
    /**
     * The y coordinate of the lower-right corner of the rectangle.
     */
    int bottom;
} RECT;

typedef RECT* PRECT;

 

在minigui.h文件中有如下定义:

/**
 * \var RECT g_rcScr
 * \brief Contains the rectangle of the whole screen.
 */
extern MG_EXPORT RECT g_rcScr;

/**
 * \def g_rcDesktop
 * \brief Contains the rectangle of desktop of the application.
#define g_rcDesktop     g_rcScr

 

例如:

static RECT welcome_rc = {10, 100, 600, 400};

SetRect (&welcome_rc,  10, 10, g_rcScr.right - 10,g_rcScr.bottom / 2 - 10);

CreateInfo.lx = 0;
CreateInfo.ty = 0;
CreateInfo.rx = g_rcScr.right;
CreateInfo.by = g_rcScr.bottom;

 

(2)相关函数:

static inline void SetRect (RECT* prc, int left, int top, int right, int bottom); //sets the rectangle with specified values,note Defined as an inline function for _USE_NEWGAL

static inline void SetRectEmpty (RECT* prc); //This function will sets all coordinates of the rectangle to be zero, Defined as an inline function for _USE_NEWGAL.

static inline void OffsetRect (RECT* prc, int x, int y); //x must be a negative value to move the rectangle to the left, and  y must be a negative value to move the rectangle up,note Defined as an inline function for _USE_NEWGAL

 

2.POINT

(1)定义:

typedef struct _POINT
{
    /**
     * The x coordinate of the point.
     */
    int x;
    /**
     * The y coordinate of the point.
     */
    int y;
} POINT;

typedef POINT* PPOINT;

 

原创粉丝点击