C++ Builder/Winapi 不同 loading/progressbar 类型

C++ Builder / Winapi Different loading/progressbar type

如何创建如下所示的 "loading" ProgressBar?我什至不知道如何 Google 。我正在寻找一种来回移动的浮动绿色条:

不是像这样的标准 ProgressBar:

要达到预期的效果,你必须设定一个标准Progress Bar's control style to PBS_MARQUEE. This can be done either through the dialog's resource script, or changed at runtime by calling SetWindowLongPtr

要启动和停止选取框动画并控制其速度,请向控件发送 PBM_SETMARQUEE 消息。

使用此样式需要通用控件 6.0 版。

To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see Enabling Visual Styles.

示例代码:

LONG_PTR style = ::GetWindowLongPtrW( hWndPB, GWL_STYLE );
style &= ~( PBS_SMOOTH | PBS_SMOOTHREVERSE | PBS_VERTICAL);  // Remove competing styles
style |= PBS_MARQUEE;                                        // Add the marquee style
::SetWindowLongPtrW( hWndPB, GWL_STYLE, style );
::SendMessageW( hWndPB, PBM_SETMARQUEE, TRUE, 0 );

注意:您不能将选取框样式与垂直进度条控件一起使用。