Painter/Component/ScaleGrid.cs

(开头部分) 2KB

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

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;

namespace Painter.Component
{
    public class ScaleGrid:Grid
    {
        public static DependencyProperty ShowGridProperty =
            DependencyProperty.Register("ShowGrid", typeof(bool), typeof(ScaleGrid), new PropertyMetadata(true));
        public static DependencyProperty ScaleBoxProperty =
            DependencyProperty.Register("ScaleBox", typeof(double), typeof(ScaleGrid), new PropertyMetadata(10.0));

        public bool ShowGrid
        {
            get{return (bool)GetValue(ShowGridProperty);}
            set
            {
                SetValue(ShowGridProperty, value);
                Background = (value ? mGridBrush : null);
            }
        }
        public double ScaleBox
        {
            get{return (double)GetValue(ScaleBoxProperty);}
            set{
                SetValue(ScaleBoxProperty, value);
                mGridBrush = new DrawingBrush(
                    new GeometryDrawing(new SolidColorBrush(Colors.Transparent),
                    new System.Windows.Media.Pen(new SolidColorBrush(Colors.Black), 1.0) { DashStyle = DashStyles.Dot },
                    new RectangleGeometry(new Rect(0, 0, ScaleBox, ScaleBox))))
                {
                    Stretch = Stretch.None,
                    TileMode = TileMode.Tile,
                    Viewport = new Rect(0.0, 0.0, ScaleBox, ScaleBox),
                    ViewportUnits = BrushMappingMode.Absolute
                };
                if ((bool)GetValue(ShowGridProperty))
                    Background = mGridBrush;
            }
        }
        DrawingBrush mGridBrush = new DrawingBrush(
            new GeometryDrawing(new SolidColorBrush(Colors.Transparent),
            new System.Windows.Media.Pen(new SolidColorBrush(Colors.Black), 1.0) { DashStyle = DashStyles.Dot },
            new RectangleGeometry(new Rect(0, 0, 20, 20))))
        {
            Stretch = Stretch.None,
            TileMode = TileMode.Tile,
            Viewport = new Rect(0.0, 0.0, 20, 20),
            ViewportUnits = BrushMappingMode.Absolute
后面还有 10 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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