C#控件移动范围控制,急救! 见http://www.codeproject.com/csharp/SmartDragDrop.asp可以下载代码示例。不过需要注册。可以告诉我你的邮箱,我给你发过去。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼主试下这个代码是否符合题意:private Point m_StartPoint;private Rectangle m_Rect;private Rectangle m_oRect;private void label1_MouseDown(object sender, MouseEventArgs e){ if (e.Button == MouseButtons.Left) { this.m_StartPoint = e.Location; this.m_Rect = this.label1.Bounds; this.m_oRect = this.m_Rect; }}private void label1_MouseMove(object sender, MouseEventArgs e){ if (this.label1.Capture) { this.m_Rect.X += e.X - this.m_StartPoint.X; this.m_Rect.Y += e.Y - this.m_StartPoint.Y; this.label1.Bounds = this.m_Rect; }}private void label1_MouseUp(object sender, MouseEventArgs e){ if (!this.ClientRectangle.Contains(this.m_Rect)) { this.label1.Bounds = this.m_oRect; }} 這是我做的子窗范围控制在主窗體內,看看是否對你有用http://www.cnblogs.com/scottckt/archive/2007/08/28/872871.html 在JAVA板块中高手都死光了!高手解答弱智问题一题! xml与c#的联系 在Access2003中查重并删除大量数据,有无什么好办法?!! web service问题 C#字符串截取问题,急用,谢谢!! 问一个刚入门的很简单问题 .net连接Oracle的问题 .Net中如何改变ColorDialog弹出时的位置 C# 获得sql server中表的创建语句 如何将字符串转换成具有相应名称的控件对象 图形化操作问题. 关于SharePoint2007中WebPart的问题
private Rectangle m_Rect;
private Rectangle m_oRect;
private void label1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.m_StartPoint = e.Location;
this.m_Rect = this.label1.Bounds;
this.m_oRect = this.m_Rect;
}
}private void label1_MouseMove(object sender, MouseEventArgs e)
{
if (this.label1.Capture)
{
this.m_Rect.X += e.X - this.m_StartPoint.X;
this.m_Rect.Y += e.Y - this.m_StartPoint.Y;
this.label1.Bounds = this.m_Rect;
}
}private void label1_MouseUp(object sender, MouseEventArgs e)
{
if (!this.ClientRectangle.Contains(this.m_Rect))
{
this.label1.Bounds = this.m_oRect;
}
}
http://www.cnblogs.com/scottckt/archive/2007/08/28/872871.html