⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.cpp

📁 旅行社的业务帮助系统
💻 CPP
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "LXS.h"

#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_CREATE()
	ON_WM_CLOSE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
	ID_INDICATOR_CAPS,
	ID_INDICATOR_NUM,
	ID_INDICATOR_SCRL,
};

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
	// TODO: add member initialization code here
	
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

 CImageList img;
	
	//下面的代码是设置"热"的位图
	img.Create(23, 23, ILC_COLOR16|ILC_MASK,7,7);
	img.SetBkColor(::GetSysColor(COLOR_BTNFACE));
	img.Add(AfxGetApp()->LoadIcon(IDI_ICON1));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON3));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON4));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON5));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON6));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON7));

    m_wndToolBar.GetToolBarCtrl().SetHotImageList(&img);
	img.Detach();
//下面的代码是设置"冷"的位图
	img.Create(23, 23, ILC_COLOR16|ILC_MASK, 7,7);
	img.SetBkColor(::GetSysColor(COLOR_BTNFACE));
	img.Add(AfxGetApp()->LoadIcon(IDI_ICON1));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
	img.Add(AfxGetApp()->LoadIcon(IDI_ICON3));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON4));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON5));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON6));
    img.Add(AfxGetApp()->LoadIcon(IDI_ICON7));

	m_wndToolBar.GetToolBarCtrl().SetImageList(&img);
	img.Detach();

//改变属性
	m_wndToolBar.ModifyStyle(0, TBSTYLE_FLAT |CBRS_TOOLTIPS | TBSTYLE_TRANSPARENT|TBBS_CHECKBOX );
	m_wndToolBar.SetButtons(NULL,7);
// set up each toolbar button设置文字  
	m_wndToolBar.SetButtonInfo(0, ID_KH, TBSTYLE_BUTTON, 0);
	m_wndToolBar.SetButtonText(0, "客户信息管理");
    
	m_wndToolBar.SetButtonInfo(1, ID_TD, TBSTYLE_BUTTON, 1);
	m_wndToolBar.SetButtonText(1, "团队信息管理");

	m_wndToolBar.SetButtonInfo(2, ID_XL, TBSTYLE_BUTTON, 2);
	m_wndToolBar.SetButtonText(2, "线路信息管理");

	m_wndToolBar.SetButtonInfo(3, ID_JD, TBSTYLE_BUTTON, 3);
	m_wndToolBar.SetButtonText(3, "景点资料");

	m_wndToolBar.SetButtonInfo(4, ID_BM, TBSTYLE_BUTTON, 4);
	m_wndToolBar.SetButtonText(4, "游客报名");

	m_wndToolBar.SetButtonInfo(5, ID_KHLY, TBSTYLE_BUTTON, 5);
	m_wndToolBar.SetButtonText(5, "客户来源统计");

	m_wndToolBar.SetButtonInfo(6, ID_XLQY, TBSTYLE_BUTTON, 6);
	m_wndToolBar.SetButtonText(6, "线路区域统计");



CRect rectToolBar;
	//得到按钮的大小
	m_wndToolBar.GetItemRect(0, &rectToolBar);
	//设置按钮的大小
	m_wndToolBar.SetSizes(rectToolBar.Size(), CSize(23,23));
		
	//无此代码可能按钮大小不合适,显示不完全





	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers


//DEL void CMainFrame::OnKh() 
//DEL {
//DEL 	// TODO: Add your command handler code here
//DEL 		jhdDlg dlg;
//DEL 	dlg.DoModal();
//DEL }

//DEL void CMainFrame::OnXlqy() 
//DEL {
//DEL 	// TODO: Add your command handler code here
//DEL 	
//DEL }

void CMainFrame::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	 AfxMessageBox("你马上要退出本程序",MB_ICONQUESTION);
/*int   a=AfxMessageBox(""你马上要退出本程序",MB_YESNO|MB_ICONQUESTION);   
  if(a==IDNO)//如果选择取消则去掉这个询问对话框,返回程序   
  return;   
  if(a==IDYES)//如果选择"是",则先执行你的程序,再退出   
  {    CFrameWnd::OnClose();
    
  //这里写你的处理函数   
  }
*/
	CFrameWnd::OnClose();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -