c# - Enable listview columHeader checkBox Click -


here wants have checkbox in listview header. , wrote below code that, can me out here enable check-box .

now able see checkbox- not click on it. has idea on , can handled listview3_columnclick event..?? in advance.

private void listview3_drawcolumnheader_1(object sender, drawlistviewcolumnheadereventargs e)      {          textformatflags flags = textformatflags.leftandrightpadding;         e.drawbackground();          //checkboxrenderer.drawcheckbox(e.graphics, clientrectangle.location, system.windows.forms.visualstyles.checkboxstate.uncheckednormal);         checkboxrenderer.drawcheckbox(e.graphics, clientrectangle.location, textrectangle, "", this.font, textformatflags.horizontalcenter, clicked, state);          e.drawtext(flags);     } 

i think have got

private void listview_columnclick(object sender, columnclickeventargs e)     {         if (!clicked)         {             clicked = true;             state = checkboxstate.checkedpressed;                foreach (listviewitem item in listview.items)             {                 item.checked = true;             }              invalidate();         }         else         {             clicked = false;             state = checkboxstate.uncheckednormal;             invalidate();              foreach (listviewitem item in listview.items)             {                 item.checked = false;             }         }                } 

wheres state => private checkboxstate state = checkboxstate.uncheckednormal;


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -