Board index » cppbuilder » Coordinate line heights in side-by-side TTreeview and TRichEdit---Damon Chandler?

Coordinate line heights in side-by-side TTreeview and TRichEdit---Damon Chandler?


2005-03-19 04:23:04 AM
cppbuilder80
Hi,
We want the contents of a TTreeview component to "label" or identify the
keys for corresponding lines in a TRichedit control sitting next to it on
the form. We have the same number of visible lines in each control and
simply want them to stand side by side. Using the same font and font
size/height in both controls doesn't provide that visual alignment.
I have seen an old message from Damon Chandler in the search-newsgroups
about using CustomDraw in the TTreeview to detach the distance between
baselines from the font heights:
Quote
Usually, the height and width are implicitly set by changing the font.
However,
for TreeView controls on a target platform with comctl32 version 4.71+, you
can
use the TVM_SETITEMHEIGHT message to set the height...
#define TVM_SETITEMHEIGHT (TV_FIRST + 27)
const int new_height = 40;
SendMessage(TreeView1->Handle, TVM_SETITEMHEIGHT, new_height, 0);
For ListViews and widths, you'll need to use Custom Draw.
I've used CustomDraw with other components but not with Treeview. Does
anyone know how that would work? The +/- icons make me nervous :-) with
TTrreview. And how do we calculate the necessary adjustments from existing
data in the TRichEdit for font heights/sizes? Will that part be
experimental or is there information on the source of the difference?
Thanks in advance,
Wally Hooper
American Indian Studies Research Institute, Indiana University
 
 

Re:Coordinate line heights in side-by-side TTreeview and TRichEdit---Damon Chandler?

Hi Wally,
Getting two controls to perfectly align themselves can be tricky,
especially if different fonts come into play. Based on your
description, it sounds like there might be a better single-control-based
solution. For example, my first thought would be to scratch the
RichEdit and render everything in the TreeView (if possible). Can you
provide a screenshot (or sketch) of what you'd like your composite
control to look like?
Cheers,
Wally Hooper wrote:
Quote
Hi,
We want the contents of a TTreeview component to "label" or identify the
keys for corresponding lines in a TRichedit control sitting next to it on
the form.