I wonder there are no posts on internet for this question, How do I add scrollbar to work on DataGridViewTextBoxColumn after MyGrid_EditingControlShowing event displays this textbox on grid.
I have added below event
private void MyGrid_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if ((!(e.Control is TextBox)) || e.CellStyle.WrapMode == DataGridViewTriState.True) return;
var textBox = e.Control as TextBox;
textBox.ScrollBars = ScrollBars.Both;
}
but it didn't worked, when mouse scrolled it scrolled to grid's row not on cell
thanks in advance
This:
will never be true.
You can try this instead:
Or this:
Note that the
ScrollBarswill still only show when theCellis in edit mode! The 'Cells' of aDateGridVieware only virtual controls or, in other words, they are just pixels painted on the screen. They have no event model etc, so they can't function interactively. Only theEditControlthat gets overlaid is an actual control.