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


C# Font.ToUIFont方法代码示例

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


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

示例1: GetHeight

 /// <summary>
 /// Gets height for the font.
 /// </summary>
 /// <param name="font">Font whose height is calculated.</param>
 /// <returns>Height of the font in inches.</returns>
 public double GetHeight(Font font)
 {
     return font.ToUIFont().Ascender 
         * UIScreen.MainScreen.Scale 
         * this.display.ScreenHeightInches() 
         / this.display.Height;
 }
开发者ID:jdluzen,项目名称:Xamarin-Forms-Labs,代码行数:12,代码来源:FontManager.cs

示例2: UpdateFromFormsControl

		public static void UpdateFromFormsControl (this UILabel uiLabel, string text, TextAlignment textAlignment, Color textColor, Font font)
		{
			uiLabel.Text = text;
			uiLabel.TextAlignment = textAlignment.ToUITextAlignment ();
			uiLabel.TextColor = textColor.ToUIColor ();
			uiLabel.Font = font.ToUIFont ();
		}
开发者ID:JoshuaNovak919,项目名称:Xamarin.Forms.Plugins,代码行数:7,代码来源:UILabelExtensions.cs

示例3: AddText

		/// <summary>
		/// Adds the text.
		/// </summary>
		/// <param name="source">The source.</param>
		/// <param name="text">The text.</param>
		/// <param name="point">The point.</param>
		/// <param name="font">The font.</param>
		/// <param name="color">The color.</param>
		/// <returns>Task&lt;ImageSource&gt;.</returns>
		public static async Task<ImageSource> AddText(
			this StreamImageSource source,
			string text,
			CGPoint point,
			Font font,
			Color color)
		{
			var token = new CancellationTokenSource();
			var stream = await source.Stream(token.Token);
			var image = UIImage.LoadFromData(NSData.FromStream(stream));

			var bytes = image.AddText(text, point, font.ToUIFont(), color.ToUIColor()).AsPNG().ToArray();

			return ImageSource.FromStream(() => new MemoryStream(bytes));
		}
开发者ID:Jaskomal,项目名称:Xamarin-Forms-Labs,代码行数:24,代码来源:UIImageExtensions.cs

示例4: UpdateFromFormsControl

		public static void UpdateFromFormsControl (this UILabel uiLabel, string text, Xamarin.Forms.TextAlignment textAlignment, Color textColor, Font font)
		{
			uiLabel.Text = text;

			switch (textAlignment) {
			case TextAlignment.Start:
				uiLabel.TextAlignment = UITextAlignment.Left;
				break;
			case TextAlignment.Center: 
				uiLabel.TextAlignment = UITextAlignment.Center;
				break;
			case TextAlignment.End: 
				uiLabel.TextAlignment = UITextAlignment.Right;
				break;
			}

			uiLabel.TextColor = textColor.ToUIColor ();
			uiLabel.Font = font.ToUIFont ();
		}
开发者ID:patridge,项目名称:Xamarin.Forms.Plugins,代码行数:19,代码来源:UILabelExtensions.cs

示例5: GetHeight

        public double GetHeight(Font font)
        {
            var height = (double)string.Empty.StringHeight(font.ToUIFont(), float.MaxValue);

            return height * this.display.ScreenHeightInches() / this.display.Height;
        }
开发者ID:Gunner92,项目名称:Xamarin-Forms-Labs,代码行数:6,代码来源:FontManager.cs


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