Sliding Animation Win Forms App C#

Hemanth B 856 Reputation points

Hi I this is the Class file where the data for animation is stored:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mycalc
    using System;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;

    public static class Util
        public enum Effect { Roll, Slide, Center, Blend }

        public static void Animate(Control ctl, Effect effect, int msec, int angle)
            int flags = effmap[(int)effect];
            if (ctl.Visible) { flags |= 0x10000; angle += 180; }
                if (ctl.TopLevelControl == ctl) flags |= 0x20000;
                else if (effect == Effect.Blend) throw new ArgumentException();
            flags |= dirmap[(angle % 360) / 45];
            bool ok = AnimateWindow(ctl.Handle, msec, flags);
            if (!ok) MessageBox.Show("Animation failed");
            ctl.Visible = !ctl.Visible;

        private static int[] dirmap = { 1, 5, 4, 6, 2, 10, 8, 9 };
        private static int[] effmap = { 0, 0x40000, 0x10, 0x80000 };

        private static extern bool AnimateWindow(IntPtr handle, int msec, int flags);

And this when the treeview is visible:

  private void Menuicon_Click_1(object sender, EventArgs e)
            button4.Visible = true;
            Menuicon.Visible = false;

            Util.Animate(treeView2, Util.Effect.Slide, 150, 200);

This code makes the treeview slide from the right to left.
I want it to slide from left to right. Please help me with this

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
7,512 questions
No comments
{count} votes

0 additional answers

Sort by: Most helpful