When loading something such as a software update in Windows 7 there is often an oscillating green glow effect in a horizontal bar. Is this a standard control that can be utilized in C#? If not, how can it be incorporated into a C# app.?
This control is called ProgressBar.
If you are using WPF the property IsIndeterminate has to be set to true to have a "running green glow".
You can implemented this using BackgroundWorker to update a progress bar ("the green glowing horizontal bar), and the same time keep the application main thread responsive. See this SO post, or google around BackgroundWorker + Progress bar.
Related
So I'm pulling some stuff from a database via a different thread, and want the form to remain usable while doing so, and also want to show the user a progress indicator until the DB code finishes.
In 'normal' winforms I'd use a ProgressBar with the ProgressBarStyle set to Continuous, but CF doesn't have that. Neither does it seem to support animated GIFs in a PictureBox (which would have been an easy way).
So what are my options for doing something like this?
EDIT: Don't want to use an hourglass mouse cursor because that implies to the user that the UI is busy (it's not).
Thanks
You could look for a 3rd party progress bar control that supports the Continuous progress bar style, or a control that supports animated gifs - you're not the first running into this limitation, but I'm not sure if there are any good ones out there.
Rolling your own "continuous" progress bar UserControl shouldn't be very hard, you get a decent result with just a timer to call Invalidate, and using Graphics.FillRectangle in the Paint event.
An alternative to an animated gif control could be to create a "film strip" UserControl, where you provide an image (non-gif) that contains all "frames" of the gif layed out horizontally or vertically. Again you'd need a timer to call Invalidate and increase the frame number, and Graphics.DrawImage has an overload to specify which portion of the film strip image is drawn.
Instead of the timer you could use #josef's comment to increment the "current frame" whenever the worker thread has finished a portion of the work. The animated gif's "movement" would then actually show the user that work is being done.
Can someone tell me that how to change backcolor of progress bar control. I am using devexpress bar control. I have searched and tried the ways which are explained on devexpress forum and this site.progress bar back color
If ProgressBarControl.Property.LookAndFeel.Style is set to Skin, the control's background is fully controlled by the current skin.
The progress bar appearance can be customized via the Properties.StartColor and EndColor properties.
Change LookAndFeel to anything except UseDefaultLookAndFeel that will work.
I was using a program made in C# and came across these progress bars, one of which is blue.
Here's a picture of the progress bars in question:
The forecolor property obviously doesn't do anything, so does anyone know how to do this?
Thanks
If its a winform application then do the following step
In Program.cs comment out the line
Application.EnableVisualStyles();
In code behind:
ProgressBar1.ForeColor = Color.Blue;
ProgressBar1.Style = ProgressBarStyle.Continuous;
Disabling Visual styles as Habib suggested will work, But if you application relies on visual styles to look nicer, You will have to use a custom progress bar.
Color Progress Bar - CodeProdject
TerrariViewer uses Wpf as I understand, and if your willing to use that, this is a possibility
Progressbar foreground color
what control can i use to place in my programme so that i can have a loading bar. For example
ProgressBar pb = new ProgressBar();
pb.start();
connectToDatabase();
pb.stop();
Is this possible in c#?
Thanks
Sure. There's a ProgressBar control in the Windows Forms library. Set its Style to Marquee and you should get a scrolling on/off pattern that indicates progress is being made.
A ProgressBar requires your code to periodically update the progress as you work through the task. Also, the progress only has meaning when you can roughly calculate what percent you have completed.
If you just want something moving to show that the program is busy, you can set the progress bar Style property to ProgressBarStyle.Marquee. This style is used to indicate something is happening without reporting the percent the task is complete.
Is there not a simple control called progressbar? Or are you asking something more complex that I'm missing?
Heres a knowledgebase article about created a smooth progressbar
Link to Article.
And heres a tutorial
I need to "animate" an arrow. It can go in any direction (up, down, left, right and diagonals) and the arrowhead will be at the end. It needs to appear as if it is growing from orgin to the end.
To make matters more complicated it has to be in a user control so it is possible to add to the controls collection in the forms and remove it to delete it from the screen, and its background is really transparent (no color.transparent) so i can't paint the background to "clear" the previous line.
I have it static already (drawn from origin to end) but i can't animate it. I tried to add a timer in the user control but I fail to get a correct algorithm to calculate the intermediate ends of the line while it is growing.
Any help would be appreciated.
Thanks
When using animation on a Windows form you have to use another thread. Look into using a background worker: http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx
You don't need another thread - I have succesfully implemented Windows Forms animation.
My design:
Use a Windows.System.Forms.Timer object to call a callback function 'Animate()' at regular intervals
the Animate() function updates a property of your arrow, and then calls Invalidate() on the windows control
this all happens in the same UI thread, so yuo will not get any flicker effects (as long as your control has double duffering switched on).