作为多屏视频监控
要实现:
10x10的方格,(用什么控件没有限制)显示一百个画面,用户用鼠标拖动可以把鼠标覆盖的格子单独输出。
比如能任意拖拽出3x4, 5x6的画面。
只需实现这个拖拽功能就行,求各位大神指点下 本人小白。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
Point pt;
bool moves = true;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (moves == true)
{
MessageBox.Show("sfdfdf");
}
}
private void button1_MouseDown(object sender, MouseEventArgs e)
{
pt = Cursor.Position;
}
private void button1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
int px = Cursor.Position.X - pt.X;
int py = Cursor.Position.Y - pt.Y;
button1.Location = new Point(button1.Location.X + px, button1.Location.Y + py);
pt = Cursor.Position;
moves = false;
}
}
private void button1_MouseUp(object sender, MouseEventArgs e)
{
moves = true;
}
}
}
思路就是改变你这100个控件所在布局控件的位置就行了