Beispiel #1
0
        public static double GetFontSize(sz _sz)
        {
            double normalSize = Val(28);
            double fontSize   = normalSize;

            switch (_sz)
            {
            case sz.Micro:
                fontSize = normalSize * 0.4;
                break;

            case sz.Small:
                fontSize = normalSize * 0.7;
                break;

            case sz.Normal:
                fontSize = normalSize;
                break;

            case sz.Large:
                fontSize = normalSize * 1.5;
                break;

            case sz.Big:
                fontSize = normalSize * 2.0;
                break;

            case sz.Vast:
                fontSize = normalSize * 2.5;
                break;
            }
            return(fontSize);
        }
Beispiel #2
0
        public static Button GetButton(string text, sz _sz)
        {
            int w = 0, d = 35;

            if (_sz == sz.Small)
            {
                w = Global.ButtonSizeWidthSmall;
                d = 30;
            }
            else if (_sz == sz.Normal)
            {
                w = Global.ButtonSizeWidthMedium;
                d = 30;
            }
            else if (_sz == sz.Large)
            {
                w = Global.ButtonSizeWidthLarge;
                d = 30;
            }

            return(new Button
            {
                Text = text,
                WidthRequest = Format.Val(w + d),
                HeightRequest = ButtonHeight * Device.OnPlatform(1.5, 1, 1),
                BackgroundColor = Color.Blue,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
            });
        }
Beispiel #3
0
        //public static Style EditorStyle(sz _sz)
        //{
        //    double fsize = GetFontSize(_sz);
        //    var editorStyle = new Style(typeof(ExtendedEditor))
        //    {
        //        Setters = {
        //            new Setter { Property = ExtendedEditor.FontProperty, Value = Font.OfSize("Open 24 Display St", fsize) },
        //            //new Setter { Property = ExtendedEditor.BackgroundColorProperty, Value = Color.FromRgb(232,235,235) },
        //        }
        //    };
        //    return editorStyle;
        //}

        public static Style CheckBoxStyle(sz _sz)
        {
            double fsize      = GetFontSize(_sz);
            var    checkStyle = new Style(typeof(CheckBox))
            {
                Setters =
                {
                    new Setter {
                        Property = CheckBox.FontSizeProperty, Value = fsize
                    },
                }
            };

            return(checkStyle);
        }
Beispiel #4
0
        public static Style LabelStyle(sz _sz)
        {
            double fsize      = GetFontSize(_sz);
            var    labelStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter {
                        Property = Label.FontProperty, Value = Font.OfSize("Open 24 Display St", fsize)
                    },
                }
            };

            return(labelStyle);
        }
Beispiel #5
0
        public static Style ButtonStyle(sz _sz)
        {
            double fsize       = GetFontSize(_sz);
            var    buttonStyle = new Style(typeof(Button))
            {
                Setters =
                {
                    new Setter {
                        Property = Button.FontSizeProperty, Value = fsize
                    },
                    new Setter {
                        Property = Button.BackgroundColorProperty, Value = Color.Transparent
                    },
                }
            };

            return(buttonStyle);
        }
Beispiel #6
0
        public static Style ImageStyle(sz _sz)
        {
            double fsize      = GetFontSize(_sz);
            var    imageStyle = new Style(typeof(Image))
            {
                Setters =
                {
                    new Setter {
                        Property = Image.AspectProperty, Value = Aspect.AspectFit
                    },
                    new Setter {
                        Property = Image.WidthRequestProperty, Value = fsize * 2
                    },
                    new Setter {
                        Property = Image.HeightRequestProperty, Value = fsize * 2
                    },
                }
            };

            return(imageStyle);
        }
Beispiel #7
0
        public static Style EntryStyle(sz _sz)
        {
            double fsize      = GetFontSize(_sz);
            var    entryStyle = new Style(typeof(ExtendedEntry))
            {
                Setters =
                {
                    new Setter {
                        Property = ExtendedEntry.FontProperty, Value = Font.OfSize("Open 24 Display St", fsize)
                    },
                    new Setter {
                        Property = ExtendedEntry.PlaceholderTextColorProperty, Value = Global.PlaceHolderColor
                    },
                    new Setter {
                        Property = ExtendedEntry.BackgroundColorProperty, Value = Color.FromRgb(250, 250, 250)
                    },
                }
            };

            return(entryStyle);
        }