protected override void OnMouseUp(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { mdown = false; } else if (e.Button == MouseButtons.Right) { currentContext = this; contextMenu.Show(this, e.Location); } base.OnMouseUp(e); }
// ctor public ChatControl() { MessagePadding = new Padding(12, 8 + TopMenuBarHeight, 16 + SystemInformation.VerticalScrollBarWidth, 8); _scroll.Location = new Point(Width - SystemInformation.VerticalScrollBarWidth, TopMenuBarHeight); _scroll.Size = new Size(SystemInformation.VerticalScrollBarWidth, Height - TopMenuBarHeight - 2); _scroll.Anchor = AnchorStyles.None; // AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top; Input = new ChatInputControl(this) { Width = 600 - 2, Location = new Point(0, Height - 32) }; Input.VisibleChanged += (s, e) => { updateMessageBounds(); Invalidate(); }; Input.SizeChanged += (s, e) => { Input.Location = new Point(1, Height - Input.Height - 1); updateMessageBounds(); Invalidate(); }; Input.Anchor = AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left; Controls.Add(Input); Fonts.FontChanged += Fonts_FontChanged; Net.CurrentChannelChanged += Net_CurrentChannelChanged; Disposed += (s, e) => { Fonts.FontChanged -= Fonts_FontChanged; Net.CurrentChannelChanged -= Net_CurrentChannelChanged; TwitchChannel.RemoveChannel(ActualChannelName); }; //Font = Fonts.GdiMedium; Font = new Font("Segoe UI", 9.5f); var header = _header = new ChatControlHeader(this); header.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; header.Width = Width - 2; header.Location = new Point(1, 0); Controls.Add(header); GotFocus += (s, e) => { Input.Logic.ClearSelection(); Input.Invalidate(); header.Invalidate(); }; LostFocus += (s, e) => { header.Invalidate(); Input.Invalidate(); }; }