Created
August 24, 2017 03:33
-
-
Save SamedBll/01b2a41b62b5b82d5f4e60b4745ef8aa to your computer and use it in GitHub Desktop.
B(C) - 22 (2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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