Link to home
Create AccountLog in
Avatar of KzKrew
KzKrewFlag for United States of America

asked on

VB.Net ListView Grouping Font Size / Font Bold

I am using the following sub in VB.Net to group data in a Windows Forms ListView.

Passing the data to sub from MySql query. I have been able to group the data by Employee Number - Name as shown in the image below:

My question is How to Make the header stand out more. 

The first header 474 Blake, Jorge font is Too small -- have not been able to figure out how to make bigger or possibly Bold it. I have tried making the text size within the ListView object bigger but has no effect on the grouping text size.

Let me know how to resolve

Thanks  - Dan



    Public Sub GroupByEmpNo(ByVal lstV As System.Windows.Forms.ListView, ByVal SubItemIndex As Int16)
        Dim flag As Boolean = True         For Each l As ListViewItem In lstV.Items             Dim strmyGroupname As String = l.SubItems(SubItemIndex).Text             For Each lvg As ListViewGroup In lstV.Groups                 If lvg.Name = strmyGroupname Then                     l.Group = lvg                     flag = False                 End If             Next             If flag = True Then                 Dim lstGrp As New ListViewGroup(strmyGroupname, strmyGroupname)                 lstV.Groups.Add(lstGrp)                 l.Group = lstGrp             End If             flag = True         Next     End Sub

Open in new window


User generated image


Avatar of Kelvin McDaniel
Kelvin McDaniel
Flag of United States of America image

Depending upon what Windows Desktop version your executable is targeting, you might be able to do this with Visual Styles. I say "might" because I'm not intimately familiar with this functionality. I was able to dig up the following reference that might point you in the right direction:

VisualStyleElement.ListView.Group Class

https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.visualstyles.visualstyleelement.listview.group?view=windowsdesktop-5.0

Good luck!
Avatar of KzKrew

ASKER

Yes -- i did see that one but focus is C#
Does anyone have a VB.Net solution
Dan
You can change the selected language from C# to VB as shown below.
User generated image
ASKER CERTIFIED SOLUTION
Avatar of KzKrew
KzKrew
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account