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
How to create a new TextStyle property for underline color?
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
You can create a new component inherited from TRVStyle having text styles with additional properties.
Create a new class inherited from TFontInfo having new properties.
In you new RVStyle component, override GetTextStyleClass method to return your FontInfo class instead of TFontInfo.
Example: http://www.trichview.com/support/files/neweffects.zip
I am afraid, postpainting is not possible in the current version. You need to draw the whole item text yourself instead.
Create a new class inherited from TFontInfo having new properties.
In you new RVStyle component, override GetTextStyleClass method to return your FontInfo class instead of TFontInfo.
Example: http://www.trichview.com/support/files/neweffects.zip
I am afraid, postpainting is not possible in the current version. You need to draw the whole item text yourself instead.
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: