c# - WFA Progress bar Background color or texture (not foreground) -


i have been looking solution quite long time, here, or other guidance sites.. many people want chhange foreground color of progressbar (the part, rising progress)

i think, small image can everything:

http://screenshot.cz/wt5ko/progbar.png

now, using code paint custom bar, can see above. possible compose background-edit code constructor code?

 public class newprogressbar : progressbar {     public newprogressbar()     {         this.setstyle(controlstyles.userpaint, true);      }      protected override void onpaintbackground(painteventargs pevent)     {         // none... helps control flicker.     }      protected override void onpaint(painteventargs e)     {         const int inset = 0; // single inset value control teh sizing of inner rect.          using (image offscreenimage = new bitmap(this.width, this.height))         {             using (graphics offscreen = graphics.fromimage(offscreenimage))             {                   rectangle rect = new rectangle(0, 0, this.width, this.height);                   if (progressbarrenderer.issupported)                     progressbarrenderer.drawhorizontalbar(offscreen, rect);                  rect.inflate(new size(-inset, -inset)); // deflate inner rect.                 rect.width = (int)(rect.width * ((double)this.value / this.maximum));                 if (rect.width == 0) rect.width = 1; // can't draw rec width of 0.                 texturebrush mybrush = new texturebrush(properties.resources.loading);                 lineargradientbrush brush = new lineargradientbrush(rect, color.darkgoldenrod, color.gold, lineargradientmode.vertical);                 offscreen.fillrectangle(mybrush, inset, inset, rect.width, rect.height);                  e.graphics.drawimage(offscreenimage, 0, 0);                 offscreenimage.dispose();             }         }     } } 

i use wfa template under .net 4.5

thanks in advance


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -