TX Text Control .NET for Windows Forms

Create a .NET Framework Application

Topic

Existing Windows Forms applications often still run on the .NET Framework, and TX Text Control works there as well. The editor you build is the same as in Create Your First Windows Forms Application, with a ribbon, rulers and a status bar. What differs is how TX Text Control gets into the project: there is no NuGet package, and the license comes through licenses.licx.

Prerequisites

  • Visual Studio on Windows with the .NET Framework 4.8. See .NET and .NET Framework.
  • The setup of TX Text Control .NET for Windows Forms 34.0, the full or the trial version. For .NET Framework projects, it provides the assemblies and the toolbox tab. See Installing the Product.

Create the Project

  1. Open Visual Studio and create a new project.

  2. Select C# from the Languages list, Windows from the Platform list and Desktop as the Project Type. Select Visual Basic instead for a Visual Basic project; the steps are the same.

  3. Select the project template Windows Forms App (.NET Framework) and click Next.

    The Create a new project dialog of Visual Studio with the filters C#, Windows and Desktop and the template Windows Forms App (.NET Framework) selected.

  4. Enter a project name, select .NET Framework 4.8 in the Framework list and click Create.

    The Configure your new project dialog of Visual Studio for a Windows Forms App (.NET Framework) with a project name, location and solution name, and .NET Framework 4.8 selected in the Framework list.

Add the Editor to the Form

  1. With Form1 open in the designer, find the tab TX Text Control 34.0 in the Toolbox. The setup created it, and it lists all controls and components of TX Text Control.

    The Visual Studio Toolbox with the tab TX Text Control 31.0, listing MailMerge, DocumentController, ServerTextControl, ButtonBar, RulerBar, StatusBar, TextControl, Sidebar, Ribbon and the ribbon tabs.

  2. Select TextControl and draw the control onto the form.

  3. Add the ribbon, the status bar and the two rulers with the smart tag of the TextControl, as in steps 3 and 4 of Add the Editor to the Form in the .NET tutorial. The designer works the same way in a .NET Framework project.

    A form in the Visual Studio designer with the ribbon, rulers and status bar docked around the TextControl, and the TextControl Tasks smart tag with Dock set to Fill and the Wizards links.

  4. Add the ribbon tabs from Home to Proofing with the smart tag of the ribbon, as in Add the Ribbon Tabs.

    The form in the Visual Studio designer with the added ribbon tabs from Home to Proofing, and the Ribbon Tasks smart tag with the links that add the predefined tabs.

Run the Application

Press F5. The form shows the same word processor as in the .NET tutorial: the ribbon with its tabs, a horizontal and a vertical ruler, the document in page view and the status bar.

The running application with the ribbon tabs Home, Insert, Page Layout, View and Proofing, two rulers, the page and the status bar.

The code of Load a Document When the Form Opens works unchanged in this project.

What Is Different in a .NET Framework Project

  • The assemblies come from the setup. The project references the assemblies in the Assembly folder of the installation, by default C:\Program Files\Text Control GmbH\TX Text Control 34.0.NET for Windows Forms\Assembly.
  • The license comes through licenses.licx. When you drop the TextControl on the form, Visual Studio adds an entry to the project's licenses.licx file, and the license compiler embeds the license into your assembly when you build. If Visual Studio reports that a control "could not be licensed", check the entries of this file. See Development Licenses.
  • Service packs need no change. A service pack replaces the files in the installation folder and keeps the assembly version, so the project picks it up when you rebuild.
  • Publishing means shipping the assemblies and native libraries yourself. See Deploying .NET Framework Applications.

The Finished Sample

The setup installs this tutorial as a finished project in %USERPROFILE%\Documents\TX Text Control 34.0.NET for Windows Forms\CSharp\Tutorial\Simple, and in Visual Basic under VB.NET\Tutorial\Simple.

Next Steps