DesktopListbox header

Okay I have read the documentation and I am beginning to believe it’s not possible to do what I want to do and that is ONLY bold the DesktopListbox Header. I already have certain cells being bolded based on their value as well as cell border color but I want the Text in the Header to be bold… and I can’t figure this out and I don’t see a clear reference… can it be done?

Also… does the Transparent feature not work with Linux systems? I was hoping to create a semi-transparent DesktopListbox, but it doesn’t seem to work

It used to be that you could adjust properties on the Graphics object passed to a Paint event to affect the drawing by the framework, but the documentation for PaintHeaderContent seem to imply that is not the case. However, the signature and the description conflict on the return value, so I don’t really know what to believe.

It sure would be nice if you could trust the docs, but you’re just going to have to test it.

In the DesktopListbox Opening event, do this:

me.Bold = True

Then, before writing text into the cells, in whatever method you use to do that, do:

me.Bold = False

Now: if you write all (or any of) your cell content in the CellPaint event, do this:

g.Bold = False

Seemed to work for me.

You could also try just putting

g.Bold = True

at the start of your PaintHeaderText event, and turn it off at the end.

Edit: what you are after is perfect;y do-able, my main listbox has bold headers but not the cell content.

1 Like

I’ve tried both ways and no go for Joe.

' ---- Variable Defined ----

' ---- Code In Action ----
Me.Bold = True
Me.ColumnWidths = "8%,10%,17%,10%,10%,10%,35%"  '15%,45%,20%,20%"',16%,4%"
Me.HasHeader = True
Me.HeaderAt( 0 ) = "Rec Num"
Me.HeaderAt( 1 ) = "Bill Date"
Me.HeaderAt( 2 ) = "Account Paid/Deposit"
Me.HeaderAt( 3 ) = "Amt Paid"
Me.HeaderAt( 4 ) = "Acct Bal"
Me.HeaderAt( 5 ) = "Clear Date"
Me.HeaderAt( 6 ) = "Notes"

lstExpenses.Transparent = True
Me.Bold = False
frmBills.mthLoadListBox( )

mthLoadListBox( ) does the actual loading and cell formatting I want and works perfectly. But the header still remains stubbornly not bold. I even use the PaintHeaderBackground with no luck…

' ---- Variable Defined ----

' ---- Code In Action ----
Select Case column
Case 0
  g.Bold = True
Case 1
  
Case 2
  g.DrawingColor = Color.Green
  g.FillRectangle(0, 0, g.Width, g.Height)
  Return True
Case 3
  g.DrawingColor = Color.Red
  g.FillRectangle(0, 0, g.Width, g.Height)
  Return True
Case 4
  g.DrawingColor = Color.Teal
  g.FillRectangle(0, 0, g.Width, g.Height)
  Return True
Case 5
  
Case 6
  
End Select

This is what I get:

Maybe it’s a Linux thing. Just like the transparency doesn’t work either.

Okay so I basically created my own header using Labels and setting the format the way I wanted then took the time to align each label over the appropriate column. Not how I wanted to do it… but it works!

Design View:

Running View:

I think that if you want to write something (text) on the Header you need to use PaintHeaderContent and not PaintHeaderBackground.

not the best idea with xojo…

It is a lingle line of code in the PaintHeaderContent event

Function PaintHeaderContent(g As Graphics, column As Integer) Handles PaintHeaderContent as Boolean
    g.Bold = True
End Function
1 Like