📄 contact_tip_widget.cs
字号:
namespace Imps.Client.Pc.BizControls
{
using AxWMPLib;
using Imps.Client;
using Imps.Client.Base;
using Imps.Client.Core;
using Imps.Client.Pc;
using Imps.Client.Pc.WndlessControls;
using Imps.Client.Resource;
using Imps.Client.Utils;
using Imps.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using WMPLib;
public class contact_tip_widget : Form
{
private WndlessScorePictureBox _score_level_control;
private WndlessControlCollection _wndlessControls;
private IContainer components;
protected Color m_border_color = Color.FromArgb(0xad, 180, 0xbc);
private imagebutton_widget m_close_button;
protected Imps.Client.Core.Contact m_contact;
private Rectangle m_contact_rect = Rectangle.Empty;
private contact_tip_crbt_page m_crbttome_page = new contact_tip_crbt_page();
protected Size m_emotion_size = new Size(0x10, 0x10);
protected Color m_headicon_border_color = Color.FromArgb(0xe4, 0xe4, 0xe4);
protected Rectangle m_headicon_bounds = Rectangle.FromLTRB(12, 0x22, 0x4c, 0x62);
protected Rectangle m_headicon_rect = Rectangle.FromLTRB(9, 0x1f, 0x4f, 0x65);
protected IFrameworkWindow m_iframe;
protected Size m_inner_space = new Size(9, 4);
protected System.Drawing.Point m_last_leftdown = System.Drawing.Point.Empty;
protected Size m_lefttop_margin = new Size(9, 9);
private WndlessLinkLabel m_link_account;
private LinkLabel m_link_buy;
private WndlessLinkLabel m_link_phonenum;
private point_area m_mouse_location;
protected rich_string m_name = new rich_string();
protected rich_string m_nickname = new rich_string();
protected object m_owner;
protected Color m_page_background_color = Color.FromArgb(0xf7, 250, 0xf8);
protected Color m_page_title_background_color = Color.FromArgb(0xdd, 0xdd, 0xdd);
protected Color m_page_title_border_color = Color.FromArgb(0xad, 180, 0xbc);
protected Color m_page_title_color = Color.Gray;
protected int m_page_title_height = 0x18;
private List<contact_tip_page> m_pages = new List<contact_tip_page>();
protected rich_string m_personal_msg = new rich_string();
protected Rectangle m_personal_msg_bounds = Rectangle.Empty;
protected Color m_personal_msg_color = Color.Gray;
protected int m_personal_msg_lines;
private AxWindowsMediaPlayer m_player;
protected Size m_rightbottom_margin = new Size(9, 9);
protected Rectangle m_score_level_bounds = Rectangle.Empty;
private bool m_searching;
private contact_tip_page m_selected_page;
protected Color m_status_color = Color.Silver;
protected Rectangle m_status_img_bounds = new Rectangle(9, 6, 0x10, 0x10);
protected Color m_tag_color = Color.FromArgb(0x34, 0x3a, 120);
protected int m_titlebar_height = 0x19;
protected Color m_titlebar_top_color = Color.FromArgb(200, 0xcb, 0xe0);
private ToolTip m_tooltip;
public event mouse_leavehide_handler on_mouse_leavehide;
public contact_tip_widget(IFrameworkWindow iframe)
{
this.m_iframe = iframe;
this.InitializeComponent();
this.InitializeWndlessComponent();
if ((iframe != null) && (iframe.MainWindow != null))
{
base.Owner = iframe.MainWindow;
iframe.MainWindow.VisibleChanged += new EventHandler(this.OnMainWindowVisibleChanged);
}
this.PostInitializeComponent();
MiscStyle.Instance.StyleChanged += new EventHandler(this.Instance_StyleChanged);
}
private void browse_pages(browse_pages_proc proc, object context)
{
int num = this.GetMoodphraseBottom(true) + this.m_inner_space.Height;
if (!this.m_crbttome_page.show_detail && this.m_crbttome_page.IsValid())
{
num += this.m_crbttome_page.size.Height;
num -= this.m_inner_space.Height;
}
List<contact_tip_page>.Enumerator enumerator = this.m_pages.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
contact_tip_page page = enumerator.get_Current();
if (page.visible)
{
bool cancel = false;
proc(page, num, context, ref cancel);
if (cancel)
{
return;
}
num += this.m_page_title_height;
if (page == this.m_selected_page)
{
num += page.size.Height;
}
}
}
}
finally
{
enumerator.Dispose();
}
}
private void calc_bounds_size(Graphics g, out Size sz)
{
sz = Size.Empty;
Rectangle canvas = Rectangle.FromLTRB(0, 0, base.ClientRectangle.Width, base.ClientRectangle.Height);
this.paint_score_level(g, canvas, true);
this.paint_personal_msg(g, canvas, true);
sz.Width = base.ClientRectangle.Width;
int moodphraseBottom = this.GetMoodphraseBottom(this.m_crbttome_page.IsValid());
sz.Height = moodphraseBottom - base.ClientRectangle.Top;
calc_pages_size_args context = new calc_pages_size_args();
context.m_titles_height = 0;
context.m_max_page_height = 0;
this.browse_pages(new browse_pages_proc(this.calc_pages_size_proc), context);
if (0 < context.m_titles_height)
{
sz.Height += context.m_titles_height + context.m_max_page_height;
}
if (!this.m_crbttome_page.IsValid())
{
sz.Height += this.m_rightbottom_margin.Height;
}
}
private void calc_pages_size_proc(contact_tip_page page, int page_top, object context, ref bool cancel)
{
calc_pages_size_args _args = context as calc_pages_size_args;
_args.m_titles_height += this.m_page_title_height;
if ((page.size.Height > _args.m_max_page_height) && !(page is contact_tip_crbt_page))
{
_args.m_max_page_height = page.size.Height;
}
}
protected override void Dispose(bool disposing)
{
try
{
MiscStyle.Instance.StyleChanged -= new EventHandler(this.Instance_StyleChanged);
this.contact = null;
this.m_name.clear();
this.m_personal_msg.clear();
if (this.iframe != null)
{
this.iframe.MainWindow.VisibleChanged -= new EventHandler(this.OnMainWindowVisibleChanged);
}
if (this.m_player != null)
{
this.m_player.PlayStateChange -= new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(this.on_player_playstatechange);
this.m_player.ErrorEvent -= new EventHandler(this.on_player_errorevent);
}
}
catch
{
}
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
protected void do_paint()
{
if (base.IsHandleCreated && !base.IsDisposed)
{
using (Graphics graphics = Graphics.FromHwnd(base.Handle))
{
using (PaintEventArgs e = new PaintEventArgs(graphics, base.ClientRectangle))
{
this.do_paint(e);
}
}
}
}
protected void do_paint(PaintEventArgs e)
{
try
{
Rectangle clientRectangle = base.ClientRectangle;
if ((0 < clientRectangle.Width) && (0 < clientRectangle.Height))
{
using (Bitmap image = new Bitmap(clientRectangle.Width, clientRectangle.Height))
{
if (image == null)
{
return;
}
Rectangle canvas = Rectangle.FromLTRB(0, 0, image.Width - 1, image.Height - 1);
using (Graphics g = Graphics.FromImage(image))
{
this.paint_background(g, canvas);
this.paint_headicon(g, canvas);
this.paint_title_bar(g, canvas);
this.paint_tags(g, canvas);
this.paint_score_level(g, canvas, false);
this.paint_personal_msg(g, canvas, false);
this.paint_pages(g, canvas);
this.paint_border(g, canvas);
}
e.Graphics.DrawImage(image, base.ClientRectangle.Location);
}
base.OnPaint(e);
}
}
catch (Exception exception)
{
ClientLogger.WriteGeneral("ContactTip", exception.ToString(), 20);
}
}
protected void get_selected_page_bounds_proc(contact_tip_page page, int page_top, object context, ref bool cancel)
{
if (page == this.m_selected_page)
{
get_selected_page_bounds_args _args = context as get_selected_page_bounds_args;
_args.m_page_bounds = Rectangle.FromLTRB(_args.m_canvas.Left, page_top + this.m_page_title_height, _args.m_canvas.Right, (page_top + this.m_page_title_height) + page.size.Height);
cancel = true;
}
}
private void get_visible_pages_count_proc(contact_tip_page page, int page_top, object context, ref bool cancel)
{
get_visible_pages_count_args _args = context as get_visible_pages_count_args;
_args.m_count++;
}
private int GetMoodphraseBottom(bool hasPages)
{
int bottom = this.m_personal_msg_bounds.Top + ((hasPages && (this.m_personal_msg_lines > 3)) ? 0x36 : this.m_personal_msg_bounds.Height);
if (bottom < this.m_headicon_bounds.Bottom)
{
bottom = this.m_headicon_bounds.Bottom;
}
return bottom;
}
private void InitializeComponent()
{
this.m_link_buy = new LinkLabel();
this.m_close_button = new imagebutton_widget();
base.SuspendLayout();
this.m_link_buy.ActiveLinkColor = Color.FromArgb(0, 0x66, 0xa7);
this.m_link_buy.set_AutoSize(true);
this.m_link_buy.BackColor = Color.Transparent;
this.m_link_buy.Font = new Font("SimSun", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
this.m_link_buy.LinkBehavior = LinkBehavior.HoverUnderline;
this.m_link_buy.LinkColor = Color.FromArgb(0, 0x66, 0xa7);
this.m_link_buy.Location = new System.Drawing.Point(0x7e, 0xb9);
this.m_link_buy.Name = "m_link_buy";
this.m_link_buy.Size = new Size(0x1d, 12);
this.m_link_buy.TabIndex = 7;
this.m_link_buy.TabStop = true;
this.m_link_buy.Text = "定购";
this.m_link_buy.Visible = false;
this.m_link_buy.VisitedLinkColor = Color.FromArgb(0, 0x66, 0xa7);
this.m_link_buy.LinkClicked += new LinkLabelLinkClickedEventHandler(this.on_link_buy_clicked);
this.m_close_button.Location = new System.Drawing.Point(0xda, 8);
this.m_close_button.Name = "m_close_button";
this.m_close_button.prompt = "关闭";
this.m_close_button.Size = new Size(13, 13);
this.m_close_button.state_image = null;
this.m_close_button.TabIndex = 6;
this.m_close_button.Visible = false;
this.m_close_button.Click += new EventHandler(this.on_click_close);
base.set_AutoScaleDimensions(new SizeF(6f, 12f));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -