diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..a5c06e89
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,91 @@
+
+
+This repo is a fork obtained from https://github.com/leocb/MaterialSkin.git
+ - Revision: e14384f49f142cde712951824f6c461b57a0032b
+ - Author: orapps44 <77468294+orapps44@users.noreply.github.com>
+ - Date: 06/02/2022 21:50:11
+
+
+
+build 2.3.1.5 [2022-02-20]
+-------------------------
+ - Enhancements:
+ - MaterialComboBox - better support for font customization (Item text and hint text)
+ - user can change Item text font using properties pane, changes are rendered in design-mode as well as during runtime.
+ - previously the item text font was hardcoded to "Subtitle1"
+ - base property "Font" changed to "hidden". Avoids misleading the user since its value is not respected
+ - new property "ItemMaterialFont" - user can choose from a list of "material fonts".
+ - new property "ItemFont" - read-only property that shows in the "properties pane" the characteristics of the corresponding Font type defined by property "ItemMaterialFont", helping the user to understand the true meaning of the selected Material font
+
+
+
+build 2.3.1.4 [2022-02-20]
+-------------------------
+ - Enhancements:
+ - Added support for "UserControl" Containers
+ - Previous versions only supported placing controls like MaterialDialog if the Parent Container was of a type that inherits from Winform (Form class), like MaterialForm or plain Winform. Adding MaterialDialog control to a custom UserControl would generate a runtime exception because MaterialDialog._formOverlay was expecting an "Onwer" of type "Form" which is not the case when using parent containers like UserControls.
+ - Changed class "MaterialDialog" to expect a Parent-container of type "ContainerControl", Form and UserControl classes inherit from ContainControl class.
+ - Affected files:
+ - MaterialDialog.cs
+ - MaterialSkinManager.cs
+
+ - Improved design-mode experience of MaterialDrawer when combined with MaterialTabControl object. Now, during design-time, it's possible to view the drawer and the design impact on it when drawer's and tabcontrol's properties are changed by the user.
+
+ - Improved performance of MaterialDrawer during initialization
+ - Reduced the number of "Redraws" (Pain events) while the MaterialDrawer control is being initialized by its container.
+ - Previously, during MaterialDrawer's initialization, every property set done by the container that would impact drawer's UI would generate a redraw event (paint event).
+ - Now, MaterialDrawer control checks if its container has finish the initialization and if not ignores the redraw. When container invokes control's "InitLayout" method, meaning "end of control's initialization phase, future propertities changes will invoke a redraw action.
+
+
+
+build 2.3.1.3 [2022-02-20]
+-------------------------
+ - Code Cleansing:
+ - moved all p/invoke declarations to a new static class "NativeWin" (NativeWin.cs)
+ - there were a significant number of duplicated declarations on several controls
+ - affected files:
+ - NativeTextRenderer.cs
+ - MouseWheelRedirector.cs
+ - MaterialDialog.cs
+ - MaterialForm.cs
+ - MaterialMultiLineTextBox.cs
+ - MaterialMultiLineTextBox2.cs
+ - MaterialScrollBar.cs
+ - MaterialSnackBar.cs
+ - MaterialTextBox.cs
+ - MaterialSkinManager.cs
+
+ - moved several const declarations related to native Window Message IDs to new static class "NativeWin"
+ - affected files:
+ - MouseWheelRedirector.cs
+
+ - moved all possible category's labels to a new static class "CategoryLabels" (Globals.cs) and replaced the Category Labels by the corresponding const string
+ - affected files:
+ - MaterialButton.cs
+ - MaterialCheckBox.cs
+ - MaterialComboBox.cs
+ - MaterialDrawer.cs
+ - MaterialExpansionPanel.cs
+ - MaterialFloatingActionButton.cs
+ - MaterialForm.cs
+ - MaterialLabel.cs
+ - MaterialListBox.cs
+ - MaterialListView.cs
+ - MaterialMaskedTextBox.cs
+ - MaterialMultiLineTextBox.cs
+ - MaterialMultiLineTextBox2.cs
+ - MaterialRadioButton.cs
+ - MaterialScrollBar.cs
+ - MaterialSlider.cs
+ - MaterialSnackBar.cs
+ - MaterialSwitch.cs
+ - MaterialTabSelector.cs
+ - MaterialTextBox.cs
+ - MaterialTextBox2.cs
+
+ - moved several const declarations and enum declarations that were shared among files to a new file Globals.cs
+ - MaterialDrawer.cs
+
+ - Enhancement - compatibility with Msft CLI/C++:
+ - enum value MouseState.OUT (IMaterialControl.cs) renamed to MouseState.OUT_
+ - "OUT" keyword is a reserved word on CLI/C++.
diff --git a/MaterialSkin.sln b/MaterialSkin.sln
index 69f92cb6..af6e6ed1 100644
--- a/MaterialSkin.sln
+++ b/MaterialSkin.sln
@@ -1,4 +1,3 @@
-
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.136
@@ -9,6 +8,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaterialSkin", "MaterialSki
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{17028688-3699-4BC7-849F-A6B0F6E766BC}"
ProjectSection(SolutionItems) = preProject
+ CHANGELOG.md = CHANGELOG.md
README.md = README.md
EndProjectSection
EndProject
diff --git a/MaterialSkin/Controls/MaterialButton.cs b/MaterialSkin/Controls/MaterialButton.cs
index 0dd9d164..9b53f0b3 100644
--- a/MaterialSkin/Controls/MaterialButton.cs
+++ b/MaterialSkin/Controls/MaterialButton.cs
@@ -24,7 +24,7 @@ public class MaterialButton : Button, IMaterialControl
// icons
private TextureBrush iconsBrushes;
-
+
///
/// Gets or sets the Depth
///
@@ -59,14 +59,14 @@ public enum MaterialButtonDensity
[Browsable(false)]
public Color NoAccentTextColor { get; set; }
- [Category("Material Skin")]
+ [Category(CategoryLabels.MaterialSkin)]
public bool UseAccentColor
{
get { return useAccentColor; }
set { useAccentColor = value; Invalidate(); }
}
- [Category("Material Skin")]
+ [Category(CategoryLabels.MaterialSkin)]
///
/// Gets or sets a value indicating whether HighEmphasis
///
@@ -77,7 +77,7 @@ public bool HighEmphasis
}
[DefaultValue(true)]
- [Category("Material Skin")]
+ [Category(CategoryLabels.MaterialSkin)]
[Description("Draw Shadows around control")]
public bool DrawShadows
{
@@ -85,24 +85,24 @@ public bool DrawShadows
set { drawShadows = value; Invalidate(); }
}
- [Category("Material Skin")]
+ [Category(CategoryLabels.MaterialSkin)]
public MaterialButtonType Type
{
get { return type; }
set { type = value; preProcessIcons(); Invalidate(); }
}
- [Category("Material Skin")]
+ [Category(CategoryLabels.MaterialSkin)]
///
/// Gets or sets a value indicating button density
///
public MaterialButtonDensity Density
{
get { return _density; }
- set
- {
+ set
+ {
_density = value;
- if (_density== MaterialButtonDensity.Dense)
+ if (_density == MaterialButtonDensity.Dense)
Size = new Size(Size.Width, HEIGHTDENSE);
else
Size = new Size(Size.Width, HEIGHTDEFAULT);
@@ -119,7 +119,7 @@ public enum CharacterCasingEnum
}
public CharacterCasingEnum _cc;
- [Category("Behavior"), DefaultValue(CharacterCasingEnum.Upper), Description("Change capitalization of Text property")]
+ [Category(CategoryLabels.Behavior), DefaultValue(CharacterCasingEnum.Upper), Description("Change capitalization of Text property")]
public CharacterCasingEnum CharacterCasing
{
get => _cc;
@@ -200,7 +200,7 @@ private void RemoveShadowPaintEvent(Control control, PaintEventHandler shadowPai
private MaterialButtonType type;
private MaterialButtonDensity _density;
- [Category("Material Skin")]
+ [Category(CategoryLabels.MaterialSkin)]
///
/// Gets or sets the Icon
///
@@ -325,7 +325,7 @@ private void preProcessIcons()
int newWidth, newHeight;
//Resize icon if greater than ICON_SIZE
- if (Icon.Width> ICON_SIZE || Icon.Height > ICON_SIZE)
+ if (Icon.Width > ICON_SIZE || Icon.Height > ICON_SIZE)
{
//calculate aspect ratio
float aspect = Icon.Width / (float)Icon.Height;
@@ -399,7 +399,7 @@ private void preProcessIcons()
textureBrushGray.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp;
// Translate the brushes to the correct positions
- var iconRect = new Rectangle(8, (Height/2 - ICON_SIZE / 2), ICON_SIZE, ICON_SIZE);
+ var iconRect = new Rectangle(8, (Height / 2 - ICON_SIZE / 2), ICON_SIZE, ICON_SIZE);
textureBrushGray.TranslateTransform(iconRect.X + iconRect.Width / 2 - IconResized.Width / 2,
iconRect.Y + iconRect.Height / 2 - IconResized.Height / 2);
@@ -534,7 +534,7 @@ protected override void OnPaint(PaintEventArgs pevent)
Color textColor = Enabled ? (HighEmphasis ? (Type == MaterialButtonType.Text || Type == MaterialButtonType.Outlined) ?
UseAccentColor ? SkinManager.ColorScheme.AccentColor : // Outline or Text and accent and emphasis
- NoAccentTextColor == Color.Empty ?
+ NoAccentTextColor == Color.Empty ?
SkinManager.ColorScheme.PrimaryColor : // Outline or Text and emphasis
NoAccentTextColor : // User defined Outline or Text and emphasis
SkinManager.ColorScheme.TextColor : // Contained and Emphasis
@@ -607,7 +607,7 @@ public override Size GetPreferredSize(Size proposedSize)
s.Width += extra;
s.Height = HEIGHTDEFAULT;
}
- if (Icon != null && Text.Length==0 && s.Width < MINIMUMWIDTHICONONLY) s.Width = MINIMUMWIDTHICONONLY;
+ if (Icon != null && Text.Length == 0 && s.Width < MINIMUMWIDTHICONONLY) s.Width = MINIMUMWIDTHICONONLY;
else if (s.Width < MINIMUMWIDTH) s.Width = MINIMUMWIDTH;
return s;
@@ -627,7 +627,7 @@ protected override void OnCreateControl()
return;
}
- MouseState = MouseState.OUT;
+ MouseState = MouseState.OUT_;
MouseEnter += (sender, args) =>
{
MouseState = MouseState.HOVER;
@@ -636,7 +636,7 @@ protected override void OnCreateControl()
};
MouseLeave += (sender, args) =>
{
- MouseState = MouseState.OUT;
+ MouseState = MouseState.OUT_;
_hoverAnimationManager.StartNewAnimation(AnimationDirection.Out);
Invalidate();
};
@@ -664,7 +664,7 @@ protected override void OnCreateControl()
};
LostFocus += (sender, args) =>
{
- MouseState = MouseState.OUT;
+ MouseState = MouseState.OUT_;
_focusAnimationManager.StartNewAnimation(AnimationDirection.Out);
Invalidate();
};
diff --git a/MaterialSkin/Controls/MaterialCheckBox.cs b/MaterialSkin/Controls/MaterialCheckBox.cs
index 82c58c32..5f759310 100644
--- a/MaterialSkin/Controls/MaterialCheckBox.cs
+++ b/MaterialSkin/Controls/MaterialCheckBox.cs
@@ -25,7 +25,7 @@ public class MaterialCheckbox : CheckBox, IMaterialControl
private bool _ripple;
- [Category("Appearance")]
+ [Category(CategoryLabels.Appearance)]
public bool Ripple
{
get { return _ripple; }
@@ -224,7 +224,7 @@ protected override void OnCreateControl()
if (DesignMode) return;
- MouseState = MouseState.OUT;
+ MouseState = MouseState.OUT_;
GotFocus += (sender, AddingNewEventArgs) =>
{
@@ -258,7 +258,7 @@ protected override void OnCreateControl()
MouseLeave += (sender, args) =>
{
MouseLocation = new Point(-1, -1);
- MouseState = MouseState.OUT;
+ MouseState = MouseState.OUT_;
//if (Ripple && hovered)
//{
// _hoverAM.StartNewAnimation(AnimationDirection.Out, new object[] { Checked });
diff --git a/MaterialSkin/Controls/MaterialComboBox.cs b/MaterialSkin/Controls/MaterialComboBox.cs
index b9abfdec..2eb346f4 100644
--- a/MaterialSkin/Controls/MaterialComboBox.cs
+++ b/MaterialSkin/Controls/MaterialComboBox.cs
@@ -11,7 +11,7 @@
public class MaterialComboBox : ComboBox, IMaterialControl
{
// For some reason, even when overriding the AutoSize property, it doesn't appear on the properties panel, so we have to create a new one.
- [Browsable(true), EditorBrowsable(EditorBrowsableState.Always), Category("Layout")]
+ [Browsable(true), EditorBrowsable(EditorBrowsableState.Always), Category(CategoryLabels.Layout)]
private bool _AutoResize;
public bool AutoResize
@@ -36,7 +36,7 @@ public bool AutoResize
private bool _UseTallSize;
- [Category("Material Skin"), DefaultValue(true), Description("Using a larger size enables the hint to always be visible")]
+ [Category(CategoryLabels.MaterialSkin), DefaultValue(true), Description("Using a taller size enables the hint to always be visible")]
public bool UseTallSize
{
get { return _UseTallSize; }
@@ -48,12 +48,12 @@ public bool UseTallSize
}
}
- [Category("Material Skin"), DefaultValue(true)]
+ [Category(CategoryLabels.MaterialSkin), DefaultValue(true)]
public bool UseAccent { get; set; }
private string _hint = string.Empty;
- [Category("Material Skin"), DefaultValue(""), Localizable(true)]
+ [Category(CategoryLabels.MaterialSkin), DefaultValue(""), Localizable(true)]
public string Hint
{
get { return _hint; }
@@ -65,6 +65,45 @@ public string Hint
}
}
+
+ [Category(CategoryLabels.MaterialSkin),
+ DefaultValue("Body1"),
+ Description("Font to be used by the Display Text & List of Items")]
+ public MaterialSkinManager.fontType ItemMaterialFont
+ {
+ get
+ {
+ return _itemMaterialFont;
+ }
+ set
+ {
+ if (value != _itemMaterialFont)
+ {
+ _itemMaterialFont = value;
+ _itemFont = SkinManager.getFontByType(_itemMaterialFont);
+ Invalidate();
+ }
+ }
+ }
+ private MaterialSkinManager.fontType _itemMaterialFont;
+
+ [Category(CategoryLabels.MaterialSkin),
+ Description("Sets the Font used by Item-text")]
+ public Font ItemFont
+ {
+ get
+ {
+ return _itemFont;
+ }
+ }
+ private Font _itemFont;
+
+
+ // disabling from designer the Font property
+ [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
+ public new Font Font { get; set; }
+
+
private int _startIndex;
public int StartIndex
{
@@ -103,7 +142,11 @@ public MaterialComboBox()
UseTallSize = true;
MaxDropDownItems = 4;
- Font = SkinManager.getFontByType(MaterialSkinManager.fontType.Subtitle2);
+ // set Item-text default font
+ ItemMaterialFont = MaterialSkinManager.fontType.Body1;
+ // Font is not being used
+ //Font = SkinManager.getFontByType(MaterialSkinManager.fontType.Subtitle2);
+
BackColor = SkinManager.BackgroundColor;
ForeColor = SkinManager.TextHighEmphasisColor;
DrawMode = DrawMode.OwnerDrawVariable;
@@ -120,12 +163,12 @@ public MaterialComboBox()
_animationManager.OnAnimationFinished += sender => _animationManager.SetProgress(0);
DropDownClosed += (sender, args) =>
{
- MouseState = MouseState.OUT;
+ MouseState = MouseState.OUT_;
if (SelectedIndex < 0 && !Focused) _animationManager.StartNewAnimation(AnimationDirection.Out);
};
LostFocus += (sender, args) =>
{
- MouseState = MouseState.OUT;
+ MouseState = MouseState.OUT_;
if (SelectedIndex < 0) _animationManager.StartNewAnimation(AnimationDirection.Out);
};
DropDown += (sender, args) =>
@@ -144,7 +187,7 @@ public MaterialComboBox()
};
MouseLeave += (sender, args) =>
{
- MouseState = MouseState.OUT;
+ MouseState = MouseState.OUT_;
Invalidate();
};
}
@@ -243,10 +286,14 @@ protected override void OnPaint(PaintEventArgs pevent)
using (NativeTextRenderer NativeText = new NativeTextRenderer(g))
{
- // Draw user text
+ // Draw item text
NativeText.DrawTransparentText(
Text,
- SkinManager.getLogFontByType(MaterialSkinManager.fontType.Subtitle1),
+
+ // using new property "_itemFont"
+ //SkinManager.getLogFontByType(MaterialSkinManager.fontType.Subtitle1),
+ _itemFont,
+
Enabled ? SkinManager.TextHighEmphasisColor : SkinManager.TextDisabledOrHintColor,
textRect.Location,
textRect.Size,
@@ -263,7 +310,7 @@ protected override void OnPaint(PaintEventArgs pevent)
NativeText.DrawTransparentText(
Hint,
SkinManager.getTextBoxFontBySize(hintTextSize),
- Enabled ? DroppedDown || Focused ?
+ Enabled ? DroppedDown || Focused ?
SelectedColor : // Focus
SkinManager.TextMediumEmphasisColor : // not focused
SkinManager.TextDisabledOrHintColor, // Disabled
@@ -293,7 +340,7 @@ private void CustomDrawItem(object sender, System.Windows.Forms.DrawItemEventArg
{
g.FillRectangle(SkinManager.BackgroundHoverBrush, e.Bounds);
}
-
+
string Text = "";
if (!string.IsNullOrWhiteSpace(DisplayMember))
{
@@ -317,7 +364,11 @@ private void CustomDrawItem(object sender, System.Windows.Forms.DrawItemEventArg
{
NativeText.DrawTransparentText(
Text,
- SkinManager.getFontByType(MaterialSkinManager.fontType.Subtitle1),
+
+ // using new property "_itemFont"
+ //SkinManager.getFontByType(MaterialSkinManager.fontType.Subtitle1),
+ _itemFont,
+
SkinManager.TextHighEmphasisNoAlphaColor,
new Point(e.Bounds.Location.X + SkinManager.FORM_PADDING, e.Bounds.Location.Y),
new Size(e.Bounds.Size.Width - SkinManager.FORM_PADDING * 2, e.Bounds.Size.Height),
@@ -328,7 +379,7 @@ private void CustomDrawItem(object sender, System.Windows.Forms.DrawItemEventArg
protected override void OnCreateControl()
{
base.OnCreateControl();
- MouseState = MouseState.OUT;
+ MouseState = MouseState.OUT_;
MeasureItem += CustomMeasureItem;
DrawItem += CustomDrawItem;
DropDownStyle = ComboBoxStyle.DropDownList;
@@ -367,7 +418,9 @@ public void recalculateAutoSize()
var itemsList = this.Items.Cast