shape.cs

来自「c#设计模式随书源码 c#设计模式随书源码」· CS 代码 · 共 28 行

CS
28
字号
using System;
using System.Drawing ;
namespace CsharpPats
{
	/// <summary>
	/// Summary description for Shape.
	/// </summary>
	public abstract class Shape 	{
		protected int height, width;
		protected int xpos, ypos;
		protected Pen bPen;
		//-----
		public Shape(int x, int y, int h, int w)	{
			width = w;
			height = h;
			xpos = x;
			ypos = y;
			bPen = new Pen(Color.Black );
		}
		//-----
		public abstract void draw(Graphics g);
		//-----
		public virtual float getArea() {
			return height * width;
		}
	}
}

⌨️ 快捷键说明

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