Forum > General
TSringgrid first row, multi line
(1/1)
Hansvb:
Hi,
How can I create a TStringgrid header column 2 lines?
I have this as a quick test but i see still 1 line:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFrm_Main.Button1Click(Sender: TObject);var i : integer;begin StringGridMain.RowHeights[0] := 38; for i:=0 to StringGridMain.Columns.Count-1 do begin StringGridMain.Columns[i].Title.MultiLine := true; end; StringGridMain.Cells[1, 0]:='Max. verschil' + LineEnding + 'in dagen.'; StringGridMain.Repaint;end;
paweld:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject);var i: Integer;begin StringGridMain.RowHeights[0] := 38; for i := 0 to StringGridMain.Columns.Count - 1 do StringGridMain.Columns[i].Title.MultiLine := True; StringGridMain.Columns[1].Title.Caption := 'Max. verschil' + LineEnding + 'in dagen.';end;
Hansvb:
I see what is changed. I didn't select the right column. But now I get a list index out of bounds error. No matter what column I choose. I have 10 columns and 10 rows.
The columns.count gives always 0 even I see 10 columns.
bytebites:
Columns need to be added using object inspector or programmatically.
paweld:
If you are not using columns, then setting the Multiline property does not change anything.
You can do this in two ways:
- by adding columns and setting the Multiline property to True
- setting the DrawCell event (if you are not using columns)
Sample in attachment.
Navigation
[0] Message Index