Up | .Net 1.1 with Scorpion | Converting Scorpion .Net 1.1 to 2.0

.Net 1.1 with Scorpion Examples | Winforms Controls Samples
 

  

 
.Net 1.1 with Scorpion
Introduction

.Net with Scorpion opens up Scorpion to the large .Net Framework 1.1 class library. And the possibility to easily integrate your own .Net object expanding the capabilities of Scorpion Vision Software. The main new features are:

  • Add custom status information to Scorpion tab-pages
  • Add custom dialog and status windows to Scorpion
  • Implement project specific GUI
  • Add high performance - high priority image aquisition and custom interfaces to external devices

The use of .Net with Scorpion is based on Python for .Net (http://www.zope.org/Members/Brian/PythonNet).  The "readme" page here is an important source for information regarding the use of .NET components from python scripts.

Python for .NET is a near-seamless integration of the Python runtime with the .NET Common Language Runtime (CLR). It lets you script and build applications in Python, using CLR services and components written in any language that targets the CLR

Currently the .NET Framework version 1.1 is supported.


Microsoft Downloads - .Net Framework and .Net Framework SDK

The .NET Framework SDK version 1.1 with documentation can be downloaded at no cost from: Microsoft .NET downloads or from the Scorpion support-web - http://scorpion.tordivel.no

In addition the .NET Framework SDK - 106 MByte is available from Microsoft to download free of charge. The most vital informastion is found in the .Net Framework Class Library. Search for "Form Class" to locate Form class description:

Note: The links will fail unless .Net Framework 1.1 is installed


Quick Start on using .Net with Scorpion

A typical python script using .NET will start with something like this:

import CLR
import CLR.System.Windows.Forms as WinForms
from CLR.System.Drawing import Size, Point, Font, Color

Standard .NET components and custom components can be used.

Due to the immense functionality in the .NET Framework class library, it is difficult to memorize method and parameter names. The documentation downloaded with the SDK is an important source of detailed information.

If you have Visual Studio installed, it may be easier to create code snippets in C# and use copy and paste to insert into the Scorpion script editor window. Of course you must modify the code to get the proper Python syntax.

In Visual studio, most details regarding layout of controls on a surface is performed using the graphical designer. This is not possible in the Scorpion script editor. One book to recommend is "Programming Microsoft Windows with C#" by Charles Petzold. In this book there are many examples showing "manual" layout and handling of controls.


How to use .NET GUI Components

To use .NET GUI (Graphical User Interface) components embedded into the existing Scorpion GUI, a specially developed component Tordivel.OverlayPanel is to be used. The OverlayPanel is a .NET Panel control that may cover an already existing window area in the Scorpion GUI.

Possible Scorpion window areas that may host the .NET OverlayPanel are:

- ResultPanel and CustomPanels on the left hand side of the Scorpion GUI.

- Custom Pages created on the left hand side of the Scorpion GUI.

More information about Panels python interfaces.

The OverlayPanel can be used with different DockStyle values to fill the entire area of the parent window, or dock into one of the sides of the parent window.

The general approach for using .NET GUI components is to derive a python class from the .NET Tordivel.OverlayPanel class and create a global instance of this class giving it a handle of the parent window (See the first example for an easy understanding).

The .NET event mechanism for button-clicks etc. will work just like in any real .NET programming language.

These examples are relatively complete, and work by pasting them into the Scorpion central start script.

.Net 1.1 with Scorpion Examples
Winforms Controls Samples


.Net Developer Resources on the Internet

Microsoft Developer Resources - http://www.microsoft.com/net/developers.mspx


How to locate the Scorpion .Net 1.1 Examples?

There are a folder of profile examples located on the Scorpion CD or using the links:

Learn more about .Net

Microsoft has launched a free development tool C# Express - http://msdn.microsoft.com/vstudio/express/visualcsharp/ - it can be used to learn the .Net Framework - a skill needed to fully understand the power of Scorpion .Net.

 
 

Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.