LunarPresentation/Widegets/ExpressionLayerButton.cs

(开头部分) 4KB

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

using System;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace SHomeWorkshop.LunarPresentation.Widegets
{
    public class ExpressionLayerButton : Button
    {
        public ExpressionLayerButton(Expressions.Expression correspondingExpression)
        {
            basePanel = new StackPanel();
            basePanel.Orientation = Orientation.Horizontal;

            textBlock = new TextBlock() { VerticalAlignment = System.Windows.VerticalAlignment.Center };

            if (correspondingExpression != null)
            {
                this.correspondingExpression = correspondingExpression;
                textBlock.Text = correspondingExpression.ChineseName;
            }
            else
            {
                textBlock.Text = "{0}";
            }

            basePanel.Children.Add(textBlock);

            img = new Image() { SnapsToDevicePixels = true };
            img.Width = 12; img.Height = 16;
            img.VerticalAlignment = System.Windows.VerticalAlignment.Center;

            bitmapImg = new BitmapImage(
                new Uri("pack://application:,,,/LunarPresentation;component/Resources/Icons/RightTriangle.png"));
            img.Source = bitmapImg;

            basePanel.Children.Add(img);

            this.Content = basePanel;


            if (correspondingExpression is Expressions.SubPanel)
            {
                this.Background = Brushes.LightSlateGray;
                this.Foreground = Brushes.White;
            }
            else
            {
                this.Background = Brushes.LightGray;
                this.Foreground = Brushes.Black;
            }

            this.Click += new System.Windows.RoutedEventHandler(ExpressionLayerButton_Click);

            if (correspondingExpression.CommentText != null && correspondingExpression.CommentText.Length > 0)
            {
                if (correspondingExpression.CommentText.Length > 10)
                {
                    this.ToolTip = correspondingExpression.CommentText.Substring(0, 10) + "…";
                }
后面还有 76 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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