在我的應用程序中,我有一個帶有兩個面板的表單。一個面板里面是一個按鈕。在另一個內部是一個 DevExpress Grid 控件。網格由 3 列組成。您可以將值從一列拖到另一列中以進行復制。我的問題是,每當我從一列拖放到另一列時,對應用程序的關注就會進入一種不尋常的狀態。網格保持聚焦;我可以將鼠標懸停在標題上并看到它們正常反應。然而,應用程序的其余部分并未集中。將鼠標懸停在另一個面板中的按鈕上沒有反應,菜單或表單控件也沒有反應。如果我單擊該按鈕,它的反應就像我單擊了一個未聚焦的應用程序一樣。我必須再次單擊才能真正激活按鈕。除了網格之外的每個控件都相同。我曾嘗試在按鈕和表單上使用 Activate() 和 Focus() 但無濟于事。namespace Company.StuffUploader{ public partial class ComputationGrid : DevExpress.XtraEditors.XtraUserControl { private BindingList<ComputationLinkModel> _links = new BindingList<ComputationLinkModel>(); public List<ComputationLinkModel> ComputationLinkModels { get { return new List<ComputationLinkModel>(_links); } } public ComputationGrid() { InitializeComponent(); } private void ComputationGrid_Load(object sender, EventArgs e) { _gridControl.DataSource = _links; } private DragDropEffects GetDragEffect(DragEventArgs e) { var text = e.Data.GetData("System.String") as string; if (text == null) return DragDropEffects.None; var link = GetLinkFromScreenPoint(new Point(e.X, e.Y)); if (link == null) return DragDropEffects.None; var tokens = text.Split('\t'); if (tokens.Count() != 2) return DragDropEffects.None; var dateString = link.movedate.ToString("yyyy-MM-dd"); if (link.StuffSurfaceName == tokens[0] && dateString != tokens[1]) return DragDropEffects.Move; else return DragDropEffects.None; } private ComputationLinkModel GetLinkFromScreenPoint(Point screenPt) { var pt = _gridControl.PointToClient(screenPt); var hitInfo = _gridView.CalcHitInfo(pt); return _gridView.GetRow(hitInfo.RowHandle) as ComputationLinkModel; }
- 2 回答
- 0 關注
- 203 瀏覽
添加回答
舉報
0/150
提交
取消