⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 displaypreviewemotion.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Pc.BizControls
{
    using Imps.Client.Resource;
    using Imps.Client.Utils;
    using Imps.Utils;
    using System;
    using System.Drawing;
    using System.Windows.Forms;

    internal class DisplayPreviewEmotion : UserControl
    {
        private AmigoImage _animate;
        private Emoticon _emotion;
        private Timer _timer = new Timer();

        public DisplayPreviewEmotion()
        {
            this._timer.Tick += new EventHandler(this._timer_Tick);
            this.set_DoubleBuffered(true);
        }

        private void _timer_Tick(object sender, EventArgs e)
        {
            try
            {
                if (this._animate != null)
                {
                    this._animate.NextFrame(this._timer.Interval);
                    base.Invalidate();
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        public void BeginAnimate()
        {
            this._timer.Start();
        }

        public void EndAnimate()
        {
            this._timer.Stop();
        }

        private void HandleException(Exception ex)
        {
            ClientLogger.WriteException(ex);
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            try
            {
                using (Pen pen = new Pen(Color.FromArgb(0xde, 0xde, 0xde)))
                {
                    e.Graphics.DrawRectangle(pen, 0, 0, base.Width - 1, base.Height - 1);
                }
                if ((this._animate != null) && (this._animate.Image != null))
                {
                    int width = this._animate.Image.Width;
                    int height = this._animate.Image.Height;
                    if ((width >= (base.Width - 2)) || (height >= (base.Height - 2)))
                    {
                        if (width > height)
                        {
                            float num3 = ((float) height) / ((float) width);
                            width = base.Width - 2;
                            height = (int) (num3 * width);
                        }
                        else if (width <= height)
                        {
                            float num4 = ((float) width) / ((float) height);
                            height = base.Height - 2;
                            width = (int) (num4 * height);
                        }
                    }
                    e.Graphics.DrawImage(this._animate.CurrentImage, (base.Width - width) / 2, (base.Height - height) / 2, width, height);
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }

        public void Reset()
        {
            AmigoImage image1 = this._animate;
        }

        public Emoticon Emotion
        {
            get
            {
                return this._emotion;
            }
            set
            {
                try
                {
                    this._emotion = value;
                    if (this._emotion != null)
                    {
                        this._animate = new AmigoImage(this._emotion.AmigoImage.Image, this._emotion.AmigoImage.IsSpeedFirst);
                    }
                    else
                    {
                        this._animate = null;
                    }
                }
                catch (Exception exception)
                {
                    this.HandleException(exception);
                }
            }
        }
    }
}

⌨️ 快捷键说明

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