An open API service indexing awesome lists of open source software.

https://github.com/microcodeincorporated/mcode-resizer

A C# Class and Windows Form Base Class to add resolution, scaling, and DPI independence to any .NET App.
https://github.com/microcodeincorporated/mcode-resizer

Last synced: 4 months ago
JSON representation

A C# Class and Windows Form Base Class to add resolution, scaling, and DPI independence to any .NET App.

Awesome Lists containing this project

README

          

# mcode-resizer
A pair of C# .NET classes that enable any Windows Form to automatically resize to any DPI at any Scale on any display.

## Description

After adding these two .NET C# classes to any Windows Forms project any Form can be updated to auto-size

by editing just three (3) lines of code.

The auto-sizing of these classes does not rely on any Windows features, no DPI scaling mode, no anchoring

of controls, etc. It relies on Windows display properties and math alone to retain the best possible appearance

of all controls in a Windows Form for all possible resolutions, scales, and shapes. It also supports dynamic scaling

changes and dragging between display of different capabilities.

## Using the MicroCODE.Resizer

### Dependencies

* Reference these two C# Classes ('Resizer.cs' and 'ResizerForm.cs') in your project

* Set The Properties on your Form to "AutoScaleMode = None" -- 'Resizer' will take care of it all

//
// AppScreen
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;

* Change your Forms to inherit "ResizerForm" (which itself inherits "Form") instead of "Form" directly

// Inherit from 'ReserForm' for display independence
public partial class AppScreen : ResizerForm, IAppScreen, IAppEvents
{

* Call "UseResizer()" after "IntializeComponents()" -- this method is included in "Reszier.cs"

// Use MicroCODE's auto-scaling / auto-resizing capability...
UseResizer(parentForm: this);

### Installing

Clone this repo and copy these files into your Visual Studio project:
- ResizerForm.cs
- Resizer.cs

* Change your Forms to inherit 'ResizerForm' instead of 'System.Windows.Form'
* Call 'UseResizer()' immediately after 'InitializeComponents()'



### Demonstration of the MicroCODE Resizer...

Your browser does not support the HTML5 player.




## Help

This is delivered AS-IS under the MIT License, but we will make every effort to

address any issues you may find to improve the Resizer. If you have improvements

or suggests to contribute clone this repository and give us a pull request with

your documentation.


## Terminology

| Word or Acronym | Description/Definition |
|-------------------|-------------------------------------------------------|
| Resizer | Our class and process for permanent resolution independence.
| Scale | The user selected scaling of the Windows displays.
| DPI | Dots per Inch - where the default is 96 dpi.
| High DPI | A monitor supports more than 96 dpi.
| DPI Aware | An application that can scale itself regardless of DPI.
| | The MicroCODE.Resizer adds 'DPI Awareness' to your App.
| -
| PXPI | Pixels per Inch
| PTPI | Points per Inch
| PXPP | Pixels per Point
| IPPT | Inches per Point
| IPPX | Inches per Pixel
| PTPP | Points per Pixel
| -
| STANDARD | Measurements, ratios, and sizes associated with a 96 dpi monitor.
| NATIVE | Measurements, ratios, and sizes associated with physical monitor.
| DISPLAY | Measurements, ratios, and sizes associated with the 'Scaled' display on the physical monitor.

## Authors

Contributors names and contact info:

* Timothy J McGuire [@tjmcode](https://tjmcode.github.io/)

## Release History

* 0.0
* Initial release of our internal code for use by others.

## Future Development

* 0.1
* Improve Child Form awareness of Parent Form resizing.

## License

This project is licensed under the MIT License - see the LICENSE.md file for details