Exemple #1
0
        // Shared initialization code
        void Initialize()
        {
            Title = "Nevron Open Vision Examples";
            SetFrame(NSScreen.MainScreen.VisibleFrame, true);

            //NUISettings.EnableMultiThreadedPainting = false;
            //NUISettings.EnablePaintCache = false;

            // place the host inside the mac window
            NNovWidgetHost widget = new NNovWidgetHost(new NExamplesContent());

            ContentView = widget;
        }
Exemple #2
0
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                // install Nevron Open Vision for Windows Forms
                NNovApplicationInstaller.Install(
                    NTextModule.Instance,
                    NChartModule.Instance,
                    NDiagramModule.Instance,
                    NScheduleModule.Instance,
                    NGridModule.Instance,
                    NBarcodeModule.Instance);

                // show the main form
                bool startWithNovWindow = false;
                if (startWithNovWindow)
                {
                    // create a NOV top level window
                    NTopLevelWindow window = NApplication.CreateTopLevelWindow();
                    window.BackgroundFill = new NColorFill(NColor.White);
                    window.Content        = new NExamplesContent();
                    window.Closed        += OnWindowClosed;
                    window.Title          = "Nevron Open Vision Examples for Windows Forms";
                    window.AllowXResize   = true;
                    window.AllowYResize   = true;
                    window.ShowInTaskbar  = true;
                    window.Modal          = true;
                    window.PreferredSize  = new NSize(500, 500);
                    window.StartPosition  = ENWindowStartPosition.CenterScreen;
                    window.Open();

                    // run the application
                    ApplicationContext context = new ApplicationContext();
                    Application.Run(context);
                }
                else
                {
                    // create a WinForms form
                    Form form = new Form();

                    // set form icon
                    using (Stream stream = typeof(Program).Assembly.GetManifestResourceStream("Nevron.Nov.Examples.WinForm.Resources.NevronOpenVision.ico"))
                    {
                        Icon icon = new Icon(stream);
                        form.Icon = icon;
                    }

                    // set form title and state
                    form.Text        = "Nevron Open Vision Examples for Windows Forms";
                    form.WindowState = FormWindowState.Maximized;

                    // place a NOV WinForms Control that contains an NExampleContent widget
                    NNovWidgetHost <NExamplesContent> host = new NNovWidgetHost <NExamplesContent>();
                    host.Dock = DockStyle.Fill;
                    form.Controls.Add(host);

                    // run the form
                    Application.Run(form);
                }
            }
            catch (Exception ex)
            {
                NTrace.WriteException("Exception in Main", ex);
            }
        }