コード例 #1
0
ファイル: ProgressBase.cs プロジェクト: zalid/elysium
 private void OnAnimationUpdate(object sender, SizeChangedEventArgs e)
 {
     if (DoubleUtil.IsNonNegative(e.NewSize.Width) && DoubleUtil.IsNonNegative(e.NewSize.Height))
     {
         OnAnimationsUpdating(new RoutedEventArgs(AnimationsUpdatingEvent));
         OnAnimationsUpdated(new RoutedEventArgs(AnimationsUpdatedEvent));
     }
 }
コード例 #2
0
ファイル: Window.cs プロジェクト: Paulwyg/express-project
        private void GetMinMaxInfo(IntPtr lParam)
        {
            var info = (Interop.MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(Interop.MINMAXINFO));

            _monitor.Invalidate();
            Taskbar.Invalidate();

            var bounds   = _monitor.Bounds;
            var workArea = _monitor.WorkArea;

            info.ptMaxPosition.x = Math.Abs(bounds.left) + Taskbar.Position == TaskbarPosition.Left && Taskbar.AutoHide ? 1 : 0;
            info.ptMaxPosition.y = Math.Abs(bounds.top) + Taskbar.Position == TaskbarPosition.Top && Taskbar.AutoHide ? 1 : 0;
            info.ptMaxSize.x     = info.ptMaxTrackSize.x =
                Math.Abs(workArea.right - workArea.left) - (Taskbar.Position == TaskbarPosition.Right && Taskbar.AutoHide ? 1 : 0);
            info.ptMaxSize.y = info.ptMaxTrackSize.y =
                Math.Abs(workArea.bottom - workArea.top) - (Taskbar.Position == TaskbarPosition.Bottom && Taskbar.AutoHide ? 1 : 0);

            var source = PresentationSource.FromVisual(this);

            if (source != null && source.CompositionTarget != null)
            {
                if (DoubleUtil.IsNonNegative(MinWidth))
                {
                    info.ptMinTrackSize.x = (int)Math.Ceiling(MinWidth * source.CompositionTarget.TransformFromDevice.M11);
                }
                if (DoubleUtil.IsNonNegative(MinHeight))
                {
                    info.ptMinTrackSize.y = (int)Math.Ceiling(MinHeight * source.CompositionTarget.TransformFromDevice.M22);
                }
                if (DoubleUtil.IsNonNegative(MaxWidth))
                {
                    info.ptMaxSize.x = info.ptMaxTrackSize.x =
                        Math.Min(info.ptMaxSize.x, (int)Math.Ceiling(MaxWidth * source.CompositionTarget.TransformFromDevice.M11));
                }
                if (DoubleUtil.IsNonNegative(MaxHeight))
                {
                    info.ptMaxSize.y = info.ptMaxTrackSize.y =
                        Math.Min(info.ptMaxSize.y, (int)Math.Ceiling(MaxHeight * source.CompositionTarget.TransformFromDevice.M22));
                }
            }

            Marshal.StructureToPtr(info, lParam, true);
        }