X
xiko tripa
Hi. I have an apsx page with a Panel inside. The panel has his
properties Width and Height set to 590 and 390 respectively.
I call a function to make up an table inside this panel. That table
has 2 columns. The size of the first one has 2/3 of the panel.width
and the size of the second one has 1/3 of the panel.width.
The only way I got to calculate these values was:
private void MakeCentralTable(Panel panel)
{
double twoThird = double.Parse(panel.Width.ToString()) * 0.66;
double oneThird = double.Parse(panel.Width.ToString()) * 0.33;
double half = double.Parse(panel.Height.ToString()) * 0.5;
First I tryied to convert panel.Width and .Height this way:
double twoThird = (double) panel.Width * 0.66;
but I got an error saying that the compiler cannot cast Unit.Pixel to
double. Ok I understand I cannot cast an object to a type value. But
converto to string and follow convert to double just to store in a
double variable seems to me to much work for nothing.
Can anyone tell if there's a simpler way to do this?
Thanks
properties Width and Height set to 590 and 390 respectively.
I call a function to make up an table inside this panel. That table
has 2 columns. The size of the first one has 2/3 of the panel.width
and the size of the second one has 1/3 of the panel.width.
The only way I got to calculate these values was:
private void MakeCentralTable(Panel panel)
{
double twoThird = double.Parse(panel.Width.ToString()) * 0.66;
double oneThird = double.Parse(panel.Width.ToString()) * 0.33;
double half = double.Parse(panel.Height.ToString()) * 0.5;
First I tryied to convert panel.Width and .Height this way:
double twoThird = (double) panel.Width * 0.66;
but I got an error saying that the compiler cannot cast Unit.Pixel to
double. Ok I understand I cannot cast an object to a type value. But
converto to string and follow convert to double just to store in a
double variable seems to me to much work for nothing.
Can anyone tell if there's a simpler way to do this?
Thanks