Introduction .Net with Scorpion opens up Scorpion to the large
.Net Framework 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
- Scorpion Vision 4.2 to 7.3
supports .Net Framework version 1.1
- Scorpion Vision 8.0 support .Net
Framework 2.0
Quick Start on using .Net 2.0 with Scorpion
A typical python script using .NET will start with something like
this:
import clr
import System.Windows.Forms as WinForms
from 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
Scorpion
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.
.Net 2.0 Demo ProfilesThese
following demo profiles shows how you can use .Net to extend Scorpion
Vision Software:
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.
|