?? windows.c
字號:
?
+
#include"MYGUIConfig.h"
/****************************************************
繪制窗口。
****************************************************/
uint8 GUI_WindowsDraw(WINDOWS *win)
{ uint8 *str,color;
int32 bak, bak1, bak2;
//參數(shù)過濾,若窗口起出范圍,則返回0
if( ( (win->with)<20 ) || ( (win->hight)<20 ) ) return(0); // 寬度、高度檢查,限制最小窗口
if( (win->x + win->with ) > GUI_LCM_XMAX ) return(0); // 窗口寬度是否溢出
if( (win->y + win->hight ) > GUI_LCM_YMAX ) return(0); // 窗口高度是否溢出
// 開始畫窗口
color=LCD_PenColor;
LCD_PenColor=LCD_BGColor;
GUI_RectangleFill(win->x, win->y, win->x + win->with - 1, win->y + win->hight - 1);
LCD_PenColor=color;
GUI_Rectangle(win->x, win->y, win->x + win->with - 1, win->y + win->hight - 1);// 畫窗口
GUI_HLine(win->x, win->y + 12, win->x + win->with - 1); // 畫標題目欄
GUI_RLine(win->x + 12, win->y, win->y + 12); // 畫關閉窗號按鈕
GUI_Line(win->x, win->y, win->x + 12, win->y + 12);
GUI_Line(win->x + 12, win->y, win->x, win->y + 12);
//寫標題
//color=LCD_PenColor;
// LCD_PenColor=LCD_Zcolor;
if( win->title != NULL )
{
str = win->title;
bak = win->x + 15; //修改這里
bak1 = win->y + 2;
bak2 = win->x + win->with -1;
while(1)
{
if( (bak+8) > bak2 ) break; // 判斷標題是否溢出
if(*str=='\0') break; // 判斷字符串是否結(jié)束
GUI_PutChar(bak, bak1, *str++); // 顯示標題
bak += 6;
}
}
//LCD_PenColor=color;
return(1);
}
/****************************************************************************
消隱窗口
***************************************************************************/
uint8 GUI_WindowsHide(WINDOWS *win)
{
uint8 color;
//參數(shù)過濾,若窗口起出范圍,則返回0
if( ( (win->with)<20 ) || ( (win->hight)<20 ) ) return(0); // 寬度、高度檢查,限制最小窗口
if( (win->x + win->with ) > GUI_LCM_XMAX ) return(0); // 窗口寬度是否溢出
if( (win->y + win->hight ) > GUI_LCM_YMAX ) return(0); // 窗口高度是否溢出
/* 消隱窗口 */
color=LCD_PenColor;
LCD_PenColor=LCD_BGColor;
GUI_RectangleFill(win->x, win->y, win->x + win->with - 1, win->y + win->hight - 1);
LCD_PenColor=color;
return(1);
}
/****************************************************************************
清除窗口文本區(qū)
****************************************************************************/
void GUI_WindowsClr(WINDOWS *win)
{ uint8 x0, y0;
uint8 x1, y1;
uint8 color;
//設置要清屏的區(qū)域
x0 = win->x + 1;
x1 = win->x + win->with - 2;
y0 = win->y + 13;
y1 = win->y + win->hight - 2;
//使用填充矩形實現(xiàn)清屏
color=LCD_PenColor;
LCD_PenColor=LCD_BGColor;
GUI_RectangleFill(x0, y0, x1, y1);
LCD_PenColor=color;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -