dataGridView3.DefaultCellStyle.WrapMode = DataGridViewTriState.True; dataGridView3.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
private void dataGridView3_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { if (e.Value == null) return; if (e.FormattedValue.GetType() != typeof(System.String)) return; bool selected = (e.State & DataGridViewElementStates.Selected) == DataGridViewElementStates.Selected; string s = e.FormattedValue.ToString(); e.PaintBackground(e.CellBounds, selected); e.Graphics.DrawString(s, dataGridView1.Font, selected ? SystemBrushes.HighlightText : SystemBrushes.ControlText, new Rectangle(e.CellBounds.X + 1, e.CellBounds.Y + 2, e.CellBounds.Width - 2, e.CellBounds.Height - 4)); e.Handled = true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)