// #include "stdafx.h" #include "ViewRecipeNew.h" // CViewRecipeNew 措拳 惑磊涝聪促. IMPLEMENT_DYNAMIC(CViewRecipeNew, CDialog) CViewRecipeNew::CViewRecipeNew(CWnd* pParent /*=NULL*/) : CDialog(CViewRecipeNew::IDD, pParent) { } CViewRecipeNew::~CViewRecipeNew() { } void CViewRecipeNew::DoDataExchange(CDataExchange* pDX) { DDX_Text(pDX,IDC_EDIT_RECIPENEW_NAME,m_strNewRecipeName); DDX_Text(pDX,IDC_EDIT_RECIPENEW_COMMENT,m_strNewRecipeComment); CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CViewRecipeNew, CDialog) ON_WM_PAINT() ON_WM_SHOWWINDOW() END_MESSAGE_MAP() BEGIN_EVENTSINK_MAP(CViewRecipeNew, CDialog) ON_EVENT(CViewRecipeNew, IDC_BTN_RECIPENEW_OK, DISPID_CLICK, CViewRecipeNew::ClickBtnRecipenewOk, VTS_NONE) ON_EVENT(CViewRecipeNew, IDC_BTN_RECIPENEW_CANCEL, DISPID_CLICK, CViewRecipeNew::ClickBtnRecipenewCancel, VTS_NONE) END_EVENTSINK_MAP() // CViewRecipeNew 皋矫瘤 贸府扁涝聪促. BOOL CViewRecipeNew::OnInitDialog() { m_FontControl.SetFont(this,IDC_EDIT_RECIPENEW_NAME,CFontControl::EN_MIDDLEFONT); m_FontControl.SetFont(this,IDC_EDIT_RECIPENEW_COMMENT,CFontControl::EN_MIDDLEFONT); return TRUE; } void CViewRecipeNew::OnPaint() { CPaintDC dc(this); // device context for painting CGeneralDraw pDraw; CUIPictureControl uiTitleRecipeName,uiTitleComment; uiTitleRecipeName.SetItemDefault(this,IDC_NEWRECIPE_NAME_TITLE); uiTitleRecipeName.m_nFontsize = 24; uiTitleRecipeName.m_strData.Format(_T("%s"),_T("New Recipe Name")); uiTitleComment.SetItemDefault(this,IDC_NEWRECIPE_NAME_TITLE2); uiTitleComment.m_nFontsize = 24; uiTitleComment.m_strData.Format(_T("%s"),_T("Comment")); pDraw.DrawPitureControl(uiTitleRecipeName); pDraw.DrawPitureControl(uiTitleComment); } void CViewRecipeNew::OnShowWindow(BOOL bShow, UINT nStatus) { CDialog::OnShowWindow(bShow, nStatus); if(bShow == TRUE) { ((CWnd*)GetDlgItem(IDC_EDIT_RECIPENEW_NAME))->SetFocus(); } } void CViewRecipeNew::ClickBtnRecipenewOk() { UpdateData(TRUE); if(m_strNewRecipeName.IsEmpty() == TRUE) { AfxMessageBox(_T("Input Recipe Name")); ((CWnd*)GetDlgItem(IDC_EDIT_RECIPENEW_NAME))->SetFocus(); return; } OnOK(); } void CViewRecipeNew::ClickBtnRecipenewCancel() { OnCancel(); }