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:

  1. set wrapmode datagridviewcolumn datagridviewtristate.true

  2. 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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -