imageviewcontent.cs

来自「SharpDevelop2.0.0 c#开发免费工具」· CS 代码 · 共 52 行

CS
52
字号
/*
 * Created by SharpDevelop.
 * User: Daniel Grunwald
 * Date: 19.10.2005
 * Time: 21:43
 */

using System;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;

namespace ImageViewer
{
	public class ImageViewContent : AbstractViewContent
	{
		PictureBox box = new PictureBox();
		public override Control Control {
			get {
				return box;
			}
		}
		public override string TabPageText {
			get {
				return "Image Viewer";
			}
		}
		public override void Load(string fileName) {
			this.IsDirty = false;
			this.FileName = fileName;
			this.TitleName = Path.GetFileName(fileName);
			box.SizeMode = PictureBoxSizeMode.Zoom;
			box.Load(fileName);
		}
		
		public override void Save(string fileName) {
			this.IsDirty = false;
			this.FileName = fileName;
			this.TitleName = Path.GetFileName(fileName);
			box.Image.Save(fileName);
		}
		
		public override bool IsReadOnly {
			get {
				return (File.GetAttributes(this.FileName)
				        & FileAttributes.ReadOnly) != 0;
			}
		}
	}
}

⌨️ 快捷键说明

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