禁用的WinForms进度动画进度、动画、WinForms

2023-09-02 21:47:51 作者:人间朝暮

有没有possbility禁用进度条的动画?

我需要一些pocess被暂停,目前没有运行。一个普通的用户会认为该进程正在运行,如果进度条正在闪烁。

要创建自己的进度条控制的建议是不是我要找的。 解决方案

您可以使用Vista进度条的暂停状态,的这样的:

  //假设Form1中有3进度控制
私人无效Form1_Load的(对象发件人,EventArgs的)
{
  SendMessage函数(progressBar2.Handle,
    0×400 + 16,// WM_USER + PBM_SETSTATE
    为0x0003,// PBST_PAUSED
    0);

  SendMessage函数(progressBar3.Handle,
    0×400 + 16,// WM_USER + PBM_SETSTATE
    为0x0002,// PBST_ERROR
    0);
}

[的DllImport(user32.dll中,字符集= CharSet.Uni code)
静态外部UINT SendMessage函数(IntPtr的的HWND,
  UINT消息,
  UINT wParam中,
  UINT的lParam);
 
android 颜色渐变 动画效果,CircleProgressView纵享丝滑的圆形渐变进度动画效果

Is there a possbility to disable animation of the progress bar?

I need it for some pocess which is paused and not running at the moment. An average user would think the process is running if the progress bar is being blinking.

The advice to create own progress bar control is not what I'm looking for.

解决方案

You can use the Vista progress bar's paused state, like this:

// Assuming a Form1 with 3 ProgressBar controls
private void Form1_Load(object sender, EventArgs e)
{
  SendMessage(progressBar2.Handle,
    0x400 + 16, //WM_USER + PBM_SETSTATE
    0x0003, //PBST_PAUSED
    0);

  SendMessage(progressBar3.Handle,
    0x400 + 16, //WM_USER + PBM_SETSTATE
    0x0002, //PBST_ERROR
    0);
}

[DllImport("user32.dll", CharSet = CharSet.Unicode)]
static extern uint SendMessage(IntPtr hWnd,
  uint Msg,
  uint wParam,
  uint lParam);