• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3652
  • Last Modified:

listview "Column name" Font Change in C# windows form

i want the listview colmn name to be of font 8 and i want the rest of the rows to be of 12 font can any one can help me abt this
0
kranthi4uonly
Asked:
kranthi4uonly
  • 2
1 Solution
 
RedKelvinCommented:
Hi there,
I think you will need to start with this,
http://www.codeproject.com/cs/miscctrl/customheader.asp
0
 
RedKelvinCommented:
Ok, sorry disregard that,

you need to set ownerDraw for your listview to true, and subscribe to the DrawColumnHeader event

            this.listView1.OwnerDraw = true;
            this.listView1.DrawColumnHeader += new DrawListViewColumnHeaderEventHandler(listView1_DrawColumnHeader);

and define the event

        void listView1_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
        {
            using (StringFormat sf = new StringFormat())
            {
                // Draw the header text.
                using (Font headerFont = new Font("Helvetica", 8, FontStyle.Bold))
                {
                    e.Graphics.DrawString(e.Header.Text, headerFont,
                        Brushes.Black, e.Bounds, sf);
                }
            }
        }

http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.drawcolumnheader.aspx
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now