Converts font size in points to font size in pixels - CSharp System.Drawing

CSharp examples for System.Drawing:Font

Description

Converts font size in points to font size in pixels

Demo Code

/******************************************************************************
  Copyright 2009-2012 dataweb GmbH/*  w ww.j a va 2  s . c  om*/
  This file is part of the NShape framework.
  NShape is free software: you can redistribute it and/or modify it under the 
  terms of the GNU General Public License as published by the Free Software 
  Foundation, either version 3 of the License, or (at your option) any later 
  version.
  NShape is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  You should have received a copy of the GNU General Public License along with 
  NShape. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
using System.Drawing.Drawing2D;
using System.Drawing;
using System.Diagnostics;
using System.Collections.Generic;
using System;

public class Main{
        /// <summary>
      /// Converts font size in points to font size in pixels
      /// </summary>
      public static int PointToPixel(float sizeInPoints, float dpiY) {
         return (int)Math.Ceiling((sizeInPoints / 72) * dpiY);
      }
}

Related Tutorials