private void menuTimer_Tick(Object myObject, EventArgs myEventArgs) { MenuMoving = true; if (MenuHidden) { switch (MenuOpened) { case MenuName.PersonalMenu: MenuPanel.Controls.Add(PersonalMenu); break; case MenuName.WorkPlaceMenu: MenuPanel.Controls.Add(WorkPlaceMenu); break; case MenuName.StaffMenu: MenuPanel.Controls.Add(StaffMenu); break; case MenuName.MaintenanceMenu: MenuPanel.Controls.Add(MaintenanceMenu); break; default: break; } if (MenuPanel.Width >= MenuWidth) { MenuTimer.Stop(); MenuHidden = false; MenuMoving = false; return; } MenuPanel.Width += 10; } else { if (MenuPanel.Width <= 0) { MenuTimer.Stop(); MenuHidden = true; MenuMoving = false; MenuPanel.Controls.Clear(); if (MenusChanging) { MenusChanging = false; MenuTimer.Start(); } return; } MenuPanel.Width -= 10; } }
private void MenuTimer_Tick(object sender, EventArgs e) { //this.Update(); if (!Menu_open)//menuopen== false { if (Menu_panel.Size.Width < 232) { Menu_panel.Size = new Size(Menu_panel.Size.Width + Menu_velocity, Menu_panel.Size.Height); Menu_panel.BackColor = Color.FromArgb(Menu_panel.BackColor.R - 2, Menu_panel.BackColor.B - 2, Menu_panel.BackColor.G - 2); Menu_velocity++; } else { Menu_panel.Size = new Size(232, Menu_panel.Size.Height); MenuTimer.Stop(); Menu_velocity = 0; Menu_open = true; OpenMenu_button.Enabled = true; Menu_panel.BackColor = Color.FromArgb(65, 65, 65); } } else { if (Menu_panel.Size.Width > 0) { Menu_panel.Size = new Size(Menu_panel.Size.Width - Menu_velocity, Menu_panel.Size.Height); Menu_panel.BackColor = Color.FromArgb(Menu_panel.BackColor.R + 4, Menu_panel.BackColor.B + 4, Menu_panel.BackColor.G + 4); Menu_velocity++; } else { Menu_panel.Size = new Size(0, Menu_panel.Size.Height); MenuTimer.Stop(); Menu_velocity = 0; Menu_open = false; OpenMenu_button.Enabled = true; Menu_panel.BackColor = Color.FromArgb(115, 115, 115); } } }