Forum > Beginners

TListView draw Item caption in bold


Hi all,

Sorry for my question, I'm not using Lazarus since many years.

I would like draw only the caption in bold.

For that, I use OnAdvancedCustomDrawItem :

--- 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 xxxxx.xxxxxAdvancedCustomDrawItem(  Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;  Stage: TCustomDrawStage; var DefaultDraw: Boolean);begin  // NotWorking  Sender.Canvas.Font.Style := [fsBold];   // Working  Sender.Canvas.Font.Color := clRed;end;  
For change color, it's working (Under Windows 10, Lazarus 2.0.13).

Is-it because DefaultDraw is set to true?

No luck, this is an old bug ( which has not yet been solved. (There seemed to be a solution but it turned out that it had sideeffects).

When you absolutely need the bold caption you should switch to a StringGrid in which you can control text attributes in the OnPrepareCanvas event. And this works, guaranteed!


[0] Message Index

Go to full version