 |
|
 |
This program is absoulutely awesome, however the in-code documentation is lacking. Good program though.
|
|
|
|
 |
|
 |
Now i must make it not into a DLL
|
|
|
|
 |
|
 |
Seriously though what is the lisense on this?
|
|
|
|
 |
|
 |
Hey, great control & idea. A few issue's though, perhaps when the visibility of the control is false, and the timer is active, surely you wouldnt want the ticker too continue repainting.
Also, if the current thread that it is executed on is busy, the control doesnt visually update, any idea's or suggestions on how too work around this?
Drugs are bad, very very bad. Now give them to me for safe keeping
|
|
|
|
 |
|
 |
If you look at the original post in the VB.NET section it explains that if you have a process that blocks, or is busy, whatever is running in that thread will block, hence the control stops scrolling. The class below can be used as a class to <[insert here your process]> on another thread. I'm using it for xml serialization. I'm assuming you are using the progressbar as some sort of indicator on a form while you are processing. Start your progressbar, create an instance of this class, modifying it so that it performs your process, and then call the spinup method When it is complete, the LoadComplete property will be set to true. That's how you will know it's done. Make sure you call the SpinDown method when done. That releases the thread. THat's all there is to it...threading's so COOL!
Imports System.Threading
Imports System.io
Imports System.xml.Serialization
Friend Class DocLoaderThread
Private _Thread As Thread
Private _Document As Document
Private _FileName As String
Private _IsCancelled As Boolean
Private _LoadComplete As Boolean
Public ReadOnly Property LoadedDocument() As Document
Get
Return _Document
End Get
End Property
Public ReadOnly Property LoadComplete() As Boolean
Get
Return _LoadComplete
End Get
End Property
Private Sub Start()
Try
Dim xmlser As New XmlSerializer(GetType(Document))
Dim reader As New StreamReader(_FileName)
_Document = xmlser.Deserialize(reader)
reader.Close()
Catch ex As Exception
_Document.SetLoadError(ex)
Finally
Me._LoadComplete = True
End Try
End Sub
Private Sub Cancel()
_IsCancelled = True
End Sub
Public Sub Spinup(ByVal FileName As String)
_Document = New Document
_FileName = FileName
Dim ThreadStart As New ThreadStart(AddressOf Me.Start)
_Thread = New Thread(ThreadStart)
_Thread.Start()
End Sub
Public Sub SpinDown()
Cancel()
_Thread.Join()
_Thread = Nothing
End Sub
End Class
Greg Osborne
Microsoft Certified Professional Since 1995
|
|
|
|
 |
|
 |
Can you post your sample code? I use this during object Deserialization which is similar to your task. The progress bar becomes idole during the object deserialization.
Haiyan DU
|
|
|
|
 |
|
|
 |
|
 |
Another note...don't be surprised if it still blocks when you are trying to debug it. I have experienced this in the VS-IDE with my current installation, but not with others in the past. It may be a configuration problem on my part. It soes work fine though compiled running outside the ide
Greg Osborne
Microsoft Certified Professional Since 1995
|
|
|
|
 |
|
 |
Hi,
This one from that thingy controls everyone can code but lazy to. )
Thanks, as well! Great work.
As always, some notes about flickering: paste this inside InitializeComponent()
this.ResizeRedraw = true;
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
Looks better after that.
|
|
|
|
 |
|
 |
Outstanding!
Thanks for the tip
Greg Osborne
Microsoft Certified Professional Since 1995
|
|
|
|
 |
|
 |
I've implemented this code in VB.NET and it works great, but I don't understand why I had to comment out SetStyle(ControlStyles.UserPaint, True), which causes the control to become invisible..? Could it be because I have it subclassed inside a statusbar? Why does it work in C# for you guys?!
|
|
|
|
 |
|
 |
This has already been implemented in VB Go to here for the code
http://www.codeproject.com/vb/net/NeverEndingBar.asp
Don't know why that makes the bar invisible...I never had that behavior when developing it
Greg Osborne
Microsoft Certified Professional Since 1995
|
|
|
|
 |
|
 |
Yeah, I'm using the VB version, but posted the question here because I ported LEXXa's C# flickering solution code to VB in order to resolve some of the flickering issues. I'm just trying to understand why the SetStyle(ControlStyles.UserPaint, True) call didn't fly, but the rest of them did (and reduced the flickering). While the flickering situation has been improved greatly as a result of using LEXXA's code in ProgressStatus.New(), there still is a little bit that is noticeable, and I'm wondering if it can be eliminated completely if I can somehow set UserPaint without the control disappearing. Since I've got my instance of the control subclassed within a StatusBar, perhaps I have to make these calls on the parent StatusBar instead/also?
|
|
|
|
 |
|
 |
You should include a screenshot of what it ACTUALLY looks like. I was dissapointed after I got it running that it looks nothing like the screenshot...
|
|
|
|
 |
|
 |
It is what it actually looks like. The graphics on the screen shot were from my own implementation of the bar on a status form. I added the graphics to the ends and text boxes and used graphics for the progress. Flash it up any way you want
Greg Osborne
Microsoft Certified Professional Since 1995
|
|
|
|
 |
|
 |
Cool. Care to include that with the sample?
Thanks,
Curtis.
|
|
|
|
 |
|
 |
No...but thanks for asking
|
|
|
|
 |
|
 |
Thanks, Nice control.
This is certainly outside of normal (probable) usage but I thought I'd pass on a workaround to a problem I ran into when using the osProgress within a container That is itself resized.
To Reproduce:
1.Add a Panel with Dock=Top
2.Add the osProgressBar1 to the Panel
3.Start the application
4.Resize the form back and forth from multiple times.. It's inconsistent but eventually the progress Bar will no longer display the highlighted block (although it is probably working in the background).
To workaround the problem I just added:
osProgressBar1.Position = 0 to the Resize event of the Form
Cheers,
|
|
|
|
 |
|
 |
Thanks...I actually found that one a few minutes ago myself
Greg Osborne
Microsoft Certified Professional Since 1995
|
|
|
|
 |