Пример #1
0
        public void Edit()
        {
            var w = new AddTextWindow(this)
                {
                    TextEditor =
                        {
                            Text = Txt.Text,
                            Foreground = Txt.Foreground,
                            FontSize = Txt.FontSize,
                            FontStyle = Txt.FontStyle,
                            FontWeight = Txt.FontWeight
                        }
                };

            double xPos = InkCanvas.GetLeft(this);
            double yPos = InkCanvas.GetTop(this);

            if (w.ShowDialog() != true) return;

            Txt.Text = w.Txt.Txt.Text;
            Txt.Foreground = w.Txt.Txt.Foreground;
            Txt.FontSize = w.Txt.Txt.FontSize;
            Txt.FontStyle = w.Txt.Txt.FontStyle;
            Txt.FontWeight = w.Txt.Txt.FontWeight;
            Height = Txt.Height;
            Width = Txt.Width;
            InkCanvas.SetLeft(this, xPos);
            InkCanvas.SetTop(this, yPos);

            Actions.Clear();
            foreach (ComAction a in w.Txt.Actions)
                Actions.Add(a);

            var mainWin = DesignerMainWindow.GetInstance();
            int currentSlideNr = mainWin.GetCurrentSlideNr();
            mainWin.canMainCanvas.SaveAllSlideData(Practice.GetInstance().GetSlideByPosition(currentSlideNr));
        }
Пример #2
0
        public static Text NewText()
        {
            var tb = new Text();
            var w = new AddTextWindow(tb);

            if (w.ShowDialog() != true) return null;

            var mainWin = DesignerMainWindow.GetInstance();
            Point currentMousePosition = mainWin.GetCurrentMousePosition();

            tb.Txt.Text = w.Txt.Txt.Text;
            tb.Txt.FontSize = w.Txt.Txt.FontSize;
            tb.Txt.FontStyle = w.Txt.Txt.FontStyle;
            tb.Txt.FontWeight = w.Txt.Txt.FontWeight;
            tb.Txt.Foreground = w.Txt.Txt.Foreground;

            InkCanvas.SetTop(tb, currentMousePosition.Y);
            InkCanvas.SetLeft(tb, currentMousePosition.X);
            Panel.SetZIndex(tb, Practice.GetInstance().GetSlideByPosition(mainWin.GetCurrentSlideNr()).SlideObjects.Count);

            SetTxtWidthAndHeight(tb);

            tb.Actions.Clear();
            foreach (ComAction a in w.Txt.Actions)
                tb.Actions.Add(a);

            return tb;
        }