About component
Text-box fields let users enter and edit text.
How to use it?
Like other controls, MTextBox can be simply droped from toolbox on the form. If you are not using IDE with integrated form designer (like Visual Studio), you can always create a text-box button programmatically:
// Initialize text-box first
MTextBox textBox = new MTextBox();
// Set location
textBox.Location = new Point(50, 50);
// Don't forget to add our newly created
// text-box to form's control collection.
targetForm.Controls.Add(textBox);
using System;
using System.Windows.Forms;
using Minimal.Components;
namespace Demo
{
public partial class MyForm : Form
{
// Initialize text-box first
MTextBox textBox = new MTextBox();
// Form constructor
public MyForm()
{
InitializeComponent();
// Set size and location
textBox.Location = new Point(50, 50);
// Don't forget to add our newly created
// text-box to form's control collection.
Controls.Add(textBox);
}
}
}
Code example asumes, that targetForm variable is form where you want to have your color-box placed. If you are working inside a class derived from System.Windows.Forms.Form, you can of course replace targetForm variable with this keyword or in latest version of C# omit form reference completely. See second example above. Like other M-Components in Minimal library, MTextBox now support all handy features like accent or themes. In addition, support for hints was added. Hint can be placed on left, right or on both sides. They can be set using LeftHint and RightHint properties. Font of both hints can be changed using HintFont property.
Class content
Assembly |
Minimal.dll |
Namespace |
Minimal.Components |
Inheritance |
UserControl |
Attributes |
Minimal.Components.Design.TextBoxDesigner |
Implements |
IMComponent |
This list doesn’t include content derived from the parent class. See Microsoft’s official UserControl class documentation for a complete list of items.
Although the MTextBox do not directly inherit from the TextBox class it still have all classic text-box properties and events build-in. For the clarity purposes there are not listed below and you can find them in Miscrosoft’s official documentation under TextBox section.
Constructors
Name |
Description |
|
MTextBox() |
Initializes a new instance of the MTextBox class. |
|
Properties
Name |
Description |
Type |
Component |
Handles life-cycle of the M-Component. |
MComponent |
Accent |
Component’s accent color. Main visible color of the component. |
Color |
CustomTheme |
Component’s custom theme. Will override default parent M-form theme or application wide theme. |
Theme |
LeftHint |
Text-box's inner left-sided hint. |
string |
RightHint |
Text-box's inner right-sided hint. |
string |
HintFont |
Font of the both hints. |
Font |
AutoHideHints |
Will hide both hints if text-box contains text. |
bool |
Fields
Name |
Description |
Type |
- |
- |
- |
Events
Name |
Description |
Type |
AccentChanged |
Fires when the Accent property is changed. |
PropertyChangedEventHandler |
CustomThemeChanged |
Fires when the CustomTheme property is changed. |
PropertyChangedEventHandler |
Methods
Name |
Description |
Returns |
Clear() |
Resets Text property. |
- |