### Complete MaterialSkin Application Setup in C# Source: https://context7.com/ignacemaes/materialskin/llms.txt This C# code demonstrates how to set up a full Material Design application using the MaterialSkin library. It includes initializing the MaterialSkinManager, managing themes (light and dark), changing color schemes, and integrating various MaterialSkin controls. The application features buttons to toggle themes and change color palettes, along with input fields and a submit button. ```csharp using System; using System.Windows.Forms; using MaterialSkin; using MaterialSkin.Controls; public class MaterialApp : MaterialForm { private readonly MaterialSkinManager skinManager; private int colorSchemeIndex = 0; public MaterialApp() { // Form setup Text = "Material Design App"; Size = new Size(600, 500); StartPosition = FormStartPosition.CenterScreen; // Initialize MaterialSkinManager skinManager = MaterialSkinManager.Instance; skinManager.AddFormToManage(this); skinManager.Theme = MaterialSkinManager.Themes.LIGHT; skinManager.ColorScheme = new ColorScheme( Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); // Theme toggle button var btnTheme = new MaterialFlatButton { Text = "TOGGLE THEME", Location = new Point(20, 80), AutoSize = true }; btnTheme.Click += (s, e) => { skinManager.Theme = skinManager.Theme == MaterialSkinManager.Themes.DARK ? MaterialSkinManager.Themes.LIGHT : MaterialSkinManager.Themes.DARK; }; // Color scheme button var btnColor = new MaterialRaisedButton { Text = "CHANGE COLORS", Location = new Point(160, 80), AutoSize = true }; btnColor.Click += (s, e) => { colorSchemeIndex = (colorSchemeIndex + 1) % 3; skinManager.ColorScheme = colorSchemeIndex switch { 0 => new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE), 1 => new ColorScheme(Primary.Indigo500, Primary.Indigo700, Primary.Indigo100, Accent.Pink200, TextShade.WHITE), _ => new ColorScheme(Primary.Green600, Primary.Green700, Primary.Green200, Accent.Red100, TextShade.WHITE) }; }; // Sample controls var txtInput = new MaterialSingleLineTextField { Hint = "Enter your name", Location = new Point(20, 140), Width = 250 }; var chkAgree = new MaterialCheckBox { Text = "I agree to the terms", Location = new Point(20, 180), AutoSize = true }; var btnSubmit = new MaterialRaisedButton { Text = "SUBMIT", Location = new Point(20, 220), AutoSize = true }; btnSubmit.Click += (s, e) => { if (chkAgree.Checked && !string.IsNullOrEmpty(txtInput.Text)) MessageBox.Show($"Hello, {txtInput.Text}!"); else MessageBox.Show("Please fill all fields and accept terms."); }; Controls.AddRange(new Control[] { btnTheme, btnColor, txtInput, chkAgree, btnSubmit }); } [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MaterialApp()); } } ``` -------------------------------- ### Create and Use MaterialFlatButton in C# Source: https://context7.com/ignacemaes/materialskin/llms.txt Demonstrates the creation of MaterialFlatButton controls, including standard, primary-colored, and icon-enabled variants. Shows how to set the primary color property and handle positioning. Also includes an example of a disabled flat button. ```csharp using MaterialSkin.Controls; // Standard flat button var btnMore = new MaterialFlatButton { Text = "LEARN MORE", Primary = false, // Use default text color AutoSize = true, Location = new Point(20, 350) }; // Primary colored flat button var btnAction = new MaterialFlatButton { Text = "ACTION", Primary = true, // Use primary color for text AutoSize = true, Location = new Point(140, 350) }; // Flat button with icon var btnAdd = new MaterialFlatButton { Text = "ADD ITEM", Icon = Properties.Resources.plus_icon, AutoSize = true, Location = new Point(20, 400) }; // Disabled flat button var btnDisabled = new MaterialFlatButton { Text = "DISABLED", Enabled = false, AutoSize = true, Location = new Point(140, 400) }; this.Controls.AddRange(new Control[] { btnMore, btnAction, btnAdd, btnDisabled }); ``` -------------------------------- ### Initialize and Manage MaterialSkin in WinForms Source: https://context7.com/ignacemaes/materialskin/llms.txt Demonstrates how to integrate MaterialSkin into a WinForms application by inheriting from MaterialForm and using the MaterialSkinManager singleton to control themes and form management. ```csharp using MaterialSkin; using MaterialSkin.Controls; public partial class MainForm : MaterialForm { private readonly MaterialSkinManager materialSkinManager; public MainForm() { InitializeComponent(); 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 ); } private void ToggleTheme() { materialSkinManager.Theme = materialSkinManager.Theme == MaterialSkinManager.Themes.DARK ? MaterialSkinManager.Themes.LIGHT : MaterialSkinManager.Themes.DARK; } protected override void OnFormClosing(FormClosingEventArgs e) { materialSkinManager.RemoveFormToManage(this); base.OnFormClosing(e); } } ``` -------------------------------- ### Create MaterialContextMenuStrip with Submenus Source: https://context7.com/ignacemaes/materialskin/llms.txt Shows how to build a context menu with Material Design styling, including separators, event handling for clicks, and nested submenus. ```csharp using MaterialSkin.Controls; var contextMenu = new MaterialContextMenuStrip(); var menuCut = new MaterialToolStripMenuItem { Text = "Cut" }; var menuCopy = new MaterialToolStripMenuItem { Text = "Copy" }; var menuPaste = new MaterialToolStripMenuItem { Text = "Paste" }; var menuDelete = new MaterialToolStripMenuItem { Text = "Delete" }; contextMenu.Items.AddRange(new ToolStripItem[] { menuCut, menuCopy, menuPaste, new ToolStripSeparator(), menuDelete }); contextMenu.OnItemClickStart += (sender, e) => { switch (e.ClickedItem.Text) { case "Cut": PerformCut(); break; case "Copy": PerformCopy(); break; case "Paste": PerformPaste(); break; case "Delete": PerformDelete(); break; } }; var menuMore = new MaterialToolStripMenuItem { Text = "More Options" }; menuMore.DropDownItems.Add(new MaterialToolStripMenuItem { Text = "Option 1" }); menuMore.DropDownItems.Add(new MaterialToolStripMenuItem { Text = "Option 2" }); contextMenu.Items.Add(menuMore); var panel = new Panel { Location = new Point(20, 300), Size = new Size(200, 100) }; panel.ContextMenuStrip = contextMenu; this.Controls.Add(panel); ``` -------------------------------- ### Implement MaterialSingleLineTextField Source: https://context7.com/ignacemaes/materialskin/llms.txt Demonstrates creating single-line text inputs with hints, password masking, and event handling for validation and text manipulation. ```csharp using MaterialSkin.Controls; var txtUsername = new MaterialSingleLineTextField { Hint = "Username", Location = new Point(20, 450), Width = 250 }; var txtPassword = new MaterialSingleLineTextField { Hint = "Password", UseSystemPasswordChar = true, Location = new Point(20, 490), Width = 250 }; var txtPin = new MaterialSingleLineTextField { Hint = "Enter PIN", PasswordChar = '*', MaxLength = 4, Location = new Point(20, 530), Width = 150 }; txtUsername.TextChanged += (sender, e) => { string text = txtUsername.Text; Console.WriteLine($"Username: {text}"); }; txtUsername.KeyPress += (sender, e) => { if (!char.IsLetterOrDigit(e.KeyChar) && !char.IsControl(e.KeyChar)) { e.Handled = true; } }; txtUsername.SelectAll(); txtUsername.Clear(); txtUsername.Focus(); this.Controls.AddRange(new Control[] { txtUsername, txtPassword, txtPin }); ``` -------------------------------- ### Create and Configure MaterialCheckBox in C# Source: https://context7.com/ignacemaes/materialskin/llms.txt Demonstrates how to programmatically create a MaterialCheckBox, set its properties like text, checked state, and ripple effect, handle the CheckedChanged event, and add it to a form. Supports enabling/disabling the checkbox. ```csharp using MaterialSkin.Controls; // Create checkbox programmatically var checkbox = new MaterialCheckBox { Text = "Enable notifications", Checked = true, Ripple = true, // Enable ripple animation (default: true) AutoSize = true, Location = new Point(20, 100) }; // Handle checked changed event checkbox.CheckedChanged += (sender, e) => { bool isChecked = ((MaterialCheckBox)sender).Checked; Console.WriteLine($"Checkbox is now: {(isChecked ? "checked" : "unchecked")}"); }; // Disable the checkbox checkbox.Enabled = false; // Add to form this.Controls.Add(checkbox); ``` -------------------------------- ### Define and Apply MaterialSkin Color Schemes Source: https://context7.com/ignacemaes/materialskin/llms.txt Shows how to create custom ColorScheme instances using predefined Material Design constants and apply them to the MaterialSkinManager to update the application's visual style. ```csharp using MaterialSkin; var indigoScheme = new ColorScheme( Primary.Indigo500, Primary.Indigo700, Primary.Indigo100, Accent.Pink200, TextShade.WHITE ); MaterialSkinManager.Instance.ColorScheme = indigoScheme; Color primaryColor = MaterialSkinManager.Instance.ColorScheme.PrimaryColor; Brush primaryBrush = MaterialSkinManager.Instance.ColorScheme.PrimaryBrush; Pen accentPen = MaterialSkinManager.Instance.ColorScheme.AccentPen; ``` -------------------------------- ### Configure MaterialTabControl and MaterialTabSelector Source: https://context7.com/ignacemaes/materialskin/llms.txt Shows how to link a tab control with a selector to create animated tab navigation. Includes adding pages and handling selection changes. ```csharp using MaterialSkin.Controls; var tabControl = new MaterialTabControl { Location = new Point(0, 100), Size = new Size(500, 300), Dock = DockStyle.Fill }; var tabHome = new TabPage { Text = "HOME" }; var tabSettings = new TabPage { Text = "SETTINGS" }; var tabAbout = new TabPage { Text = "ABOUT" }; tabControl.TabPages.AddRange(new TabPage[] { tabHome, tabSettings, tabAbout }); var tabSelector = new MaterialTabSelector { BaseTabControl = tabControl, Location = new Point(0, 64), Size = new Size(500, 48), Dock = DockStyle.Top }; tabControl.SelectedIndexChanged += (sender, e) => { Console.WriteLine($"Selected tab: {tabControl.SelectedTab.Text}"); }; tabControl.SelectedIndex = 1; this.Controls.Add(tabControl); this.Controls.Add(tabSelector); ``` -------------------------------- ### Create MaterialProgressBar Source: https://context7.com/ignacemaes/materialskin/llms.txt Implements a Material Design progress bar with a fixed height and demonstrates how to update its value via user interaction. ```csharp using MaterialSkin.Controls; var progressBar = new MaterialProgressBar { Location = new Point(20, 580), Width = 300, Minimum = 0, Maximum = 100, Value = 0 }; var btnIncrease = new MaterialRaisedButton { Text = "+", Location = new Point(330, 575), Size = new Size(40, 36) }; btnIncrease.Click += (s, e) => progressBar.Value = Math.Min(progressBar.Value + 10, 100); var btnDecrease = new MaterialFlatButton { Text = "-", Location = new Point(380, 575), Size = new Size(40, 36) }; btnDecrease.Click += (s, e) => progressBar.Value = Math.Max(progressBar.Value - 10, 0); this.Controls.AddRange(new Control[] { progressBar, btnIncrease, btnDecrease }); ``` -------------------------------- ### Initialize MaterialSkin ColorScheme Source: https://github.com/ignacemaes/materialskin/blob/master/README.md Configure the MaterialSkinManager instance to set the application theme and color scheme. This ensures the form and its components reflect the chosen design settings. ```csharp 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); } ``` ```vbnet 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 ``` -------------------------------- ### Implement MaterialForm for Custom Styling Source: https://context7.com/ignacemaes/materialskin/llms.txt Explains how to replace the standard Form class with MaterialForm to enable Material Design features like custom title bars and window control buttons. ```csharp using MaterialSkin.Controls; public partial class MyMaterialApp : MaterialForm { public MyMaterialApp() { InitializeComponent(); this.Sizable = true; this.Text = "My Material App"; this.MinimizeBox = true; this.MaximizeBox = true; this.ControlBox = true; var manager = MaterialSkinManager.Instance; manager.AddFormToManage(this); manager.Theme = MaterialSkinManager.Themes.LIGHT; } } ``` -------------------------------- ### Implement MaterialListView for Tabular Data Source: https://context7.com/ignacemaes/materialskin/llms.txt Demonstrates how to initialize a MaterialListView, populate it with columns and data, and handle row selection events. This component provides built-in hover highlighting and selection states. ```csharp using MaterialSkin.Controls; var listView = new MaterialListView { Location = new Point(20, 100), Size = new Size(400, 200) }; listView.Columns.Add("Dessert", 150); listView.Columns.Add("Calories", 80); listView.Columns.Add("Fat (g)", 70); listView.Columns.Add("Carbs (g)", 70); var desserts = new[] { new[] { "Lollipop", "392", "0.2", "0" }, new[] { "KitKat", "518", "26.0", "7" }, new[] { "Ice cream sandwich", "237", "9.0", "4.3" }, new[] { "Jelly Bean", "375", "0.0", "0.0" }, new[] { "Honeycomb", "408", "3.2", "6.5" } }; foreach (string[] dessert in desserts) { var item = new ListViewItem(dessert); listView.Items.Add(item); } listView.SelectedIndexChanged += (sender, e) => { if (listView.SelectedItems.Count > 0) { var selected = listView.SelectedItems[0]; Console.WriteLine($"Selected: {selected.SubItems[0].Text}"); } }; this.Controls.Add(listView); ``` -------------------------------- ### Create and Manage MaterialRadioButton Group in C# Source: https://context7.com/ignacemaes/materialskin/llms.txt Illustrates the creation of multiple MaterialRadioButton controls to form a group. Radio buttons within the same container automatically manage selection. Shows how to set default selections and handleCheckedChanged events for each button. ```csharp using MaterialSkin.Controls; // Create a group of radio buttons var radioSmall = new MaterialRadioButton { Text = "Small", Ripple = true, Location = new Point(20, 140), AutoSize = true }; var radioMedium = new MaterialRadioButton { Text = "Medium", Ripple = true, Checked = true, // Default selection Location = new Point(20, 170), AutoSize = true }; var radioLarge = new MaterialRadioButton { Text = "Large", Ripple = true, Location = new Point(20, 200), AutoSize = true }; // Handle selection changes radioSmall.CheckedChanged += (s, e) => { if (radioSmall.Checked) OnSizeSelected("Small"); }; radioMedium.CheckedChanged += (s, e) => { if (radioMedium.Checked) OnSizeSelected("Medium"); }; radioLarge.CheckedChanged += (s, e) => { if (radioLarge.Checked) OnSizeSelected("Large"); }; // Add to a GroupBox or Panel to create the radio group var sizeGroup = new GroupBox { Text = "Select Size", Location = new Point(10, 120), Size = new Size(200, 120) }; sizeGroup.Controls.AddRange(new Control[] { radioSmall, radioMedium, radioLarge }); this.Controls.Add(sizeGroup); ``` -------------------------------- ### Create and Use MaterialRaisedButton in C# Source: https://context7.com/ignacemaes/materialskin/llms.txt Shows how to create MaterialRaisedButton controls with options for primary color, secondary (white) background, and icons. Includes handling the Click event and positioning buttons on the form. Supports auto-sizing. ```csharp using MaterialSkin.Controls; // Primary raised button (uses primary color) var btnSubmit = new MaterialRaisedButton { Text = "SUBMIT", Primary = true, // Use primary color (default: true) AutoSize = true, Location = new Point(20, 250) }; btnSubmit.Click += (sender, e) => { MessageBox.Show("Form submitted!"); }; // Secondary raised button (white background) var btnCancel = new MaterialRaisedButton { Text = "CANCEL", Primary = false, // Use white background AutoSize = true, Location = new Point(120, 250) }; // Button with icon var btnSettings = new MaterialRaisedButton { Text = "SETTINGS", Primary = true, Icon = Properties.Resources.ic_settings_white_24dp, // 24x24 icon AutoSize = true, Location = new Point(20, 300) }; this.Controls.AddRange(new Control[] { btnSubmit, btnCancel, btnSettings }); ``` -------------------------------- ### Add MaterialLabel and MaterialDivider Source: https://context7.com/ignacemaes/materialskin/llms.txt Basic implementation of text labels and horizontal dividers that automatically adhere to Material Design color and sizing standards. ```csharp using MaterialSkin.Controls; var label = new MaterialLabel { Text = "Material Design Label", Location = new Point(20, 20), AutoSize = true }; var divider = new MaterialDivider { Location = new Point(20, 50), Size = new Size(300, 1) }; this.Controls.AddRange(new Control[] { label, divider }); ``` -------------------------------- ### MaterialFlatButton Control Source: https://context7.com/ignacemaes/materialskin/llms.txt API for creating flat buttons for secondary actions. ```APIDOC ## MaterialFlatButton ### Description A flat button without elevation, featuring hover highlight and ripple animation. Use for secondary actions or within dialogs. ### Method N/A (C# Class Instantiation) ### Parameters - **Text** (string) - Optional - Button label. - **Primary** (bool) - Optional - If true, uses primary theme color for text. - **Icon** (Image) - Optional - Icon to display on the button. ### Request Example var btn = new MaterialFlatButton { Text = "LEARN MORE", Primary = false }; ``` -------------------------------- ### MaterialCheckBox Control Source: https://context7.com/ignacemaes/materialskin/llms.txt API for creating and configuring an animated MaterialCheckBox control. ```APIDOC ## MaterialCheckBox ### Description An animated checkbox control with ripple effect that follows Material Design guidelines. Supports checked/unchecked states, disabled mode, and configurable ripple animation. ### Method N/A (C# Class Instantiation) ### Parameters - **Text** (string) - Optional - The display text for the checkbox. - **Checked** (bool) - Optional - Initial checked state. - **Ripple** (bool) - Optional - Enables or disables the ripple animation. - **Enabled** (bool) - Optional - Sets the enabled state of the control. ### Request Example var checkbox = new MaterialCheckBox { Text = "Enable", Checked = true, Ripple = true }; ``` -------------------------------- ### MaterialRadioButton Control Source: https://context7.com/ignacemaes/materialskin/llms.txt API for creating and grouping MaterialRadioButton controls. ```APIDOC ## MaterialRadioButton ### Description An animated radio button with ripple effect for selecting one option from a group. Groups are managed by placing radio buttons in the same container. ### Method N/A (C# Class Instantiation) ### Parameters - **Text** (string) - Optional - The display text for the radio button. - **Checked** (bool) - Optional - Initial selection state. - **Ripple** (bool) - Optional - Enables or disables the ripple animation. ### Request Example var radio = new MaterialRadioButton { Text = "Option 1", Ripple = true, Checked = true }; ``` -------------------------------- ### Inherit from MaterialForm Source: https://github.com/ignacemaes/materialskin/blob/master/README.md To apply MaterialSkin styling, your form class must inherit from MaterialForm instead of the standard Form class. ```csharp public partial class Form1 : MaterialForm ``` ```vbnet Partial Class Form1 Inherits MaterialSkin.Controls.MaterialForm End Class ``` -------------------------------- ### MaterialRaisedButton Control Source: https://context7.com/ignacemaes/materialskin/llms.txt API for creating elevated buttons for primary actions. ```APIDOC ## MaterialRaisedButton ### Description A raised button with elevation and ripple animation. Use for primary actions with emphasis. Supports icons and auto-sizing. ### Method N/A (C# Class Instantiation) ### Parameters - **Text** (string) - Optional - Button label. - **Primary** (bool) - Optional - If true, uses primary theme color. - **Icon** (Image) - Optional - Icon to display on the button. ### Request Example var btn = new MaterialRaisedButton { Text = "SUBMIT", Primary = true }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.