I am having a slight issue with putting a Picture into a Cell in a ListBox. The Picture is displayed too far to the Left and as a result, the Picture is cut off.
lstDeckList.RowPicture(i) = tmpCard.SmPic
The Pictures I am using are 60x88.
I have tried to Align the Column to Center and Left with no change.
The ListBox has 2 Columns. The Picture is going into Column 0 and Column 0 has a width of 20% which is more than big enough to fit the Pictures I am using. The width of the ListBox is 547.
This is the first time I am putting Pictures into a ListBox so maybe I am doing something wrong or is there a way to shift the Pictures over a bit.
Don’t use RowPicture then…
Put the picture in the ROWTAG instead (its a variant so it will store it)
Then in the CELLBACKGROUNDPAINT event… draw it whereever/however you need to.
I did this to create a Photo Gallery… worked just fine.
I works but now it puts the picture in BOTH columns.
Check the Column parameter of CellBackgroundPaint, and only draw it in Column = 0.
Can you elaborate on how to do that?
if Column = 0 then
// draw the picture
Thank you. One last question. The second column contains text, is there a way to skew the text to fit the column? I want to keep the same font size?
In CELLTEXTPAINT, use DRAWSTRING and draw the text yourself…
Don’t forget to RETURN TRUE, or the event will draw it again
What do you mean by “skew the text,” exactly?
I want to scale the text to fit the width of Column 1. I couldn’t think of the term before. I don’t want it to WordWrap. I only want to scale it horizontally, not vertically.
As a side question, can I use transparency with this?
Some years ago, I saw this as well. My project uses fixed graphics,
therefore I added a white area to the left of each graphics file to let it display correctly.
But I think I will take a look into S’s solution written in the 2nd post above, too.