I have come very close to finding a solution to this one; just missing one minor detail at this point.
What I am trying to do:
I want to change the cursor style of every button on my Form (Form1) through code. I know how to search through all controls on my form using foreach, but I'm not sure how to pass this control as a parameter through the routine that I wrote. I will show an example of what I am doing below.
private void Form1_Load(object sender, EventArgs e)
{
foreach (Button b in this.Controls)
{
ChangeCursor(b); // Here is where I'm trying to pass the button as a parameter. Clearly this is not acceptable.
}
}
private void ChangeCursor(System.Windows.Forms.Button Btn)
{
Btn.Cursor = Cursors.Hand;
}
Might anyone have a tip for me?
Thank you very much
Evan
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…