How to create a new TextStyle property for underline color?
Posted: Mon Jan 02, 2006 8:07 pm
Hello,
i have succesfully implemented different underline schemes (e.g. double, dotted, colored, wave, etc). What i don't know is the best way to create a new style and have these data as properties.
For example, a new TFontInfo class could have 2 more properties:
- UnderlineColor
- UnderlineScheme (set of predefined values).
Then, i can use the custom drawing event to correctly paint the proper underline based on the above properties. Also, methods such as FindSuchStyle can also work.
Another question:
when i have an underline scheme that needs more than 1 pixel (e.g. a wave underline needs 4 pixels), and i use the rvsDefDrawTextBack to draw it, i cannot draw anything AFTER the default painting occurs. The problem is that if the text has a background color, then the only part i can draw to is below the line height: but in order to draw there, i need to set the LineSpacing to 3+ pixels which is not nice.
Checking at MSWord and similar apps, it seems that such multi-pixel underlines are painted within the line height and not below it. But this is not possible in that case if there is a color background because i cannot perform my custom painting after richview's painting.
Proposal: maybe there should be a way for the OnDefDrawTextBack event to be called AFTER the default painting to allow such things (or even better, be called twice with a parameter that says if it is before or after the default painting and allow for both cases)
Thanks,
Costas
i have succesfully implemented different underline schemes (e.g. double, dotted, colored, wave, etc). What i don't know is the best way to create a new style and have these data as properties.
For example, a new TFontInfo class could have 2 more properties:
- UnderlineColor
- UnderlineScheme (set of predefined values).
Then, i can use the custom drawing event to correctly paint the proper underline based on the above properties. Also, methods such as FindSuchStyle can also work.
Another question:
when i have an underline scheme that needs more than 1 pixel (e.g. a wave underline needs 4 pixels), and i use the rvsDefDrawTextBack to draw it, i cannot draw anything AFTER the default painting occurs. The problem is that if the text has a background color, then the only part i can draw to is below the line height: but in order to draw there, i need to set the LineSpacing to 3+ pixels which is not nice.
Checking at MSWord and similar apps, it seems that such multi-pixel underlines are painted within the line height and not below it. But this is not possible in that case if there is a color background because i cannot perform my custom painting after richview's painting.
Proposal: maybe there should be a way for the OnDefDrawTextBack event to be called AFTER the default painting to allow such things (or even better, be called twice with a parameter that says if it is before or after the default painting and allow for both cases)
Thanks,
Costas