当前位置: 首页>>代码示例>>C#>>正文


C# Font.ToLogFont方法代码示例

本文整理汇总了C#中System.Drawing.Font.ToLogFont方法的典型用法代码示例。如果您正苦于以下问题:C# Font.ToLogFont方法的具体用法?C# Font.ToLogFont怎么用?C# Font.ToLogFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Font的用法示例。


在下文中一共展示了Font.ToLogFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFontFaceName

 public static string GetFontFaceName(string fn)
 {
     Font ft = new Font(fn, 9F);
     LOGFONT lt = new LOGFONT();
     ft.ToLogFont(lt);
     return lt.lfFaceName;
 }
开发者ID:zhuangyy,项目名称:Motion,代码行数:7,代码来源:FontHelper.cs

示例2: SetFont

        public void SetFont(Font font)
        {
            var lf = new LogFont();
            font.ToLogFont(lf);
            lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;

            NativeMethods.SendMessage(hIMEWnd, (int) WindowMessage.WM_IME_CONTROL, IMC_SETCOMPOSITIONFONT, lf);
        }
开发者ID:alexisjojo,项目名称:ktibiax,代码行数:8,代码来源:IMEWindow.cs

示例3: CreateFontObject

        private static IntPtr CreateFontObject(Font font, bool antiAliasing)
        {
            NativeStructs.LOGFONT logFont = new NativeStructs.LOGFONT();
            font.ToLogFont(logFont);

            int nHeight = logFont.lfHeight;
            int nWidth = logFont.lfWidth;
            int nEscapement = logFont.lfEscapement;
            int nOrientation = logFont.lfOrientation;
            int fnWeight = logFont.lfWeight;
            uint fdwItalic = logFont.lfItalic;
            uint fdwUnderline = logFont.lfUnderline;
            uint fdwStrikeOut = logFont.lfStrikeOut;
            uint fdwCharSet = logFont.lfCharSet;
            uint fdwOutputPrecision = logFont.lfOutPrecision;
            uint fdwClipPrecision = logFont.lfClipPrecision;
            uint fdwQuality;
            
            if (antiAliasing)
            {
                fdwQuality = NativeConstants.ANTIALIASED_QUALITY;
            }
            else
            {
                fdwQuality = NativeConstants.NONANTIALIASED_QUALITY;
            }

            uint fdwPitchAndFamily = logFont.lfPitchAndFamily;
            string lpszFace = logFont.lfFaceName;

            IntPtr hFont = SafeNativeMethods.CreateFontW(
                nHeight,
                nWidth,
                nEscapement,
                nOrientation,
                fnWeight,
                fdwItalic,
                fdwUnderline,
                fdwStrikeOut,
                fdwCharSet,
                fdwOutputPrecision,
                fdwClipPrecision,
                fdwQuality,
                fdwPitchAndFamily,
                lpszFace);

            if (hFont == IntPtr.Zero)
            {
                NativeMethods.ThrowOnWin32Error("CreateFontW returned NULL");
            }

            return hFont;
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:53,代码来源:Fonts.cs

示例4: ToLogFont_TooSmall

		public void ToLogFont_TooSmall ()
		{
			Font f = new Font ("Arial", 10);
			object o = new object ();
			f.ToLogFont (o);
			// no PInvoke conversion exists !?!?
		}
开发者ID:frje,项目名称:SharpLang,代码行数:7,代码来源:TestFont.cs

示例5: ToLogFont_Int

		public void ToLogFont_Int ()
		{
			Font f = new Font ("Arial", 10);
			int i = 1;
			f.ToLogFont (i);
			Assert.AreEqual (1, i);
		}
开发者ID:frje,项目名称:SharpLang,代码行数:7,代码来源:TestFont.cs

示例6: ToLogFont_DenyUnmanagedCode

		public void ToLogFont_DenyUnmanagedCode ()
		{
			Font f;
			LOGFONT	lf;

			lf = new LOGFONT();
			f = new Font("Arial", 10);

			f.ToLogFont(lf);
		}
开发者ID:frje,项目名称:SharpLang,代码行数:10,代码来源:TestFont.cs

示例7: ToLogFont_AssertUnmanagedCode

		public void ToLogFont_AssertUnmanagedCode ()
		{
			Font f = new Font("Arial", 10);
			LOGFONT	lf = new LOGFONT();

			f.ToLogFont (lf);
			Assert.AreEqual (400, lf.lfWeight, "lfWeight");
			Assert.AreEqual (1, lf.lfCharSet, "lfCharSet");
			Assert.AreEqual (f.Name, lf.lfFaceName, "lfFaceName");

			LOGFONT_STRUCT lfs = new LOGFONT_STRUCT ();
			f.ToLogFont (lfs);
			Assert.AreEqual (0, lfs.lfWeight, "struct-lfWeight");
			Assert.AreEqual (0, lfs.lfCharSet, "struct-lfCharSet");
			Assert.AreEqual (0, lfs.lfHeight, "struct-lfHeight");
			Assert.AreEqual (0, lfs.lfWidth, "struct-lfWidth");
			Assert.AreEqual (0, lfs.lfEscapement, "struct-lfEscapement");
			Assert.AreEqual (0, lfs.lfOrientation, "struct-lfOrientation");
			Assert.AreEqual (0, lfs.lfWeight, "struct-lfWeight");
			Assert.AreEqual (0, lfs.lfItalic, "struct-lfItalic");
			Assert.AreEqual (0, lfs.lfUnderline, "struct-lfUnderline");
			Assert.AreEqual (0, lfs.lfStrikeOut, "struct-lfStrikeOut");
			Assert.AreEqual (0, lfs.lfCharSet, "struct-lfCharSet");
			Assert.AreEqual (0, lfs.lfOutPrecision, "struct-lfOutPrecision");
			Assert.AreEqual (0, lfs.lfClipPrecision, "struct-lfClipPrecision");
			Assert.AreEqual (0, lfs.lfQuality, "struct-lfQuality");
			Assert.AreEqual (0, lfs.lfPitchAndFamily, "struct-lfPitchAndFamily");
			Assert.IsNull (lfs.lfFaceName, "struct-lfFaceName");
		}
开发者ID:frje,项目名称:SharpLang,代码行数:29,代码来源:TestFont.cs

示例8: GetLogFont

 public static void GetLogFont(Font font, Graphics graphics, out LOGFONT logfont)
 {
     object o = new LOGFONT();
     if (graphics != null)
     {
         font.ToLogFont(o, graphics);
     }
     else
     {
         font.ToLogFont(o);
     }
     logfont = (LOGFONT)o;
 }
开发者ID:programmatom,项目名称:TextEditor,代码行数:13,代码来源:Gdi.cs

示例9: SetIMEWindowFont

		private void SetIMEWindowFont(Font f)
		{
			if (lf == null) {
				lf = new LOGFONT();
				f.ToLogFont(lf);
				lf.lfFaceName = f.Name;  // This is very important! "Font.ToLogFont" Method sets invalid value to LOGFONT.lfFaceName
			}

			SendMessage(
			            hIMEWnd,
			            WM_IME_CONTROL,
			            new IntPtr(IMC_SETCOMPOSITIONFONT),
			            lf
			           );
		}
开发者ID:viticm,项目名称:pap2,代码行数:15,代码来源:Ime.cs

示例10: LoadSubtitles

    public bool LoadSubtitles(IGraphBuilder graphBuilder, string filename)
    {
      FreeSubtitles();
      LoadSettings();

      {
        //remove InternalScriptRenderer as it takes subtitle pin
        IBaseFilter isr = null;
        DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.InternalScriptRenderer, out isr);
        if (isr != null)
        {
          graphBuilder.RemoveFilter(isr);
          DirectShowUtil.ReleaseComObject(isr);
        }
      }

      vobSub = (IDirectVobSub)DirectVobSubUtil.AddToGraph(graphBuilder);
      if (vobSub == null)
        return false;

      {
        //set style
        Log.Debug("VideoPlayerVMR9: Setting DirectVobsub parameters");
        LOGFONT logFont = new LOGFONT();
        int txtcolor;
        bool fShadow, fOutLine, fAdvancedRenderer = false;
        int size = Marshal.SizeOf(typeof(LOGFONT));
        vobSub.get_TextSettings(logFont, size, out txtcolor, out fShadow, out fOutLine, out fAdvancedRenderer);
        FontStyle fontStyle = defStyle.fontIsBold ? FontStyle.Regular : FontStyle.Bold;
        Font Subfont = new Font(defStyle.fontName, defStyle.fontSize, fontStyle, GraphicsUnit.Point,
                                (byte)defStyle.fontCharset);
        Subfont.ToLogFont(logFont);
        fShadow = defStyle.shadow > 0;
        fOutLine = defStyle.isBorderOutline;
        vobSub.put_TextSettings(logFont, size, defStyle.fontColor, fShadow, fOutLine, fAdvancedRenderer);
        vobSub.put_FileName(filename);

        bool fBuffer, fOnlyForced, fPolygonize;
        vobSub.get_VobSubSettings(out fBuffer, out fOnlyForced, out fPolygonize);
        vobSub.put_VobSubSettings(fBuffer, !this.autoShow, fPolygonize);
      }

      {
        //load sub streams
        IBaseFilter hms = null;
        DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.HaaliGuid, out hms);
        if (hms == null)
          DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.LAVFilterSource, out hms);
        if (hms == null)
          DirectShowUtil.FindFilterByClassID(graphBuilder, ClassId.LAVFilter, out hms);
        embeddedSelector = hms as IAMStreamSelect;
        if (embeddedSelector != null)
        {
          AddStreams(embeddedSelector);
        }

        vobSub.get_LanguageCount(out extCount);
        if (intSubs.Count > 0)
        {
          //if there are embedded subtitles,
          //last stream of directvobsub is currently selected embedded subtitle
          extCount--;
        }
      }

      FFDShowEngine.DisableFFDShowSubtitles(graphBuilder);

      Current = 0;
      if (selectionOff)
      {
        Enable = false;
      }
      else
      {
        Enable = autoShow;
      }
      return true;
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:78,代码来源:DirectVobSubEngine.cs

示例11: Dispose_ToLogFont_LoopCharSet

		public void Dispose_ToLogFont_LoopCharSet ()
		{
#if !TARGET_JVM
			Font f = new Font (name, 12.5f);
			f.Dispose ();
			LOGFONT lf = new LOGFONT ();

			for (int i = Byte.MinValue; i < Byte.MaxValue; i++) {
				byte b = (byte) i;
				lf.lfHeight = b;
				lf.lfWidth = b;
				lf.lfEscapement = b;
				lf.lfOrientation = b;
				lf.lfWeight = b;
				lf.lfItalic = b;
				lf.lfUnderline = b;
				lf.lfStrikeOut = b;
				lf.lfCharSet = b;
				lf.lfOutPrecision = b;
				lf.lfClipPrecision = b;
				lf.lfQuality = b;
				lf.lfPitchAndFamily = b;
				lf.lfFaceName = b.ToString ();
				try {
					f.ToLogFont (lf);
				}
				catch (ArgumentException) {
					Assert.AreEqual (b, lf.lfHeight, "lfHeight");
					Assert.AreEqual (b, lf.lfWidth, "lfWidth");
					Assert.AreEqual (b, lf.lfEscapement, "lfEscapement");
					Assert.AreEqual (b, lf.lfOrientation, "lfOrientation");
					Assert.AreEqual (b, lf.lfWeight, "lfWeight");
					Assert.AreEqual (b, lf.lfItalic, "lfItalic");
					Assert.AreEqual (b, lf.lfUnderline, "lfUnderline");
					Assert.AreEqual (b, lf.lfStrikeOut, "lfStrikeOut");
					// special case for 0
					Assert.AreEqual ((i == 0) ? (byte)1 : b, lf.lfCharSet, "lfCharSet");
					Assert.AreEqual (b, lf.lfOutPrecision, "lfOutPrecision");
					Assert.AreEqual (b, lf.lfClipPrecision, "lfClipPrecision");
					Assert.AreEqual (b, lf.lfQuality, "lfQuality");
					Assert.AreEqual (b, lf.lfPitchAndFamily, "lfPitchAndFamily");
					Assert.AreEqual (b.ToString (), lf.lfFaceName, "lfFaceName");
				}
				catch (Exception e) {
					Assert.Fail ("Unexcepted exception {0} at iteration {1}", e, i);
				}
			}
#endif
		}
开发者ID:frje,项目名称:SharpLang,代码行数:49,代码来源:TestFont.cs

示例12: FontToLogFont

 static private void FontToLogFont(Font value, NativeMethods.LOGFONT logfont) {
     value.ToLogFont(logfont);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:3,代码来源:RichTextBox.cs

示例13: IsSymbolFont

 /// <summary>
 /// Determines whether a font uses the 'symbol' character set.
 /// </summary>
 /// <remarks>
 /// Symbol fonts do not typically contain glyphs that represent letters of the alphabet.
 /// Instead they might contain pictures and symbols. As such, they are not useful for
 /// drawing text. Which means you can't use a symbol font to write out its own name for
 /// illustrative purposes (like for the font drop-down chooser).
 /// </remarks>
 public static bool IsSymbolFont(Font font)
 {
     NativeStructs.LOGFONT logFont = new NativeStructs.LOGFONT();
     font.ToLogFont(logFont);
     return logFont.lfCharSet == NativeConstants.SYMBOL_CHARSET;
 }
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:15,代码来源:Fonts.cs

示例14: LogicalFont

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="LogicalFont"/> class.
		/// </summary>
		/// <param name="createFrom">The font to use as the basis for the logical font.</param>
		/// <remarks>If it's not obvious why we need this class in order to determine if a font
		/// is a symbol font, see the Dr. Gui article entitled
		/// <see href="http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnaraskdr/html/askgui12302003.asp">
		/// Determining the Character Set Used by a Font</see></remarks>
		/// ------------------------------------------------------------------------------------
		public LogicalFont(Font createFrom)
		{
			createFrom.ToLogFont(this);
		}
开发者ID:sillsdev,项目名称:CarlaLegacy,代码行数:14,代码来源:Win32Wrappers.cs

示例15: Dispose_ToLogFont

		public void Dispose_ToLogFont ()
		{
			Font f = new Font (name, 12.5f);
			f.Dispose ();
			LOGFONT	lf = new LOGFONT();
			f.ToLogFont (lf);
		}
开发者ID:jamescourtney,项目名称:mono,代码行数:7,代码来源:TestFont.cs


注:本文中的System.Drawing.Font.ToLogFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。