CoreSuite.Helpers.Windows 1.0.0

dotnet add package CoreSuite.Helpers.Windows --version 1.0.0
                    
NuGet\Install-Package CoreSuite.Helpers.Windows -Version 1.0.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="CoreSuite.Helpers.Windows" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreSuite.Helpers.Windows" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CoreSuite.Helpers.Windows" />
                    
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 CoreSuite.Helpers.Windows --version 1.0.0
                    
#r "nuget: CoreSuite.Helpers.Windows, 1.0.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.
#:package CoreSuite.Helpers.Windows@1.0.0
                    
#: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=CoreSuite.Helpers.Windows&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CoreSuite.Helpers.Windows&version=1.0.0
                    
Install as a Cake Tool

Helpers.Windows

Windows Forms helpers for working with controls and images.

Helpers.Windows is one of the libraries included in the CoreSuite solution. It has no CoreSuite or third-party package dependencies.

Overview

Helpers.Windows provides small, reusable utilities for Windows Forms applications. ControlHelper helps traverse control hierarchies, control double buffering and verify whether a child control is fully visible. ImageHelper provides image loading, cloning, recoloring, color analysis and proportional resizing.

It is designed for .NET 8 Windows Forms applications and can be used from any form, user control or Windows Forms component.

Features

  • Enumerates every descendant control from a root control.
  • Optionally includes the root control in control enumeration.
  • Enables or disables the protected DoubleBuffered property on controls and forms.
  • Checks whether a child control is fully visible inside its parent.
  • Loads an independent copy of a file-based image.
  • Supplies a built-in error image when a file cannot be loaded.
  • Recolors images by replacing an exact color or preserving per-pixel alpha.
  • Obtains all distinct colors used by an image.
  • Resizes images proportionally within optional width and height limits.
  • Includes English XML documentation for the public API.
  • Requires no third-party packages.

Requirements

  • Windows Forms
  • .NET 8 for Windows (net8.0-windows)

Installation

Install the package from NuGet:

dotnet add package CoreSuite.Helpers.Windows

Or use the Visual Studio NuGet Package Manager and search for:

CoreSuite.Helpers.Windows

Namespace

Imports CoreSuite.Helpers

Quick start

Imports CoreSuite.Helpers

Dim AllControls As IEnumerable(Of Control) = ControlHelper.GetAllControls(Me, True)
ControlHelper.EnableFormDoubleBuffer(Me, True)

Dim PreviewImage As Image = ImageHelper.GetCopyImage("C:\Images\logo.png")
PictureBox1.Image = ImageHelper.GetResizedImage(PreviewImage, 128, 128)

API reference

ControlHelper

Provides utility methods for traversing, configuring and inspecting Windows Forms controls and forms.

Member Behavior
GetAllControls(root, includeRoot) Enumerates child controls recursively, optionally including the root control.
EnableControlDoubleBuffer(control, setting) Enables or disables double buffering on a control through reflection.
EnableFormDoubleBuffer(form, setting) Enables or disables double buffering on a form through reflection.
IsControlFullyVisible(parent, child) Returns whether the complete child bounds are visible inside the parent client area.

ImageHelper

Provides helper methods for common image operations.

Member Behavior
GetCopyImage(imagePath) Loads and returns an independent image copy; returns the built-in error image when loading fails.
GetRecoloredImage(image, fromColor, toColor) Returns a bitmap replacing one exact ARGB color with another.
GetRecoloredImage(image, baseColor) Recolors all image colors with the supplied base color while preserving alpha values.
GetImageColors(image) Returns the distinct colors used by the image.
GetResizedImage(image, maxWidth, maxHeight) Resizes proportionally only when the image exceeds a supplied dimension limit.

Examples

Enable double buffering on a DataGridView

ControlHelper.EnableControlDoubleBuffer(DataGridView1, True)

Recolor an icon while preserving transparency

Dim AccentIcon As Image = ImageHelper.GetRecoloredImage(My.Resources.Icon, Color.DodgerBlue)
Button1.Image = AccentIcon

Resize an image before displaying it

Dim Preview As Image = ImageHelper.GetCopyImage(FileName)
PictureBox1.Image = ImageHelper.GetResizedImage(Preview, 320, 180)

Behavior and lifetime considerations

  • EnableControlDoubleBuffer and EnableFormDoubleBuffer use reflection because DoubleBuffered is not publicly exposed by Windows Forms.
  • GetResizedImage disposes the supplied image when a resized replacement is created. Do not use the original image reference after that call.
  • An image returned by GetCopyImage or either GetRecoloredImage overload is owned by the caller and should be disposed when no longer needed, unless it is assigned to a control that owns its lifetime.
  • Image methods operate on Bitmap pixel data and are best suited to icons and reasonably sized images.

Package information

Item Value
Package CoreSuite.Helpers.Windows
Namespace CoreSuite.Helpers
Assembly CoreSuite.Helpers.Windows
Target framework net8.0-windows
UI framework Windows Forms
CoreSuite dependencies None
External dependencies None

License

This package is distributed under the MIT License defined by the CoreSuite repository.

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

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CoreSuite.Helpers.Windows:

Package Downloads
CoreSuite.AsyncLoader

Windows Forms service for displaying a centered loading form while covering or disabling a parent form during asynchronous operations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 132 8/3/2026

Initial release of Windows Forms control and image helpers.