Dividing by two integers does not return expected result

前端 未结 6 603
甜味超标
甜味超标 2021-01-25 13:18

I\'m currently writing a program that requires a preview of a live display, but the preview, of course, is scaled down. However, when I scale the PictureBox down, t

6条回答
  •  温柔的废话
    2021-01-25 13:35

    Maybe you should do a decimal division and not integer division:

    double h = Height / 4.0;
    double ratio = 4 / 3.0;
    

    If C# Math was off many things around the world would be off as well.

提交回复
热议问题