Skip to content

Instantly share code, notes, and snippets.

@SamedBll
Created August 24, 2017 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamedBll/01b2a41b62b5b82d5f4e60b4745ef8aa to your computer and use it in GitHub Desktop.
Save SamedBll/01b2a41b62b5b82d5f4e60b4745ef8aa to your computer and use it in GitHub Desktop.
B(C) - 22 (2)
public class FontSizesPage : ContentPage
{
public FontSizesPage()
{
BackgroundColor = Color.White;
StackLayout stackLayout = new StackLayout
{
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center
};
// Do the NamedSize values.
NamedSize[] namedSizes =
{
NamedSize.Default, NamedSize.Micro, NamedSize.Small,
NamedSize.Medium, NamedSize.Large
};
foreach (NamedSize namedSize in namedSizes)
{
double fontSize = Device.GetNamedSize(namedSize, typeof(Label));
stackLayout.Children.Add(new Label
{
Text = String.Format("Named Size = {0} ({1:F2})", namedSize, fontSize),
FontSize = fontSize,
TextColor = Color.Black
});
}
// İnç başına aygıta bağlı olmayan birimlerdeki çözünürlük.
double resolution = 160;
// Yatay ayırıcı çizgiyi çiz.
stackLayout.Children.Add(
new BoxView
{
Color = Color.Accent,
HeightRequest = resolution / 80
});
// Bazı sayısal point (nokta) boyutları yapın.
int[] ptSizes = { 4, 6, 8, 10, 12 };
foreach (double ptSize in ptSizes)
{
double fontSize = resolution * ptSize / 72;
stackLayout.Children.Add(new Label
{
Text = String.Format("Point Size = {0} ({1:F2})", ptSize, fontSize),
FontSize = fontSize,
TextColor = Color.Black
});
}
Content = stackLayout;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment