📄 qgzx_infoplatdlg.cpp
字号:
// TODO: Add your command update UI handler code here
pCmdUI->Enable(FALSE);
}
HBRUSH CQGZX_InfoPlatDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
//*************************添加背景色教程**********************
// 在OnCtlColor函数中添加如下代码:(可能需要选择STATIC的简单属性)
// if(nCtlColor==CTLCOLOR_STATIC) 下面的IDC_STATIC_TEST也可用CTLCOLOR_STATIC代替
// { pDC->SetTextColor(RGB(255,0,0));
// pDC->SetBkColor(RGB(128,128,128));//设置文本背景色
// pDC->SetBkMode(TRANSPARENT);//设置背景透明
// }
// 其他控件的宏定义为:
// .CTLCOLOR_BTN 按钮控件
// .CTLCOLOR_DLG 对话框
// .CTLCOLOR_EDIT 编辑框
// .CTLCOLOR_LISTBOX 列表控件
// .CTLCOLOR_MSGBOX 消息控件
// .CTLCOLOR_SCROLLBAR 滚动条控件
// .CTLCOLOR_STATIC 静态控件
//******************************************************
//****************************设置控件的字体**********************
// CFont font;
// font.CreatePointFont(720,_T("Arial"));
// GetDlgItem(IDC_STATIC_TEST)->SetFont(&font);
// font.DeleteObject();
//********************************************************
if(pWnd->GetDlgCtrlID()==IDC_STATIC_TEST)
{
pDC->SetTextColor(RGB(255, 0, 0)); //设置文本颜色
//如果FormView只是一中颜色,而不是图片,你就可以用:pDC->SetBkColor(...)
// pDC->BitBlt(0, 0, m_rectLOG.Width(), m_rectLOG.Height(),
// &m_listMemDC, 0, 0, SRCCOPY);
// pDC->SetBkMode(TRANSPARENT); //设置透明
// return (HBRUSH)GetStockObject(NULL_BRUSH);
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
int CQGZX_InfoPlatDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
/*
if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_LIST, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_ToolBar.LoadToolBar(IDR_TOOLBAR))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
// Set up hot bar image lists.
CImageList imageList;
CBitmap bitmap;
// Create and set the normal toolbar image list.
bitmap.LoadBitmap(IDB_TOOLBAR_COLD);
imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1);
imageList.Add(&bitmap, RGB(255,0,255));
m_ToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
imageList.Detach();
bitmap.Detach();
// Create and set the hot toolbar image list.
bitmap.LoadBitmap(IDB_TOOLBAR_HOT);
imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1);
imageList.Add(&bitmap, RGB(255,0,255));
m_ToolBar.SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
imageList.Detach();
bitmap.Detach();
::AfxMessageBox("test");
*/
//**********************此处先要取消一下皮肤文件,然后重试*********************
if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_LIST, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_ToolBar.LoadToolBar(IDR_TOOLBAR))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_ToolBar.ShowWindow(SW_SHOW);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
// Set up hot bar image lists.
CImageList imageList;
CBitmap bitmap;
// Create and set the normal toolbar image list.
bitmap.LoadBitmap(IDB_TOOLBAR_COLD);
imageList.Create(32, 32, ILC_COLORDDB|ILC_MASK, 15, 1);
imageList.Add(&bitmap, RGB(255,0,255));
m_ToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
imageList.Detach();
bitmap.Detach();
// Create and set the hot toolbar image list.
bitmap.LoadBitmap(IDB_TOOLBAR_COLD);
imageList.Create(32, 32, ILC_COLORDDB|ILC_MASK, 15, 1);
imageList.Add(&bitmap, RGB(255,0,255));
m_ToolBar.SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
imageList.Detach();
bitmap.Detach();
//***************************设置工具栏按钮文字*******************
m_ToolBar.SetButtonText(0,"系统设置");
m_ToolBar.SetButtonText(1,"员工换班");
m_ToolBar.SetButtonText(2,"商品出售");
m_ToolBar.SetButtonText(3,"分类查询");
m_ToolBar.SetButtonText(4,"商品入库");
m_ToolBar.SetButtonText(5,"定单处理");
m_ToolBar.SetButtonText(6,"品种管理");
m_ToolBar.SetButtonText(7,"销售统计");
m_ToolBar.SetButtonText(8,"报表打印");
m_ToolBar.SetButtonText(9,"联系我们");
CRect rect;
m_ToolBar.GetItemRect(0,&rect);
m_ToolBar.SetSizes(rect.Size(),CSize(32,32));
m_ToolBar.SetButtonInfo(0, ID_SYSSETTING,0,0);
m_ToolBar.SetButtonInfo(1, ID_MANAGERLOGIN,0,1);
m_ToolBar.SetButtonInfo(2, ID_GOODSSELL,0,2);
m_ToolBar.SetButtonInfo(3, ID_SEARCH_FAST,0,3);
m_ToolBar.SetButtonInfo(4, ID_ENTERSTORE,0,4);
// m_ToolBar.SetButtonInfo(5, ID_GOODSSELL,0,5);
m_ToolBar.SetButtonInfo(6, IDOK,0,6);
m_ToolBar.SetButtonInfo(7, ID_SELLEVENT,0,7);
m_ToolBar.SetButtonInfo(8, ID_SELLEVENT,0,8);
// m_ToolBar.SetButtonInfo(1, ID_MANAGERLOGIN,0,0);
//***********************************************************
return 0;
}
//DEL void CQGZX_InfoPlatDlg::OnManagerlogin()
//DEL {
//DEL // TODO: Add your command handler code here
//DEL ::AfxMessageBox("abc");
//DEL // CManagerChangeDlg dlg;
//DEL // dlg.DoModal();
//DEL }
void CQGZX_InfoPlatDlg::OnSyssetting()
{
// TODO: Add your command handler code here
if(this->m_nPower != 0)
{
MessageBox("访问权限不够,请与系统管理员联系!", "系统提示", MB_ICONINFORMATION | MB_OK);
return;
}
CMyPropertySheet myps(_T("管理系统设置"),this,0);
myps.AddPage(&m_pageManager);
myps.AddPage(&m_pageDBSetting);
myps.AddPage(&m_pageDBBak);
myps.DoModal();
}
void CQGZX_InfoPlatDlg::OnGoodssell()
{
// TODO: Add your command handler code here
CSellDlg dlg;
dlg.m_strManager = this->m_ManagerName;
dlg.DoModal();
}
void CQGZX_InfoPlatDlg::OnEnterstore()
{
// TODO: Add your command handler code here
if(this->m_nPower != 0)
{
MessageBox("访问权限不够,请与系统管理员联系!", "系统提示", MB_ICONINFORMATION | MB_OK);
return;
}
CEnterDlg dlg;
dlg.nOpenType = 1;
dlg.DoModal();
}
void CQGZX_InfoPlatDlg::OnSearchFast()
{
// TODO: Add your command handler code here
CEnterDlg dlg;
dlg.nOpenType = 2;
dlg.DoModal();
}
void CQGZX_InfoPlatDlg::OnSkin1()
{
// TODO: Add your command handler code here
LoadSkin("SoftCrystal.ssk");
}
void CQGZX_InfoPlatDlg::OnSkin2()
{
// TODO: Add your command handler code here
LoadSkin("Minimized.ssk");
}
void CQGZX_InfoPlatDlg::OnSkin3()
{
// TODO: Add your command handler code here
LoadSkin("XPCorona.ssk");
}
void CQGZX_InfoPlatDlg::OnManagerlogin()
{
// TODO: Add your command handler code here
CManagerChangeDlg dlg;
dlg.m_strManagerName = this->m_ManagerName;
dlg.m_strAccount = this->m_ManagerAccount;
if(dlg.DoModal() == IDOK)
{
this->m_ManagerAccount = dlg.m_strAccount;
this->m_ManagerName = dlg.m_strManagerName;
this->m_nPower = dlg.m_nPower;
::AfxMessageBox(this->m_ManagerAccount + " " + this->m_ManagerName);
}
if(m_nPower == 1) //如果是一般管理员
{
//限制系统设置子菜单
GetMenu()->GetSubMenu(0)->EnableMenuItem(0,MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
GetMenu()->GetSubMenu(0)->EnableMenuItem(7,MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
GetMenu()->GetSubMenu(0)->EnableMenuItem(8,MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
//限出入库管理子菜单
GetMenu()->GetSubMenu(1)->EnableMenuItem(0,MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
GetMenu()->GetSubMenu(1)->EnableMenuItem(1,MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
}
else if(m_nPower == 2) //如果是Guest
{
//关闭限制系统设置子菜单
GetMenu()->GetSubMenu(0)->EnableMenuItem(0,MF_BYPOSITION | MF_ENABLED);
GetMenu()->GetSubMenu(0)->EnableMenuItem(2,MF_BYPOSITION | MF_ENABLED);
GetMenu()->GetSubMenu(0)->EnableMenuItem(6,MF_BYPOSITION | MF_ENABLED);
GetMenu()->GetSubMenu(0)->EnableMenuItem(7,MF_BYPOSITION | MF_ENABLED);
GetMenu()->GetSubMenu(0)->EnableMenuItem(8,MF_BYPOSITION | MF_ENABLED);
//关闭限出入库管理子菜单、商品销售
GetMenu()->GetSubMenu(1)->EnableMenuItem(0,MF_BYPOSITION | MF_ENABLED);
GetMenu()->GetSubMenu(1)->EnableMenuItem(1,MF_BYPOSITION | MF_ENABLED);
GetMenu()->GetSubMenu(2)->EnableMenuItem(0,MF_BYPOSITION | MF_ENABLED);
//关闭限出数据统计
GetMenu()->GetSubMenu(4)->EnableMenuItem(0,MF_BYPOSITION | MF_ENABLED);
GetMenu()->GetSubMenu(4)->EnableMenuItem(1,MF_BYPOSITION | MF_ENABLED);
}
}
void CQGZX_InfoPlatDlg::OnSysQuit()
{
// TODO: Add your command handler code here
SendMessage(WM_CLOSE,0,0);
}
BOOL CQGZX_InfoPlatDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN)
{
if((pMsg->wParam==VK_RETURN)||(pMsg->wParam==VK_ESCAPE))
{
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
void CQGZX_InfoPlatDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
if(IDOK != MessageBox("确定要退出此系统吗?","退出提示",MB_OKCANCEL|MB_ICONQUESTION|MB_DEFBUTTON2))
return;
EndDialog(0);
CDialog::OnClose();
}
void CQGZX_InfoPlatDlg::OnSellevent()
{
// TODO: Add your command handler code here
CSellEventDlg dlg;
dlg.DoModal();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -