如何将窗口动画移到指定位置 如现在位置为:CPoint(30,21)那如何动画移动到CPoint(620,870)呢?要求水平坐标与纵坐标同步移动,不要先移动X到指定位置,再移动Y的值 ! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void Form1_Move(object sender, System.EventArgs e) { Rectangle clipRectangle=new Rectangle(200,200,300,300); ClipCursor(ref clipRectangle); } show是LOCATION http://topic.csdn.net/u/20100226/23/1c3cddc3-2bc3-4e00-a342-5a17445b1933.html private void Form1_Load(object sender, EventArgs e) { this.Location = p1; } Point p1 = new Point(30,21); Point p2 = new Point(420, 470); private void button1_Click(object sender, EventArgs e) { MoveTo(this, p2, 1, 50); } /// <summary> /// 将指定控件移动到指定位置 /// </summary> /// <param name="c">控件</param> /// <param name="p">目标位置(父容器坐标系)</param> /// <param name="movestep">移动次数</param> /// <param name="time">移动耗时</param> /// <res></res> public void MoveTo(Control c, Point p, int movestep, int time) { Point l = c.Location; float xspeed = (p.X - l.X) / movestep; float yspeed = (p.Y - l.Y) / movestep; float steptime = time; //1000 * time / movestep; for (int i = 1; i <= movestep; i++) { c.Left = (int)(l.X + i * xspeed); c.Top =(int)( l.Y + i * yspeed); System.Threading.Thread.Sleep((int)steptime); Application.DoEvents(); } } VS2008 C#程序合并问题 第三次发问:调用C++DLL堆栈问题“Windows 已在###中触发一个断点”。 DateTime? 与 DateTime 的区别 NetMeeting端口映射的问题 读取正在处理操作的usb接口 求救大家一个关于mshtml的问题 关于officexp 问题 谁来给解决啊 WCF双工通信WinRT调用 证书错误? 关于C#委托与线程: 请帮我解决一个跨线程消息响应的问题 关于泛型委托的一些问题 Entity Framework 的connectionString意思?? asp.net c# 关于提醒功能的,有没有实例
{
Rectangle clipRectangle=new Rectangle(200,200,300,300);
ClipCursor(ref clipRectangle);
}
show是LOCATION
{
this.Location = p1; } Point p1 = new Point(30,21);
Point p2 = new Point(420, 470);
private void button1_Click(object sender, EventArgs e)
{
MoveTo(this, p2, 1, 50);
} /// <summary>
/// 将指定控件移动到指定位置
/// </summary>
/// <param name="c">控件</param>
/// <param name="p">目标位置(父容器坐标系)</param>
/// <param name="movestep">移动次数</param>
/// <param name="time">移动耗时</param>
/// <res></res>
public void MoveTo(Control c, Point p, int movestep, int time)
{
Point l = c.Location;
float xspeed = (p.X - l.X) / movestep;
float yspeed = (p.Y - l.Y) / movestep;
float steptime = time; //1000 * time / movestep;
for (int i = 1; i <= movestep; i++)
{
c.Left = (int)(l.X + i * xspeed);
c.Top =(int)( l.Y + i * yspeed);
System.Threading.Thread.Sleep((int)steptime);
Application.DoEvents();
}
}