Forum > Editor

How to change color for only one character?



I have one problem. I'm doing a calendar. For showing days of the selected month I chose table. Problem appeared when I wanted to change color of the dates that are showing sundays or holidays.

I tried font.color but this didn't work because all the text went from default color to color I chose and not just one character.

I'm hoping that someone knows how to change color just for one character.


You need OwnerDraw for this (but I don't know if it is suppoerted yet)

Start your own component and draw that character in your favourite color as well as the grid (or whatever).
Use the canvas Font, Pen, Brush properties and draw Text and Lines.
It should be a little work but look at other custom components source code.
Delphi's DBGrids (i don't know about String or Draw Grid) support changing the column color so you could change the color for sundays, i didn't test this in Lazarus yet.


[0] Message Index

Go to full version