• 网络学院
  • IT资讯
  • 操作系统
  • 网络技术
  • 软件应用
  • 办公软件
  • 编程技术
  • 网站架设
  • 数据库类
  • 平面设计
  • 多媒体类
  • 游戏资讯
  • 教学论文
  • 认证考试
C# 用Timer组件开发你的动感程序!!!
  站点:
  • 首 页
  • 最新软件
  • 文章教程
  • 国内软件
  • 国外软件
  • 绿色软件
  • 源码下载
  • 字体下载
C# 用Timer组件开发你的动感程序!!!
软件发布 C# 用Timer组件开发你的动感程序!!!
网络软件 系统工具 应用软件 联络聊天 图形图像 多媒体类 行业软件 游戏娱乐 编程开发 安全相关 教育教学 数码软件 绿软下载
热门软件: QQ 瑞星 pplive e话通 木马克星 千千静听 office2000 五笔字根 Photoshop 视频分割
返回文章教程首页 >> 文章首页 >> 编程技术 >> C#教程 >> C# 用Timer组件开发你的动感程序!!!

C# 用Timer组件开发你的动感程序!!!

添加时间: 2007-7-11 3:32:36  作者: C#教程  阅读次数:84   来源: http://www.d9soft.com

        前面有朋友介绍了Timer组件的应用,发现有一些不详细的地方。为此特意上传了这段代码,希望能给各位一点启发!
  其详细的介绍可阅前面一位朋友提供的文章,在此不再重复。
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowSAP
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
public int x1=0,y1=0;
private System.Timers.Timer timer1;
private System.Windows.Forms.PictureBox pictureBox1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null) 
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.timer1 = new System.Timers.Timer();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit();
this.SuspendLayout();
// 
// timer1
// 
this.timer1.Enabled = true;
this.timer1.SynchronizingObject = this;
this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed);
// 
// pictureBox1
// 
this.pictureBox1.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.BackgroundImage")));
this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(144, 128);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
// 
// Form1
// 
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(142, 123);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
  this.pictureBox1});
this.MaximizeBox = false;
this.Name = "Form1";
this.Text = "Form1";
this.TopMost = true;
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit();
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() 
{
Application.Run(new Form1());
}

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


}

private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
  x1+=1;
  y1+=1;
if (x1+10>=700)
x1=0;
if(y1+10>=500)
y1=0;
Point newxy=new Point ( x1,y1 );
this.DesktopLocation =newxy;

  

}

private void label1_Click(object sender, System.EventArgs e)
{

}
}
}

 

上下文章:

 

上一篇文章: 概述C#中的索引器 下一篇文章: C#锐利体验(二)

相关文章:

  • Windows7到来,你的PC准备好了吗?
  • 你的email服务器准备好应对账号搜集攻击了吗
  • 配置你的第一台e-mail服务器(一)
  • 配置你的第一台e-mail服务器(二)
  • 配置你的第一台e-mail服务器(三)

相关软件:

  • RasTimer V1.12
  • ibqsImage 图像处理组件 V2.4
  • FTP远程文件同步更新程序 1.0.0.0
  • iImgReSize图片处理组件 V3.0
  • wfGifAnimator 动画GIF组件 V2.0
  • eptoxls Excel报表图表生成组件 V2.0

 

快速导航

  • 网络学院
  • 精品汇聚
  • 字体下载
  • 教程下载
  • ASP源码
  • PHP源码
  • Net源码
  • JSP 源码

编程技术分类导航

  • ASP & ASP.NET教程
  • PHP教程
  • JSP教程
  • C/C++教程
  • VB & VB.NET教程
  • VC教程
  • Delphi教程
  • BCB教程
  • VFP教程
  • PB教程
  • JAVA教程
  • XML教程
  • C#教程
  • CGI教程

本类经典文章推荐

  • ADO.NET的开发场景及传统ADO的处理
  • 利用Visual C#实现Window管道技术
  • C#取得汉字的拼音的首字母
  • 使用C#编写DES加密程序的framework
  • Visual C#编写3D游戏框架示例
  • 用C#和本地Windows API操纵系统菜...
  • 在C#程序设计中使用Win32类库
  • Visual C#中调用Windows服务初探
  • 如何在C#的WinForm中制作饼状图和...
  • C#中实现DataGrid双向排序

C#教程阅读排行

  • 如何在C#的WinForm中制作饼状图和...
  • 浅析C#中图形编程
  • 用C#和本地Windows API操纵系统菜...
  • 彻底剖析C# 2.0泛型类的创建和使用
  • 使用C#编写DES加密程序的framework
  • Visual C#编写3D游戏框架示例
  • Visual C#中调用Windows服务初探
  • C#如何在Form中嵌入并且操作Excel...
  • Visual C# 2005实现控件中捕获按键
  • C#中利用mediaplayer打造mp3播放器

编程技术阅读总排行

  • VB入门教程之一
  • Java连接数据库实例
  • 第二章 PowerBuilder 入门之创建新...
  • VC++之List Box/Check List Box控...
  • 第一章 什么是PowerBuilder
  • VC++ List Ctrl控件
  • VC++ Combo Box/Combo Box Ex控件
  • 学C++不得不看的一篇文章
  • VB入门教程之二
  • VC++之Button控件

广告位置

字母检索 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 回到顶部

关于我们 | 版权声明 | 免责条款 | 广告联系 | 软件发布 | 下载帮助 | 下载排行 | 网站地图 | 特别鸣谢 | 友情连接

copyright; 2005-2008 D9soft.com 第九软件网 版权所有