Nevron Open Vision Documentation
Integrating NOV in Windows Forms

There are two ways in which NOV can integrate in a WinForms application - by dragging and dropping NOV controls from the toolbox (Designer Integration) and by writing code (Code Integration).

The integration 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.
If you are using Visual Studio 2010 make sure that you target ".NET Framework 4.0" not ".NET Framework 4.0 Client Profile". 
Designer (Toolbox) Integration

You can simply drag and drop NOV controls from the Visual Studio Toolbox. The Visual Studio Designer will automatically add the necessary dll references to your project and you can start coding directly. The following code snippet shows how to say "Hello World from Nevron Open Vision" using this type:

1. Drag and Drop the NLabelControl from the "Nevron NOV Controls" toolbox category to the form.

2. Write the following code in the Form Load event handler

Installing NOV in Windows Forms
Copy Code
private void Form1_Load(object sender, EventArgs e)
nLabelControl1.Widget.Text = "Hello World from NOV";

That's it - you have created your first WinForms application using a NOV control. For more information check out the Integrating NOV from the Visual Studio Toolbox topic.

Coded Integration

With this type of integration you write the code needed to add NOV controls to the WinForms form. This approach allows you to create interfaces that can easily be ported to Mac. Another benefit from this aproach is that you can create heavier interfaces (with many NOV controls).

The steps to use in this case are:

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:

  • Nevron.Nov.Presentation.dll - Core NOV assembly.
  • Nevron.Nov.Host.WinBase.dll - base assembly for Windows presentation hosts (WinForm and WPF). 
  • Nevron.Nov.Host.WinForm.dll - presentation host for WinForm. 
  • Nevron.Nov.Barcode.dll - NOV Barcode.
  • Nevron.Nov.Chart.dll - NOV Chart.
  • Nevron.Nov.Diagram.dll - NOV Diagram.
  • Nevron.Nov.Grid.dll - NOV Grid.
  • Nevron.Nov.Schedule.dll - NOV Schedule.
  • Nevron.Nov.Text.dll - NOV Text.

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 Nevron.Nov;
using Nevron.Nov.Barcode;
using Nevron.Nov.Chart;
using Nevron.Nov.Diagram;
using Nevron.Nov.Grid;
using Nevron.Nov.Schedule;
using Nevron.Nov.Text;
using Nevron.Nov.Windows.Forms;
using System;
using System.Windows.Forms;
namespace WindowsFormsApp5
    static class Program
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
            // 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[] {
            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()
            // clear all controls from the form
            // 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. The sample just makes a simple label, as content of the NNovWidgetHost WinForms Control, but this control can actually contain any NOV widget. See the UI Overview topic for an overview of the User Interface that comes along with NOV.

See Also


Send Feedback