MaterialSkin Documentation

repository·master·Indexed 25 days ago

https://github.com/ignacemaes/materialskin

A library for theming .NET WinForms applications in C# or VB.NET using Google's Material Design principles. Includes instructions for NuGet installation, adding components to the Visual Studio Toolbox, inheriting from MaterialForm, and configuring themes and color schemes via MaterialSkinManager.

Tokens
840
Snippets
3
Records
4
Agent score
35%

What's inside MaterialSkin

  1. Inherit from MaterialForm

    master

    To apply the MaterialSkin theme to a window, change the base class of your Form from Form to MaterialForm. Ensure you include the appropriate library imports in your code-behind.

    // C# (Form1.cs)
    public partial class Form1 : MaterialForm
    ' VB.NET (Form1.Designer.vb)
    Partial Class Form1
        Inherits MaterialSkin.Controls.MaterialForm
  2. Install MaterialSkin via NuGet

    master

    To add MaterialSkin to your .NET WinForms project, use the NuGet Package Manager.

    1. Right-click on your project in your IDE.
    2. Select 'Manage NuGet Packages...'.
    3. Search for 'MaterialSkin' and click install.

    Alternatively, you can use the Package Manager Console:

    Install-Package MaterialSkin
  3. Add MaterialSkin components to the Visual Studio Toolbox

    master
    After installing the NuGet package, locate the MaterialSkin.dll file (typically found in your project's //bin/Debug folder). Drag and drop the MaterialSkin.dll file directly into your IDE's Toolbox to automatically add all available MaterialSkin controls to your component list.
  4. Initialize MaterialSkin colorscheme and theme

    master

    Use the MaterialSkinManager.Instance to configure the visual appearance of your application. You must add your form to the manager using AddFormToManage(this) so that the theme updates are applied correctly. You can set the Theme (e.g., MaterialSkinManager.Themes.LIGHT) and a custom ColorScheme.

    // C# implementation
    public Form1()
    {
        InitializeComponent();
    
        var materialSkinManager = MaterialSkinManager.Instance;
        materialSkinManager.AddFormToManage(this);
        materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;
        materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE);
    }
    ' VB.NET implementation
    Imports MaterialSkin
    
    Public Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Dim SkinManager As MaterialSkinManager = MaterialSkinManager.Instance
            SkinManager.AddFormToManage(Me)
            SkinManager.Theme = MaterialSkinManager.Themes.LIGHT
            SkinManager.ColorScheme = New ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE)
        End Sub
    End Class