About changing a control's font .

Adel 21 Reputation points
2022-03-29T11:32:11.93+00:00

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

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,835 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,277 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 81,741 Reputation points
    2022-03-29T12:37:21.55+00:00

    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)