예제 #1
0
 public TextElementWindow(LabelMode labelMode = LabelMode.Label)
 {
     InitializeComponent();
     contentPresenter.Content = new FontUserControl();
     textViewModel            = new TextElementViewModel();
     DataContext           = textViewModel;
     HelpContainer.Content = HelpResourceHelper.GetHelpButton("PrintMapTextHelp", HelpButtonMode.NormalButton);
     if (labelMode == LabelMode.Signature)
     {
         SignatureNameGroupBox.Visibility = Visibility.Visible;
     }
 }
예제 #2
0
        public static void LoadFromViewModel(this LabelPrinterLayer labelPrinterLayer, TextElementViewModel textElementViewModel)
        {
            DrawingFontStyles drawingFontStyles = DrawingFontStyles.Regular;

            if (textElementViewModel.IsBold)
            {
                drawingFontStyles = drawingFontStyles | DrawingFontStyles.Bold;
            }
            if (textElementViewModel.IsItalic)
            {
                drawingFontStyles = drawingFontStyles | DrawingFontStyles.Italic;
            }
            if (textElementViewModel.IsStrikeout)
            {
                drawingFontStyles = drawingFontStyles | DrawingFontStyles.Strikeout;
            }
            if (textElementViewModel.IsUnderline)
            {
                drawingFontStyles = drawingFontStyles | DrawingFontStyles.Underline;
            }

            GeoFont font = new GeoFont(textElementViewModel.FontName.Source, textElementViewModel.FontSize, drawingFontStyles);

            labelPrinterLayer.PrinterWrapMode = textElementViewModel.WrapText ? PrinterWrapMode.WrapText : PrinterWrapMode.AutoSizeText;
            labelPrinterLayer.Text            = textElementViewModel.Text;
            labelPrinterLayer.Font            = font;
            labelPrinterLayer.TextBrush       = textElementViewModel.FontColor;
            labelPrinterLayer.DragMode        = textElementViewModel.DragMode;
            labelPrinterLayer.ResizeMode      = textElementViewModel.ResizeMode;
        }