Click here to Skip to main content
15,922,650 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to set backcolor for a particular cell in a tablelayoutpanel during runtime? If the user clicks particular cell, that cell should show some color. So that user know that the particular cell is selected. This should be done dynamically..

Dont need to selected entire row or column,only particular cell...

How can I achieve this?
Posted

The following will set the background color of the cell at 1, 1 to brown:


private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e) {
       if (e.Column == 1 && e.Row == 1) {
           e.Graphics.FillRectangle(Brushes.brown, e.CellBounds);
       }
   }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900