高中生
最后登录1970-1-1
在线时间 小时
注册时间2018-9-5
|
我用STM32F767驱动7寸触摸屏。
主程序太大了,我想整理一下,就把按钮初始化部分单写到一个文件里。
有写了个头文件。
C源文件如下:
#include "sys.h"
#include "delay.h"
#include "usart.h"
#include "led.h"
#include "key.h"
#include "sdram.h"
#include "tftlcd.h"
#include "ltdc.h"
#include "mpu.h"
#include "timer.h"
#include "usmart.h"
#include "malloc.h"
#include "touch.h"
#include "GUI.h"
#include "WM.h"
#include "GUIDEMO.h"
#include "edit.h"
#include "dropdown.h"
#include "DIALOG.h"
#include "emwin.h"
#include <stdlib.h>
#include <string.h>
#ifndef GUI_FLASH
#define GUI_FLASH
#endif
extern GUI_FLASH const GUI_FONT GUI_Fontst211;
extern GUI_FLASH const GUI_FONT GUI_FontST37AA2;
extern GUI_FLASH const GUI_FONT GUI_Fontyh62;
extern WM_HWIN hWin,hWin1,hWin2,hWin3;
extern BUTTON_Handle hButton1,hButton2,hButton3,hButton4,hButton5,hButton6;
extern BUTTON_Handle hButton7,hButton8,hButton9,hButton10,hButton11;
extern BUTTON_Handle hButton12,hButton13,hButton14,hButton15;
extern BUTTON_Handle hButton16,hButton17,hButton18,hButton19;
extern const GUI_WIDGET_CREATE_INFO _aDialogCreate[];
//按钮初始化
void BUTTON_Init(void)
{
hButton1 = WM_GetDialogItem(hWin, GUI_ID_BUTTON1); //获取按钮句柄
hButton2 = WM_GetDialogItem(hWin, GUI_ID_BUTTON2); //获取按钮句柄
hButton3 = WM_GetDialogItem(hWin, GUI_ID_BUTTON3); //获取按钮句柄
hButton4 = WM_GetDialogItem(hWin, GUI_ID_BUTTON4); //获取按钮句柄
hButton5 = WM_GetDialogItem(hWin, GUI_ID_BUTTON5); //获取按钮句柄
BUTTON_SetBkColor(hButton1,0,GUI_WHITE); //设置按钮颜色
BUTTON_SetBkColor(hButton2,0,GUI_WHITE); //设置按钮颜色
BUTTON_SetBkColor(hButton3,0,GUI_WHITE); //设置按钮颜色
BUTTON_SetBkColor(hButton4,0,GUI_WHITE); //设置按钮颜色
BUTTON_SetBkColor(hButton5,0,GUI_WHITE); //设置按钮颜色
BUTTON_SetFont(hButton1,&GUI_FontST37AA2); //设置按钮字体
BUTTON_SetFont(hButton2,&GUI_FontST37AA2); //设置按钮字体
BUTTON_SetFont(hButton3,&GUI_FontST37AA2); //设置按钮字体
BUTTON_SetFont(hButton4,&GUI_FontST37AA2); //设置按钮字体
BUTTON_SetFont(hButton5,&GUI_FontST37AA2); //设置按钮字体
BUTTON_SetText(hButton1, "设置"); //按钮文本显示
BUTTON_SetText(hButton2, "标定"); //按钮文本显示
BUTTON_SetText(hButton3, "查询");
//BUTTON_SetText(hButton4,"鍔涘 |
|