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

📄 displayemoticons.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
                                this.toolTip.SetToolTip(this, region.Emoticon.Description);
                                this.toolTip.set_Tag(num);
                            }
                            else if (!flag2)
                            {
                                this.toolTip.Active = false;
                                this.toolTip.set_Tag(-1);
                            }
                        }
                        if (region.Emoticon != null)
                        {
                            if (region != this.currentEmoticonRS)
                            {
                                region.IsSelected = true;
                                base.Invalidate(region.RectEmoticon);
                                if (this.currentEmoticonRS != null)
                                {
                                    this.currentEmoticonRS.IsSelected = false;
                                    base.Invalidate(this.currentEmoticonRS.RectEmoticon);
                                }
                                this.lastEmoticonRS = this.currentEmoticonRS;
                                this.currentEmoticonRS = region;
                                base.Invalidate();
                            }
                            else
                            {
                                this.lastEmoticonRS = this.currentEmoticonRS;
                            }
                        }
                        else
                        {
                            flag = false;
                        }
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            if (!flag)
            {
                if (!flag2)
                {
                    this.toolTip.Active = false;
                    this.toolTip.set_Tag(-1);
                }
                if (this.currentEmoticonRS != null)
                {
                    this.currentEmoticonRS.IsSelected = false;
                    this.currentEmoticonRS = null;
                    base.Invalidate();
                }
            }
            if ((this.currentEmoticonRS != null) && !string.IsNullOrEmpty(this.currentEmoticonRS.ID))
            {
                int x = this.paddingLeft;
                int y = this.paddingTop + 3;
                x = (e.X < (base.Width / 2)) ? (((base.Width - this.paddingRight) - this._preview_emotion.Width) - 2) : (this.paddingLeft + 3);
                this._preview_emotion.Location = new System.Drawing.Point(x, y);
                if ((this.lastEmoticonRS == null) || (this.lastEmoticonRS.ID != this.currentEmoticonRS.ID))
                {
                    this._preview_emotion.Emotion = this.currentEmoticonRS.Emoticon;
                    this._preview_emotion.Invalidate();
                }
                if (!this._preview_emotion.Visible && !GlobalTimer.IsHandlerRegistered(new EventHandler(this._preview_timer_Tick)))
                {
                    GlobalTimer.Register(new EventHandler(this._preview_timer_Tick), 3);
                }
                else if (this._preview_emotion.Visible && GlobalTimer.IsHandlerRegistered(new EventHandler(this._preview_timer_Tick)))
                {
                    GlobalTimer.Unregister(new EventHandler(this._preview_timer_Tick));
                }
            }
            else
            {
                this._preview_emotion.Visible = false;
                this._preview_emotion.EndAnimate();
                if (GlobalTimer.IsHandlerRegistered(new EventHandler(this._preview_timer_Tick)))
                {
                    GlobalTimer.Unregister(new EventHandler(this._preview_timer_Tick));
                }
            }
        }

        private void DisplayEmoticons_Paint(object sender, PaintEventArgs e)
        {
            this.rects.Clear();
            this.rectsHightlightOutside.Clear();
            this.rectsHightlightInside.Clear();
            using (Pen pen2 = (this.pen = new Pen(this.LineColor, 1f)))
            {
                Graphics g = e.Graphics;
                Rectangle r = e.ClipRectangle;
                this.DrawEmoticons(g, r);
                if (this.rects.get_Count() > 0)
                {
                    g.DrawRectangles(this.pen, this.rects.ToArray());
                }
                if (this.rectsHightlightOutside.get_Count() > 0)
                {
                    this.pen.Color = this.BorderHightlightOutsideColor;
                    g.DrawRectangles(this.pen, this.rectsHightlightOutside.ToArray());
                }
                if (this.rectsHightlightInside.get_Count() > 0)
                {
                    this.pen.Color = this.BorderHightlightInsideColor;
                    g.DrawRectangles(this.pen, this.rectsHightlightInside.ToArray());
                }
                if ((r.Width == base.Width) && (r.Height == base.Height))
                {
                    this.DrawBorder(g);
                }
                this.DrawCustomOperation(g);
            }
        }

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (this.toolTip != null)
            {
                this.toolTip.Dispose();
            }
            if (this.timer != null)
            {
                this.timer.Dispose();
            }
            this.ClearCurPageCustomEmoticon();
        }

        private void DrawBorder(Graphics g)
        {
            this.pen.Color = this.lineColor;
            g.DrawRectangle(this.pen, this.rectBorder);
            SizeF ef = g.MeasureString("自定义表情", this.Font);
            int y = ((((int) (ef.Height / 2f)) + 3) + this.paddingTop) + (this.RowCount * this.EmoticonSize.Height);
            int num2 = ((int) ef.Width) + 1;
            this.pointSeperatorLine1 = new System.Drawing.Point(this.seperatorPadding + num2, y);
            this.pointSeperatorLine2 = new System.Drawing.Point(base.Width - this.seperatorPadding, y);
            g.DrawLine(this.pen, this.pointSeperatorLine1, this.pointSeperatorLine2);
            this.pen.Color = this.ForeColor;
            using (Brush brush = this.pen.Brush)
            {
                g.DrawString(base.Name, this.Font, brush, (float) 10f, (float) 8f);
                g.DrawString("自定义表情", this.Font, brush, 10f, (float) ((this.paddingTop + (this.RowCount * this.EmoticonSize.Height)) + this.seperatorHeight));
            }
        }

        private void DrawCustomOperation(Graphics g)
        {
            int x = 10;
            if (this.emoticonMgrOperation.RectOperation.Width > base.Width)
            {
                SizeF ef = g.MeasureString(this.emoticonMgrOperation.Text, this.fontCustomOperation);
                this.emoticonMgrOperation.RectOperation = new Rectangle(x, this.emoticonMgrOperation.RectOperation.Top, ((int) ef.Width) + 1, ((int) ef.Height) + 1);
            }
            if (this.emoticonMgrPageShow.RectOperation.Width > base.Width)
            {
                SizeF ef2 = g.MeasureString(this.emoticonMgrPageShow.Text, this.fontCustomOperation);
                x = (base.Width / 2) - ((int) (ef2.Width / 2f));
                this.emoticonMgrPageShow.RectOperation = new Rectangle(x, this.emoticonMgrPageShow.RectOperation.Top, ((int) ef2.Width) + 1, ((int) ef2.Height) + 1);
            }
            if (this.emoticonMgrPagePrev.RectOperation.Width > base.Width)
            {
                SizeF ef3 = g.MeasureString(this.emoticonMgrPagePrev.Text, this.fontCustomOperation);
                x = (base.Width - this.paddingRight) - ((int) ef3.Width);
                this.emoticonMgrPagePrev.RectOperation = new Rectangle(x, this.emoticonMgrPagePrev.RectOperation.Top, ((int) ef3.Width) + 1, ((int) ef3.Height) + 1);
            }
            if (this.emoticonMgrPageBack.RectOperation.Width > base.Width)
            {
                SizeF ef4 = g.MeasureString(this.emoticonMgrPageBack.Text, this.fontCustomOperation);
                x = (x - this.paddingRight) - ((int) ef4.Width);
                this.emoticonMgrPageBack.RectOperation = new Rectangle(x, this.emoticonMgrPageBack.RectOperation.Top, ((int) ef4.Width) + 1, ((int) ef4.Height) + 1);
            }
            this.pen.Color = this.fontCustomOperationColor;
            if (this.emoticonMgrOperation.IsSelected && this.emoticonMgrOperation.IsCanClick)
            {
                this.pen.Color = this.fontCustomOperationHoverColor;
            }
            using (Brush brush = this.pen.Brush)
            {
                if (this.emoticonMgrOperation.IsSelected && this.emoticonMgrOperation.IsCanClick)
                {
                    g.DrawString(this.emoticonMgrOperation.Text, this.fontCustomOperationHover, brush, (float) (this.emoticonMgrOperation.RectOperation.Left + 1), (float) (this.emoticonMgrOperation.RectOperation.Top + 1));
                }
                else
                {
                    g.DrawString(this.emoticonMgrOperation.Text, this.fontCustomOperation, brush, (float) this.emoticonMgrOperation.RectOperation.Left, (float) this.emoticonMgrOperation.RectOperation.Top);
                }
            }
            this.pen.Color = this.fontCustomOperationColor;
            if (this.emoticonMgrPageShow.IsSelected && this.emoticonMgrPageShow.IsCanClick)
            {
                this.pen.Color = this.fontCustomOperationHoverColor;
            }
            using (Brush brush2 = this.pen.Brush)
            {
                if (this.emoticonMgrPageShow.IsSelected && this.emoticonMgrPageShow.IsCanClick)
                {
                    g.DrawString(this.emoticonMgrPageShow.Text, this.fontCustomOperationHover, brush2, (float) this.emoticonMgrPageShow.RectOperation.Left, (float) this.emoticonMgrPageShow.RectOperation.Top);
                }
                else
                {
                    g.DrawString(this.emoticonMgrPageShow.Text, this.fontCustomOperation, brush2, (float) this.emoticonMgrPageShow.RectOperation.Left, (float) this.emoticonMgrPageShow.RectOperation.Top);
                }
            }
            this.pen.Color = this.fontCustomOperationColor;
            if (this.emoticonMgrPagePrev.IsSelected && this.emoticonMgrPagePrev.IsCanClick)
            {
                this.pen.Color = this.fontCustomOperationHoverColor;
            }
            using (Brush brush3 = this.pen.Brush)
            {
                if (this.emoticonMgrPagePrev.IsSelected && this.emoticonMgrPagePrev.IsCanClick)
                {
                    g.DrawString(this.emoticonMgrPagePrev.Text, this.fontCustomOperationHover, brush3, (float) (this.emoticonMgrPagePrev.RectOperation.Left + 1), (float) (this.emoticonMgrPagePrev.RectOperation.Top + 1));
                }
                else
                {
                    g.DrawString(this.emoticonMgrPagePrev.Text, this.fontCustomOperation, brush3, (float) this.emoticonMgrPagePrev.RectOperation.Left, (float) this.emoticonMgrPagePrev.RectOperation.Top);
                }
            }
            this.pen.Color = this.fontCustomOperationColor;
            if (this.emoticonMgrPageBack.IsSelected && this.emoticonMgrPageBack.IsCanClick)
            {
                this.pen.Color = this.fontCustomOperationHoverColor;
            }
            using (Brush brush4 = this.pen.Brush)
            {
                if (this.emoticonMgrPageBack.IsSelected && this.emoticonMgrPageBack.IsCanClick)
                {
                    g.DrawString(this.emoticonMgrPageBack.Text, this.fontCustomOperationHover, brush4, (float) (this.emoticonMgrPageBack.RectOperation.Left + 1), (float) (this.emoticonMgrPageBack.RectOperation.Top + 1));
                }
                else
                {
                    g.DrawString(this.emoticonMgrPageBack.Text, this.fontCustomOperation, brush4, (float) this.emoticonMgrPageBack.RectOperation.Left, (float) this.emoticonMgrPageBack.RectOperation.Top);
                }
            }
        }

        private void DrawEmoticon(Graphics g, EmoticonRegion er)
        {
            if (er != null)
            {
                this.rects.Add(er.RectEmoticonInside);
                if ((er.Emoticon != null) && (er.Emoticon.StaticImage != null))
                {
                    g.DrawImage(er.Emoticon.StaticImage, er.RectEmoticonImage);
                }
                if (er.IsSelected)
                {
                    this.rectsHightlightOutside.Add(er.RectEmoticonOutside);
                    this.rectsHightlightInside.Add(er.RectEmoticonMiddle);
                }
            }
        }

        private void DrawEmoticons(Graphics g, Rectangle r)
        {
            List<EmoticonRegion>.Enumerator enumerator = this.emoticonRegions.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    EmoticonRegion er = enumerator.get_Current();
                    if (er.RectEmoticonImage.IntersectsWith(r))
                    {
                        this.DrawEmoticon(g, er);
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
        }

        protected override void HandleBossKey()
        {
            if (BossKey.Hidden)
            {
                this._oldVisible = base.Visible;
                base.Visible = false;
            }
            else
            {
                base.Visible = this._oldVisible;
            }
        }

        public void Hide()
        {
            base.Hide();
            this.timer.Enabled = false;
            this.OnDisplayEmoticonsHide(new EventArgs());
            this._preview_emotion.Visible = false;
            this._preview_emotion.EndAnimate();
        }

        protected void InitComponent()
        {
            base.components = new Container();
            this.FontHover = new Font(this.Font, FontStyle.Underline);
            this.fontCustomOperationHover = new Font("Arial", 9f, FontStyle.Underline);
            this.fontCustomOperation = new Font("Arial", 9f, FontStyle.Regular);
            base.Name = "我的表情";
            this.ForeColor = this.fontColor;
            this.timer = new Timer(base.components);
            this.timer.Tick += new EventHandler(this.timer_Tick);
            base.Paint += new PaintEventHandler(this.DisplayEmoticons_Paint);
            base.MouseMove += new MouseEventHandler(this.DisplayEmoticons_MouseMove);
            base.add_MouseClick(new MouseEventHandler(this.DisplayEmoticons_MouseClick));
            base.MouseDown += new MouseEventHandler(this.DisplayEmoticons_MouseDown);
            base.MouseLeave += new EventHandler(this.DisplayEmoticons_MouseLeave);
            base.Deactivate += new EventHandler(this.DisplayEmoticons_Deactivate);
            base.add_FormClosed(new FormClosedEventHandler(this, (IntPtr) this.DisplayEmoticons_FormClosed));
            base.Activated += new EventHandler(this.DisplayEmoticons_Activated);
            Rectangle rect = Rectangle.Empty;
            this.emoticonMgrOperation = new CustomOperation(1, rect, false, true, "+表情管理");
            this.emoticonMgrPageShow = new CustomOperation(2, rect, false, false, "1/1");
            this.emoticonMgrPageBack = new CustomOperation(3, rect, false, false, "上一页");
            this.emoticonMgrPagePrev = new CustomOperation(4, rect, false, false, "下一页");
            this.toolTip = new ToolTip(base.components);
            this.toolTip.set_Tag(-1);
            this._preview_emotion = new DisplayPreviewEmotion();
            base.SuspendLayout();
            this._preview_emotion.Location = new System.Drawing.Point(this.paddingLeft, this.paddingTop);
            this._preview_emotion.Size = new Size(0x39, 0x39);
            this._preview_emotion.Visible = false;
            base.Controls.Add(this._preview_emotion);
            base.ResumeLayout(false);
        }

        private void InitRegions()
        {
            this.rectBorder = new Rectangle(0, 0, base.Width - 1, base.Height - 1);
            this.emoticonRegions = new List<EmoticonRegion>();
            System.Drawing.Point startPoint = new System.Drawing.Point(this.paddingLeft, this.paddingTop);
            string key = "";
            for (int i = 0; i < this.rowCount; i++)
            {
                startPoint.Y = this.paddingTop + (i * this.EmoticonSize.Height);
                for (int j = 0; j < this.ColCount; j++)
                {
                    startPoint.X = this.paddingLeft + (j * this.EmoticonSize.Width);
                    int num3 = (i * this.ColCount) + j;
                    Emoticon emoticon = null;
                    key = "";
                    if (num3 < this.emoticons.get_Count())
                    {
                        emoticon = this.emoticons.get_Item(num3);
                        key = emoticon.Key;

⌨️ 快捷键说明

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