Click here to Skip to main content
15,898,371 members
Home / Discussions / C#
   

C#

 
GeneralRe: axWebBrowser DocumentComplete Pin
Dave Kreskowiak24-Mar-04 9:35
mveDave Kreskowiak24-Mar-04 9:35 
GeneralRe: axWebBrowser DocumentComplete Pin
Heath Stewart24-Mar-04 9:43
protectorHeath Stewart24-Mar-04 9:43 
GeneralRe: axWebBrowser DocumentComplete Pin
Dave Kreskowiak24-Mar-04 9:50
mveDave Kreskowiak24-Mar-04 9:50 
GeneralRe: axWebBrowser DocumentComplete Pin
Nick Parker24-Mar-04 17:35
protectorNick Parker24-Mar-04 17:35 
GeneralComponent Text Property Pin
dbetting24-Mar-04 6:28
dbetting24-Mar-04 6:28 
GeneralRe: Component Text Property Pin
je_gonzalez24-Mar-04 7:54
je_gonzalez24-Mar-04 7:54 
GeneralRe: Component Text Property Pin
Heath Stewart24-Mar-04 8:41
protectorHeath Stewart24-Mar-04 8:41 
GeneralRe: Component Text Property Pin
je_gonzalez24-Mar-04 8:55
je_gonzalez24-Mar-04 8:55 
GeneralRe: Component Text Property Pin
Heath Stewart24-Mar-04 9:02
protectorHeath Stewart24-Mar-04 9:02 
GeneralRe: Component Text Property Pin
je_gonzalez24-Mar-04 9:13
je_gonzalez24-Mar-04 9:13 
GeneralRe: Component Text Property Pin
Heath Stewart24-Mar-04 9:18
protectorHeath Stewart24-Mar-04 9:18 
GeneralRe: Component Text Property Pin
je_gonzalez24-Mar-04 9:26
je_gonzalez24-Mar-04 9:26 
GeneralRe: Component Text Property Pin
Heath Stewart24-Mar-04 8:47
protectorHeath Stewart24-Mar-04 8:47 
GeneralRe: Component Text Property Pin
dbetting24-Mar-04 15:41
dbetting24-Mar-04 15:41 
GeneralRe: Component Text Property Pin
Heath Stewart24-Mar-04 17:08
protectorHeath Stewart24-Mar-04 17:08 
Generalversion numbers Pin
surgeproof24-Mar-04 6:22
surgeproof24-Mar-04 6:22 
GeneralRe: version numbers Pin
Michael Flanakin24-Mar-04 6:50
Michael Flanakin24-Mar-04 6:50 
GeneralRe: version numbers Pin
surgeproof24-Mar-04 7:15
surgeproof24-Mar-04 7:15 
GeneralRe: version numbers Pin
Heath Stewart24-Mar-04 8:55
protectorHeath Stewart24-Mar-04 8:55 
GeneralRe: version numbers Pin
surgeproof24-Mar-04 9:19
surgeproof24-Mar-04 9:19 
GeneralRe: version numbers Pin
Michael Flanakin24-Mar-04 10:32
Michael Flanakin24-Mar-04 10:32 
QuestionTransparent Label on a Progressbar? Pin
DennisMetz24-Mar-04 5:54
DennisMetz24-Mar-04 5:54 
AnswerRe: Transparent Label on a Progressbar? Pin
surgeproof24-Mar-04 6:24
surgeproof24-Mar-04 6:24 
AnswerRe: Transparent Label on a Progressbar? Pin
Heath Stewart24-Mar-04 9:54
protectorHeath Stewart24-Mar-04 9:54 
If your goal is display a message while the progress bar increments (like the percentage, which was common with older controls), you might be better off just extending the existing ProgressBar and provide your own painting by overridding OnPaint (do your drawing after calling base.OnPaint to make sure that the progress bar itself is draw first and your code gets drawn on top of it).

Getting the label to be transparent actually has to do with the parent forum in which it's contained. This only works in Win2K and newer (i.e., XP, 2003) since it uses layered Windows, "Windows" (or forms, dialogs) being the optimal word. A transparent color or alpha value is specified for the form an any control that uses the same color (ambience) down the chain of child controls is transparent/translucent as well. Since the ProgressBar is not a form and would paint in different colors anyway, that's one problem (the reasons go deeper, but I won't get into that).

Your painting method could be as simple as:
protected override void OnPaint(PaintEventArgs e)
{
  base.OnPaint(e);
 
  int value = (int)(Value / Maximum);
  string s = value + "%";
 
  StringFormat format = StringFormat.GenericTypographic;
  format.Alignment = StringAlignment.Center;
 
  e.Graphics.DrawString(value + "%", Font, SystemBrushes.ControlText,
    (RectangleF)Bounds, format);
}
This is untested, but should work and at least give you some ideas.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Transparent Label on a Progressbar? Pin
DennisMetz24-Mar-04 11:40
DennisMetz24-Mar-04 11:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.