Blog First. Ask Questions Later.
Say you have a user control that contains some other web controls, such as a text box or drop down list. Now say that you want the UI designer to be able to set the font properties of the contained controls, by setting the font properties of the control in the designer. Well, if you've ever tried this:
this.myContainedControl.Font = this.Font;
You'll find that the Font property is read only. You can set the individual properties, but this would be a pain for all of the properties that the FontInfo object supports. Luckily, the FontInfo object has a CopyFrom method, which you can use to do accomplish this task in one fell swoop:
this
.myContainedControl.Font.CopyFrom(this.Font);
Music tip o' the day: If you like REM, check out Placebo
About Brendan Tompkins
Brendan has been programming with .NET since the first public beta and is owner and operator of Port Technology Services, a consultancy company providing .NET application development services to the Maritime industry. In July, 2007, he was awarded the Microsoft MVP award for ASP.NET.
He's also a proud co-founder of failed .COM startup Intrinsigo, and has had a hand in the failure of numerous other businesses.
He currently runs CodeBetter.Com and Devlicio.us, and lives in Norfolk, Virgina with his wife Tiara and son Ian.