吉吉于

free

C#每天抄一点(17):输出系统图标

01 /*
02 * 由SharpDevelop创建。
03 * 用户: Lazynight
04 * 日期: 2011/10/18
05 * 时间: 7:00
06 *
07 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
08 */
09 using System;
10 using System.Collections.Generic;
11 using System.Drawing;
12 using System.Windows.Forms;
13
14 namespace Lazy17_获取系统图标
15 {
16     public partial class MainForm : Form
17     {
18         public MainForm()
19         {
20             InitializeComponent();
21         }
22         void MainFormPaint(object sender, PaintEventArgs e)
23         {
24             Rectangle[] Lazy_rects=new Rectangle[16];
25             Pen Lazy_pen=new Pen(Color.Black,4);//定义画笔
26             int index=;
27             for(int i=20;i<250;i=i+60)//4*4排列,并且利用i,j定位
28             {
29                 for(int j=20;j<250;j=j+60)
30                 {
31                     e.Graphics.DrawRectangle(Lazy_pen,j,i,60,60);//画框大小
32                     Lazy_rects[index++]=new Rectangle(j,i,60,60);//图标大小
33                 }
34             }
35             Icon[] Lazy_icon={SystemIcons.Application,SystemIcons.Asterisk,SystemIcons.Error,
36                 SystemIcons.Exclamation,SystemIcons.Hand,SystemIcons.Information,SystemIcons.Question,
37                 SystemIcons.Shield,SystemIcons.Warning,SystemIcons.WinLogo,SystemIcons.WinLogo,
38                 SystemIcons.Asterisk,SystemIcons.Asterisk,SystemIcons.Asterisk,SystemIcons.Asterisk,SystemIcons.Hand};
39             //输出图标集合
40             for(int i=;i<Lazy_icon.Length;i++)//画出图标
41             {
42                 e.Graphics.DrawIcon(Lazy_icon[i],Lazy_rects[i]);
43             }
44
45         }
46     }
47 }

下载源码

转载请注明:于哲的博客 » C#每天抄一点(17):输出系统图标