📄 windows.c
字号:
#include"MYGUIConfig.h"
/****************************************************
绘制窗口。
****************************************************/
uint8 GUI_WindowsDraw(WINDOWS *win)
{ uint8 *str,color;
int32 bak, bak1, bak2;
//参数过滤,若窗口起出范围,则返回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; // 判断字符串是否结束
GUI_PutChar(bak, bak1, *str++); // 显示标题
bak += 6;
}
}
//LCD_PenColor=color;
return(1);
}
/****************************************************************************
消隐窗口
***************************************************************************/
uint8 GUI_WindowsHide(WINDOWS *win)
{
uint8 color;
//参数过滤,若窗口起出范围,则返回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);
}
/****************************************************************************
清除窗口文本区
****************************************************************************/
void GUI_WindowsClr(WINDOWS *win)
{ uint8 x0, y0;
uint8 x1, y1;
uint8 color;
//设置要清屏的区域
x0 = win->x + 1;
x1 = win->x + win->with - 2;
y0 = win->y + 13;
y1 = win->y + win->hight - 2;
//使用填充矩形实现清屏
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 + -