memento.cs

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

CS
31
字号
using System;

namespace Memento
{
	/// <summary>
	/// Summary description for Memento.
	/// </summary>
	public class Memento 	{
		private int x, y, w, h;
		private CsharpPats.Rectangle rect;
		private VisRectangle visRect;
		//------
    	public Memento(VisRectangle vrect) 		{
			visRect = vrect;
			rect = visRect.rects ;
			x = rect.x ;
			y = rect.y;
			w = rect.w;
			h = rect.h;
		}
		//------
		public void restore() {
			rect.x = x;
			rect.y = y;
			rect.h = h;
			rect.w = w;
			visRect.rects = rect;
		}
	}
}

⌨️ 快捷键说明

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