LunarPresentation/Commands/EmbedToAnotherExpression.cs

(开头部分) 15KB

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

using System.Windows;
using System.Windows.Controls;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {

        public static void EmbedToBracket()
        {
            EmbedToAnotherExpression(TypeOfExpression.Bracket,
                LunarPresentation.Properties.Resources.Bracket);
        }

        public static void EmbedToOneLTwoCGrid()
        {
            EmbedToAnotherExpression(TypeOfExpression.Grid,
                LunarPresentation.Properties.Resources.OneLTwoCGrid);
        }

        public static void EmbedToRow()
        {
            Expressions.Expression ex = EmbedToAnotherExpression(TypeOfExpression.Row,
                LunarPresentation.Properties.Resources.Row);
            if (ex is Expressions.Row)
            {
                Expressions.Row row = ex as Expressions.Row;
                if (row.FirstSubPanel != null &&
                    row.FirstSubPanel.BasePanel.Orientation == Orientation.Horizontal)
                {
                    foreach (UIElement ue in row.FirstSubPanel.BasePanel.Children)
                    {
                        Expressions.Expression childEx = ue as Expressions.Expression;

                        if (childEx != null)
                        {
                            childEx.VerticalAlignment = System.Windows.VerticalAlignment.Center;
                            //水平子面板中默认是垂直居中的(只有根面板例外——根面板中默认居上对齐),
                            //但此处是嵌入,不必考虑根面板。
                        }
                    }
                }
            }
        }

        public static void EmbedToExpander()
        {
            EmbedToAnotherExpression(TypeOfExpression.Expander,
                LunarPresentation.Properties.Resources.Expander);
        }

        /// <summary>
        /// 嵌入某个公式,该公式类型的FirstPanel必须不为null。
        /// </summary>
        /// <param name="exType">要嵌入在其中的新公式的类型。</param>
        /// <param name="destExXml">新公式的Xml文本。</param>
        private static Expressions.Expression EmbedToAnotherExpression(TypeOfExpression exEype, string destExXml)
        {
            if (Globals.selectedEditor == null) return null;
            if (Globals.selectedEditor.SelectedExpression == null) return null;
后面还有 285 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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