English 中文(简体)
非模式“地位”形式
原标题:Non modal "status" form

在C#法典的一节一开始,可以有几秒钟才能完成,我想展示一种非模式,其贴上“请等”的标签。

WaitForm myWaitForm = null;

try
{
  // if conditions suggest process will take awhile
  myWaitForm = new WaitForm();
  myWaitForm.Show();

  // do stuff
}
finally
{
  if (myWaitForm != null)
  {
    myWaitForm.Hide();
    myWaitForm.Dispose();
    myWaitForm = null;
  }
}

问题:WaitForm在法典的其余部分交织起来之前完全展示。 因此,我只看表格的框架。 在德尔菲(我的老 st场),我称之为申请。 展览后的程序 C#中是否有类似之处? 我是否可以在类似情况下使用“状态”的形式? 是否有更好的办法处理这一问题?

Thanks in advance. David Jennings

最佳回答

i 同意“其他校对”建议,但为了简单和短目的适用。 DoEvents()将这样做。

问题回答

Yo need to run the do stuff part in a different thread.
and then all myWaitForm.Show()
Take a look at BackgroundWorker class here

You d better move your "do stuff" code to other thread. and use Application.DoEvents() to proces the form messages

你回顾的术语是“闪电”。

https://stackoverflow.com/search?q=splash+cr+c%23”https://stackoverflow.com/search?q=splash+cr+c%23





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签