LunarPresentation/Expressions/RichText.cs

(开头部分) 17KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Xml;
using SHomeWorkshop.LunarPresentation.Interfaces;

namespace SHomeWorkshop.LunarPresentation.Expressions
{
    public class RichText : Expression, IAutoWrap
    {
        public RichText(SubPanel rootPanel, SubPanel parentPanel, Editor editor)
            : base(rootPanel, parentPanel, editor)
        {
            //textBlock = new TextBlock() { TextWrapping = TextWrapping.Wrap };
            //textBlock.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(textBlock_PreviewMouseDown);
            //textBlock.Foreground = ExForeground;
            //this.mainBorder.Child = textBlock;

            //textBlock.MouseLeftButtonDown +=
            //    new System.Windows.Input.MouseButtonEventHandler(textBlock_MouseLeftButtonDown);
            //textBlock.MouseLeftButtonUp +=
            //    new System.Windows.Input.MouseButtonEventHandler(textBlock_MouseLeftButtonUp);
            //textBlock.MouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(textBlock_MouseRightButtonDown);

            //textBlock.MouseEnter += new System.Windows.Input.MouseEventHandler(textBlock_MouseEnter);
            //textBlock.MouseLeave += new System.Windows.Input.MouseEventHandler(textBlock_MouseLeave);

            //2011年11月26日,改支持富文本块内部右对齐。

            textPanel = new StackPanel();
            this.mainBorder.Child = textPanel;

            #region 绑定最大宽度。
            MultiBinding maxWidthBinding = new MultiBinding();

            Binding exFontSizeBinding = new Binding("ExFontSize");
            exFontSizeBinding.Source = editor;

            Binding wndWidthBinding = new Binding("ActualWidth");
            wndWidthBinding.Source = editor.BaseScrolledViewer;

            Binding indentBinding = new Binding("Indent");
            indentBinding.Source = this;

            Binding docAutoWrapBinding = new Binding("AutoWrap");
            docAutoWrapBinding.Source = editor;

            Binding selfAutoWrapBinding = new Binding("AutoWrap");
            selfAutoWrapBinding.Source = this;

            Binding maxTextWidthBinding = new Binding("MaxTextWidth");
            maxTextWidthBinding.Source = editor;

            maxWidthBinding.Bindings.Add(exFontSizeBinding);
            maxWidthBinding.Bindings.Add(wndWidthBinding);
            maxWidthBinding.Bindings.Add(indentBinding);
后面还有 411 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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