Insert Picture Question

General TRichView support forum. Please post your questions here
Post Reply
Boogie

Insert Picture Question

Post by Boogie »

How do I get a newly inserted picture to be vertically aligned in the middle of the line. The image is 16x16.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Unfortunately, generally it's not possible, if you do not know text height.
Image can be positioned relative to the text base line, not relative to the middle of line. More options will be implemented in future, but not now.

Properties for vertical text positioning:
1) VAlign has 2 values:
- image bottom <-> text base line
- image middle <-> text base line.

2) More precise positioning can be done using item's extra integer properties: you can shift the picture up and down by the specified number of pixels or percents. See the help about TRVExtraItemProperty type.
jonjon
Posts: 467
Joined: Sat Aug 27, 2005 4:19 pm

Post by jonjon »

Sergey,

I don't know RV's internals but I can't see how it would be difficult to place an image at the middle of a line. As far as I can understand:
1- You can already position the image according to the base line, which means that you have a method to modify vertical position of an image after the computation of the whole line's base;
2- You obviously can separate one line from the other without overlaping, which means that you should be able to compute the line's height. Or do you use another method ?

Now knowing the line's height, why can't you modify the position of the image to place it at the middle of the line ?

I'm sure I'm missing something but I'm curious to know why this can't be so simple :?:
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Nothing too complicated, of course.
The only problem - the positioning relative to the line bottom/middle/top must be done after the calculation of the line vertical position, while baseline-related position does not require a post processing.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Update: all the information above is obsolete.

Since v1.9.16 there are new types of VAlign for images. You need rvvaAbsMiddle. No more calculations to align images to the middle!

This version is available for registered users.
Post Reply