コード例 #1
0
        private void SetZonePanelSize(GridZone panel, GridData.Zone zone)
        {
            Size   actualSize = WorkAreaSize();
            double spacing    = Model.ShowSpacing ? Model.Spacing : 0;

            double topSpacing    = zone.Top == 0 ? spacing : spacing / 2;
            double bottomSpacing = zone.Bottom == GridData.Multiplier ? spacing : spacing / 2;
            double leftSpacing   = zone.Left == 0 ? spacing : spacing / 2;
            double rightSpacing  = zone.Right == GridData.Multiplier ? spacing : spacing / 2;

            Canvas.SetTop(panel, (actualSize.Height * zone.Top / GridData.Multiplier) + topSpacing);
            Canvas.SetLeft(panel, (actualSize.Width * zone.Left / GridData.Multiplier) + leftSpacing);
            panel.MinWidth  = Math.Max(1, (actualSize.Width * (zone.Right - zone.Left) / GridData.Multiplier) - leftSpacing - rightSpacing);
            panel.MinHeight = Math.Max(1, (actualSize.Height * (zone.Bottom - zone.Top) / GridData.Multiplier) - topSpacing - bottomSpacing);
        }
コード例 #2
0
ファイル: GridZone.xaml.cs プロジェクト: ztomer/PowerToys
        public GridZone(int spacing, MagneticSnap snapX, MagneticSnap snapY, Func <Orientation, int, bool> canSplit, GridData.Zone zone)
        {
            InitializeComponent();
            OnSelectionChanged();
            _splitter = new Rectangle
            {
                Fill = Application.Current.Resources[AccentColorBrushID] as SolidColorBrush,
            };
            Body.Children.Add(_splitter);

            SplitterThickness = Math.Max(spacing, 1);

            SizeChanged += GridZone_SizeChanged;

            _snapX    = snapX;
            _snapY    = snapY;
            _canSplit = canSplit;
            _zone     = zone;
        }
コード例 #3
0
        public GridZone(int spacing, MagneticSnap snapX, MagneticSnap snapY, Func<Orientation, int, bool> canSplit, GridData.Zone zone)
        {
            InitializeComponent();
            OnSelectionChanged();
            _splitter = new Rectangle
            {
                Fill = SystemParameters.WindowGlassBrush,
            };
            Body.Children.Add(_splitter);

            SplitterThickness = Math.Max(spacing, 1);

            SizeChanged += GridZone_SizeChanged;

            _snapX = snapX;
            _snapY = snapY;
            _canSplit = canSplit;
            _zone = zone;
        }