日期:2014-05-17 浏览次数:20949 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace TestWin
{
public partial class Form1 : Form
{
private Thread threadForm = null;
public Form1()
{
InitializeComponent();
threadForm = Thread.CurrentThread;
Button tButton = new Button()
{
Text="测试按钮!"
};
SetNewPostion(tButton, new Point(0,0));
tButton.Click+=new EventHandler(tButton_Click);
Controls.Add(tButton);
}
private void SetNewPostion(Control ct, Point positon)
{
ct.Location = positon;
}
private delegate void MoveDelegate(object o);
private bool IsMoving = false;
private IAsyncResult result = null;
protected void tButton_Click(object o, EventArgs e)
{
if (IsMoving)
{
this.EndInvoke(result);
}
else
{