Có gì mới?

Chào mừng bạn đến với diễn đàn Tui Học Web

Vui lòng đăng ký hoặc đăng nhập để sử dụng hết các tính năng của forum nhé!
  • Thông báo: Hiện tại do admin không có nhiều thời gian và không thể tiếp tục quản trị và maintain forum, do đó forum sẽ có dự định được đóng lại từ 06/2022, cảm ơn mọi người đã đồng hành cùng forum suốt thời gian vừa qua. Cảm ơn rất nhiều.

Chia sẻ Hiệu ứng hiển thị menu slide trong winform

Chia sẻ

Hiệu ứng hiển thị menu slide trong winform​



ThumbnailTuiHocWeb95a36f2b535f7f91.jpg

Xin chào các bạn, bài viết hôm nay mình sẽ tiếp tục chia sẻ đến các bạn hiệu ứng hiển thị menu trên C#, Winform


ezgif-7-5fc3ef6d2967.gif

C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace animation_menu
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        bool isShow = false;
        #region "animation"
        private void timer1_Tick(object sender, EventArgs e)
        {
          
            panel1.Left -= 7;
            label1.Left -= 7;
            if (panel1.Left <= 300)
            {
                timer2.Start();
            }
            if (panel2.Left <= 300)
            {
                timer3.Start();
            }
            if (panel3.Left <= 300)
            {
                timer4.Start();
            }
            if (panel1.Left <= 22)
            {
                timer1.Stop();
            }
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            panel2.Left -= 7;
            label2.Left -= 7;
            if (panel2.Left <= 22)
            {
                timer2.Stop();
            }   

        }

        private void timer3_Tick(object sender, EventArgs e)
        {
            panel3.Left -= 7;
            label3.Left -= 7;
            if (panel3.Left <= 22)
            {
                timer3.Stop();
            }
 
        }
 

        private void timer4_Tick(object sender, EventArgs e)
        {
            panel4.Left -= 7;
            label4.Left -= 7;
            if (panel4.Left <= 22)
            {
                timer4.Stop();
                isShow = true;
            } 
        }

        private void Form1_Load(object sender, EventArgs e)
        {
          
        }

        

        private void timer5_Tick(object sender, EventArgs e)
        {
            panel1.Left += 7;
            label1.Left += 7;
            if (panel1.Left >= 62)
            {
                timer6.Start();
            }

            if (panel2.Left >= 62)
            {
                timer7.Start();
            }
            if (panel3.Left >= 62)
            {
                timer8.Start();
            }
            if (panel1.Left >= 344)
            {
                timer5.Stop();
            }
        }

        private void timer6_Tick(object sender, EventArgs e)
        {
            panel2.Left += 7;
            label2.Left += 7;
            if (panel2.Left >= 344)
            {
                timer6.Stop();
                isShow = false;
            } 
        }

        private void timer7_Tick(object sender, EventArgs e)
        {
            panel3.Left += 7;
            label3.Left += 7;
            if (panel3.Left >= 344)
            {
                timer7.Stop();
            } 
        }

        private void timer8_Tick(object sender, EventArgs e)
        {
            panel4.Left += 7;
            label4.Left += 7;
            if (panel4.Left >= 344)
            {
                timer8.Stop();             
            } 
        }

        #endregion

    

        private void label6_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        private void panel6_Click(object sender, EventArgs e)
        {
            if (!isShow)
            {
                timer1.Start();
            }
            else
            {
                timer5.Start();
            }
        }

    
    }
}

Ồ, bạn chưa phải thành viên của forum Đăng nhập hoặc đăng ký ngay.

Chúc các bạn thành công!​

 
shape1
shape2
shape3
shape4
shape7
shape8
Bên trên