c# - Multiple lines in a DataGridView cell -
using c#
windows forms
;
i have datagridview
number of cells. show digits (from 1-9) in cell. digits should placed under each other in 3x3
format.
i looked around, , ended rather complex custom implementation of richtextbox
cell.
is there way can draw custom rectangle
, implement backgroundimage
of cell or something? cell need redrawn several times. can't call paint
event guess.
note: cell must not edited user.
im don't know if satisfy you, can use environment.newline
create simple line break inside cell.
example:
string nl = environment.newline; // new line variable string data = "1 2 3" + nl + "4 5 6" + nl + "7 8 9";
added later:
as adrian said in comments - need to:
set wrapmode
datagridviewcolumn
datagridviewtristate.true
make sure set height row, or set datagridview's
autosizerowsmode
datagridviewautosizerowsmode.allcells
if don't want edit column - can set datagridview.column.readonly
property true
.
Comments
Post a Comment