📄 xformstyle.cs
字号:
namespace Imps.Client.Pc.XControlStyle
{
using Imps.Client.Pc;
using Imps.Client.Pc.Theme;
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
public class XFormStyle : StyleBase
{
private Color _BackColor;
private Image _BorderBottom;
private Image _BorderLeft;
private Image _BorderRight;
private short _BorderWidth;
private short _CaptionHeight;
private ImageList _CloseBox;
private Color _ContentBorderColor;
private Color _ContentColor;
private Color _ForeColor;
private Image _LeftCorner;
private Image _mainLogo;
private ImageList _MaxBox;
private ImageList _MinBox;
private ImageList _RestoreBox;
private Image _RightCorner;
private System.Drawing.Point _SysButtonPos;
private Size _SysButtonSize;
private Image _TitleCenter;
private Image _TitleLeft;
private Image _TitleRight;
protected override void LoadStyle(XmlElement elem)
{
if (elem.HasAttribute("BorderWidth"))
{
try
{
this.BorderWidth = short.Parse(elem.GetAttribute("BorderWidth"));
}
catch (FormatException exception)
{
ErrorLog.WriteLog(exception.Message);
}
}
if (elem.HasAttribute("CaptionHeight"))
{
try
{
this.CaptionHeight = short.Parse(elem.GetAttribute("CaptionHeight"));
}
catch (FormatException exception2)
{
ErrorLog.WriteLog(exception2.Message);
}
}
if (elem.HasAttribute("ForeColor"))
{
this.ForeColor = ThemeManager.GetColor(elem.GetAttribute("ForeColor"));
}
if (elem.HasAttribute("BackColor"))
{
this.BackColor = ThemeManager.GetColor(elem.GetAttribute("BackColor"));
}
if (elem.HasAttribute("ContentColor"))
{
this.ContentColor = ThemeManager.GetColor(elem.GetAttribute("ContentColor"));
}
if (elem.HasAttribute("ContentBorderColor"))
{
this.ContentBorderColor = ThemeManager.GetColor(elem.GetAttribute("ContentBorderColor"));
}
if (elem.HasAttribute("BorderLeft"))
{
this.BorderLeft = ThemeManager.GetImage(elem.GetAttribute("BorderLeft"));
}
if (elem.HasAttribute("BorderRight"))
{
this.BorderRight = ThemeManager.GetImage(elem.GetAttribute("BorderRight"));
}
if (elem.HasAttribute("BorderBottom"))
{
this.BorderBottom = ThemeManager.GetImage(elem.GetAttribute("BorderBottom"));
}
if (elem.HasAttribute("TitleLeft"))
{
this.TitleLeft = ThemeManager.GetImage(elem.GetAttribute("TitleLeft"));
}
if (elem.HasAttribute("TitleRight"))
{
this.TitleRight = ThemeManager.GetImage(elem.GetAttribute("TitleRight"));
}
if (elem.HasAttribute("TitleCenter"))
{
this.TitleCenter = ThemeManager.GetImage(elem.GetAttribute("TitleCenter"));
}
if (elem.HasAttribute("LeftCorner"))
{
this.LeftCorner = ThemeManager.GetImage(elem.GetAttribute("LeftCorner"));
}
if (elem.HasAttribute("RightCorner"))
{
this.RightCorner = ThemeManager.GetImage(elem.GetAttribute("RightCorner"));
}
if (elem.HasAttribute("MinBox"))
{
this.MinBox = ThemeManager.GetImageList(elem.GetAttribute("MinBox"), 3, 1);
}
if (elem.HasAttribute("MaxBox"))
{
this.MaxBox = ThemeManager.GetImageList(elem.GetAttribute("MaxBox"), 3, 1);
}
if (elem.HasAttribute("RestoreBox"))
{
this.RestoreBox = ThemeManager.GetImageList(elem.GetAttribute("RestoreBox"), 3, 1);
}
if (elem.HasAttribute("CloseBox"))
{
this.CloseBox = ThemeManager.GetImageList(elem.GetAttribute("CloseBox"), 3, 1);
}
if (elem.HasAttribute("SysButtonPos"))
{
try
{
string[] textArray = elem.GetAttribute("SysButtonPos").Split(new char[] { ',' });
this.SysButtonPos = new System.Drawing.Point(int.Parse(textArray[0]), int.Parse(textArray[1]));
}
catch (Exception exception3)
{
ErrorLog.WriteLog(exception3.Message);
}
}
if (elem.HasAttribute("SysButtonSize"))
{
try
{
string[] textArray2 = elem.GetAttribute("SysButtonSize").Split(new char[] { ',' });
this.SysButtonSize = new Size(int.Parse(textArray2[0]), int.Parse(textArray2[1]));
}
catch (Exception exception4)
{
ErrorLog.WriteLog(exception4.Message);
}
}
if (elem.HasAttribute("MainLogo"))
{
this.MainLogo = ThemeManager.GetImage(elem.GetAttribute("MainLogo"));
}
}
protected override void SetDefaultValue()
{
this._BorderWidth = (short) SystemInformation.Border3DSize.Width;
this._CaptionHeight = (short) (SystemInformation.CaptionHeight + (this._BorderWidth * 2));
this._ForeColor = SystemColors.ActiveCaptionText;
this._BackColor = SystemColors.Control;
this._ContentColor = Color.WhiteSmoke;
this._ContentBorderColor = Color.DarkGray;
this._SysButtonPos = new System.Drawing.Point(5, 5);
this._SysButtonSize = SystemInformation.CaptionButtonSize;
this._TitleCenter = null;
this._TitleLeft = null;
this._TitleRight = null;
this._BorderLeft = null;
this._BorderRight = null;
this._BorderBottom = null;
this._LeftCorner = null;
this._RightCorner = null;
this._MinBox = null;
this._MaxBox = null;
this._CloseBox = null;
this._RestoreBox = null;
this._mainLogo = null;
}
public Color BackColor
{
get
{
return this._BackColor;
}
set
{
this._BackColor = value;
}
}
public Image BorderBottom
{
get
{
return this._BorderBottom;
}
set
{
this._BorderBottom = value;
}
}
public Image BorderLeft
{
get
{
return this._BorderLeft;
}
set
{
this._BorderLeft = value;
}
}
public Image BorderRight
{
get
{
return this._BorderRight;
}
set
{
this._BorderRight = value;
}
}
public short BorderWidth
{
get
{
return this._BorderWidth;
}
set
{
if (value < 0)
{
this._BorderWidth = 0;
}
else if (value > 10)
{
this._BorderWidth = 10;
}
else
{
this._BorderWidth = value;
}
}
}
public short CaptionHeight
{
get
{
return this._CaptionHeight;
}
set
{
if (value < 20)
{
this._CaptionHeight = 20;
}
else if (value > 100)
{
this._CaptionHeight = 100;
}
else
{
this._CaptionHeight = value;
}
}
}
public ImageList CloseBox
{
get
{
return this._CloseBox;
}
set
{
this._CloseBox = value;
}
}
public Color ContentBorderColor
{
get
{
return this._ContentBorderColor;
}
set
{
this._ContentBorderColor = value;
}
}
public Color ContentColor
{
get
{
return this._ContentColor;
}
set
{
this._ContentColor = value;
}
}
public Color ForeColor
{
get
{
return this._ForeColor;
}
set
{
this._ForeColor = value;
}
}
public Image LeftCorner
{
get
{
return this._LeftCorner;
}
set
{
this._LeftCorner = value;
}
}
public Image MainLogo
{
get
{
return this._mainLogo;
}
set
{
this._mainLogo = value;
}
}
public ImageList MaxBox
{
get
{
return this._MaxBox;
}
set
{
this._MaxBox = value;
}
}
public ImageList MinBox
{
get
{
return this._MinBox;
}
set
{
this._MinBox = value;
}
}
public ImageList RestoreBox
{
get
{
return this._RestoreBox;
}
set
{
this._RestoreBox = value;
}
}
public Image RightCorner
{
get
{
return this._RightCorner;
}
set
{
this._RightCorner = value;
}
}
public System.Drawing.Point SysButtonPos
{
get
{
return this._SysButtonPos;
}
set
{
this._SysButtonPos = value;
}
}
public Size SysButtonSize
{
get
{
return this._SysButtonSize;
}
set
{
this._SysButtonSize = value;
}
}
public Image TitleCenter
{
get
{
return this._TitleCenter;
}
set
{
this._TitleCenter = value;
}
}
public Image TitleLeft
{
get
{
return this._TitleLeft;
}
set
{
this._TitleLeft = value;
}
}
public Image TitleRight
{
get
{
return this._TitleRight;
}
set
{
this._TitleRight = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -