Showing progress bar in a status bar pane
在工具卡显示进度条,原文链接:http://www.codeproject.com/Articles/35/Showing-progress-bar-in-a-status-bar-pane
1.构造函数
CProgressBar();
CProgressBar(LPCTSTR strMessage, int nSize=100, int MaxValue=100, BOOL bSmooth=FALSE, int nPane=0);
BOOL Create(LPCTSTR strMessage, int nSize=100, int MaxValue=100, BOOL bSmooth=FALSE, int nPane=0);
参数说明:
strMessage//bar字符串
nSize//占比
MaxValue//bar最大值(0~MaxValue)
bSmooth//是否平滑
nPane//状态栏第几子项
2.方法函数
BOOL Success() // Construction successful? COLORREF SetBarColour(COLORREF clrBar); // Set Bar colour, returns previous
COLORREF SetBkColour(COLORREF clrBar); // Set background colour, returns previous int SetPos(int nPos); // Same as CProgressCtrl
int OffsetPos(int nPos); // Same as CProgressCtrl
int SetStep(int nStep); // Same as CProgressCtrl
int StepIt(); // Same as CProgressCtrl
void Clear(); // Clear the status bar
void SetRange(int nLower, int nUpper, int nStep = 1);
// Set min, max and step size
void SetText(LPCTSTR strMessage); // Set the message
void SetSize(int nSize); // Set the bar size
3.应用
CProgressBar Bar("Testing", 40, 1000);
for (int i = 0; i < 1000; i++)
{
// perform operation
Bar.StepIt();
}
或者
CProgressBar bar;
bar.Create("Processing", 40, 1000);
for (int i = 0; i < 1000; i++)
{
// perform operation
bar.StepIt();
}
bar.SetText("Writing");
for (int i = 0; i < 1000; i++)
{
// perform operation
bar.StepIt();
PeekAndPump(); // Message pump
}
bar.Clear();
PeekAndPump()函数的作用是进行,消息循环,使之进度条走时,可进行操作响应,如最大最小化等等
BOOL PeekAndPump()
{
static MSG msg; while (::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE)) {
if (!AfxGetApp()->PumpMessage()) {
::PostQuitMessage(0);
return FALSE;
}
} return TRUE;
}
运行结果如下:

代码下载地址:http://download.csdn.net/detail/wuyuan2011woaini/9595419
Showing progress bar in a status bar pane的更多相关文章
- WP 8.1 status bar
A status bar is the bar showing signal, battery and time on the top of the phone's screen. In WP8.1 ...
- 与Status Bar和Navigation Bar相关的一些东西
Android Navigation Bar Status Bar 与StatusBar和NavigationBar相关的东西有两种,一是控制它们的显示与隐藏,二是控制它们的透明与否及背景. 在2 ...
- Customizing Navigation Bar and Status Bar
Like many of you, I have been very busy upgrading my apps to make them fit for iOS 7. The latest ver ...
- Java基础之扩展GUI——添加状态栏(Sketcher 1 with a status bar)
控制台程序. 为了显示各个应用程序参数的状态,并且将各个参数显示在各自的面板中,在应用程序窗口的底部添加状态栏是常见且非常方便的方式. 定义状态栏时没有Swing类可用,所以必须自己建立StatusB ...
- Status bar and navigation bar appear over my view's bounds in iOS 7
转自:http://stackoverflow.com/questions/17074365/status-bar-and-navigation-bar-appear-over-my-views-bo ...
- status bar、navigationBar、tableView吸顶view设置
1. 隐藏navigationBar self.navigationController.navigationBar.hidden = YES; 2. status bar设置 -(void)view ...
- iOS7下隐藏status bar的详细研究
info.plist文件中,View controller-based status bar appearance项设为YES,则View controller对status bar的设置优先级高于a ...
- iOS-修改Status Bar
一.在info.plist文件中添加一行不但要在 Status bar is initially hidden一行,选择为 YES. 二.在didFinishLaunchingWithOptions方 ...
- iOS7 status bar 样式问题
在ios7中,有如下status bar 样式 typedef NS_ENUM(NSInteger, UIStatusBarStyle) { UIStatusBarStyleDefault = , / ...
随机推荐
- SQL SERVER 分布式事务(DTC)
BEGIN DISTRIBUTED TRANSACTION指定一个由 Microsoft 分布式事务处理协调器 (MS DTC) 管理的 Transact-SQL 分布式事务的起始. 语法BEGIN ...
- Github教程(3)
Pull Request Pull Request 是自己修改源代码后,请求对方仓库采纳该修改时采取的一种行为. 场景1: 用户A在fork完用户B的项目时,A修改了代码并提交了一个Pull Requ ...
- 当我们安装使用时,会出现eclipse启动不了,出现“Java was started but returned exit code=13......”的问题
安装win8.1后,启动eclipse,也会提示 "java was started but returned exit code=13" 可能是eclipse.ini配置文件错误 ...
- Import 元素 (MSBuild)
Import 元素 (MSBuild) Visual Studio 2013 .NET Framework 4 .NET Framework 3 ...
- C#设计模式——外观模式(Facade Pattern)
一.概述 在系统设计中,某一个系统可能非常庞大,用户要使用该系统就不得不掌握大量的接口,造成使用的不便.这时可以考虑将该系统细分成一系列子系统并使子系统间的耦合降到最低,利用外观模式提供一个外观对象, ...
- 【循序渐进学Python】1. Python基础知识
1. Python安装和配置 首先需要到Python的官方网站(http://www.python.org/getit/) 下载安装包,现在Python的发行版分为兼容之前Python程序的Pytho ...
- 多余的Using Namespaces或引用会影响程序的执行效率么?
在.NET程序编写中,需要using相应命名空间或添加相应的References,可有时候没有使用到的命名空间也被添加到了Using Namespaces中,那么,这样会影响程序的执行效率么? 通过示 ...
- FreeBSD10上编译尝试DeepIn UI
经历了两百多次命令的输入尝试,终于搞定. 1 git clone https://github.com/linuxdeepin/deepin-ui.git 11 git clone https://g ...
- Servlet-Jsp
Jsp实际就是Servlet. 我们访问Http://localhost:8080/Web/index.jsp的流程: 1 [jsp文件名].jsp转义为[jsp文件名_jsp].java,文件存储在 ...
- [javaSE] java获取文件列表
递归测试 import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Lis ...