c# - Move column in DataGridView without clicking on it twice -
normally, move column in datagridview, click , drag. however, if scroll before operation (which quite common if moving columns), must click on column before click-and-drag. thought had datagridview losing focus, listened scroll events of type endscroll horizontal scroll bar , called focus() on datagridview there. did not work. know how can move columns without click in case?
this looks winforms bug.
decompiling system.windows.forms helped me find solution : declare datagridview child class , override onscroll function way :
protected override void onscroll(scrolleventargs e) { base.onscroll(e); base.onmouseup(new mouseeventargs(mousebuttons.left, 1, 0, 0, 0)); }
Comments
Post a Comment