From c1af26c2b345488054b7954e46c68eb33f45193f Mon Sep 17 00:00:00 2001 From: orapps44 <77468294+orapps44@users.noreply.github.com> Date: Mon, 25 Oct 2021 08:09:00 +0200 Subject: [PATCH 1/5] MaterialMaskedTextBox Add AssistiveText MaterialMaskedTextBox Add AssistiveText. --- .../Controls/MaterialMaskedTextBox.cs | 140 +++++++++++++++--- 1 file changed, 122 insertions(+), 18 deletions(-) diff --git a/MaterialSkin/Controls/MaterialMaskedTextBox.cs b/MaterialSkin/Controls/MaterialMaskedTextBox.cs index e610f4d3..2c9162b7 100644 --- a/MaterialSkin/Controls/MaterialMaskedTextBox.cs +++ b/MaterialSkin/Controls/MaterialMaskedTextBox.cs @@ -57,14 +57,54 @@ public bool UseTallSize get { return _UseTallSize; } set { - //if (_UseTallSize != value) - //{ _UseTallSize = value; - HEIGHT = _UseTallSize ? 48 : 36; - Size = new Size(Size.Width, HEIGHT); + UpdateHeight(); UpdateRects(); Invalidate(); - //} + } + } + + private bool _showAssistiveText; + [Category("Material Skin"), DefaultValue(false), Description("Assistive elements provide additional detail about text entered into text fields. Could be Helper text or Error message.")] + public bool ShowAssistiveText + { + get { return _showAssistiveText; } + set + { + _showAssistiveText = value; + if (_showAssistiveText) + _helperTextHeight = HELPER_TEXT_HEIGHT; + else + _helperTextHeight = 0; + UpdateHeight(); + //UpdateRects(); + Invalidate(); + } + } + + private string _helperText; + + [Category("Material Skin"), DefaultValue(""), Localizable(true), Description("Helper text conveys additional guidance about the input field, such as how it will be used.")] + public string HelperText + { + get { return _helperText; } + set + { + _helperText = value; + Invalidate(); + } + } + + private string _errorMessage; + + [Category("Material Skin"), DefaultValue(""), Localizable(true), Description("When text input isn't accepted, an error message can display instructions on how to fix it. Error messages are displayed below the input line, replacing helper text until fixed.")] + public string ErrorMessage + { + get { return _errorMessage; } + set + { + _errorMessage = value; + Invalidate(); } } @@ -1273,6 +1313,7 @@ public event TypeValidationEventHandler TypeValidationCompleted private const int LEFT_PADDING = 16; private const int RIGHT_PADDING = 12; private const int ACTIVATION_INDICATOR_HEIGHT = 2; + private const int HELPER_TEXT_HEIGHT = 16; private const int FONT_HEIGHT = 20; private int HEIGHT = 48; @@ -1284,6 +1325,7 @@ public event TypeValidationEventHandler TypeValidationCompleted private int _right_padding; private int _prefix_padding; private int _suffix_padding; + private int _helperTextHeight; private Rectangle _leadingIconBounds; private Rectangle _trailingIconBounds; @@ -1291,6 +1333,7 @@ public event TypeValidationEventHandler TypeValidationCompleted private Dictionary iconsErrorBrushes; protected readonly BaseMaskedTextBox baseTextBox; + public MaterialMaskedTextBox() { // Material Properties @@ -1337,6 +1380,9 @@ public MaterialMaskedTextBox() UseTallSize = true; PrefixSuffix = PrefixSuffixTypes.None; + ShowAssistiveText = true; + HelperText = string.Empty; + ErrorMessage = string.Empty; if (!Controls.Contains(baseTextBox) && !DesignMode) { @@ -1404,7 +1450,10 @@ protected override void OnPaint(PaintEventArgs pevent) //Leading Icon if (LeadingIcon != null) { - g.FillRectangle(iconsBrushes["_leadingIcon"], _leadingIconBounds); + if (_errorState) + g.FillRectangle(iconsErrorBrushes["_leadingIcon"], _leadingIconBounds); + else + g.FillRectangle(iconsBrushes["_leadingIcon"], _leadingIconBounds); } //Trailing Icon @@ -1418,6 +1467,7 @@ protected override void OnPaint(PaintEventArgs pevent) // HintText bool userTextPresent = !String.IsNullOrEmpty(Text); + Rectangle helperTextRect = new Rectangle(LEFT_PADDING - _prefix_padding, LINE_Y + ACTIVATION_INDICATOR_HEIGHT, Width - (LEFT_PADDING - _prefix_padding) - _right_padding, HELPER_TEXT_HEIGHT); Rectangle hintRect = new Rectangle(_left_padding - _prefix_padding, HINT_TEXT_SMALL_Y, Width - (_left_padding - _prefix_padding) - _right_padding, HINT_TEXT_SMALL_SIZE); int hintTextSize = 12; @@ -1431,7 +1481,7 @@ protected override void OnPaint(PaintEventArgs pevent) // bottom line if (isFocused) { - g.FillRectangle(isFocused ? UseAccent ? SkinManager.ColorScheme.AccentBrush : SkinManager.ColorScheme.PrimaryBrush : SkinManager.DividersBrush, 0, LINE_Y, Width, isFocused ? 2 : 1); + g.FillRectangle(_errorState ? SkinManager.BackgroundHoverRedBrush : isFocused ? UseAccent ? SkinManager.ColorScheme.AccentBrush : SkinManager.ColorScheme.PrimaryBrush : SkinManager.DividersBrush, 0, LINE_Y, Width, isFocused ? 2 : 1); } } else @@ -1453,7 +1503,6 @@ protected override void OnPaint(PaintEventArgs pevent) Rectangle prefixRect = new Rectangle( _left_padding - _prefix_padding, hasHint && UseTallSize ? (hintRect.Y + hintRect.Height) - 2 : ClientRectangle.Y, -// NativeText.MeasureLogString(_prefixsuffixText, SkinManager.getLogFontByType(MaterialSkinManager.fontType.Subtitle1)).Width, _prefix_padding, hasHint && UseTallSize ? LINE_Y - (hintRect.Y + hintRect.Height) : LINE_Y); @@ -1476,7 +1525,6 @@ protected override void OnPaint(PaintEventArgs pevent) Rectangle suffixRect = new Rectangle( Width - _right_padding , hasHint && UseTallSize ? (hintRect.Y + hintRect.Height) - 2 : ClientRectangle.Y, - //NativeText.MeasureLogString(_prefixsuffixText, SkinManager.getLogFontByType(MaterialSkinManager.fontType.Subtitle1)).Width + PREFIX_SUFFIX_PADDING, _suffix_padding, hasHint && UseTallSize ? LINE_Y - (hintRect.Y + hintRect.Height) : LINE_Y); @@ -1511,6 +1559,43 @@ protected override void OnPaint(PaintEventArgs pevent) } } + // Draw helper text + if (_showAssistiveText && isFocused && !_errorState) + { + using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) + { + NativeText.DrawTransparentText( + HelperText, + SkinManager.getTextBoxFontBySize(hintTextSize), + Enabled ? !_errorState || (!userTextPresent && !isFocused) ? isFocused ? UseAccent ? + SkinManager.ColorScheme.AccentColor : // Focus Accent + SkinManager.ColorScheme.PrimaryColor : // Focus Primary + SkinManager.TextMediumEmphasisColor : // not focused + SkinManager.BackgroundHoverRedColor : // error state + SkinManager.TextDisabledOrHintColor, // Disabled + helperTextRect.Location, + helperTextRect.Size, + NativeTextRenderer.TextAlignFlags.Left | NativeTextRenderer.TextAlignFlags.Middle); + } + } + + // Draw error message + if (_showAssistiveText && _errorState && ErrorMessage!=null) + { + using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) + { + NativeText.DrawTransparentText( + ErrorMessage, + SkinManager.getTextBoxFontBySize(hintTextSize), + Enabled ? + SkinManager.BackgroundHoverRedColor : // error state + SkinManager.TextDisabledOrHintColor, // Disabled + helperTextRect.Location, + helperTextRect.Size, + NativeTextRenderer.TextAlignFlags.Left | NativeTextRenderer.TextAlignFlags.Middle); + } + } + } protected override void OnMouseMove(MouseEventArgs e) @@ -1588,7 +1673,7 @@ protected override void OnResize(EventArgs e) preProcessIcons(); Size = new Size(Width, HEIGHT); - LINE_Y = HEIGHT - ACTIVATION_INDICATOR_HEIGHT; + LINE_Y = HEIGHT - ACTIVATION_INDICATOR_HEIGHT - _helperTextHeight; } @@ -1694,31 +1779,38 @@ private void preProcessIcons() Size newSize_leadingIcon = ResizeIcon(_leadingIcon); Bitmap _leadingIconIconResized = new Bitmap(_leadingIcon, newSize_leadingIcon.Width, newSize_leadingIcon.Height); - // Create a pre-processed copy of the image (GRAY) - Bitmap bgray = new Bitmap(destRect.Width, destRect.Height); - using (Graphics gGray = Graphics.FromImage(bgray)) + //Create a pre - processed copy of the image(RED) + Bitmap bred = new Bitmap(destRect.Width, destRect.Height); + using (Graphics gred = Graphics.FromImage(bred)) { - gGray.DrawImage(_leadingIconIconResized, + gred.DrawImage(_leadingIconIconResized, new Point[] { new Point(0, 0), new Point(destRect.Width, 0), new Point(0, destRect.Height), }, - destRect, GraphicsUnit.Pixel, grayImageAttributes); + destRect, GraphicsUnit.Pixel, redImageAttributes); } // added processed image to brush for drawing TextureBrush textureBrushGray = new TextureBrush(bgray); + TextureBrush textureBrushRed = new TextureBrush(bred); textureBrushGray.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp; + textureBrushRed.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp; var iconRect = _leadingIconBounds; textureBrushGray.TranslateTransform(iconRect.X + iconRect.Width / 2 - _leadingIconIconResized.Width / 2, iconRect.Y + iconRect.Height / 2 - _leadingIconIconResized.Height / 2); + textureBrushRed.TranslateTransform(iconRect.X + iconRect.Width / 2 - _leadingIconIconResized.Width / 2, + iconRect.Y + iconRect.Height / 2 - _leadingIconIconResized.Height / 2); // add to dictionary iconsBrushes.Add("_leadingIcon", textureBrushGray); + + iconsErrorBrushes.Add("_leadingIcon", textureBrushRed); + } if (_trailingIcon != null) @@ -1781,6 +1873,13 @@ private void preProcessIcons() #endregion + private void UpdateHeight() + { + HEIGHT = _UseTallSize ? 48 : 36; + HEIGHT += _helperTextHeight; + Size = new Size(Size.Width, HEIGHT); + } + private void UpdateRects() { if (LeadingIcon != null) @@ -1822,18 +1921,23 @@ private void UpdateRects() } else { - baseTextBox.Location = new Point(_left_padding, HEIGHT / 2 - FONT_HEIGHT / 2); + baseTextBox.Location = new Point(_left_padding, (LINE_Y + ACTIVATION_INDICATOR_HEIGHT) / 2 - FONT_HEIGHT / 2); baseTextBox.Width = Width - (_left_padding + _right_padding); baseTextBox.Height = FONT_HEIGHT; } - _leadingIconBounds = new Rectangle(8, (HEIGHT / 2) - (ICON_SIZE / 2), ICON_SIZE, ICON_SIZE); - _trailingIconBounds = new Rectangle(Width - (ICON_SIZE + 8), (HEIGHT / 2) - (ICON_SIZE / 2), ICON_SIZE, ICON_SIZE); + _leadingIconBounds = new Rectangle(8, ((LINE_Y + ACTIVATION_INDICATOR_HEIGHT) / 2) - (ICON_SIZE / 2), ICON_SIZE, ICON_SIZE); + _trailingIconBounds = new Rectangle(Width - (ICON_SIZE + 8), ((LINE_Y + ACTIVATION_INDICATOR_HEIGHT) / 2) - (ICON_SIZE / 2), ICON_SIZE, ICON_SIZE); } public void SetErrorState(bool ErrorState) { _errorState = ErrorState; + if (_errorState) + baseTextBox.ForeColor = SkinManager.BackgroundHoverRedColor; + else + baseTextBox.ForeColor = SkinManager.TextHighEmphasisColor; + baseTextBox.Invalidate(); Invalidate(); } From 7aa1f8c2875d6e47ae6ed3b3b1b92e660ce68a94 Mon Sep 17 00:00:00 2001 From: orapps44 <77468294+orapps44@users.noreply.github.com> Date: Mon, 25 Oct 2021 08:21:25 +0200 Subject: [PATCH 2/5] MaterialTextBox2 Add AssistiveText MaterialTextBox2 Add AssistiveText --- MaterialSkin/Controls/MaterialTextBox2.cs | 143 +++++++++++++++++++--- 1 file changed, 129 insertions(+), 14 deletions(-) diff --git a/MaterialSkin/Controls/MaterialTextBox2.cs b/MaterialSkin/Controls/MaterialTextBox2.cs index e3abe4a9..d34085fb 100644 --- a/MaterialSkin/Controls/MaterialTextBox2.cs +++ b/MaterialSkin/Controls/MaterialTextBox2.cs @@ -57,14 +57,54 @@ public bool UseTallSize get { return _UseTallSize; } set { - //if (_UseTallSize != value) - //{ _UseTallSize = value; - HEIGHT = _UseTallSize ? 48 : 36; - Size = new Size(Size.Width, HEIGHT); + UpdateHeight(); UpdateRects(); Invalidate(); - //} + } + } + + private bool _showAssistiveText; + [Category("Material Skin"), DefaultValue(false), Description("Assistive elements provide additional detail about text entered into text fields. Could be Helper text or Error message.")] + public bool ShowAssistiveText + { + get { return _showAssistiveText; } + set + { + _showAssistiveText = value; + if (_showAssistiveText) + _helperTextHeight = HELPER_TEXT_HEIGHT; + else + _helperTextHeight = 0; + UpdateHeight(); + //UpdateRects(); + Invalidate(); + } + } + + private string _helperText; + + [Category("Material Skin"), DefaultValue(""), Localizable(true), Description("Helper text conveys additional guidance about the input field, such as how it will be used.")] + public string HelperText + { + get { return _helperText; } + set + { + _helperText = value; + Invalidate(); + } + } + + private string _errorMessage; + + [Category("Material Skin"), DefaultValue(""), Localizable(true), Description("When text input isn't accepted, an error message can display instructions on how to fix it. Error messages are displayed below the input line, replacing helper text until fixed.")] + public string ErrorMessage + { + get { return _errorMessage; } + set + { + _errorMessage = value; + Invalidate(); } } @@ -1180,11 +1220,10 @@ public event EventHandler TextAlignChanged private const int ICON_SIZE = 24; private const int HINT_TEXT_SMALL_SIZE = 18; private const int HINT_TEXT_SMALL_Y = 4; - private const int TOP_PADDING = 8; //10; - private const int BOTTOM_PADDING = 8; //10; private const int LEFT_PADDING = 16; private const int RIGHT_PADDING = 12; private const int ACTIVATION_INDICATOR_HEIGHT = 2; + private const int HELPER_TEXT_HEIGHT = 16; private const int FONT_HEIGHT = 20; private int HEIGHT = 48; @@ -1196,6 +1235,7 @@ public event EventHandler TextAlignChanged private int _right_padding; private int _prefix_padding; private int _suffix_padding; + private int _helperTextHeight; private Rectangle _leadingIconBounds; private Rectangle _trailingIconBounds; @@ -1250,6 +1290,9 @@ public MaterialTextBox2() UseTallSize = true; PrefixSuffix = PrefixSuffixTypes.None; + ShowAssistiveText = true; + HelperText = string.Empty; + ErrorMessage = string.Empty; if (!Controls.Contains(baseTextBox) && !DesignMode) { @@ -1286,7 +1329,6 @@ public MaterialTextBox2() cms.Opening += ContextMenuStripOnOpening; cms.OnItemClickStart += ContextMenuStripOnItemClickStart; ContextMenuStrip = cms; - } private void Redraw(object sencer, EventArgs e) @@ -1317,7 +1359,10 @@ protected override void OnPaint(PaintEventArgs pevent) //Leading Icon if (LeadingIcon != null) { - g.FillRectangle(iconsBrushes["_leadingIcon"], _leadingIconBounds); + if (_errorState) + g.FillRectangle(iconsErrorBrushes["_leadingIcon"], _leadingIconBounds); + else + g.FillRectangle(iconsBrushes["_leadingIcon"], _leadingIconBounds); } //Trailing Icon @@ -1331,6 +1376,7 @@ protected override void OnPaint(PaintEventArgs pevent) // HintText bool userTextPresent = !String.IsNullOrEmpty(Text); + Rectangle helperTextRect = new Rectangle(LEFT_PADDING - _prefix_padding, LINE_Y + ACTIVATION_INDICATOR_HEIGHT, Width - (LEFT_PADDING - _prefix_padding) - _right_padding, HELPER_TEXT_HEIGHT); Rectangle hintRect = new Rectangle(_left_padding - _prefix_padding, HINT_TEXT_SMALL_Y, Width - (_left_padding - _prefix_padding) - _right_padding, HINT_TEXT_SMALL_SIZE); int hintTextSize = 12; @@ -1344,7 +1390,7 @@ protected override void OnPaint(PaintEventArgs pevent) // bottom line if (isFocused) { - g.FillRectangle(isFocused ? UseAccent ? SkinManager.ColorScheme.AccentBrush : SkinManager.ColorScheme.PrimaryBrush : SkinManager.DividersBrush, 0, LINE_Y, Width, isFocused ? 2 : 1); + g.FillRectangle(_errorState ? SkinManager.BackgroundHoverRedBrush : isFocused ? UseAccent ? SkinManager.ColorScheme.AccentBrush : SkinManager.ColorScheme.PrimaryBrush : SkinManager.DividersBrush, 0, LINE_Y, Width, isFocused ? 2 : 1); } } else @@ -1424,6 +1470,43 @@ protected override void OnPaint(PaintEventArgs pevent) } } + // Draw helper text + if (_showAssistiveText && isFocused && !_errorState) + { + using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) + { + NativeText.DrawTransparentText( + HelperText, + SkinManager.getTextBoxFontBySize(hintTextSize), + Enabled ? !_errorState || (!userTextPresent && !isFocused) ? isFocused ? UseAccent ? + SkinManager.ColorScheme.AccentColor : // Focus Accent + SkinManager.ColorScheme.PrimaryColor : // Focus Primary + SkinManager.TextMediumEmphasisColor : // not focused + SkinManager.BackgroundHoverRedColor : // error state + SkinManager.TextDisabledOrHintColor, // Disabled + helperTextRect.Location, + helperTextRect.Size, + NativeTextRenderer.TextAlignFlags.Left | NativeTextRenderer.TextAlignFlags.Middle); + } + } + + // Draw error message + if (_showAssistiveText && _errorState && ErrorMessage!=null) + { + using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) + { + NativeText.DrawTransparentText( + ErrorMessage, + SkinManager.getTextBoxFontBySize(hintTextSize), + Enabled ? + SkinManager.BackgroundHoverRedColor : // error state + SkinManager.TextDisabledOrHintColor, // Disabled + helperTextRect.Location, + helperTextRect.Size, + NativeTextRenderer.TextAlignFlags.Left | NativeTextRenderer.TextAlignFlags.Middle); + } + } + } protected override void OnMouseMove(MouseEventArgs e) @@ -1501,7 +1584,7 @@ protected override void OnResize(EventArgs e) preProcessIcons(); Size = new Size(Width, HEIGHT); - LINE_Y = HEIGHT - ACTIVATION_INDICATOR_HEIGHT; + LINE_Y = HEIGHT - ACTIVATION_INDICATOR_HEIGHT - _helperTextHeight; } @@ -1620,18 +1703,38 @@ private void preProcessIcons() destRect, GraphicsUnit.Pixel, grayImageAttributes); } + //Create a pre - processed copy of the image(RED) + Bitmap bred = new Bitmap(destRect.Width, destRect.Height); + using (Graphics gred = Graphics.FromImage(bred)) + { + gred.DrawImage(_leadingIconIconResized, + new Point[] { + new Point(0, 0), + new Point(destRect.Width, 0), + new Point(0, destRect.Height), + }, + destRect, GraphicsUnit.Pixel, redImageAttributes); + } + // added processed image to brush for drawing TextureBrush textureBrushGray = new TextureBrush(bgray); + TextureBrush textureBrushRed = new TextureBrush(bred); textureBrushGray.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp; + textureBrushRed.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp; var iconRect = _leadingIconBounds; textureBrushGray.TranslateTransform(iconRect.X + iconRect.Width / 2 - _leadingIconIconResized.Width / 2, iconRect.Y + iconRect.Height / 2 - _leadingIconIconResized.Height / 2); + textureBrushRed.TranslateTransform(iconRect.X + iconRect.Width / 2 - _leadingIconIconResized.Width / 2, + iconRect.Y + iconRect.Height / 2 - _leadingIconIconResized.Height / 2); // add to dictionary iconsBrushes.Add("_leadingIcon", textureBrushGray); + + iconsErrorBrushes.Add("_leadingIcon", textureBrushRed); + } if (_trailingIcon != null) @@ -1694,6 +1797,13 @@ private void preProcessIcons() #endregion + private void UpdateHeight() + { + HEIGHT = _UseTallSize ? 48 : 36; + HEIGHT += _helperTextHeight; + Size = new Size(Size.Width, HEIGHT); + } + private void UpdateRects() { if (LeadingIcon != null) @@ -1736,18 +1846,23 @@ private void UpdateRects() } else { - baseTextBox.Location = new Point(_left_padding, HEIGHT / 2 - FONT_HEIGHT / 2); + baseTextBox.Location = new Point(_left_padding, (LINE_Y + ACTIVATION_INDICATOR_HEIGHT) / 2 - FONT_HEIGHT / 2); baseTextBox.Width = Width - (_left_padding + _right_padding); baseTextBox.Height = FONT_HEIGHT; } - _leadingIconBounds = new Rectangle(8, (HEIGHT / 2) - (ICON_SIZE / 2), ICON_SIZE, ICON_SIZE); - _trailingIconBounds = new Rectangle(Width - (ICON_SIZE + 8), (HEIGHT / 2) - (ICON_SIZE / 2), ICON_SIZE, ICON_SIZE); + _leadingIconBounds = new Rectangle(8, ((LINE_Y + ACTIVATION_INDICATOR_HEIGHT) / 2) - (ICON_SIZE / 2), ICON_SIZE, ICON_SIZE); + _trailingIconBounds = new Rectangle(Width - (ICON_SIZE + 8), ((LINE_Y + ACTIVATION_INDICATOR_HEIGHT) / 2) - (ICON_SIZE / 2), ICON_SIZE, ICON_SIZE); } public void SetErrorState(bool ErrorState) { _errorState = ErrorState; + if (_errorState) + baseTextBox.ForeColor = SkinManager.BackgroundHoverRedColor; + else + baseTextBox.ForeColor = SkinManager.TextHighEmphasisColor; + baseTextBox.Invalidate(); Invalidate(); } From 1eee0b62e930dda0030e683405b4d22b28d297b5 Mon Sep 17 00:00:00 2001 From: orapps44 <77468294+orapps44@users.noreply.github.com> Date: Tue, 26 Oct 2021 18:47:11 +0200 Subject: [PATCH 3/5] Update MaterialMaskedTextBox.cs --- MaterialSkin/Controls/MaterialMaskedTextBox.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MaterialSkin/Controls/MaterialMaskedTextBox.cs b/MaterialSkin/Controls/MaterialMaskedTextBox.cs index 2c9162b7..565f30bd 100644 --- a/MaterialSkin/Controls/MaterialMaskedTextBox.cs +++ b/MaterialSkin/Controls/MaterialMaskedTextBox.cs @@ -1779,6 +1779,19 @@ private void preProcessIcons() Size newSize_leadingIcon = ResizeIcon(_leadingIcon); Bitmap _leadingIconIconResized = new Bitmap(_leadingIcon, newSize_leadingIcon.Width, newSize_leadingIcon.Height); + // Create a pre-processed copy of the image (GRAY) + Bitmap bgray = new Bitmap(destRect.Width, destRect.Height); + using (Graphics gGray = Graphics.FromImage(bgray)) + { + gGray.DrawImage(_leadingIconIconResized, + new Point[] { + new Point(0, 0), + new Point(destRect.Width, 0), + new Point(0, destRect.Height), + }, + destRect, GraphicsUnit.Pixel, grayImageAttributes); + } + //Create a pre - processed copy of the image(RED) Bitmap bred = new Bitmap(destRect.Width, destRect.Height); using (Graphics gred = Graphics.FromImage(bred)) From 074ab2c500801ba9074e7def8d10122a34e1b4d3 Mon Sep 17 00:00:00 2001 From: orapps44 <77468294+orapps44@users.noreply.github.com> Date: Tue, 26 Oct 2021 19:08:39 +0200 Subject: [PATCH 4/5] Update MainForm.cs --- MaterialSkinExample/MainForm.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MaterialSkinExample/MainForm.cs b/MaterialSkinExample/MainForm.cs index daa15dde..753560f0 100644 --- a/MaterialSkinExample/MainForm.cs +++ b/MaterialSkinExample/MainForm.cs @@ -279,6 +279,13 @@ private void materialButton25_Click(object sender, EventArgs e) SnackBarMessage.Show(this); } + + private void materialSwitch16_CheckedChanged(object sender, EventArgs e) + { + materialTextBox21.ShowAssistiveText = materialSwitch16.Checked; + } + + } } From 9989da594e727730b8180bba43bf6920204767ce Mon Sep 17 00:00:00 2001 From: orapps44 <77468294+orapps44@users.noreply.github.com> Date: Tue, 26 Oct 2021 19:17:00 +0200 Subject: [PATCH 5/5] Update MainForm.Designer.cs --- MaterialSkinExample/MainForm.Designer.cs | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/MaterialSkinExample/MainForm.Designer.cs b/MaterialSkinExample/MainForm.Designer.cs index df637c84..10eadb8e 100644 --- a/MaterialSkinExample/MainForm.Designer.cs +++ b/MaterialSkinExample/MainForm.Designer.cs @@ -127,6 +127,7 @@ private void InitializeComponent() this.tabPage3 = new System.Windows.Forms.TabPage(); this.materialSwitch15 = new MaterialSkin.Controls.MaterialSwitch(); this.materialSwitch14 = new MaterialSkin.Controls.MaterialSwitch(); + this.materialSwitch16 = new MaterialSkin.Controls.MaterialSwitch(); this.materialSwitch13 = new MaterialSkin.Controls.MaterialSwitch(); this.materialComboBox7 = new MaterialSkin.Controls.MaterialComboBox(); this.materialSwitch12 = new MaterialSkin.Controls.MaterialSwitch(); @@ -1757,6 +1758,7 @@ private void InitializeComponent() this.tabPage3.Controls.Add(this.materialMaskedTextBox1); this.tabPage3.Controls.Add(this.materialSwitch15); this.tabPage3.Controls.Add(this.materialSwitch14); + this.tabPage3.Controls.Add(this.materialSwitch16); this.tabPage3.Controls.Add(this.materialSwitch13); this.tabPage3.Controls.Add(this.materialComboBox7); this.tabPage3.Controls.Add(this.materialSwitch12); @@ -1813,6 +1815,24 @@ private void InitializeComponent() this.materialSwitch14.UseVisualStyleBackColor = true; this.materialSwitch14.CheckedChanged += new System.EventHandler(this.materialSwitch14_CheckedChanged); // + // materialSwitch16 + // + this.materialSwitch16.AutoSize = true; + this.materialSwitch16.Checked = true; + this.materialSwitch16.CheckState = System.Windows.Forms.CheckState.Checked; + this.materialSwitch16.Depth = 0; + this.materialSwitch16.Location = new System.Drawing.Point(729, 295); + this.materialSwitch16.Margin = new System.Windows.Forms.Padding(0); + this.materialSwitch16.MouseLocation = new System.Drawing.Point(-1, -1); + this.materialSwitch16.MouseState = MaterialSkin.MouseState.HOVER; + this.materialSwitch16.Name = "materialSwitch16"; + this.materialSwitch16.Ripple = true; + this.materialSwitch16.Size = new System.Drawing.Size(200, 37); + this.materialSwitch16.TabIndex = 76; + this.materialSwitch16.Text = "Show Assistive Text"; + this.materialSwitch16.UseVisualStyleBackColor = true; + this.materialSwitch16.CheckedChanged += new System.EventHandler(this.materialSwitch16_CheckedChanged); + // // materialSwitch13 // this.materialSwitch13.AutoSize = true; @@ -1914,7 +1934,9 @@ private void InitializeComponent() this.materialTextBox21.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.materialTextBox21.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal; this.materialTextBox21.Depth = 0; + this.materialTextBox21.ErrorMessage = "Invalid entry"; this.materialTextBox21.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.materialTextBox21.HelperText = "Helper Text"; this.materialTextBox21.HideSelection = true; this.materialTextBox21.LeadingIcon = null; this.materialTextBox21.Location = new System.Drawing.Point(528, 114); @@ -1929,6 +1951,7 @@ private void InitializeComponent() this.materialTextBox21.SelectionLength = 0; this.materialTextBox21.SelectionStart = 0; this.materialTextBox21.ShortcutsEnabled = true; + this.materialTextBox21.ShowAssistiveText = true; this.materialTextBox21.Size = new System.Drawing.Size(384, 48); this.materialTextBox21.TabIndex = 71; this.materialTextBox21.TabStop = false; @@ -3277,6 +3300,7 @@ private void InitializeComponent() this.DrawerTabControl = this.materialTabControl1; this.MinimumSize = new System.Drawing.Size(300, 200); this.Name = "MainForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "MaterialSkin Demo"; this.materialTabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); @@ -3481,5 +3505,6 @@ private void InitializeComponent() private MaterialMaskedTextBox materialMaskedTextBox1; private MaterialButton materialButton25; private MaterialLabel materialLabel57; + private MaterialSwitch materialSwitch16; } }