如何设置static变量显示的颜色和字体大小

上传人:自*** 文档编号:80545832 上传时间:2019-02-19 格式:DOC 页数:5 大小:58.30KB
返回 下载 相关 举报
如何设置static变量显示的颜色和字体大小_第1页
第1页 / 共5页
如何设置static变量显示的颜色和字体大小_第2页
第2页 / 共5页
如何设置static变量显示的颜色和字体大小_第3页
第3页 / 共5页
如何设置static变量显示的颜色和字体大小_第4页
第4页 / 共5页
如何设置static变量显示的颜色和字体大小_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《如何设置static变量显示的颜色和字体大小》由会员分享,可在线阅读,更多相关《如何设置static变量显示的颜色和字体大小(5页珍藏版)》请在金锄头文库上搜索。

1、如何设置static变量显示的颜色和字体大小?#if !defined(AFX_DLGLINKDEMO_H_9E74FFA5_8167_429E_8CC2_59CC0D97B764_INCLUDED_)#define AFX_DLGLINKDEMO_H_9E74FFA5_8167_429E_8CC2_59CC0D97B764_INCLUDED_#if _MSC_VER 1000#pragma once#endif / _MSC_VER 1000/ DlgLinkDemo.h : header file/ CDlgLinkDemo dialogclass CDlgLinkDemo : publi

2、c CDialog/ Constructionpublic:CFont m_font;BOOL UrlVisited;BOOL MailVisited;HCURSOR hHand;CDlgLinkDemo(CWnd* pParent = NULL); / standard constructor/ Dialog Data/AFX_DATA(CDlgLinkDemo)enum IDD = IDD_DLGLINK ;CEditm_Hello2;CStaticm_Hello1;/AFX_DATA/ Overrides/ ClassWizard generated virtual function o

3、verrides/AFX_VIRTUAL(CDlgLinkDemo)protected:virtual void DoDataExchange(CDataExchange* pDX);/ DDX/DDV support/AFX_VIRTUAL/ Implementationprotected:/ Generated message map functions/AFX_MSG(CDlgLinkDemo)afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);afx_msg void OnUrl();afx_msg void

4、OnEmail();virtual BOOL OnInitDialog();afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);afx_msg void OnChangeHello2();/AFX_MSGDECLARE_MESSAGE_MAP();/AFX_INSERT_LOCATION/ Microsoft Visual C+ will insert additional declarations immediately before the previous line.#endif / !defined(AFX

5、_DLGLINKDEMO_H_9E74FFA5_8167_429E_8CC2_59CC0D97B764_INCLUDED_)/ DlgLinkDemo.cpp : implementation file/#include stdafx.h#include xExam.h#include DlgLinkDemo.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CDlgLinkDemo dialogCDlgLinkDemo:CDlgLinkDemo(CWnd* pPa

6、rent /*=NULL*/): CDialog(CDlgLinkDemo:IDD, pParent)/AFX_DATA_INIT(CDlgLinkDemo)/ NOTE: the ClassWizard will add member initialization here/AFX_DATA_INITvoid CDlgLinkDemo:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CDlgLinkDemo)DDX_Control(pDX, IDC_HELLO2, m_Hello2);DD

7、X_Control(pDX, IDC_HELLO1, m_Hello1);/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CDlgLinkDemo, CDialog)/AFX_MSG_MAP(CDlgLinkDemo)ON_WM_CTLCOLOR()ON_BN_CLICKED(IDC_URL, OnUrl)ON_BN_CLICKED(IDC_EMAIL, OnEmail)ON_WM_SETCURSOR()ON_EN_CHANGE(IDC_HELLO2, OnChangeHello2)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CDlgLinkDemo messa

8、ge handlersHBRUSH CDlgLinkDemo:OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) HBRUSH hbr = CDialog:OnCtlColor(pDC, pWnd, nCtlColor);/ TODO: Change any attributes of the DC hereif (pWnd-GetDlgCtrlID() = IDC_URL) | (pWnd-GetDlgCtrlID() = IDC_EMAIL)LOGFONT lf;GetFont()-GetObject(sizeof(lf), &lf);lf.l

9、fUnderline = TRUE;m_font.CreateFontIndirect(&lf);pDC-SelectObject(&m_font);if (pWnd-GetDlgCtrlID() = IDC_URL) & (!UrlVisited) | (pWnd-GetDlgCtrlID() = IDC_EMAIL) & (!MailVisited)pDC-SetTextColor (RGB(0,0,255);/blueelsepDC-SetTextColor (RGB(128,0,128);/purplem_font.DeleteObject();/ TODO: Return a dif

10、ferent brush if the default is not desiredreturn hbr;void CDlgLinkDemo:OnUrl() / TODO: Add your control notification handler code hereHINSTANCE h = ShellExecute( NULL, open,http:/, NULL, NULL, SW_SHOWNORMAL );if (UINT)h 32)UrlVisited = TRUE;Invalidate(); / repaint to show visited color else AfxMessa

11、geBox (Unable to display web page.);void CDlgLinkDemo:OnEmail() / TODO: Add your control notification handler code hereHINSTANCE h = ShellExecute( NULL, open,mailto:, NULL, NULL, SW_SHOWNORMAL );if (UINT)h 32)MailVisited = TRUE;Invalidate(); / repaint to show visited color else AfxMessageBox (Unable

12、 to open mail client.);BOOL CDlgLinkDemo:OnInitDialog() CDialog:OnInitDialog();/ TODO: Add extra initialization herehHand = :LoadCursor(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDC_XHAND);UrlVisited = FALSE;MailVisited = FALSE;return TRUE;/ return TRUE unless you set the focus to a control/ EXCEPTION: OCX Property Pages should return FALSEBOOL CDlgLinkDemo:OnSetCursor(CWnd* pWnd

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号