slashdeco.cs

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

CS
26
字号
using System;
using System.Windows.Forms;
using System.Drawing ;

namespace SlashDecorator
{
	/// <summary>
	/// Summary description for SlashDeco.
	/// </summary>
	public class SlashDeco:CoolDecorator 	{
		private Pen rPen;
		//----------------
		public SlashDeco(Control c, Control bc):base(c, bc) {
		  rPen = new Pen(Color.Red , 2);
		}
		//----------------
		public override void paint(object sender, PaintEventArgs e){
			Graphics g = e.Graphics ;
			x1=0; y1=0;
			x2=this.Size.Width ;
			y2=this.Size.Height ;
			g.DrawLine (rPen, x1, y1, x2, y2);		
        }
	}
}

⌨️ 快捷键说明

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