📄 contact_tip_widget.cs
字号:
base.OnVisibleChanged(e);
if (!base.Visible)
{
try
{
if (this.is_playing)
{
this.m_player.Ctlcontrols.stop();
}
}
catch (Exception exception)
{
ClientLogger.WriteGeneral("ContactTip", exception.ToString(), 10);
}
}
}
protected void paint_background(Graphics g, Rectangle canvas)
{
get_selected_page_bounds_args context = new get_selected_page_bounds_args();
context.m_canvas = canvas;
context.m_page_bounds = Rectangle.Empty;
this.browse_pages(new browse_pages_proc(this.get_selected_page_bounds_proc), context);
using (Brush brush = new SolidBrush(this.BackColor))
{
if (context.m_page_bounds.IsEmpty)
{
g.FillRectangle(brush, canvas);
}
else
{
Rectangle rect = Rectangle.FromLTRB(canvas.Left, canvas.Top, canvas.Right, context.m_page_bounds.Top);
g.FillRectangle(brush, rect);
Rectangle rectangle2 = Rectangle.FromLTRB(canvas.Left, context.m_page_bounds.Bottom, canvas.Right, canvas.Bottom);
g.FillRectangle(brush, rectangle2);
using (Brush brush2 = new SolidBrush(this.m_page_background_color))
{
g.FillRectangle(brush2, context.m_page_bounds);
}
}
}
}
protected void paint_border(Graphics g, Rectangle canvas)
{
using (Pen pen = new Pen(this.border_color))
{
g.DrawRectangle(pen, canvas);
}
using (Pen pen2 = new Pen(this.m_headicon_border_color))
{
Rectangle rect = Rectangle.FromLTRB(this.m_headicon_rect.Left, this.m_headicon_rect.Top, this.m_headicon_rect.Right - 1, this.m_headicon_rect.Bottom - 1);
g.DrawRectangle(pen2, rect);
}
}
protected void paint_headicon(Graphics g, Rectangle canvas)
{
Image image = (this.m_contact == null) ? this.CurrentUser.PersonalInfo.PortraitMedium : this.m_contact.PersonalInfo.PortraitMedium;
if (image != null)
{
g.DrawImage(image, this.m_headicon_bounds);
}
}
protected void paint_page_title_proc(contact_tip_page page, int page_top, object context, ref bool cancel)
{
paint_page_title_args _args = context as paint_page_title_args;
using (Brush brush = new SolidBrush(this.m_page_title_background_color))
{
_args.m_graphics.FillRectangle(brush, (int) (_args.m_canvas.Left + 2), (int) (page_top + 2), (int) (_args.m_canvas.Width - 2), (int) (this.m_page_title_height - 2));
}
int x = _args.m_canvas.Left + this.m_lefttop_margin.Width;
int num2 = x + this.m_inner_space.Width;
if (page.icon != null)
{
_args.m_graphics.DrawImage(page.icon, x, page_top + ((this.m_page_title_height - page.icon.Height) / 2));
num2 += page.icon.Width;
}
Image image = ImpsResources.GetImage(this.m_crbttome_page.show_detail ? "Images.card_expand.png" : "Images.card_collspan.png");
Rectangle rect = new Rectangle();
rect.X = (_args.m_canvas.Right - this.m_rightbottom_margin.Width) - image.Width;
rect.Y = page_top + ((this.m_page_title_height - image.Height) / 2);
rect.Width = image.Width;
rect.Height = image.Height;
_args.m_graphics.DrawImage(image, rect);
Rectangle layoutRectangle = Rectangle.FromLTRB((x + page.icon.Width) + this.m_inner_space.Width, page_top, rect.Left - this.m_inner_space.Width, page_top + this.m_page_title_height);
_args.m_graphics.DrawString(page.title, this.Font, _args.m_brText, layoutRectangle, _args.m_fmt);
_args.m_graphics.DrawLine(_args.m_penBorder, _args.m_canvas.Left, page_top, _args.m_canvas.Right, page_top);
page_top += this.m_page_title_height;
_args.m_graphics.DrawLine(_args.m_penBorder, _args.m_canvas.Left, page_top - 1, _args.m_canvas.Right, page_top - 1);
if (page == this.m_selected_page)
{
Rectangle canvas = Rectangle.FromLTRB(x, page_top, _args.m_canvas.Right - this.m_rightbottom_margin.Width, page_top + page.size.Height);
page.paint(_args.m_graphics, canvas);
page_top += canvas.Height;
}
}
protected void paint_pages(Graphics g, Rectangle canvas)
{
if (this.m_crbttome_page.IsValid())
{
using (StringFormat format = new StringFormat())
{
format.Alignment = StringAlignment.Near;
format.LineAlignment = StringAlignment.Center;
format.FormatFlags |= StringFormatFlags.NoWrap;
format.Trimming = StringTrimming.EllipsisCharacter;
using (Pen pen = new Pen(this.m_page_title_border_color))
{
using (Brush brush = new SolidBrush(this.m_page_title_color))
{
paint_page_title_args context = new paint_page_title_args();
context.m_graphics = g;
context.m_fmt = format;
context.m_penBorder = pen;
context.m_brText = brush;
context.m_canvas = canvas;
this.browse_pages(new browse_pages_proc(this.paint_page_title_proc), context);
}
}
}
}
}
protected void paint_personal_msg(Graphics g, Rectangle canvas, bool calc_mode)
{
if (string.IsNullOrEmpty(this.m_personal_msg.plane_text))
{
this.m_personal_msg_bounds.X = base.ClientRectangle.Left + this.m_inner_space.Width;
this.m_personal_msg_bounds.Y = this.m_score_level_bounds.Bottom;
this.m_personal_msg_bounds.Width = base.ClientRectangle.Width - (this.m_inner_space.Width * 2);
this.m_personal_msg_bounds.Height = 0;
}
else
{
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Near;
format.LineAlignment = StringAlignment.Near;
format.FormatFlags |= StringFormatFlags.NoWrap;
format.Trimming = StringTrimming.None;
int num = (canvas.Left + this.m_inner_space.Width) - base.ClientRectangle.Left;
int num2 = (canvas.Top + this.m_score_level_bounds.Bottom) + (this.m_inner_space.Height * 2);
int right = canvas.Right;
int width = this.m_rightbottom_margin.Width;
int left = base.ClientRectangle.Left;
if (calc_mode)
{
this.m_personal_msg_bounds.X = num + base.ClientRectangle.Left;
this.m_personal_msg_bounds.Y = num2 + base.ClientRectangle.Top;
this.m_personal_msg_bounds.Width = (canvas.Right - this.m_rightbottom_margin.Width) - num;
SizeF ef = this.m_personal_msg.MeasureMultiLineMode(g, this.Font, this.m_personal_msg_bounds.Width, 5, out this.m_personal_msg_lines);
this.m_personal_msg_bounds.Height = (int) Math.Ceiling((double) ef.Height);
}
else
{
int maxLines = (this.m_crbttome_page.show_detail && this.m_crbttome_page.IsValid()) ? 3 : 5;
this.m_personal_msg.DrawMultiLineMode(g, this.Font, this.m_personal_msg_color, this.m_personal_msg_bounds, maxLines);
}
}
}
protected void paint_score_level(Graphics g, Rectangle canvas, bool calcmode)
{
int num = (this.m_contact == null) ? this.CurrentUser.ScoreInfo.ScoreLevel : this.m_contact.PersonalInfo.ScoreLevel;
this._score_level_control.Visible = num > 0;
if (num > 0)
{
this._score_level_control.ScoreLevel = num;
this.m_score_level_bounds.X = base.ClientRectangle.Left + this.m_inner_space.Width;
this.m_score_level_bounds.Y = this.m_headicon_rect.Bottom + this.m_inner_space.Height;
this.m_score_level_bounds.Width = this._score_level_control.Width;
this.m_score_level_bounds.Height = this._score_level_control.Height;
this._score_level_control.Bounds = this.m_score_level_bounds;
}
else
{
this.m_score_level_bounds.X = 0;
this.m_score_level_bounds.Y = this.m_headicon_rect.Bottom;
this.m_score_level_bounds.Width = base.Width;
this.m_score_level_bounds.Height = 0;
}
}
protected void paint_tags(Graphics g, Rectangle canvas)
{
bool flag = null != this.m_contact;
using (StringFormat format = new StringFormat())
{
format.Alignment = StringAlignment.Near;
format.LineAlignment = StringAlignment.Center;
format.FormatFlags |= StringFormatFlags.NoWrap;
using (Brush brush = new SolidBrush(this.m_tag_color))
{
using (Brush brush2 = new SolidBrush(this.m_personal_msg_color))
{
SizeF ef = g.MeasureString("手机号", this.Font);
int num = flag ? 4 : 3;
float num2 = (this.m_headicon_rect.Height - (0x10 * num)) / (num + 1);
int num3 = (this.m_headicon_rect.Right + this.m_inner_space.Width) + base.ClientRectangle.Left;
float y = this.m_headicon_rect.Top + num2;
RectangleF layoutRectangle = new RectangleF((float) num3, y, ef.Width, 16f);
RectangleF ef3 = new RectangleF(layoutRectangle.Right, y, ef.Width / 3f, 16f);
RectangleF rc = RectangleF.FromLTRB(ef3.Right, y, (float) (base.ClientRectangle.Right - this.m_inner_space.Width), ef3.Bottom);
format.Trimming = StringTrimming.EllipsisCharacter;
bool flag2 = (this.m_contact == null) || (this.iframe.AccountManager.CurrentUser.Status != UserAccountStatus.Logon);
g.DrawString("昵", this.Font, brush, layoutRectangle, format);
format.Alignment = StringAlignment.Far;
g.DrawString("称", this.Font, brush, layoutRectangle, format);
format.Alignment = StringAlignment.Near;
g.DrawString(":", this.Font, brush, ef3, format);
this.m_nickname.Draw(g, this.Font, this.m_personal_msg_color, rc);
layoutRectangle.Y = layoutRectangle.Bottom + num2;
ef3.Y = layoutRectangle.Y;
rc.Y = layoutRectangle.Y;
g.DrawString("手机号", this.Font, brush, layoutRectangle, format);
format.Alignment = StringAlignment.Near;
g.DrawString(":", this.Font, brush, ef3, format);
if (flag2)
{
this.m_link_phonenum.Visible = false;
g.DrawString(this.m_link_phonenum.Text, this.Font, brush2, rc, format);
}
else
{
this.m_link_phonenum.Visible = true;
this.m_link_phonenum.Location = System.Drawing.Point.Round(rc.Location);
}
layoutRectangle.Y = layoutRectangle.Bottom + num2;
ef3.Y = layoutRectangle.Y;
rc.Y = layoutRectangle.Y;
g.DrawString("飞信号", this.Font, brush, layoutRectangle, format);
format.Alignment = StringAlignment.Near;
g.DrawString(":", this.Font, brush, ef3, format);
if (flag2)
{
this.m_link_account.Visible = false;
g.DrawString(this.m_link_account.Text, this.Font, brush2, rc, format);
}
else
{
this.m_link_account.Visible = true;
this.m_link_account.Location = System.Drawing.Point.Round(rc.Location);
}
if (flag)
{
layoutRectangle.Y = layoutRectangle.Bottom + num2;
ef3.Y = layoutRectangle.Y;
rc.Y = layoutRectangle.Y;
g.DrawString("分", this.Font, brush, layoutRectangle, format);
format.Alignment = StringAlignment.Far;
g.DrawString("组", this.Font, brush, layoutRectangle, format);
format.Alignment = StringAlignment.Near;
g.DrawString(":", this.Font, brush, ef3, format);
string s = this.m_contact.BelongToGroupsName;
if (!string.IsNullOrEmpty(s))
{
g.DrawString(s, this.Font, brush2, rc, format);
}
}
}
}
}
}
private void paint_title_bar()
{
using (Graphics graphics = Graphics.FromHwnd(base.Handle))
{
using (Bitmap image = new Bitmap(base.ClientRectangle.Width - 1, this.m_titlebar_height))
{
using (Graphics graphics2 = Graphics.FromImage(image))
{
Rectangle clipRect = Rectangle.FromLTRB(0, 0, image.Width, image.Height);
using (PaintEventArgs args = new PaintEventArgs(graphics2, clipRect))
{
this.paint_title_bar(graphics2, clipRect);
}
using (Pen pen = new Pen(this.border_color))
{
graphics2.DrawLine(pen, clipRect.Left, clipRect.Bottom, clipRect.Left, clipRect.Top);
graphics2.DrawLine(pen, clipRect.Left, clipRect.Top, clipRect.Right, clipRect.Top);
graphics2.DrawLine(pen, clipRect.Right, clipRect.Top, clipRect.Right, clipRect.Bottom);
}
graphics.DrawImage(image, base.ClientRectangle.Location);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -