📄 querydlg.cpp
字号:
// QUERYDLG.cpp : implementation file
//
#include "stdafx.h"
#include "常州旅游管理系统.h"
#include "QUERYDLG.h"
#include "常州旅游管理系统View.h"
#include "FindDlg.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// QUERYDLG dialog
QUERYDLG::QUERYDLG(CWnd* pParent /*=NULL*/)
: CDialog(QUERYDLG::IDD, pParent)
{
//{{AFX_DATA_INIT(QUERYDLG)
//}}AFX_DATA_INIT
}
void QUERYDLG::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(QUERYDLG)
DDX_Control(pDX, IDOK, m_OK);
DDX_Control(pDX, IDCANCEL, m_CANCEL);
DDX_Control(pDX, IDC_COMBOQUE, m_comboquery);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(QUERYDLG, CDialog)
//{{AFX_MSG_MAP(QUERYDLG)
ON_WM_CTLCOLOR()
ON_WM_PAINT()
ON_CBN_SELCHANGE(IDC_COMBOQUE, OnSelchangeComboque)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// QUERYDLG message handlers
BOOL QUERYDLG::OnInitDialog()
{
CDialog::OnInitDialog();
m_comboquery.InsertString(0,"中华恐龙园");
m_comboquery.InsertString(1,"红梅公园");
m_comboquery.InsertString(2,"春秋淹城");
m_comboquery.InsertString(3,"天目湖");
m_comboquery.InsertString(4,"天宁寺");
m_comboquery.InsertString(5, "茅山");
m_comboquery.SetCurSel(0);//设置复合框的默认值
//////////////////////////////////////////////////////////
CRect rectsize;
CMyApp *pcpp=(CMyApp*)AfxGetApp();
CMainFrame *pfrm=(CMainFrame*)(pcpp->m_pMainWnd);
CMyView* pview=(CMyView*)pfrm->m_splitter.GetPane(0,1);
rectsize=pview->viewrect;
SetWindowPos(NULL,rectsize.Width()/3+46,63,rectsize.Width(),rectsize.Height(),TRUE);//设置对话框的初始位置
//////////////////////////////////////////////////////////
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
HBRUSH QUERYDLG::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
pDC->SetTextColor(RGB(0,0,225));
if (nCtlColor != CTLCOLOR_EDIT && nCtlColor != CTLCOLOR_LISTBOX)
{
pDC->SetBkMode(TRANSPARENT);
HBRUSH B = CreateSolidBrush(RGB(128, 184, 223));
//HBRUSH B = CreateSolidBrush(RGB(0,170,170));
return (HBRUSH) B;
}
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Return a different brush if the default is not desired
return hbr;
}
void QUERYDLG::OnPaint()
{
CPaintDC dc(this); // device context for painting
/*
CString string;
string="常州旅游管理系统";
CFont m_fontLogo;
m_fontLogo.CreateFont(44, 0, 0, 0, 1, FALSE, FALSE,0,0,0,0,0,0, "Arial");
dc.SetBkMode(TRANSPARENT);
CRect rectText;
GetClientRect(&rectText);
CFont * OldFont = dc.SelectObject(&m_fontLogo);
// draw text in DC
COLORREF OldColor = dc.SetTextColor( ::GetSysColor( COLOR_3DHILIGHT));
dc.DrawText( string, rectText+CPoint(50,50) , DT_SINGLELINE | DT_LEFT | DT_VCENTER|DT_CENTER);
dc.SetTextColor( RGB(255,0,0));
// dc.DrawText( string, rectText, DT_SINGLELINE | DT_LEFT | DT_VCENTER|DT_CENTER);
// restore old text color
// dc.SetTextColor( OldColor);
// restore old font
dc.SelectObject(OldFont);
// Do not call CDialog::OnPaint() for painting messages*/
}
void QUERYDLG::OnOK()
{
/*int cursel;
CString temp,str;
cursel=m_comboquery.GetCurSel();
m_comboquery.GetLBText(cursel,temp);
CMyApp *pcpp=(CMyApp*)AfxGetApp();
pcpp->strapp=temp;
CMainFrame *pfrm=(CMainFrame*)(pcpp->m_pMainWnd);
CMyView* pview=(CMyView*)pfrm->m_splitter.GetPane(0,1);*/
new CFaderWnd(this,2000);//实现渐隐效果
EndDialog(IDOK);//关闭对话框
// CDialog::OnOK();
}
void QUERYDLG::OnSelchangeComboque()
{
int cursel;
CString str;
FindDlg dlg;
cursel=m_comboquery.GetCurSel();
m_comboquery.GetLBText(cursel,temp);
CMyApp *pcpp=(CMyApp*)AfxGetApp();
pcpp->strapp=temp;
dlg.DoModal();
}
void QUERYDLG::OnCancel()
{
new CFaderWnd(this,2000);//实现渐隐效果
EndDialog(IDOK);//关闭对话框
// CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -