Roland Bengtsson
Roland Bengtsson

Reputation: 5158

Use custom font in Devexpress columns headerhint

I use D2007 and Devexpress QuantumGrid v2011 2.3. I want to assign the columns headerhint in code like this.

colGoodsMasks.HeaderHint :=
Format('%s %-30s %-30s%s' +
'%s %-30s %-30s%s' +
'%s %-30s %-30s%s' +
'%s %-30s %-30s%s' +
'%s %-30s %-30s%s' +
'%s %-30s %-30s%s' +
'%s %-30s %-30s%s' +
'%s %-30s %-30s%s' +
'%s %-30s %-30s%s' +
'%s %-30s %-30s%s' +
'%s %-30s %-30s%s' +
'%s %-30s %-30s%s',
['! ', 'Parcel', 'Express goods', sLineBreak,
'*', 'Parcel', 'Require cold transport', sLineBreak,
'¤', 'Parcel', 'Require heat transport', sLineBreak,
'€', 'Parcel', 'Fragile goods', sLineBreak,
'A', 'Party role', 'Sender', sLineBreak,
'M', 'Party role', 'Receiver', sLineBreak,
'S', 'Party role', 'Seller', sLineBreak,
'K', 'Party role', 'Buyer', sLineBreak,
'/', 'Party property', 'Require tail lifter', sLineBreak,
'1⁄2', 'Party property', 'Require only hauler', sLineBreak,
'¿', 'Party property', 'Require (un)loading from top', sLineBreak,
'%', 'Party property', 'Require (un)loading from back', sLineBreak,
'@', 'Party property', 'Require Avi', sLineBreak]);

The result should be 3 left justified columns in the hint but the margin is not straight. I think it is because the font is proportional. How can I change font in the hint so the margins is straight?

EDIT1: Got this from the doc:

Whenever an active hint style controller with the Global property set to True is present within an application, each control that shows its hints uses this hint style controller's style unless another (which is called “local”) hint style controller is defined within the form.

But I don't want to change font on any other hints in the application or in this form. Maybe I have to use a HitTest for this and call ShowHint ? But not sure how to implement this.

GridHint

Upvotes: 0

Views: 825

Answers (1)

Sam M
Sam M

Reputation: 4166

Use a TcxHintStyleController instance. Then change the HintStyle.CaptionFont property to a monospaced font.

Upvotes: 2

Related Questions