コード例 #1
0
/*********************************************************************
*
*       _UserDraw
*
* Function description
*   This routine is called by the GRAPH object before anything is drawn
*   and after the last drawing operation.
*/
void Main_UserDraw (WM_HWIN hWin, int Stage) {
	if (Stage == GRAPH_DRAW_LAST) {
		static char ycText[] = "Amplitude ";//纵坐标单位说明
		static char xcText[] = "Time ";//横坐标单位说明
		static GUI_RECT RectY;
		static GUI_RECT RectX;
		static GUI_RECT RectInvalid;
		static int FontSizeY;//字体高度

		GUI_SetFont(&GUI_Font13_ASCII);//设置字体
		FontSizeY = GUI_GetFontSizeY();//返回字体高度
		WM_GetInsideRect(&RectY);//返回窗口尺寸
		WM_GetInsideRect(&RectX);
		WM_GetInvalidRect(hWin, &RectInvalid);//返回窗口尺寸减去边界尺寸后的坐标
		RectY.x1 = RectY.x0 + FontSizeY;
		RectX.y0 = SCALE_H_Pos + FontSizeY - 2;
		RectX.y1 = RectX.y0 + FontSizeY;
		GUI_SetColor(GUI_YELLOW);
		GUI_DispStringInRectEx(ycText, &RectY, GUI_TA_CENTER, strlen(ycText), GUI_ROTATE_CCW);//纵向显示(GUI_ROTATE_CCW),水平对齐(GUI_TA_HCENTER)
		GUI_DispStringInRectEx(xcText, &RectX, GUI_TA_HCENTER, strlen(xcText), GUI_ROTATE_0);//从左到右显示(GUI_ROTATE_0),水平对齐(GUI_TA_HCENTER)

		/*内存监视-------------------------------------------------------*/
#ifdef MEM_DEBUG__
		MemDisp(200, 200);
#endif
		/*-------------------------------------------------------*/
	}
}
コード例 #2
0
ファイル: WIDGET_GraphXY.c プロジェクト: caicry/uFrame
/*********************************************************************
*
*       _UserDraw
*
* Purpose:
*   This routine is called by the GRAPH object before anything is drawn
*   and after the last drawing operation.
*/
static void _UserDraw(WM_HWIN hWin, int Stage) {
  if (Stage == GRAPH_DRAW_LAST) {
    char acText[] = "Flow Rate L/s";
    GUI_RECT Rect, RectInvalid;
    int FontSizeY;
    GUI_SetFont(&GUI_Font13_ASCII);
    FontSizeY = GUI_GetFontSizeY();
    WM_GetInsideRect(&Rect);
    WM_GetInvalidRect(hWin, &RectInvalid);
    Rect.x1 = Rect.x0 + FontSizeY;
    GUI_SetColor(GUI_RED);
    GUI_DispStringInRectEx(acText, &Rect, GUI_TA_HCENTER, strlen(acText), GUI_ROTATE_CCW);
  }
}