如何设置static变量显示的颜色和字体大小.doc_第1页
如何设置static变量显示的颜色和字体大小.doc_第2页
如何设置static变量显示的颜色和字体大小.doc_第3页
如何设置static变量显示的颜色和字体大小.doc_第4页
如何设置static变量显示的颜色和字体大小.doc_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

如何设置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 : public 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 overrides/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 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_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* pParent /*=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);DDX_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 message 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.lfUnderline = 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 different brush if the default is not desiredreturn hbr;void CDlgLinkDemo:OnUrl() / TODO: Add your control notification handler code hereHINSTANCE h = ShellExecute( NULL, open,, NULL, NULL, SW_SHOWNORMAL );if (UINT)h 32)UrlVisited = TRUE;Invalidate(); / repaint to show visited color else AfxMessageBox (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 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, UINT nHitTest, UINT message) / TODO: Add your message handler code here and/or call default/Sets cursor to handif (pWnd-GetDlgCtrlID() = IDC_URL) | (pWnd-GetDlgCtrlID() = IDC_EMAIL):SetCursor(hHand);return TRUE;return CDialog:OnSetCursor(pWnd, nHitTest, message);void CDlgLinkDemo:OnChangeHello2() / TODO: If this is a RICHEDIT control, the control will not/ send this notification unless you override the CDialog:OnInitDialog()/ fun

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论