Hi,
I’m trying to draw a rectangle and put a string there in the Cell of the ListBox.
With below code, I can draw it.
Open event
Listbox1.AddRow str(0)
dim p as new Picture(200,50,32)
p.Graphics.ForeColor = &C92B92C
p.Graphics.FillRect(0,0,200,50)
p.Transparent=1
Listbox1.CellTag(0,0) = p
Listbox1.Cell(0,0) = "Service Normal"
CellTextPaint
dim p as Picture = me.CellTag( row,column )
g.DrawPicture p,0,0
g.DrawString me.cell(row,column),x,y
Return true
Question:
- In fact, there is already a row data in the Cell. However, even though I tried to use ’ p.Transparent=1’, I don’t see the string in the rectangle so that’s why I should use ‘g.DrawString’.
Is it expected? - With g.DrawString, the String starts from the first pixel of the Cell. I want to put the String in the center of the Cell like AlignCenter. How can I do that?