LunarPresentation/Dialogs/DocBackgroundImageDlg.xaml.cs

(开头部分) 26KB

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

using System;
using System.IO;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Win32;

namespace SHomeWorkshop.LunarPresentation.Dialogs
{
    /// <summary>
    /// DocBackgroundImageDlg.xaml 的交互逻辑
    /// </summary>
    public partial class DocBackgroundImageDlg : Window
    {
        public DocBackgroundImageDlg(Editor editor)
        {
            InitializeComponent();

            this.Owner = Globals.MainWindow;
            this.editor = editor;

            Type type = typeof(Brushes);
            PropertyInfo[] properties = type.GetProperties();
            foreach (PropertyInfo pi in properties)
            {
                BrushItem bi1 = new BrushItem(pi.GetValue(null, null) as Brush, pi.Name);
                cboxBackgroundBrushes.Items.Add(bi1);

                BrushItem bi2 = new BrushItem(pi.GetValue(null, null) as Brush, pi.Name);
                cboxForegroundBrushes.Items.Add(bi2);

                BrushItem bi3 = new BrushItem(pi.GetValue(null, null) as Brush, pi.Name);
                cboxSelBox1Brushes.Items.Add(bi3);

                BrushItem bi4 = new BrushItem(pi.GetValue(null, null) as Brush, pi.Name);
                cboxSelBox2Brushes.Items.Add(bi4);
            }

            if (editor != null)
            {
                tbForegroundSample.Foreground = editor.DefaultForeground;

                rect11.Fill = rect12.Fill = rect13.Fill = rect14.Fill = rect1.Stroke = editor.ExSelectionAdornerBrush;
                rect21.Fill = rect22.Fill = rect23.Fill = rect24.Fill = rect2.Stroke = editor.SubPanelSelectionAdornerBrush;

                //如果背景色是纯色,读入背景色,如果不是纯色,读入图像背景。

                ImageBrush editorImgBrush = editor.BaseScrolledViewer.Background as ImageBrush;
                if (editorImgBrush != null)
                {
                    rbtnFillWithImageBrush.IsChecked = true;
                    ImageBrush newImageBrush = new ImageBrush(editorImgBrush.ImageSource)
                    {
                        TileMode = editorImgBrush.TileMode,
                        Viewport = editorImgBrush.Viewport,
                        ViewportUnits = editorImgBrush.ViewportUnits,
                        Stretch = editorImgBrush.Stretch,
后面还有 593 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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