Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Drawing / August 2004

Tip: Looking for answers? Try searching our database.

C# question: how do I make the ProgressBar dimmed/gray

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Maka Sili - 25 Aug 2004 15:27 GMT
Using ProgressBar.Enabled = false does not dim the progress bar.
There must be a way.  I hope somebody could guide me.

Thanks.
Justin Rogers - 31 Aug 2004 23:36 GMT
Create a derived progress bar and override the OnPaint method.

protected override void OnPaint(PaintEventArgs pe) {
   base.OnPaint(pe);

   if ( !this.Enabled ) { // Do some overdraw to turn it gray; }
}

option #2

protected override void OnPaint(PaintEventArgs pe) {
   this.ForeColor = this.Enabled ? enabledColor : disabledColor;

   base.OnPaint(pe);
}

A quick note, some of the controls use values stored on pe in order
to render. You may have to update this structure directly rather than
setting the base properties of the control.

Signature

Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

> Using ProgressBar.Enabled = false does not dim the progress bar.
> There must be a way.  I hope somebody could guide me.
>
> Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.