コード例 #1
0
ファイル: AboutForm.cs プロジェクト: oneminot/greenshot
        /// <summary>
        /// Constructor
        /// </summary>
        public AboutForm()
        {
            // Make sure our resources are removed again.
            Disposed += Cleanup;
            FormClosing += Cleanup;

            // Enable animation for this form, when we don't set this the timer doesn't start as soon as the form is loaded.
            EnableAnimation = true;
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            // Only use double-buffering when we are NOT in a Terminal Server session
            DoubleBuffered = !isTerminalServerSession;

            // Not needed for a Tool Window, but still for the task manager it's important
            Icon = GreenshotResources.getGreenshotIcon();

            // Use the self drawn image, first we create the background to be the backcolor (as we animate from this)
            gBitmap = ImageHelper.CreateEmpty(90, 90, PixelFormat.Format24bppRgb, BackColor, 96, 96);
            pictureBox1.Image = gBitmap;
            Version v = Assembly.GetExecutingAssembly().GetName().Version;

            // Format is like this:  AssemblyVersion("Major.Minor.Build.Revision")]
            lblTitle.Text = "Greenshot " + v.Major + "." + v.Minor + "." + v.Build + " Build " + v.Revision + (IniConfig.IsPortable ? " Portable" : "") + (" (" + OSInfo.Bits + " bit)");

            //Random rand = new Random();

            // Number of frames the pixel animation takes
            int frames = FramesForMillis(2000);
            // The number of frames the color-cycle waits before it starts
            waitFrames = FramesForMillis(6000);

            // Every pixel is created after pixelWaitFrames frames, which is increased in the loop.
            int pixelWaitFrames = FramesForMillis(2000);
            // Create pixels
            for (int index = 0; index < gSpots.Count; index++) {
                // Read the pixels in the order of the flow
                Point gSpot = gSpots[flowOrder[index]];
                // Create the animation, first we do nothing (on the final destination)
                RectangleAnimator pixelAnimation;

                // Make the pixel grom from the middle, if this offset isn't used it looks like it's shifted
                int offset = (w - 2) / 2;

                // If the optimize for Terminal Server is set we make the animation without much ado
                if (isTerminalServerSession) {
                    // No animation
                    pixelAnimation = new RectangleAnimator(new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), 1, EasingType.Cubic, EasingMode.EaseIn);
                } else {
                    // Create the animation, first we do nothing (on the final destination)
                    Rectangle standingStill = new Rectangle(gSpot.X + offset, gSpot.Y + offset, 0, 0);
                    pixelAnimation = new RectangleAnimator(standingStill, standingStill, pixelWaitFrames, EasingType.Quintic, EasingMode.EaseIn);
                    // And than we size to the wanted size.
                    pixelAnimation.QueueDestinationLeg(new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), frames);
                }
                // Increase the wait frames
                pixelWaitFrames += FramesForMillis(100);
                // Add to the list of to be animated pixels
                pixels.Add(pixelAnimation);
                // Add a color to the list for this pixel.
                pixelColors.Add(pixelColor);
            }
            // Make sure the frame "loop" knows we have to animate
            hasAnimationsLeft = true;

            // Pixel Color cycle colors, here we use a pre-animated loop which stores the values.
            ColorAnimator pixelColorAnimator = new ColorAnimator(pixelColor, Color.FromArgb(255, 255, 255), 6, EasingType.Quadratic, EasingMode.EaseIn);
            pixelColorAnimator.QueueDestinationLeg(pixelColor, 6, EasingType.Quadratic, EasingMode.EaseOut);
            do {
                colorFlow.Add(pixelColorAnimator.Current);
                pixelColorAnimator.Next();
            } while (pixelColorAnimator.hasNext);

            // color animation for the background
            backgroundAnimation = new ColorAnimator(BackColor, backColor, FramesForMillis(5000), EasingType.Linear, EasingMode.EaseIn);
        }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public AboutForm()
        {
            // Make sure our resources are removed again.
            Disposed    += Cleanup;
            FormClosing += Cleanup;

            // Enable animation for this form, when we don't set this the timer doesn't start as soon as the form is loaded.
            EnableAnimation = true;
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            // Only use double-buffering when we are NOT in a Terminal Server session
            DoubleBuffered = !isTerminalServerSession;

            // Use the self drawn image, first we create the background to be the backcolor (as we animate from this)
            gBitmap           = ImageHelper.CreateEmpty(90, 90, PixelFormat.Format24bppRgb, BackColor, 96, 96);
            pictureBox1.Image = gBitmap;
            Version v = Assembly.GetExecutingAssembly().GetName().Version;

            // Format is like this:  AssemblyVersion("Major.Minor.Build.Revision")]
            lblTitle.Text = "Greenshot " + v.Major + "." + v.Minor + "." + v.Build + " Build " + v.Revision + (IniConfig.IsPortable ? " Portable" : "") + (" (" + OSInfo.Bits + " bit)");

            //Random rand = new Random();

            // Number of frames the pixel animation takes
            int frames = FramesForMillis(2000);

            // The number of frames the color-cycle waits before it starts
            waitFrames = FramesForMillis(6000);

            // Every pixel is created after pixelWaitFrames frames, which is increased in the loop.
            int pixelWaitFrames = FramesForMillis(2000);

            // Create pixels
            for (int index = 0; index < gSpots.Count; index++)
            {
                // Read the pixels in the order of the flow
                Point gSpot = gSpots[flowOrder[index]];
                // Create the animation, first we do nothing (on the final destination)
                RectangleAnimator pixelAnimation;

                // Make the pixel grom from the middle, if this offset isn't used it looks like it's shifted
                int offset = (w - 2) / 2;

                // If the optimize for Terminal Server is set we make the animation without much ado
                if (isTerminalServerSession)
                {
                    // No animation
                    pixelAnimation = new RectangleAnimator(new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), 1, EasingType.Cubic, EasingMode.EaseIn);
                }
                else
                {
                    // Create the animation, first we do nothing (on the final destination)
                    Rectangle standingStill = new Rectangle(gSpot.X + offset, gSpot.Y + offset, 0, 0);
                    pixelAnimation = new RectangleAnimator(standingStill, standingStill, pixelWaitFrames, EasingType.Quintic, EasingMode.EaseIn);
                    // And than we size to the wanted size.
                    pixelAnimation.QueueDestinationLeg(new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), frames);
                }
                // Increase the wait frames
                pixelWaitFrames += FramesForMillis(100);
                // Add to the list of to be animated pixels
                pixels.Add(pixelAnimation);
                // Add a color to the list for this pixel.
                pixelColors.Add(pixelColor);
            }
            // Make sure the frame "loop" knows we have to animate
            hasAnimationsLeft = true;

            // Pixel Color cycle colors, here we use a pre-animated loop which stores the values.
            ColorAnimator pixelColorAnimator = new ColorAnimator(pixelColor, Color.FromArgb(255, 255, 255), 6, EasingType.Quadratic, EasingMode.EaseIn);

            pixelColorAnimator.QueueDestinationLeg(pixelColor, 6, EasingType.Quadratic, EasingMode.EaseOut);
            do
            {
                colorFlow.Add(pixelColorAnimator.Current);
                pixelColorAnimator.Next();
            } while (pixelColorAnimator.hasNext);

            // color animation for the background
            backgroundAnimation = new ColorAnimator(BackColor, backColor, FramesForMillis(5000), EasingType.Linear, EasingMode.EaseIn);
        }
コード例 #3
0
        /// <summary>
        ///     Constructor
        /// </summary>
        public AboutForm(
            ICoreConfiguration coreConfiguration,
            IGreenshotLanguage greenshotlanguage,
            IVersionProvider versionProvider
            ) : base(coreConfiguration, greenshotlanguage)
        {
            _greenshotlanguage = greenshotlanguage;
            // Make sure our resources are removed again.
            Disposed    += Cleanup;
            FormClosing += Cleanup;

            // Enable animation for this form, when we don't set this the timer doesn't start as soon as the form is loaded.
            EnableAnimation = true;
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            // Use the self drawn image, first we create the background to be the backcolor (as we animate from this)
            _bitmap           = BitmapFactory.CreateEmpty(90, 90, PixelFormat.Format24bppRgb, BackColor);
            pictureBox1.Image = _bitmap;

            _dpiSubscription = FormDpiHandler.OnDpiChanged.Subscribe(info =>
            {
                pictureBox1.Size = FormDpiHandler.ScaleWithCurrentDpi(new NativeSize(90, 90));
            });

            var versionInfo = $@"Greenshot {versionProvider.CurrentVersion} {(coreConfiguration.IsPortable ? " Portable" : "")} ({OsInfo.Bits} bit)";

            if (versionProvider.IsUpdateAvailable)
            {
                versionInfo += $" latest is: {versionProvider.LatestVersion}";
            }
            lblTitle.Text = versionInfo;
            // Number of frames the pixel animation takes
            var frames = FramesForMillis(2000);

            // The number of frames the color-cycle waits before it starts
            _waitFrames = FramesForMillis(6000);

            // Every pixel is created after pixelWaitFrames frames, which is increased in the loop.
            var pixelWaitFrames = FramesForMillis(2000);

            // Create pixels
            for (var index = 0; index < _gSpots.Count; index++)
            {
                // Read the pixels in the order of the flow
                var gSpot = _gSpots[_flowOrder[index]];
                // Create the animation, first we do nothing (on the final destination)
                RectangleAnimator pixelAnimation;

                // Make the pixel grom from the middle, if this offset isn't used it looks like it's shifted
                var offset = (w - 2) / 2;

                // If the optimize for Terminal Server is set we make the animation without much ado
                if (IsTerminalServerSession)
                {
                    // No animation
                    pixelAnimation = new RectangleAnimator(new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), 1, EasingTypes.Cubic);
                }
                else
                {
                    // Create the animation, first we do nothing (on the final destination)
                    var standingStill = new Rectangle(gSpot.X + offset, gSpot.Y + offset, 0, 0);
                    pixelAnimation = new RectangleAnimator(standingStill, standingStill, pixelWaitFrames, EasingTypes.Quintic);
                    // And than we size to the wanted size.
                    pixelAnimation.QueueDestinationLeg(new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), frames);
                }
                // Increase the wait frames
                pixelWaitFrames += FramesForMillis(100);
                // Add to the list of to be animated pixels
                _pixels.Add(pixelAnimation);
                // Add a color to the list for this pixel.
                _pixelColors.Add(_pixelColor);
            }
            // Make sure the frame "loop" knows we have to animate
            _hasAnimationsLeft = true;

            // Pixel Color cycle colors, here we use a pre-animated loop which stores the values.
            var pixelColorAnimator = new ColorAnimator(_pixelColor, Color.FromArgb(255, 255, 255), 6, EasingTypes.Quadratic);

            pixelColorAnimator.QueueDestinationLeg(_pixelColor, 6, EasingTypes.Quadratic, EasingModes.EaseOut);
            do
            {
                _colorFlow.Add(pixelColorAnimator.Current);
                pixelColorAnimator.Next();
            } while (pixelColorAnimator.HasNext);

            // color animation for the background
            _backgroundAnimation = new ColorAnimator(BackColor, _backColor, FramesForMillis(5000));
        }