这是界面显示部分的代码:
void Fun(void) {
unsigned short i=0,a;
//open_f=0;
GUI_CURSOR_Show();
WM_SetCreateFlags(WM_CF_MEMDEV); /* Automatically use memory devices on all windows */
DesktopColorOld = WM_SetDesktopColor(GUI_BLUE); /* Automatically update desktop window */
/* 建立窗体,包含了资源列表,资源数目, 并指定回调函数 */
//hWin = GUI_CreateDialogBox(aDialogCreate, GUI_COUNTOF(aDialogCreate), _cbCallback, 0, 0, 0);
hWin = GUI_CreateDialogBox(aDialogCreate, GUI_COUNTOF(aDialogCreate), NULL, 0, 0, 0);
/* 设置窗体字体 */
FRAMEWIN_SetFont(hWin, pFont);
/* 获得TEXT 部件的句柄 */
text0 = WM_GetDialogItem(hWin, GUI_ID_TEXT0);
text1 = WM_GetDialogItem(hWin, GUI_ID_TEXT1);
/* 获得slider 部件的句柄 */
slider0 = WM_GetDialogItem(hWin, GUI_ID_SLIDER0);
/* 获得按钮 部件的句柄 */
_ahButton[0] = WM_GetDialogItem(hWin, GUI_ID_BUTTON0);
_ahButton[1] = WM_GetDialogItem(hWin, GUI_ID_BUTTON1);
_ahButton[2] = WM_GetDialogItem(hWin, GUI_ID_BUTTON2);
_ahButton[3] = WM_GetDialogItem(hWin, GUI_ID_BUTTON3);
_ahButton[4] = WM_GetDialogItem(hWin, GUI_ID_BUTTON4);
//按键字体设置
BUTTON_SetFont(_ahButton[0],pFont);
BUTTON_SetFont(_ahButton[1],pFont);
BUTTON_SetFont(_ahButton[2],pFont);
BUTTON_SetFont(_ahButton[3],pFont);
BUTTON_SetFont(_ahButton[4],pFont);
//按键背景色设置
BUTTON_SetBkColor(_ahButton[0],0,GUI_GRAY); //按键背景颜色
BUTTON_SetBkColor(_ahButton[1],0,GUI_GRAY);
BUTTON_SetBkColor(_ahButton[2],0,GUI_GRAY);
BUTTON_SetBkColor(_ahButton[3],0,GUI_GRAY);
BUTTON_SetBkColor(_ahButton[4],0,GUI_GRAY);
//按键前景色设置
BUTTON_SetTextColor(_ahButton[0],0,GUI_WHITE);
BUTTON_SetTextColor(_ahButton[1],0,GUI_WHITE);
BUTTON_SetTextColor(_ahButton[2],0,GUI_WHITE);
BUTTON_SetTextColor(_ahButton[3],0,GUI_WHITE);
BUTTON_SetTextColor(_ahButton[4],0,GUI_WHITE);
listbox1 = WM_GetDialogItem(hWin, GUI_ID_LISTBOX0); //获得对话框里GUI_ID_LISTBOX0项目的句柄
LISTBOX_SetFont(listbox1,pFont); //设置对话框里列表框的字体
SCROLLBAR_CreateAttached(listbox1, SCROLLBAR_CF_VERTICAL); //设置对话框里列表框-卷动方向为下拉
BUTTON_SetBkColor(_ahButton[0],0,GUI_WHITE); //设置对话框里按键CLEAR未被按下的字体颜色
BUTTON_SetBkColor(_ahButton[1],0,GUI_WHITE); //设置对话框里按键CLEAR未被按下的字体颜色
BUTTON_SetBkColor(_ahButton[2],0,GUI_WHITE); //设置对话框里按键CLEAR未被按下的字体颜色
BUTTON_SetBkColor(_ahButton[3],0,GUI_WHITE); //设置对话框里按键CLEAR未被按下的字体颜色
BUTTON_SetBkColor(_ahButton[4],0,GUI_WHITE); //设置对话框里按键CLEAR未被按下的字体颜色
/* 将SD卡根目录下的MP3文件增加到列表框里 */
//a=file_num;
//while(a>0){
// LISTBOX_AddString(listbox1,str[i]);
// i++;
// a--;
//}
while (1)
{
// #if 0
//if(open_f==0){
BUTTON_SetBMPEx(_ahButton[0],BUTTON_BI_UNPRESSED,&play_bt,29,3);/*为按钮设置图片,图片数据为play_bt,图片相对于按钮的坐标为(29,3)*/
BUTTON_SetBMPEx(_ahButton[1],BUTTON_BI_UNPRESSED,&prev_bt,29,3);
BUTTON_SetBMPEx(_ahButton[2],BUTTON_BI_UNPRESSED,&next_bt,29,3);
BUTTON_SetBMPEx(_ahButton[3],BUTTON_BI_UNPRESSED,&bk_bt,29,3);
BUTTON_SetBMPEx(_ahButton[4],BUTTON_BI_UNPRESSED,&bk_bt,29,3);
//}
#if 0
else if(open_f==1){
BUTTON_SetBMPEx(_ahButton[0],BUTTON_BI_UNPRESSED,&pause_bt,29,3);
BUTTON_SetBMPEx(_ahButton[1],BUTTON_BI_UNPRESSED,&prev_bt,29,3);
BUTTON_SetBMPEx(_ahButton[2],BUTTON_BI_UNPRESSED,&next_bt,29,3);
BUTTON_SetBMPEx(_ahButton[3],BUTTON_BI_UNPRESSED,&stop_bt,29,3);
BUTTON_SetBMPEx(_ahButton[4],BUTTON_BI_UNPRESSED,&fast_bt,29,3);
}
else if(open_f==2){
BUTTON_SetBMPEx(_ahButton[0],BUTTON_BI_UNPRESSED,&play_bt,29,3);
BUTTON_SetBMPEx(_ahButton[1],BUTTON_BI_UNPRESSED,&bk_bt,29,3);
BUTTON_SetBMPEx(_ahButton[2],BUTTON_BI_UNPRESSED,&bk_bt,29,3);
BUTTON_SetBMPEx(_ahButton[3],BUTTON_BI_UNPRESSED,&stop_bt,29,3);
BUTTON_SetBMPEx(_ahButton[4],BUTTON_BI_UNPRESSED,&bk_bt,29,3);
}
#endif
//OSTimeDlyHMSM(0, 0, 0, 100); //延时
//SLIDER_SetValue(slider0,mp3_step); //播放进度条刷新
WM_Exec(); //显示刷新
}
}