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

📄 dlgsearch.cpp

📁 本程序是VC为平台开发的股票资讯系统
💻 CPP
字号:
// DlgSearch.cpp : implementation file
//

#include "stdafx.h"
#include "stockrefer.h"
#include "DlgSearch.h"

#include "MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlgSearch dialog


CDlgSearch::CDlgSearch(LPCTSTR lpszTitle, int iCurSelImage, CWnd* pParent /*=NULL*/)
	: CDialog(CDlgSearch::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgSearch)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	iCurImage = iCurSelImage;
	strTitle = lpszTitle;
}


void CDlgSearch::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgSearch)
	DDX_Control(pDX, IDC_DATETIMEPICKE_DATE, m_date);
	DDX_Control(pDX, IDC_EDIT_KEY, m_key);
	DDX_Control(pDX, IDC_COMBO_SUBCATE, m_cate);
	DDX_Control(pDX, IDC_STATIC_ICON, m_icon);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgSearch, CDialog)
	//{{AFX_MSG_MAP(CDlgSearch)
	ON_CBN_SELCHANGE(IDC_COMBO_SUBCATE, OnSelchangeComboSubcate)
	ON_NOTIFY(DTN_CLOSEUP, IDC_DATETIMEPICKE_DATE, OnCloseupDatetimepickeDate)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgSearch message handlers

BOOL CDlgSearch::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
	ASSERT(pFrame);
	SetWindowText(strTitle);
	HICON hIcon = pFrame->m_LargeFinance.ExtractIcon(iCurImage);
	m_icon.SetIcon(hIcon);

	for(int i=0;i<CATEGORY_NUM;i++)
		m_cate.AddString(strFolder[i]);
	
	m_cate.SetCurSel(iCurImage);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgSearch::OnSelchangeComboSubcate() 
{
	// TODO: Add your control notification handler code here
	CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
	ASSERT(pFrame);
	int iCurItem = m_cate.GetCurSel();
	HICON hIcon = pFrame->m_LargeFinance.ExtractIcon(iCurItem);
	m_icon.SetIcon(hIcon);
	SetWindowText(strFolder[iCurItem]);
}

void CDlgSearch::OnOK() 
{
	// TODO: Add extra validation here
	CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
	ASSERT(pFrame);

	int iCurItem = m_cate.GetCurSel();
	CString strKey;
	CTime date;
	m_key.GetWindowText(strKey);
	m_date.GetTime(date);
	
	pFrame->m_strKey = strKey;
	pFrame->m_Date = date;
	pFrame->m_iCurItem = iCurItem;

	CDialog::OnOK();
}

void CDlgSearch::OnCloseupDatetimepickeDate(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	CTime m_timeval,m_today;
	m_date.GetTime(m_timeval);
	m_today = CTime::GetCurrentTime();
	
	if(m_timeval - m_today > CTimeSpan(1,0,0,0) || m_timeval < m_today - CTimeSpan(3650,0,0,0))
		m_date.SetTime(&m_today);
	
	*pResult = 0;
}

⌨️ 快捷键说明

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