Beispiel #1
0
        public void SetData(HorizontalAlignment horAl, VerticalAlignment verAl)
        {
            if (horAl == HorizontalAlignment.Left)
            {
                Button_LeftAlign.SetCheckedNoCall(true);
            }
            else if (horAl == HorizontalAlignment.Center)
            {
                Button_CenterAlign.SetCheckedNoCall(true);
            }
            else if (horAl == HorizontalAlignment.Right)
            {
                Button_RightAlign.SetCheckedNoCall(true);
            }


            if (verAl == VerticalAlignment.Top)
            {
                Button_VTopAlign.SetCheckedNoCall(true);
            }
            else if (verAl == VerticalAlignment.Center)
            {
                Button_VCenterAlign.SetCheckedNoCall(true);
            }
            else if (verAl == VerticalAlignment.Bottom)
            {
                Button_VBottomAlign.SetCheckedNoCall(true);
            }

            val = verAl;
            hal = horAl;
        }
Beispiel #2
0
        private void Button_Align_OnCheckChanged(object sender, bool IsChecked)
        {
            if (sender == Button_LeftAlign)
            {
                hal = HorizontalAlignment.Left;
                Button_LeftAlign.SetCheckedNoCall(true);
                Button_RightAlign.SetCheckedNoCall(false);
                Button_CenterAlign.SetCheckedNoCall(false);
            }
            else if (sender == Button_CenterAlign)
            {
                hal = HorizontalAlignment.Center;
                Button_RightAlign.SetCheckedNoCall(false);
                Button_LeftAlign.SetCheckedNoCall(false);
                Button_CenterAlign.SetCheckedNoCall(true);
            }
            else if (sender == Button_RightAlign)
            {
                hal = HorizontalAlignment.Right;
                Button_CenterAlign.SetCheckedNoCall(false);
                Button_LeftAlign.SetCheckedNoCall(false);
                Button_RightAlign.SetCheckedNoCall(true);
            }
            else if (sender == Button_VTopAlign)
            {
                val = VerticalAlignment.Top;
                Button_VCenterAlign.SetCheckedNoCall(false);
                Button_VBottomAlign.SetCheckedNoCall(false);
                Button_VTopAlign.SetCheckedNoCall(true);
            }
            else if (sender == Button_VCenterAlign)
            {
                val = VerticalAlignment.Center;
                Button_VTopAlign.SetCheckedNoCall(false);
                Button_VBottomAlign.SetCheckedNoCall(false);
                Button_VCenterAlign.SetCheckedNoCall(true);
            }
            else if (sender == Button_VBottomAlign)
            {
                val = VerticalAlignment.Bottom;
                Button_VTopAlign.SetCheckedNoCall(false);
                Button_VCenterAlign.SetCheckedNoCall(false);
                Button_VBottomAlign.SetCheckedNoCall(true);
            }

            if (ChangedAlign != null)
            {
                ChangedAlign(hal, val);
            }
        }
Beispiel #3
0
        public void Load(Control control, DataStore data)
        {
            cont = control;

            try
            {
                ComboBox_FontName.Text = cont.FontFamily.ToString();


                try
                {
                    if (Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\GoodTeacher\\Temp\\"))
                    {
                        foreach (System.Windows.Media.FontFamily fm in Fonts.GetFontFamilies(new Uri(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\GoodTeacher\\Temp\\")))
                        {
                            Debug.WriteLine(fm.ToString().Substring(3));
                            Debug.WriteLine("EXIST: " + data.FontManager.Exists(item => item.FontFamilyName == fm.ToString().Substring(3)));
                            if (data.FontManager.Exists(item => item.FontFamilyName == fm.ToString().Substring(3)))
                            {
                                Label labelf = new Label();
                                labelf.Content    = fm.ToString().Substring(3);
                                labelf.FontFamily = fm;
                                labelf.FontSize   = 14;
                                labelf.ToolTip    = fm.ToString();
                                labelf.Foreground = new SolidColorBrush(Color.FromRgb(19, 87, 48));
                                ComboBox_FontName.Items.Add(labelf);
                            }
                        }
                    }
                }catch (Exception ex)
                {
                    Debug.WriteLine("!NotFoundFontFile: " + ex);
                }



                foreach (System.Windows.Media.FontFamily fm in Fonts.SystemFontFamilies)
                {
                    Label labelf = new Label();
                    labelf.Content    = fm;
                    labelf.FontFamily = fm;
                    labelf.FontSize   = 14;
                    labelf.ToolTip    = fm.ToString();
                    ComboBox_FontName.Items.Add(labelf);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Font not found: " + ex);
            }

            ComboBox_FontSize.Text = "" + cont.FontSize;

            if (cont.FontWeight == FontWeights.Bold)
            {
                SButton_Bold.SetCheckedNoCall(true);
            }
            else
            {
                SButton_Bold.SetCheckedNoCall(false);
            }


            if (cont.FontStyle == FontStyles.Italic)
            {
                SButton_Italic.SetCheckedNoCall(true);
            }
            else
            {
                SButton_Italic.SetCheckedNoCall(false);
            }

            if (cont.HorizontalContentAlignment == HorizontalAlignment.Left)
            {
                Button_LeftAlign.SetCheckedNoCall(true);
            }
            else if (cont.HorizontalContentAlignment == HorizontalAlignment.Center)
            {
                Button_CenterAlign.SetCheckedNoCall(true);
            }
            else if (cont.HorizontalContentAlignment == HorizontalAlignment.Right)
            {
                Button_RightAlign.SetCheckedNoCall(true);
            }


            if (cont.VerticalContentAlignment == VerticalAlignment.Top)
            {
                Button_VTopAlign.SetCheckedNoCall(true);
            }
            else if (cont.VerticalContentAlignment == VerticalAlignment.Center)
            {
                Button_VCenterAlign.SetCheckedNoCall(true);
            }
            else if (cont.VerticalContentAlignment == VerticalAlignment.Bottom)
            {
                Button_VBottomAlign.SetCheckedNoCall(true);
            }
        }