// UseDialogBarDlg.cpp : implementation file
//
#include "stdafx.h"
#include "UseDialogBar.h"
#include "UseDialogBarDlg.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()
/////////////////////////////////////////////////////////////////////////////
// CUseDialogBarDlg dialog
CUseDialogBarDlg::CUseDialogBarDlg(CWnd* pParent /*=NULL*/)
: CDialog(CUseDialogBarDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CUseDialogBarDlg)
// 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(IDI_ICON1);
}
void CUseDialogBarDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUseDialogBarDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUseDialogBarDlg, CDialog)
//{{AFX_MSG_MAP(CUseDialogBarDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_SIZE()
ON_BN_CLICKED(IDC_BUTTONMSG, OnMsg)
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUseDialogBarDlg message handlers
BOOL CUseDialogBarDlg::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
//创建CDialogBar
m_CustomBar.Create(this,IDD_CUSTOMBAR,WS_CHILD|WS_VISIBLE,IDD_CUSTOMBAR);
CRect wndRC;
GetClientRect(wndRC);//获取主窗本区域
//将CDialogBar放在主窗体上
m_CustomBar.MoveWindow(CRect(0,0,300,wndRC.Height()));
return TRUE; // return TRUE unless you set the focus to a control
}
void CUseDialogBarDlg::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 CUseDialogBarDlg::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 CUseDialogBarDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CUseDialogBarDlg::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
m_CustomBar.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
BOOL ret = CDialog::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
// if (!ret)
return ret;
}
BOOL CUseDialogBarDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
m_CustomBar.OnCommand(wParam, lParam);
return CDialog::OnCommand(wParam, lParam);
}
void CUseDialogBarDlg::OnOK()
{
m_CustomBar.CloseWindow();
}
void CUseDialogBarDlg::OnCancel()
{
CDialog::OnCancel();
}
BOOL CUseDialogBarDlg::PreTranslateMessage(MSG* pMsg)
{
return CDialog::PreTranslateMessage(pMsg);
}
LRESULT CUseDialogBarDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
return CDialog::WindowProc(message, wParam, lParam);
}
void CUseDialogBarDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if (IsWindow(m_CustomBar.m_hWnd))
{
CRect wndRC,selfRC;
GetClientRect(wndRC);
m_CustomBar.GetWindowRect(selfRC);
m_CustomBar.MoveWindow(CRect(0,0,selfRC.Width()
,wndRC.Height()));
}
}
void CUseDialogBarDlg::OnMsg()
{
CString cstrMsg;
m_CustomBar.GetDlgItemText(IDC_MSG,cstrMsg);
MessageBox(cstrMsg);
}
void CUseDialogBarDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// m_CustomBar.OnHScroll(nSBCode, nPos, pScrollBar);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
没有合适的资源?快使用搜索试试~ 我知道了~
C++实战开发1200例代码
共276个文件
h:80个
cpp:62个
ico:19个
需积分: 4 17 下载量 23 浏览量
2013-10-23
08:17:33
上传
评论
收藏 26.39MB RAR 举报
温馨提示
C++实战开发1200例中的MFC代码,都可运行,用来学习MFC的好东西!
资源推荐
资源详情
资源评论
收起资源包目录
C++实战开发1200例代码 (276个子文件)
ModalForm.aps 35KB
017.bmp 684KB
c.bmp 364KB
汽球.bmp 364KB
伞.bmp 364KB
花.bmp 364KB
i.bmp 364KB
bitmap.bmp 364KB
ModalForm.clw 2KB
UseDialogBar.clw 2KB
Shadow.clw 1KB
ShowLogin.clw 1KB
BmpFile.clw 1KB
FindAndReplace.clw 1KB
APIResource.clw 1KB
Donghua.clw 1KB
Open.clw 1KB
Open.clw 1KB
BmpBK.clw 1KB
RandBK.clw 1KB
Save.clw 1022B
ColorChange.clw 1013B
Fade.clw 1004B
Crasis.clw 976B
半透明窗体.clw 934B
ShutterView.clw 696B
UseDialogBarDlg.cpp 6KB
FindAndReplaceDlg.cpp 5KB
半透明窗体Dlg.cpp 5KB
DonghuaDlg.cpp 5KB
OpenDlg.cpp 5KB
SaveDlg.cpp 5KB
FadeDlg.cpp 5KB
BmpBKDlg.cpp 5KB
ShadowDlg.cpp 5KB
APIResourceDlg.cpp 5KB
OpenDlg.cpp 5KB
ModalFormDlg.cpp 4KB
CrasisDlg.cpp 4KB
BmpFileDlg.cpp 4KB
RandBKDlg.cpp 4KB
ShowLoginDlg.cpp 4KB
ColorChangeDlg.cpp 4KB
ShutterViewDlg.cpp 3KB
FindAndReplace.cpp 2KB
UseDialogBar.cpp 2KB
ColorChange.cpp 2KB
APIResource.cpp 2KB
CustomDlg.cpp 2KB
ShowLogin.cpp 2KB
ModalForm.cpp 2KB
ShutterView.cpp 2KB
CustomBar.cpp 2KB
BmpFile.cpp 2KB
Donghua.cpp 2KB
RandBK.cpp 2KB
Crasis.cpp 2KB
Shadow.cpp 2KB
BmpBK.cpp 2KB
Fade.cpp 2KB
Save.cpp 2KB
Open.cpp 2KB
Open.cpp 2KB
半透明窗体.cpp 2KB
Shaddlg2.cpp 2KB
Shaddlg1.cpp 2KB
Login.cpp 1KB
Book.cpp 1KB
Bookinfo2.cpp 1024B
Bookinfo.cpp 1012B
StdAfx.cpp 216B
StdAfx.cpp 214B
StdAfx.cpp 213B
StdAfx.cpp 213B
StdAfx.cpp 213B
StdAfx.cpp 212B
StdAfx.cpp 211B
StdAfx.cpp 211B
StdAfx.cpp 209B
StdAfx.cpp 209B
StdAfx.cpp 208B
StdAfx.cpp 208B
StdAfx.cpp 208B
StdAfx.cpp 207B
StdAfx.cpp 206B
StdAfx.cpp 206B
StdAfx.cpp 206B
StdAfx.cpp 206B
UseDialogBar.dsp 4KB
Shadow.dsp 4KB
ShutterView.dsp 4KB
ModalForm.dsp 4KB
ShowLogin.dsp 4KB
半透明窗体.dsp 4KB
BmpFile.dsp 4KB
FindAndReplace.dsp 4KB
ColorChange.dsp 4KB
APIResource.dsp 4KB
RandBK.dsp 4KB
BmpBK.dsp 4KB
共 276 条
- 1
- 2
- 3
资源评论
一地零碎
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功