question

dzAdel avatar image
0 Votes"
dzAdel asked dzAdel commented

About changing a control's font .

In Windows Forms, when changing a control's font, does the control dispose the old one automatically?
If so, what if this font (the old one) is used elsewhere?
Thanks

dotnet-csharpwindows-forms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Castorix31 avatar image
0 Votes"
Castorix31 answered dzAdel commented

It disposes the current font handle and sets the new font handle to the control with WM_SETFONT
You can see the source in control.cs, but not easy to folllow (search the calls to DisposeFontHandle)



· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks.
so, if i need to use the font after the control destruction, i have to create it as many time as necessary!

0 Votes 0 ·

The Font itself is not destroyed
If you test with a global Font that you set to a control that you destroy, and to other controls too, the font won't be destroyed

1 Vote 1 ·

Ok
Thanks

0 Votes 0 ·