2017-03-07 83 views
1

自定義排序和列大小調整不起作用。在調整DevExpress XtraGrid列大小時不正確的HitTest

實現的自定義排序在MouseUp事件處理程序然而

if (hitInfo.InColumnPanel && hitInfo.HitTest == GridHitTest.ColumnEdge) 
{ 
    (e as DXMouseEventArgs).Handled = true; 
    return; 
} 

沒有爲事件工作。

希望能夠通過拖動列邊緣來點擊列標題進行排序和調整大小。

回答

1
private void OnMouseDown(object sender, MouseEventArgs e) 
{ 
    GridHitInfo hitInfo = gridView1.CalcHitInfo(e.Location); 
    if (hitInfo.HitTest == GridHitTest.ColumnEdge) 
    { 
     isEdgeClicked = true; 
    } 
} 

private void OnMouseUp(object sender, System.Windows.Forms.MouseEventArgs e) 
{ 
    if (isEdgeClicked) 
    { isEdgeClicked = false; 
     return; 
    } 
    else 
    { 
     (e as DXMouseEventArgs).Handled = true; 
    } 
}