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 LoginExample_001
{
public partial class Form1 : Form
{
int formMove;
int mouseValue_X;
int mouseValue_Y;
public Form1()
{
InitializeComponent();
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
formMove = 0;
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
formMove = 1;
mouseValue_X = e.X;
mouseValue_Y = e.Y;
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (formMove == 1)
{
this.SetDesktopLocation(MousePosition.X - mouseValue_X, MousePosition.Y - mouseValue_Y);
}
}
}
}
No comments:
Post a Comment