// PropertySheetDlg.cpp : implementation file
//
#include "stdafx.h"
#include "PropertySheet.h"
#include "PropertySheetDlg.h"
#include "DlgTabControl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPropertySheetDlg dialog
CPropertySheetDlg::CPropertySheetDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPropertySheetDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPropertySheetDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CPropertySheetDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPropertySheetDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPropertySheetDlg, CDialog)
//{{AFX_MSG_MAP(CPropertySheetDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDB_TAB_PROPSHEET, OnTabPropsheet)
ON_BN_CLICKED(IDB_WIZARD_PROPSHEET, OnWizardPropsheet)
ON_BN_CLICKED(IDB_TAB_CONTORL, OnTabContorl)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPropertySheetDlg message handlers
BOOL CPropertySheetDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CPropertySheetDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CPropertySheetDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CPropertySheetDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CPropertySheetDlg::OnTabPropsheet()
{
// TODO: Add your control notification handler code here
CPropertySheet tabSheet("Tab属性页");
tabSheet.AddPage(&m_prop1);
tabSheet.AddPage(&m_prop2);
tabSheet.AddPage(&m_prop3);
if(IDOK == tabSheet.DoModal())
{
CString csTemp;
csTemp.Format(TEXT("Tab属性页计算结果为%d+%d=%d"), m_prop1.m_value1, m_prop2.m_value2, m_prop3.m_result);
GetDlgItem(IDE_INPUT)->SetWindowText(csTemp);
}
}
void CPropertySheetDlg::OnWizardPropsheet()
{
// TODO: Add your control notification handler code here
CPropertySheet tabSheet("向导属性页");
tabSheet.AddPage(&m_prop1);
tabSheet.AddPage(&m_prop2);
tabSheet.AddPage(&m_prop3);
tabSheet.SetWizardMode();
if(ID_WIZFINISH == tabSheet.DoModal())
{
CString csTemp;
csTemp.Format(TEXT("向导属性页计算结果为%d+%d=%d"), m_prop1.m_value1, m_prop2.m_value2, m_prop3.m_result);
GetDlgItem(IDE_INPUT)->SetWindowText(csTemp);
}
}
void CPropertySheetDlg::OnTabContorl()
{
// TODO: Add your control notification handler code here
CDlgTabControl dlg;
if (IDOK == dlg.DoModal())
{
CString csTemp;
csTemp.Format(TEXT("Tab控件页计算结果为%d+%d=%d"), dlg.m_pProp1->m_value1, dlg.m_pProp2->m_value2, dlg.m_pProp3->m_result);
GetDlgItem(IDE_INPUT)->SetWindowText(csTemp);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
博客-属性页和Tab控件使用演示
共26个文件
h:11个
cpp:10个
ico:1个
5星 · 超过95%的资源 需积分: 11 51 下载量 136 浏览量
2014-01-07
13:17:41
上传
评论
收藏 23KB ZIP 举报
温馨提示
这是博客属性页和Tab控件的演示代码,你可以学习属性页和Tab控件构建Tab属性页的方法以及不同的Tab页面之间的相互数据访问。
资源推荐
资源详情
资源评论
收起资源包目录
VC6_MFC_属性页和Tab控件.zip (26个子文件)
VC6_MFC_属性页和Tab控件
DlgProp1.h 1KB
DlgProp2.h 1KB
DlgProp2.cpp 1KB
res
PropertySheet.ico 1KB
PropertySheet.rc2 405B
DlgProp1.cpp 1KB
PropertySheetDlg.cpp 6KB
PropertySheet.h 1KB
DlgTabControl1.h 1KB
DlgTabControl.h 2KB
DlgProp3.cpp 2KB
PropertySheet.dsw 534B
StdAfx.cpp 215B
resource.h 1KB
DlgTabControl1.cpp 956B
PropertySheet.dsp 5KB
DlgProp3.h 1KB
DlgTabControl3.h 1KB
StdAfx.h 1KB
PropertySheet.cpp 2KB
PropertySheetDlg.h 2KB
DlgTabControl.cpp 3KB
DlgTabControl3.cpp 986B
DlgTabControl2.cpp 958B
PropertySheet.rc 8KB
DlgTabControl2.h 1KB
共 26 条
- 1
资源评论
- qq_201261052015-04-28挺不错的,学习学习
- lfxiansheng2017-04-26学习属性页和TAB控件的很好例程。 vc使用属性页比vb麻烦太多了,尤其是TAB控件。
文大侠666
- 粉丝: 1200
- 资源: 109
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功