Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
AnswerRe: Java vs .NET - Open Source Pin
Mohammad Dayyan16-Mar-09 9:48
Mohammad Dayyan16-Mar-09 9:48 
QuestionDisplaying multiple images in a picturebox crashes after the first one Pin
Sam Shiell16-Mar-09 3:34
Sam Shiell16-Mar-09 3:34 
AnswerRe: Displaying multiple images in a picturebox crashes after the first one Pin
Dave Kreskowiak16-Mar-09 6:04
mveDave Kreskowiak16-Mar-09 6:04 
AnswerRe: Displaying multiple images in a picturebox crashes after the first one Pin
Sam Shiell17-Mar-09 23:30
Sam Shiell17-Mar-09 23:30 
Questionsmall start up application... Pin
geoNeo_16-Mar-09 3:11
geoNeo_16-Mar-09 3:11 
AnswerRe: small start up application... Pin
musefan16-Mar-09 3:26
musefan16-Mar-09 3:26 
GeneralRe: small start up application... Pin
geoNeo_16-Mar-09 3:33
geoNeo_16-Mar-09 3:33 
QuestionColoring ProgressBar Pin
eyalbi00716-Mar-09 3:01
eyalbi00716-Mar-09 3:01 
Hi All,

I'm trying to chenge the color of my ProgressBar without building a new component from scratch.
I tried inheriting from System.Windows.Forms.ProgressBar and use the code below (which I found in several forums), but it's not working (if relevant, I'm working on vista 64).
Any ideas?

class MyProgressBar : ProgressBar
{
   [DllImport("User32.Dll")]
   public static extern int SendMessage(int hwnd, int wMsg, int wParam, int lParam);

   public const int PBM_SETBKCOLOR = 0x2001;
   public const int PBM_SETBARCOLOR = 0x409;

   public void SetProgressBackColor(Color c)
   {/// set the back color of the bar
       int a = Convert.ToInt32(c.R.ToString());
       int b = Convert.ToInt32(c.G.ToString());
       int d = Convert.ToInt32(c.B.ToString());
       int tot = Convert.ToInt32(ColorTranslator.ToOle(Color.FromArgb(a, b, d)).ToString());
       int j = this.Handle.ToInt32();
       SendMessage(j, PBM_SETBKCOLOR, 0, tot);
   }

   public void SetProgressForeColor(Color c)
   {/// set the forecolor of the bar
       int a = Convert.ToInt32(c.R.ToString());
       int b = Convert.ToInt32(c.G.ToString());
       int d = Convert.ToInt32(c.B.ToString());
       int tot = Convert.ToInt32(ColorTranslator.ToOle(Color.FromArgb(a, b, d)).ToString());
       int j = this.Handle.ToInt32();
       SendMessage(j, PBM_SETBARCOLOR, 0, tot);
   }
}


Thanks!
AnswerRe: Coloring ProgressBar Pin
harold aptroot16-Mar-09 3:11
harold aptroot16-Mar-09 3:11 
GeneralRe: Coloring ProgressBar Pin
musefan16-Mar-09 3:17
musefan16-Mar-09 3:17 
GeneralRe: Coloring ProgressBar Pin
eyalbi00716-Mar-09 3:35
eyalbi00716-Mar-09 3:35 
GeneralRe: Coloring ProgressBar Pin
harold aptroot16-Mar-09 3:40
harold aptroot16-Mar-09 3:40 
GeneralRe: Coloring ProgressBar Pin
eyalbi00716-Mar-09 3:55
eyalbi00716-Mar-09 3:55 
GeneralRe: Coloring ProgressBar Pin
harold aptroot16-Mar-09 3:57
harold aptroot16-Mar-09 3:57 
GeneralRe: Coloring ProgressBar Pin
eyalbi00716-Mar-09 4:48
eyalbi00716-Mar-09 4:48 
GeneralRe: Coloring ProgressBar Pin
harold aptroot16-Mar-09 4:53
harold aptroot16-Mar-09 4:53 
AnswerRe: Coloring ProgressBar Pin
musefan16-Mar-09 3:12
musefan16-Mar-09 3:12 
Answeris not working Pin
Luc Pattyn16-Mar-09 4:19
sitebuilderLuc Pattyn16-Mar-09 4:19 
QuestionAssign Color to text in Rich Textbox Pin
Sajjad Leo16-Mar-09 1:58
Sajjad Leo16-Mar-09 1:58 
AnswerRe: Assign Color to text in Rich Textbox Pin
Blue_Boy16-Mar-09 2:08
Blue_Boy16-Mar-09 2:08 
AnswerRe: Assign Color to text in Rich Textbox Pin
AB777116-Mar-09 2:10
AB777116-Mar-09 2:10 
Questionhow to Merge two datatables in a dataset Pin
Nitin K16-Mar-09 1:40
Nitin K16-Mar-09 1:40 
AnswerRe: how to Merge two datatables in a dataset Pin
Russell Jones16-Mar-09 1:42
Russell Jones16-Mar-09 1:42 
GeneralRe: how to Merge two datatables in a dataset Pin
Nitin K16-Mar-09 1:51
Nitin K16-Mar-09 1:51 
GeneralRe: how to Merge two datatables in a dataset Pin
Russell Jones16-Mar-09 1:56
Russell Jones16-Mar-09 1:56 

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.