青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

分享知識(shí)

與大家一起分享知識(shí)

C++博客 首頁 新隨筆 聯(lián)系 聚合 管理
  19 Posts :: 3 Stories :: 45 Comments :: 0 Trackbacks

在利用 VC MFC 編程的時(shí)候,我們往往能碰到這種情況:在一個(gè)模擬程序中(如有些游戲),需要實(shí)時(shí)顯示一些屬性的值(文字或者圖形),這個(gè)時(shí)候我們可以重新打開一個(gè)對(duì)話框(可以是一個(gè)模態(tài)或者非模態(tài)的)來顯示這些信息,本文以模態(tài)對(duì)話框?yàn)槔?jiǎn)單實(shí)現(xiàn)這個(gè)技術(shù)。以下代碼陰影部分是我利用 ClassWizard 加的,藍(lán)色部分是我手工加的。其余是用 MFC 向?qū)傻模?br />源代碼下載地址:http://www.shnenglu.com/Files/sscchh-2000/NotifyDialog.rar?

// NotifyDialogView.h : interface of the CNotifyDialogView class

//

/////////////////////////////////////////////////////////////////////////////

?

#if !defined(AFX_NOTIFYDIALOGVIEW_H__8242946E_9215_46D8_8EAC_DFC7452C8076__INCLUDED_)

#define AFX_NOTIFYDIALOGVIEW_H__8242946E_9215_46D8_8EAC_DFC7452C8076__INCLUDED_

?

#if _MSC_VER > 1000

#pragma once

#endif // _MSC_VER > 1000

?

#include "CountDlg.h"

?

class CNotifyDialogView : public CScrollView

{

protected: // create from serialization only

?????? CNotifyDialogView();

?????? DECLARE_DYNCREATE(CNotifyDialogView)

?

// Attributes

public:

?????? CNotifyDialogDoc* GetDocument();

?

?????? CCountDlg *m_pCountDlg;

// Operations

public:

?

// Overrides

?????? // ClassWizard generated virtual function overrides

?????? //{{AFX_VIRTUAL(CNotifyDialogView)

?????? public:

?????? virtual void OnDraw(CDC* pDC);? // overridden to draw this view

?????? virtual BOOL PreCreateWindow(CREATESTRUCT& cs);

?????? protected:

?????? virtual void OnInitialUpdate(); // called first time after construct

?????? virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);

?????? virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);

?????? virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);

?????? //}}AFX_VIRTUAL

?

// Implementation

public:

?????? virtual ~CNotifyDialogView();

#ifdef _DEBUG

?????? virtual void AssertValid() const;

?????? virtual void Dump(CDumpContext& dc) const;

#endif

?

protected:

?

// Generated message map functions

protected:

?????? //{{AFX_MSG(CNotifyDialogView)

?????? afx_msg void OnTimer(UINT nIDEvent);

?????? afx_msg void OnCountDialog();

?????? afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

?????? afx_msg void OnDestroy();

?????? //}}AFX_MSG

?????? DECLARE_MESSAGE_MAP()

};

?

#ifndef _DEBUG? // debug version in NotifyDialogView.cpp

inline CNotifyDialogDoc* CNotifyDialogView::GetDocument()

?? { return (CNotifyDialogDoc*)m_pDocument; }

#endif

?

/////////////////////////////////////////////////////////////////////////////

?

//{{AFX_INSERT_LOCATION}}

// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

?

#endif // !defined(AFX_NOTIFYDIALOGVIEW_H__8242946E_9215_46D8_8EAC_DFC7452C8076__INCLUDED_)

?

// NotifyDialogView.cpp : implementation of the CNotifyDialogView class

//

?

#include "stdafx.h"

#include "NotifyDialog.h"

?

#include "NotifyDialogDoc.h"

#include "NotifyDialogView.h"

?

#ifdef _DEBUG

#define new DEBUG_NEW

#undef THIS_FILE

static char THIS_FILE[] = __FILE__;

#endif

?

/////////////////////////////////////////////////////////////////////////////

// CNotifyDialogView

?

IMPLEMENT_DYNCREATE(CNotifyDialogView, CScrollView)

?

BEGIN_MESSAGE_MAP(CNotifyDialogView, CScrollView)

?????? //{{AFX_MSG_MAP(CNotifyDialogView)

?????? ON_WM_TIMER()

?????? ON_COMMAND(ID_COUNT_DIALOG, OnCountDialog)

?????? ON_WM_CREATE()

?????? ON_WM_DESTROY()

?????? //}}AFX_MSG_MAP

?????? // Standard printing commands

?????? ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint)

?????? ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)

?????? ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)

END_MESSAGE_MAP()

?

/////////////////////////////////////////////////////////////////////////////

// CNotifyDialogView construction/destruction

?

CNotifyDialogView::CNotifyDialogView()

{

?????? // TODO: add construction code here

?????? m_pCountDlg = NULL;

}

?

CNotifyDialogView::~CNotifyDialogView()

{

}

?

BOOL CNotifyDialogView::PreCreateWindow(CREATESTRUCT& cs)

{

?????? // TODO: Modify the Window class or styles here by modifying

?????? //? the CREATESTRUCT cs

?

?????? return CScrollView::PreCreateWindow(cs);

}

?

/////////////////////////////////////////////////////////////////////////////

// CNotifyDialogView drawing

?

void CNotifyDialogView::OnDraw(CDC* pDC)

{

?????? CNotifyDialogDoc* pDoc = GetDocument();

?????? ASSERT_VALID(pDoc);

?????? // TODO: add draw code for native data here

}

?

void CNotifyDialogView::OnInitialUpdate()

{

?????? CScrollView::OnInitialUpdate();

?

?????? CSize sizeTotal;

?????? // TODO: calculate the total size of this view

?????? sizeTotal.cx = sizeTotal.cy = 100;

?????? SetScrollSizes(MM_TEXT, sizeTotal);

}

?

/////////////////////////////////////////////////////////////////////////////

// CNotifyDialogView printing

?

BOOL CNotifyDialogView::OnPreparePrinting(CPrintInfo* pInfo)

{

?????? // default preparation

?????? return DoPreparePrinting(pInfo);

}

?

void CNotifyDialogView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)

{

?????? // TODO: add extra initialization before printing

}

?

void CNotifyDialogView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)

{

?????? // TODO: add cleanup after printing

}

?

/////////////////////////////////////////////////////////////////////////////

// CNotifyDialogView diagnostics

?

#ifdef _DEBUG

void CNotifyDialogView::AssertValid() const

{

?????? CScrollView::AssertValid();

}

?

void CNotifyDialogView::Dump(CDumpContext& dc) const

{

?????? CScrollView::Dump(dc);

}

?

CNotifyDialogDoc* CNotifyDialogView::GetDocument() // non-debug version is inline

{

?????? ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CNotifyDialogDoc)));

?????? return (CNotifyDialogDoc*)m_pDocument;

}

#endif //_DEBUG

?

/////////////////////////////////////////////////////////////////////////////

// CNotifyDialogView message handlers

?

void CNotifyDialogView::OnTimer(UINT nIDEvent)

{

?????? // TODO: Add your message handler code here and/or call default

?????? if(m_pCountDlg)

?????? {

????????????? m_pCountDlg->m_dwCount++;

????????????? m_pCountDlg->ShowValue();

?????? }

?

?????? CScrollView::OnTimer(nIDEvent);

}

?

void CNotifyDialogView::OnCountDialog()

{

?????? // TODO: Add your command handler code here

?????? CCountDlg countDlg(this);

?????? countDlg.DoModal();

}

?

int CNotifyDialogView::OnCreate(LPCREATESTRUCT lpCreateStruct)

{

?????? if (CScrollView::OnCreate(lpCreateStruct) == -1)

????????????? return -1;

??????

?????? // TODO: Add your specialized creation code here

?????? SetTimer(1,100,NULL);

?

?????? return 0;

}

?

void CNotifyDialogView::OnDestroy()

{

?????? CScrollView::OnDestroy();

??????

?????? // TODO: Add your message handler code here

?????? KillTimer(1);

}

?

#if !defined(AFX_COUNTDLG_H__C5A72F95_781F_47DC_95D1_A0E9A8473756__INCLUDED_)

#define AFX_COUNTDLG_H__C5A72F95_781F_47DC_95D1_A0E9A8473756__INCLUDED_

?

#if _MSC_VER > 1000

#pragma once

#endif // _MSC_VER > 1000

// CountDlg.h : header file

//

#include "stdafx.h"

?

/////////////////////////////////////////////////////////////////////////////

// CCountDlg dialog

?

class CCountDlg : public CDialog

{

// Construction

public:

?????? CCountDlg(CWnd* pParent = NULL);?? // standard constructor

?

// Dialog Data

?????? //{{AFX_DATA(CCountDlg)

?????? enum { IDD = IDD_DIALOG_COUNT };

?????? DWORDm_dwCount;

?????? //}}AFX_DATA

?

public:

?????? CView *m_pView;

?

// Overrides

?????? // ClassWizard generated virtual function overrides

?????? //{{AFX_VIRTUAL(CCountDlg)

?????? protected:

?????? virtual void DoDataExchange(CDataExchange* pDX);??? // DDX/DDV support

?????? //}}AFX_VIRTUAL

public:????

?????? void ShowValue();

??????

?

// Implementation

protected:

?????? void ReleaseViewPointer();

?????? // Generated message map functions

?????? //{{AFX_MSG(CCountDlg)

?????? afx_msg void OnDestroy();

?????? //}}AFX_MSG

?????? DECLARE_MESSAGE_MAP()

};

?

//{{AFX_INSERT_LOCATION}}

// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

?

#endif // !defined(AFX_COUNTDLG_H__C5A72F95_781F_47DC_95D1_A0E9A8473756__INCLUDED_)

?

// CountDlg.cpp : implementation file

//

?

#include "stdafx.h"

#include "NotifyDialog.h"

#include "CountDlg.h"

?

#include "MainFrm.h"

#include "ChildFrm.h"

#include "NotifyDialogDoc.h"

#include "NotifyDialogView.h"

#ifdef _DEBUG

#define new DEBUG_NEW

#undef THIS_FILE

static char THIS_FILE[] = __FILE__;

#endif

?

/////////////////////////////////////////////////////////////////////////////

// CCountDlg dialog

?

?

CCountDlg::CCountDlg(CWnd* pParent /*=NULL*/)

?????? : CDialog(CCountDlg::IDD, pParent)

{

?????? //{{AFX_DATA_INIT(CCountDlg)

?????? m_dwCount = 0;

?????? //}}AFX_DATA_INIT

?????? m_pView = (CNotifyDialogView*)pParent;

?????? ((CNotifyDialogView*)m_pView)->m_pCountDlg = this;

}

?

?

void CCountDlg::DoDataExchange(CDataExchange* pDX)

{

?????? CDialog::DoDataExchange(pDX);

?????? //{{AFX_DATA_MAP(CCountDlg)

?????? DDX_Text(pDX, IDC_EDIT_COUNT, m_dwCount);

?????? //}}AFX_DATA_MAP

}

?

?

BEGIN_MESSAGE_MAP(CCountDlg, CDialog)

?????? //{{AFX_MSG_MAP(CCountDlg)

?????? ON_WM_DESTROY()

?????? //}}AFX_MSG_MAP

END_MESSAGE_MAP()

?

/////////////////////////////////////////////////////////////////////////////

// CCountDlg message handlers

?

void CCountDlg::ShowValue()

{

?????? UpdateData(FALSE);

}

?

void CCountDlg::ReleaseViewPointer()

{

?????? ((CNotifyDialogView*)m_pView)->m_pCountDlg = NULL;

}

void CCountDlg::OnDestroy()

{

?????? CDialog::OnDestroy();

??????

?????? // TODO: Add your message handler code here

?????? ReleaseViewPointer();

}

posted on 2006-04-28 21:47 史傳紅 閱讀(3878) 評(píng)論(2)  編輯 收藏 引用 所屬分類: C/C++細(xì)節(jié)知識(shí)

Feedback

# re: VC中視圖(View)通知對(duì)話框(Dialog)的方法 2006-04-28 23:11 flyingxu
其實(shí)可以用簡(jiǎn)潔的語言代替所有的代碼
而且,如果真的想在一個(gè)對(duì)話框中顯示實(shí)時(shí)的值,現(xiàn)在的程序結(jié)構(gòu)上不好。  回復(fù)  更多評(píng)論
  

# re: VC中視圖(View)通知對(duì)話框(Dialog)的方法 2006-04-29 20:15 史傳紅
@flyingxu

由于我以前遇到這個(gè)問題沒有解決,現(xiàn)在看了深入淺出MFC這本書,總結(jié)出來的,你能給出一個(gè)好的結(jié)構(gòu)嗎?我的意思是說把文檔的數(shù)據(jù)在一個(gè)對(duì)話框中實(shí)時(shí)表現(xiàn)出來,謝謝。
  回復(fù)  更多評(píng)論
  

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美专区在线播放| 亚洲精品中文在线| 美女精品在线| 久久国产免费| 国内精品久久久久伊人av| 亚洲午夜精品一区二区| 亚洲一区二区三区精品动漫| 国产精品二区在线观看| 亚洲网址在线| 久久久久久久国产| 韩国在线一区| 欧美成人精品三级在线观看| 亚洲精品久久嫩草网站秘色| 一本久久综合亚洲鲁鲁| 国产精品人人爽人人做我的可爱| 亚洲欧美自拍偷拍| 欧美大片一区| 亚洲欧美久久| 亚洲激情在线激情| 国产精品人人爽人人做我的可爱| 久久久久青草大香线综合精品| 亚洲激情av| 午夜精品影院| 91久久视频| 国产欧美日韩| 欧美电影在线免费观看网站| 一区二区高清视频| 欧美成人午夜激情视频| 亚洲特黄一级片| 亚洲国产二区| 国产亚洲一区二区三区| 欧美激情亚洲精品| 久久不射网站| 亚洲一区亚洲| 午夜在线视频一区二区区别| 亚洲一区欧美二区| 国产日韩一区二区| 免费久久精品视频| 亚洲自拍偷拍福利| 欧美电影免费观看高清| 亚洲欧美日韩在线一区| 日韩小视频在线观看| 黄色精品网站| 国产一区视频观看| 国产精品久久国产精麻豆99网站| 米奇777在线欧美播放| 亚洲综合电影| 亚洲日本在线观看| 国产亚洲精品久久久久久| 欧美日本一道本在线视频| 男女激情久久| 久久久视频精品| 亚洲香蕉视频| 亚洲美女在线视频| 亚洲国产免费| 欧美成人精品影院| 久热精品在线| 久久婷婷麻豆| 久久久久成人精品| 香蕉久久a毛片| 欧美一级视频| 欧美一区91| 欧美在线视频一区二区| 亚洲一区三区在线观看| 亚洲五月婷婷| 亚洲图片欧洲图片av| 亚洲一级电影| 亚洲专区在线视频| 香蕉久久久久久久av网站| 欧美在线日韩精品| 欧美中文字幕精品| 欧美一区二区三区电影在线观看| 欧美在线观看一区| 欧美自拍偷拍午夜视频| 欧美资源在线| 老司机一区二区| 欧美激情视频一区二区三区在线播放 | 欧美日本中文| 欧美美女喷水视频| 欧美日韩伊人| 国产欧美一区二区三区久久| 精久久久久久久久久久| 日韩亚洲国产欧美| 午夜精品一区二区三区在线播放| 欧美中文在线观看国产| 欧美.www| 亚洲精品小视频在线观看| 亚洲欧美电影在线观看| 久久久久九九九| 欧美不卡在线视频| 欧美精品精品一区| 国产欧美一区二区视频| 亚洲国产日韩欧美| 亚洲午夜精品久久| 久久亚洲精品视频| 一本一道久久综合狠狠老精东影业 | 国产日韩在线视频| 91久久精品美女| 亚洲在线视频网站| 久久天天狠狠| 一本一本a久久| 久久免费99精品久久久久久| 欧美日韩国产小视频| 国产日韩欧美中文| 亚洲人体1000| 久久亚洲春色中文字幕| 久久久久网站| 亚洲人成人一区二区在线观看| 亚洲一区二区av电影| 另类成人小视频在线| 亚洲午夜一级| 欧美精品久久久久a| 黄色成人av| 亚洲欧美日韩中文播放| 亚洲人成高清| 久久精品亚洲热| 国产欧美大片| 亚洲尤物在线视频观看| 欧美国产精品人人做人人爱| 亚洲欧美久久久| 欧美日韩一区二区免费在线观看| 很黄很黄激情成人| 欧美亚洲免费电影| 99精品欧美一区二区三区综合在线| 久久免费国产精品1| 国产精品美女久久福利网站| 一本久久综合亚洲鲁鲁五月天| 欧美福利视频在线| 久久久国产午夜精品| 国产偷久久久精品专区| 性欧美大战久久久久久久免费观看| 日韩视频永久免费观看| 欧美极品欧美精品欧美视频| 亚洲国产综合视频在线观看| 久久久免费av| 欧美在线观看视频| 国产精品大片免费观看| 亚洲综合精品四区| 正在播放亚洲一区| 欧美日韩免费观看一区三区 | 欧美顶级艳妇交换群宴| 久久精品91久久香蕉加勒比| 国内精品久久久| 久久久久久亚洲精品不卡4k岛国| 亚洲欧美日本另类| 亚洲欧美视频| 国产欧美日韩综合精品二区| 久久福利电影| 久久亚洲综合色| 亚洲激情图片小说视频| 亚洲国产成人在线播放| 欧美经典一区二区| 亚洲一级黄色片| 亚洲校园激情| 狠狠色综合网站久久久久久久| 欧美aⅴ99久久黑人专区| 欧美成人在线网站| 中文在线资源观看视频网站免费不卡| 一区二区三区日韩精品| 国产亚洲人成a一在线v站| 免费欧美日韩| 欧美日韩综合视频| 亚洲欧美日韩国产一区二区三区| 亚洲欧美美女| 亚洲三级电影全部在线观看高清| 亚洲老司机av| 亚洲午夜电影网| 日韩视频一区二区三区在线播放| 欧美日韩成人综合天天影院| 亚洲在线一区| 久久se精品一区精品二区| 亚洲国产高清aⅴ视频| 亚洲欧洲综合另类| 国产精品毛片| 欧美护士18xxxxhd| 国产精品视频久久久| 浪潮色综合久久天堂| 欧美日韩高清在线播放| 久久米奇亚洲| 国产精品豆花视频| 玖玖精品视频| 欧美性猛交一区二区三区精品| 裸体一区二区三区| 国产精品av久久久久久麻豆网| 欧美~级网站不卡| 国产美女扒开尿口久久久| 欧美国产日韩精品| 国产精品永久免费在线| 亚洲久久在线| 最新成人av网站| 久久丁香综合五月国产三级网站| 亚洲深夜福利网站| 欧美大尺度在线| 老司机亚洲精品| 一区精品在线| 1024欧美极品| 日韩视频中文| 亚洲另类黄色| 亚洲欧洲日产国产综合网| 午夜日韩在线观看|