本文整理汇总了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;
}
示例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 ();
}
示例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<ImageSource>.</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));
}
示例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 ();
}
示例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;
}