📄 mainwindowstate.cs
字号:
// MainWindowState.cs
// Copyright (C) 2001 Mike Krueger
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using SharpDevelop.Tool.Data;
namespace SharpDevelop.Gui {
/// <summary>
/// This class contains the state of the mainwindow, it is used to load/save the
/// state of the mainwindow in the options file.
/// </summary>
public class MainWindowState : XmlConvertable
{
FormWindowState windowstate;
Rectangle bounds;
bool fullscreen;
public FormWindowState WindowState {
get {
return windowstate;
}
}
public Rectangle Bounds {
get {
return bounds;
}
}
public bool FullScreen {
get {
return fullscreen;
}
}
public MainWindowState()
{
windowstate = FormWindowState.Maximized;
bounds = new Rectangle(0, 0, 640, 480);
fullscreen = false;
}
public MainWindowState(XmlElement element)
{
string[] boundstr = element.InnerText.Split(new char [] {'|'});
bounds = new Rectangle (Int32.Parse(boundstr[0]),
Int32.Parse(boundstr[1]),
Int32.Parse(boundstr[2]),
Int32.Parse(boundstr[3]));
windowstate = (FormWindowState)Enum.Parse(typeof(FormWindowState), element.Attributes["STATE"].InnerText);
fullscreen = Boolean.Parse(element.Attributes["FULLSCREEN"].InnerText);
}
public MainWindowState(MainWindow mainwindow)
{
windowstate = mainwindow.WindowState;
bounds = mainwindow.DesktopBounds;
fullscreen = mainwindow.FullScreen;
}
public object FromXmlElement(XmlElement element)
{
return new MainWindowState(element);
}
public XmlElement ToXmlElement(XmlDocument doc)
{
XmlElement element = doc.CreateElement("WINDOWSTATE");
element.InnerText = bounds.X + "|" +
bounds.Y + "|" +
bounds.Width + "|" +
bounds.Height;
XmlAttribute stateattr = doc.CreateAttribute("STATE");
stateattr.InnerText = windowstate.ToString();
XmlAttribute fullscreenattr = doc.CreateAttribute("FULLSCREEN");
fullscreenattr.InnerText = fullscreen.ToString();
element.Attributes.Append(fullscreenattr);
element.Attributes.Append(stateattr);
return element;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -