コード例 #1
0
ファイル: GdiInterop.cs プロジェクト: loreggia/SharpDX
        /// <summary>
        /// Creates a font object that matches the properties specified by the LOGFONT structure.
        /// </summary>
        /// <param name="font">A <see cref="System.Drawing.Font"/> description. </param>
        /// <returns>a reference to a newly created <see cref="SharpDX.DirectWrite.Font"/>. </returns>
        /// <unmanaged>HRESULT IDWriteGdiInterop::CreateFontFromLOGFONT([In] const LOGFONTW* logFont,[Out] IDWriteFont** font)</unmanaged>
        public Font FromSystemDrawingFont(System.Drawing.Font font)
        {
            var logfontw = new Win32Native.LogFont();

            font.ToLogFont(logfontw);
            return(FromLogFont(logfontw));
        }
コード例 #2
0
ファイル: GdiInterop.cs プロジェクト: loreggia/SharpDX
        /// <summary>
        /// Convert a Direct2D <see cref="Font"/> to a <see cref="System.Drawing.Font"/>.
        /// </summary>
        /// <param name="d2dFont">a Direct2D Font</param>
        /// <param name="font">a <see cref="System.Drawing.Font"/></param>
        /// <returns>true if the specified font object is part of the system font collection; otherwise, false.</returns>
        public bool ToSystemDrawingFont(Font d2dFont, out System.Drawing.Font font)
        {
            var  logfontw     = new Win32Native.LogFont();
            bool isSystemFont = ToLogFont(d2dFont, logfontw);

            font = System.Drawing.Font.FromLogFont(logfontw);
            return(isSystemFont);
        }
コード例 #3
0
 /// <summary>
 /// Convert a Direct2D <see cref="Font"/> to a <see cref="System.Drawing.Font"/>.
 /// </summary>
 /// <param name="d2dFont">a Direct2D Font</param>
 /// <param name="font">a <see cref="System.Drawing.Font"/></param>
 /// <returns>true if the specified font object is part of the system font collection; otherwise, false.</returns>
 public bool ToSystemDrawingFont(Font d2dFont, out System.Drawing.Font font)
 {
     var logfontw = new Win32Native.LogFont();
     bool isSystemFont = ToLogFont(d2dFont, logfontw);
     font = System.Drawing.Font.FromLogFont(logfontw);
     return isSystemFont;
 }
コード例 #4
0
 /// <summary>	
 /// Creates a font object that matches the properties specified by the LOGFONT structure. 	
 /// </summary>	
 /// <param name="font">A <see cref="System.Drawing.Font"/> description. </param>
 /// <returns>a reference to a newly created <see cref="SharpDX.DirectWrite.Font"/>. </returns>
 /// <unmanaged>HRESULT IDWriteGdiInterop::CreateFontFromLOGFONT([In] const LOGFONTW* logFont,[Out] IDWriteFont** font)</unmanaged>
 public Font FromSystemDrawingFont(System.Drawing.Font font)
 {
     var logfontw = new Win32Native.LogFont();
     font.ToLogFont(logfontw);
     return FromLogFont(logfontw);
 }