HeaderPane
Main
Hide
Share Link
Print

Using SftTabs/NET with .NET 10

SftTabs/NET 3.0 supports Windows Forms applications for .NET 10 (or later) as well as for the .NET Framework 4.7 (or later). The control's classes, properties, methods and events are the same on both.

Adding SftTabs/NET To An Application

.NET 10 projects reference SftTabs/NET through its NuGet package Softelvdm.SftTabsNET. Setup installs the package in the SftTabs/NET installation directory (\Program Files (x86)\Softelvdm\SftTabs NET 3.0\NuGet\) and registers that folder as the package source "Softelvdm SftTabs NET 3.0" for all users of the system.

1. Create the Project

In Visual Studio, create a new project from the "Windows Forms App" template (C# or Visual Basic) and select .NET 10.0 as the framework. An existing Windows Forms project for .NET 10 (or later) works the same way.

2. Install the NuGet Package

In Solution Explorer, right-click the project and select Manage NuGet Packages. On the Browse tab, select "Softelvdm SftTabs NET 3.0" as the package source, select the package Softelvdm.SftTabsNET and click Install.

Manage NuGet Packages

The package can also be added to the project file directly:

<ItemGroup>
  <PackageReference Include="Softelvdm.SftTabsNET" Version="3.0.0" />
</ItemGroup>

3. Add the Control to a Form

Open the form in the designer. The Toolbox shows the control as SftTabs (Softelvdm.SftTabsNET) in the group Softelvdm.SftTabsNET. Drag it onto the form.

Toolbox

4. Set Up the Control

Click the smart tag at the top right corner of the control to open the SftTabs Tasks. Add Tab adds a tab with a new page and Remove Tab removes the selected tab and its page. Edit Properties opens the property pages; Tabs, Scrolling and Buttons open them on that page.

SftTabs Tasks

Drag controls from the Toolbox onto the page of the selected tab. Once the tab control is selected, clicking a tab selects the tab and shows its page.

Build and run the application. The code example in Using SftTabs/NET with .NET Framework works unchanged in .NET 10 projects.

Designing Forms

Visual Studio's designer for .NET projects runs the controls on a form in a separate process. SftTabs/NET supports this designer: the control is placed from the Toolbox, edited in the Properties window and through its smart tag, and its tabs are saved in the form's resource (.resx) file.

The property pages open from the smart tag and from the Properties window, as in .NET Framework projects. In .NET projects they edit a copy of the control, and the control on the form is updated when Apply is clicked.

Saved Contents

.NET 10 no longer includes the BinaryFormatter, which SftTabs/NET uses in .NET Framework applications to save the images and fonts in the control's contents (SftTabs.GetContents, and the Contents resource of a form). In .NET 10 applications, SftTabs/NET saves images as image files and fonts by their name, size, style, unit and character set instead.

  • Contents saved by a .NET 10 application load in .NET 10 and .NET Framework applications.
  • Contents saved by a .NET Framework application load in a .NET 10 application only if they contain no images or fonts.
  • The Contents resource of a form designed in a .NET Framework project cannot be loaded in a .NET 10 project.

Per-Monitor DPI

A .NET 10 application becomes per-monitor aware by calling Application.SetHighDpiMode(HighDpiMode.PerMonitorV2) before it creates its first window. See Per-Monitor DPI and Scaling.

Using SftTabs/NET and SftTree/NET Together

SftTabs/NET 3.0 and SftTree/NET 3.0 can be used in the same application, for example with a tree control on a tab page. Each control comes in its own assembly and its own NuGet package. The classes both controls share, such as the part classes, are defined in the namespace Softelvdm.SftTabsNET.Controls for SftTabs/NET and in the namespace Softelvdm.Controls for SftTree/NET.

Distributing Applications

When a .NET 10 application is built, Softelvdm.SftTabsNET.dll is copied from the NuGet package to the application's output folder. Distribute it with the application as described in Distributing SftTabs/NET.