本文整理汇总了C#中IDisplay.HeightRequestInInches方法的典型用法代码示例。如果您正苦于以下问题:C# IDisplay.HeightRequestInInches方法的具体用法?C# IDisplay.HeightRequestInInches怎么用?C# IDisplay.HeightRequestInInches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDisplay
的用法示例。
在下文中一共展示了IDisplay.HeightRequestInInches方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AbsoluteLayoutWithDisplayInfoPage
/// <summary>
/// Initializes a new instance of the <see cref="AbsoluteLayoutWithDisplayInfoPage" /> class.
/// </summary>
/// <param name="display">The display.</param>
public AbsoluteLayoutWithDisplayInfoPage(IDisplay display)
{
this.Title = "Absolute Layout With Display Info";
var abs = new AbsoluteLayout();
var inchX = display.WidthRequestInInches(1);
var inchY = display.HeightRequestInInches(1);
var originX = display.WidthRequestInInches(display.ScreenWidthInches() / 2);
var originY = display.HeightRequestInInches(display.ScreenHeightInches() / 2);
abs.Children.Add(new Label() { Text = "1\"x\"1\" blue frame" });
abs.Children.Add(new Frame()
{
BackgroundColor = Color.Navy,
},
new Rectangle(originX - inchX/2, originY - inchY/2, inchX, inchY));
abs.Children.Add(new Frame()
{
BackgroundColor = Color.White
},
new Rectangle(originX - inchX/16, originY - inchY/16, inchX/8, inchY/8));
this.Content = abs;
}
示例2: FontManagerPage
/// <summary>
/// Initializes a new instance of the <see cref="FontManagerPage"/> class.
/// </summary>
/// <param name="display">The display.</param>
/// <param name="fontManager">The font manager.</param>
public FontManagerPage(IDisplay display, IFontManager fontManager)
{
var stack = new StackLayout();
foreach (var namedSize in Enum.GetValues(typeof(NamedSize)))
{
var font = Font.SystemFontOfSize((NamedSize)namedSize);
var height = fontManager.GetHeight(font);
var heightRequest = display.HeightRequestInInches(height);
var label = new Label()
{
Font = font,
HeightRequest = heightRequest + 10,
Text = string.Format("System font {0} is {1:0.000}in tall.", namedSize, height),
XAlign = TextAlignment.Center
};
stack.Children.Add(label);
}
var f = Font.SystemFontOfSize(24);
var inchFont = fontManager.FindClosest(f.FontFamily, fontSize);
stack.Children.Add(new Label()
{
Text = "The below text should be " + fontSize + "in height from its highest point to lowest.",
XAlign = TextAlignment.Center
});
stack.Children.Add(new Label()
{
Text = "FfTtLlGgJjPp",
TextColor = Color.Lime,
FontSize = inchFont.FontSize,
// BackgroundColor = Color.Gray,
// FontFamily = inchFont.FontFamily,
XAlign = TextAlignment.Center,
YAlign = TextAlignment.Start
});
stack.Children.Add(new Label()
{
Text = fontSize + "in height = SystemFontOfSize(" + inchFont.FontSize + ")",
XAlign = TextAlignment.Center,
YAlign = TextAlignment.End
});
this.Content = stack;
}
示例3: FontManagerPage
public FontManagerPage(IDisplay display)
{
var stack = new StackLayout();
foreach (var namedSize in Enum.GetValues(typeof(NamedSize)))
{
var font = Font.SystemFontOfSize((NamedSize)namedSize);
var height = display.FontManager.GetHeight(font);
var heightRequest = display.HeightRequestInInches(height);
var label = new Label()
{
Font = font,
HeightRequest = heightRequest + 10,
Text = string.Format("System font {0} is {1:0.000}in tall.", namedSize, height),
XAlign = TextAlignment.Center
};
stack.Children.Add(label);
}
var f = Font.SystemFontOfSize(24);
var inchFont = display.FontManager.FindClosest(f.FontFamily, 0.25);
stack.Children.Add(new Label()
{
Text = "The below text should be 1/4 inch height from its highest point to lowest.",
XAlign = TextAlignment.Center
});
stack.Children.Add(new Label()
{
Text = "ftlgjp",
Font = inchFont,
XAlign = TextAlignment.Center
});
this.Content = stack;
}
示例4: FontManagerPage
/// <summary>
/// Initializes a new instance of the <see cref="FontManagerPage"/> class.
/// </summary>
/// <param name="display">The display.</param>
/// <param name="fontManager">The font manager.</param>
public FontManagerPage(IDisplay display, IFontManager fontManager)
{
var stack = new StackLayout();
foreach (var namedSize in Enum.GetValues(typeof(NamedSize)))
{
var font = Font.SystemFontOfSize((NamedSize)namedSize);
var height = fontManager.GetHeight(font);
var heightRequest = display.HeightRequestInInches(height);
var label = new Label()
{
Font = font,
HeightRequest = heightRequest + 10,
Text = string.Format("System font {0} is {1:0.000}in tall.", namedSize, height),
XAlign = TextAlignment.Center
};
stack.Children.Add(label);
}
var f = Font.SystemFontOfSize(24);
var inchFont = fontManager.FindClosest(f.FontFamily, FontSize);
stack.Children.Add(new Label()
{
Text = "The below text should be " + FontSize + "in height from its highest point to lowest.",
XAlign = TextAlignment.Center
});
stack.Children.Add(new Label()
{
Text = "FfTtLlGgJjPp",
TextColor = Color.Lime,
FontSize = inchFont.FontSize,
// BackgroundColor = Color.Gray,
// FontFamily = inchFont.FontFamily,
XAlign = TextAlignment.Center,
YAlign = TextAlignment.Start
});
stack.Children.Add(new Label()
{
Text = FontSize + "in height = SystemFontOfSize(" + inchFont.FontSize + ")",
XAlign = TextAlignment.Center,
YAlign = TextAlignment.End
});
this.Children.Add(new ContentPage() { Title = "Sizes", Content = stack });
var listView = new ListView
{
ItemsSource = fontManager.AvailableFonts,
ItemTemplate = new DataTemplate(() =>
{
var label = new Label();
label.SetBinding(Label.TextProperty, ".");
label.SetBinding(Label.FontFamilyProperty, ".");
return new ViewCell { View = label};
})
};
this.Children.Add(new ContentPage { Title = "Fonts", Content = listView });
}