如何移动PANEL及包含控件? 网上找了好几个,都不行,鼠标进入点不点不管用,如果像在编辑状态下那样处理就足够了!如何做到呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public class MyPanel : Panel{ [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wparam, int lparam); protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Button == MouseButtons.Left)//按下的是鼠标左键 { Capture = false;//释放鼠标,使能够手动操作 SendMessage(this.Handle, 0x00A1, 2, 0);//拖动窗体 } }}复制到你项目任何一个地方,编译一次,在工具栏拖这个MyPanel到窗体上。就可以运行的时候随意拖动了。本方法来自我博客:http://blog.csdn.net/wuyazhe/archive/2010/06/23/5690116.aspx 一楼的回答,如果单一个PANEL的确可以拖动,但我在里边加了一个WEBBROWSER,就无法拖动了!不知楼主有没有好办法,另外如何缩放呢? 请教正则表达式 c#写文件问题 c#中怎么设置用户的投票次数代码就一个用户只能投3次 C# polyfit 拟合函数实现 ListView高效分页 出现“未能开启约束”错误 求解 FileSystemWatcher怎么动态创建和监测多个文件夹 创建超大数组 如何调用remoting? 求教:Foxmail中的已经接收和已经发送的邮件的文件存储方式! 字符串中的单引号和双引号的替换 怎样在DataGridView中的DataGridViewImageColumn列显示两张图片? c# 实现treeview节点展开折叠
public class MyPanel : Panel
{
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wparam, int lparam);
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button == MouseButtons.Left)//按下的是鼠标左键
{
Capture = false;//释放鼠标,使能够手动操作
SendMessage(this.Handle, 0x00A1, 2, 0);//拖动窗体
}
}}复制到你项目任何一个地方,编译一次,在工具栏拖这个MyPanel到窗体上。就可以运行的时候随意拖动了。
本方法来自我博客:
http://blog.csdn.net/wuyazhe/archive/2010/06/23/5690116.aspx