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

📄 itemfactory.cs

📁 这是一个用C#编写的画图板程序
💻 CS
字号:
using System;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace Painter.Common
{
	/// <summary>
	/// ItemFactory 的摘要说明。
	/// </summary>
	public class ItemFactory
	{
		public ItemFactory()
		{
		}
		public static MyItem CreateItem(ItemType type,params object[] ItemParam)
		{
			MyItem item;
			try
			{
				switch(type) 
				{
					case ItemType.Line:
						item = new MyLine((int)ItemParam[0],(int)ItemParam[1],
							(int)ItemParam[2],(int)ItemParam[3],
							(Color)ItemParam[4],
							(float)ItemParam[5],
							(DashStyle)ItemParam[6]);
						break;
					case ItemType.RectAngle:
						item = new MyRectAngle((int)ItemParam[0],(int)ItemParam[1],
							(int)ItemParam[2],(int)ItemParam[3],
							(Color)ItemParam[4],
							(float)ItemParam[5],
							(DashStyle)ItemParam[6]);
						break;
					case ItemType.Circle:
						item = new MyCircle((int)ItemParam[0],
							(int)ItemParam[1],
							(int)ItemParam[2],
							(int)ItemParam[3],
							(Color)ItemParam[4],
							(float)ItemParam[5],
							(DashStyle)ItemParam[6]);

						break;
					default:
						item = null;
						break;
				}
			}catch
			{
				throw new Exception("创建图像元素实例失败!");
			}
			return item;
		}
	}
}

⌨️ 快捷键说明

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