473,385 Members | 1,531 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 23151
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 ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.