Quantcast
Viewing all articles
Browse latest Browse all 3747

How do I right align header text in a desktoplistbox + change the text color?

I have a (sub classed) DeskTopListBox with 4 columns. Two columns contain numbers and right align. The header text of course follows the Left/Right align of the rows below the header.
I use a method with (simplified here):

MyListBox.ColumnAlignmentAt(3) = DesktopListBox.Alignments.Right MyListBox.ColumnAlignmentAt(4) = DesktopListBox.Alignments.Right

Now I want to give the header text a slightly different color. I didn’t find a convenient font.color property for the header, but found in this forum some PaintHeaderContent EventHandler code:

g.DrawingColor = MyColor
Var y As Double = (g.Height - g.TextHeight)/2 + g.FontAscent
g.DrawText(Me.HeaderAt(column),5,y, g.width -10, True)

It works, except for the right alignment in the header. It looks I have to change the x-value 5 to a bigger value for the right align columns, but how do I retrieve the width of the header text (like in the y-value)?

Off topic, but related: Why isn’t there a simple property for the text color and the alignment in Xojo? Yes, it is very flexible as it is now, but it comes at a “diffuculty-cost”.

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 3747

Trending Articles