c# - In my VS extension, how can I programmatically preview a file in Visual Studio 2015/2017? -
in visual studio extension display related files.
i have code can open file in visual studio.
i want code can preview file
this code use open file using dte2 object. how can preview file?
public void viewfile(fileinfo file) { if (null == file) throw new argumentnullexception(nameof(file)); var dte2 = (envdte80.dte2)dte; dte2.mainwindow.activate(); var newwindow = dte2.itemoperations.isfileopen(file.fullname) ? findwindow(file.fullname) : dte2.itemoperations.openfile(file.fullname); newwindow.activate(); }
this previewed file, if single click in solution explorer:
this opened file, if double click in solution explorer, or make change previewed file:
Comments
Post a Comment