//---------------------------------------------------------------------------
// Copyright (C) 1997, Interscope Ltd. All rights reserved.
// This software is protected by copyright law. Unauthorised reproduction
// or distribution of this program, or any portion of it, may result in
// severe civil or criminal penalties. For more information, contact:
//
// Interscope Ltd., 5 Culturii St., 5th floor, 4800 Baia Mare, Romania
// Phone/Fax: +40(62)415023
// E-mail: office@interscope.ro
//
// $Author: Levente Farkas $
// $Date: 11/07/97 11:53p $
// $Modtime: 11/07/97 11:53p $
// $Revision: 2 $
// $Archive: /Interscope/Thebe/SetupWizard/StatusBarWithProgress.Cpp $
// $Workfile: StatusBarWithProgress.Cpp $
//---------------------------------------------------------------------------
#include "StdAfx.H"
#include "StatusBarWithProgress.Hpp"
//--- Debugee ---------------------------------------------------------------
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//--- Miscellaneous ---------------------------------------------------------
#define ID_STATUS_PROGRESS 17234
//--- Message map 4 classs CStatusBarWithProgress ---------------------------
IMPLEMENT_DYNCREATE(CStatusBarWithProgress,CStatusBar)
BEGIN_MESSAGE_MAP(CStatusBarWithProgress,CStatusBar)
//{{AFX_MSG_MAP(CStatusBarWithProgress)
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//---------------------------------------------------------------------------
// Pre :
// Post :
// Globals :
// I/O :
// Task : Construct a status bar with a progress control
//---------------------------------------------------------------------------
CStatusBarWithProgress::CStatusBarWithProgress(int nProgressBarWidth):
m_nProgressWidth(nProgressBarWidth),
m_bProgressVisible(FALSE)
{
}
//---------------------------------------------------------------------------
// Pre :
// Post :
// Globals :
// I/O :
// Task : When creating the status bar, also create the progress control,
// but do not show it yet
//---------------------------------------------------------------------------
BOOL CStatusBarWithProgress::Create(CWnd *pParentWnd, DWORD dwStyle, UINT nID)
{
// Default creation
BOOL bCreatedOK =CStatusBar::Create(pParentWnd,dwStyle,nID);
if(bCreatedOK)
{
// Also create the progress bar
m_Progress.Create(WS_CHILD | WS_EX_STATICEDGE | PBS_SMOOTH,CRect(0,0,m_nProgressWidth,10),this,ID_STATUS_PROGRESS);
}
return bCreatedOK;
}
//---------------------------------------------------------------------------
// Pre :
// Post : Return old visible status
// Globals :
// I/O :
// Task : Show/hide the progress bar
//---------------------------------------------------------------------------
BOOL CStatusBarWithProgress::ShowProgressBar(BOOL bShow)
{
// Save old visible status
BOOL bOldVisible =m_bProgressVisible;
if((bOldVisible != bShow) && ::IsWindow(m_Progress.m_hWnd))
{
// Show/hide
m_Progress.ShowWindow(bShow ? SW_SHOWNA : SW_HIDE);
m_bProgressVisible =bShow;
// If just shown, make sure it's in the right position
if(bShow)
{
AdjustProgressBarPosition();
RedrawWindow(NULL,NULL,RDW_INVALIDATE | RDW_UPDATENOW);
}
}
return bOldVisible;
}
//---------------------------------------------------------------------------
// Pre :
// Post :
// Globals :
// I/O :
// Task : Adjust the progress bar's position, so that it comes after the text
// in the first pane
//---------------------------------------------------------------------------
void CStatusBarWithProgress::AdjustProgressBarPosition()
{
// Make sure the progress bar is created
if(!::IsWindow(m_Progress.m_hWnd))
return;
// Find out the size of the text in first pane
CString str_pane_text;
CRect progress_rect;
GetItemRect(0,progress_rect);
GetPaneText(0,str_pane_text);
// Measure the size of the text in the first pane
CClientDC temp(this);
CFont *pOldFont =temp.SelectObject(GetFont());
progress_rect.left =temp.GetTextExtent(str_pane_text).cx + 10;
progress_rect.right =progress_rect.left + m_nProgressWidth;
progress_rect.InflateRect(0,-1);
temp.SelectObject(pOldFont);
// Now adjust the size of the progrss control
m_Progress.SetWindowPos(NULL,progress_rect.left,
progress_rect.top,
progress_rect.Width(),
progress_rect.Height(),SWP_NOZORDER | SWP_NOACTIVATE);
}
//---------------------------------------------------------------------------
// Pre :
// Post :
// Globals :
// I/O :
// Task : After each sizing, if the progress bar is visible, adjust
// its position
//---------------------------------------------------------------------------
void CStatusBarWithProgress::OnSize(UINT nType, int cx, int cy)
{
// Default sizing
CStatusBar::OnSize(nType, cx, cy);
if(m_bProgressVisible)
AdjustProgressBarPosition();
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
MFC资源大全7.rar (96个子文件)
statusbar
ready_prompt.shtml 5KB
progress_in_status2.gif 2KB
progress_in_status3.shtml 2KB
progress_in_status2.shtml 4KB
XStatusBar.shtml 11KB
index.dat 1KB
XStatusBar.gif 12KB
progress_in_status2_demo.zip 39KB
statusbar_toc.shtml 2KB
StatusBarWithProgress.Cpp 5KB
longop.shtml 7KB
statustricks.zip 34KB
printf_to_status.shtml 2KB
clock_in_status.shtml 4KB
enhanced_status.shtml 3KB
XStatusBarProject.zip 45KB
progress_in_status2_src.zip 4KB
progress_in_status.shtml 4KB
scrolling_text.shtml 3KB
XStatusBar.zip 11KB
StatusBarWithProgress.Hpp 3KB
tips
infoviewer_assistant.shtml 4KB
index.dat 1KB
visual_studio_full_platforms.shtml 3KB
classwiz_hide_function.shtml 3KB
classwiz_msg_category.shtml 2KB
usertype.zip 180KB
editor_tips.shtml 2KB
tips_toc.shtml 2KB
enhance_help.shtml 5KB
visual_studio_full_platforms.zip 346B
devstudio_tips.shtml 3KB
fileopen.shtml 1KB
wusage.conf 2KB
user_def_keywords.shtml 3KB
www.pudn.com.txt 218B
toolbar
no_sysmenu.shtml 2KB
toolbar_toc.shtml 3KB
VCMenu.zip 288KB
ContextMenu.jpg 10KB
folder 0B
ctrls_in_tb2.gif 2KB
VCMenu.shtml 6KB
index.dat 2KB
VCMenu.gif 5KB
new.gif 908B
256colors_in_toolbar.shtml 2KB
flatbar_sample_project.zip 185KB
demo_toolbar_prj.zip 166KB
ctrls_in_tb3.gif 4KB
customizable_tb.shtml 3KB
custom_tb.shtml 3KB
demo_toolbar_a.gif 971B
ToolBarPage-Resource.jpg 32KB
VCMenu_source.zip 33KB
Alt-Drag.gif 2KB
demo_toolbar_c.gif 1KB
devstudio_like.shtml 13KB
demo_toolbar_b.gif 1KB
combo_in_flatbar.shtml 6KB
ctrls_in_tb.shtml 8KB
flatbar.shtml 20KB
demo_toolbar_d.gif 2KB
fix_for_ctoolbar.shtml 6KB
ctrls_in_tb1.gif 1KB
Customize-Dlg.jpg 20KB
customizable_tb.zip 25KB
TextToolBar.gif 15KB
display_dialog_tooltips.shtml 7KB
NewStyleBorderLook.jpg 11KB
demo_toolbar.shtml 12KB
tb_custmsg_tips.shtml 4KB
custom_tb.jpg 48KB
OldStyleBorderLook.jpg 12KB
VCMenu_demo.zip 70KB
enh_flatbar_source.zip 24KB
flatbar_source.zip 11KB
demo_toolbar_e.gif 1KB
TextToolBar.shtml 4KB
enh_flatbar_sample.zip 56KB
custom_tb_source.zip 148KB
string
std_string.shtml 6KB
xstring_source.zip 8KB
fixed_len_string.shtml 2KB
index.dat 1KB
ConstantStringArray.cpp 4KB
StdString.zip 9KB
reg_ex.shtml 33KB
CHAR_STR.H 5KB
cstring_ext.shtml 21KB
regexp.shtml 18KB
string_toc.shtml 2KB
cstring_ext_num.shtml 21KB
xstring.shtml 17KB
ConstantStringArray.h 4KB
regexp_source.zip 33KB
共 96 条
- 1
局外狗
- 粉丝: 64
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0