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


C# IDisplay.HeightRequestInInches方法代码示例

本文整理汇总了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;
		}
开发者ID:jdluzen,项目名称:Xamarin-Forms-Labs,代码行数:29,代码来源:AbsoluteLayoutWithDisplayInfoPage.cs

示例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;
        }
开发者ID:nrogoff,项目名称:Xamarin-Forms-Labs,代码行数:60,代码来源:FontManagerPage.cs

示例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;
        }
开发者ID:GGHG72,项目名称:Xamarin-Forms-Labs,代码行数:42,代码来源:FontManagerPage.cs

示例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 });
        }
开发者ID:,项目名称:,代码行数:74,代码来源:


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