当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 表单启动太慢时显示一个等待图标(类似Windows下的时间沙漏)

ASP.NET
FreeTextBox(版本3.1.6)在ASP.Net 2.0中使用方法
.NET 常用功能和代码小结
在 .NET Framework 2.0 中未处理的异常导致基于 ASP.NET 的应用程序意外退出
asp.net IList查询数据后格式化数据再绑定控件
asp.net sql存储过程
asp.net 简单实现禁用或启用页面中的某一类型的控件
asp.net(c#)获取内容第一张图片地址的函数
The remote procedure call failed and did not execute的解决办法
ASP.NET 在线文件管理
asp.net 读取并修改config文件实现代码
ASP.NET Cookie 操作实现
asp.net Silverlight中的模式窗体
Silverlight中动态获取Web Service地址
asp.net Silverlight应用程序中获取载体aspx页面参数
asp.net 水晶报表隔行换色实现方法
asp.net 获取Gridview隐藏列的值
手动把asp.net的类生成dll文件的方法
asp.net 使用ObjectDataSource控件在ASP.NET中实现Ajax真分页
动态指定任意类型的ObjectDataSource对象的查询参数
asp.net Md5的用法小结

ASP.NET 中的 表单启动太慢时显示一个等待图标(类似Windows下的时间沙漏)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 63 ::
收藏到网摘: n/a


在PPC下有时打开一个程序或表单会比较慢, 往往要等十几甚至几十秒, 这可能让用户以为他没有点中所选项, 比如说在调用一个使用了数据库的表单时更是如此, 虽然第二次再打开这个表单会很快, 但是如果你在用户点了某个选项或菜单项后, 立即显示一个等待图标,那么就不会让用户觉得你的程序很奇怪了,并且也给程序增加了色彩, 何乐而不为了, 方法很简单:

在表单启动前添加一句:

Cursor.Current = Cursors.WaitCursor

在表单的Load事件里添加一句:

Cursor.Current = Cursors.Default

例如:

Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
'Display the wait cursor
Cursor.Current = Cursors.WaitCursor
FormOpenPatient.ShowDialog()
End Sub

Private Sub Form_OpenPatient_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Do some other things
'Display the default cursor
Cursor.Current = Cursors.Default
End Sub