AppDimens.Net.WinForms 3.6.1

dotnet add package AppDimens.Net.WinForms --version 3.6.1
                    
NuGet\Install-Package AppDimens.Net.WinForms -Version 3.6.1
                    
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="AppDimens.Net.WinForms" Version="3.6.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AppDimens.Net.WinForms" Version="3.6.1" />
                    
Directory.Packages.props
<PackageReference Include="AppDimens.Net.WinForms" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AppDimens.Net.WinForms --version 3.6.1
                    
#r "nuget: AppDimens.Net.WinForms, 3.6.1"
                    
#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.
#:package AppDimens.Net.WinForms@3.6.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AppDimens.Net.WinForms&version=3.6.1
                    
Install as a Cake Addin
#tool nuget:?package=AppDimens.Net.WinForms&version=3.6.1
                    
Install as a Cake Tool

AppDimens.Net.WinForms

📖 Documentation: AppDimens.Net.WinForms guide · complete API reference · all AppDimens .NET packages

Windows Forms integration for AppDimens.Net — the pure C# port of AppDimens KMP. Sizes follow the form's client size and the monitor DPI, and are recalculated every time the form is resized.

Frameworks net8.0-windows, net9.0-windows, net10.0-windows (+ net11.0-windows with SDK 11)
Depends on AppDimens.Net, AppDimens.Net.Fluid, AppDimens.Net.Percent (installed automatically)

Step 1 — Install

dotnet add package AppDimens.Net.WinForms

Step 2 — Initialize and size controls

using AppDimens.Net.Code.Scaled;   // 16.Sdp(), 14.Ssp() (dp)
using AppDimens.Net.Code.Fluid;    // 24.FSdp()
using AppDimens.Net.WinForms;      // AppDimensWinForms, DimenPx

public partial class MainForm : Form
{
    public MainForm()
    {
        InitializeComponent();
        AppDimensWinForms.Initialize(this);

        // Runs now and after every resize / DPI change:
        AppDimensWinForms.Apply(this, () =>
        {
            saveButton.Width  = DimenPx.ToPx(120.Sdp());       // dp → pixels
            saveButton.Height = DimenPx.ToPx(40.Hdp());
            saveButton.Font   = new Font(saveButton.Font.FontFamily, DimenPx.ToPt(14.Ssp())); // dp → points
            panel1.Padding    = DimenPx.Padding(16.Sdp());
            banner.Height     = DimenPx.Of(DimenFunction.FSdp, 80); // any function straight to pixels
        });
    }
}

Units cheat sheet

Value What it is Use with
16.Sdp() dp (device-independent, 1/96 inch) input of DimenPx
DimenPx.ToPx(dp) pixels for the form's monitor Width, Height, Size, Location
DimenPx.ToPt(dp) font points new Font(family, size)
DimenPx.Padding(dp) / DimenPx.Size(w, h) Padding / Size padding, margins, sizes
16.SdpPx() pixels (core API) same as DimenPx.ToPx(16.Sdp())

Which function?

Need Function
Most sizes Sdp
Follow form height / width Hdp / Wdp
Text Ssp
Grows gently on large forms FSdp (fluid)
Percent of the form SpaceW / SpaceH via DimenPx.Of(DimenFunction.SpaceW, 50)

Tips

  • Put all AppDimens assignments inside Apply so they are refreshed on resize.
  • If a control looks scaled twice on high-DPI monitors, set AutoScaleMode = AutoScaleMode.None on that form.

Português (resumo)

dotnet add package AppDimens.Net.WinForms → no construtor: AppDimensWinForms.Initialize(this); e coloque os tamanhos dentro de AppDimensWinForms.Apply(this, () => { ... }). Converta dp em pixels com DimenPx.ToPx(120.Sdp()) e fontes em pontos com DimenPx.ToPt(14.Ssp()).

More: AppDimens.Net core · Repository

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net9.0-windows7.0 is compatible.  net10.0-windows was computed.  net10.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
3.6.1 81 10/12/2026