473,385 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Text over progressbar

Hi

Is there a way to show text in/over a progressbar (like using a label
with transparent background? Which hasn't worked for me, BTW)???

Rene

Nov 17 '05 #1
3 23153
Rene Sørensen wrote:
Hi

Is there a way to show text in/over a progressbar (like using a label
with transparent background? Which hasn't worked for me, BTW)???

Rene


override the OnPaint method, call the base, then do your own painting

John
Nov 17 '05 #2
Hi john

I did the OnPaint, (se beneath), just a small test,
but the
< call the base, then do your own painting >
you suggest, I don't exactly know what you mean about this.

This code works, but not the way I hoped, the string is drawn behind
my Progress bar control, so is there another way I can do this, or is
Graphics the wrong one to use?

private void OnPaint(object
sender,System.Windows.Forms.PaintEventArgse)
{
Graphics G = e.Graphics;
G.DrawString( "Hello Mum!", new Font( "Verdana", 20 ),
new SolidBrush( Color.Tomato ),
650,
360 );

}

On Fri, 22 Apr 2005 22:05:54 -0400, John Davison
<no**********@yahoo.com> wrote:
Rene Sørensen wrote:
Hi

Is there a way to show text in/over a progressbar (like using a label
with transparent background? Which hasn't worked for me, BTW)???

Rene


override the OnPaint method, call the base, then do your own painting

John

Nov 17 '05 #3
Rene Sørensen wrote:
Hi john

I did the OnPaint, (se beneath), just a small test,
but the
< call the base, then do your own painting >
you suggest, I don't exactly know what you mean about this.

This code works, but not the way I hoped, the string is drawn behind
my Progress bar control, so is there another way I can do this, or is
Graphics the wrong one to use?

private void OnPaint(object
sender,System.Windows.Forms.PaintEventArgse)
{
Graphics G = e.Graphics;
G.DrawString( "Hello Mum!", new Font( "Verdana", 20 ),
new SolidBrush( Color.Tomato ),
650,
360 );

}


I'm sorry, I forgot ProgressBar is a sealed class. After quickly
studying the class, I could not find a way to do what you want to do.
You *could* obtain the Graphics object for the progress bar, and draw on
top of that, but you would not know when the control repaints itself,
because ProgressBar does not have a Paint event.

I think your best bet would be to create your own ProgressBar control
using the drawing primitives. I don't think that would be very difficult.

John Davison
Compass Engineering Group
Nov 17 '05 #4

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

Similar topics

5
by: Basil Fenix | last post by:
I check data from a text file with a mdb Database using a progressbar and changing the Caption by % to indicate to the user what is happening.The file is large and takes quite a while. The problem...
2
by: jez123456 | last post by:
Hi, thanks for the previous advice on progressbars with showing the percentage. I would now like to create a less clunky version. I.e at the moment my progressbar shows 7 separate steps. Some...
1
by: Rene Sørensen | last post by:
Hi Is there a way to show text in / over a progressbar ( like using a label with transparent background? Which hasn't worked for me, BTW )?? Rene
1
by: Mehr H | last post by:
I've been trying to figure out how i can embed a Windows.Forms.ProgressBar in my webform (aspx) file. I have tried putting a Windows.Forms.ProgressBar as public on a regular winform designer form...
3
by: Mitchell Vincent | last post by:
In other programming languages I've been able to easily change the style of a progress bar between smooth and blocked. I find that is either really hidden or impossible in .NET. Am I missing...
1
by: nobody | last post by:
Hi I'm currently developing a Windows application. At the start of the application I load several tables into datatables in a dataset. I also use a progressbar to show the user how much percent...
7
by: TheGanjaMan | last post by:
Hi people, I'm stuck on a problem and I was wondering if there was a way around: I'm trying to find the number of lines in a comma delimited text file. I have a progress bar that should...
2
by: =?Utf-8?B?Y2FzaGRlc2ttYWM=?= | last post by:
Hi, I have a Label on a Windows form (Version 1.1.4322) and while I iterate recursively through a method I want to show the name of the current file being copied to another directory. The...
4
by: sivamoorthy | last post by:
how to use a progressbar in a one cpp file but defined in another header file. the function in which i am using is a static member function. how to use the progressbar inside the function ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.