If you have a control that is using a font with size 8.25 (which was defined at design-time), then at runtime you want to change it to a different size (such as 12), you cannot simply say:
ctrl.Font.Size = 12 (this will not work - Property Size is Read-Only)
However, you can replace the whole font:
ctrl.Font = new Font(ctrl.Font.FontFamily, 12, ctrl.Font.Style)
For more info and examples in C#, see: http://bytes.com/forum/thread261450.html
5 comments:
Hi!
This was a great example, i was working on a listbox where i needed to be able to change the fontsize in runtime and after hours of searching the net i found this.
Thank you very much!
hi=) ..tnx 4 the gud example!! more power..its a great help!
thk u vry mch=)...
Great. Thanks. This realy helps my school project =D
Thanks.. It helped me a lot..
Great help! Good contribution...
Post a Comment