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

📄 contact_tip_widget.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
                }
            }
        }

        protected void paint_title_bar(Graphics g, Rectangle canvas)
        {
            Rectangle rect = Rectangle.FromLTRB(canvas.Left + 1, canvas.Top + 1, canvas.Right, canvas.Top + this.m_titlebar_height);
            Image contactTipTitle = MiscStyle.Instance.ContactTipTitle;
            if (contactTipTitle != null)
            {
                using (Brush brush = new TextureBrush(contactTipTitle, WrapMode.Tile, new Rectangle(0, 0, 1, contactTipTitle.Height)))
                {
                    g.FillRectangle(brush, rect);
                }
                Rectangle rectangle2 = new Rectangle(rect.Right - contactTipTitle.Width, rect.Top, contactTipTitle.Width, contactTipTitle.Height);
                g.DrawImage(contactTipTitle, rectangle2);
            }
            else
            {
                using (LinearGradientBrush brush2 = new LinearGradientBrush(rect, this.m_titlebar_top_color, this.BackColor, LinearGradientMode.Vertical))
                {
                    g.FillRectangle(brush2, rect);
                }
            }
            this.paint_title_line(g, canvas);
        }

        protected void paint_title_line(Graphics g, Rectangle canvas)
        {
            if (this.m_status_img != null)
            {
                g.DrawImage(this.m_status_img.Image, this.m_status_img_bounds);
            }
            using (StringFormat fmt = new StringFormat())
            {
                fmt.Alignment = StringAlignment.Near;
                fmt.LineAlignment = StringAlignment.Center;
                fmt.FormatFlags |= StringFormatFlags.NoWrap;
                fmt.Trimming = StringTrimming.EllipsisCharacter;
                int left = (this.m_status_img == null) ? this.m_status_img_bounds.Left : (this.m_status_img_bounds.Right + this.m_inner_space.Width);
                left += canvas.Left - base.ClientRectangle.Left;
                int top = canvas.Top + 1;
                int right = (canvas.Right - this.m_rightbottom_margin.Width) - (!this.m_close_button.Visible ? 0 : this.m_close_button.Width);
                Rectangle rc = Rectangle.FromLTRB(left, top, right, canvas.Top + this.m_titlebar_height);
                this.m_name.Draw(g, this.Font, Color.White, rc, fmt, ref left);
            }
        }

        private void PostInitializeComponent()
        {
            this.m_close_button.state_image = ImpsResources.GetImage("Images.card_close.png");
            this.m_crbttome_page.is_to_buddy = false;
            this.m_crbttome_page.owner = this;
            this.m_pages.Add(this.m_crbttome_page);
            this.m_tooltip = new ToolTip();
            this.m_tooltip.ShowAlways = true;
            this.m_link_buy.Enabled = true;
        }

        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, Keys keyData)
        {
            bool flag = base.ProcessCmdKey(ref msg, keyData);
            if (Keys.Escape == keyData)
            {
                base.Hide();
            }
            return flag;
        }

        public void show(Control owner, tree_widget_buddy item)
        {
            try
            {
                this.update(owner, item);
                win32api_wrapper.ShowWindow(base.Handle, 4);
            }
            catch
            {
            }
        }

        private void show_buttons(bool show, params Control[] buttons)
        {
            foreach (Control control in buttons)
            {
                control.Visible = show;
            }
        }

        public void show_crbt(Imps.Client.Core.Contact contact, Rectangle contact_rect, bool crbttome)
        {
            if (contact == null)
            {
                throw new ArgumentNullException("contact or contact_rect");
            }
            try
            {
                this.update_contact(contact);
                this.update_bounds(contact_rect);
                this.selected_page = this.m_crbttome_page;
                if (base.Visible)
                {
                    this.do_paint();
                }
                else
                {
                    win32api_wrapper.ShowWindow(base.Handle, 4);
                }
                this.m_player.Ctlcontrols.play();
            }
            catch
            {
            }
        }

        public void show_user(Control owner, Rectangle rect)
        {
            try
            {
                this.update_contact(null);
                rect = owner.RectangleToScreen(rect);
                this.update_bounds(rect);
                this.do_paint();
                win32api_wrapper.ShowWindow(base.Handle, 4);
            }
            catch
            {
            }
        }

        private void start_chat()
        {
            try
            {
                if (this.m_contact != null)
                {
                    base.Hide();
                    this.iframe.ConversationManager.StartConversation(this.iframe.MainWindow, ConversationOperation.ImChat, new string[] { this.m_contact.Uri.Raw });
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteGeneral("ContactTip", exception.ToString(), 20);
            }
        }

        public void update(Control owner, tree_widget_buddy item)
        {
            if (item != null)
            {
                Rectangle r = item.bounds;
                if (owner != null)
                {
                    r = owner.ClientRectangle;
                    r = Rectangle.FromLTRB(r.Left, item.bounds.Top, r.Right, item.bounds.Bottom);
                    r = owner.RectangleToScreen(r);
                }
                this.update_contact(item.contact);
                this.update_bounds(r);
                this.do_paint();
            }
        }

        private void update_bounds(Rectangle contact_rect)
        {
            Size sz;
            this.m_contact_rect = contact_rect;
            using (Graphics graphics = Graphics.FromHwnd(base.Handle))
            {
                using (Bitmap image = new Bitmap(1, 1))
                {
                    using (Graphics g = Graphics.FromImage(image))
                    {
                        this.calc_bounds_size(g, out sz);
                    }
                }
            }
            try
            {
                if (this.m_player != null)
                {
                    if (this.m_player.IsHandleCreated && !this.m_player.IsDisposed)
                    {
                        if (this.m_crbttome_page.IsValid())
                        {
                            sz.Height += this.m_crbttome_page.size.Height;
                            this.m_player.Visible = true;
                            this.m_player.Location = new System.Drawing.Point(base.ClientRectangle.Left + 1, sz.Height);
                            this.m_player.Size = new Size(base.ClientRectangle.Width - 2, 0x2d);
                            sz.Height += 0x2e;
                            if (this.m_crbttome_page.show_detail)
                            {
                                this.m_link_buy.Location = new System.Drawing.Point((base.ClientRectangle.Right - this.m_rightbottom_margin.Width) - this.m_link_buy.Width, ((sz.Height - 0x2e) - (this.m_crbttome_page.size.Height / 2)) + (((this.m_crbttome_page.size.Height / 2) - this.m_link_buy.Height) / 2));
                                this.show_buttons(true, new Control[] { this.m_link_buy });
                            }
                        }
                        else
                        {
                            this.m_player.Visible = false;
                            this.show_buttons(false, new Control[] { this.m_link_buy });
                        }
                    }
                }
                else if (this.m_crbttome_page.IsValid())
                {
                    sz.Height += this.m_crbttome_page.size.Height;
                    this.m_link_buy.Location = new System.Drawing.Point((base.ClientRectangle.Right - this.m_rightbottom_margin.Width) - this.m_link_buy.Width, (base.ClientRectangle.Bottom - (this.m_crbttome_page.size.Height / 2)) + (((this.m_crbttome_page.size.Height / 2) - this.m_link_buy.Height) / 2));
                    this.show_buttons(true, new Control[] { this.m_link_buy });
                }
                else
                {
                    this.show_buttons(false, new Control[] { this.m_link_buy });
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteGeneral("ContactTip", exception.ToString(), 10);
            }
            Screen primaryScreen = null;
            int num = 0;
            foreach (Screen screen2 in Screen.AllScreens)
            {
                Rectangle rectangle = Rectangle.Intersect(screen2.WorkingArea, contact_rect);
                if (num < (rectangle.Width * rectangle.Height))
                {
                    num = rectangle.Width * rectangle.Height;
                    primaryScreen = screen2;
                }
            }
            if (primaryScreen == null)
            {
                primaryScreen = Screen.PrimaryScreen;
            }
            int x = ((primaryScreen.WorkingArea.Left + sz.Width) > contact_rect.Left) ? contact_rect.Right : (contact_rect.Left - sz.Width);
            if ((x + sz.Width) > primaryScreen.WorkingArea.Right)
            {
                x = primaryScreen.WorkingArea.Right - sz.Width;
            }
            int y = ((primaryScreen.WorkingArea.Bottom - sz.Height) < contact_rect.Top) ? (primaryScreen.WorkingArea.Bottom - sz.Height) : contact_rect.Top;
            if (base.Visible)
            {
                win32api_wrapper.SetWindowPos(base.Handle, IntPtr.Zero, x, y, sz.Width, sz.Height, 0x10);
            }
            else
            {
                win32api_wrapper.SetWindowPos(base.Handle, IntPtr.Zero, x, y, sz.Width, sz.Height, 20);
            }
            if (this.m_crbttome_page.IsValid())
            {
                this.m_crbttome_page.show_detail = this.m_personal_msg_lines <= 3;
                try
                {
                    if (this.m_player != null)
                    {
                        if (this.m_player.IsHandleCreated && !this.m_player.IsDisposed)
                        {
                            this.m_link_buy.Location = new System.Drawing.Point((base.ClientRectangle.Right - this.m_rightbottom_margin.Width) - this.m_link_buy.Width, ((base.ClientRectangle.Bottom - 0x2e) - (this.m_crbttome_page.size.Height / 2)) + (((this.m_crbttome_page.size.Height / 2) - this.m_link_buy.Height) / 2));
                        }
                        else
                        {
                            this.m_link_buy.Location = new System.Drawing.Point((base.ClientRectangle.Right - this.m_rightbottom_margin.Width) - this.m_link_buy.Width, (base.ClientRectangle.Bottom - (this.m_crbttome_page.size.Height / 2)) + (((this.m_crbttome_page.size.Height / 2) - this.m_link_buy.Height) / 2));
                        }
                    }
                    else
                    {
                        this.m_link_buy.Location = new System.Drawing.Point((base.ClientRectangle.Right - this.m_rightbottom_margin.Width) - this.m_link_buy.Width, (base.ClientRectangle.Bottom - (this.m_crbttome_page.size.Height / 2)) + (((this.m_crbttome_page.size.Height / 2) - this.m_link_buy.Height) / 2));
                    }
                    this.m_link_buy.Visible = this.m_crbttome_page.show_detail && this.m_crbttome_page.IsValid();
                }
                catch (Exception exception2)
                {
                    ClientLogger.WriteGeneral("ContactTip", exception2.ToString(), 20);
                }
            }
        }

        private void update_buttons_state()
        {
        }

        private void update_contact(Imps.Client.Core.Contact contact)
        {
            this.contact = contact;
            this.update_texts();
            this.update_buttons_state();
            this.update_crbts();
            List<contact_tip_page>

⌨️ 快捷键说明

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