[Solved] Alter row height in dbgrid without altering the height of titles lazarus / 31-LCL ---------------------------------------------------------------------- Ever · 2019-07-28 16:00 Regards    As the subject says, I need to alter the height of the rows in a dbgrid without altering the height of the titles. Modifying the DafaultRowHeight property alters the height of both the rows and the titles and I don't want that, I need the height of the titles to remain fixed. For example: high of the rows: 40, high of the titles: 20. That is possible. Thanks in advance for the support you can provide ---------------------------------------------------------------------- jamie · 2019-07-28 16:47 Try RowHeights [ 0 ]  := SomeIntegerValue; I don't know if it's exposed in the DBgrid. Put this at the top of your source in the type section Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  TMyCustomGridHack = Class(TCustomGrid)   Public     Property RowHeights; end;                       and this is a test button run.. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);begin  TMyCustomGridHack(DBGrid1).RowHeights[0] := 20;  DBgrid1.Update;end;       I tried that with a blank DBGrid and didn't see it change but the grid may need to have something in it..  The RowsHeights array do change and maintain the height value..  It's possible I guess the DBGrid could be overriding something but one can never know until we try   I just noticed you can use the TCustomDrawGrid(DBGrid1).RowHeights[ 0 ] := ? ---------------------------------------------------------------------- Ever · 2019-07-29 03:08 Thanks for your response  I used TCustomDrawGrid and achieved what I wanted, I implemented it as follows, I don't know if it's the right one but it worked. In the type section carry out the following statement, I put part of the code that is before and after so you can get an idea of where to locate it Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type   { Tfsms }                            TMyCustomGrid = Class(TCustomDrawGrid);  Tfsms = class(TForm)     BCMaterialDesignButton1: TBCMaterialDesignButton;    BCPanel1: TBCPanel;    BCPanel2: TBCPanel;    benviar: TButton;    blimpiar: TButton;    DBGrid1: TDBGrid;    dssms: TDataSource;    ebcodcli: TEdit;     then in the activate event of the form, I wrote the following Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TMyCustomGrid(DBGrid1).RowHeights[0]:=20;  doing it that way, it worked perfectly, but the compiler throws me the following warning... Class Type "TDBGrid" and "TMyCustomGrid"  are not related If I implement it badly, I ask you please indicate the correct way to do it.  Thanks for the support ---------------------------------------------------------------------- jamie · 2019-07-29 20:51 you don't need to recreate that in your source.. Simply use the TCustomDrawGrid(DBGrid1)./…. you don't need to declare any types in your source, these types already exists... ---------------------------------------------------------------------- devEric69 · 2019-07-30 09:12 A little tip for the RowHeights number 0 for titles, to assign it taking into account the letters: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i RowHeights[0]:= (Canvas.TextHeight('Ŵg') + 4) * iMaxNumberOfLinesInTitles; ---------------------------------------------------------------------- Ever · 2019-08-01 00:28 Jamie thanks for the support provided, I deleted the statement and only implemented the TCustomDrawGrid line (DBGrid1) ./…. It is working very well. devEric69 thanks for the tip, I will take it into account. regards