let say i need to create a cpu simulator and i need 32 registers, to make the demonstration i need 32 labels and let say i want those labels background color to be white, what should i do to avoid repetation of setting properties to labels?
serkan sendur
821
Postaholic
Banned
Recommended Answers
Jump to PostYou can write below code and call it in form load or in the constructor.
Just a demonstration.foreach(Control c in Controls) { if ( c is Label ) { c.BackColor = Color.White; } }
Jump to PostAnd I think it's the only solution if you don't need to use Themes, etc.. because .net controls is sealed; you can't inherit from and do some changes.
Jump to Post1- Search on theming and skeining product and see the read me file.
Really, I didn't use such methodology in work, usually I don't interfere with UI process.
All 10 Replies
Ramy Mahrous
401
Postaholic
Featured Poster
serkan sendur
821
Postaholic
Banned
Ramy Mahrous
401
Postaholic
Featured Poster
serkan sendur
821
Postaholic
Banned
Ramy Mahrous
401
Postaholic
Featured Poster
ddanbe
2,724
Professional Procrastinator
Featured Poster
serkan sendur
821
Postaholic
Banned
Ramy Mahrous
401
Postaholic
Featured Poster
serkan sendur
821
Postaholic
Banned
ddanbe
2,724
Professional Procrastinator
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.