LunarPresentation/Commands/EditRichText.cs

(完整代码) 1KB

using System.Windows;
using SHomeWorkshop.LunarPresentation.Dialogs;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        public static void EditRichText(LunarPresentation.Expressions.RichText curEx, string initializeText = null)
        {
            LunarPresentation.Expressions.RichText rtx = curEx;

            MainWindow mainWindow = curEx.Editor.ParentWindow;

            RichTextEditor rte = new RichTextEditor(rtx, initializeText);

            rte.WindowStartupLocation = WindowStartupLocation.Manual;
            rte.Width = rtx.Editor.BaseScrolledViewer.ActualWidth - 54;
            Point ptBase = new Point(0, 0);
            Point ptStart = rtx.Editor.BaseScrolledViewer.PointToScreen(ptBase);
            rte.Left = ptStart.X + 26;
            rte.Height = 100;
            rte.Top = rtx.Editor.BaseScrolledViewer.ActualHeight + ptStart.Y - 136;

            //AutoScrollBaseText(rte);

            rte.fontSizeSlider.Value = mainWindow.fontSizeSlider.Value;
            rte.Owner = curEx.Editor.ParentWindow;

            rte.ShowDialog();

            //尝试解决编辑文本块后显示不出来的问题。发现TabControl中的选项卡标头绘制也有问题。
            //实际上文本块的布局是没有问题的——用鼠标指针划过文本块就可以发现这一点。
            //造成这个Bug的原因可能是窗口焦点转移时未及时绘制。因为编辑器是另一个窗口。
            rtx.Editor.InvalidateVisual();
            rtx.Editor.UpdateLayout();
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。