//TODO: I have to refactor this code here private void Timer_Panel_Tick(object sender, EventArgs e) { if (Hidden) { Panel_Slide.Visible = true; // Panel_Slide.BringToFront(); Panel_Slide.Height = Panel_Slide.Height + 10; if (Panel_Slide.Height >= panelHeight) { Timer_Panel.Stop(); Hidden = false; this.Refresh(); } } else { Panel_Slide.Height = Panel_Slide.Height - 10; if (Panel_Slide.Height <= 0) { Timer_Panel.Stop(); Hidden = true; this.Refresh(); } } }
public Form_Principal() { InitializeComponent(); panelHeight = Panel_Slide.Height; Hidden = false; Panel_Slide.Visible = false; Timer_Panel.Start(); }
private void Timer_Panel_Tick(object sender, EventArgs e) { if (Opacity < 0.5) { return; } int offset = 6; if (MouseMoveNeedShowPanel) { if (Button_Control_Close.Top + offset >= 1) { Button_Control_Close.Top = 1; } else { Button_Control_Close.Top += offset; } if (Panel_Control.Top - offset <= Height - Panel_Control.Height) { Panel_Control.Top = Height - Panel_Control.Height; MouseMoveNeedShowPanel = false; Timer_Panel.Stop(); } else { Panel_Control.Top -= offset; } } else { if (Button_Control_Close.Top - offset <= -50) { Button_Control_Close.Top = -50; } else { Button_Control_Close.Top -= offset; } if (Panel_Control.Top + offset >= Height) { Panel_Control.Top = Height; Timer_Panel.Stop(); } else { Panel_Control.Top += offset; } } }
private void Timer_GetCurPos_Tick(object sender, EventArgs e) { int x = Cursor.Position.X; int y = Cursor.Position.Y; if (x >= Left && x <= Left + Width && y >= Top && y <= Top + Height) { MouseMoveNeedShowPanel = true; Timer_Panel.Start(); } else { MouseMoveNeedShowPanel = false; Timer_Panel.Start(); } }
//para mostrar el panel private void MostrarPanel() { if (Hidden) { // Panel_Slide.Visible = true; Panel_Slide.BringToFront(); Timer_Panel.Start(); Panel_Slide.Height = Panel_Slide.Height + 10; if (Panel_Slide.Height >= panelHeight) { Timer_Panel.Stop(); Hidden = false; this.Refresh(); } } }
//para ocultar el panel internal void OcultarPanel() { if (Hidden == false) { // Hidden = true; Timer_Panel.Start(); Panel_Slide.Height = Panel_Slide.Height - 10; if (Panel_Slide.Height <= 0) { Timer_Panel.Stop(); Hidden = true; this.Refresh(); } } }