📄 stylebase.cs
字号:
namespace Imps.Client.Pc.XControlStyle
{
using Imps.Client.Pc.Theme;
using System;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Xml;
public abstract class StyleBase
{
private bool _UseTheme;
public event EventHandler StyleChanged;
protected StyleBase()
{
}
public virtual void ChangeColor(int hue, double sat, double lum)
{
if (this.StyleChanged != null)
{
this.StyleChanged(null, EventArgs.Empty);
}
}
protected Bitmap GetImageAttribute(XmlElement elem, string attrName)
{
Bitmap bitmap = null;
if (elem.HasAttribute(attrName))
{
try
{
bitmap = new Bitmap(ThemeManager.GetImagePath(elem.GetAttribute(attrName)));
}
catch (Exception exception)
{
throw new Exception(exception.Message + ":" + attrName);
}
}
return bitmap;
}
protected int GetIntegerAttribute(XmlElement elem, string attrName)
{
int num = 0;
if (elem.HasAttribute(attrName))
{
int.TryParse(elem.GetAttribute(attrName), ref num);
return num;
}
return 0;
}
protected virtual void LoadStyle(XmlElement elem)
{
}
public void SetDefaultStyle()
{
this.UseTheme = false;
this.SetDefaultValue();
if (this.StyleChanged != null)
{
this.StyleChanged(null, EventArgs.Empty);
}
}
protected virtual void SetDefaultValue()
{
}
public void SetStyle(XmlElement elem)
{
this.LoadStyle(elem);
this.UseTheme = true;
if (this.StyleChanged != null)
{
this.StyleChanged(null, EventArgs.Empty);
}
}
public bool UseTheme
{
get
{
return this._UseTheme;
}
set
{
this._UseTheme = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -