| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 797 人关注过本帖
标题:帮帮忙,看下怎么做...
只看楼主 加入收藏
luohongtai
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-10-25
结帖率:0
收藏
已结贴  问题点数:20 回复次数:7 
帮帮忙,看下怎么做...
初学c#,但是想了好久都没有头绪...

帮我看下附件那个东西怎么做的,可以的话,做下,把源文件打包发给我...

邮箱:lhthello@

题目.rar (7.32 KB)



搜索更多相关主题的帖子: 源文件 
2009-10-25 22:48
jedypjd
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:9
帖 子:1096
专家分:4969
注 册:2009-7-27
收藏
得分:4 
只要会用计时器就差不多了

天涯无岁月,歧路有风尘,百年浑似醉,是非一片云
2009-10-25 23:24
jedypjd
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:9
帖 子:1096
专家分:4969
注 册:2009-7-27
收藏
得分:0 

天涯无岁月,歧路有风尘,百年浑似醉,是非一片云
2009-10-26 00:17
baikil
Rank: 10Rank: 10Rank: 10
来 自:X星球
等 级:青峰侠
威 望:4
帖 子:282
专家分:1580
注 册:2009-7-20
收藏
得分:4 
回复 楼主 luohongtai
我还是把它的源码给你贴出来吧!


private void InitializeComponent()
{
    = new Container();
    this.label1 = new Label();
    this.groupBox1 = new GroupBox();
    this.button4 = new Button();
    this.button3 = new Button();
    this.button2 = new Button();
    this.button1 = new Button();
    this.timer1 = new Timer();
    this.timer2 = new Timer();
    this.timer3 = new Timer();
    this.groupBox1.SuspendLayout();
    base.SuspendLayout();
    this.label1.BorderStyle = BorderStyle.Fixed3D;
    this.label1.Font = new Font("宋体", 18f, FontStyle.Bold, GraphicsUnit.Point, 134);
    this.label1.Location = new Point(36, 7);
    this.label1.Name = "label1";
    this.label1.Size = new Size(162, 31);
    this.label1.TabIndex = 0;
    this.label1.Text = "飘动动画窗体";
    this.groupBox1.BackColor = SystemColors.Control;
    this.groupBox1.Controls.Add(this.button4);
    this.groupBox1.Controls.Add(this.button3);
    this.groupBox1.Controls.Add(this.button2);
    this.groupBox1.Controls.Add(this.button1);
    this.groupBox1.Location = new Point(17, 41);
    this.groupBox1.Name = "groupBox1";
    this.groupBox1.Size = new Size(200, 108);
    this.groupBox1.TabIndex = 1;
    this.groupBox1.TabStop = false;
    this.groupBox1.Text = "飘动动画窗体的控制";
    this.button4.Location = new Point(112, 63);
    this.button4.Name = "button4";
    this.button4.Size = new Size(69, 37);
    this.button4.TabIndex = 3;
    this.button4.Text = "停止飘动";
    this.button4.UseVisualStyleBackColor = true;
    this.button4.Click += new EventHandler(this.button4_Click);
    this.button3.Location = new Point(34, 63);
    this.button3.Name = "button3";
    this.button3.Size = new Size(69, 37);
    this.button3.TabIndex = 2;
    this.button3.Text = "飘动窗体";
    this.button3.UseVisualStyleBackColor = true;
    this.button3.Click += new EventHandler(this.button3_Click);
    this.button2.Location = new Point(112, 20);
    this.button2.Name = "button2";
    this.button2.Size = new Size(69, 37);
    this.button2.TabIndex = 1;
    this.button2.Text = "垂直飘动";
    this.button2.UseVisualStyleBackColor = true;
    this.button2.Click += new EventHandler(this.button2_Click);
    this.button1.Location = new Point(36, 20);
    this.button1.Name = "button1";
    this.button1.Size = new Size(69, 37);
    this.button1.TabIndex = 0;
    this.button1.Text = "水平飘动";
    this.button1.UseVisualStyleBackColor = true;
    this.button1.Click += new EventHandler(this.button1_Click);
    this.timer1.Interval = 10;
    this.timer1.Tick += new EventHandler(this.timer1_Tick);
    this.timer2.Interval = 10;
    this.timer2.Tick += new EventHandler(this.timer2_Tick);
    this.timer3.Interval = 10;
    this.timer3.Tick += new EventHandler(this.timer3_Tick);
    base.AutoScaleDimensions = new SizeF(6f, 12f);
    base.AutoScaleMode = AutoScaleMode.Font;
    base.ClientSize = new Size(234, 161);
    base.Controls.Add(this.groupBox1);
    base.Controls.Add(this.label1);
    base.Name = "Form1";
    this.Text = "飘动动画窗体";
    base.Load += new EventHandler(this.Form1_Load);
    this.groupBox1.ResumeLayout(false);
    base.ResumeLayout(false);
}

 
private void button1_Click(object sender, EventArgs e)
{
    this.timer1.Enabled = true;
    this.timer2.Enabled = false;
    this.timer3.Enabled = false;
}
private void button2_Click(object sender, EventArgs e)
{
    this.timer1.Enabled = false;
    this.timer2.Enabled = true;
    this.timer3.Enabled = false;
}
private void button3_Click(object sender, EventArgs e)
{
    this.timer1.Enabled = false;
    this.timer2.Enabled = false;
    this.timer3.Enabled = true;
}
private void button4_Click(object sender, EventArgs e)
{
    this.timer1.Enabled = false;
    this.timer2.Enabled = false;
    this.timer3.Enabled = false;
}


private void Form1_Load(object sender, EventArgs e)
{
    this.timer1.Enabled = true;
}

private void timer1_Tick(object sender, EventArgs e)
{
    Point point = new Point(base.DesktopLocation.X, base.DesktopLocation.Y);
    if ((point.X + base.Width) < this.ScreenWidth)
    {
        base.DesktopLocation = new Point(point.X + 1, point.Y);
    }
    else
    {
        base.DesktopLocation = new Point(0, 0);
    }
}
private void timer2_Tick(object sender, EventArgs e)
{
    Point point = new Point(base.DesktopLocation.X, base.DesktopLocation.Y);
    if ((point.Y + base.Height) < this.ScreenHeight)
    {
        base.DesktopLocation = new Point(point.X, point.Y + 1);
    }
    else
    {
        base.DesktopLocation = new Point(0, 0);
    }
}

 
private void timer3_Tick(object sender, EventArgs e)
{
    Point point = new Point(base.DesktopLocation.X, base.DesktopLocation.Y);
    if (((point.X + base.Width) < this.ScreenWidth) || ((point.Y + base.Height) < this.ScreenHeight))
    {
        base.DesktopLocation = new Point(point.X + 1, point.Y + 1);
    }
    else
    {
        base.DesktopLocation = new Point(0, 0);
    }
}
 
public class Form1 : Form
{
    // Fields
    private Button button1;
    private Button button2;
    private Button button3;
    private Button button4;
    private IContainer components;
    private GroupBox groupBox1;
    private Label label1;
    private int ScreenHeight;
    private int ScreenWidth;
    private Timer timer1;
    private Timer timer2;
    private Timer timer3;

    // Methods
    public Form1();
    private void button1_Click(object sender, EventArgs e);
    private void button2_Click(object sender, EventArgs e);
    private void button3_Click(object sender, EventArgs e);
    private void button4_Click(object sender, EventArgs e);
    protected override void Dispose(bool disposing);
    private void Form1_Load(object sender, EventArgs e);
    private void InitializeComponent();
    private void timer1_Tick(object sender, EventArgs e);
    private void timer2_Tick(object sender, EventArgs e);
    private void timer3_Tick(object sender, EventArgs e);
}

自己整理一下啊,可以做个和它一模一样的,哈哈..
 

 




 

自创QQ群64885635,方便C#学习交流.希望各项工作路好学都好入!
2009-10-26 09:12
一叶之秋
Rank: 2
等 级:论坛游民
帖 子:13
专家分:29
注 册:2009-10-30
收藏
得分:4 
楼上的厉害啊
2009-10-30 14:16
leegy
Rank: 1
等 级:新手上路
帖 子:7
专家分:4
注 册:2009-10-30
收藏
得分:4 
厉害
2009-10-30 16:23
domon
Rank: 3Rank: 3
来 自:河南
等 级:论坛游侠
帖 子:92
专家分:191
注 册:2009-10-26
收藏
得分:4 
四楼真强!!!

希望,是走出来的!!!
2009-10-30 16:36
leegy
Rank: 1
等 级:新手上路
帖 子:7
专家分:4
注 册:2009-10-30
收藏
得分:0 
用一个计时器也可以,我试了!
2009-10-30 18:07
快速回复:帮帮忙,看下怎么做...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029728 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved