Hello fellow programmers!
I am new to events and delegates, so any help with the following problem would be greatly appreciated.
I need to update a column of a tableLayoutPanel after clicking a different button in the UI. I have started with the code from another post (thanks to Bob zhu - MSFT):
void Form122_Load(object sender, EventArgs e)
this.tableLayoutPanel1.CellPaint += new TableLayoutCellPaintEventHandler(tableLayoutPanel1_CellPaint);
void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
if (e.Row == 0 || e.Row == 2)
Graphics g = e.Graphics;
Rectangle r = e.CellBounds;
new SolidBrush(Color.Blue), r);
Now, instead of using
Form_Load(object sender, EventArgs e)
I need to use
Button1_Click(object sender, EventArgs e)
So, I think the problem is that the sender is different in both cases, and so are the EventArgs. How can this be overcome?
Thank you so much for your help
-Dave