Board index » cppbuilder » Customdraw, a few questions

Customdraw, a few questions


2006-10-25 03:47:20 AM
cppbuilder28
When customdrawing on a control, is it possible that someone can
explain a few things to me please.
Since I am trying to do different things with a listview, I will
ask questions pertaining to a listview.
Lets say that I want to draw some items on a Listview grid, with
the code that Gambit posted for me with the progressbar, it
looks really simple and makes you want to experiment more. But
I want to ask these just in case I am not understanding
something.
When you use the following code to get the rectangle of the
listitem: TRect ItemRect = Item->DisplayRect(drBounds);
If I want to place an icon before the text, do I just leave a
certain amount of spaces for the icon then write the text? I
ask this because I have seen some code that uses a lot of
calculations to know where to put the text for the entire row.
When looking at code like that I never understand it at all, but
looking at the code that I have makes it seem so simple to understand.
From what I read in the help file, this code just gets the
rectangle of the current item: TRect ItemRect = Item->DisplayRect(drBounds);
I guess I am not asking what I am trying to ask very clearly,
maybe I better experiment first, then ask the question when I
get stuck.
 
 

Re:Customdraw, a few questions

"Newbie" < XXXX@XXXXX.COM >wrote in message
Quote
When you use the following code to get the rectangle of the
listitem: TRect ItemRect = Item->DisplayRect(drBounds);

If I want to place an icon before the text, do I just leave a
certain amount of spaces for the icon then write the text?
Yes. Although, you would have to set DefaultDrawing to false and draw teh
text yourself, since you are putting it in a non-standard position.
Otherwise, just use the icon support that the ListView already has. List
items can already display icons in front of their text without owner-drawing
them.
Quote
From what I read in the help file, this code just gets the
rectangle of the current item: TRect ItemRect =
Item->DisplayRect(drBounds);
The drawing events are triggered on a per-item basis. The code is
calculating and drawing the Item that the event specifies needs drawing.
Gambit
 

Re:Customdraw, a few questions

Quote
>If I want to place an icon before the text, do I just leave a
>certain amount of spaces for the icon then write the text?

Yes. Although, you would have to set DefaultDrawing to false and draw teh
When setting the defaultdraw to false, doesn't that make it
difficult when selecting the entire row. That is what I had a
problem with the first time before you helped me out. The
selected row would not highlight the area that I had to write
in.
Quote
Otherwise, just use the icon support that the ListView already has. List
Hmm, I didn't think that would work. I had tried doing that
before but I could never it to work. I don't remember exactly,
but I think when you don't use an icon, there is a blank space
before the text, and it looks different.
Is there any way to set the checkbox to another column besides
the first?
I am really trying to make this as easy as possible, this way
I would understand a lot more of exactly how to do this on my
own.
Thanks again
 

{smallsort}