ColorDialog question.

G

Guest

If I use the standard ColorDialog control to select a colour (say a pale blue) I get the returned value of 16762980 which is fine (Red=100, Green=200, Blue=255), BUT why when I use the following do I just get a transparent background???

Panel2.BackColor = Color.FromArgb(16762980)

Many thanks.
Steve
 
A

Armin Zingler

Steve Randall said:
If I use the standard ColorDialog control to select a colour (say a
pale blue) I get the returned value of 16762980

System.Windows.Forms.ColorDialog.Color is a System.Drawing.Color object. Why
do you get an integer value?
which is fine
(Red=100, Green=200, Blue=255), BUT why when I use the following do I
just get a transparent background???

Panel2.BackColor = Color.FromArgb(16762980)

Because you set the alpha value to 0.

Using a Color structure I'd write

Color.FromArgb(255, ColorDialog1.Color)

Or:
Panel2.BackColor = Color.FromArgb(16762980 Or &Hff000000)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top