How to get the Enviroment Font information of Visual Studio in real time .

Vasu Bansal 0 Reputation points
2025-02-27T05:24:26.1166667+00:00

I want to get the real time latest Environment font information of visual studio using c# dot net. Is there any listeners available and a method to get the latest current visual studio environment font information I am calling this method

System.Drawing.Font font = VsShellUtilities.GetEnvironmentFont();

var fontfamily = font.Name;

var fontsize = String.Format("{0}pt", font.SizeInPoints);

in the VSColorTheme.ThemeChanged event it also some how listens the font change event also but the problem with this is when we change the font 1st time it does not give me the latest value from 2nd time onwards if i change it works fine. and also if i change the theme first and then onwards I change the fonts it works fine everything is in real time i am talking about.

C#, visual studio 2022

Visual Studio Extensions
Visual Studio Extensions
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Extensions: A program or program module that adds functionality to or extends the effectiveness of a program.
249 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.