Nevron Open Vision Documentation
Hosting NOV in Windows Forms
The hosting of NOV in your application is by default performed by NOV project templates. If you are using project templates you can skip this documentation topic.

1. Create a new WinForm project in Visual Studio

This step is not mandatory, because you can integrate NOV in an already existing WinForm project. It is performed just for the purpose of making a complete installation scenario.

2. Reference the NOV Assemblies

Ensure that your application references the following NOV dlls:

3. Initialize the NOV Application

Open the Program.cs file and ensure that the NNovApplicationInstaller.Install() method is called before the WinForm application runs the main form of the application.

Installing NOV for Windows Forms
Copy Code
using System;
using System.Windows.Forms;
using Nevron.Nov;
using Nevron.Nov.Windows.Forms;
namespace WindowsFormsApplication1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Apply license for redistribution here. You can skip this code when evaluating NOV.
            NLicenseManager.Instance.SetLicense(new NLicense("LICENSE KEY"));
            // Install NOV
            NModule[] modules = new NModule[] {
                // TODO: Create modules here
            };
            NNovApplicationInstaller.Install(modules);
            Application.Run(new Form1());
        }
    }
}
See Hosting NOV in your Application for more information about modules.

4. Say Hello World from NOV

Open the Form1.cs file and replace its content with the following code:

Say Hello World from NOV
Copy Code
using System.Windows.Forms;
using Nevron.Nov.UI;
using Nevron.Nov.Windows.Forms;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            // clear all controls from the form
            Controls.Clear();
            // Add a NOV widget inside the form
            NLabel sayHelloWorld = new NLabel("Hello World from Nevron Open Vision");
            Controls.Add(new NNovWidgetHost<NLabel>(sayHelloWorld));
        }
    }
}

Run the application - it should display a simple form with a "Hello World from Nevron Open Vision" label inside.

This is as much as is required to host some NOV content in Windows Forms. From now on you can forget everything you know about Windows Forms, since you will not need it when developing with NOV.

The sample just makes a simple label, as content of the NNovWidgetHost WinForms Control, but this control actually contain any NOV widget. See the UI Overview topic for an overview of the User Interface that comes along with NOV.

Send Feedback