elementstaticstyle.cs

来自「破解的飞信源代码」· CS 代码 · 共 78 行

CS
78
字号
namespace Imps.Client.Pc
{
    using Imps.Client.Utils;
    using System;
    using System.Drawing;
    using System.Xml;

    public class ElementStaticStyle : EStyleBase
    {
        private Bitmap _image;
        public System.Drawing.Point _location;
        public Size _size;
        private RGB _transParentColor;
        public EAlignment _xAlignment;
        public EAlignment _yAlignment;

        public override void ChangeColor(int hue, double sat, double lum)
        {
            HSLFilter.ChangeImageColor(ref this._image, hue, sat, lum, this.TransParentColor);
            base.ChangeColor(hue, sat, lum);
        }

        public override void Dispose()
        {
            base.Dispose();
            this._image = null;
            this._location = System.Drawing.Point.Empty;
            this._size = Size.Empty;
            this._xAlignment = EAlignment.left;
            this._yAlignment = EAlignment.top;
            this._transParentColor = null;
        }

        protected override void LoadStyle(XmlElement elem)
        {
            base.LoadStyle(elem);
            this._location.X = base.GetIntegerAttribute(elem, "left");
            this._location.Y = base.GetIntegerAttribute(elem, "top");
            this._size.Width = base.GetIntegerAttribute(elem, "width");
            this._size.Height = base.GetIntegerAttribute(elem, "height");
            this._xAlignment = EStyleBase.AlignmentStringToValue(base.GetStringAttribute(elem, "xAlignment"), EAlignment.left);
            this._yAlignment = EStyleBase.AlignmentStringToValue(base.GetStringAttribute(elem, "yAlignment"), EAlignment.top);
            this.Image = base.GetImageAttribute(elem, "image");
            this.TransParentColor = base.GetRGBAttribute(elem, "transColor");
        }

        public Bitmap Image
        {
            get
            {
                return this._image;
            }
            set
            {
                if (this._image != null)
                {
                    this._image.Dispose();
                    this._image = null;
                }
                this._image = value;
            }
        }

        internal RGB TransParentColor
        {
            get
            {
                return this._transParentColor;
            }
            set
            {
                this._transParentColor = value;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?