📄 foodnurritiondlg.cpp
字号:
// FoodNurritionDlg.cpp : implementation file
//
#include "stdafx.h"
#include "FoodMenu.h"
#include "FoodNurritionDlg.h"
#include "List1Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFoodNurritionDlg dialog
CFoodNurritionDlg::CFoodNurritionDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFoodNurritionDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFoodNurritionDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CFoodNurritionDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFoodNurritionDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFoodNurritionDlg, CDialog)
//{{AFX_MSG_MAP(CFoodNurritionDlg)
ON_BN_CLICKED(IDC_MEAT_BUTTON1, OnMeatButton1)
ON_BN_CLICKED(IDC_SEAFOOD_BUTTON4, OnSeafoodButton4)
ON_BN_CLICKED(IDC_FRUIT_BUTTON2, OnFruitButton2)
ON_BN_CLICKED(IDC_DAIRY_BUTTON3, OnDairyButton3)
ON_BN_CLICKED(IDC_VEGETABLE_BUTTON5, OnVegetableButton5)
ON_BN_CLICKED(IDC_OTHER_BUTTON6, OnOtherButton6)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFoodNurritionDlg message handlers
void CFoodNurritionDlg::OnMeatButton1()
{
// TODO: Add your control notification handler code here
CList1Dlg ListDlg;
ListDlg.Filename=L"\\Storage Card\\foodMenuData\\食物营养\\肉类蛋类.txt";
isExistfile=FindFirstFile(ListDlg.Filename,&lpFileData);
if(isExistfile==INVALID_HANDLE_VALUE)
{
MessageBox(TEXT("没有这种食物的资料"),TEXT("出错啦!"),MB_ICONASTERISK |MB_OK);
FindClose(isExistfile);
return ;
}
FindClose(isExistfile);
ListDlg.DoModal();
}
void CFoodNurritionDlg::OnSeafoodButton4()
{
// TODO: Add your control notification handler code here
CList1Dlg ListDlg;
ListDlg.Filename=L"\\Storage Card\\foodMenuData\\食物营养\\水产类.txt";
isExistfile=FindFirstFile(ListDlg.Filename,&lpFileData);
if(isExistfile==INVALID_HANDLE_VALUE)
{
MessageBox(TEXT("没有这种食物的资料"),TEXT("出错啦!"),MB_ICONASTERISK |MB_OK);
FindClose(isExistfile);
return ;
}
FindClose(isExistfile);
ListDlg.DoModal();
}
void CFoodNurritionDlg::OnFruitButton2()
{
// TODO: Add your control notification handler code here
CList1Dlg ListDlg;
ListDlg.Filename=L"\\Storage Card\\foodMenuData\\食物营养\\水果类.txt";
isExistfile=FindFirstFile(ListDlg.Filename,&lpFileData);
if(isExistfile==INVALID_HANDLE_VALUE)
{
MessageBox(TEXT("没有这种食物的资料"),TEXT("出错啦!"),MB_ICONASTERISK |MB_OK);
FindClose(isExistfile);
return ;
}
FindClose(isExistfile);
ListDlg.DoModal();
}
void CFoodNurritionDlg::OnDairyButton3()
{
// TODO: Add your control notification handler code here
CList1Dlg ListDlg;
ListDlg.Filename=L"\\Storage Card\\foodMenuData\\食物营养\\乳制品类.txt";
isExistfile=FindFirstFile(ListDlg.Filename,&lpFileData);
if(isExistfile==INVALID_HANDLE_VALUE)
{
MessageBox(TEXT("没有这种食物的资料"),TEXT("出错啦!"),MB_ICONASTERISK |MB_OK);
FindClose(isExistfile);
return ;
}
FindClose(isExistfile);
ListDlg.DoModal();
}
void CFoodNurritionDlg::OnVegetableButton5()
{
// TODO: Add your control notification handler code here
CList1Dlg ListDlg;
ListDlg.Filename=L"\\Storage Card\\foodMenuData\\食物营养\\蔬菜类.txt";
isExistfile=FindFirstFile(ListDlg.Filename,&lpFileData);
if(isExistfile==INVALID_HANDLE_VALUE)
{
MessageBox(TEXT("没有这种食物的资料"),TEXT("出错啦!"),MB_ICONASTERISK |MB_OK);
FindClose(isExistfile);
return ;
}
FindClose(isExistfile);
ListDlg.DoModal();
}
void CFoodNurritionDlg::OnOtherButton6()
{
// TODO: Add your control notification handler code here
CList1Dlg ListDlg;
ListDlg.Filename=L"\\Storage Card\\foodMenuData\\食物营养\\其它类.txt";
isExistfile=FindFirstFile(ListDlg.Filename,&lpFileData);
if(isExistfile==INVALID_HANDLE_VALUE)
{
MessageBox(TEXT("没有这种食物的资料"),TEXT("出错啦!"),MB_ICONASTERISK |MB_OK);
FindClose(isExistfile);
return ;
}
FindClose(isExistfile);
ListDlg.DoModal();
}
BOOL CFoodNurritionDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
/////////////////////////////////////////////////////////////////////////
rou_dan_lei.LoadBitmaps(IDB_swyy_rou_dan_lei,IDB_swyy_rou_dan_lei);
sui_can_lei.LoadBitmaps(IDB_swyy_suican_lei,IDB_swyy_suican_lei);
sui_guo_lei.LoadBitmaps(IDB_swyy_suiguo_lei,IDB_swyy_suiguo_lei);
sucai_lei.LoadBitmaps(IDB_swyy_sucailei,IDB_swyy_sucailei);
ru_zi_ping_lei.LoadBitmaps(IDB_swyy_ruzipin_lei,IDB_swyy_ruzipin_lei);
other_lei.LoadBitmaps(IDB_swyy_other,IDB_swyy_other);
VERIFY(rou_dan_lei.SubclassDlgItem(IDC_MEAT_BUTTON1, this));
VERIFY(sui_can_lei.SubclassDlgItem(IDC_SEAFOOD_BUTTON4, this));
VERIFY(sui_guo_lei.SubclassDlgItem(IDC_FRUIT_BUTTON2, this));
VERIFY(sucai_lei.SubclassDlgItem(IDC_VEGETABLE_BUTTON5, this));
VERIFY(ru_zi_ping_lei.SubclassDlgItem(IDC_DAIRY_BUTTON3, this));
VERIFY(other_lei.SubclassDlgItem(IDC_OTHER_BUTTON6, this));
rou_dan_lei.SizeToContent();
sui_can_lei.SizeToContent();
sui_guo_lei.SizeToContent();
sucai_lei.SizeToContent();
ru_zi_ping_lei.SizeToContent();
other_lei.SizeToContent();
//////////////////////////////////////////////////////////////////////////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CFoodNurritionDlg::DestroyWindow()
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::DestroyWindow();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -