[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 12[3]45678910 ]

[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 05:38:26 06/13/03 Fri
Author: Joan Leser
Subject: Center Canvas & TListview in Builder


I'm programming in BCB6 a componente derivated from TListBox. What I'm trying to do, is to put the strings in the objetc, centered inside the Canvas.

For example; I have one TListBox with an Height of 100. But i only have one Item, so I don't want that it displays in the top. I would want that it displays in the middle of the control, about in the pixel 40 of "y", so it looks more centered.

I set the Style variable to lbOwnerDrawVariable, and I created a DrawItem method wich override the original one. Realize that I'm developing a component itself, not an application. In fact, the MoveTo() and Draw() methods wich I use, was called from the DrawItem method of the component.

Also, if I add some Items in tne first positions of the ListBox, then the user can select some "white blanks", so it isn't what i want.

I tried to down the Canvas by making some like:

Canvas->TextOut(Rect.Left, Rect.Top+OFFSET, Items->Strings[Index]);

But although in that way, the text of the ListBox appears at Y+Offset, the selection of the item is done at (Rect.Left, Rect.Top), so if you click in the text, you get nothing, because the control only understands clicks in their correct place.

Please, how can I center the items in the Y axis? Is it possible?

Joan Leser

[ Next Thread | Previous Thread | Next Message | Previous Message ]

[ Contact Forum Admin ]

Forum timezone: GMT-5
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.