Getting started!
This section will guide you through all basics of the Minimal library. If you would like to know more about each topic, there is a link at the end of each paragraph
Components
In Minimal library, we distinguish between components and controls. Every M-control (control from Minimal library) is also a component, but not every component is necessarily a control. Controls can be placed directly on the form because they inherit from System.Windows.Forms.UserControl class. Components, on the other hand, can extend any class and may not necessarily be placeable on the form on their own. When not extending UserControl class, components usually contain control internally so they act like a wrapper. Good "non-control" component example is MContextMenu, which can’t be placed directly on the form, but after initialization and Show() call will utilize inner list-box control which will then present all menu items to the user. All components in Minimal library always implements IMComponent interface. If you would like to know more about components in general, you can read a component model section.
Themes
Minimal library support themes. Themes are loaded as .xml files and they can be modified as needed. There is a light and dark theme by default. You can load a theme with M.LoadTheme() method and then set it to the MForm by calling M.SetTheme(). See code example below:
using Minimal;
namespace Demo
{
public partial class Form : MForm
{
// Form constructor
public Form()
{
InitializeComponent();
// Loads theme from file
Theme myTheme = M.LoadTheme("theme.xml");
// Set loaded theme to this MForm
M.SetTheme(this, myTheme);
}
}
}
Please note, that you can pass only variables of type MForm as the first parameter to M.SetTheme(). If a component is placed on regular System.Windows.Forms.Form, then M.ApplicationWideTheme is used as a component source theme. If you need to set theme individually, you can use component’s CustomTheme property. See themes section for more information.
Accent
Most components have its own Accent color property. This color property is by default set to bright and friendly blue. By changing it, you can make Minimal library more visually connected to specific projects. You can set accent color of every component individually or change it for all components on the form by calling M.SetAccent() with target Form and Color variables as parameters.
Hex
Hex class provides support for colors in hexadecimal format. This is super useful when you don’t like to specify your colors in RGBA format. There is also an implicit conversion with original System.Drawing.Color class and some static predefined colors.
// Creates new HEX color
Hex red = new Hex("#FF0000");
// Or you can simply write:
Hex blue = "#0000FF";
// There is also defined an implicit conversion for System.Drawing.Color class
Color myColor = blue;
Hex white = Color.White;
See Hex class documentation for more.
Scaling
Due to scaling issues in WinForm platform is Minimal library using own scaling engine to ensure, that you get the best viewing experience on each device. This is achieved thanks to Dip class. See more here.
Touch
Minimal library supports touch input. Components can react to gestures and they smartly adapt to Windows 10 tablet experience. Using M.TabletMode property you can always check whether you are in tablet mode or not.