禁用的WinForms进度动画 [英] Disable WinForms ProgressBar animation

查看:106
本文介绍了禁用的WinForms进度动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有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);
 

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);

这篇关于禁用的WinForms进度动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆