📄 notifywindowstyle.cs
字号:
namespace Imps.Client.Pc.BizControls.NotifyWindows
{
using Imps.Client.Pc.Theme;
using Imps.Client.Pc.XControlStyle;
using Imps.Client.Utils;
using System;
using System.Drawing;
using System.Xml;
public class NotifyWindowStyle : StyleBase
{
private Bitmap _backgroundImage;
private Bitmap _captionImage;
private int _captionX;
private int _captionY;
private int _clientHeight;
private int _clientWidth;
private int _clientX;
private int _clientY;
private Bitmap _closeImage;
private int _closeX;
private int _closeY;
private Bitmap _iconImage;
private static NotifyWindowStyle _instance;
private Color _transParentColor;
public NotifyWindowStyle()
{
_instance = this;
}
public override void ChangeColor(int hue, double sat, double lum)
{
HSLFilter.ChangeImageColor(ref this._backgroundImage, hue, sat, lum, new RGB(this.TransParentColor));
HSLFilter.ChangeImageColor(ref this._iconImage, hue, sat, lum, new RGB(this.TransParentColor));
HSLFilter.ChangeImageColor(ref this._closeImage, hue, sat, lum, new RGB(this.TransParentColor));
base.ChangeColor(hue, sat, lum);
}
private Bitmap GetImageAttribute(XmlElement elem, string attrName)
{
Bitmap bitmap = null;
if (elem.HasAttribute(attrName))
{
bitmap = new Bitmap(ThemeManager.GetImagePath(elem.GetAttribute(attrName)));
}
return bitmap;
}
private 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 override void LoadStyle(XmlElement elem)
{
this.BackgroundImage = this.GetImageAttribute(elem, "BackgroundImage");
this.IconImage = this.GetImageAttribute(elem, "IconImage");
this.CloseImage = this.GetImageAttribute(elem, "CloseImage");
this.CaptionImage = this.GetImageAttribute(elem, "CaptionImage");
int red = this.GetIntegerAttribute(elem, "TransParentRedValue");
int green = this.GetIntegerAttribute(elem, "TransParentGreenValue");
int blue = this.GetIntegerAttribute(elem, "TransParentBlueValue");
this.TransParentColor = Color.FromArgb(red, green, blue);
this.CloseX = this.GetIntegerAttribute(elem, "CloseX");
this.CloseY = this.GetIntegerAttribute(elem, "CloseY");
this.CaptionX = this.GetIntegerAttribute(elem, "CaptionX");
this.CaptionY = this.GetIntegerAttribute(elem, "CaptionY");
this.ClientX = this.GetIntegerAttribute(elem, "ClientX");
this.ClientY = this.GetIntegerAttribute(elem, "ClientY");
this.ClientWidth = this.GetIntegerAttribute(elem, "ClientWidth");
this.ClientHeight = this.GetIntegerAttribute(elem, "ClientHeight");
base.LoadStyle(elem);
}
internal Bitmap BackgroundImage
{
get
{
return this._backgroundImage;
}
set
{
if (this._backgroundImage != null)
{
this._backgroundImage.Dispose();
}
this._backgroundImage = value;
}
}
internal Bitmap CaptionImage
{
get
{
return this._captionImage;
}
set
{
if (this._captionImage != null)
{
this._captionImage.Dispose();
}
this._captionImage = value;
}
}
public int CaptionX
{
get
{
return this._captionX;
}
set
{
this._captionX = value;
}
}
public int CaptionY
{
get
{
return this._captionY;
}
set
{
this._captionY = value;
}
}
internal int ClientHeight
{
get
{
return this._clientHeight;
}
set
{
this._clientHeight = value;
}
}
internal int ClientWidth
{
get
{
return this._clientWidth;
}
set
{
this._clientWidth = value;
}
}
internal int ClientX
{
get
{
return this._clientX;
}
set
{
this._clientX = value;
}
}
internal int ClientY
{
get
{
return this._clientY;
}
set
{
this._clientY = value;
}
}
internal Bitmap CloseImage
{
get
{
return this._closeImage;
}
set
{
if (this._closeImage != null)
{
this._closeImage.Dispose();
}
this._closeImage = value;
}
}
internal int CloseX
{
get
{
return this._closeX;
}
set
{
this._closeX = value;
}
}
internal int CloseY
{
get
{
return this._closeY;
}
set
{
this._closeY = value;
}
}
internal Bitmap IconImage
{
get
{
return this._iconImage;
}
set
{
if (this._iconImage != null)
{
this._iconImage.Dispose();
}
this._iconImage = value;
}
}
public static NotifyWindowStyle Instance
{
get
{
return _instance;
}
}
internal Color TransParentColor
{
get
{
return this._transParentColor;
}
set
{
this._transParentColor = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -