Painter/TitleWindow.xaml.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Painter
{
    /// <summary>
    /// TitleWindow.xaml 的交互逻辑
    /// </summary>
    public partial class TitleWindow : UserControl
    {
        public bool OpenStatus { get; set; }
        public static DependencyProperty HeaderProperty =
            DependencyProperty.Register("Header", typeof(string), typeof(TitleWindow), new PropertyMetadata(""));

        public string Header
        {
            get { return (string)GetValue(HeaderProperty); }
            set{SetValue(HeaderProperty, value);}
        }

        public TitleWindow()
        {
            OpenStatus = true;
            InitializeComponent();
        }
        private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            OpenStatus = !OpenStatus;
            (e.Source as Image).Source = OpenStatus?new BitmapImage(new Uri("pack://application:,,,/Resource/侧边栏_收起.png")):
                new BitmapImage(new Uri("pack://application:,,,/Resource/侧边栏_展开.png"));
            Width = (!OpenStatus?30:double.NaN);

            if ((sender as FrameworkElement).Parent is Grid){
                ((sender as FrameworkElement).Parent as Grid).Children[0].Visibility = (!OpenStatus ? Visibility.Collapsed:Visibility.Visible);
            }
            if ((sender as FrameworkElement).Parent is Grid){
                (((sender as FrameworkElement).Parent as Grid).Parent as Grid).Children[1].Visibility = (!OpenStatus ? Visibility.Collapsed : Visibility.Visible);
            }
        }
    }
}

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

AI 解读 AI

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

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