コード例 #1
0
        // Method to create a rotated font using a LOGFONT structure.
        Font CreateRotatedFont(string fontname, int angleInDegrees)
        {
            LogFont logf = new Microsoft.WindowsCE.Forms.LogFont();
            // Create graphics object for the form, and obtain
            // the current DPI value at design time. In this case,
            // only the vertical resolution is petinent, so the DpiY
            // property is used.
            Graphics g = this.CreateGraphics();

            // Scale an 18-point font for current screen vertical DPI.
            logf.Height = (int)(-18f * g.DpiY / curDPI);
            // Convert specified rotation angle to tenths of degrees.
            logf.Escapement = angleInDegrees * 10;
            // Orientation is the same as Escapement in mobile platforms.
            logf.Orientation = logf.Escapement;
            logf.FaceName    = fontname;
            // Set LogFont enumerations.
            logf.CharSet        = LogFontCharSet.Default;
            logf.OutPrecision   = LogFontPrecision.Default;
            logf.ClipPrecision  = LogFontClipPrecision.Default;
            logf.Quality        = LogFontQuality.ClearType;
            logf.PitchAndFamily = LogFontPitchAndFamily.Default;
            // Explicitly dispose any drawing objects created.
            g.Dispose();
            return(Font.FromLogFont(logf));
        }
コード例 #2
0
ファイル: IVCurves.cs プロジェクト: gyygyy32/Redsun
        //创建带旋转效果的字体
        private Font CreateRotatedFont(Graphics gragh, int ang)
        {
            LogFont logf = new Microsoft.WindowsCE.Forms.LogFont();

            logf.Height         = -11;             //字体高度
            logf.Escapement     = ang * 10;        // 旋转角度
            logf.Orientation    = logf.Escapement; // 字体的方向
            logf.FaceName       = _FontName;       //字体名称
            logf.CharSet        = LogFontCharSet.Default;
            logf.OutPrecision   = LogFontPrecision.Default;
            logf.ClipPrecision  = LogFontClipPrecision.Default;
            logf.Quality        = LogFontQuality.ClearType;
            logf.Weight         = LogFontWeight.Bold;
            logf.PitchAndFamily = LogFontPitchAndFamily.Default;
            return(Font.FromLogFont(logf));
        }