0
我們繼承了一個使用RADGrid的項目。它同時具有啓用雙擊和單擊的事件。Telerik WinForms:雙擊無法區分單擊
但當的DoubleClick被解僱,因此被點擊並CellBeginEdit,...
我想取消點擊,CellBeginEdit或他人的DoubleClick時觸發。
我們繼承了一個使用RADGrid的項目。它同時具有啓用雙擊和單擊的事件。Telerik WinForms:雙擊無法區分單擊
但當的DoubleClick被解僱,因此被點擊並CellBeginEdit,...
我想取消點擊,CellBeginEdit或他人的DoubleClick時觸發。
我有一個從我的項目中用作網格控件的Telerik.WinControls.UI.RadGridView的繼承類表。
這種簡歷去解決問題所需要的:
public partial class Sheet : Telerik.WinControls.UI.RadGridView
{
//System Time to wait between Click and DoubleClick
private int _doubleClickTime = 500;
private bool _doubleClickRaised = false;
private bool _doubleClickCancelEdit = false;
public void FpSpread()
{
_doubleClickTime = System.Windows.Forms.SystemInformation.DoubleClickTime;
//...
}
protected override void OnMouseDoubleClick(MouseEventArgs e)
{
_doubleClickRaised = true;
_doubleClickCancelEdit = true;
base.OnMouseDoubleClick(e);
}
protected override void OnMouseClick(MouseEventArgs e)
{
//Doing what Telerik doesn't
//Wait system time needed for DoubleClick
System.Threading.Thread.Sleep(_doubleClickTime + 10);
Application.DoEvents();
if (_doubleClickRaised)
{
_doubleClickRaised = false;
return;
}
base.OnMouseClick(e);
}
//This only when editable cells...
protected override void OnCellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
if (_doubleClickCancelEdit)
{
_doubleClickCancelEdit = false;
e.Cancel = true;
}
base.OnCellBeginEdit(sender, e);
}
}
我希望這有助於!