?? content.cs
字號(hào):
// *****************************************************************************
//
// (c) Crownwood Consulting Limited 2002
// All rights reserved. The software and associated documentation
// supplied hereunder are the proprietary information of Crownwood Consulting
// Limited, Haxey, North Lincolnshire, England and are supplied subject to
// licence terms.
//
// Magic Version 1.7 www.dotnetmagic.com
// *****************************************************************************
using System;
using System.Xml;
using System.Drawing;
using System.Windows.Forms;
using Crownwood.Magic.Common;
using Crownwood.Magic.Docking;
namespace Crownwood.Magic.Docking
{
public class Content
{
// Enumeration of property change events
public enum Property
{
Control,
Title,
FullTitle,
ImageList,
ImageIndex,
CaptionBar,
CloseButton,
HideButton,
DisplaySize,
AutoHideSize,
FloatingSize,
DisplayLocation
}
// Declare the property change event signature
public delegate void PropChangeHandler(Content obj, Property prop);
// Class constant
protected static int _defaultDisplaySize = 150;
protected static int _defaultAutoHideSize = 150;
protected static int _defaultFloatingSize = 150;
protected static int _defaultLocation = 150;
protected static int _counter = 0;
// Instance fields
protected Control _control;
protected string _title;
protected string _fullTitle;
protected ImageList _imageList;
protected int _imageIndex;
protected Size _displaySize;
protected Size _autoHideSize;
protected Size _floatingSize;
protected Point _displayLocation;
protected int _order;
protected DockingManager _manager;
protected bool _docked;
protected bool _autoHidden;
protected bool _visible;
protected bool _captionBar;
protected bool _closeButton;
protected bool _hideButton;
protected AutoHidePanel _autoHidePanel;
protected WindowContent _parentWindowContent;
protected Restore _defaultRestore;
protected Restore _autoHideRestore;
protected Restore _dockingRestore;
protected Restore _floatingRestore;
// Instance events
public event PropChangeHandler PropertyChanging;
public event PropChangeHandler PropertyChanged;
public Content(XmlTextReader xmlIn, int formatVersion)
{
// Define the initial object state
_control = null;
_title = "";
_fullTitle = "";
_imageList = null;
_imageIndex = -1;
_manager = null;
_parentWindowContent = null;
_displaySize = new Size(_defaultDisplaySize, _defaultDisplaySize);
_autoHideSize = new Size(_defaultAutoHideSize, _defaultAutoHideSize);
_floatingSize = new Size(_defaultFloatingSize, _defaultFloatingSize);
_displayLocation = new Point(_defaultLocation, _defaultLocation);
_order = _counter++;
_visible = false;
_defaultRestore = null;
_autoHideRestore = null;
_floatingRestore = null;
_dockingRestore = null;
_autoHidePanel = null;
_docked = true;
_captionBar = true;
_closeButton = true;
_hideButton = true;
_autoHidden = false;
// Overwrite default with values read in
LoadFromXml(xmlIn, formatVersion);
}
public Content(DockingManager manager)
{
InternalConstruct(manager, null, "", null, -1);
}
public Content(DockingManager manager, Control control)
{
InternalConstruct(manager, control, "", null, -1);
}
public Content(DockingManager manager, Control control, string title)
{
InternalConstruct(manager, control, title, null, -1);
}
public Content(DockingManager manager, Control control, string title, ImageList imageList, int imageIndex)
{
InternalConstruct(manager, control, title, imageList, imageIndex);
}
protected void InternalConstruct(DockingManager manager,
Control control,
string title,
ImageList imageList,
int imageIndex)
{
// Must provide a valid manager instance
if (manager == null)
throw new ArgumentNullException("DockingManager");
// Define the initial object state
_control = control;
_title = title;
_imageList = imageList;
_imageIndex = imageIndex;
_manager = manager;
_parentWindowContent = null;
_order = _counter++;
_visible = false;
_displaySize = new Size(_defaultDisplaySize, _defaultDisplaySize);
_autoHideSize = new Size(_defaultAutoHideSize, _defaultAutoHideSize);
_floatingSize = new Size(_defaultFloatingSize, _defaultFloatingSize);
_displayLocation = new Point(_defaultLocation, _defaultLocation);
_defaultRestore = new RestoreContentState(State.DockLeft, this);
_floatingRestore = new RestoreContentState(State.Floating, this);
_autoHideRestore = new RestoreAutoHideState(State.DockLeft, this);
_dockingRestore = _defaultRestore;
_autoHidePanel = null;
_docked = true;
_captionBar = true;
_closeButton = true;
_hideButton = true;
_autoHidden = false;
_fullTitle = title;
}
public DockingManager DockingManager
{
get { return _manager; }
set { _manager = value; }
}
public Control Control
{
get { return _control; }
set
{
if (_control != value)
{
OnPropertyChanging(Property.Control);
_control = value;
OnPropertyChanged(Property.Control);
}
}
}
public string Title
{
get { return _title; }
set
{
if (_title != value)
{
OnPropertyChanging(Property.Title);
_title = value;
OnPropertyChanged(Property.Title);
}
}
}
public string FullTitle
{
get { return _fullTitle; }
set
{
if (_fullTitle != value)
{
OnPropertyChanging(Property.FullTitle);
_fullTitle = value;
OnPropertyChanged(Property.FullTitle);
}
}
}
public ImageList ImageList
{
get { return _imageList; }
set
{
if(_imageList != value)
{
OnPropertyChanging(Property.ImageList);
_imageList = value;
OnPropertyChanged(Property.ImageList);
}
}
}
public int ImageIndex
{
get { return _imageIndex; }
set
{
if (_imageIndex != value)
{
OnPropertyChanging(Property.ImageIndex);
_imageIndex = value;
OnPropertyChanged(Property.ImageIndex);
}
}
}
public bool CaptionBar
{
get { return _captionBar; }
set
{
if (_captionBar != value)
{
OnPropertyChanging(Property.CaptionBar);
_captionBar = value;
OnPropertyChanged(Property.CaptionBar);
}
}
}
public bool CloseButton
{
get { return _closeButton; }
set
{
if (_closeButton != value)
{
OnPropertyChanging(Property.CloseButton);
_closeButton = value;
OnPropertyChanged(Property.CloseButton);
}
}
}
public bool HideButton
{
get { return _hideButton; }
set
{
if (_hideButton != value)
{
OnPropertyChanging(Property.HideButton);
_hideButton = value;
OnPropertyChanged(Property.HideButton);
}
}
}
public Size DisplaySize
{
get { return _displaySize; }
set
{
if (_displaySize != value)
{
OnPropertyChanging(Property.DisplaySize);
_displaySize = value;
OnPropertyChanged(Property.DisplaySize);
}
}
}
public Size AutoHideSize
{
get { return _autoHideSize; }
set
{
if (_autoHideSize != value)
{
OnPropertyChanging(Property.AutoHideSize);
_autoHideSize = value;
OnPropertyChanged(Property.AutoHideSize);
}
}
}
public Size FloatingSize
{
get { return _floatingSize; }
set
{
if (_floatingSize != value)
{
OnPropertyChanging(Property.FloatingSize);
_floatingSize = value;
OnPropertyChanged(Property.FloatingSize);
}
}
}
public Point DisplayLocation
{
get { return _displayLocation; }
set
{
if (_displayLocation != value)
{
OnPropertyChanging(Property.DisplayLocation);
_displayLocation = value;
OnPropertyChanged(Property.DisplayLocation);
}
}
}
public int Order
{
get { return _order; }
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -