why is not Color.FromArgb working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello!

Here I have two button Web controller Button1 and Button2.
When I run this page the two buttons looks just the same.
I mean I have different values on the first parameter which is called alpha
so I should see some difference or
have I missed something here.


protected void Page_Load(object sender, EventArgs e)
{
Button1.BackColor = Color.FromArgb(14, 255, 0, 0);
Button2.BackColor = Color.FromArgb(255, 255, 0, 0);
}

//Tony
 
If you take your code and put it in a Winform application then it works!
button1 will be slightly pinkish and button2 will be red.

// Anders
 
What is the reason that is doesn't work in a web application ?

//Tony

"Anders Eriksson" skrev i meddelandet
If you take your code and put it in a Winform application then it works!
button1 will be slightly pinkish and button2 will be red.

// Anders
 
I'm only guessing here (I don't program ASP.NET) but you are using a
different control! In Winform you(I) use System.Windows.Forms.Button and
in ASP.NET you use System.Web.UI.WebControls.Button (?)

I find it most likely that the different controls has different
possibilities!

If you need to use Alpha you probably should use Siverlight.NET

Maybe some expert can tell you more! You might want to ask in a group
dedicated to ASP.NET and/or Silverlight

// Anders
 
Here I have two button Web controller Button1 and Button2.
When I run this page the two buttons looks just the same.
I mean I have different values on the first parameter which is called
alpha so I should see some difference or
have I missed something here.


protected void Page_Load(object sender, EventArgs e)
{
Button1.BackColor = Color.FromArgb(14, 255, 0, 0);
Button2.BackColor = Color.FromArgb(255, 255, 0, 0);
}

Did you examine the HTML that was generated? (Hint: you should do this ALL
the time.) You'll probably see a color assigned to the button, and it'll be
in this form: #RRGGBB. Note that there will be no "AA" component. I've never
see an alpha value in an HTML color. I doubt it's supported.
 
Back
Top