Gradient progress replacement
Gradient progress replacement
Gradient progress replacement
Gradient progress replacement
Gradient progress replacement
Gradient progress replacement Gradient progress replacement Gradient progress replacement Gradient progress replacement Gradient progress replacement Gradient progress replacement Gradient progress replacement Gradient progress replacement
Gradient progress replacement Gradient progress replacement
Gradient progress replacement
Go Back  Xtreme Visual Basic Talk > > > Gradient progress replacement


Reply
 
Thread Tools Display Modes
  #1  
Old 06-19-2006, 02:20 PM
PrOpHeT's Avatar
PrOpHeTGradient progress replacement PrOpHeT is offline
Hopelessly confused...

* Expert *
 
Join Date: Mar 2001
Location: Tyler, Tx.
Posts: 3,055
Default Gradient progress replacement


I am using this

Code:
Private Sub ProgressTimerHandler(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Static _Place As Double Dim Rect As New Rectangle(CInt(_Place) - CInt((Progress.Width * 0.2)), Progress.Left - 9, CInt((Progress.Width * 0.2)), Progress.Height) Dim Brush As New System.Drawing.Drawing2D.LinearGradientBrush(Rect, Color.LightBlue, Color.MidnightBlue, Drawing2D.LinearGradientMode.Horizontal) Dim Painter As Graphics = Progress.CreateGraphics Painter.FillRectangle(Brush, Rect) If _Place > 0 Then _Place -= 3 Else _Place = Progress.Width + (Progress.Width * 0.2) End If End Sub

To produce a progressbar type effect on a picturebox, "Progress"

It works fine, but I would love to be able to reverse the gradient and have the effect of it bouncing back and forth. Any Ideas on how to reverse the gradient?
__________________
When you earnestly believe you can compensate for a lack of skill by doubling your efforts, there's no end to what you can't do ;)

For the love of Gold...
Reply With Quote
  #2  
Old 06-20-2006, 10:06 AM
JNewt's Avatar
JNewt JNewt is offline
Centurion
 
Join Date: Apr 2003
Location: KY (Home), ID (College)
Posts: 138
Default

You might try reversing the rectangle that you pass to the FillRectangle call. Basically, set X to the far right-side edge and make the width negative (you should probably leave Y and Height alone. Not sure if the fillrect will work with such a rectangle, but it works for flipping images.
__________________
Erat autem fuenum multum in loco. -John 6:10
Please forgive my English -I'm a modern American.
Reply With Quote
  #3  
Old 06-21-2006, 06:37 PM
jo0lsGradient progress replacement jo0ls is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Feb 2005
Location: London
Posts: 1,050
Default

Just swap the order of the colors.

Attached is a custom progress bar class:
Inherits control
Double buffered so all painting must be done in the paint event
Ivalidate(rectangle) fires the paint event.
By specifying only the area that needs updating, you can tweak performance.
It uses a symmetrical pattern for the brush, by using the setSigmaBlend thing.

It would perform better with horizontal stipes, that way you only need to update two very small strips at either end of the progress indicator portion of the bar (or one end if it is not a marquee style bar). As it is, it looks ok so long as it isn't going too fast. GDI+ is not good at high frame rates.
Attached Files
File Type: zip GradientProgressBar.zip (16.3 KB, 10 views)
Reply With Quote
  #4  
Old 06-25-2006, 10:06 AM
PrOpHeT's Avatar
PrOpHeTGradient progress replacement PrOpHeT is offline
Hopelessly confused...

* Expert *
 
Join Date: Mar 2001
Location: Tyler, Tx.
Posts: 3,055
Default

Slightly different effect than I was going for, but I believe from looking at the code I can fix a few things in mine. Thanks.
__________________
When you earnestly believe you can compensate for a lack of skill by doubling your efforts, there's no end to what you can't do ;)

For the love of Gold...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Gradient progress replacement
Gradient progress replacement
Gradient progress replacement Gradient progress replacement
Gradient progress replacement
Gradient progress replacement
Gradient progress replacement Gradient progress replacement Gradient progress replacement Gradient progress replacement Gradient progress replacement Gradient progress replacement Gradient progress replacement
Gradient progress replacement
Gradient progress replacement
 
Gradient progress replacement
Gradient progress replacement
 
-->