⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 colorchain.cs

📁 VC#里面的东西,大家可以看看
💻 CS
字号:
using System;
using System.Collections ;
using System.Drawing ;
using System.Windows.Forms ;
namespace Chain
{
	/// <summary>
	/// receives color names in chain
	/// </summary>
	public class ColorChain : Chain {
		private Hashtable colHash;	//color list kept here
		private Panel panel;		//color goes here
		//-----
		public ColorChain(Panel pnl) 		{
			panel = pnl;			//save reference
			//create Hash table to correlate color names
			//with actual Color objects
			colHash = new Hashtable ();
			colHash.Add ("red", Color.Red);
			colHash.Add ("green", Color.Green);
			colHash.Add ("blue", Color.Blue);
		}
		//-----
		public override void sendToChain(string mesg) {
			mesg = mesg.ToLower ();
			try {
				Color c = (Color)colHash[mesg];
				//if this is a color, put it in the panel
				panel.BackColor =c;
			}
			catch (NullReferenceException e) {
				//send on if this doesn't work
				sendChain(mesg);
			}
			
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -