一个包含bar和取消而且不需要资源弹出窗口

1.构造函数

CProgressWnd();
CProgressWnd(CWnd* pParent, LPCTSTR strTitle, BOOL bSmooth=FALSE);
BOOL Create(CWnd* pParent, LPCTSTR strTitle, BOOL bSmooth=FALSE);

参数说明:

pParent//父窗口
strTitle//窗口标题
bSmooth//是否平滑

2.方法属性

BOOL GoModal(LPCTSTR strTitle = _T("Progress"), BOOL bSmooth=FALSE);
// Make window modal 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 SetRange(int nLower, int nUpper, int nStep = 1);
// Set min, max and step size void Hide(); // Hide the window
void Show(); // Show the window
void Clear(); // Clear the text and reset the
// progress bar
void SetText(LPCTSTR fmt, ...); // Set the text in the text area BOOL Cancelled() // Has the cancel button been pressed? void SetWindowSize(int nNumTextLines, int nWindowWidth = 390);
// Sets the size of the window
// according to the number of text
// lines specifed and the
// desired window size in pixels. void PeekAndPump(BOOL bCancelOnESCkey = TRUE);
// Message pumping, with options of
// allowing Cancel on ESC key.

SetWindowSize()默认显示四行

PeekAndPump()防止消息阻塞,在走进度过程中,相关操作可以继续执行,如esc取消,鼠标点击等等

3例子

通过GoModal()显示

CProgressWnd wndProgress(this, "Progress");

// wndProgress.GoModal(); // Call this if you want a modal window
wndProgress.SetRange(0,5000);
wndProgress.SetText("Processing..."); for (int i = 0; i < 5000; i++) {
wndProgress.StepIt();
wndProgress.PeekAndPump(); if (wndProgress.Cancelled()) {
MessageBox("Progress Cancelled");
break;
}
}

或者Create()

CProgressWnd wndProgress;

if (!wndProgress.Create(this, "Progress"))
return; wndProgress.SetRange(0,5000);
wndProgress.SetText("Processing...");

源代码链接地址:http://download.csdn.net/detail/wuyuan2011woaini/9594242

A Popup Progress Window的更多相关文章

  1. Popup a window before the MainWindow

    protected override void OnStartup(StartupEventArgs e) { Window w = new Window(); w.ShowDialog(); bas ...

  2. Pass value from child popup window to parent page window using JavaScript--reference

    Here Mudassar Ahmed Khan has explained how to pass value from child popup window to parent page wind ...

  3. BOM 浏览器对象模型_window 对象的常见 window.属性_window.方法

    1. 常用属性 window.devicePixelRatio        像素比 = css / 物理像素 window.scrollX,window.scrollY    滚动条 卷曲距离 if ...

  4. WPF Popup全屏 弹出方法。解决只显示75%的问题。

    WPF Popup全屏 弹出方法.解决只显示75%的问题.   WPF 中 Popup 有一个特点.当Popup的高度超过屏幕的75%的时候,只显示75%的高度. 如下代码: <Window x ...

  5. popup的简单应用举例(具体在增删改查组件中用到)以及补充的知识点

    一.首先说一下自执行函数 1. 立即执行函数是什么?也就是匿名函数 立即执行函数就是 声明一个匿名函数 马上调用这个匿名函数 2.popup的举例 点击,弹出一个新的窗口.保存完事,页面不刷新数据就返 ...

  6. python 全栈开发,Day117(popup,Model类的继承,crm业务开发)

    昨日内容回顾 第一部分:权限相关 1. 权限基本流程 用户登录成功后获取权限信息,将[权限和菜单]信息写入到session. 以后用户在来访问,在中间件中进行权限校验. 为了提升用户体验友好度,在后台 ...

  7. window.open() & iframe

    window.open() & iframe https://www.w3schools.com/jsref/met_win_open.asp window.open(URL, name, s ...

  8. popup的简单应用举例

    一.首先说一下自执行函数 1. 立即执行函数是什么?也就是匿名函数 立即执行函数就是 声明一个匿名函数 马上调用这个匿名函数 2.popup的举例 点击,弹出一个新的窗口.保存完事,页面不刷新数据就返 ...

  9. WPF popup控件的使用

    <Window x:Class="WPFPopup.RuntimePopup"     xmlns="http://schemas.microsoft.com/wi ...

随机推荐

  1. AC自动机 - 多模式串匹配问题的基本运用 + 模板题 --- HDU 2222

    Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  2. UnityShader快速上手指南(四)

    简介 由于其他项目中断了几天更新,继续~~ 这一篇主要是讲光照的(包含漫反射和高光以及多光源的处理) 还是先来看看具体效果(多光源后面单独展示) 有了基本的光照处理之后越来越有立体感了有不有 ╮(╯▽ ...

  3. csharp:VerifyCode in winform or webform

    winform: using System; using System.Collections.Generic; using System.ComponentModel; using System.D ...

  4. ASP.NET Web API涉及到的上下文

    1.表示请求的上下文:HttpRequestContext; 2.表示HttpController:HttpControllerContext; 3.表示Action方法:HttpActionCont ...

  5. 硅谷新闻3--使用Android系统自带的API解析json数据

    NewsCenterPagerBean2 bean2 = new NewsCenterPagerBean2(); try { JSONObject object = new JSONObject(js ...

  6. android onNewIntent

    在Android应用程序开发的时候,从一个Activity启动另一个Activity并传递一些数据到新的Activity上非常简单,但是当您需要让后台运行的Activity回到前台并传递一些数据可能就 ...

  7. Android Service获取当前位置(GPS+基站)

    需求详情:1).Service中每隔1秒执行一次定位操作(GPS+基站)2).定位的结果实时显示在界面上(要求得到经度.纬度)技术支持:1).获取经纬度通过GPS+基站获取经纬度,先通过GPS来获取, ...

  8. [ javascript canvas toDataURL() clip() ] javascript canvas toDataURL() clip() 属性及方法演示

    <!DOCTYPE html> <html lang='zh-cn'> <head> <title>Insert you title</title ...

  9. 在Seismic.NET下用最少的语句写出一个剖面显示程序

    用Seismic.NET开发地震剖面显示程序可以节省大量的时间,下面的代码展开了如何用最少的代码显示一个SEGY文件. // 用一行语句把 reader, pipeline, view 和 plot ...

  10. oracle断电重启之ORA-01033和ORA-01172

    参考文献: ORA-01033:解决方法 数据库掉电后 ORA-01172 磁盘坏块解决方法 --尝试连接数据库prjdb C:\Documents and Settings\Administrato ...