RoyalApps.Community.Rdp.WinForms 1.2.0

Prefix Reserved
dotnet add package RoyalApps.Community.Rdp.WinForms --version 1.2.0                
NuGet\Install-Package RoyalApps.Community.Rdp.WinForms -Version 1.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RoyalApps.Community.Rdp.WinForms" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RoyalApps.Community.Rdp.WinForms --version 1.2.0                
#r "nuget: RoyalApps.Community.Rdp.WinForms, 1.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RoyalApps.Community.Rdp.WinForms as a Cake Addin
#addin nuget:?package=RoyalApps.Community.Rdp.WinForms&version=1.2.0

// Install RoyalApps.Community.Rdp.WinForms as a Cake Tool
#tool nuget:?package=RoyalApps.Community.Rdp.WinForms&version=1.2.0                

RDP Control

NuGet Version NuGet Downloads .NET

RoyalApps.Community.RDP contains projects/packages to easily embed/use Microsoft RDP ActiveX wrapped in MsRdpEx in a Windows (WinForms) application. Screenshot

Getting Started

Installation

You should install the RoyalApps.Community.RDP.WinForms with NuGet:

Install-Package RoyalApps.Community.RDP.WinForms

or via the command line interface:

dotnet add package RoyalApps.Community.RDP.WinForms

Using the RdpControl

Add Control

Place the RdpControl on a form or in a container control (user control, tab control, etc.) and set the Dock property to DockStyle.Fill

Set Properties

To configure all RDP relevant settings, use the properties of the RdpClientConfiguration class which is accessible through the RdpControl.RdpConfiguration property.

Connect and Disconnect

Once the configuration is set, call:

RdpControl.Connect();

to start a connection.

To disconnect, simply call:

RdpControl.Disconnect();
Subscribe to Events

When the connection has been established, the Connected event is raised.

The Disconnected event is raised when:

  • the connection couldn't be established (server not reachable, incorrect credentials)
  • the connection has been interrupted (network failure)
  • the connection was closed by the user (logoff or disconnect)

The DisconnectedEventArgs may have an error code or error message for more information.

Exploring the Demo Application

The demo application is quite simple. The Remote Desktop menu has the following items:

Connect

Starts the remote desktop connection.

Disconnect

Stops the remote desktop connection.

Settings

Shows a window with all the settings from the RdpClientConfiguration class. Edit/change the settings before you click on Connect.

Notable Features

Use Microsoft Remote Desktop Client

One of the most interesting possibilities of this package is to use the Microsoft's modern Remote Desktop Client (RDC) instead of the Terminal Services Client (MSTSC) which ships with Windows. Just set RdpClientConfiguration.UseMsRdc to true and ensure that the Remote Desktop Client is installed from the Microsoft Store.

Auto Expand Desktop Size

If DesktopWidth and DesktopHeight properties are set to 0 (default), the remote desktop size is determined by the container size the control is placed on.

Resize Behavior

You can set the RdpClientConfiguration.Display.ResizeBehavior property to one of the following:

  • Scrollbars: displays scrollbars when the container (form) size decreases.
  • SmartSizing: scales down the remote desktop while preserving the original desktop size.
  • SmartReconnect: adapts the remote desktop size to accordingly when the container (form) size changes.

Call the RdpControl.SetResizeBehavior(ResizeBehavior resizeBehavior) method to change the behavior while connected.

Scaling and Zoom
Auto Scaling

Setting the RdpClientConfiguration.Display.AutoScaling to true will automatically adapt the scaling factor to system's the DPI scaling during connect.

Alternatively you can provide the RdpClientConfiguration.Display.InitialZoomLevel to set a custom zoom level.

Changing Zoom Level

While connected you can use the methods RdpControl.ZoomIn() and RdpControl.ZoomOut() to change the zoom level.

Local Scaling

Setting RdpClientConfiguration.Display.UseLocalScaling to true will scale on the client side instead of settings the remote zoom level (DPI settings). With this enabled, SmartSizing as ResizeBehavior will not be possible.

Acknowledgements

Special thanks to Marc-André Moreau / Devolutions for providing the MsRdpEx package.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 98 11/14/2024
1.2.0-beta2 49 10/9/2024
1.2.0-beta1 50 9/19/2024
1.1.0 400 9/2/2024
1.0.7 108 8/7/2024
1.0.6 187 4/19/2024
1.0.5 148 4/15/2024
1.0.4 133 4/9/2024
1.0.3 103 4/9/2024
0.9.5 166 9/19/2023
0.9.4 174 7/6/2023
0.9.3 148 6/30/2023
0.9.2 143 6/29/2023
0.9.1 148 6/27/2023
0.9.0 144 6/27/2023