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


C# FontStyle.ToString方法代码示例

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


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

示例1: CreateFont

		private void CreateFont (string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical)
		{
#if ONLY_1_1
			if (familyName == null)
				throw new ArgumentNullException ("familyName");
#endif
			originalFontName = familyName;
                        FontFamily family;
			// NOTE: If family name is null, empty or invalid,
			// MS creates Microsoft Sans Serif font.
			try {
				family = new FontFamily (familyName);
			}
			catch (Exception){
				family = FontFamily.GenericSansSerif;
			}

			setProperties (family, emSize, style, unit, charSet, isVertical);           
			Status status = GDIPlus.GdipCreateFont (family.NativeObject, emSize,  style, unit, out fontObject);
			
			if (status == Status.FontStyleNotFound)
				throw new ArgumentException (Locale.GetText ("Style {0} isn't supported by font {1}.", style.ToString (), familyName));
				
			GDIPlus.CheckStatus (status);
		}
开发者ID:LevNNN,项目名称:mono,代码行数:25,代码来源:Font.cs

示例2: GetPdfFontStyle

 private PdfFontStyle GetPdfFontStyle(FontStyle style)
 {
     return (PdfFontStyle)Enum.Parse(typeof(PdfFontStyle), style.ToString(), false);
 }
开发者ID:e-iceblue,项目名称:Spire.Office-for-.NET,代码行数:4,代码来源:PdfInternalFont.cs

示例3: MeasureTextNoTrim

 private Size MeasureTextNoTrim(string text, int size, FontStyle style)
 {
     var closest = GetClosestFontSize(size);
     var scale = size / (float) closest;
     var measure = GetFont(Path.Combine(style.ToString(), closest.ToString())).MeasureString(text);
     return new Size((int) (Math.Round(measure.X * scale)), (int) (Math.Round(measure.Y * scale)));
 }
开发者ID:Pyratron,项目名称:PyraUI,代码行数:7,代码来源:Renderer.cs

示例4: DrawString

        public override void DrawString(string text, Point point, Brush brush, int size, FontStyle style,
            Rectangle bounds,
            bool ignoreFormatting = false)
        {
            SetClipArea(bounds);
            var pos = new Vector2((int) Math.Round(point.X), (int) Math.Round(point.Y));
            var closest = GetClosestFontSize(size);

            var colorBrush = brush as ColorBrush;
            var gradientBrush = brush as GradientBrush;
            var defaultColor = Color.Black;
            if (colorBrush != null)
                defaultColor = colorBrush.Color;

            if (gradientBrush != null)
            {
                UseMaskStencil(bounds);
            }

            if (!ignoreFormatting) // If formatting is enabled, parse it and render each part.
            {
                var parts = ParseFormattedText(text, defaultColor, style);
                foreach (var part in parts)
                {
                    var font = GetFont(Path.Combine(part.Style.ToString(), closest.ToString()));
                    var measure = MeasureTextNoTrim(part.Text, size, part.Style);
                    var col = new ColorXNA(part.Color.R, part.Color.G, part.Color.B, defaultColor.A);

                    manager.SpriteBatch.DrawString(font, part.Text, pos,
                        col * (defaultColor.A / 255f), 0,
                        Vector2.Zero, size / (float) closest, SpriteEffects.None, 0);
                    pos = new Vector2(pos.X + (float) measure.Width, pos.Y);
                }
            }
            else // Draw plain string
            {
                var font = GetFont(Path.Combine(style.ToString(), closest.ToString()));
                var col = new ColorXNA(defaultColor.R, defaultColor.G, defaultColor.B, defaultColor.A);
                manager.SpriteBatch.DrawString(font, text, pos,
                    col * (defaultColor.A / 255f), 0,
                    Vector2.Zero, size / (float) closest, SpriteEffects.None, 0);
            }

            // If using a gradient brush, draw a gradient over the mask.
            if (gradientBrush != null)
            {
                UseRenderStencil();
                DrawGradient(bounds, gradientBrush);
                EndStencil();
            }

            ResetClipArea();
        }
开发者ID:Pyratron,项目名称:PyraUI,代码行数:53,代码来源:Renderer.cs

示例5: GetFontStyleEnum

 protected string GetFontStyleEnum(FontStyle fontStyle)
 {
     return fontStyle.ToString();
 }
开发者ID:gipasoft,项目名称:Sfera,代码行数:4,代码来源:ReportHelper.cs

示例6: WriteFontStyleProperty

 private static void WriteFontStyleProperty(System.Xml.XmlWriter writer, FontStyle font)
 {
     writer.WriteString(font.ToString());
 }
开发者ID:ThrDev,项目名称:LiteDevelop,代码行数:4,代码来源:AppearanceDescription.cs

示例7: createHashString

 private static string createHashString(string fontFamilyName, float pointSize, FontStyle style)
 {
     return (fontFamilyName + pointSize.ToString() + style.ToString());
 }
开发者ID:Riketta,项目名称:Stronghold-Kingdoms,代码行数:4,代码来源:FontManager.cs

示例8: GetDescription

        public static string GetDescription(string name, float size, FontStyle style, GraphicsUnit unit,
                                            string nameAndPropertiesFormat)
        {
            string properties = string.Format("{0} {1}{2}",
                                              size,
                                              unit.ToString().ToLower(),
                                              style != FontStyle.Regular ? ", " + style.ToString().ToLower() : "");

            return string.Format(nameAndPropertiesFormat, name, properties);
        }
开发者ID:Rafael-Lin,项目名称:TypingPractice,代码行数:10,代码来源:FontInfo.cs


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