📄 pgconversationtopcontrol.cs
字号:
namespace Imps.Client.Pc
{
using Imps.Client;
using Imps.Client.Core;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.Controls;
using Imps.Client.Pc.Properties;
using Imps.Client.Pc.WndlessControls;
using Imps.Client.Utils;
using Imps.Utils;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
public class PGConversationTopControl : UserControl
{
private IFrameworkWindow _framework;
private PersonalGroup _group;
private bool _sendSMS;
private WndlessControlCollection _wndlessControls;
private XTextBox _xtxtBulletin;
private Color borderColor = Color.FromArgb(0xa4, 170, 220);
private IContainer components;
private WndlessPortrait imgPortrait;
private HtmlLabel lblBulletin;
private menu_widget menuDropdown;
private ToolTip myToolTip = new ToolTip();
private PictureBox picGroupSetting;
private PictureBox picInviteFriend;
private PictureBox picSendSMS;
private PictureBox picVisitGroupWebsite;
private Panel pnlContainer;
private Panel pnlOperate;
private Panel pnlPortrait;
private ToolStripMenuItem tsClose;
private ToolStripMenuItem tsGroupSetup;
private ToolStripMenuItem tsGroupWebSite;
private ToolStripMenuItem tsHistory;
private ToolStripMenuItem tsInviteFriends;
public event EventHandler SendSMSChanged;
public PGConversationTopControl(IFrameworkWindow framework, PersonalGroup group)
{
this.InitializeComponent();
this._framework = framework;
this._group = group;
this.InitImageControl();
this.InitGroupInfo();
this.InitPopedom();
this.InitEvents();
this.tsInviteFriends.set_Enabled(this._group.UserInfo.EnableInviteFriends);
this.set_DoubleBuffered(true);
ControlHelper.SetDoubleBuffered(this.pnlPortrait);
ControlHelper.SetDoubleBuffered(this.pnlOperate);
}
private void _xtxtBulletin_KeyPress(object sender, KeyPressEventArgs e)
{
this.myToolTip.Hide(base.ParentForm);
bool flag = this._framework.AccountManager.CurrentUser.Configuration.UserSetting.ConversationSetting.SendMessageByEnterKey.Value;
if ((((Control.ModifierKeys & Keys.Control) == Keys.Control) ^ flag) && ((e.KeyChar == '\r') || (e.KeyChar == '\n')))
{
this.UpdateBulletin();
e.Handled = true;
}
}
private void _xtxtBulletin_LostFocus(object sender, EventArgs e)
{
if (this._xtxtBulletin.Visible)
{
this.UpdateBulletin();
}
}
public void Disable()
{
this.picGroupSetting.Image = Resources.PG_Setup_Disable;
this.picGroupSetting.Enabled = false;
this.picSendSMS.Image = Resources.PG_SMS_Disable;
this.picSendSMS.Enabled = false;
this.picInviteFriend.Image = Resources.PG_Invite_Disable;
this.picInviteFriend.Enabled = false;
this.picVisitGroupWebsite.Image = Resources.PG_Website_Disable;
this.picVisitGroupWebsite.Enabled = false;
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void GroupInfo_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
{
if (e.ContainsProperty("Portrait"))
{
this.imgPortrait.Portrait = this._group.GroupInfo.Portrait.Value;
}
if (e.ContainsProperty("Bulletin"))
{
this.lblBulletin.Text = StringHelper.EncodString(this._group.GroupInfo.Bulletin.Value);
}
}
private void imgPortrait_PortraitClicked(object sender, EventArgs e)
{
this._framework.PersonalGroupManager.ShowGroupSetting(base.FindForm(), this._group, GroupOption.Normal);
}
private void InitEvents()
{
this._group.GroupInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.GroupInfo_PropertiesChanged);
this._group.UserInfo.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.UserInfo_PropertiesChanged);
base.Disposed += new EventHandler(this.PGConversationTopControl_Disposed);
this.pnlOperate.Paint += new PaintEventHandler(this.pnlOperate_Paint);
}
private void InitGroupInfo()
{
this.imgPortrait.Portrait = this._group.GroupInfo.Portrait.Value;
this.lblBulletin.Text = StringHelper.EncodString(this._group.GroupInfo.Bulletin.Value);
}
private void InitializeComponent()
{
this.components = new Container();
ComponentResourceManager manager = new ComponentResourceManager(typeof(PGConversationTopControl));
this.menuDropdown = new menu_widget(this.components);
this.tsGroupSetup = new ToolStripMenuItem();
this.tsGroupWebSite = new ToolStripMenuItem();
this.tsHistory = new ToolStripMenuItem();
this.tsInviteFriends = new ToolStripMenuItem();
this.tsClose = new ToolStripMenuItem();
this.pnlContainer = new Panel();
this.lblBulletin = new HtmlLabel();
this.pnlOperate = new Panel();
this.picVisitGroupWebsite = new PictureBox();
this.picInviteFriend = new PictureBox();
this.picGroupSetting = new PictureBox();
this.picSendSMS = new PictureBox();
this.pnlPortrait = new Panel();
this.menuDropdown.SuspendLayout();
this.pnlContainer.SuspendLayout();
this.pnlOperate.SuspendLayout();
this.picVisitGroupWebsite.BeginInit();
this.picInviteFriend.BeginInit();
this.picGroupSetting.BeginInit();
this.picSendSMS.BeginInit();
base.SuspendLayout();
this.menuDropdown.get_Items().AddRange(new ToolStripItem[] { this.tsGroupSetup, this.tsGroupWebSite, this.tsHistory, this.tsInviteFriends, this.tsClose });
this.menuDropdown.Name = "menuInputChat";
this.menuDropdown.Size = new Size(0xb7, 0x72);
this.menuDropdown.UseMnemonic = true;
this.tsGroupSetup.set_Image(Resources.PG_Menu_Setup);
this.tsGroupSetup.set_Name("tsGroupSetup");
this.tsGroupSetup.set_Size(new Size(0xb6, 0x16));
this.tsGroupSetup.set_Text("群设置");
this.tsGroupSetup.add_Click(new EventHandler(this.tsGroupSetup_Click));
this.tsGroupWebSite.set_Image(Resources.PG_Menu_Website);
this.tsGroupWebSite.set_Name("tsGroupWebSite");
this.tsGroupWebSite.set_Size(new Size(0xb6, 0x16));
this.tsGroupWebSite.set_Text("访问群主页");
this.tsGroupWebSite.add_Click(new EventHandler(this.tsGroupWebSite_Click));
this.tsHistory.set_Image(Resources.PG_Menu_History);
this.tsHistory.set_Name("tsHistory");
this.tsHistory.set_Size(new Size(0xb6, 0x16));
this.tsHistory.set_Text("消息历史");
this.tsHistory.add_Click(new EventHandler(this.tsHistory_Click));
this.tsInviteFriends.set_Image(Resources.PG_Menu_Invite);
this.tsInviteFriends.set_Name("tsInviteFriends");
this.tsInviteFriends.set_Size(new Size(0xb6, 0x16));
this.tsInviteFriends.set_Text("邀请飞信好友加入群");
this.tsInviteFriends.add_Click(new EventHandler(this.tsInviteFriends_Click));
this.tsClose.set_Name("tsClose");
this.tsClose.set_Size(new Size(0xb6, 0x16));
this.tsClose.set_Text("关闭");
this.tsClose.add_Click(new EventHandler(this.tsClose_Click));
this.pnlContainer.BackColor = Color.Transparent;
this.pnlContainer.BackgroundImage = (Image) manager.GetObject("pnlContainer.BackgroundImage");
this.pnlContainer.Controls.Add(this.lblBulletin);
this.pnlContainer.Controls.Add(this.pnlOperate);
this.pnlContainer.Controls.Add(this.pnlPortrait);
this.pnlContainer.Dock = DockStyle.Fill;
this.pnlContainer.Location = new System.Drawing.Point(3, 3);
this.pnlContainer.Name = "pnlContainer";
this.pnlContainer.Size = new Size(0x1b7, 0x42);
this.pnlContainer.TabIndex = 3;
this.lblBulletin.set_AutoEllipsis(true);
this.lblBulletin.Cursor = Cursors.Hand;
this.lblBulletin.BackColor = Color.Transparent;
this.lblBulletin.Dock = DockStyle.Fill;
this.lblBulletin.ForeColor = Color.White;
this.lblBulletin.LinkColor = Color.Blue;
this.lblBulletin.Location = new System.Drawing.Point(0x59, 0);
this.lblBulletin.Name = "lblBulletin";
this.lblBulletin.set_Padding(new Padding(1, 2, 1, 1));
this.lblBulletin.ParseEmotion = true;
this.lblBulletin.ShowBackgroundImage = false;
this.lblBulletin.Size = new Size(0x11e, 0x42);
this.lblBulletin.TabIndex = 0;
this.lblBulletin.Text = "群公告";
this.lblBulletin.UseMnemonic = false;
this.lblBulletin.DoubleClick += new EventHandler(this.lblBulletin_DoubleClick);
this.pnlOperate.BackColor = Color.Transparent;
this.pnlOperate.Controls.Add(this.picVisitGroupWebsite);
this.pnlOperate.Controls.Add(this.picInviteFriend);
this.pnlOperate.Controls.Add(this.picGroupSetting);
this.pnlOperate.Controls.Add(this.picSendSMS);
this.pnlOperate.Dock = DockStyle.Right;
this.pnlOperate.Location = new System.Drawing.Point(0x177, 0);
this.pnlOperate.Name = "pnlOperate";
this.pnlOperate.Size = new Size(0x40, 0x42);
this.pnlOperate.TabIndex = 2;
this.picVisitGroupWebsite.Anchor = AnchorStyles.Right | AnchorStyles.Top;
this.picVisitGroupWebsite.Cursor = Cursors.Hand;
this.picVisitGroupWebsite.Image = Resources.PG_Website;
this.picVisitGroupWebsite.Location = new System.Drawing.Point(0x25, 6);
this.picVisitGroupWebsite.Name = "picVisitGroupWebsite";
this.picVisitGroupWebsite.Size = new Size(0x18, 0x18);
this.picVisitGroupWebsite.TabIndex = 2;
this.picVisitGroupWebsite.TabStop = false;
this.picVisitGroupWebsite.MouseLeave += new EventHandler(this.picVisitGroupWebsite_MouseLeave);
this.picVisitGroupWebsite.MouseDown += new MouseEventHandler(this.picVisitGroupWebsite_MouseDown);
this.picVisitGroupWebsite.add_MouseClick(new MouseEventHandler(this.picVisitGroupWebsite_MouseClick));
this.picVisitGroupWebsite.MouseHover += new EventHandler(this.picVisitGroupWebsite_MouseHover);
this.picVisitGroupWebsite.MouseUp += new MouseEventHandler(this.picVisitGroupWebsite_MouseUp);
this.picInviteFriend.Anchor = AnchorStyles.Right | AnchorStyles.Top;
this.picInviteFriend.Cursor = Cursors.Hand;
this.picInviteFriend.Image = Resources.PG_Invite;
this.picInviteFriend.Location = new System.Drawing.Point(6, 6);
this.picInviteFriend.Name = "picInviteFriend";
this.picInviteFriend.Size = new Size(0x18, 0x18);
this.picInviteFriend.TabIndex = 1;
this.picInviteFriend.TabStop = false;
this.picInviteFriend.MouseLeave += new EventHandler(this.picInviteFriend_MouseLeave);
this.picInviteFriend.MouseDown += new MouseEventHandler(this.picInviteFriend_MouseDown);
this.picInviteFriend.add_MouseClick(new MouseEventHandler(this.picInviteFriend_MouseClick));
this.picInviteFriend.MouseHover += new EventHandler(this.picInviteFriend_MouseHover);
this.picInviteFriend.MouseUp += new MouseEventHandler(this.picInviteFriend_MouseUp);
this.picGroupSetting.Anchor = AnchorStyles.Right | AnchorStyles.Top;
this.picGroupSetting.Cursor = Cursors.Hand;
this.picGroupSetting.Image = Resources.PG_Setup;
this.picGroupSetting.Location = new System.Drawing.Point(0x25, 0x23);
this.picGroupSetting.Name = "picGroupSetting";
this.picGroupSetting.Size = new Size(0x18, 0x18);
this.picGroupSetting.SizeMode = PictureBoxSizeMode.StretchImage;
this.picGroupSetting.TabIndex = 0;
this.picGroupSetting.TabStop = false;
this.picGroupSetting.MouseLeave += new EventHandler(this.picGroupSetting_MouseLeave);
this.picGroupSetting.MouseDown += new MouseEventHandler(this.picGroupSetting_MouseDown);
this.picGroupSetting.add_MouseClick(new MouseEventHandler(this.picGroupSetting_MouseClick));
this.picGroupSetting.MouseHover += new EventHandler(this.picGroupSetting_MouseHover);
this.picGroupSetting.MouseUp += new MouseEventHandler(this.picGroupSetting_MouseUp);
this.picSendSMS.Anchor = AnchorStyles.Right | AnchorStyles.Top;
this.picSendSMS.Cursor = Cursors.Hand;
this.picSendSMS.Image = Resources.PG_SMS;
this.picSendSMS.Location = new System.Drawing.Point(6, 0x23);
this.picSendSMS.Name = "picSendSMS";
this.picSendSMS.Size = new Size(0x18, 0x18);
this.picSendSMS.SizeMode = PictureBoxSizeMode.CenterImage;
this.picSendSMS.TabIndex = 0;
this.picSendSMS.TabStop = false;
this.picSendSMS.MouseLeave += new EventHandler(this.picSendSMS_MouseLeave);
this.picSendSMS.MouseDown += new MouseEventHandler(this.picSendSMS_MouseDown);
this.picSendSMS.add_MouseClick(new MouseEventHandler(this.picSendSMS_MouseClick));
this.picSendSMS.MouseHover += new EventHandler(this.picSendSMS_MouseHover);
this.picSendSMS.MouseUp += new MouseEventHandler(this.picSendSMS_MouseUp);
this.pnlPortrait.Dock = DockStyle.Left;
this.pnlPortrait.Location = new System.Drawing.Point(0, 0);
this.pnlPortrait.Name = "pnlPortrait";
this.pnlPortrait.Size = new Size(0x59, 0x42);
this.pnlPortrait.TabIndex = 3;
base.set_AutoScaleDimensions(new SizeF(6f, 13f));
base.set_AutoScaleMode(1);
this.BackColor = Color.Transparent;
base.Controls.Add(this.pnlContainer);
base.Name = "PGConversationTopControl";
base.set_Padding(new Padding(3, 3, 3, 5));
base.Size = new Size(0x1bd, 0x4a);
this.menuDropdown.ResumeLayout(false);
this.pnlContainer.ResumeLayout(false);
this.pnlOperate.ResumeLayout(false);
this.picVisitGroupWebsite.EndInit();
this.picInviteFriend.EndInit();
this.picGroupSetting.EndInit();
this.picSendSMS.EndInit();
base.ResumeLayout(false);
}
private void InitImageControl()
{
this._wndlessControls = new WndlessControlCollection(this.pnlPortrait);
this.imgPortrait = new WndlessPortrait();
this.imgPortrait.AutoSize = false;
this.imgPortrait.Portrait = this._group.GroupInfo.Portrait.Value;
this.imgPortrait.BackgroundImage = Resources.portrait;
this.imgPortrait.Location = new System.Drawing.Point(0, 0);
this.imgPortrait.Size = new Size(0x4f, 60);
this.imgPortrait.PortraitSize = 0x30;
this.imgPortrait.Style = WndlessPortrait.PortraitStyle.DropDownAtRightSide;
this.imgPortrait.DropDown = this.menuDropdown;
this.imgPortrait.PortraitCursor = Cursors.Hand;
this.imgPortrait.PortraitClicked += new EventHandler(this.imgPortrait_PortraitClicked);
this._wndlessControls.Add(this.imgPortrait);
}
private void InitPopedom()
{
if (((UserIdentity) this._group.UserInfo.GroupUserIdentity.Value) == UserIdentity.SuperManager)
{
this.pnlOperate.Width = 0x40;
}
else
{
this.pnlOperate.Width = 0x20;
}
this.picInviteFriend.Visible = this._group.UserInfo.EnableInviteFriends;
this.picSendSMS.Visible = this._group.UserInfo.EnableGroupSendSMS;
this.picGroupSetting.Visible = this._group.UserInfo.EnableModifyMyInfo;
this.InitSMSButton();
}
private void InitSMSButton()
{
if (this.SendSMS)
{
this.picSendSMS.Image = Resources.PG_SMS_Down;
}
else
{
this.picSendSMS.Image = Resources.PG_SMS;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -