Right click will close code menu

This commit is contained in:
Jaex 2019-01-24 16:53:00 +03:00
parent bac503c1b9
commit fa9e751dd7

View file

@ -68,10 +68,17 @@ public static ContextMenuStrip Create(TextBoxBase tb, CodeMenuItem[] items)
foreach (CodeMenuItem item in items)
{
ToolStripMenuItem tsmi = new ToolStripMenuItem { Text = $"{item.Name} - {item.Description}", Tag = item.Name };
tsmi.Click += (sender, e) =>
tsmi.MouseUp += (sender, e) =>
{
string text = ((ToolStripMenuItem)sender).Tag.ToString();
tb.AppendTextToSelection(text);
if (e.Button == MouseButtons.Left)
{
string text = ((ToolStripMenuItem)sender).Tag.ToString();
tb.AppendTextToSelection(text);
}
else
{
cms.Close();
}
};
if (string.IsNullOrWhiteSpace(item.Category))