Showing results 1 to 8 of 8

Thread: C# form on screen

  1. #1
    Join Date
    10.12.2010
    Posts
    55

    Default C# form on screen

    Hello
    I would like to know if its possible to embed a C# winform (vsta) on a screen? The only way I can seem to work with winforms is in a popup.

    Is there other ways?
    Best Regards
    Brian

  2. #2
    martins Gast

    Default Re: C# form on screen

    hi,

    embedding a form as a WPF element or as an ActiveX into the runtime would be two possibilities.

    best regards

  3. #3

    Default Re: C# form on screen

    Hi,

    Have a look at the "Information Unlimited" magazines, editions 17, 18 and 20, where you can find three articles how you can use a .NET form in zenon.

    You can download the information unlimited magazines from the website as .PDF files.

    Best regards,
    mark

  4. #4
    Join Date
    10.12.2010
    Posts
    55

    Default Re: C# form on screen

    Thanks alot
    I will start to read the Information Unlimited magazines. Is there an overview, preferably an rss feed, that describes the content of each magazine?

  5. #5

    Default Re: C# form on screen

    Hi Brian,

    Unfortunately there is no such thing as an article index, however I do like the idea and will pass on this suggestion.

    In the meantime, it may be the easiest to download all .pdf files into a directory, and perform a search inside the .pdf files if you are after something specific.

    Best regards,
    Mark

  6. #6
    Join Date
    10.12.2010
    Posts
    55

    Default Re: C# form on screen

    Hi again
    Are there anywhere else I can find this information? It is extreamly hard to get any information out of the screenshots because they are so small and when Im zooming in the quality degrates. Im looking at IU17 page 27.

  7. #7
    Join Date
    10.12.2010
    Posts
    55

    Default Re: C# form on screen

    For future reference, this seems to be what you should add in step 5

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    using Microsoft.Win32;
    using System.Reflection;
    
    [assembly: ClassInterface(ClassInterfaceType.AutoDual)]
    namespace ZenonBrowser
    {
     
        [ProgId("ZenonBrowser.Browser")]
        [ComVisible(true), ClassInterface(ClassInterfaceType.AutoDual)]
        public partial class Browser : UserControl
        {
            public Browser()
            {
                InitializeComponent();
            }
    
            [ComRegisterFunction()]
            public static void RegisterClass(string key)
            {
                // Strip off HKEY_CLASSES_ROOT\ from the passed key as I don't need it
                StringBuilder sb = new StringBuilder(key);
                sb.Replace(@"HKEY_CLASSES_ROOT\", "");
    
                // Open the CLSID\{guid} key for write access
                RegistryKey k = Registry.ClassesRoot.OpenSubKey(sb.ToString(), true);
    
                // And create the 'Control' key - this allows it to show up in
                // the ActiveX control container
                RegistryKey ctrl = k.CreateSubKey("Control");
                ctrl.Close();
    
                // Next create the CodeBase entry - needed if not string named and GACced.
                RegistryKey inprocServer32 = k.OpenSubKey("InprocServer32", true);
                inprocServer32.SetValue("CodeBase", Assembly.GetExecutingAssembly().CodeBase);
                inprocServer32.Close();
    
                // Finally close the main key
                k.Close();
            }
    
            [ComUnregisterFunction()]
            public static void UnregisterClass(string key)
            {
                StringBuilder sb = new StringBuilder(key);
                sb.Replace(@"HKEY_CLASSES_ROOT\", "");
    
                // Open HKCR\CLSID\{guid} for write access
                RegistryKey k = Registry.ClassesRoot.OpenSubKey(sb.ToString(), true);
    
                // Delete the 'Control' key, but don't throw an exception if it does not exist
                k.DeleteSubKey("Control", false);
    
                // Next open up InprocServer32
                RegistryKey inprocServer32 = k.OpenSubKey("InprocServer32", true);
    
                // And delete the CodeBase key, again not throwing if missing
                k.DeleteSubKey("CodeBase", false);
    
                // Finally close the main key
                k.Close();
            }
        }
       
          
    }

  8. #8
    Join Date
    21.05.2014
    Posts
    32

    Default Re: C# form on screen

    Hello,

    nice to know that forms can be created using Active_x or WPF. Would like to know, can one create elements in runtime dynamically in these forms similar to VB. I mean, without elements being defined in zenon editor explicitly.

    Regards,
    Jyothiswaroop

Similar Threads

  1. CD_DotNetControlContainer & Form
    By stolyarov_as in forum VSTA
    Replies: 0
    Last Post: 24th January 2012, 12:36
  2. Form visual style windows XP/7
    By ippela in forum VSTA
    Replies: 1
    Last Post: 26th September 2011, 00:20
  3. Form visual fault
    By ippela in forum VSTA
    Replies: 2
    Last Post: 23rd September 2011, 09:20
  4. Login form for signature
    By sldewit in forum zenon Service Engine Supervisor
    Replies: 1
    Last Post: 19th October 2010, 14:17
  5. Replies: 1
    Last Post: 3rd August 2010, 10:02

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •