Use ContextMenuStrip instead of ContextMenu

This commit is contained in:
Jaex 2019-12-03 23:11:35 +03:00
parent a149c608b7
commit 1b00fb0538
3 changed files with 9 additions and 6 deletions

View file

@ -297,7 +297,7 @@ internal static string HistoryItemManager_InitializeComponent_Markdown__linked_i
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to More info. /// Looks up a localized string similar to More info....
/// </summary> /// </summary>
internal static string HistoryItemManager_InitializeComponent_More_info { internal static string HistoryItemManager_InitializeComponent_More_info {
get { get {

View file

@ -182,7 +182,7 @@
<value>Open</value> <value>Open</value>
</data> </data>
<data name="HistoryItemManager_InitializeComponent_More_info" xml:space="preserve"> <data name="HistoryItemManager_InitializeComponent_More_info" xml:space="preserve">
<value>More info</value> <value>More info...</value>
</data> </data>
<data name="HistoryItemManager_InitializeComponent_HTML_link" xml:space="preserve"> <data name="HistoryItemManager_InitializeComponent_HTML_link" xml:space="preserve">
<value>HTML link</value> <value>HTML link</value>

View file

@ -55,10 +55,11 @@ public ObjectListView()
MultiSelect = false; MultiSelect = false;
Columns.Add(Resources.ObjectListView_ObjectListView_Name, 125); Columns.Add(Resources.ObjectListView_ObjectListView_Name, 125);
Columns.Add(Resources.ObjectListView_ObjectListView_Value, 300); Columns.Add(Resources.ObjectListView_ObjectListView_Value, 300);
ContextMenu contextMenu = new ContextMenu(); ContextMenuStrip cms = new ContextMenuStrip();
contextMenu.MenuItems.Add(Resources.ObjectListView_ObjectListView_Copy_name).Click += PropertyListView_Click_Name; cms.ShowImageMargin = false;
contextMenu.MenuItems.Add(Resources.ObjectListView_ObjectListView_Copy_value).Click += PropertyListView_Click_Value; cms.Items.Add(Resources.ObjectListView_ObjectListView_Copy_name).Click += PropertyListView_Click_Name;
ContextMenu = contextMenu; cms.Items.Add(Resources.ObjectListView_ObjectListView_Copy_value).Click += PropertyListView_Click_Value;
ContextMenuStrip = cms;
} }
private void PropertyListView_Click_Name(object sender, EventArgs e) private void PropertyListView_Click_Name(object sender, EventArgs e)
@ -66,6 +67,7 @@ private void PropertyListView_Click_Name(object sender, EventArgs e)
if (SelectedItems.Count > 0) if (SelectedItems.Count > 0)
{ {
string text = SelectedItems[0].Text; string text = SelectedItems[0].Text;
if (!string.IsNullOrEmpty(text)) if (!string.IsNullOrEmpty(text))
{ {
ClipboardHelpers.CopyText(text); ClipboardHelpers.CopyText(text);
@ -78,6 +80,7 @@ private void PropertyListView_Click_Value(object sender, EventArgs e)
if (SelectedItems.Count > 0) if (SelectedItems.Count > 0)
{ {
string text = SelectedItems[0].SubItems[1].Text; string text = SelectedItems[0].SubItems[1].Text;
if (!string.IsNullOrEmpty(text)) if (!string.IsNullOrEmpty(text))
{ {
ClipboardHelpers.CopyText(text); ClipboardHelpers.CopyText(text);