Simple Bartender .net Application With Visual Studio 2013 Follow
Follow the below steps in order to create a simple Windows form application that integrates with BarTender.
1. From within Visual Studio select the "File>New Project" menu item. Select the "Visual C#>Windows Desktop" template type, and then choose the ,"Windows Forms Application" item. Specify a unique name and location for the project and click OK.
2. In the "Solution Explorer" for the project double click on the solution's "Properties" to configure the solution's settings.
Choose the target framework you wish to work with for your solution. The default, ".NET Framework 4.5" is acceptable, but you make select frameworks 4.5.1 or 3.5 if you prefer.
As BarTender is currently only available as a 32 bit (x86) application you'll need to specify this under the "Build" section on the solution properties. Failure to set this appropriately will cause an error on an x64 computer system.
If you selected the .NET Frameworks 4.5 or 4.5.1 in the solution properties you'll need to make a small alteration to the app configuration. To do this, double click the "App.config" file from the Solution Explorer and add the, "useLegacyV2RuntimeActivationPolicy" attribute to the <startup> tag giving it a value of "true". See below an example of this:
In order for your application to integrate with BarTender a reference should be added to the project for the BarTender .NET component, which is listed as "Seagull.BarTender.Print" in the "Assemblies>Extensions" list. Tck the checkbox alongside it and click OK.
In the form designer view add a command button to the form and then double click it to edit the underlying code.
To start, add a using reference to the "Seagull.BarTender.Print" component at the beginning of the code alongside other using statements, thus bringing the BarTender class into scope.
Enter in your BarTender specific automation code into the contents of the button's click event. In the below example we create a BarTender engine instance, start it, define an application window making it visible, pause for five seconds, and then lastly, stopping the BarTender engine instance.
Save all your work and test run the project by clicking the "Start" button in the toolbar of Visual Studio.
Please sign in to leave a comment.