Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- namespace R715MoverFormularioSinBordes
- {
- public partial class Principal : Form
- {
- private bool moviendoFormulario;
- private Point posicionActualPuntero;
- public Principal()
- {
- InitializeComponent();
- }
- private void btnMoverFormulario_Click(object sender, EventArgs e)
- {
- Close();
- }
- private void lblMoverFormulario_MouseDown(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Left)
- {
- moviendoFormulario = true;
- posicionActualPuntero = new Point(e.X, e.Y);
- }
- else
- {
- moviendoFormulario = false;
- }
- }
- private void lblMoverFormulario_MouseMove(object sender, MouseEventArgs e)
- {
- if (moviendoFormulario)
- {
- Point nuevoPunto;
- nuevoPunto = PointToScreen(new Point(e.X, e.Y));
- nuevoPunto.Offset(-posicionActualPuntero.X, -posicionActualPuntero.Y);
- Location = nuevoPunto;
- }
- }
- private void lblMoverFormulario_MouseUp(object sender, MouseEventArgs e)
- {
- moviendoFormulario = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement