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

📄 mainfrm.cpp

📁 VC+SQL SERVER 2000环境下开发的商品销售管理系统
💻 CPP
字号:
// MainFrm.cpp : CMainFrame 类的实现
//

#include "stdafx.h"
#include "SaleManager.h"

#include "MainFrm.h"
#include ".\mainfrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	ON_WM_NCLBUTTONDBLCLK()
	ON_WM_CREATE()
	ON_WM_TIMER()
	ON_MESSAGE(WM_REALNAME, OnReal)
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // 状态行指示器
	ID_SEPARATOR,
	ID_SEPARATOR,
	ID_SEPARATOR,
	ID_SEPARATOR,
	ID_SEPARATOR
};
// CMainFrame 构造/析构

CMainFrame::CMainFrame()
{

}

CMainFrame::~CMainFrame()
{
}


BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或
	// 样式

	cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
		 | WS_THICKFRAME | WS_MAXIMIZE | WS_SYSMENU;

	cs.style &= ~FWS_ADDTOTITLE;

	cs.lpszName = _T("商品销售管理系统");

	return TRUE;
}


// CMainFrame 诊断

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

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

#endif //_DEBUG


// CMainFrame 消息处理程序


void CMainFrame::OnNcLButtonDblClk(UINT nHitTest, CPoint point)
{
    if( nHitTest != HTCAPTION)
	   CFrameWnd::OnNcLButtonDblClk(nHitTest, point);
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
    
	m_wndStatusBar.Create(this);
	m_wndStatusBar.SetIndicators(indicators,6);

	m_wndStatusBar.SetPaneInfo (0, ID_SEPARATOR, SBPS_NORMAL, 50);
    m_wndStatusBar.SetPaneInfo (1, ID_SEPARATOR, SBPS_NORMAL, 190);
    m_wndStatusBar.SetPaneInfo (2, ID_SEPARATOR, SBPS_NORMAL, 60);
    m_wndStatusBar.SetPaneInfo (3, ID_SEPARATOR, SBPS_NORMAL, 200);
	m_wndStatusBar.SetPaneInfo (4, ID_SEPARATOR, SBPS_NORMAL, 100);
	m_wndStatusBar.SetPaneInfo (5, ID_SEPARATOR, SBPS_NORMAL, 380);

	m_wndStatusBar.SetPaneText (3, _T("       广州大学华软软件学院  "));
	m_wndStatusBar.SetPaneText (5, _T("             华软小星星工作室-商品销售管理系统V1.0"));

	SetTimer(1, 200, NULL);
	CRect rect;
	GetClientRect(rect);
	::SetWindowPos(m_hWnd,HWND_TOPMOST,rect.left,rect.top,rect.Width(),rect.Height(),SWP_SHOWWINDOW);
	return 0;
}

void CMainFrame::OnTimer(UINT nIDEvent)
{
	CTime time = CTime::GetCurrentTime();
	int nSecond = time.GetSecond();
	int nMinute = time.GetMinute();
	int nHour = time.GetHour();

	CString string;
	string.Format(_T(" %0.2d:%0.2d:%0.2d"), nHour, nMinute, nSecond);
	m_wndStatusBar.SetPaneText(2, string);

	int nYear = time.GetYear();
	int nMonth = time.GetMonth();
	int nDay = time.GetDay();
	if(nDayofWeek != time.GetDayOfWeek())
	{
	   nDayofWeek = time.GetDayOfWeek();

		CString sDayofWeek;
		switch(nDayofWeek)
		{
			case 1: sDayofWeek = _T("星期日"); break;
			case 2: sDayofWeek = _T("星期一"); break;
			case 3: sDayofWeek = _T("星期二"); break;
			case 4: sDayofWeek = _T("星期三"); break;
			case 5: sDayofWeek = _T("星期四"); break;
			case 6: sDayofWeek = _T("星期五"); break;
			case 7: sDayofWeek = _T("星期六"); break;
		}
    
	    string.Format(_T("   %0.4d 年 %d 月 %d 日 %s"), nYear, nMonth, nDay, sDayofWeek);
	     m_wndStatusBar.SetPaneText(1, string);
	}

	CFrameWnd::OnTimer(nIDEvent);
}

LRESULT CMainFrame::OnReal(WPARAM wParam, LPARAM lParam)
{
	CString *s = (CString*)lParam;
	CString str;
	str.Format(_T("   %s"),*s);
    m_wndStatusBar.SetPaneText(4, str);
	return 0;
}

⌨️ 快捷键说明

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