// MySetDlg.cpp : implementation file // #include "stdafx.h" #include "myMailServer.h" #include "MySetDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMySetDlg dialog CMySetDlg::CMySetDlg(CWnd* pParent /*=NULL*/) : CDialog(CMySetDlg::IDD, pParent) { //{{AFX_DATA_INIT(CMySetDlg) m_Psd = _T(""); m_Server = _T(""); m_Usr = _T(""); //}}AFX_DATA_INIT } void CMySetDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMySetDlg) DDX_Control(pDX, IDOK, m_bnOk); DDX_Control(pDX, IDCANCEL, m_bnCancel); DDX_Control(pDX, IDC_bnUsr, m_bnUsr); DDX_Control(pDX, IDC_bnServer, m_bnServer); DDX_Control(pDX, IDC_bnPsd, m_bnPsd); DDX_Text(pDX, IDC_PSD, m_Psd); DDX_Text(pDX, IDC_SERVER, m_Server); DDX_Text(pDX, IDC_USR, m_Usr); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CMySetDlg, CDialog) //{{AFX_MSG_MAP(CMySetDlg) ON_WM_LBUTTONUP() ON_WM_LBUTTONDOWN() ON_WM_CTLCOLOR() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMySetDlg message handlers BOOL CMySetDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_bmBack.DeleteObject(); m_brBack.DeleteObject(); m_bmBack.LoadBitmap(IDB_SEBACK); //导入背景图片 m_brBack.CreatePatternBrush(&m_bmBack); //保存窗体背景图片,供OnCtlColor()调用 CString strFontName = _T("隶书"); ////////////////////////////////////////////////////////////////////////// // set server m_bnServer.SetForceColor(RGB(0, 138, 260), RGB(0, 138, 260), RGB(0, 138, 260), FALSE); //文字颜色 m_bnServer.SetTextAlign(NL_ALIGN_LEFT, FALSE); //设置文字排列方式 m_bnServer .SetDrawText(TRUE, FALSE) //是否显示按钮文字 .SetDrawTextAsDisable(FALSE) //按定义色彩画失效文字 ; ////////////////////////////////////////////////////////////////////////// // set usr m_bnUsr.SetForceColor(RGB(0, 138, 260), RGB(0, 138, 260), RGB(0, 138, 260), FALSE); //文字颜色 m_bnUsr.SetTextAlign(NL_ALIGN_LEFT, FALSE); //设置文字排列方式 m_bnUsr .SetDrawText(TRUE, FALSE) //是否显示按钮文字 .SetDrawTextAsDisable(FALSE) //按定义色彩画失效文字 ; ////////////////////////////////////////////////////////////////////////// // set psd m_bnPsd.SetForceColor(RGB(0, 138, 260), RGB(0, 138, 260), RGB(0, 138, 260), FALSE); //文字颜色 m_bnPsd.SetTextAlign(NL_ALIGN_LEFT, FALSE); //设置文字排列方式 m_bnPsd .SetDrawText(TRUE, FALSE) //是否显示按钮文字 .SetDrawTextAsDisable(FALSE) //按定义色彩画失效文字 ; ////////////////////////////////////////////////////////////////////////// // set btnBackward //set bitmap m_bnOk.SetBitmaps(IDB_SET_N, IDB_SET_N, IDB_SET_H, IDB_SET_N); //位图 m_bnOk.SetForceColor(RGB(255, 255, 0), RGB(255, 255, 255), RGB(255, 255, 255), FALSE); //文字颜色 m_bnOk.SetSound(MAKEINTRESOURCE(IDR_WAVEMOVE), ::GetModuleHandle(NULL)); //动态 m_bnOk.SetSound(MAKEINTRESOURCE(IDR_WAVECLICK), ::GetModuleHandle(NULL), TRUE); //按下声音 m_bnOk.SizeToContent(); //按钮自动适应第一个图片大小 m_bnOk.SetBtnCursor(IDC_CURSOR_HAND, FALSE); //按钮鼠标类型 m_bnOk.SetWindowText(TEXT("确定")); //改变按钮显示文字 m_bnOk.SetTextAlign(NL_ALIGN_RIGHT, FALSE); //设置文字排列方式 //set font m_bnOk .SetDrawText(TRUE, FALSE) //是否显示按钮文字 .SetFont3D(TRUE, 3, 2, FALSE) //显示文字3d效果 .SetText3DBKColor(RGB(95, 95, 95), FALSE) //3d阴影颜色 .SetFontSize(12, FALSE) //字体大小 .SetFontName(strFontName) //字体名称 ; ////////////////////////////////////////////////////////////////////////// // set btnForward //set bitmap m_bnCancel.SetBitmaps(IDB_EXIT_N, IDB_EXIT_N, IDB_EXIT_H, IDB_EXIT_N); //位图 m_bnCancel.SetForceColor(RGB(255, 255, 0), RGB(255, 255, 255), RGB(255, 255, 255), FALSE); //文字颜色 m_bnCancel.SetSound(MAKEINTRESOURCE(IDR_WAVEMOVE), ::GetModuleHandle(NULL)); //动态 m_bnCancel.SetSound(MAKEINTRESOURCE(IDR_WAVECLICK), ::GetModuleHandle(NULL), TRUE); //按下声音 m_bnCancel.SizeToContent(); //按钮自动适应第一个图片大小 m_bnCancel.SetBtnCursor(IDC_CURSOR_HAND, FALSE); //按钮鼠标类型 m_bnCancel.SetWindowText(TEXT("取消")); //改变按钮显示文字 m_bnCancel.SetTextAlign(NL_ALIGN_LEFT, FALSE); //设置文字排列方式 //set font m_bnCancel .SetDrawText(TRUE, FALSE) //是否显示按钮文字 .SetFont3D(TRUE, 3, 2, FALSE) //显示文字3d效果 .SetText3DBKColor(RGB(95, 95, 95), FALSE) //3d阴影颜色 .SetFontSize(12, FALSE) //字体大小 .SetFontName(strFontName) //字体名称 ; SetWindowText("Mail Set"); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CMySetDlg::OnLButtonUp(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CDialog::OnLButtonUp(nFlags, point); } void CMySetDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y)); CDialog::OnLButtonDown(nFlags, point); } HBRUSH CMySetDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here if(nCtlColor == CTLCOLOR_DLG || nCtlColor == CTLCOLOR_BTN) { pDC->SetBkMode(TRANSPARENT); return m_brBack; } // TODO: Return a different brush if the default is not desired return hbr; }