Beruflich Dokumente
Kultur Dokumente
SDK+ C#
Contents
Overview................................................................................................................................................................................ 2
Target Audience .................................................................................................................................................................... 2
Feedback ............................................................................................................................................................................... 2
Prerequisites ......................................................................................................................................................................... 2
Installing the ZMotif SDK+ ................................................................................................................................................. 3
Creating an Application using the ZMotif SDK+ ................................................................................................................ 5
Launch Microsoft Visual Studio 2008. ........................................................................................................................... 5
Create a C# Windows Form project. ............................................................................................................................. 5
Design the Form Layout .............................................................................................................................................. 10
Add the Code ............................................................................................................................................................... 19
Running the Application ............................................................................................................................................... 22
Deploying the Application ............................................................................................................................................ 24
Overview
This document describes the end to end process of designing, packaging, deploying and running a C# application using
the Zebra ZMotif SDK+.
The sample code used in this guide is from the Getting started with ZMotif Card Printer Development supporting sample
code (SA249) available here on the Zebra Support Portal.
Target Audience
The information delivered in this document assumes the reader has reasonable technical competence covering
Microsoft Visual Studio, core programming concepts and rationales.
Feedback
We value all feedback. Please add your comments/suggestions to the article in the Zebra Support Portal.
Prerequisites
The following items are required to create the ZMotif SDK+ application:
ZMotif SDK+
The following components are required and included in the ZMotif SDK+ package: ZMotif Printer SDK, ZMotif
Graphics SDK, and ZGT (Zebra General Tool). To download ZMotif SDK+, navigate to the following site:
http://www.zebra.com/cardpartner/zmotif.php. Click the Click here for the EULA link located at the top right section of
the page. The Installing the ZMotif SDK+ section of this document contains instructions on how to install the SDKs.
ZXP Series 8 Printer
In order to run the ZMotif SDK+ application created in this document, a Zebra ZXP Series 8 retransfer printer must
be accessible from the computer.
c. Complete the ZMotifPrinterSDK installation by advancing through the installation wizard using the
installers defaults.
c. Complete the ZMotifGraphicsSDK installation by advancing through the installation wizard using the
installers defaults.
b. You will be prompted with a New Project window. In Project types pane, expand Visual C# and select
Windows Forms Application.
c. Enter ZMotifGettingStarted in the Name text field and chose a location for your project. Click OK.
d. Your project will automatically open in the IDE. The Form Designer is opened by default.
e. The ZMotif SDK+ only works with 32-bit applications. If you are running on a 64-bit system you must
change the projects built type to x86.
i. Right-click the ZMotifGettingStarted project in the Solution Explorer and select Properties.
ii. The ZMotifGettingStarted projects properties window will be displayed. Select Build on the left.
iii. Set the Platform target to x86 and Save. Close the properties window to return to the Form
Designer.
b. Right-click anywhere on the form in the Form Designer and select Properties. This will bring up the
Properties table in the bottom right panel.
c. Replace Form1 with ZMotif Application for the value of the Text property. This changes the text on the
title bar of the form.
d. For the value of the Size property, replace 300, 300 with 350, 300.
e. In the Properties window, select the lightning bolt icon to show the Forms events. Set the Load event to
frmMain_Load.
f.
g. We will use a text box to enter text that will appear on the card.
i. Drag a TextBox from the Toolbox and place it directly under the combo box on the form.
ii. Right-click the TextBox and select Properties. Set the value of its (Name) property to
txtCardTextFront.
i.
j.
ii. Select the Browse tab and navigate to the location where the ZMotifGraphicsSDK was installed.
(The default is C:\Program Files\Zebra Technologies\ZMotifGraphicsSDK\bin)
iii. In the bin directory, select ZMotifGrahpics.dll and click OK.
iv. Now we will add a reference to ZMotifPrinter.dll. Once again, right-click References and select
Add Reference.
v. Select the Browse tab and navigate to the location where the ZMotifPrinterSDK was installed.
(The default is C:\Program Files\Zebra Technologies\ZMotifPrinterSDK\<version>\bin)
vi. In the <version>\bin directory, select ZMotifPrinter.dll and click OK.
vii. Lastly, we will add a reference to Neodynamic.SDK.Barcode.dll. This DLL is required by the
ZMotif SDK+s assemblies.
viii. In the Solution Explorer, right-click References and select Add Reference.
ix. Select the Browse tab and navigate to the location where the ZGT (Zebra General Tool) was
installed. (The default is C:\Program Files\Zebra Technologies\ZGT)
x. Select Neodynamic.SDK.Barcode.dll and click OK.
xi. There should now be three new assemblies (ZMotifGraphics, ZMOTIFPRINTERLib,
Neodynamic.SDK.Barcode) under References in the Solution Explorer.
b. Now we will begin adding the code. Right-click anywhere in the Form Designer and select View Code.
This will open frmMain.cs.
c. Replace the existing code in frmMain.cs with the frmMain.cs from the Getting Started with ZMotif
Printer Development supporting sample code. This code has a few main functions:
Note: The source code in this whitepaper is extracted from the "Getting started with ZMotif Card Printer
Development support sample code" SA249 which is available for download to all registered members of
the Zebra ISV Program here. For information on joining the ISV Program, contact a Program Manager in
your area. Details here.
d. Click the Print button. When the print begins, you will see the message Printing Card.
e. The resulting card should have shapes and text printed on the front and back, as shown below.
Front:
Back:
b. If you are running on a 64-bit system, you must once again change the build type to x86, as this set
separately for Debug and Release build modes.
i. You may refer back to section 2 step e if you do not remember how to do this.
ii. Be sure your build mode is set to Release before changing the build type.
c. Select Build -> Build Solution from the top menu.
d. Open Windows Explorer and navigate to your ZMotifGettingStarted Visual Studio project. Your
application is located at ~\ZMotifGettingStarted \bin\Release\ZMotifGettingStarted.exe.
e. If a custom ZMotif device application will be run on machines that do not have the ZMotif SDK+
installed, it needs access to any ZMotif assemblies that it uses in its code. The ZMotifGettingStarted
uses ZMotifGraphics.dll (ZMotifGraphicsSDK) and Interop.ZMOTIFPRINTERLib.dll
(ZMotifPrinterSDK).
Document Control
Version Date
1.0
14-Dec-10
Description
Initial Release
Corporate Headquarters
Asia-Pacific Headquarters
EMEA Headquarters
Other Locations
USA: California, Georgia, Rhode Island, Texas, Wisconsin Europe: France, Germany, Italy, Netherlands, Poland, Spain, Sweden Asia Pacific: Australia, China, Japan, South Korea
Latin America: Argentina, Brazil, Florida (USA), Mexico Africa/Middle East: India, Russia, South Africa, United Arab Emirates
GSA#: GS-35F-0268N
13919L-001 Rev. 9 (11/08)