Mesen-X/GUI.NET/Controls/MyListView.cs

42 lines
850 B
C#
Raw Normal View History

2015-07-03 00:12:02 -04:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesen.GUI.Controls
{
class MyListView : ListView
{
private bool preventCheck = false;
2015-07-03 00:12:02 -04:00
protected override void OnItemCheck(ItemCheckEventArgs e)
2015-07-03 00:12:02 -04:00
{
if(this.preventCheck) {
e.NewValue = e.CurrentValue;
this.preventCheck = false;
} else
base.OnItemCheck(e);
2015-07-03 00:12:02 -04:00
}
protected override void OnMouseDown(MouseEventArgs e)
2015-07-03 00:12:02 -04:00
{
if(e.Button == MouseButtons.Left && e.Clicks > 1) {
this.preventCheck = true;
} else {
this.preventCheck = false;
2015-07-03 00:12:02 -04:00
}
base.OnMouseDown(e);
2015-07-03 00:12:02 -04:00
}
protected override void OnKeyDown(KeyEventArgs e)
2015-07-03 00:12:02 -04:00
{
this.preventCheck = false;
base.OnKeyDown(e);
2015-07-03 00:12:02 -04:00
}
}
}