MainForm.cs
上传用户:linger1010
上传日期:2008-12-08
资源大小:561k
文件大小:1k
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace DrawingIcon
- {
- public partial class MainForm : Form
- {
- // 保存动画所用的图标
- private Icon[] m_icons = new Icon[8];
- // 记录当前显示的图标编号
- private int m_curIcon = 0;
- // 绘制图表的位置和大小
- private Rectangle m_rcIcon = new Rectangle(20, 20, 32, 32);
- public MainForm()
- {
- InitializeComponent();
- m_icons[0] = Properties.Resources.MOON01;
- m_icons[1] = Properties.Resources.MOON02;
- m_icons[2] = Properties.Resources.MOON03;
- m_icons[3] = Properties.Resources.MOON04;
- m_icons[4] = Properties.Resources.MOON05;
- m_icons[5] = Properties.Resources.MOON06;
- m_icons[6] = Properties.Resources.MOON07;
- m_icons[7] = Properties.Resources.MOON08;
- }
- private void MainForm_Paint(object sender, PaintEventArgs e)
- {
- //e.Graphics.DrawIcon(Properties.Resources.PDA, 20, 20);
- // 在指定位置绘制当前图标
- e.Graphics.DrawIcon(m_icons[m_curIcon], m_rcIcon.Left, m_rcIcon.Top);
- // 改变图标的编号,以便下一次绘制新的图标
- m_curIcon = (m_curIcon + 1) % 8;
- }
- private void m_onTimer(object sender, EventArgs e)
- {
- this.Invalidate(m_rcIcon);
- }
- }
- }