Centimeter to pixel

前端 未结 6 1260
深忆病人
深忆病人 2021-01-11 18:55

How do I convert centimeter to pixel in c# ?

6条回答
  •  别那么骄傲
    2021-01-11 19:45

    int CentimeterToPixel(double Centimeter)
    {
        double pixel = -1;
        using (Graphics g = this.CreateGraphics())
        {
            pixel = Centimeter * g.DpiY / 2.54d;
        }
        return (int)pixel;
    }

提交回复
热议问题