我新写了一个form来作为等待提示框,在查询统计中让它显示。
现在显示是可以显示了,我在等待提示框中加入的一个定时器来控制一个progressBar自动滚动,正常统计过程中progressBar不会自动走,这是什么原因?
统计过程中如果出错,progressBar则会自动走。//等待提示框类
public partial class 状态提示 : BaseImeForm
{
private int iTime = 0;//用于时间
private bool bAutoClose = false;//是否自动关闭 public 状态提示(bool b, int i)
{
InitializeComponent(); bAutoClose = b;
iTime = i;
} //定时器
private void timer1_Tick(object sender, EventArgs e)
{
int j = iTime / 20;
progressBar1.PerformStep(); //自动关闭判断
if (bAutoClose)
{
if (progressBar1.Value >= 200)
this.Close();
}
else
{
if (progressBar1.Value >= 200)
progressBar1.Value = 0;
}
}
}//公用函数
/// <summary>
/// 显示信息
/// </summary>
/// <param name="bAutoClose">是否自动关闭,为true则自动关闭</param>
/// <param name="nTime">如果是自动关闭,显示的时间</param>
public static void ShowMsg(bool bAutoClose, int iTime)
{
if (m_FormMsg != null)
{
m_FormMsg.Close();
m_FormMsg = null;
} m_FormMsg = new 状态提示(bAutoClose, iTime);
m_FormMsg.Show();
} /// <summary>
/// 关闭信息显示窗口
/// </summary>
public static void CloseMsg()
{
if (m_FormMsg != null)
{
m_FormMsg.Close();
} m_FormMsg = null;
}
}
//程序调用
BaseDataOperate.ShowMsg(false, 0);
Application.DoEvents(); //查询统计处理 BaseDataOperate.CloseMsg();
现在显示是可以显示了,我在等待提示框中加入的一个定时器来控制一个progressBar自动滚动,正常统计过程中progressBar不会自动走,这是什么原因?
统计过程中如果出错,progressBar则会自动走。//等待提示框类
public partial class 状态提示 : BaseImeForm
{
private int iTime = 0;//用于时间
private bool bAutoClose = false;//是否自动关闭 public 状态提示(bool b, int i)
{
InitializeComponent(); bAutoClose = b;
iTime = i;
} //定时器
private void timer1_Tick(object sender, EventArgs e)
{
int j = iTime / 20;
progressBar1.PerformStep(); //自动关闭判断
if (bAutoClose)
{
if (progressBar1.Value >= 200)
this.Close();
}
else
{
if (progressBar1.Value >= 200)
progressBar1.Value = 0;
}
}
}//公用函数
/// <summary>
/// 显示信息
/// </summary>
/// <param name="bAutoClose">是否自动关闭,为true则自动关闭</param>
/// <param name="nTime">如果是自动关闭,显示的时间</param>
public static void ShowMsg(bool bAutoClose, int iTime)
{
if (m_FormMsg != null)
{
m_FormMsg.Close();
m_FormMsg = null;
} m_FormMsg = new 状态提示(bAutoClose, iTime);
m_FormMsg.Show();
} /// <summary>
/// 关闭信息显示窗口
/// </summary>
public static void CloseMsg()
{
if (m_FormMsg != null)
{
m_FormMsg.Close();
} m_FormMsg = null;
}
}
//程序调用
BaseDataOperate.ShowMsg(false, 0);
Application.DoEvents(); //查询统计处理 BaseDataOperate.CloseMsg();
解决方案 »
- access链接问题?
- c#自定义一个窗体,让用户自己根据接收到的打印机参数选择自己要用的。
- 求Microsoft Excel 11.0 object library开发参考
- c#.net环境中引入SQL Server???
- 如何用vs2005 运行下面此段程序
- 怎样动态设置label的字体大小和字体(谢谢)
- 如何实现Web程序的多语言版本.
- 有点难度的问题,关于SOCKET和WEB SERVICE的整合,各位高手请进!
- focus方法的用法,为什么没有加入focus方法调用的方法就不能起作用
- vb2005通过托拽自动生成的sql语句带数据库用户名的问题
- 新手问题,C#做WEB的机制是什么?
- 如何用winform的拖放实现不同类型的数据的拖放接收处理?
delegate object dlExecuteQuery();
private void button1_Click(object sender, EventArgs e)
{
dlExecuteQuery de=new dlExecuteQuery(this.Query());
IAsyncResult ir = de.BeginInvoke(null, null); Form f=new Form()
f.ShowDialog(this);
Application.DoEvents();
while (!ir.IsCompleted)
{
Application.DoEvents();
}
object obj = de.EndInvoke(ir);
f.Close();
}private object Query()
{
//长时间的操作
}