Articles in this section

How to make movable WinForms Splash control?

This requirement can be achieved by handling MouseMove and MouseDown event of the SplashControlPanel in SplashControl.

C#

 
//Determined the cursor point 
Point cursorPoint = new Point();
 
//Events
this.splashControl1.SplashControlPanel.MouseDown += SplashControlPanel_MouseDown;
this.splashControl1.SplashControlPanel.MouseMove += SplashControlPanel_MouseMove;
 
private void SplashControlPanel_MouseMove(object sender, MouseEventArgs e)
{
    if (Control.MouseButtons == MouseButtons.Left)
    {
        if (this.splashControl1.SplashControlPanel.Parent is Form)
        {
            (this.splashControl1.SplashControlPanel.Parent as Form).Left = Cursor.Position.X - cursorPoint.X;
            (this.splashControl1.SplashControlPanel.Parent as Form).Top = Cursor.Position.Y - cursorPoint.Y;
        }
    }
}
 
private void SplashControlPanel_MouseDown(object sender, MouseEventArgs e)
{
    cursorPoint = e.Location;
}

 

View Sample in GitHub

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied