winforms - How to change listview header's forecolor? C# windows form application -



winforms - How to change listview header's forecolor? C# windows form application -

i know can alter ownerdraw property true , handle drawcolumnheader event if this, have take care of in drawing header.

is there anyway alter foreground color , else drawn defaults?

how this:

create new winform project, drag listview command onto form, set ownerdraw = true, view = details in properties pane, handle drawcolumnheader event.

namespace windowsformsapplication1 { public partial class form1 : form { public form1() { initializecomponent(); this.setlastcolumnwidth(); this.thelistview.layout += delegate { this.setlastcolumnwidth(); }; } private void setlastcolumnwidth() { // forcefulness lastly listview column width occupy // available space. this.thelistview.columns[ this.thelistview.columns.count - 1 ].width = -2; } private void listview1_drawcolumnheader( object sender, drawlistviewcolumnheadereventargs e ) { // fill header background solid yello color. e.graphics.fillrectangle( brushes.yellow, e.bounds ); // allow listview draw else. e.drawtext(); } } }

c# winforms visual-studio listview

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -