Anzeigen eines ProgressBar-Steuerelements im Marquee-Modus
Anzeigen eines ProgressBar-Steuerelements im Marquee-Modus <URL:http://dotnet.mvps.org/dotnet/faqs/?id=marqueeprogressbar&lang=de> ---------------------------------------------------------------------------- Displaying a progressbar control in marquee mode Windows' progressbar control supports a marquee mode that is not available in the .NET 1.1 Windows Forms wrapper around this control. A marquee-style progressbar does not display progress, instead it indicates that an operation is going on by moving some blocks from right to left: +--------------------+ | | +--------------------+ 'System.Windows.Forms.ProgressBar' is marked as 'NotInheritable', thus it's not as easy to change the progressbar's style. Instead of writing a wrapper from scratch, only the code used to change the style is shown below: \\\ Private Declare Auto Function SendMessage Lib "user32.dll" ( _ ByVal hwnd As IntPtr, _ ByVal wMsg As Int32, _ ByVal wParam As IntPtr, _ ByVal lParam As IntPtr _ ) As IntPtr Private Const WM_USER As Int32 = &H400 Private Const PBM_SETMARQUEE As Int32 = (WM_USER + 10) Private Const GWL_STYLE As Int32 = -16 Private Declare Auto Function GetWindowLong Lib "user32.dll" ( _ ByVal hwnd As IntPtr, _ ByVal nIndex As Int32 _ ) As Int32 Private Declare Auto Function SetWindowLong Lib "user32.dll" ( _ ByVal hwnd As IntPtr, _ ByVal nIndex As Int32, _ ByVal dwNewLong As Int32 _ ) As Int32 Private Const PBS_MARQUEE As Int32 = 8 . . . Dim cs As Int32 = _ GetWindowLong(Me.ProgressBar1.Handle, GWL_STYLE) SetWindowLong( _ Me.ProgressBar1.Handle, _ GWL_STYLE, _ cs Or PBS_MARQUEE _ ) SendMessage( _ Me.ProgressBar1.Handle, _ PBM_SETMARQUEE, _ New IntPtr(CInt(True)), _ New IntPtr(100) _ ) . . . Public Module Program Friend Sub Main() Application.EnableVisualStyles() Application.DoEvents() Application.Run(New MainForm()) End Sub End Module ///