Solved

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

Posted on 2007-11-14
2
3,346 Views
Last Modified: 2013-12-17
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
Comment
Question by:kranthi4uonly
  • 2
2 Comments
 
LVL 22

Expert Comment

by:RedKelvin
ID: 20285124
Hi there,
I think you will need to start with this,
http://www.codeproject.com/cs/miscctrl/customheader.asp
0
 
LVL 22

Accepted Solution

by:
RedKelvin earned 500 total points
ID: 20285185
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best resource to learn entity framework 2 33
converto datetime always changes format 9 35
2 questions 10 25
What can cause the styling on a .NET site to not be found? 17 25
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question