can't get float value
-
dear all
float nwidth = (ImageBW8 .Width / ImageBW8.ImageWidth);
float nheight =((ImageBW8 .Height / ImageBW8.ImageHeight);ImageBW8 .Width ,ImageBW8.ImageWidth, ImageBW8 .Height ,ImageBW8.ImageHeight, all got value, but however nwidth and nheight are 0.0. anyone can help me? why nwidth and nheight are only 0.0, instead of exact values there. thanks a lot.
-
dear all
float nwidth = (ImageBW8 .Width / ImageBW8.ImageWidth);
float nheight =((ImageBW8 .Height / ImageBW8.ImageHeight);ImageBW8 .Width ,ImageBW8.ImageWidth, ImageBW8 .Height ,ImageBW8.ImageHeight, all got value, but however nwidth and nheight are 0.0. anyone can help me? why nwidth and nheight are only 0.0, instead of exact values there. thanks a lot.
-
dear all
float nwidth = (ImageBW8 .Width / ImageBW8.ImageWidth);
float nheight =((ImageBW8 .Height / ImageBW8.ImageHeight);ImageBW8 .Width ,ImageBW8.ImageWidth, ImageBW8 .Height ,ImageBW8.ImageHeight, all got value, but however nwidth and nheight are 0.0. anyone can help me? why nwidth and nheight are only 0.0, instead of exact values there. thanks a lot.
-
dear all
float nwidth = (ImageBW8 .Width / ImageBW8.ImageWidth);
float nheight =((ImageBW8 .Height / ImageBW8.ImageHeight);ImageBW8 .Width ,ImageBW8.ImageWidth, ImageBW8 .Height ,ImageBW8.ImageHeight, all got value, but however nwidth and nheight are 0.0. anyone can help me? why nwidth and nheight are only 0.0, instead of exact values there. thanks a lot.
if those properties are integers, you get integer division. And if
0 < Width < ImageWidth
, you would get zero for nwidth. You assigning the quotient to a float variable does not influence how an expression gets evaluated. :)Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.