/// <summary> /// Handles the MouseDown event of the lbKillLog control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param> private void lbKillLog_MouseDown(object sender, MouseEventArgs e) { int index = lbKillLog.IndexFromPoint(e.Location); if (index < 0 || index >= lbKillLog.Items.Count) { return; } Rectangle itemRect; // Beware, this last index may actually means a click in the whitespace at the bottom // Let's deal with this special case if (index == lbKillLog.Items.Count - 1) { itemRect = lbKillLog.GetItemRectangle(index); if (!itemRect.Contains(e.Location)) { return; } } Object item = lbKillLog.Items[index]; String killsGroup = item as String; if (killsGroup != null) { // Left or Middle button : expand/collapse if (e.Button != MouseButtons.Right) { ToggleGroupExpandCollapse(killsGroup); return; } // If right click on the button, still expand/collapse itemRect = lbKillLog.GetItemRectangle(lbKillLog.Items.IndexOf(item)); Rectangle buttonRect = GetButtonRectangle(killsGroup, itemRect); if (!buttonRect.Contains(e.Location)) { return; } ToggleGroupExpandCollapse(killsGroup); return; } // Right click we display a context menu if (e.Button == MouseButtons.Right) { // Display the context menu contextMenuStrip.Show(lbKillLog, e.Location); return; } // Did the user clicked on the "copy kill info" image ? itemRect = lbKillLog.GetItemRectangle(index); Rectangle copyKillInfoRect = GetCopyKillInfoRect(itemRect); if (copyKillInfoRect.Contains(e.Location)) { KillLogExporter.CopyKillInfoToClipboard(m_selectedKillLog); } }
/// <summary> /// Handles the Click event of the CopyPictureBox control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void CopyPictureBox_Click(object sender, EventArgs e) { KillLogExporter.CopyKillInfoToClipboard(m_killLog); }
/// <summary> /// Handles the Click event of the copyKillInfoMenuItem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void copyKillInfoMenuItem_Click(object sender, EventArgs e) { KillLogExporter.CopyKillInfoToClipboard(m_selectedKillLog); }