LunarPresentation/Commands/EraseAllColors.cs

(开头部分) 2KB

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

using System.Windows.Media;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        /// <summary>
        /// 清除公式的前景色、背景色、边框色并将边框宽度设置为1。
        /// </summary>
        /// <param name="withBorder">是否连边框一起清除。</param>
        public static void ExEraseAllColors(bool withBorder = true)
        {
            if (Globals.selectedEditor == null) return;
            if (Globals.selectedEditor.SelectedExpression == null) return;

            LunarPresentation.Expressions.Expression curEx
                = Globals.selectedEditor.SelectedExpression;

            ModifingItem mi = new ModifingItem();

            Action actFore = new Action(curEx.ExID, -1, curEx.GetType().Name, "ExForeground",
                ColorPicker.GetBrushName(curEx.ExForeground),
                ColorPicker.GetBrushName(curEx.Editor.DefaultForeground));

            //2011年3月13日之后要考虑1-4级标题文本块的默认前景色。
            Expressions.BaseText bt = curEx as Expressions.BaseText;
            if (bt == null)
            {
                curEx.ExForeground = curEx.Editor.DefaultForeground;
                curEx.XmlData.RemoveAttributeByName("ExForeground");
            }
            else
            {
                curEx.XmlData.RemoveAttributeByName("ExForeground");
                bt.RefreshExForeground();
            }

            Action actBack = new Action(curEx.ExID, -1, curEx.GetType().Name, "ExBackground",
                ColorPicker.GetBrushName(curEx.ExBackground),
                ColorPicker.GetBrushName(Brushes.Transparent));
            curEx.ExBackground = Brushes.Transparent;
            curEx.XmlData.RemoveAttributeByName("ExBackground");

            mi.Add(actFore); mi.Add(actBack);

            if (withBorder)
            {
                Action actBorder = new Action(curEx.ExID, -1, curEx.GetType().Name, "BorderColor",
                    ColorPicker.GetBrushName(curEx.BorderColor),
                    ColorPicker.GetBrushName(Brushes.Transparent));
                curEx.BorderColor = Brushes.Transparent;
                curEx.XmlData.RemoveAttributeByName("BorderColor");

                if (curEx is Expressions.Grid || curEx is Expressions.GridPanel)
                {
                    if (curEx.Editor != null)
                        curEx.MainBorder.BorderBrush = curEx.Editor.DefaultForeground;
                }

                Action actBorderWidth = new Action(curEx.ExID, -1, curEx.GetType().Name, "BorderWidth",
后面还有 10 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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