c# 按钮移动 急救!!!!!

幸福简单 2013-01-10 09:20:12
最近刚学完c#,老师要求我们开始做项目了,经我们小组(3人)讨论,决定做一个和仓库管理差不多的系统,但是问题来,如图:假如点击第二个按钮,它就会往上走,且速度像是被拉上去一般,很是好看,它上去之后,就会有一些新的按钮出来,然后又点击第三个按钮,也是和第二个按钮一样,下面的按钮也是这样,不知道这样的效果是怎么做出来的,想请大家帮忙指点指点,还没去问老师,小弟感激不尽,这是我们第一个项目啊!!!感觉太繁琐了.........最好能有代码外加注释了(我在别的板块也发了这个帖子,可是没啥人回....真的挺急的)
...全文
250 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
实现起来也不难吧。。。就是比较繁琐而已。。。。 用第三方控件比较简单。。 学生就老老实实的写事件处理吧。。
yuefeng_sihu 2013-01-11
  • 打赏
  • 举报
回复
自己写第三方,想要例子,网上搜索,sidebar控件,源码好像一大堆吧
心态要好 2013-01-11
  • 打赏
  • 举报
回复
做bs的楼主的功能好实现
Kim_Du 2013-01-11
  • 打赏
  • 举报
回复
自己用JS写吧 很麻烦的
_猫了个咪 2013-01-11
  • 打赏
  • 举报
回复
用DEV控件好看还好实现 。。。。。 你现在不好做的。。。。 建议你直接用按钮代替得了。
xdq025 2013-01-10
  • 打赏
  • 举报
回复
//悄悄的抛出一块砖头 [code=c#] 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 { result = this.BeginInvoke(new MoveDelegate(RandomMove), o); } } private const int radomDelay = 1; private const int moveDelay = 1; private const int stepCount = 10; protected void RandomMove(object o) { if (!(o is Control)) return; Control ct = o as Control; Random rd = new Random(); int i=0; int y = (rd.Next(0, this.ClientSize.Height - this.Padding.All-ct.Size.Height) - ct.Location.Y) / stepCount; Thread.CurrentThread.Join(radomDelay); int x = (rd.Next(0, this.ClientSize.Width-this.Padding.All-ct.Size.Width) - ct.Location.X) / stepCount; while (i++<stepCount) { IsMoving = true; Point p = new Point(ct.Location.X + x, ct.Location.Y + y); SetNewPostion(ct, p); Thread.CurrentThread.Join(moveDelay); } IsMoving = false; } } } //代码应该不难看懂吧,没必要上注释了 [/code]
bdmh 2013-01-10
  • 打赏
  • 举报
回复
别作了,估计你是做不出来,用第三方的吧,比如dev的
幸福简单 2013-01-10
  • 打赏
  • 举报
回复
不好意思啊,是WinForm,帮帮忙了大家们
xdq025 2013-01-10
  • 打赏
  • 举报
回复
C#是神马? WinForm还是WebForm啊?

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧