I don't know how to do this in Visual Studio, but I know you can achieve this by using doxygen and Graphviz .
These SO posts might be of great help:
How to use doxygen to create UML class diagrams from C++ source
Graphviz + Doxygen to generate UML class diagrams
I also found this tool online: https://code.google.com/archive/p/doxygraph/
Never tested it but based on its description it seems to do exactly what you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.