473,480 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

gradient progressbar

Hi!

Does anyone have a tipp for me where can I found (or how can I programm) a
"progressbar" which has a gradient and the color go from the left side to
right and back ... I should have a waiting-progressbar :-)

Thanks
Thomas
Nov 15 '05 #1
2 4795
Thomas,
I would use a System.Drawing.Drawing2D.LinearGradientBrush to get the color
gradient.

I would start a new Control (inherit System.Windows.Forms.Control) that had
properties similar to System.Windows.Forms.ProgressBar, plus 2 color
properties (for first & second color of the gradient).

In the OnPaint event of the control I would fill the client area with my
brush.

Then depending on the effect you desire I would set different options on the
brush.

Charles Petzold's book "Programming Microsoft Windows With Microsft Visual
Basic .NET" has a chapter where is discusses the different effects possible
with the LinearGradientBrush.

Hope this helps
Jay

"Thomas Kehl" <lh****@heeb.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

Does anyone have a tipp for me where can I found (or how can I programm) a
"progressbar" which has a gradient and the color go from the left side to
right and back ... I should have a waiting-progressbar :-)

Thanks
Thomas

Nov 15 '05 #2
How about something like this:

using System.Drawing;
using System.Drawing.Drawing2D;
....
public void SetPercentComplete( int percent )
{
int width = (int)Math.Floor(pnlProgress.ClientRectangle.Width *
((double)percent)/100.0);
int height = pnlProgress.ClientRectangle.Height;
if( width > 0 && height > 0 )
{
pnlProgress.Invalidate(new Rectangle( pnlProgress.ClientRectangle.X,
pnlStatus.ClientRectangle.Y, width, height));
}
}
private void pnlProgress_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
if( e.ClipRectangle.Width > 0 )
{
LinearGradientBrush brBackground = new
LinearGradientBrush(e.ClipRectangle, System.Drawing.Color.FromArgb(255, 0,
0), Color.FromArgb(0, 255, 0), LinearGradientMode.Horizontal);
e.Graphics.FillRectangle(brBackground, e.ClipRectangle);
}
}

Tom Clement
Apptero, Inc.
"Thomas Kehl" <lh****@heeb.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

Does anyone have a tipp for me where can I found (or how can I programm) a
"progressbar" which has a gradient and the color go from the left side to
right and back ... I should have a waiting-progressbar :-)

Thanks
Thomas

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2417
by: Woody Splawn | last post by:
I have a webform where I would like to have the background color for the webform be a gradient in blue. How do I do this? What is the easiest way? What is the way most used by other developers? ...
13
2050
by: Crirus | last post by:
The main ideea: I havea 513x513 array of values....I draw a sort of map using that values for colors... so I have a realistic lanscape (map). I want to zoom about 60 times that map...and the...
0
4416
by: Don | last post by:
I'm making a custom control that has a multiline textbox on it. I want to make the textbox have a gradient background. On my custom control's Paint event I call a routine that draws a gradient on...
11
4447
by: Maximus | last post by:
Hi all, Has anyone been able to reterive the gradient selection colors used in outlook 2003? Basically, I have a grid showing a list of records and my client wants the selected row to have the...
4
5864
by: Jon Slaughter | last post by:
I'm drawing a linear gradient and its very "banded". The colors are far enough part that it should be plenty smooth enough but I always get the same number of bands regardless. I've tried to set...
2
1927
by: moondaddy | last post by:
How do I make a background gradient diagonal instead of just horizontal or vertical? This makes the standard horizontal gradient. progid:dximagetransform.microsoft.gradient(gradienttype=1,...
6
6152
by: moondaddy | last post by:
I want to fill the entire background of a page with a gradient. As a test, I first filled with a solid color like this: <body style="background-color: #ccffff;" > and the entire page was this...
9
8132
by: Eric Lindsay | last post by:
How do you provide a consistent gradient fill as a background in a liquid layout? If I make a gradient fill image say 1000 pixels wide (and repeat it down the page) to suit a typical computer...
1
7315
by: Allard Warrink | last post by:
I would like to create a transparency gradient over an image using PIL. But I don't have a clue how to do this... Is there anyone out here who could give me some advise?
0
7041
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7043
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6737
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6921
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4776
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4481
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.