Application creation

<< Click to Display Table of Contents >>

Navigation:  Gnostice Document Studio .NET > Getting Started > Document Viewing > WinForms >

Application creation

 

Document Studio product installer demo source path: “%USERPROFILE%\Documents\Gnostice\Document Studio .NET\Demos\”

 

 

 

Steps to create a basic Windows Forms document viewer application.

1.Open Visual Studio and create a new WinForms application.

2.Use either the GUI or the Package Manager Console and install the Gnostice.DocumentStudio.WinForms NuGet package.

3.Build the application.

4.Adding the control to the toolbox

a.For Visual Studio 2017 and later: Nothing to be done, the control automatically appears on the Toolbox under tab titled Gnostice Document Studio .NET.

b.For Visual Studio 2015 and earlier

i.In the toolbox, add a new tab titled Gnostice Document Studio .NET

ii.On this tab, add the Gnostice.Controls.WinForms.dll assembly from the bin\debug or bin\release folder of your project. This will add a new DocumentViewer control to the tab.

5.Drag the DocumentViewer control on to the form.

6.Add a button to the form.

7.Arrange and size the controls to your liking.

8.Double-click the button and add the following code for the "button click" event handler.

 

 

    // Load a document and display it
    // Provide the file name with path
    documentViewer1.LoadDocument("sample_file.docx");

 

 

9.Replace sample_file.docx in the LoadDocument() method with the fully qualified file name of any supported document format file on your computer.

10.Build the project and run.