From e6f66c219a3876800befe93c21459c1a6b54238e Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Sun, 20 Feb 2022 11:36:31 +0000 Subject: [PATCH 1/3] 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++. --- CHANGELOG.md | 60 +++ MaterialSkin.sln | 2 +- MaterialSkin/Controls/MaterialButton.cs | 36 +- MaterialSkin/Controls/MaterialCheckBox.cs | 6 +- MaterialSkin/Controls/MaterialComboBox.cs | 20 +- MaterialSkin/Controls/MaterialDialog.cs | 24 +- MaterialSkin/Controls/MaterialDrawer.cs | 38 +- .../Controls/MaterialExpansionPanel.cs | 66 +-- .../Controls/MaterialFloatingActionButton.cs | 18 +- MaterialSkin/Controls/MaterialForm.cs | 266 ++--------- MaterialSkin/Controls/MaterialLabel.cs | 12 +- MaterialSkin/Controls/MaterialListBox.cs | 78 ++-- MaterialSkin/Controls/MaterialListView.cs | 6 +- .../Controls/MaterialMaskedTextBox.cs | 120 ++--- .../Controls/MaterialMultiLineTextBox.cs | 9 +- .../Controls/MaterialMultiLineTextBox2.cs | 40 +- MaterialSkin/Controls/MaterialRadioButton.cs | 6 +- MaterialSkin/Controls/MaterialScrollBar.cs | 12 +- MaterialSkin/Controls/MaterialSlider.cs | 68 +-- MaterialSkin/Controls/MaterialSnackBar.cs | 34 +- MaterialSkin/Controls/MaterialSwitch.cs | 8 +- MaterialSkin/Controls/MaterialTabSelector.cs | 26 +- MaterialSkin/Controls/MaterialTextBox.cs | 89 ++-- MaterialSkin/Controls/MaterialTextBox2.cs | 94 ++-- MaterialSkin/Globals.cs | 23 + MaterialSkin/IMaterialControl.cs | 2 +- MaterialSkin/MaterialSkin.csproj | 2 + MaterialSkin/MaterialSkinManager.cs | 12 +- MaterialSkin/MouseWheelRedirector.cs | 21 +- MaterialSkin/NativeTextRenderer.cs | 201 ++------- MaterialSkin/NativeWin.cs | 417 ++++++++++++++++++ MaterialSkin/Properties/AssemblyInfo.cs | 6 +- MaterialSkinExample/MainForm.Designer.cs | 32 +- .../Properties/AssemblyInfo.cs | 6 +- 34 files changed, 983 insertions(+), 877 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 MaterialSkin/Globals.cs create mode 100644 MaterialSkin/NativeWin.cs diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..87a3415f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,60 @@ + + +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.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..84ac95fc 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; } @@ -120,12 +120,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 +144,7 @@ public MaterialComboBox() }; MouseLeave += (sender, args) => { - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; Invalidate(); }; } @@ -263,7 +263,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 +293,7 @@ private void CustomDrawItem(object sender, System.Windows.Forms.DrawItemEventArg { g.FillRectangle(SkinManager.BackgroundHoverBrush, e.Bounds); } - + string Text = ""; if (!string.IsNullOrWhiteSpace(DisplayMember)) { @@ -328,7 +328,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; diff --git a/MaterialSkin/Controls/MaterialDialog.cs b/MaterialSkin/Controls/MaterialDialog.cs index 609999f9..fbf22af1 100644 --- a/MaterialSkin/Controls/MaterialDialog.cs +++ b/MaterialSkin/Controls/MaterialDialog.cs @@ -31,16 +31,6 @@ public class MaterialDialog : MaterialForm /// //public ObservableCollection Buttons { get; set; } - [DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")] - private static extern IntPtr CreateRoundRectRgn - ( - int nLeftRect, // x-coordinate of upper-left corner - int nTopRect, // y-coordinate of upper-left corner - int nRightRect, // x-coordinate of lower-right corner - int nBottomRect, // y-coordinate of lower-right corner - int nWidthEllipse, // width of ellipse - int nHeightEllipse // height of ellipse - ); /// /// Constructer Setting up the Layout @@ -122,7 +112,7 @@ public MaterialDialog(Form ParentForm, string Title, string Text, string Validat RectHeight + 9); Height = _header_Height + TEXT_TOP_PADDING + textRect.Height + TEXT_BOTTOM_PADDING + 52; //560; - Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 6, 6)); + Region = System.Drawing.Region.FromHrgn(NativeWin.CreateRoundRectRgn(0, 0, Width, Height, 6, 6)); int _buttonWidth = ((TextRenderer.MeasureText(ValidationButtonText, SkinManager.getFontByType(MaterialSkinManager.fontType.Button))).Width + 32); Rectangle _validationbuttonBounds = new Rectangle((Width) - BUTTON_PADDING - _buttonWidth, Height - BUTTON_PADDING - BUTTON_HEIGHT, _buttonWidth, BUTTON_HEIGHT); @@ -169,7 +159,7 @@ public MaterialDialog(Form ParentForm, string Title, string Text, bool ShowCance { } - public MaterialDialog(Form ParentForm, string Title, string Text, string ValidationButtonText, bool ShowCancelButton, string CancelButtonText) : this(ParentForm, Title, Text, ValidationButtonText, ShowCancelButton, CancelButtonText, false) + public MaterialDialog(Form ParentForm, string Title, string Text, string ValidationButtonText, bool ShowCancelButton, string CancelButtonText) : this(ParentForm, Title, Text, ValidationButtonText, ShowCancelButton, CancelButtonText, false) { } @@ -181,7 +171,7 @@ protected override void OnLoad(EventArgs e) { base.OnLoad(e); - Location = new Point(Convert.ToInt32(Owner.Location.X + (Owner.Width / 2) - (Width / 2)), Convert.ToInt32(Owner.Location.Y + (Owner.Height/2) - (Height / 2))); + Location = new Point(Convert.ToInt32(Owner.Location.X + (Owner.Width / 2) - (Width / 2)), Convert.ToInt32(Owner.Location.Y + (Owner.Height / 2) - (Height / 2))); _AnimationManager.StartNewAnimation(AnimationDirection.In); } @@ -207,12 +197,12 @@ protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) e.Graphics.Clear(BackColor); - + // Calc title Rect Rectangle titleRect = new Rectangle( LEFT_RIGHT_PADDING, 0, - Width - (2 * LEFT_RIGHT_PADDING) , + Width - (2 * LEFT_RIGHT_PADDING), _header_Height); //Draw title @@ -236,9 +226,9 @@ protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) Rectangle textRect = new Rectangle( LEFT_RIGHT_PADDING, - _header_Height+17, + _header_Height + 17, RectWidth, - RectHeight +19); + RectHeight + 19); //Draw Text using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) diff --git a/MaterialSkin/Controls/MaterialDrawer.cs b/MaterialSkin/Controls/MaterialDrawer.cs index 7a2cd6e0..9c9bfed1 100644 --- a/MaterialSkin/Controls/MaterialDrawer.cs +++ b/MaterialSkin/Controls/MaterialDrawer.cs @@ -16,7 +16,7 @@ public class MaterialDrawer : Control, IMaterialControl private bool _showIconsWhenHidden; - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool ShowIconsWhenHidden { get @@ -39,7 +39,7 @@ public bool ShowIconsWhenHidden private bool _isOpen; - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool IsOpen { get @@ -56,13 +56,13 @@ public bool IsOpen } } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool AutoHide { get; set; } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool AutoShow { get; set; } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] private bool _useColors; public bool UseColors @@ -79,7 +79,7 @@ public bool UseColors } } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] private bool _highlightWithAccent; public bool HighlightWithAccent @@ -96,7 +96,7 @@ public bool HighlightWithAccent } } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] private bool _backgroundWithAccent; public bool BackgroundWithAccent @@ -112,7 +112,7 @@ public bool BackgroundWithAccent } } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public int IndicatorWidth { get; set; } [Browsable(false)] @@ -151,7 +151,7 @@ public bool BackgroundWithAccent private MaterialTabControl _baseTabControl; - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public MaterialTabControl BaseTabControl { get { return _baseTabControl; } @@ -302,7 +302,7 @@ private void preProcessIcons() private List _drawerItemRects; private List _drawerItemPaths; - private const int TAB_HEADER_PADDING = 24; + private const int BORDER_WIDTH = 7; private int drawerItemHeight; @@ -392,7 +392,7 @@ private void MaterialDrawer_MouseWheel(object sender, MouseEventArgs e) [EditorBrowsable(EditorBrowsableState.Advanced)] protected override void InitLayout() { - drawerItemHeight = TAB_HEADER_PADDING * 2 - SkinManager.FORM_PADDING / 2; + drawerItemHeight = Globals.TAB_HEADER_PADDING * 2 - SkinManager.FORM_PADDING / 2; MinWidth = (int)(SkinManager.FORM_PADDING * 1.5 + drawerItemHeight); _showHideAnimManager.SetProgress(_isOpen ? 0 : 1); showHideAnimation(); @@ -653,18 +653,18 @@ protected override void OnMouseUp(MouseEventArgs e) base.OnMouseUp(e); if (DesignMode) return; - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; } protected override void OnMouseMove(MouseEventArgs e) { if (DesignMode) return; - + if (e.Button == MouseButtons.Left && e.Y != _lastMouseY && (Location.Y < 0 || Height < (8 + drawerItemHeight) * _drawerItemRects.Count)) { int diff = e.Y - _lastMouseY; - if (diff > 0) + if (diff > 0) { if (Location.Y < 0) { @@ -672,7 +672,7 @@ protected override void OnMouseMove(MouseEventArgs e) Height = Parent.Height + Math.Abs(Location.Y); } } - else + else { if (Height < (8 + drawerItemHeight) * _drawerItemRects.Count) { @@ -682,12 +682,12 @@ protected override void OnMouseMove(MouseEventArgs e) } //return; } - + base.OnMouseMove(e); if (_drawerItemRects == null) UpdateTabRects(); - + Cursor previousCursor = Cursor; if (e.Location.X + this.Location.X < BORDER_WIDTH) @@ -716,7 +716,7 @@ protected override void OnMouseMove(MouseEventArgs e) protected override void OnMouseEnter(EventArgs e) { base.OnMouseEnter(e); - if (AutoShow && _isOpen==false) + if (AutoShow && _isOpen == false) { Show(); } @@ -766,7 +766,7 @@ private void UpdateTabRects() { _drawerItemRects[i] = (new Rectangle( (int)(SkinManager.FORM_PADDING * 0.75) - (ShowIconsWhenHidden ? Location.X : 0), - (TAB_HEADER_PADDING * 2) * i + (int)(SkinManager.FORM_PADDING >> 1), + (Globals.TAB_HEADER_PADDING * 2) * i + (int)(SkinManager.FORM_PADDING >> 1), (Width + (ShowIconsWhenHidden ? Location.X : 0)) - (int)(SkinManager.FORM_PADDING * 1.5) - 1, drawerItemHeight)); diff --git a/MaterialSkin/Controls/MaterialExpansionPanel.cs b/MaterialSkin/Controls/MaterialExpansionPanel.cs index ce998b65..79e3e091 100644 --- a/MaterialSkin/Controls/MaterialExpansionPanel.cs +++ b/MaterialSkin/Controls/MaterialExpansionPanel.cs @@ -29,20 +29,20 @@ public class MaterialExpansionPanel : Panel, IMaterialControl private const int _footerHeight = 68; private const int _footerButtonHeight = 36; private const int _minHeight = 200; - private int _headerHeight ; + private int _headerHeight; - private bool _collapse ; + private bool _collapse; private bool _useAccentColor; private int _expandHeight; - - + + private string _titleHeader; private string _descriptionHeader; private string _validationButtonText; private string _cancelButtonText; - - - + + + private bool _showValidationButtons; private bool _showCollapseExpand; private bool _drawShadows; @@ -77,7 +77,7 @@ private enum ButtonState [Browsable(false)] public MouseState MouseState { get; set; } - [Category("Material Skin"), DefaultValue(false), DisplayName("Use Accent Color")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), DisplayName("Use Accent Color")] public bool UseAccentColor { get { return _useAccentColor; } @@ -86,7 +86,7 @@ public bool UseAccentColor [DefaultValue(false)] [Description("Collapses the control when set to true")] - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] public bool Collapse { get { return _collapse; } @@ -99,7 +99,7 @@ public bool Collapse } [DefaultValue("Title")] - [Category("Material Skin"), DisplayName("Title")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Title")] [Description("Title to show in expansion panel's header")] public string Title { @@ -112,7 +112,7 @@ public string Title } [DefaultValue("Description")] - [Category("Material Skin"), DisplayName("Description")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Description")] [Description("Description to show in expansion panel's header")] public string Description { @@ -125,7 +125,7 @@ public string Description } [DefaultValue(true)] - [Category("Material Skin"), DisplayName("Draw Shadows")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Draw Shadows")] [Description("Draw Shadows around control")] public bool DrawShadows { @@ -134,7 +134,7 @@ public bool DrawShadows } [DefaultValue(240)] - [Category("Material Skin"), DisplayName("Expand Height")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Expand Height")] [Description("Define control height when expanded")] public int ExpandHeight { @@ -143,7 +143,7 @@ public int ExpandHeight } [DefaultValue(true)] - [Category("Material Skin"), DisplayName("Show collapse/expand")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Show collapse/expand")] [Description("Show collapse/expand indicator")] public bool ShowCollapseExpand { @@ -152,7 +152,7 @@ public bool ShowCollapseExpand } [DefaultValue(true)] - [Category("Material Skin"), DisplayName("Show validation buttons")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Show validation buttons")] [Description("Show save/cancel button")] public bool ShowValidationButtons { @@ -161,7 +161,7 @@ public bool ShowValidationButtons } [DefaultValue("SAVE")] - [Category("Material Skin"), DisplayName("Validation button text")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Validation button text")] [Description("Set Validation button text")] public string ValidationButtonText { @@ -170,7 +170,7 @@ public string ValidationButtonText } [DefaultValue("CANCEL")] - [Category("Material Skin"), DisplayName("Cancel button text")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Cancel button text")] [Description("Set Cancel button text")] public string CancelButtonText { @@ -179,7 +179,7 @@ public string CancelButtonText } [DefaultValue(false)] - [Category("Material Skin"), DisplayName("Validation button enable")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Validation button enable")] [Description("Enable validation button")] public bool ValidationButtonEnable { @@ -193,19 +193,19 @@ public bool ValidationButtonEnable #region "Events" - [Category("Action")] + [Category(CategoryLabels.Action)] [Description("Fires when Save button is clicked")] public event EventHandler SaveClick; - [Category("Action")] + [Category(CategoryLabels.Action)] [Description("Fires when Cancel button is clicked")] public event EventHandler CancelClick; - [Category("Disposition")] + [Category(CategoryLabels.Disposition)] [Description("Fires when Panel Collapse")] public event EventHandler PanelCollapse; - [Category("Disposition")] + [Category(CategoryLabels.Disposition)] [Description("Fires when Panel Expand")] public event EventHandler PanelExpand; @@ -231,9 +231,9 @@ public MaterialExpansionPanel() ForeColor = SkinManager.TextHighEmphasisColor; Padding = new Padding(24, 64, 24, 16); - Margin = new Padding( 3, 16, 3, 16); + Margin = new Padding(3, 16, 3, 16); Size = new Size(480, ExpandHeight); - + //CollapseOrExpand(); _validationButton = new MaterialButton @@ -254,18 +254,18 @@ public MaterialExpansionPanel() Text = "CANCEL" }; - if (!Controls.Contains(_validationButton) ) + if (!Controls.Contains(_validationButton)) { Controls.Add(_validationButton); } - if (!Controls.Contains(_cancelButton) ) + if (!Controls.Contains(_cancelButton)) { Controls.Add(_cancelButton); } _validationButton.Click += _validationButton_Click; _cancelButton.Click += _cancelButton_Click; - + UpdateRects(); } @@ -383,7 +383,7 @@ protected override void OnResize(EventArgs e) UpdateRects(); if (Parent != null) - { + { RemoveShadowPaintEvent(Parent, drawShadowOnParent); AddShadowPaintEvent(Parent, drawShadowOnParent); } @@ -435,7 +435,7 @@ protected override void OnMouseDown(MouseEventArgs e) return; } - base.OnMouseDown(e); + base.OnMouseDown(e); } protected override void OnMouseLeave(EventArgs e) @@ -484,7 +484,7 @@ protected override void OnPaint(PaintEventArgs e) expansionPanelBorderRectF.X -= 0.5f; expansionPanelBorderRectF.Y -= 0.5f; GraphicsPath expansionPanelBoarderPath = DrawHelper.CreateRoundRect(expansionPanelBorderRectF, 2); - + g.FillPath(SkinManager.ExpansionPanelFocusBrush, expansionPanelBoarderPath); } else @@ -517,13 +517,13 @@ protected override void OnPaint(PaintEventArgs e) } if (!String.IsNullOrEmpty(_descriptionHeader)) - { + { //Draw description header text Rectangle headerDescriptionRect = new Rectangle( headerRect.Right + _expansionPanelDefaultPadding, (_headerHeight - _textHeaderHeight) / 2, - _expandcollapseBounds.Left - (headerRect.Right + _expansionPanelDefaultPadding ) - _expansionPanelDefaultPadding, + _expandcollapseBounds.Left - (headerRect.Right + _expansionPanelDefaultPadding) - _expansionPanelDefaultPadding, _textHeaderHeight); using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) @@ -539,7 +539,7 @@ protected override void OnPaint(PaintEventArgs e) } } - if (_showCollapseExpand==true) + if (_showCollapseExpand == true) { using (var formButtonsPen = new Pen(_useAccentColor && Enabled ? SkinManager.ColorScheme.AccentColor : SkinManager.TextDisabledOrHintColor, 2)) { diff --git a/MaterialSkin/Controls/MaterialFloatingActionButton.cs b/MaterialSkin/Controls/MaterialFloatingActionButton.cs index ea48cb50..afdf31fc 100644 --- a/MaterialSkin/Controls/MaterialFloatingActionButton.cs +++ b/MaterialSkin/Controls/MaterialFloatingActionButton.cs @@ -27,12 +27,12 @@ public class MaterialFloatingActionButton : Button, IMaterialControl private Boolean _mouseHover = false; [DefaultValue(true)] - [Category("Material Skin"), DisplayName("Draw Shadows")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Draw Shadows")] [Description("Draw Shadows around control")] public bool DrawShadows { get; set; } [DefaultValue(false)] - [Category("Material Skin"), DisplayName("Size Mini")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Size Mini")] [Description("Set control size to default or mini")] public bool Mini { @@ -45,10 +45,10 @@ public bool Mini } } - private bool _mini ; + private bool _mini; [DefaultValue(false)] - [Category("Material Skin"), DisplayName("Animate Show HideButton")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Animate Show HideButton")] public bool AnimateShowHideButton { get { return _animateShowButton; } @@ -58,7 +58,7 @@ public bool AnimateShowHideButton private bool _animateShowButton; [DefaultValue(false)] - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Description("Define icon to display")] public Image Icon { @@ -187,10 +187,10 @@ protected override void OnPaint(PaintEventArgs pevent) DrawHelper.DrawRoundShadow(g, fabBounds); // draw fab - g.FillEllipse(Enabled ? _mouseHover ? - new SolidBrush(SkinManager.ColorScheme.AccentColor.Lighten(0.25f)) : + g.FillEllipse(Enabled ? _mouseHover ? + new SolidBrush(SkinManager.ColorScheme.AccentColor.Lighten(0.25f)) : SkinManager.ColorScheme.AccentBrush : - new SolidBrush(DrawHelper.BlendColor(SkinManager.ColorScheme.AccentColor, SkinManager.SwitchOffDisabledThumbColor, 197)), + new SolidBrush(DrawHelper.BlendColor(SkinManager.ColorScheme.AccentColor, SkinManager.SwitchOffDisabledThumbColor, 197)), fabBounds); if (_animationManager.IsAnimating()) @@ -263,7 +263,7 @@ protected override void OnMouseLeave(EventArgs e) protected override void OnResize(EventArgs e) { - base.OnResize(e); + base.OnResize(e); if (DrawShadows && Parent != null) { diff --git a/MaterialSkin/Controls/MaterialForm.cs b/MaterialSkin/Controls/MaterialForm.cs index e777a3cc..9b281ad5 100644 --- a/MaterialSkin/Controls/MaterialForm.cs +++ b/MaterialSkin/Controls/MaterialForm.cs @@ -9,9 +9,9 @@ namespace MaterialSkin.Controls using System.Runtime.InteropServices; using System.Windows.Forms; - #if NETFRAMEWORK +#if NETFRAMEWORK using System.Runtime.Remoting.Channels; - #endif +#endif public class MaterialForm : Form, IMaterialControl { @@ -25,10 +25,10 @@ public class MaterialForm : Form, IMaterialControl [Browsable(false)] public MouseState MouseState { get; set; } - [Category("Layout")] + [Category(CategoryLabels.Layout)] public bool Sizable { get; set; } - [Category("Material Skin"), Browsable(true), DisplayName("Form Style"), DefaultValue(FormStyles.ActionBar_40)] + [Category(CategoryLabels.MaterialSkin), Browsable(true), DisplayName("Form Style"), DefaultValue(FormStyles.ActionBar_40)] public FormStyles FormStyle { get => _formStyle; @@ -41,7 +41,7 @@ public FormStyles FormStyle } } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool DrawerShowIconsWhenHidden { get => _drawerShowIconsWhenHidden; @@ -58,27 +58,27 @@ public bool DrawerShowIconsWhenHidden } } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public int DrawerWidth { get; set; } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool DrawerAutoHide { get => _drawerAutoHide; set => drawerControl.AutoHide = _drawerAutoHide = value; } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool DrawerAutoShow { get => _drawerAutoShow; set => drawerControl.AutoShow = _drawerAutoShow = value; } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public int DrawerIndicatorWidth { get; set; } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool DrawerIsOpen { get => _drawerIsOpen; @@ -95,7 +95,7 @@ public bool DrawerIsOpen } } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool DrawerUseColors { get => _drawerUseColors; @@ -112,7 +112,7 @@ public bool DrawerUseColors } } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool DrawerHighlightWithAccent { get => _drawerHighlightWithAccent; @@ -129,7 +129,7 @@ public bool DrawerHighlightWithAccent } } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public bool DrawerBackgroundWithAccent { get => _backgroundWithAccent; @@ -146,7 +146,7 @@ public bool DrawerBackgroundWithAccent } } - [Category("Drawer")] + [Category(CategoryLabels.Drawer)] public MaterialTabControl DrawerTabControl { get; set; } public override string Text @@ -222,133 +222,7 @@ private enum ButtonState None } - /// - /// Window Messages - /// - /// - private enum WM - { - /// - /// WM_NCCALCSIZE - /// - NonClientCalcSize = 0x0083, - /// - /// WM_NCACTIVATE - /// - NonClientActivate = 0x0086, - /// - /// WM_NCLBUTTONDOWN - /// - NonClientLeftButtonDown = 0x00A1, - /// - /// WM_SYSCOMMAND - /// - SystemCommand = 0x0112, - /// - /// WM_MOUSEMOVE - /// - MouseMove = 0x0200, - /// - /// WM_LBUTTONDOWN - /// - LeftButtonDown = 0x0201, - /// - /// WM_LBUTTONUP - /// - LeftButtonUp = 0x0202, - /// - /// WM_LBUTTONDBLCLK - /// - LeftButtonDoubleClick = 0x0203, - /// - /// WM_RBUTTONDOWN - /// - RightButtonDown = 0x0204, - } - /// - /// Hit Test Results - /// - /// - private enum HT - { - /// - /// HTNOWHERE - Nothing under cursor - /// - None = 0, - /// - /// HTCAPTION - Titlebar - /// - Caption = 2, - /// - /// HTLEFT - Left border - /// - Left = 10, - /// - /// HTRIGHT - Right border - /// - Right = 11, - /// - /// HTTOP - Top border - /// - Top = 12, - /// - /// HTTOPLEFT - Top left corner - /// - TopLeft = 13, - /// - /// HTTOPRIGHT - Top right corner - /// - TopRight = 14, - /// - /// HTBOTTOM - Bottom border - /// - Bottom = 15, - /// - /// HTBOTTOMLEFT - Bottom left corner - /// - BottomLeft = 16, - /// - /// HTBOTTOMRIGHT - Bottom right corner - /// - BottomRight = 17, - } - - /// - /// Window Styles - /// - /// - private enum WS - { - /// - /// WS_MINIMIZEBOX - Allow minimizing from taskbar - /// - MinimizeBox = 0x20000, - /// - /// WS_SIZEFRAME - Required for Aero Snapping - /// - SizeFrame = 0x40000, - /// - /// WS_SYSMENU - Trigger the creation of the system menu - /// - SysMenu = 0x80000, - } - - /// - /// Track Popup Menu Flags - /// - /// - private enum TPM - { - /// - /// TPM_LEFTALIGN - /// - LeftAlign = 0x0000, - /// - /// TPM_RETURNCMD - /// - ReturnCommand = 0x0100, - } #endregion #region Constants @@ -429,7 +303,7 @@ public MaterialForm() SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); FormStyle = FormStyles.ActionBar_40; - Padding = new Padding(PADDING_MINIMUM, STATUS_BAR_HEIGHT+ ACTION_BAR_HEIGHT, PADDING_MINIMUM, PADDING_MINIMUM); //Keep space for resize by mouse + Padding = new Padding(PADDING_MINIMUM, STATUS_BAR_HEIGHT + ACTION_BAR_HEIGHT, PADDING_MINIMUM, PADDING_MINIMUM); //Keep space for resize by mouse _clickAnimManager = new AnimationManager() { @@ -692,44 +566,44 @@ private void ResizeForm(ResizeDirection direction) switch (direction) { case ResizeDirection.BottomLeft: - dir = (int)HT.BottomLeft; + dir = (int)NativeWin.HT.BottomLeft; Cursor = Cursors.SizeNESW; break; case ResizeDirection.Left: - dir = (int)HT.Left; + dir = (int)NativeWin.HT.Left; Cursor = Cursors.SizeWE; break; case ResizeDirection.Right: - dir = (int)HT.Right; + dir = (int)NativeWin.HT.Right; break; case ResizeDirection.BottomRight: - dir = (int)HT.BottomRight; + dir = (int)NativeWin.HT.BottomRight; break; case ResizeDirection.Bottom: - dir = (int)HT.Bottom; + dir = (int)NativeWin.HT.Bottom; break; case ResizeDirection.Top: - dir = (int)HT.Top; + dir = (int)NativeWin.HT.Top; break; case ResizeDirection.TopLeft: - dir = (int)HT.TopLeft; + dir = (int)NativeWin.HT.TopLeft; break; case ResizeDirection.TopRight: - dir = (int)HT.TopRight; + dir = (int)NativeWin.HT.TopRight; break; } - ReleaseCapture(); + NativeWin.ReleaseCapture(); if (dir != -1) { - SendMessage(Handle, (int)WM.NonClientLeftButtonDown, dir, 0); + NativeWin.SendMessage(Handle, (int)NativeWin.WM.NonClientLeftButtonDown, dir, 0); } } @@ -790,7 +664,7 @@ protected override CreateParams CreateParams get { var par = base.CreateParams; - par.Style |= (int)WS.MinimizeBox | (int)WS.SysMenu; + par.Style |= (int)NativeWin.WS.MinimizeBox | (int)NativeWin.WS.SysMenu; return par; } } @@ -801,19 +675,19 @@ protected override void OnCreateControl() // Sets the Window Style for having a Size Frame after the form is created // This prevents unexpected sizing while still allowing for Aero Snapping - var flags = GetWindowLongPtr(Handle, -16).ToInt64(); - SetWindowLongPtr(Handle, -16, (IntPtr)(flags | (int)WS.SizeFrame)); + var flags = NativeWin.GetWindowLongPtr(Handle, -16).ToInt64(); + NativeWin.SetWindowLongPtr(Handle, -16, (IntPtr)(flags | (int)NativeWin.WS.SizeFrame)); } protected override void WndProc(ref Message m) { - var message = (WM)m.Msg; + var message = (NativeWin.WM)m.Msg; // Prevent the base class from receiving the message - if (message == WM.NonClientCalcSize) return; + if (message == NativeWin.WM.NonClientCalcSize) return; // https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-ncactivate?redirectedfrom=MSDN#parameters // "If this parameter is set to -1, DefWindowProc does not repaint the nonclient area to reflect the state change." - if (message == WM.NonClientActivate) + if (message == NativeWin.WM.NonClientActivate) { m.Result = new IntPtr(-1); return; @@ -828,7 +702,7 @@ protected override void WndProc(ref Message m) !(_minButtonBounds.Contains(cursorPos) || _maxButtonBounds.Contains(cursorPos) || _xButtonBounds.Contains(cursorPos)); // Drawer - if (DrawerTabControl != null && (message == WM.LeftButtonDown || message == WM.LeftButtonDoubleClick) && _drawerIconRect.Contains(cursorPos)) + if (DrawerTabControl != null && (message == NativeWin.WM.LeftButtonDown || message == NativeWin.WM.LeftButtonDoubleClick) && _drawerIconRect.Contains(cursorPos)) { drawerControl.Toggle(); _clickAnimManager.SetProgress(0); @@ -836,18 +710,18 @@ protected override void WndProc(ref Message m) _animationSource = cursorPos; } // Double click to maximize - else if (message == WM.LeftButtonDoubleClick && isOverCaption) - { + else if (message == NativeWin.WM.LeftButtonDoubleClick && isOverCaption) + { Maximized = !Maximized; } // Treat the Caption as if it was Non-Client - else if (message == WM.LeftButtonDown && isOverCaption) + else if (message == NativeWin.WM.LeftButtonDown && isOverCaption) { - ReleaseCapture(); - SendMessage(Handle, (int)WM.NonClientLeftButtonDown, (int)HT.Caption, 0); + NativeWin.ReleaseCapture(); + NativeWin.SendMessage(Handle, (int)NativeWin.WM.NonClientLeftButtonDown, (int)NativeWin.HT.Caption, 0); } // Default context menu - else if (message == WM.RightButtonDown) + else if (message == NativeWin.WM.RightButtonDown) { if (_statusBarBounds.Contains(cursorPos) && !_minButtonBounds.Contains(cursorPos) && !_maxButtonBounds.Contains(cursorPos) && !_xButtonBounds.Contains(cursorPos)) @@ -857,11 +731,13 @@ protected override void WndProc(ref Message m) base.ContextMenuStrip = null; // Show default system menu when right clicking titlebar - var id = TrackPopupMenuEx(GetSystemMenu(Handle, false), (int)TPM.LeftAlign | (int)TPM.ReturnCommand, Cursor.Position.X, Cursor.Position.Y, Handle, IntPtr.Zero); + var id = NativeWin.TrackPopupMenuEx(NativeWin.GetSystemMenu(Handle, false), + (int)NativeWin.TPM.LeftAlign | (int)NativeWin.TPM.ReturnCommand, + Cursor.Position.X, Cursor.Position.Y, Handle, IntPtr.Zero); // Pass the command as a WM_SYSCOMMAND message - SendMessage(Handle, (int)WM.SystemCommand, id, 0); - + NativeWin.SendMessage(Handle, (int)NativeWin.WM.SystemCommand, id, 0); + // restore user defined ContextMenuStrip base.ContextMenuStrip = user_cms; } @@ -980,7 +856,7 @@ protected override void OnMouseUp(MouseEventArgs e) UpdateButtons(e.Button, e.Location, true); base.OnMouseUp(e); - ReleaseCapture(); + NativeWin.ReleaseCapture(); } protected override void OnPaint(PaintEventArgs e) @@ -1177,7 +1053,7 @@ protected override void OnPaint(PaintEventArgs e) //Form title using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) { - Rectangle textLocation = new Rectangle(DrawerTabControl != null ? TITLE_LEFT_PADDING : TITLE_LEFT_PADDING - (ICON_SIZE + (ACTION_BAR_PADDING*2)), STATUS_BAR_HEIGHT, ClientSize.Width, ACTION_BAR_HEIGHT); + Rectangle textLocation = new Rectangle(DrawerTabControl != null ? TITLE_LEFT_PADDING : TITLE_LEFT_PADDING - (ICON_SIZE + (ACTION_BAR_PADDING * 2)), STATUS_BAR_HEIGHT, ClientSize.Width, ACTION_BAR_HEIGHT); NativeText.DrawTransparentText(Text, SkinManager.getLogFontByType(MaterialSkinManager.fontType.H6), SkinManager.ColorScheme.TextColor, textLocation.Location, @@ -1187,58 +1063,6 @@ protected override void OnPaint(PaintEventArgs e) } } #endregion - - #region Low Level Windows Methods - /// - /// Provides a single method to call either the 32-bit or 64-bit method based on the size of an for getting the - /// Window Style flags.
- /// GetWindowLongPtr - ///
- private static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex) - { - if (IntPtr.Size == 8) - return GetWindowLongPtr64(hWnd, nIndex); - else - return GetWindowLong(hWnd, nIndex); - } - - /// - /// Provides a single method to call either the 32-bit or 64-bit method based on the size of an for setting the - /// Window Style flags.
- /// SetWindowLongPtr - ///
- private static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong) - { - if (IntPtr.Size == 8) - return SetWindowLongPtr64(hWnd, nIndex, dwNewLong); - else - return SetWindowLong(hWnd, nIndex, dwNewLong.ToInt32()); - } - - [DllImport("user32.dll", EntryPoint = "GetWindowLong")] - private static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex); - - [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")] - private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, int nIndex); - - [DllImport("user32.dll", EntryPoint = "SetWindowLong")] - private static extern IntPtr SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); - - [DllImport("user32.dll", EntryPoint = "SetWindowLongPtr")] - private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, int nIndex, IntPtr dwNewLong); - - [DllImport("user32.dll")] - private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); - - [DllImport("user32.dll")] - private static extern bool ReleaseCapture(); - - [DllImport("user32.dll")] - private static extern int TrackPopupMenuEx(IntPtr hmenu, uint fuFlags, int x, int y, IntPtr hwnd, IntPtr lptpm); - - [DllImport("user32.dll")] - private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); - #endregion } public class MaterialDrawerForm : Form diff --git a/MaterialSkin/Controls/MaterialLabel.cs b/MaterialSkin/Controls/MaterialLabel.cs index 767d2448..0493d06d 100644 --- a/MaterialSkin/Controls/MaterialLabel.cs +++ b/MaterialSkin/Controls/MaterialLabel.cs @@ -32,18 +32,18 @@ public override ContentAlignment TextAlign } } - [Category("Material Skin"), - DefaultValue(false)] + [Category(CategoryLabels.MaterialSkin), + DefaultValue(false)] public bool HighEmphasis { get; set; } - [Category("Material Skin"), - DefaultValue(false)] + [Category(CategoryLabels.MaterialSkin), + DefaultValue(false)] public bool UseAccent { get; set; } private MaterialSkinManager.fontType _fontType = MaterialSkinManager.fontType.Body1; - [Category("Material Skin"), - DefaultValue(typeof(MaterialSkinManager.fontType), "Body1")] + [Category(CategoryLabels.MaterialSkin), + DefaultValue(typeof(MaterialSkinManager.fontType), "Body1")] public MaterialSkinManager.fontType FontType { get diff --git a/MaterialSkin/Controls/MaterialListBox.cs b/MaterialSkin/Controls/MaterialListBox.cs index 940b3d3a..115ef5b1 100644 --- a/MaterialSkin/Controls/MaterialListBox.cs +++ b/MaterialSkin/Controls/MaterialListBox.cs @@ -39,7 +39,7 @@ public class MaterialListBox : Control, IMaterialControl private MaterialScrollBar _scrollBar; private object _selectedValue; - private bool _updating=false; + private bool _updating = false; private int _itemHeight; private bool _showBorder; private Color _borderColor; @@ -84,24 +84,24 @@ public enum MaterialItemDensity private bool useAccentColor; - [Category("Material Skin"), DefaultValue(false), DisplayName("Use Accent Color")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), DisplayName("Use Accent Color")] public bool UseAccentColor { get { return useAccentColor; } - set { useAccentColor = value; _scrollBar.UseAccentColor = value; Invalidate(); } + set { useAccentColor = value; _scrollBar.UseAccentColor = value; Invalidate(); } } [TypeConverter(typeof(CollectionConverter))] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Editor(typeof(MaterialItemCollectionEditor), typeof(UITypeEditor))] - [Category("Material Skin"), Description("Gets the items of the ListBox.")] + [Category(CategoryLabels.MaterialSkin), Description("Gets the items of the ListBox.")] public ObservableCollection Items => _items; [Browsable(false)] - [Category("Material Skin"), Description("Gets a collection containing the currently selected items in the ListBox.")] + [Category(CategoryLabels.MaterialSkin), Description("Gets a collection containing the currently selected items in the ListBox.")] public List SelectedItems => _selectedItems; - [Browsable(false), Category("Material Skin"), Description("Gets or sets the currently selected item in the ListBox.")] + [Browsable(false), Category(CategoryLabels.MaterialSkin), Description("Gets or sets the currently selected item in the ListBox.")] public MaterialListBoxItem SelectedItem { get => _selectedItem; @@ -114,8 +114,8 @@ public MaterialListBoxItem SelectedItem } } - [Browsable(false), Category("Material Skin"), - Description("Gets the currently selected Text in the ListBox.")] + [Browsable(false), Category(CategoryLabels.MaterialSkin), + Description("Gets the currently selected Text in the ListBox.")] public string SelectedText { get => _selectedText; @@ -126,7 +126,7 @@ public string SelectedText //} } - [Browsable(false), Category("Material Skin"), Description("Gets or sets the zero-based index of the currently selected item in a ListBox.")] + [Browsable(false), Category(CategoryLabels.MaterialSkin), Description("Gets or sets the zero-based index of the currently selected item in a ListBox.")] public int SelectedIndex { get => _selectedIndex; @@ -138,7 +138,7 @@ public int SelectedIndex } } - [Browsable(true), Category("Material Skin"), Description("Gets the value of the member property specified by the ValueMember property.")] + [Browsable(true), Category(CategoryLabels.MaterialSkin), Description("Gets the value of the member property specified by the ValueMember property.")] public object SelectedValue { get => _selectedValue; @@ -149,7 +149,7 @@ public object SelectedValue //} } - [Category("Material Skin"), DefaultValue(false), Description("Gets or sets a value indicating whether the ListBox supports multiple rows.")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), Description("Gets or sets a value indicating whether the ListBox supports multiple rows.")] public bool MultiSelect { get => _multiSelect; @@ -169,7 +169,7 @@ public bool MultiSelect [Browsable(false)] public int Count => _items.Count; - [Category("Material Skin"), DefaultValue(false), Description("Gets or sets a value indicating whether the vertical scroll bar be shown or not.")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), Description("Gets or sets a value indicating whether the vertical scroll bar be shown or not.")] public bool ShowScrollBar { get => _showScrollBar; @@ -181,7 +181,7 @@ public bool ShowScrollBar } } - [Category("Material Skin"), DefaultValue(true), Description("Gets or sets a value indicating whether the border shown or not.")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(true), Description("Gets or sets a value indicating whether the border shown or not.")] public bool ShowBorder { get => _showBorder; @@ -192,17 +192,17 @@ public bool ShowBorder } } - [Category("Material Skin"), Description("Gets or sets backcolor used by the control.")] + [Category(CategoryLabels.MaterialSkin), Description("Gets or sets backcolor used by the control.")] public override Color BackColor { get; set; } - [Category("Material Skin"), Description("Gets or sets forecolor used by the control.")] + [Category(CategoryLabels.MaterialSkin), Description("Gets or sets forecolor used by the control.")] public override Color ForeColor { get; set; } [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public override string Text { get => base.Text; set => base.Text = value; } - [Category("Material Skin"), Description("Gets or sets border color used by the control.")] + [Category(CategoryLabels.MaterialSkin), Description("Gets or sets border color used by the control.")] public Color BorderColor { get => _borderColor; @@ -213,7 +213,7 @@ public Color BorderColor } } - [Category("Material Skin"), DefaultValue(ListBoxStyle.SingleLine)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(ListBoxStyle.SingleLine)] [Description("Gets or sets the control style.")] public ListBoxStyle Style { @@ -228,7 +228,7 @@ public ListBoxStyle Style } } - [Category("Material Skin"), DefaultValue(MaterialItemDensity.Dense)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(MaterialItemDensity.Dense)] [Description("Gets or sets list density")] public MaterialItemDensity Density { @@ -466,8 +466,8 @@ protected override void OnPaint(PaintEventArgs e) NativeText.DrawTransparentText( itemText, _primaryFont, - Enabled ? (i != SelectedIndex || UseAccentColor) ? - SkinManager.TextHighEmphasisColor : + Enabled ? (i != SelectedIndex || UseAccentColor) ? + SkinManager.TextHighEmphasisColor : SkinManager.ColorScheme.TextColor : SkinManager.TextDisabledOrHintColor, // Disabled primaryTextRect.Location, @@ -478,8 +478,8 @@ protected override void OnPaint(PaintEventArgs e) NativeText.DrawTransparentText( itemSecondaryText, _secondaryFont, - Enabled ? (i != SelectedIndex || UseAccentColor) ? - SkinManager.TextDisabledOrHintColor : + Enabled ? (i != SelectedIndex || UseAccentColor) ? + SkinManager.TextDisabledOrHintColor : SkinManager.ColorScheme.TextColor.Darken(0.25f) : SkinManager.TextDisabledOrHintColor, // Disabled secondaryTextRect.Location, @@ -491,8 +491,8 @@ protected override void OnPaint(PaintEventArgs e) NativeText.DrawMultilineTransparentText( itemSecondaryText, _secondaryFont, - Enabled ? (i != SelectedIndex || UseAccentColor) ? - SkinManager.TextDisabledOrHintColor : + Enabled ? (i != SelectedIndex || UseAccentColor) ? + SkinManager.TextDisabledOrHintColor : SkinManager.ColorScheme.TextColor.Darken(0.25f) : SkinManager.TextDisabledOrHintColor, // Disabled secondaryTextRect.Location, @@ -555,9 +555,9 @@ public void AddItems(string[] newItems) public void RemoveItemAt(int index) { - if (index<= _selectedIndex) + if (index <= _selectedIndex) { - _selectedIndex -=1; + _selectedIndex -= 1; update_selection(); } _items.RemoveAt(index); @@ -567,7 +567,7 @@ public void RemoveItemAt(int index) public void RemoveItem(MaterialListBoxItem item) { - if (_items.IndexOf(item)<= _selectedIndex) + if (_items.IndexOf(item) <= _selectedIndex) { _selectedIndex -= 1; update_selection(); @@ -645,19 +645,19 @@ public void EndUpdate() #region Events - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] [Description("Occurs when selected index change.")] public event SelectedIndexChangedEventHandler SelectedIndexChanged; public delegate void SelectedIndexChangedEventHandler(object sender, MaterialListBoxItem selectedItem); - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] [Description("Occurs when selected value change.")] public event SelectedValueEventHandler SelectedValueChanged; public delegate void SelectedValueEventHandler(object sender, MaterialListBoxItem selectedItem); - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] [Description("Occurs when item is added or removed.")] public event EventHandler ItemsCountChanged; @@ -737,7 +737,7 @@ protected override void OnMouseWheel(MouseEventArgs e) _scrollBar.Value = _scrollBar.Minimum; else if (_scrollBar.Maximum < _scrollBar.Value + Height) { - if (e.Delta>0) + if (e.Delta > 0) _scrollBar.Value -= e.Delta / 2; else { } //Do nothing, maximum reached @@ -804,7 +804,7 @@ private void _updateHoveredItem(MouseEventArgs e) index = -1; } - if (index >= 0 && index= 0 && index < Items.Count) { _hoveredItem = index; } @@ -823,24 +823,16 @@ protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); _scrollBar.Size = new Size(12, Height - (ShowBorder ? 2 : 0)); - _scrollBar.Location = new Point( Width - (_scrollBar.Width + (ShowBorder ? 1 : 0)), ShowBorder ? 1 : 0); + _scrollBar.Location = new Point(Width - (_scrollBar.Width + (ShowBorder ? 1 : 0)), ShowBorder ? 1 : 0); InvalidateScroll(this, e); } - public const int WM_SETCURSOR = 0x0020; - public const int IDC_HAND = 32649; - - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern IntPtr SetCursor(IntPtr hCursor); protected override void WndProc(ref Message m) { - if (m.Msg == WM_SETCURSOR) + if (m.Msg == NativeWin.WM_SETCURSOR) { - SetCursor(LoadCursor(IntPtr.Zero, IDC_HAND)); + NativeWin.SetCursor(NativeWin.LoadCursor(IntPtr.Zero, NativeWin.IDC_HAND)); m.Result = IntPtr.Zero; return; } diff --git a/MaterialSkin/Controls/MaterialListView.cs b/MaterialSkin/Controls/MaterialListView.cs index 4bbdde22..dbd13eb1 100644 --- a/MaterialSkin/Controls/MaterialListView.cs +++ b/MaterialSkin/Controls/MaterialListView.cs @@ -21,7 +21,7 @@ public class MaterialListView : ListView, IMaterialControl private bool _autoSizeTable; - [Category("Appearance"), Browsable(true)] + [Category(CategoryLabels.Appearance), Browsable(true)] public bool AutoSizeTable { get @@ -56,14 +56,14 @@ public MaterialListView() // Fix for hovers, by default it doesn't redraw MouseLocation = new Point(-1, -1); - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; MouseEnter += delegate { MouseState = MouseState.HOVER; }; MouseLeave += delegate { - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; MouseLocation = new Point(-1, -1); HoveredItem = null; Invalidate(); diff --git a/MaterialSkin/Controls/MaterialMaskedTextBox.cs b/MaterialSkin/Controls/MaterialMaskedTextBox.cs index 99e13898..31a62ec5 100644 --- a/MaterialSkin/Controls/MaterialMaskedTextBox.cs +++ b/MaterialSkin/Controls/MaterialMaskedTextBox.cs @@ -39,7 +39,7 @@ public class MaterialMaskedTextBox : Control, IMaterialControl [Browsable(false)] public int SelectionLength { get { return baseTextBox.SelectionLength; } set { baseTextBox.SelectionLength = value; } } - + [Browsable(false)] public int TextLength { get { return baseTextBox.TextLength; } } @@ -51,7 +51,7 @@ public class MaterialMaskedTextBox : Control, IMaterialControl 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 larger size enables the hint to always be visible")] public bool UseTallSize { get { return _UseTallSize; } @@ -65,7 +65,7 @@ public bool UseTallSize } 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.")] + [Category(CategoryLabels.MaterialSkin), 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; } @@ -84,7 +84,7 @@ public bool ShowAssistiveText 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.")] + [Category(CategoryLabels.MaterialSkin), 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; } @@ -97,7 +97,7 @@ public string HelperText 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.")] + [Category(CategoryLabels.MaterialSkin), 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; } @@ -108,7 +108,7 @@ public string ErrorMessage } } - [Category("Material Skin"), DefaultValue(""), Localizable(true)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(""), Localizable(true)] public string Hint { get { return baseTextBox.Hint; } @@ -121,12 +121,12 @@ public string Hint } } - [Category("Material Skin"), DefaultValue(true)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(true)] public bool UseAccent { get; set; } private Image _leadingIcon; - [Category("Material Skin"), Browsable(true), Localizable(false)] + [Category(CategoryLabels.MaterialSkin), Browsable(true), Localizable(false)] /// /// Gets or sets the leading Icon /// @@ -144,7 +144,7 @@ public Image LeadingIcon private Image _trailingIcon; - [Category("Material Skin"), Browsable(true), Localizable(false)] + [Category(CategoryLabels.MaterialSkin), Browsable(true), Localizable(false)] /// /// Gets or sets the trailing Icon /// @@ -168,7 +168,7 @@ public enum PrefixSuffixTypes } private PrefixSuffixTypes _prefixsuffix; - [Category("Material Skin"), DefaultValue(PrefixSuffixTypes.None), Description("Set Prefix/Suffix/None")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(PrefixSuffixTypes.None), Description("Set Prefix/Suffix/None")] public PrefixSuffixTypes PrefixSuffix { get { return _prefixsuffix; } @@ -185,7 +185,7 @@ public PrefixSuffixTypes PrefixSuffix } private string _prefixsuffixText; - [Category("Material Skin"), DefaultValue(""), Localizable(true), Description("Set Prefix or Suffix text")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(""), Localizable(true), Description("Set Prefix or Suffix text")] public string PrefixSuffixText { get { return _prefixsuffixText; } @@ -193,9 +193,9 @@ public string PrefixSuffixText { //if (_prefixsuffixText != value) //{ - _prefixsuffixText = value; - UpdateRects(); - Invalidate(); + _prefixsuffixText = value; + UpdateRects(); + Invalidate(); //} } } @@ -226,61 +226,61 @@ public override ContextMenuStrip ContextMenuStrip public override string Text { get { return baseTextBox.Text; } set { baseTextBox.Text = value; } } - [Category("Appearance")] + [Category(CategoryLabels.Appearance)] public HorizontalAlignment TextAlign { get { return baseTextBox.TextAlign; } set { baseTextBox.TextAlign = value; } } - [Category("Appearance")] + [Category(CategoryLabels.Appearance)] public Char PromptChar { get { return baseTextBox.PromptChar; } set { baseTextBox.PromptChar = value; } } - //[Category("Behavior")] + //[Category(CategoryLabels.Behavior)] //public CharacterCasing CharacterCasing { get { return baseTextBox.CharacterCasing; } set { baseTextBox.CharacterCasing = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool HideSelection { get { return baseTextBox.HideSelection; } set { baseTextBox.HideSelection = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool AllowPromptAsInput { get { return baseTextBox.AllowPromptAsInput; } set { baseTextBox.AllowPromptAsInput = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool AsciiOnly { get { return baseTextBox.AsciiOnly; } set { baseTextBox.AsciiOnly = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool BeepOnError { get { return baseTextBox.BeepOnError; } set { baseTextBox.BeepOnError = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public MaskFormat CutCopyMaskFormat { get { return baseTextBox.CutCopyMaskFormat; } set { baseTextBox.CutCopyMaskFormat = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool HidePromptOnLeave { get { return baseTextBox.HidePromptOnLeave; } set { baseTextBox.HidePromptOnLeave = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public InsertKeyMode InsertKeyMode { get { return baseTextBox.InsertKeyMode; } set { baseTextBox.InsertKeyMode = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public string Mask { get { return baseTextBox.Mask; } set { baseTextBox.Mask = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public int MaxLength { get { return baseTextBox.MaxLength; } set { baseTextBox.MaxLength = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public char PasswordChar { get { return baseTextBox.PasswordChar; } set { baseTextBox.PasswordChar = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool RejectInputOnFirstFailure { get { return baseTextBox.RejectInputOnFirstFailure; } set { baseTextBox.RejectInputOnFirstFailure = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool ResetOnPrompt { get { return baseTextBox.ResetOnPrompt; } set { baseTextBox.ResetOnPrompt = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool ResetOnSpace { get { return baseTextBox.ResetOnSpace; } set { baseTextBox.ResetOnSpace = value; } } - [Category("Behavior")] - public bool ShortcutsEnabled - { - get - { return baseTextBox.ShortcutsEnabled; } - set - { + [Category(CategoryLabels.Behavior)] + public bool ShortcutsEnabled + { + get + { return baseTextBox.ShortcutsEnabled; } + set + { baseTextBox.ShortcutsEnabled = value; if (value == false) { @@ -295,13 +295,13 @@ public bool ShortcutsEnabled } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool SkipLiterals { get { return baseTextBox.SkipLiterals; } set { baseTextBox.SkipLiterals = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public MaskFormat TextMaskFormat { get { return baseTextBox.TextMaskFormat; } set { baseTextBox.TextMaskFormat = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool UseSystemPasswordChar { get { return baseTextBox.UseSystemPasswordChar; } set { baseTextBox.UseSystemPasswordChar = value; } } [Browsable(false)] @@ -310,7 +310,7 @@ public bool ShortcutsEnabled public new object Tag { get { return baseTextBox.Tag; } set { baseTextBox.Tag = value; } } private bool _readonly; - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool ReadOnly { get { return _readonly; } @@ -327,7 +327,7 @@ public bool ReadOnly private bool _animateReadOnly; - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Browsable(true)] public bool AnimateReadOnly { @@ -341,7 +341,7 @@ public bool AnimateReadOnly private bool _leaveOnEnterKey; - [Category("Material Skin"), DefaultValue(false), Description("Select next control which have TabStop property set to True when enter key is pressed.")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), Description("Select next control which have TabStop property set to True when enter key is pressed.")] public bool LeaveOnEnterKey { get => _leaveOnEnterKey; @@ -374,11 +374,11 @@ public bool LeaveOnEnterKey #region "Events" - [Category("Action")] + [Category(CategoryLabels.Action)] [Description("Fires when Leading Icon is clicked")] public event EventHandler LeadingIconClick; - [Category("Action")] + [Category(CategoryLabels.Action)] [Description("Fires when Trailing Icon is clicked")] public event EventHandler TrailingIconClick; @@ -506,7 +506,7 @@ public event EventHandler BorderStyleChanged } } - #if NETFRAMEWORK +#if NETFRAMEWORK public new event EventHandler ContextMenuChanged { add @@ -518,7 +518,7 @@ public event EventHandler BorderStyleChanged baseTextBox.ContextMenuChanged -= value; } } - #endif +#endif public new event EventHandler ContextMenuStripChanged { @@ -916,7 +916,7 @@ public event EventHandler MaskChanged } } - public event MaskInputRejectedEventHandler MaskInputRejected + public event MaskInputRejectedEventHandler MaskInputRejected { add { @@ -1264,7 +1264,7 @@ public event EventHandler ReadOnlyChanged } } - public event EventHandler TextAlignChanged + public event EventHandler TextAlignChanged { add { @@ -1288,7 +1288,7 @@ public event EventHandler TextAlignChanged } } - public event TypeValidationEventHandler TypeValidationCompleted + public event TypeValidationEventHandler TypeValidationCompleted { add { @@ -1351,7 +1351,7 @@ public event TypeValidationEventHandler TypeValidationCompleted private const int ACTIVATION_INDICATOR_HEIGHT = 2; private const int HELPER_TEXT_HEIGHT = 16; private const int FONT_HEIGHT = 20; - + private int HEIGHT = 48; private int LINE_Y; @@ -1374,7 +1374,7 @@ public MaterialMaskedTextBox() { // Material Properties UseAccent = true; - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer, true); @@ -1405,7 +1405,7 @@ public MaterialMaskedTextBox() Font = base.Font, ForeColor = SkinManager.TextHighEmphasisColor, Multiline = false, - Location = new Point(LEFT_PADDING, HEIGHT/2- FONT_HEIGHT/2), + Location = new Point(LEFT_PADDING, HEIGHT / 2 - FONT_HEIGHT / 2), Width = Width - (LEFT_PADDING + RIGHT_PADDING), Height = FONT_HEIGHT }; @@ -1442,7 +1442,7 @@ public MaterialMaskedTextBox() _animationManager.StartNewAnimation(AnimationDirection.Out); UpdateRects(); }; - + baseTextBox.TextChanged += new EventHandler(Redraw); baseTextBox.BackColorChanged += new EventHandler(Redraw); @@ -1468,7 +1468,7 @@ protected override void OnPaint(PaintEventArgs pevent) g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; g.Clear(Parent.BackColor); SolidBrush backBrush = new SolidBrush(DrawHelper.BlendColor(Parent.BackColor, SkinManager.BackgroundAlternativeColor, SkinManager.BackgroundAlternativeColor.A)); - + //backColor g.FillRectangle( !Enabled ? SkinManager.BackgroundDisabledBrush : // Disabled @@ -1561,7 +1561,7 @@ protected override void OnPaint(PaintEventArgs pevent) using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) { Rectangle suffixRect = new Rectangle( - Width - _right_padding , + Width - _right_padding, hasHint && UseTallSize ? (hintRect.Y + hintRect.Height) - 2 : ClientRectangle.Y, _suffix_padding, hasHint && UseTallSize ? LINE_Y - (hintRect.Y + hintRect.Height) : LINE_Y); @@ -1618,14 +1618,14 @@ protected override void OnPaint(PaintEventArgs pevent) } // Draw error message - if (_showAssistiveText && _errorState && ErrorMessage!=null) + if (_showAssistiveText && _errorState && ErrorMessage != null) { using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) { NativeText.DrawTransparentText( ErrorMessage, SkinManager.getTextBoxFontBySize(hintTextSize), - Enabled ? + Enabled ? SkinManager.BackgroundHoverRedColor : // error state SkinManager.TextDisabledOrHintColor, // Disabled helperTextRect.Location, @@ -1699,7 +1699,7 @@ protected override void OnMouseLeave(EventArgs e) else { base.OnMouseLeave(e); - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; Invalidate(); } } @@ -1721,7 +1721,7 @@ protected override void OnCreateControl() base.OnCreateControl(); // events - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; } diff --git a/MaterialSkin/Controls/MaterialMultiLineTextBox.cs b/MaterialSkin/Controls/MaterialMultiLineTextBox.cs index dc4036c7..f0fec272 100644 --- a/MaterialSkin/Controls/MaterialMultiLineTextBox.cs +++ b/MaterialSkin/Controls/MaterialMultiLineTextBox.cs @@ -17,9 +17,6 @@ public class MaterialMultiLineTextBox : RichTextBox, IMaterialControl [Browsable(false)] public MouseState MouseState { get; set; } - [DllImport("user32.dll", CharSet = CharSet.Auto)] - private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, string lParam); - private const int EM_SETCUEBANNER = 0x1501; private const char EmptyChar = (char)0; @@ -30,20 +27,20 @@ public class MaterialMultiLineTextBox : RichTextBox, IMaterialControl private string hint = string.Empty; - [Category("Material Skin"), DefaultValue(""), Localizable(true)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(""), Localizable(true)] public string Hint { get { return hint; } set { hint = value; - SendMessage(Handle, EM_SETCUEBANNER, (int)IntPtr.Zero, Hint); + NativeWin.SendMessage(Handle, EM_SETCUEBANNER, (int)IntPtr.Zero, Hint); } } private bool _leaveOnEnterKey; - [Category("Material Skin"), DefaultValue(false), Description("Select next control which have TabStop property set to True when enter key is pressed. To add enter in text, the user must press CTRL+Enter")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), Description("Select next control which have TabStop property set to True when enter key is pressed. To add enter in text, the user must press CTRL+Enter")] public bool LeaveOnEnterKey { get => _leaveOnEnterKey; diff --git a/MaterialSkin/Controls/MaterialMultiLineTextBox2.cs b/MaterialSkin/Controls/MaterialMultiLineTextBox2.cs index 1c514f4f..13e599d2 100644 --- a/MaterialSkin/Controls/MaterialMultiLineTextBox2.cs +++ b/MaterialSkin/Controls/MaterialMultiLineTextBox2.cs @@ -49,7 +49,7 @@ public class MaterialMultiLineTextBox2 : Control, IMaterialControl //Material Skin properties - [Category("Material Skin"), DefaultValue(""), Localizable(true)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(""), Localizable(true)] public string Hint { get { return baseTextBox.Hint; } @@ -61,7 +61,7 @@ public string Hint } } - [Category("Material Skin"), DefaultValue(true)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(true)] public bool UseAccent { get; set; } @@ -98,25 +98,25 @@ public override ContextMenuStrip ContextMenuStrip public override string Text { get { return baseTextBox.Text; } set { baseTextBox.Text = value; } } - [Category("Appearance")] + [Category(CategoryLabels.Appearance)] public HorizontalAlignment TextAlign { get { return baseTextBox.TextAlign; } set { baseTextBox.TextAlign = value; } } - [Category("Appearance")] + [Category(CategoryLabels.Appearance)] public ScrollBars ScrollBars { get { return baseTextBox.ScrollBars; } set { baseTextBox.ScrollBars = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public CharacterCasing CharacterCasing { get { return baseTextBox.CharacterCasing; } set { baseTextBox.CharacterCasing = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool HideSelection { get { return baseTextBox.HideSelection; } set { baseTextBox.HideSelection = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public int MaxLength { get { return baseTextBox.MaxLength; } set { baseTextBox.MaxLength = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public char PasswordChar { get { return baseTextBox.PasswordChar; } set { baseTextBox.PasswordChar = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool ShortcutsEnabled { get @@ -137,13 +137,13 @@ public bool ShortcutsEnabled } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool UseSystemPasswordChar { get { return baseTextBox.UseSystemPasswordChar; } set { baseTextBox.UseSystemPasswordChar = value; } } public new object Tag { get { return baseTextBox.Tag; } set { baseTextBox.Tag = value; } } private bool _readonly; - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool ReadOnly { get { return _readonly; } @@ -160,7 +160,7 @@ public bool ReadOnly private bool _animateReadOnly; - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Browsable(true)] public bool AnimateReadOnly { @@ -174,7 +174,7 @@ public bool AnimateReadOnly private bool _leaveOnEnterKey; - [Category("Material Skin"), DefaultValue(false), Description("Select next control which have TabStop property set to True when enter key is pressed. To add enter in text, the user must press CTRL+Enter")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), Description("Select next control which have TabStop property set to True when enter key is pressed. To add enter in text, the user must press CTRL+Enter")] public bool LeaveOnEnterKey { get => _leaveOnEnterKey; @@ -1135,7 +1135,7 @@ public MaterialMultiLineTextBox2() AllowScroll = true; // Material Properties UseAccent = true; - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer, true); @@ -1249,10 +1249,6 @@ protected override void OnPaint(PaintEventArgs pevent) } } - - [DllImport("User32.dll", CharSet = CharSet.Auto, EntryPoint = "SendMessage")] - protected static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); - protected void OnMouseWheel(object sender, MouseEventArgs e) { if (AllowScroll) @@ -1265,13 +1261,13 @@ protected void OnMouseWheel(object sender, MouseEventArgs e) if (v < 0) { var ptrWparam = new IntPtr(SB_LINEDOWN); - SendMessage(baseTextBox.Handle, WM_VSCROLL, ptrWparam, ptrLparam); + NativeWin.SendMessage(baseTextBox.Handle, WM_VSCROLL, ptrWparam, ptrLparam); } //Up Movement else if (v > 0) { var ptrWparam = new IntPtr(SB_LINEUP); - SendMessage(baseTextBox.Handle, WM_VSCROLL, ptrWparam, ptrLparam); + NativeWin.SendMessage(baseTextBox.Handle, WM_VSCROLL, ptrWparam, ptrLparam); } baseTextBox?.Focus(); @@ -1316,7 +1312,7 @@ protected override void OnMouseLeave(EventArgs e) else { base.OnMouseLeave(e); - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; Invalidate(); } } @@ -1338,7 +1334,7 @@ protected override void OnCreateControl() base.OnCreateControl(); // events - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; } private void ContextMenuStripOnItemClickStart(object sender, ToolStripItemClickedEventArgs toolStripItemClickedEventArgs) diff --git a/MaterialSkin/Controls/MaterialRadioButton.cs b/MaterialSkin/Controls/MaterialRadioButton.cs index 8a35cffd..3ca45079 100644 --- a/MaterialSkin/Controls/MaterialRadioButton.cs +++ b/MaterialSkin/Controls/MaterialRadioButton.cs @@ -24,7 +24,7 @@ public class MaterialRadioButton : RadioButton, IMaterialControl private bool ripple; - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool Ripple { get { return ripple; } @@ -218,7 +218,7 @@ protected override void OnCreateControl() if (DesignMode) return; - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; GotFocus += (sender, AddingNewEventArgs) => { @@ -251,7 +251,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/MaterialScrollBar.cs b/MaterialSkin/Controls/MaterialScrollBar.cs index 57a58b23..88690fe1 100644 --- a/MaterialSkin/Controls/MaterialScrollBar.cs +++ b/MaterialSkin/Controls/MaterialScrollBar.cs @@ -9,7 +9,7 @@ namespace MaterialSkin.Controls using System.Security; using System.Windows.Forms; using System.Runtime.InteropServices; - + public enum MaterialScrollOrientation { Horizontal, @@ -30,15 +30,13 @@ public class MaterialScrollBar : Control, IMaterialControl private bool useAccentColor; - [Category("Material Skin"), DefaultValue(false), DisplayName("Use Accent Color")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), DisplayName("Use Accent Color")] public bool UseAccentColor { get { return useAccentColor; } set { useAccentColor = value; Invalidate(); } } - [DllImport("user32.dll")] - public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); internal const int SCROLLBAR_DEFAULT_SIZE = 10; @@ -369,7 +367,7 @@ public MaterialScrollBar() ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.Selectable | -// ControlStyles.AllPaintingInWmPaint | + // ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true); @@ -406,14 +404,14 @@ public bool HitTest(Point point) [SecuritySafeCritical] public void BeginUpdate() { - SendMessage(Handle, WM_SETREDRAW, 0, 0); + NativeWin.SendMessage(Handle, WM_SETREDRAW, 0, 0); inUpdate = true; } [SecuritySafeCritical] public void EndUpdate() { - SendMessage(Handle, WM_SETREDRAW, 1, 0); + NativeWin.SendMessage(Handle, WM_SETREDRAW, 1, 0); inUpdate = false; SetupScrollBar(); Refresh(); diff --git a/MaterialSkin/Controls/MaterialSlider.cs b/MaterialSkin/Controls/MaterialSlider.cs index 8cd327c9..e9c125b5 100644 --- a/MaterialSkin/Controls/MaterialSlider.cs +++ b/MaterialSkin/Controls/MaterialSlider.cs @@ -38,7 +38,7 @@ public class MaterialSlider : Control, IMaterialControl private int _value; [DefaultValue(50)] - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Description("Define control value")] public int Value { @@ -50,7 +50,7 @@ public int Value else if (value > _rangeMax) _value = _rangeMax; else - _value = value; + _value = value; //_mouseX = _sliderRectangle.X + ((int)((double)_value / (double)(RangeMax - RangeMin) * (double)(_sliderRectangle.Width) - _thumbRadius / 2)); _mouseX = _sliderRectangle.X + ((int)((double)_value / (double)(RangeMax - RangeMin) * (double)(_sliderRectangle.Width - _thumbRadius))); RecalcutlateIndicator(); @@ -59,7 +59,7 @@ public int Value private int _valueMax; [DefaultValue(0)] - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Description("Define position indicator maximum value. Ignored when set to 0.")] public int ValueMax { @@ -77,7 +77,7 @@ public int ValueMax private int _rangeMax; [DefaultValue(100)] - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Description("Define control range maximum value")] public int RangeMax { @@ -93,7 +93,7 @@ public int RangeMax private int _rangeMin; [DefaultValue(0)] - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Description("Define control range minimum value")] public int RangeMin { @@ -109,7 +109,7 @@ public int RangeMin private string _text; [DefaultValue("MyData")] - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Description("Set control text")] public override string Text { @@ -124,7 +124,7 @@ public override string Text private string _valueSuffix; [DefaultValue("")] - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Description("Set control value suffix text")] public string ValueSuffix { @@ -138,7 +138,7 @@ public string ValueSuffix private Boolean _showText; [DefaultValue(true)] - [Category("Material Skin"), DisplayName("Show text")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Show text")] [Description("Show text")] public bool ShowText { @@ -148,7 +148,7 @@ public bool ShowText private Boolean _showValue; [DefaultValue(true)] - [Category("Material Skin"), DisplayName("Show value")] + [Category(CategoryLabels.MaterialSkin), DisplayName("Show value")] [Description("Show value")] public bool ShowValue { @@ -157,7 +157,7 @@ public bool ShowValue } private bool _useAccentColor; - [Category("Material Skin"), DefaultValue(false), DisplayName("Use Accent Color")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), DisplayName("Use Accent Color")] public bool UseAccentColor { get { return _useAccentColor; } @@ -166,7 +166,7 @@ public bool UseAccentColor private MaterialSkinManager.fontType _fontType = MaterialSkinManager.fontType.Body1; - [Category("Material Skin"), + [Category(CategoryLabels.MaterialSkin), DefaultValue(typeof(MaterialSkinManager.fontType), "Body1")] public MaterialSkinManager.fontType FontType { @@ -187,7 +187,7 @@ public MaterialSkinManager.fontType FontType #region "Events" - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] [Description("Occurs when value change.")] public delegate void ValueChanged(object sender, int newValue); public event ValueChanged onValueChanged; @@ -258,7 +258,7 @@ protected override void OnMouseWheel(MouseEventArgs e) if (_valueMax != 0 && (Value + e.Delta / -40) > _valueMax) Value = _valueMax; else - Value += e.Delta/-40; + Value += e.Delta / -40; onValueChanged?.Invoke(this, _value); } @@ -305,7 +305,7 @@ private void UpdateValue(MouseEventArgs e) } else if (e.X < _sliderRectangle.X)// + (_thumbRadius / 2)) { - _mouseX = _sliderRectangle.X ; + _mouseX = _sliderRectangle.X; v = _rangeMin; } else if (e.X > _sliderRectangle.Right - _thumbRadius)// / 2) @@ -336,20 +336,20 @@ private void UpdateRects() using (NativeTextRenderer NativeText = new NativeTextRenderer(CreateGraphics())) { textSize = NativeText.MeasureLogString(_showText ? Text : "", SkinManager.getLogFontByType(_fontType)); - valueSize = NativeText.MeasureLogString(_showValue ? RangeMax.ToString() + _valueSuffix : "" , SkinManager.getLogFontByType(_fontType)); + valueSize = NativeText.MeasureLogString(_showValue ? RangeMax.ToString() + _valueSuffix : "", SkinManager.getLogFontByType(_fontType)); } _valueRectangle = new Rectangle(Width - valueSize.Width - _thumbRadiusHoverPressed / 4, 0, valueSize.Width + _thumbRadiusHoverPressed / 4, Height); - _textRectangle = new Rectangle(0, 0, textSize.Width + _thumbRadiusHoverPressed/4, Height); - _sliderRectangle = new Rectangle(_textRectangle.Right , 0, _valueRectangle.Left - _textRectangle.Right , _thumbRadius); + _textRectangle = new Rectangle(0, 0, textSize.Width + _thumbRadiusHoverPressed / 4, Height); + _sliderRectangle = new Rectangle(_textRectangle.Right, 0, _valueRectangle.Left - _textRectangle.Right, _thumbRadius); _mouseX = _sliderRectangle.X + ((int)((double)_value / (double)(_rangeMax - _rangeMin) * (double)(_sliderRectangle.Width) - _thumbRadius / 2)); RecalcutlateIndicator(); } private void RecalcutlateIndicator() { - _indicatorRectangle = new Rectangle(_mouseX, (Height - _thumbRadius) /2, _thumbRadius, _thumbRadius); - _indicatorRectangleNormal = new Rectangle(_indicatorRectangle.X, Height/2 - _thumbRadius/2, _thumbRadius, _thumbRadius); - _indicatorRectanglePressed = new Rectangle(_indicatorRectangle.X + _thumbRadius/2 - _thumbRadiusHoverPressed/2, Height / 2 - _thumbRadiusHoverPressed/2, _thumbRadiusHoverPressed, _thumbRadiusHoverPressed); + _indicatorRectangle = new Rectangle(_mouseX, (Height - _thumbRadius) / 2, _thumbRadius, _thumbRadius); + _indicatorRectangleNormal = new Rectangle(_indicatorRectangle.X, Height / 2 - _thumbRadius / 2, _thumbRadius, _thumbRadius); + _indicatorRectanglePressed = new Rectangle(_indicatorRectangle.X + _thumbRadius / 2 - _thumbRadiusHoverPressed / 2, Height / 2 - _thumbRadiusHoverPressed / 2, _thumbRadiusHoverPressed, _thumbRadiusHoverPressed); Invalidate(); } @@ -359,7 +359,7 @@ protected override void OnPaint(PaintEventArgs e) g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; g.Clear(Parent.BackColor); - + Color _inactiveTrackColor; Color _accentColor; Brush _accentBrush; @@ -390,7 +390,7 @@ protected override void OnPaint(PaintEventArgs e) //_disabledBrush = new SolidBrush(_disabledColor); //_thumbHoverColor = Color.FromArgb((int)(2.55 * 15), (Value == 0 ? Color.Gray : _accentColor)); //_thumbPressedColor = Color.FromArgb((int)(2.55 * 30), (Value == 0 ? Color.Gray : _accentColor)); _thumbHoverColor = Color.FromArgb((int)(2.55 * 15), (Value == 0 ? Color.Gray : _accentColor)); - _thumbHoverColor = Color.FromArgb((int)(2.55 * 15), _accentColor); + _thumbHoverColor = Color.FromArgb((int)(2.55 * 15), _accentColor); _thumbPressedColor = Color.FromArgb((int)(2.55 * 30), _accentColor); //Pen LinePen = new Pen(_disabledColor, _inactiveTrack); @@ -398,9 +398,9 @@ protected override void OnPaint(PaintEventArgs e) //g.DrawLine(LinePen, _indicatorSize / 2, Height / 2 + (Height - _indicatorSize) / 2, Width - _indicatorSize / 2, Height / 2 + (Height - _indicatorSize) / 2); //g.DrawLine(LinePen, _sliderRectangle.X + (_indicatorSize / 2), Height / 2 , _sliderRectangle.Right - (_indicatorSize / 2), Height / 2 ); - GraphicsPath _inactiveTrackPath = DrawHelper.CreateRoundRect(_sliderRectangle.X + (_thumbRadius / 2), _sliderRectangle.Y + Height / 2 - _inactiveTrack/2, _sliderRectangle.Width - _thumbRadius, _inactiveTrack, 2); + GraphicsPath _inactiveTrackPath = DrawHelper.CreateRoundRect(_sliderRectangle.X + (_thumbRadius / 2), _sliderRectangle.Y + Height / 2 - _inactiveTrack / 2, _sliderRectangle.Width - _thumbRadius, _inactiveTrack, 2); //g.FillPath(_disabledBrush, _inactiveTrackPath); - GraphicsPath _activeTrackPath = DrawHelper.CreateRoundRect(_sliderRectangle.X + (_thumbRadius / 2), _sliderRectangle.Y + Height / 2 - _activeTrack / 2, _indicatorRectangleNormal.X - _sliderRectangle.X, _activeTrack, 2); + GraphicsPath _activeTrackPath = DrawHelper.CreateRoundRect(_sliderRectangle.X + (_thumbRadius / 2), _sliderRectangle.Y + Height / 2 - _activeTrack / 2, _indicatorRectangleNormal.X - _sliderRectangle.X, _activeTrack, 2); if (Enabled) { @@ -451,16 +451,16 @@ protected override void OnPaint(PaintEventArgs e) _textRectangle.Location, _textRectangle.Size, NativeTextRenderer.TextAlignFlags.Left | NativeTextRenderer.TextAlignFlags.Middle); - - if (_showValue==true) - // Draw value - NativeText.DrawTransparentText( - Value.ToString()+ValueSuffix, - SkinManager.getLogFontByType(_fontType), - Enabled ? SkinManager.TextHighEmphasisColor : SkinManager.TextDisabledOrHintColor, - _valueRectangle.Location, - _valueRectangle.Size, - NativeTextRenderer.TextAlignFlags.Right | NativeTextRenderer.TextAlignFlags.Middle); + + if (_showValue == true) + // Draw value + NativeText.DrawTransparentText( + Value.ToString() + ValueSuffix, + SkinManager.getLogFontByType(_fontType), + Enabled ? SkinManager.TextHighEmphasisColor : SkinManager.TextDisabledOrHintColor, + _valueRectangle.Location, + _valueRectangle.Size, + NativeTextRenderer.TextAlignFlags.Right | NativeTextRenderer.TextAlignFlags.Middle); } } diff --git a/MaterialSkin/Controls/MaterialSnackBar.cs b/MaterialSkin/Controls/MaterialSnackBar.cs index 1d144983..e19128a2 100644 --- a/MaterialSkin/Controls/MaterialSnackBar.cs +++ b/MaterialSkin/Controls/MaterialSnackBar.cs @@ -26,14 +26,14 @@ public class MaterialSnackBar : MaterialForm #region "Events" - [Category("Action")] + [Category(CategoryLabels.Action)] [Description("Fires when Action button is clicked")] public event EventHandler ActionButtonClick; #endregion - [Category("Material Skin"), DefaultValue(false), DisplayName("Use Accent Color")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), DisplayName("Use Accent Color")] public bool UseAccentColor { get { return _useAccentColor; } @@ -44,7 +44,7 @@ public bool UseAccentColor /// /// Get or Set SnackBar show duration in milliseconds /// - [Category("Material Skin"), DefaultValue(2000)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(2000)] public int Duration { get @@ -61,7 +61,7 @@ public int Duration /// /// The Text which gets displayed as the Content /// - [Category("Material Skin"), DefaultValue("SnackBar text")] + [Category(CategoryLabels.MaterialSkin), DefaultValue("SnackBar text")] public new String Text { get @@ -77,7 +77,7 @@ public int Duration } private bool _showActionButton; - [Category("Material Skin"), DefaultValue(false), DisplayName("Show Action Button")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), DisplayName("Show Action Button")] public bool ShowActionButton { get { return _showActionButton; } @@ -88,7 +88,7 @@ public bool ShowActionButton /// /// The Text which gets displayed as the Content /// - [Category("Material Skin"), DefaultValue("OK")] + [Category(CategoryLabels.MaterialSkin), DefaultValue("OK")] public String ActionButtonText { get @@ -107,16 +107,6 @@ public String ActionButtonText /// //public ObservableCollection Buttons { get; set; } - [DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")] - private static extern IntPtr CreateRoundRectRgn - ( - int nLeftRect, // x-coordinate of upper-left corner - int nTopRect, // y-coordinate of upper-left corner - int nRightRect, // x-coordinate of lower-right corner - int nBottomRect, // y-coordinate of lower-right corner - int nWidthEllipse, // width of ellipse - int nHeightEllipse // height of ellipse - ); /// /// Constructer Setting up the Layout @@ -140,7 +130,7 @@ public MaterialSnackBar(string Text, int Duration, bool ShowActionButton, string this.ShowActionButton = ShowActionButton; - Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 6, 6)); + Region = System.Drawing.Region.FromHrgn(NativeWin.CreateRoundRectRgn(0, 0, Width, Height, 6, 6)); _AnimationManager = new AnimationManager(); _AnimationManager.AnimationType = AnimationType.EaseOut; @@ -223,7 +213,7 @@ private void UpdateRects() _actionButton.Visible = _showActionButton; Width = TextRenderer.MeasureText(_text, SkinManager.getFontByType(MaterialSkinManager.fontType.Body2)).Width + (2 * LEFT_RIGHT_PADDING) + _actionButton.Width + 48; - Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 6, 6)); + Region = System.Drawing.Region.FromHrgn(NativeWin.CreateRoundRectRgn(0, 0, Width, Height, 6, 6)); } @@ -234,7 +224,7 @@ private void duration_Tick(object sender, EventArgs e) Close(); } - protected override void OnResize(EventArgs e) + protected override void OnResize(EventArgs e) { base.OnResize(e); UpdateRects(); @@ -274,7 +264,7 @@ protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) e.Graphics.Clear(BackColor); - + // Calc text Rect Rectangle textRect = new Rectangle( LEFT_RIGHT_PADDING, @@ -357,8 +347,8 @@ protected override void WndProc(ref Message message) base.WndProc(ref message); } - - public new void Show() + + public new void Show() { if (Owner == null) { diff --git a/MaterialSkin/Controls/MaterialSwitch.cs b/MaterialSkin/Controls/MaterialSwitch.cs index af574bdb..b2ef01c6 100644 --- a/MaterialSkin/Controls/MaterialSwitch.cs +++ b/MaterialSkin/Controls/MaterialSwitch.cs @@ -24,7 +24,7 @@ public class MaterialSwitch : CheckBox, IMaterialControl private bool _ripple; - [Category("Appearance")] + [Category(CategoryLabels.Appearance)] public bool Ripple { get { return _ripple; } @@ -42,7 +42,7 @@ public bool Ripple } } - [Category("Appearance")] + [Category(CategoryLabels.Appearance)] [Browsable(true), DefaultValue(false), EditorBrowsable(EditorBrowsableState.Always)] public bool ReadOnly { get; set; } @@ -272,7 +272,7 @@ protected override void OnCreateControl() if (DesignMode) return; - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; GotFocus += (sender, AddingNewEventArgs) => { @@ -305,7 +305,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/MaterialTabSelector.cs b/MaterialSkin/Controls/MaterialTabSelector.cs index 505980ce..ddd9217e 100644 --- a/MaterialSkin/Controls/MaterialTabSelector.cs +++ b/MaterialSkin/Controls/MaterialTabSelector.cs @@ -37,7 +37,7 @@ public enum CustomCharacterCasing private MaterialTabControl _baseTabControl; - [Category("Material Skin"), Browsable(true)] + [Category(CategoryLabels.MaterialSkin), Browsable(true)] public MaterialTabControl BaseTabControl { get { return _baseTabControl; } @@ -79,7 +79,7 @@ public MaterialTabControl BaseTabControl private const int ICON_SIZE = 24; private const int FIRST_TAB_PADDING = 50; - private const int TAB_HEADER_PADDING = 24; + private const int TAB_HEADER_PADDING = 16; private const int TAB_WIDTH_MIN = 160; private const int TAB_WIDTH_MAX = 264; @@ -87,7 +87,7 @@ public MaterialTabControl BaseTabControl private CustomCharacterCasing _characterCasing; - [Category("Appearance")] + [Category(CategoryLabels.Appearance)] public CustomCharacterCasing CharacterCasing { get => _characterCasing; @@ -100,8 +100,8 @@ public CustomCharacterCasing CharacterCasing } private int _tab_indicator_height; - [Category("Material Skin"), Browsable(true), DisplayName("Tab Indicator Height"), DefaultValue(2)] - public int TabIndicatorHeight + [Category(CategoryLabels.MaterialSkin), Browsable(true), DisplayName("Tab Indicator Height"), DefaultValue(2)] + public int TabIndicatorHeight { get { return _tab_indicator_height; } set @@ -124,7 +124,7 @@ public enum TabLabelStyle } private TabLabelStyle _tabLabel; - [Category("Material Skin"), Browsable(true), DisplayName("Tab Label"), DefaultValue(TabLabelStyle.Text)] + [Category(CategoryLabels.MaterialSkin), Browsable(true), DisplayName("Tab Label"), DefaultValue(TabLabelStyle.Text)] public TabLabelStyle TabLabel { get { return _tabLabel; } @@ -191,9 +191,9 @@ protected override void OnPaint(PaintEventArgs e) //Draw tab headers if (_tab_over_index >= 0) - { + { //Change mouse over tab background color - g.FillRectangle(SkinManager.BackgroundHoverBrush , _tabRects[_tab_over_index].X, _tabRects[_tab_over_index].Y , _tabRects[_tab_over_index].Width, _tabRects[_tab_over_index].Height - _tab_indicator_height); + g.FillRectangle(SkinManager.BackgroundHoverBrush, _tabRects[_tab_over_index].X, _tabRects[_tab_over_index].Y, _tabRects[_tab_over_index].Width, _tabRects[_tab_over_index].Height - _tab_indicator_height); } foreach (TabPage tabPage in _baseTabControl.TabPages) @@ -206,7 +206,7 @@ protected override void OnPaint(PaintEventArgs e) using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) { Size textSize = TextRenderer.MeasureText(_baseTabControl.TabPages[currentTabIndex].Text, Font); - Rectangle textLocation = new Rectangle(_tabRects[currentTabIndex].X+ (TAB_HEADER_PADDING/2), _tabRects[currentTabIndex].Y, _tabRects[currentTabIndex].Width - (TAB_HEADER_PADDING), _tabRects[currentTabIndex].Height); + Rectangle textLocation = new Rectangle(_tabRects[currentTabIndex].X + (TAB_HEADER_PADDING / 2), _tabRects[currentTabIndex].Y, _tabRects[currentTabIndex].Width - (TAB_HEADER_PADDING), _tabRects[currentTabIndex].Height); if (_tabLabel == TabLabelStyle.IconAndText) { @@ -214,7 +214,7 @@ protected override void OnPaint(PaintEventArgs e) textLocation.Height = 10; } - if (((TAB_HEADER_PADDING*2) + textSize.Width < TAB_WIDTH_MAX)) + if (((TAB_HEADER_PADDING * 2) + textSize.Width < TAB_WIDTH_MAX)) { NativeText.DrawTransparentText( CharacterCasing == CustomCharacterCasing.Upper ? tabPage.Text.ToUpper() : @@ -259,10 +259,10 @@ protected override void OnPaint(PaintEventArgs e) { iconRect.Y = 12; } - g.DrawImage(!String.IsNullOrEmpty(tabPage.ImageKey) ? _baseTabControl.ImageList.Images[tabPage.ImageKey]: _baseTabControl.ImageList.Images[tabPage.ImageIndex], iconRect); + g.DrawImage(!String.IsNullOrEmpty(tabPage.ImageKey) ? _baseTabControl.ImageList.Images[tabPage.ImageKey] : _baseTabControl.ImageList.Images[tabPage.ImageIndex], iconRect); } } - } + } //Animate tab indicator var previousSelectedTabIndexIfHasOne = _previousSelectedTabIndex == -1 ? _baseTabControl.SelectedIndex : _previousSelectedTabIndex; @@ -379,7 +379,7 @@ private void UpdateTabRects() else if (TabWidth < TAB_WIDTH_MIN) TabWidth = TAB_WIDTH_MIN; - if (i==0) + if (i == 0) _tabRects.Add(new Rectangle(FIRST_TAB_PADDING - (TAB_HEADER_PADDING), 0, TabWidth, Height)); else _tabRects.Add(new Rectangle(_tabRects[i - 1].Right, 0, TabWidth, Height)); diff --git a/MaterialSkin/Controls/MaterialTextBox.cs b/MaterialSkin/Controls/MaterialTextBox.cs index 041d238a..538e84d2 100644 --- a/MaterialSkin/Controls/MaterialTextBox.cs +++ b/MaterialSkin/Controls/MaterialTextBox.cs @@ -26,12 +26,12 @@ public class MaterialTextBox : RichTextBox, IMaterialControl [Browsable(false)] public MouseState MouseState { get; set; } - [Category("Material Skin"), DefaultValue(false)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false)] public bool Password { get; set; } 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 larger size enables the hint to always be visible")] public bool UseTallSize { get { return _UseTallSize; } @@ -45,12 +45,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; } @@ -64,7 +64,7 @@ public string Hint private Image _leadingIcon; - [Category("Material Skin"), Browsable(true), Localizable(false)] + [Category(CategoryLabels.MaterialSkin), Browsable(true), Localizable(false)] /// /// Gets or sets the leading Icon /// @@ -89,7 +89,7 @@ public Image LeadingIcon private Image _trailingIcon; - [Category("Material Skin"), Browsable(true), Localizable(false)] + [Category(CategoryLabels.MaterialSkin), Browsable(true), Localizable(false)] /// /// Gets or sets the trailing Icon /// @@ -160,8 +160,8 @@ public override bool ShortcutsEnabled private bool hasHint; private bool _errorState = false; - private int _left_padding ; - private int _right_padding ; + private int _left_padding; + private int _right_padding; private Rectangle _leadingIconBounds; private Rectangle _trailingIconBounds; private Rectangle _textfieldBounds; @@ -172,7 +172,7 @@ public override bool ShortcutsEnabled private bool _animateReadOnly; - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Browsable(true)] public bool AnimateReadOnly { @@ -186,7 +186,7 @@ public bool AnimateReadOnly private bool _leaveOnEnterKey; - [Category("Material Skin"), DefaultValue(false), Description("Select next control which have TabStop property set to True when enter key is pressed.")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), Description("Select next control which have TabStop property set to True when enter key is pressed.")] public bool LeaveOnEnterKey { get => _leaveOnEnterKey; @@ -207,11 +207,11 @@ public bool LeaveOnEnterKey #region "Events" - [Category("Action")] + [Category(CategoryLabels.Action)] [Description("Fires when Leading Icon is clicked")] public event EventHandler LeadingIconClick; - [Category("Action")] + [Category(CategoryLabels.Action)] [Description("Fires when Trailing Icon is clicked")] public event EventHandler TrailingIconClick; @@ -257,9 +257,6 @@ public MaterialTextBox() private const int EM_SETPASSWORDCHAR = 0x00cc; - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); - protected override void OnCreateControl() { base.OnCreateControl(); @@ -268,7 +265,7 @@ protected override void OnCreateControl() SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); - if (Password) SendMessage(Handle, EM_SETPASSWORDCHAR, 'T', 0); + if (Password) NativeWin.SendMessage(Handle, EM_SETPASSWORDCHAR, 'T', 0); // Size and padding HEIGHT = UseTallSize ? 50 : 36; @@ -277,7 +274,7 @@ protected override void OnCreateControl() UpdateRects(); // events - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; LostFocus += (sender, args) => _animationManager.StartNewAnimation(AnimationDirection.Out); GotFocus += (sender, args) => { @@ -290,17 +287,17 @@ protected override void OnCreateControl() }; MouseLeave += (sender, args) => { - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; Invalidate(); }; HScroll += (sender, args) => { - SendMessage(this.Handle, EM_GETSCROLLPOS, 0, ref scrollPos); + NativeWin.SendMessage(this.Handle, EM_GETSCROLLPOS, 0, ref scrollPos); Invalidate(); }; KeyDown += (sender, args) => { - SendMessage(this.Handle, EM_GETSCROLLPOS, 0, ref scrollPos); + NativeWin.SendMessage(this.Handle, EM_GETSCROLLPOS, 0, ref scrollPos); }; } @@ -308,8 +305,6 @@ protected override void OnCreateControl() private const int EM_GETSCROLLPOS = WM_USER + 221; private const int WM_USER = 0x400; - [DllImport("user32.dll")] - private static extern IntPtr SendMessage(IntPtr hWnd, Int32 wMsg, Int32 wParam, ref Point lParam); public override Size GetPreferredSize(Size proposedSize) { @@ -363,7 +358,7 @@ private void preProcessIcons() if (_trailingIcon == null && _leadingIcon == null) return; // Calculate lightness and color - float l = (SkinManager.Theme == MaterialSkinManager.Themes.LIGHT ) ? 0f : 1f; + float l = (SkinManager.Theme == MaterialSkinManager.Themes.LIGHT) ? 0f : 1f; // Create matrices float[][] matrixGray = { @@ -510,13 +505,13 @@ private void UpdateRects(bool RedefineTextField = true) if (RedefineTextField) { - var rect = new Rectangle(_left_padding, UseTallSize ? hasHint ? - (HINT_TEXT_SMALL_Y + HINT_TEXT_SMALL_SIZE) : // Has hint and it's tall - (int)(LINE_Y / 3.5) : // No hint and tall - Height / 5, // not tall - ClientSize.Width - _left_padding - _right_padding, LINE_Y); - RECT rc = new RECT(rect); - SendMessageRefRect(Handle, EM_SETRECT, 0, ref rc); + var rect = new Rectangle(_left_padding, UseTallSize ? hasHint ? + (HINT_TEXT_SMALL_Y + HINT_TEXT_SMALL_SIZE) : // Has hint and it's tall + (int)(LINE_Y / 3.5) : // No hint and tall + Height / 5, // not tall + ClientSize.Width - _left_padding - _right_padding, LINE_Y); + NativeWin.RECT rc = new NativeWin.RECT(rect); + NativeWin.SendMessageRefRect(Handle, NativeWin.EM_SETRECT, 0, ref rc); } } @@ -558,7 +553,7 @@ protected override void OnPaint(PaintEventArgs pevent) //Trailing Icon if (TrailingIcon != null) { - if(_errorState) + if (_errorState) g.FillRectangle(iconsErrorBrushes["_trailingIcon"], _trailingIconBounds); else g.FillRectangle(iconsBrushes["_trailingIcon"], _trailingIconBounds); @@ -829,43 +824,15 @@ private void LeaveOnEnterKey_KeyDown(object sender, KeyEventArgs e) } } - // Cursor flickering fix - private const int WM_SETCURSOR = 0x0020; - protected override void WndProc(ref Message m) { - if (m.Msg == WM_SETCURSOR) + // Cursor flickering fix + if (m.Msg == NativeWin.WM_SETCURSOR) Cursor.Current = this.Cursor; else base.WndProc(ref m); } - // Padding - private const int EM_SETRECT = 0xB3; - - [DllImport(@"User32.dll", EntryPoint = @"SendMessage", CharSet = CharSet.Auto)] - private static extern int SendMessageRefRect(IntPtr hWnd, uint msg, int wParam, ref RECT rect); - - [StructLayout(LayoutKind.Sequential)] - private struct RECT - { - public readonly int Left; - public readonly int Top; - public readonly int Right; - public readonly int Bottom; - - private RECT(int left, int top, int right, int bottom) - { - Left = left; - Top = top; - Right = right; - Bottom = bottom; - } - - public RECT(Rectangle r) : this(r.Left, r.Top, r.Right, r.Bottom) - { - } - } } [ToolboxItem(false)] diff --git a/MaterialSkin/Controls/MaterialTextBox2.cs b/MaterialSkin/Controls/MaterialTextBox2.cs index cf7f0539..246ec7ed 100644 --- a/MaterialSkin/Controls/MaterialTextBox2.cs +++ b/MaterialSkin/Controls/MaterialTextBox2.cs @@ -51,7 +51,7 @@ public class MaterialTextBox2 : Control, IMaterialControl 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 larger size enables the hint to always be visible")] public bool UseTallSize { get { return _UseTallSize; } @@ -65,7 +65,7 @@ public bool UseTallSize } 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.")] + [Category(CategoryLabels.MaterialSkin), 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; } @@ -84,7 +84,7 @@ public bool ShowAssistiveText 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.")] + [Category(CategoryLabels.MaterialSkin), 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; } @@ -97,7 +97,7 @@ public string HelperText 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.")] + [Category(CategoryLabels.MaterialSkin), 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; } @@ -108,7 +108,7 @@ public string ErrorMessage } } - [Category("Material Skin"), DefaultValue(""), Localizable(true)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(""), Localizable(true)] public string Hint { get { return baseTextBox.Hint; } @@ -121,12 +121,12 @@ public string Hint } } - [Category("Material Skin"), DefaultValue(true)] + [Category(CategoryLabels.MaterialSkin), DefaultValue(true)] public bool UseAccent { get; set; } private Image _leadingIcon; - [Category("Material Skin"), Browsable(true), Localizable(false)] + [Category(CategoryLabels.MaterialSkin), Browsable(true), Localizable(false)] /// /// Gets or sets the leading Icon /// @@ -144,7 +144,7 @@ public Image LeadingIcon private Image _trailingIcon; - [Category("Material Skin"), Browsable(true), Localizable(false)] + [Category(CategoryLabels.MaterialSkin), Browsable(true), Localizable(false)] /// /// Gets or sets the trailing Icon /// @@ -168,7 +168,7 @@ public enum PrefixSuffixTypes } private PrefixSuffixTypes _prefixsuffix; - [Category("Material Skin"), DefaultValue(PrefixSuffixTypes.None), Description("Set Prefix/Suffix/None")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(PrefixSuffixTypes.None), Description("Set Prefix/Suffix/None")] public PrefixSuffixTypes PrefixSuffix { get { return _prefixsuffix; } @@ -185,7 +185,7 @@ public PrefixSuffixTypes PrefixSuffix } private string _prefixsuffixText; - [Category("Material Skin"), DefaultValue(""), Localizable(true), Description("Set Prefix or Suffix text")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(""), Localizable(true), Description("Set Prefix or Suffix text")] public string PrefixSuffixText { get { return _prefixsuffixText; } @@ -193,9 +193,9 @@ public string PrefixSuffixText { //if (_prefixsuffixText != value) //{ - _prefixsuffixText = value; - UpdateRects(); - Invalidate(); + _prefixsuffixText = value; + UpdateRects(); + Invalidate(); //} } } @@ -228,28 +228,28 @@ public override ContextMenuStrip ContextMenuStrip public override string Text { get { return baseTextBox.Text; } set { baseTextBox.Text = value; UpdateRects(); } } - [Category("Appearance")] + [Category(CategoryLabels.Appearance)] public HorizontalAlignment TextAlign { get { return baseTextBox.TextAlign; } set { baseTextBox.TextAlign = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public CharacterCasing CharacterCasing { get { return baseTextBox.CharacterCasing; } set { baseTextBox.CharacterCasing = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool HideSelection { get { return baseTextBox.HideSelection; } set { baseTextBox.HideSelection = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public int MaxLength { get { return baseTextBox.MaxLength; } set { baseTextBox.MaxLength = value; } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public char PasswordChar { get { return baseTextBox.PasswordChar; } set { baseTextBox.PasswordChar = value; } } - [Category("Behavior")] - public bool ShortcutsEnabled - { - get - { return baseTextBox.ShortcutsEnabled; } - set - { + [Category(CategoryLabels.Behavior)] + public bool ShortcutsEnabled + { + get + { return baseTextBox.ShortcutsEnabled; } + set + { baseTextBox.ShortcutsEnabled = value; if (value == false) { @@ -264,13 +264,13 @@ public bool ShortcutsEnabled } } - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool UseSystemPasswordChar { get { return baseTextBox.UseSystemPasswordChar; } set { baseTextBox.UseSystemPasswordChar = value; } } public new object Tag { get { return baseTextBox.Tag; } set { baseTextBox.Tag = value; } } private bool _readonly; - [Category("Behavior")] + [Category(CategoryLabels.Behavior)] public bool ReadOnly { get { return _readonly; } @@ -287,7 +287,7 @@ public bool ReadOnly private bool _animateReadOnly; - [Category("Material Skin")] + [Category(CategoryLabels.MaterialSkin)] [Browsable(true)] public bool AnimateReadOnly { @@ -301,7 +301,7 @@ public bool AnimateReadOnly private bool _leaveOnEnterKey; - [Category("Material Skin"), DefaultValue(false), Description("Select next control which have TabStop property set to True when enter key is pressed.")] + [Category(CategoryLabels.MaterialSkin), DefaultValue(false), Description("Select next control which have TabStop property set to True when enter key is pressed.")] public bool LeaveOnEnterKey { get => _leaveOnEnterKey; @@ -340,11 +340,11 @@ public bool LeaveOnEnterKey #region "Events" - [Category("Action")] + [Category(CategoryLabels.Action)] [Description("Fires when Leading Icon is clicked")] public event EventHandler LeadingIconClick; - [Category("Action")] + [Category(CategoryLabels.Action)] [Description("Fires when Trailing Icon is clicked")] public event EventHandler TrailingIconClick; @@ -472,7 +472,7 @@ public event EventHandler BorderStyleChanged } } - #if NETFRAMEWORK +#if NETFRAMEWORK public new event EventHandler ContextMenuChanged { add @@ -484,7 +484,7 @@ public event EventHandler BorderStyleChanged baseTextBox.ContextMenuChanged -= value; } } - #endif +#endif public new event EventHandler ContextMenuStripChanged { @@ -1194,7 +1194,7 @@ public event EventHandler ReadOnlyChanged } } - public event EventHandler TextAlignChanged + public event EventHandler TextAlignChanged { add { @@ -1267,7 +1267,7 @@ public event EventHandler TextAlignChanged private const int ACTIVATION_INDICATOR_HEIGHT = 2; private const int HELPER_TEXT_HEIGHT = 16; private const int FONT_HEIGHT = 20; - + private int HEIGHT = 48; private int LINE_Y; @@ -1290,7 +1290,7 @@ public MaterialTextBox2() { // Material Properties UseAccent = true; - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer, true); @@ -1321,7 +1321,7 @@ public MaterialTextBox2() Font = base.Font, ForeColor = SkinManager.TextHighEmphasisColor, Multiline = false, - Location = new Point(LEFT_PADDING, HEIGHT/2- FONT_HEIGHT/2), + Location = new Point(LEFT_PADDING, HEIGHT / 2 - FONT_HEIGHT / 2), Width = Width - (LEFT_PADDING + RIGHT_PADDING), Height = FONT_HEIGHT }; @@ -1383,7 +1383,7 @@ protected override void OnPaint(PaintEventArgs pevent) g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; g.Clear(Parent.BackColor); SolidBrush backBrush = new SolidBrush(DrawHelper.BlendColor(Parent.BackColor, SkinManager.BackgroundAlternativeColor, SkinManager.BackgroundAlternativeColor.A)); - + //backColor g.FillRectangle( !Enabled ? SkinManager.BackgroundDisabledBrush : // Disabled @@ -1456,7 +1456,7 @@ 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, + // NativeText.MeasureLogString(_prefixsuffixText, SkinManager.getLogFontByType(MaterialSkinManager.fontType.Subtitle1)).Width, _prefix_padding, hasHint && UseTallSize ? LINE_Y - (hintRect.Y + hintRect.Height) : LINE_Y); @@ -1477,7 +1477,7 @@ protected override void OnPaint(PaintEventArgs pevent) using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) { Rectangle suffixRect = new Rectangle( - Width - _right_padding , + 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, @@ -1495,7 +1495,7 @@ protected override void OnPaint(PaintEventArgs pevent) } // Draw hint text - if(hasHint && UseTallSize && (isFocused || userTextPresent)) + if (hasHint && UseTallSize && (isFocused || userTextPresent)) { using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) { @@ -1535,14 +1535,14 @@ protected override void OnPaint(PaintEventArgs pevent) } // Draw error message - if (_showAssistiveText && _errorState && ErrorMessage!=null) + if (_showAssistiveText && _errorState && ErrorMessage != null) { using (NativeTextRenderer NativeText = new NativeTextRenderer(g)) { NativeText.DrawTransparentText( ErrorMessage, SkinManager.getTextBoxFontBySize(hintTextSize), - Enabled ? + Enabled ? SkinManager.BackgroundHoverRedColor : // error state SkinManager.TextDisabledOrHintColor, // Disabled helperTextRect.Location, @@ -1615,7 +1615,7 @@ protected override void OnMouseLeave(EventArgs e) else { base.OnMouseLeave(e); - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; Invalidate(); } } @@ -1637,7 +1637,7 @@ protected override void OnCreateControl() base.OnCreateControl(); // events - MouseState = MouseState.OUT; + MouseState = MouseState.OUT_; } @@ -1838,7 +1838,7 @@ private void preProcessIcons() iconsErrorBrushes.Add("_trailingIcon", textureBrushRed); } } - + #endregion private void UpdateHeight() @@ -1870,7 +1870,7 @@ private void UpdateRects() } else _prefix_padding = 0; - + if (_prefixsuffix == PrefixSuffixTypes.Suffix && _prefixsuffixText != null && _prefixsuffixText.Length > 0) { using (NativeTextRenderer NativeText = new NativeTextRenderer(CreateGraphics())) diff --git a/MaterialSkin/Globals.cs b/MaterialSkin/Globals.cs new file mode 100644 index 00000000..cb417b28 --- /dev/null +++ b/MaterialSkin/Globals.cs @@ -0,0 +1,23 @@ + +namespace MaterialSkin +{ + internal class Globals + { + /// + /// Left and Right padding applied to each header of a Material Tab Selector control + /// + internal const int TAB_HEADER_PADDING = 20; + } + + + internal static class CategoryLabels + { + internal const string MaterialSkin = "Material Skin"; + internal const string Drawer = "Drawer"; + internal const string Behavior = "Behavior"; + internal const string Layout = "Layout"; + internal const string Appearance = "Appearance"; + internal const string Action = "Action"; + internal const string Disposition = "Disposition"; + } +} diff --git a/MaterialSkin/IMaterialControl.cs b/MaterialSkin/IMaterialControl.cs index 70c94e0b..e99e00af 100644 --- a/MaterialSkin/IMaterialControl.cs +++ b/MaterialSkin/IMaterialControl.cs @@ -39,6 +39,6 @@ public enum MouseState /// /// Defines the OUT /// - OUT + OUT_ } } \ No newline at end of file diff --git a/MaterialSkin/MaterialSkin.csproj b/MaterialSkin/MaterialSkin.csproj index a9e04a3a..39df32e0 100644 --- a/MaterialSkin/MaterialSkin.csproj +++ b/MaterialSkin/MaterialSkin.csproj @@ -137,12 +137,14 @@ + + True diff --git a/MaterialSkin/MaterialSkinManager.cs b/MaterialSkin/MaterialSkinManager.cs index 22ea8509..e8ee507c 100644 --- a/MaterialSkin/MaterialSkinManager.cs +++ b/MaterialSkin/MaterialSkinManager.cs @@ -85,7 +85,7 @@ private MaterialSkinManager() // RemoveFontMemResourceEx foreach (IntPtr handle in logicalFonts.Values) { - NativeTextRenderer.DeleteObject(handle); + NativeWin.DeleteObject(handle); } } @@ -235,7 +235,7 @@ public enum Themes : byte public Brush CheckboxOffBrush => Theme == Themes.LIGHT ? CHECKBOX_OFF_LIGHT_BRUSH : CHECKBOX_OFF_DARK_BRUSH; public Color CheckBoxOffDisabledColor => Theme == Themes.LIGHT ? CHECKBOX_OFF_DISABLED_LIGHT : CHECKBOX_OFF_DISABLED_DARK; public Brush CheckBoxOffDisabledBrush => Theme == Themes.LIGHT ? CHECKBOX_OFF_DISABLED_LIGHT_BRUSH : CHECKBOX_OFF_DISABLED_DARK_BRUSH; - + // Switch public Color SwitchOffColor => Theme == Themes.LIGHT ? CHECKBOX_OFF_DARK : CHECKBOX_OFF_LIGHT; // yes, I re-use the checkbox color, sue me public Color SwitchOffThumbColor => Theme == Themes.LIGHT ? SWITCH_OFF_THUMB_LIGHT : SWITCH_OFF_THUMB_DARK; @@ -319,7 +319,7 @@ public Font getFontByType(fontType type) case fontType.Subtitle2: return new Font(RobotoFontFamilies["Roboto_Medium"], 14f, FontStyle.Bold, GraphicsUnit.Pixel); - + case fontType.SubtleEmphasis: return new Font(RobotoFontFamilies["Roboto"], 12f, FontStyle.Italic, GraphicsUnit.Pixel); @@ -378,7 +378,7 @@ private void addFont(byte[] fontdata) Marshal.Copy(fontdata, 0, ptrFont, dataLength); // GDI Font - NativeTextRenderer.AddFontMemResourceEx(fontdata, dataLength, IntPtr.Zero, out _); + NativeWin.AddFontMemResourceEx(fontdata, dataLength, IntPtr.Zero, out _); // GDI+ Font privateFontCollection.AddMemoryFont(ptrFont, dataLength); @@ -387,12 +387,12 @@ private void addFont(byte[] fontdata) private IntPtr createLogicalFont(string fontName, int size, NativeTextRenderer.logFontWeight weight, byte lfItalic = 0) { // Logical font: - NativeTextRenderer.LogFont lfont = new NativeTextRenderer.LogFont(); + NativeWin.LogFont lfont = new NativeWin.LogFont(); lfont.lfFaceName = fontName; lfont.lfHeight = -size; lfont.lfWeight = (int)weight; lfont.lfItalic = lfItalic; - return NativeTextRenderer.CreateFontIndirect(lfont); + return NativeWin.CreateFontIndirect(lfont); } // Dyanmic Themes diff --git a/MaterialSkin/MouseWheelRedirector.cs b/MaterialSkin/MouseWheelRedirector.cs index 6066b102..46f71f0c 100644 --- a/MaterialSkin/MouseWheelRedirector.cs +++ b/MaterialSkin/MouseWheelRedirector.cs @@ -1,17 +1,7 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Security; -using System.Text; -using System.Threading.Tasks; -using Microsoft.VisualBasic; using System.Windows.Forms; -using System.Runtime.InteropServices; + +using MaterialSkin; public class MouseWheelRedirector : IMessageFilter { @@ -82,18 +72,15 @@ private void ControlMouseLeaveOrDisposed(object sender, System.EventArgs e) currentControl = null; } - private const int WM_MOUSEWHEEL = 0x20A; public bool PreFilterMessage(ref System.Windows.Forms.Message m) { - if (currentControl != null && m.Msg == WM_MOUSEWHEEL) + if (currentControl != null && m.Msg == NativeWin.WM_MOUSEWHEEL) { - SendMessage(currentControl.Handle, m.Msg, m.WParam, m.LParam); + NativeWin.SendMessage(currentControl.Handle, m.Msg, m.WParam, m.LParam); return true; } else return false; } - [DllImport("user32.dll", SetLastError = false)] - private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); } diff --git a/MaterialSkin/NativeTextRenderer.cs b/MaterialSkin/NativeTextRenderer.cs index f41d1744..e19a1f34 100644 --- a/MaterialSkin/NativeTextRenderer.cs +++ b/MaterialSkin/NativeTextRenderer.cs @@ -3,6 +3,8 @@ using System.Drawing; using System.Runtime.InteropServices; +using MaterialSkin; + public sealed class NativeTextRenderer : IDisposable { #region Fields and Consts @@ -26,11 +28,11 @@ public NativeTextRenderer(Graphics g) var clip = _g.Clip.GetHrgn(_g); _hdc = _g.GetHdc(); - SetBkMode(_hdc, 1); + NativeWin.SetBkMode(_hdc, 1); - SelectClipRgn(_hdc, clip); + NativeWin.SelectClipRgn(_hdc, clip); - DeleteObject(clip); + NativeWin.DeleteObject(clip); } public Size MeasureString(string str, Font font) @@ -39,17 +41,17 @@ public Size MeasureString(string str, Font font) var size = new Size(); if (string.IsNullOrEmpty(str)) return size; - GetTextExtentPoint32(_hdc, str, str.Length, ref size); + NativeWin.GetTextExtentPoint32(_hdc, str, str.Length, ref size); return size; } public Size MeasureLogString(string str, IntPtr LogFont) { - SelectObject(_hdc, LogFont); + NativeWin.SelectObject(_hdc, LogFont); var size = new Size(); if (string.IsNullOrEmpty(str)) return size; - GetTextExtentPoint32(_hdc, str, str.Length, ref size); + NativeWin.GetTextExtentPoint32(_hdc, str, str.Length, ref size); return size; } @@ -58,7 +60,7 @@ public Size MeasureString(string str, Font font, float maxWidth, out int charFit SetFont(font); var size = new Size(); - GetTextExtentExPoint(_hdc, str, str.Length, (int)Math.Round(maxWidth), _charFit, _charFitWidth, ref size); + NativeWin.GetTextExtentExPoint(_hdc, str, str.Length, (int)Math.Round(maxWidth), _charFit, _charFitWidth, ref size); charFit = _charFit[0]; charFitWidth = charFit > 0 ? _charFitWidth[charFit - 1] : 0; return size; @@ -69,7 +71,7 @@ public void DrawString(String str, Font font, Color color, Point point) SetFont(font); SetTextColor(color); - TextOut(_hdc, point.X, point.Y, str, str.Length); + NativeWin.TextOut(_hdc, point.X, point.Y, str, str.Length); } public void DrawString(String str, Font font, Color color, Rectangle rect, TextFormatFlags flags) @@ -77,8 +79,8 @@ public void DrawString(String str, Font font, Color color, Rectangle rect, TextF SetFont(font); SetTextColor(color); - var rect2 = new Rect(rect); - DrawText(_hdc, str, str.Length, ref rect2, (uint)flags); + var rect2 = new NativeWin.RECT(rect); + NativeWin.DrawText(_hdc, str, str.Length, ref rect2, (uint)flags); } public void DrawTransparentText(string str, Font font, Color color, Point point, Size size, TextAlignFlags flags) @@ -104,11 +106,11 @@ public void DrawMultilineTransparentText(string str, IntPtr LogFont, Color color private void DrawTransparentText(IntPtr fontHandle, string str, Color color, Point point, Size size, TextAlignFlags flags, bool multilineSupport) { // Create a memory DC so we can work off-screen - IntPtr memoryHdc = CreateCompatibleDC(_hdc); - SetBkMode(memoryHdc, 1); + IntPtr memoryHdc = NativeWin.CreateCompatibleDC(_hdc); + NativeWin.SetBkMode(memoryHdc, 1); // Create a device-independent bitmap and select it into our DC - var info = new BitMapInfo(); + var info = new NativeWin.BitMapInfo(); info.biSize = Marshal.SizeOf(info); info.biWidth = size.Width; info.biHeight = -size.Height; @@ -116,17 +118,17 @@ private void DrawTransparentText(IntPtr fontHandle, string str, Color color, Poi info.biBitCount = 32; info.biCompression = 0; // BI_RGB IntPtr ppvBits; - IntPtr dib = CreateDIBSection(_hdc, ref info, 0, out ppvBits, IntPtr.Zero, 0); - SelectObject(memoryHdc, dib); + IntPtr dib = NativeWin.CreateDIBSection(_hdc, ref info, 0, out ppvBits, IntPtr.Zero, 0); + NativeWin.SelectObject(memoryHdc, dib); try { // copy target background to memory HDC so when copied back it will have the proper background - BitBlt(memoryHdc, 0, 0, size.Width, size.Height, _hdc, point.X, point.Y, 0x00CC0020); + NativeWin.BitBlt(memoryHdc, 0, 0, size.Width, size.Height, _hdc, point.X, point.Y, 0x00CC0020); // Create and select font - SelectObject(memoryHdc, fontHandle); - SetTextColor(memoryHdc, (color.B & 0xFF) << 16 | (color.G & 0xFF) << 8 | color.R); + NativeWin.SelectObject(memoryHdc, fontHandle); + NativeWin.SetTextColor(memoryHdc, (color.B & 0xFF) << 16 | (color.G & 0xFF) << 8 | color.R); Size strSize = new Size(); Point pos = new Point(); @@ -141,8 +143,8 @@ private void DrawTransparentText(IntPtr fontHandle, string str, Color color, Poi fmtFlags |= TextFormatFlags.Right; // Calculate the string size - Rect strRect = new Rect(new Rectangle(point, size)); - DrawText(memoryHdc, str, str.Length, ref strRect, TextFormatFlags.CalcRect | fmtFlags); + NativeWin.RECT strRect = new NativeWin.RECT(new Rectangle(point, size)); + NativeWin.DrawText(memoryHdc, str, str.Length, ref strRect, TextFormatFlags.CalcRect | fmtFlags); if (flags.HasFlag(TextAlignFlags.Middle)) pos.Y = ((size.Height) >> 1) - (strRect.Height >> 1); @@ -150,13 +152,13 @@ private void DrawTransparentText(IntPtr fontHandle, string str, Color color, Poi pos.Y = (size.Height) - (strRect.Height); // Draw Text for multiline format - Rect region = new Rect(new Rectangle(pos, size)); - DrawText(memoryHdc, str, -1, ref region, fmtFlags); + NativeWin.RECT region = new NativeWin.RECT(new Rectangle(pos, size)); + NativeWin.DrawText(memoryHdc, str, -1, ref region, fmtFlags); } else { // Calculate the string size - GetTextExtentPoint32(memoryHdc, str, str.Length, ref strSize); + NativeWin.GetTextExtentPoint32(memoryHdc, str, str.Length, ref strSize); // Aligment if (flags.HasFlag(TextAlignFlags.Center)) pos.X = ((size.Width) >> 1) - (strSize.Width >> 1); @@ -169,16 +171,16 @@ private void DrawTransparentText(IntPtr fontHandle, string str, Color color, Poi pos.Y = (size.Height) - (strSize.Height); // Draw text to memory HDC - TextOut(memoryHdc, pos.X, pos.Y, str, str.Length); + NativeWin.TextOut(memoryHdc, pos.X, pos.Y, str, str.Length); } // copy from memory HDC to normal HDC with alpha blend so achieve the transparent text - AlphaBlend(_hdc, point.X, point.Y, size.Width, size.Height, memoryHdc, 0, 0, size.Width, size.Height, new BlendFunction(color.A)); + NativeWin.AlphaBlend(_hdc, point.X, point.Y, size.Width, size.Height, memoryHdc, 0, 0, size.Width, size.Height, new NativeWin.BlendFunction(color.A)); } finally { - DeleteObject(dib); - DeleteDC(memoryHdc); + NativeWin.DeleteObject(dib); + NativeWin.DeleteDC(memoryHdc); } } @@ -186,7 +188,7 @@ public void Dispose() { if (_hdc != IntPtr.Zero) { - SelectClipRgn(_hdc, IntPtr.Zero); + NativeWin.SelectClipRgn(_hdc, IntPtr.Zero); _g.ReleaseHdc(_hdc); _hdc = IntPtr.Zero; } @@ -196,7 +198,7 @@ public void Dispose() private void SetFont(Font font) { - SelectObject(_hdc, GetCachedHFont(font)); + NativeWin.SelectObject(_hdc, GetCachedHFont(font)); } private static IntPtr GetCachedHFont(Font font) @@ -232,148 +234,9 @@ private static IntPtr GetCachedHFont(Font font) private void SetTextColor(Color color) { int rgb = (color.B & 0xFF) << 16 | (color.G & 0xFF) << 8 | color.R; - SetTextColor(_hdc, rgb); + NativeWin.SetTextColor(_hdc, rgb); } - [DllImport("user32.dll", CharSet = CharSet.Auto)] - private static extern int DrawText(IntPtr hdc, string lpchText, int cchText, ref Rect lprc, TextFormatFlags dwDTFormat); - - [DllImport("gdi32.dll")] - private static extern int SetBkMode(IntPtr hdc, int mode); - - [DllImport("gdi32.dll")] - private static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiObj); - - [DllImport("gdi32.dll")] - private static extern int SetTextColor(IntPtr hdc, int color); - - [DllImport("gdi32.dll", EntryPoint = "GetTextExtentPoint32W")] - private static extern int GetTextExtentPoint32(IntPtr hdc, [MarshalAs(UnmanagedType.LPWStr)] string str, int len, ref Size size); - - [DllImport("gdi32.dll", EntryPoint = "GetTextExtentExPointW")] - private static extern bool GetTextExtentExPoint(IntPtr hDc, [MarshalAs(UnmanagedType.LPWStr)]string str, int nLength, int nMaxExtent, int[] lpnFit, int[] alpDx, ref Size size); - - [DllImport("gdi32.dll", EntryPoint = "TextOutW")] - private static extern bool TextOut(IntPtr hdc, int x, int y, [MarshalAs(UnmanagedType.LPWStr)] string str, int len); - - [DllImport("gdi32.dll")] - public static extern int SetTextAlign(IntPtr hdc, uint fMode); - - [DllImport("user32.dll", EntryPoint = "DrawTextW")] - private static extern int DrawText(IntPtr hdc, [MarshalAs(UnmanagedType.LPWStr)] string str, int len, ref Rect rect, uint uFormat); - - [DllImport("gdi32.dll")] - private static extern int SelectClipRgn(IntPtr hdc, IntPtr hrgn); - - [DllImport("gdi32.dll")] - public static extern bool DeleteObject(IntPtr hObject); - - [DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)] - public static extern bool DeleteDC(IntPtr hdc); - - [DllImport("gdi32.dll", CharSet = CharSet.Auto)] - public static extern IntPtr CreateFontIndirect([In, MarshalAs(UnmanagedType.LPStruct)]LogFont lplf); - - [DllImport("gdi32.dll", ExactSpelling = true)] - public static extern IntPtr AddFontMemResourceEx(byte[] pbFont, int cbFont, IntPtr pdv, out uint pcFonts); - - [DllImport("gdi32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop); - - [DllImport("gdi32.dll", EntryPoint = "GdiAlphaBlend")] - private static extern bool AlphaBlend(IntPtr hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, IntPtr hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, BlendFunction blendFunction); - - [DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)] - private static extern IntPtr CreateCompatibleDC(IntPtr hdc); - - [DllImport("gdi32.dll")] - private static extern IntPtr CreateDIBSection(IntPtr hdc, [In] ref BitMapInfo pbmi, uint iUsage, out IntPtr ppvBits, IntPtr hSection, uint dwOffset); - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] - public class LogFont - { - public int lfHeight = 0; - public int lfWidth = 0; - public int lfEscapement = 0; - public int lfOrientation = 0; - public int lfWeight = 0; - public byte lfItalic = 0; - public byte lfUnderline = 0; - public byte lfStrikeOut = 0; - public byte lfCharSet = 0; - public byte lfOutPrecision = 0; - public byte lfClipPrecision = 0; - public byte lfQuality = 0; - public byte lfPitchAndFamily = 0; - - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string lfFaceName = string.Empty; - } - - // ReSharper disable NotAccessedField.Local - // ReSharper disable MemberCanBePrivate.Local - // ReSharper disable FieldCanBeMadeReadOnly.Local - private struct Rect - { - private int _left; - private int _top; - private int _right; - private int _bottom; - - public Rect(Rectangle r) - { - _left = r.Left; - _top = r.Top; - _bottom = r.Bottom; - _right = r.Right; - } - - public int Height - { - get - { - return _bottom - _top; - } - } - } - - [StructLayout(LayoutKind.Sequential)] - private struct BlendFunction - { - public byte BlendOp; - public byte BlendFlags; - public byte SourceConstantAlpha; - public byte AlphaFormat; - - public BlendFunction(byte alpha) - { - BlendOp = 0; - BlendFlags = 0; - AlphaFormat = 0; - SourceConstantAlpha = alpha; - } - } - - [StructLayout(LayoutKind.Sequential)] - public struct BitMapInfo - { - public int biSize; - public int biWidth; - public int biHeight; - public short biPlanes; - public short biBitCount; - public int biCompression; - public int biSizeImage; - public int biXPelsPerMeter; - public int biYPelsPerMeter; - public int biClrUsed; - public int biClrImportant; - public byte bmiColors_rgbBlue; - public byte bmiColors_rgbGreen; - public byte bmiColors_rgbRed; - public byte bmiColors_rgbReserved; - } [Flags] public enum TextFormatFlags : uint diff --git a/MaterialSkin/NativeWin.cs b/MaterialSkin/NativeWin.cs new file mode 100644 index 00000000..2a586fa6 --- /dev/null +++ b/MaterialSkin/NativeWin.cs @@ -0,0 +1,417 @@ +using System; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace MaterialSkin +{ + internal static class NativeWin + { + + #region " CONSTS " + + // Padding + internal const int EM_SETRECT = 0xB3; + + // Cursor flickering fix + internal const int WM_SETCURSOR = 0x0020; + + internal const int WM_MOUSEWHEEL = 0x20A; + + internal const int IDC_HAND = 32649; + + #endregion + + + #region " ENUMS " + + /// + /// Window Messages + /// + /// + internal enum WM + { + /// + /// WM_NCCALCSIZE + /// + NonClientCalcSize = 0x0083, + /// + /// WM_NCACTIVATE + /// + NonClientActivate = 0x0086, + /// + /// WM_NCLBUTTONDOWN + /// + NonClientLeftButtonDown = 0x00A1, + /// + /// WM_SYSCOMMAND + /// + SystemCommand = 0x0112, + /// + /// WM_MOUSEMOVE + /// + MouseMove = 0x0200, + /// + /// WM_LBUTTONDOWN + /// + LeftButtonDown = 0x0201, + /// + /// WM_LBUTTONUP + /// + LeftButtonUp = 0x0202, + /// + /// WM_LBUTTONDBLCLK + /// + LeftButtonDoubleClick = 0x0203, + /// + /// WM_RBUTTONDOWN + /// + RightButtonDown = 0x0204, + } + + + /// + /// Hit Test Results + /// + /// + internal enum HT + { + /// + /// HTNOWHERE - Nothing under cursor + /// + None = 0, + /// + /// HTCAPTION - Titlebar + /// + Caption = 2, + /// + /// HTLEFT - Left border + /// + Left = 10, + /// + /// HTRIGHT - Right border + /// + Right = 11, + /// + /// HTTOP - Top border + /// + Top = 12, + /// + /// HTTOPLEFT - Top left corner + /// + TopLeft = 13, + /// + /// HTTOPRIGHT - Top right corner + /// + TopRight = 14, + /// + /// HTBOTTOM - Bottom border + /// + Bottom = 15, + /// + /// HTBOTTOMLEFT - Bottom left corner + /// + BottomLeft = 16, + /// + /// HTBOTTOMRIGHT - Bottom right corner + /// + BottomRight = 17, + } + + /// + /// Window Styles + /// + /// + internal enum WS + { + /// + /// WS_MINIMIZEBOX - Allow minimizing from taskbar + /// + MinimizeBox = 0x20000, + /// + /// WS_SIZEFRAME - Required for Aero Snapping + /// + SizeFrame = 0x40000, + /// + /// WS_SYSMENU - Trigger the creation of the system menu + /// + SysMenu = 0x80000, + } + + + + /// + /// Track Popup Menu Flags + /// + /// + internal enum TPM + { + /// + /// TPM_LEFTALIGN + /// + LeftAlign = 0x0000, + /// + /// TPM_RETURNCMD + /// + ReturnCommand = 0x0100, + } + + #endregion + + + #region " STRUCTS " + + [StructLayout(LayoutKind.Sequential)] + internal struct RECT + { + public readonly int Left; + public readonly int Top; + public readonly int Right; + public readonly int Bottom; + + private RECT(int left, int top, int right, int bottom) + { + Left = left; + Top = top; + Right = right; + Bottom = bottom; + } + + internal RECT(Rectangle r) : this(r.Left, r.Top, r.Right, r.Bottom) + { + } + + internal int Height + { + get + { + return Bottom - Top; + } + } + } + + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + internal class LogFont + { + public int lfHeight = 0; + public int lfWidth = 0; + public int lfEscapement = 0; + public int lfOrientation = 0; + public int lfWeight = 0; + public byte lfItalic = 0; + public byte lfUnderline = 0; + public byte lfStrikeOut = 0; + public byte lfCharSet = 0; + public byte lfOutPrecision = 0; + public byte lfClipPrecision = 0; + public byte lfQuality = 0; + public byte lfPitchAndFamily = 0; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string lfFaceName = string.Empty; + } + + + [StructLayout(LayoutKind.Sequential)] + internal struct BlendFunction + { + public byte BlendOp; + public byte BlendFlags; + public byte SourceConstantAlpha; + public byte AlphaFormat; + + internal BlendFunction(byte alpha) + { + BlendOp = 0; + BlendFlags = 0; + AlphaFormat = 0; + SourceConstantAlpha = alpha; + } + } + + + [StructLayout(LayoutKind.Sequential)] + internal struct BitMapInfo + { + public int biSize; + public int biWidth; + public int biHeight; + public short biPlanes; + public short biBitCount; + public int biCompression; + public int biSizeImage; + public int biXPelsPerMeter; + public int biYPelsPerMeter; + public int biClrUsed; + public int biClrImportant; + public byte bmiColors_rgbBlue; + public byte bmiColors_rgbGreen; + public byte bmiColors_rgbRed; + public byte bmiColors_rgbReserved; + } + + #endregion + + + #region Low Level Windows Methods + + #region " USER32.DLL " + + private const string USER32_DLL = "user32.dll"; + + /// + /// Provides a single method to call either the 32-bit or 64-bit method based on the size of an for getting the + /// Window Style flags.
+ /// GetWindowLongPtr + ///
+ internal static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex) + { + if (IntPtr.Size == 8) + return GetWindowLongPtr64(hWnd, nIndex); + else + return GetWindowLong(hWnd, nIndex); + } + + /// + /// Provides a single method to call either the 32-bit or 64-bit method based on the size of an for setting the + /// Window Style flags.
+ /// SetWindowLongPtr + ///
+ internal static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong) + { + if (IntPtr.Size == 8) + return SetWindowLongPtr64(hWnd, nIndex, dwNewLong); + else + return SetWindowLong(hWnd, nIndex, dwNewLong.ToInt32()); + } + + [DllImport(USER32_DLL, EntryPoint = "GetWindowLong")] + internal static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex); + + [DllImport(USER32_DLL, EntryPoint = "GetWindowLongPtr")] + internal static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, int nIndex); + + [DllImport(USER32_DLL, EntryPoint = "SetWindowLong")] + internal static extern IntPtr SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); + + [DllImport(USER32_DLL, EntryPoint = "SetWindowLongPtr")] + internal static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, int nIndex, IntPtr dwNewLong); + + + [DllImport(USER32_DLL, CharSet = CharSet.Auto, SetLastError = true)] + internal static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName); + + [DllImport(USER32_DLL, CharSet = CharSet.Auto)] + internal static extern IntPtr SetCursor(IntPtr hCursor); + + + #region " USER32.DLL - SendMessage overloads" + + [DllImport(USER32_DLL)] + internal static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); + + [DllImport(USER32_DLL, CharSet = CharSet.Auto)] + internal static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, string lParam); + + [DllImport(USER32_DLL)] + internal static extern IntPtr SendMessage(IntPtr hWnd, Int32 wMsg, Int32 wParam, ref Point lParam); + + [DllImport(USER32_DLL, EntryPoint = "SendMessage", CharSet = CharSet.Auto)] + internal static extern int SendMessageRefRect(IntPtr hWnd, uint msg, int wParam, ref RECT rect); + + [DllImport(USER32_DLL, SetLastError = false)] + internal static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); + + [DllImport(USER32_DLL, CharSet = CharSet.Auto)] + internal static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); + + #endregion " USER32.DLL - SendMessage overloads" + + + [DllImport(USER32_DLL)] + internal static extern bool ReleaseCapture(); + + [DllImport(USER32_DLL)] + internal static extern int TrackPopupMenuEx(IntPtr hmenu, uint fuFlags, int x, int y, IntPtr hwnd, IntPtr lptpm); + + [DllImport(USER32_DLL)] + internal static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); + + [DllImport(USER32_DLL, CharSet = CharSet.Auto)] + internal static extern int DrawText(IntPtr hdc, string lpchText, int cchText, ref RECT lprc, NativeTextRenderer.TextFormatFlags dwDTFormat); + + [DllImport(USER32_DLL, EntryPoint = "DrawTextW")] + internal static extern int DrawText(IntPtr hdc, [MarshalAs(UnmanagedType.LPWStr)] string str, int len, ref RECT rect, uint uFormat); + + #endregion " USER32.DLL " + + + #region " GDI32.DLL " + + private const string GDI32_DLL = "gdi32.dll"; + + [DllImport(GDI32_DLL, EntryPoint = "CreateRoundRectRgn")] + internal static extern IntPtr CreateRoundRectRgn( + int nLeftRect, // x-coordinate of upper-left corner + int nTopRect, // y-coordinate of upper-left corner + int nRightRect, // x-coordinate of lower-right corner + int nBottomRect, // y-coordinate of lower-right corner + int nWidthEllipse, // width of ellipse + int nHeightEllipse // height of ellipse + ); + + [DllImport(GDI32_DLL)] + internal static extern int SetBkMode(IntPtr hdc, int mode); + + [DllImport(GDI32_DLL)] + internal static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiObj); + + [DllImport(GDI32_DLL)] + internal static extern int SetTextColor(IntPtr hdc, int color); + + [DllImport(GDI32_DLL, EntryPoint = "GetTextExtentPoint32W")] + internal static extern int GetTextExtentPoint32(IntPtr hdc, [MarshalAs(UnmanagedType.LPWStr)] string str, int len, ref Size size); + + [DllImport(GDI32_DLL, EntryPoint = "GetTextExtentExPointW")] + internal static extern bool GetTextExtentExPoint(IntPtr hDc, [MarshalAs(UnmanagedType.LPWStr)] string str, int nLength, int nMaxExtent, int[] lpnFit, int[] alpDx, ref Size size); + + [DllImport(GDI32_DLL, EntryPoint = "TextOutW")] + internal static extern bool TextOut(IntPtr hdc, int x, int y, [MarshalAs(UnmanagedType.LPWStr)] string str, int len); + + [DllImport(GDI32_DLL)] + internal static extern int SetTextAlign(IntPtr hdc, uint fMode); + + [DllImport(GDI32_DLL)] + internal static extern int SelectClipRgn(IntPtr hdc, IntPtr hrgn); + + [DllImport(GDI32_DLL)] + internal static extern bool DeleteObject(IntPtr hObject); + + [DllImport(GDI32_DLL, ExactSpelling = true, SetLastError = true)] + internal static extern bool DeleteDC(IntPtr hdc); + + [DllImport(GDI32_DLL, CharSet = CharSet.Auto)] + internal static extern IntPtr CreateFontIndirect([In, MarshalAs(UnmanagedType.LPStruct)] LogFont lplf); + + [DllImport(GDI32_DLL, ExactSpelling = true)] + internal static extern IntPtr AddFontMemResourceEx(byte[] pbFont, int cbFont, IntPtr pdv, out uint pcFonts); + + [DllImport(GDI32_DLL)] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop); + + [DllImport(GDI32_DLL, EntryPoint = "GdiAlphaBlend")] + internal static extern bool AlphaBlend(IntPtr hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, IntPtr hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, BlendFunction blendFunction); + + [DllImport(GDI32_DLL, ExactSpelling = true, SetLastError = true)] + internal static extern IntPtr CreateCompatibleDC(IntPtr hdc); + + [DllImport(GDI32_DLL)] + internal static extern IntPtr CreateDIBSection(IntPtr hdc, [In] ref BitMapInfo pbmi, uint iUsage, out IntPtr ppvBits, IntPtr hSection, uint dwOffset); + + #endregion " GDI32.DLL " + + #endregion + } +} diff --git a/MaterialSkin/Properties/AssemblyInfo.cs b/MaterialSkin/Properties/AssemblyInfo.cs index f916d069..ffa5ec7b 100644 --- a/MaterialSkin/Properties/AssemblyInfo.cs +++ b/MaterialSkin/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MaterialSkin")] -[assembly: AssemblyCopyright("Copyright Leonardo C Bottaro © 2021")] +[assembly: AssemblyCopyright("Copyright Leonardo C Bottaro © 2022")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.1.0")] -[assembly: AssemblyFileVersion("2.3.1.0")] +[assembly: AssemblyVersion("2.3.1.3")] +[assembly: AssemblyFileVersion("2.3.1.3")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/MaterialSkinExample/MainForm.Designer.cs b/MaterialSkinExample/MainForm.Designer.cs index 7da9791c..8c81aa37 100644 --- a/MaterialSkinExample/MainForm.Designer.cs +++ b/MaterialSkinExample/MainForm.Designer.cs @@ -1183,7 +1183,7 @@ private void InitializeComponent() "hi"}); this.materialComboBox6.Location = new System.Drawing.Point(463, 407); this.materialComboBox6.MaxDropDownItems = 4; - this.materialComboBox6.MouseState = MaterialSkin.MouseState.OUT; + this.materialComboBox6.MouseState = MaterialSkin.MouseState.OUT_; this.materialComboBox6.Name = "materialComboBox6"; this.materialComboBox6.Size = new System.Drawing.Size(190, 49); this.materialComboBox6.StartIndex = 0; @@ -1209,7 +1209,7 @@ private void InitializeComponent() "Hello There, I hope you\'ll have a wonderfull day"}); this.materialComboBox2.Location = new System.Drawing.Point(463, 462); this.materialComboBox2.MaxDropDownItems = 4; - this.materialComboBox2.MouseState = MaterialSkin.MouseState.OUT; + this.materialComboBox2.MouseState = MaterialSkin.MouseState.OUT_; this.materialComboBox2.Name = "materialComboBox2"; this.materialComboBox2.Size = new System.Drawing.Size(435, 49); this.materialComboBox2.StartIndex = 0; @@ -1303,7 +1303,7 @@ private void InitializeComponent() "down!"}); this.materialComboBox5.Location = new System.Drawing.Point(463, 352); this.materialComboBox5.MaxDropDownItems = 4; - this.materialComboBox5.MouseState = MaterialSkin.MouseState.OUT; + this.materialComboBox5.MouseState = MaterialSkin.MouseState.OUT_; this.materialComboBox5.Name = "materialComboBox5"; this.materialComboBox5.Size = new System.Drawing.Size(190, 49); this.materialComboBox5.StartIndex = 0; @@ -1398,7 +1398,7 @@ private void InitializeComponent() "down!"}); this.materialComboBox4.Location = new System.Drawing.Point(258, 407); this.materialComboBox4.MaxDropDownItems = 4; - this.materialComboBox4.MouseState = MaterialSkin.MouseState.OUT; + this.materialComboBox4.MouseState = MaterialSkin.MouseState.OUT_; this.materialComboBox4.Name = "materialComboBox4"; this.materialComboBox4.Size = new System.Drawing.Size(190, 49); this.materialComboBox4.StartIndex = 0; @@ -1490,7 +1490,7 @@ private void InitializeComponent() "Long item that won\'t fit here"}); this.materialComboBox1.Location = new System.Drawing.Point(258, 352); this.materialComboBox1.MaxDropDownItems = 4; - this.materialComboBox1.MouseState = MaterialSkin.MouseState.OUT; + this.materialComboBox1.MouseState = MaterialSkin.MouseState.OUT_; this.materialComboBox1.Name = "materialComboBox1"; this.materialComboBox1.Size = new System.Drawing.Size(190, 49); this.materialComboBox1.StartIndex = 0; @@ -1796,7 +1796,7 @@ private void InitializeComponent() this.materialMaskedTextBox1.Location = new System.Drawing.Point(528, 437); this.materialMaskedTextBox1.Mask = "+00-0-00-00-00-00"; this.materialMaskedTextBox1.MaxLength = 32767; - this.materialMaskedTextBox1.MouseState = MaterialSkin.MouseState.OUT; + this.materialMaskedTextBox1.MouseState = MaterialSkin.MouseState.OUT_; this.materialMaskedTextBox1.Name = "materialMaskedTextBox1"; this.materialMaskedTextBox1.PasswordChar = '\0'; this.materialMaskedTextBox1.PrefixSuffixText = null; @@ -1908,7 +1908,7 @@ private void InitializeComponent() "Suffix"}); this.materialComboBox7.Location = new System.Drawing.Point(729, 182); this.materialComboBox7.MaxDropDownItems = 4; - this.materialComboBox7.MouseState = MaterialSkin.MouseState.OUT; + this.materialComboBox7.MouseState = MaterialSkin.MouseState.OUT_; this.materialComboBox7.Name = "materialComboBox7"; this.materialComboBox7.Size = new System.Drawing.Size(183, 49); this.materialComboBox7.StartIndex = 0; @@ -1980,7 +1980,7 @@ private void InitializeComponent() this.materialTextBox21.LeadingIcon = null; this.materialTextBox21.Location = new System.Drawing.Point(528, 114); this.materialTextBox21.MaxLength = 32767; - this.materialTextBox21.MouseState = MaterialSkin.MouseState.OUT; + this.materialTextBox21.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox21.Name = "materialTextBox21"; this.materialTextBox21.PasswordChar = '\0'; this.materialTextBox21.PrefixSuffixText = "$"; @@ -2012,7 +2012,7 @@ private void InitializeComponent() this.materialMultiLineTextBox21.Hint = "MaterialMultiLineTextBox2"; this.materialMultiLineTextBox21.Location = new System.Drawing.Point(25, 385); this.materialMultiLineTextBox21.MaxLength = 2147483647; - this.materialMultiLineTextBox21.MouseState = MaterialSkin.MouseState.OUT; + this.materialMultiLineTextBox21.MouseState = MaterialSkin.MouseState.OUT_; this.materialMultiLineTextBox21.Name = "materialMultiLineTextBox21"; this.materialMultiLineTextBox21.PasswordChar = '\0'; this.materialMultiLineTextBox21.ReadOnly = false; @@ -2039,7 +2039,7 @@ private void InitializeComponent() this.materialTextBox5.LeadingIcon = null; this.materialTextBox5.Location = new System.Drawing.Point(222, 170); this.materialTextBox5.MaxLength = 50; - this.materialTextBox5.MouseState = MaterialSkin.MouseState.OUT; + this.materialTextBox5.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox5.Name = "materialTextBox5"; this.materialTextBox5.Size = new System.Drawing.Size(209, 50); this.materialTextBox5.TabIndex = 69; @@ -2058,7 +2058,7 @@ private void InitializeComponent() this.materialTextBox4.LeadingIcon = null; this.materialTextBox4.Location = new System.Drawing.Point(25, 170); this.materialTextBox4.MaxLength = 50; - this.materialTextBox4.MouseState = MaterialSkin.MouseState.OUT; + this.materialTextBox4.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox4.Name = "materialTextBox4"; this.materialTextBox4.Size = new System.Drawing.Size(191, 50); this.materialTextBox4.TabIndex = 68; @@ -2076,7 +2076,7 @@ private void InitializeComponent() this.materialTextBox3.LeadingIcon = null; this.materialTextBox3.Location = new System.Drawing.Point(25, 338); this.materialTextBox3.MaxLength = 50; - this.materialTextBox3.MouseState = MaterialSkin.MouseState.OUT; + this.materialTextBox3.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox3.Name = "materialTextBox3"; this.materialTextBox3.Size = new System.Drawing.Size(406, 36); this.materialTextBox3.TabIndex = 67; @@ -2134,7 +2134,7 @@ private void InitializeComponent() this.materialTextBox2.LeadingIcon = global::MaterialSkinExample.Properties.Resources.baseline_fingerprint_black_24dp; this.materialTextBox2.Location = new System.Drawing.Point(25, 282); this.materialTextBox2.MaxLength = 50; - this.materialTextBox2.MouseState = MaterialSkin.MouseState.OUT; + this.materialTextBox2.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox2.Name = "materialTextBox2"; this.materialTextBox2.UseSystemPasswordChar = true; this.materialTextBox2.Size = new System.Drawing.Size(406, 50); @@ -2153,7 +2153,7 @@ private void InitializeComponent() this.materialTextBox1.LeadingIcon = null; this.materialTextBox1.Location = new System.Drawing.Point(25, 114); this.materialTextBox1.MaxLength = 50; - this.materialTextBox1.MouseState = MaterialSkin.MouseState.OUT; + this.materialTextBox1.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox1.Name = "materialTextBox1"; this.materialTextBox1.Size = new System.Drawing.Size(406, 50); this.materialTextBox1.TabIndex = 1; @@ -2171,7 +2171,7 @@ private void InitializeComponent() this.materialSingleLineTextField2.LeadingIcon = null; this.materialSingleLineTextField2.Location = new System.Drawing.Point(25, 226); this.materialSingleLineTextField2.MaxLength = 50; - this.materialSingleLineTextField2.MouseState = MaterialSkin.MouseState.OUT; + this.materialSingleLineTextField2.MouseState = MaterialSkin.MouseState.OUT_; this.materialSingleLineTextField2.Name = "materialSingleLineTextField2"; this.materialSingleLineTextField2.Size = new System.Drawing.Size(406, 50); this.materialSingleLineTextField2.TabIndex = 2; @@ -2236,7 +2236,7 @@ private void InitializeComponent() this.materialListView1.Location = new System.Drawing.Point(25, 149); this.materialListView1.MinimumSize = new System.Drawing.Size(200, 100); this.materialListView1.MouseLocation = new System.Drawing.Point(-1, -1); - this.materialListView1.MouseState = MaterialSkin.MouseState.OUT; + this.materialListView1.MouseState = MaterialSkin.MouseState.OUT_; this.materialListView1.Name = "materialListView1"; this.materialListView1.OwnerDraw = true; this.materialListView1.Scrollable = false; diff --git a/MaterialSkinExample/Properties/AssemblyInfo.cs b/MaterialSkinExample/Properties/AssemblyInfo.cs index 798dfc80..ad78a5a6 100644 --- a/MaterialSkinExample/Properties/AssemblyInfo.cs +++ b/MaterialSkinExample/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MaterialSkinExample")] -[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.1.3")] +[assembly: AssemblyFileVersion("2.3.1.3")] \ No newline at end of file From eb927b662defe016a3fb39a53a75c08b4e23cd48 Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Sun, 20 Feb 2022 13:18:52 +0000 Subject: [PATCH 2/3] 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. --- CHANGELOG.md | 20 ++ MaterialSkin/Controls/MaterialDialog.cs | 25 +-- MaterialSkin/Controls/MaterialDrawer.cs | 37 ++++ MaterialSkin/Controls/MaterialForm.cs | 5 +- MaterialSkin/MaterialSkinManager.cs | 53 +++++- MaterialSkin/Properties/AssemblyInfo.cs | 4 +- MaterialSkinExample/MainForm.Designer.cs | 178 +++++++++++++----- MaterialSkinExample/MainForm.resx | 80 ++++---- .../Properties/AssemblyInfo.cs | 4 +- 9 files changed, 302 insertions(+), 104 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87a3415f..6049a25d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,26 @@ This repo is a fork obtained from https://github.com/leocb/MaterialSkin.git +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: diff --git a/MaterialSkin/Controls/MaterialDialog.cs b/MaterialSkin/Controls/MaterialDialog.cs index fbf22af1..0687b76a 100644 --- a/MaterialSkin/Controls/MaterialDialog.cs +++ b/MaterialSkin/Controls/MaterialDialog.cs @@ -35,8 +35,10 @@ public class MaterialDialog : MaterialForm /// /// Constructer Setting up the Layout /// - public MaterialDialog(Form ParentForm, string Title, string Text, string ValidationButtonText, bool ShowCancelButton, string CancelButtonText, bool UseAccentColor) + public MaterialDialog(ContainerControl ParentForm, string Title, string Text, string ValidationButtonText, bool ShowCancelButton, string CancelButtonText, bool UseAccentColor) { + Point locationFromScreen = ParentForm.PointToScreen(Point.Empty); + _formOverlay = new Form { BackColor = Color.Black, @@ -49,9 +51,10 @@ public MaterialDialog(Form ParentForm, string Title, string Text, string Validat FormBorderStyle = FormBorderStyle.None, Size = new Size(ParentForm.Width, ParentForm.Height), ShowInTaskbar = false, - Owner = ParentForm, + Owner = null, + Tag = ParentForm, Visible = true, - Location = new Point(ParentForm.Location.X, ParentForm.Location.Y), + Location = locationFromScreen, Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom, }; @@ -135,31 +138,31 @@ public MaterialDialog(Form ParentForm, string Title, string Text, string Validat //return materialDialogResult; } - public MaterialDialog(Form ParentForm) : this(ParentForm, "Title", "Dialog box", "OK", false, "Cancel", false) + public MaterialDialog(ContainerControl ParentForm) : this(ParentForm, "Title", "Dialog box", "OK", false, "Cancel", false) { } - public MaterialDialog(Form ParentForm, string Text) : this(ParentForm, "Title", Text, "OK", false, "Cancel", false) + public MaterialDialog(ContainerControl ParentForm, string Text) : this(ParentForm, "Title", Text, "OK", false, "Cancel", false) { } - public MaterialDialog(Form ParentForm, string Title, string Text) : this(ParentForm, Title, Text, "OK", false, "Cancel", false) + public MaterialDialog(ContainerControl ParentForm, string Title, string Text) : this(ParentForm, Title, Text, "OK", false, "Cancel", false) { } - public MaterialDialog(Form ParentForm, string Title, string Text, string ValidationButtonText) : this(ParentForm, Title, Text, ValidationButtonText, false, "Cancel", false) + public MaterialDialog(ContainerControl ParentForm, string Title, string Text, string ValidationButtonText) : this(ParentForm, Title, Text, ValidationButtonText, false, "Cancel", false) { } - public MaterialDialog(Form ParentForm, string Title, string Text, bool ShowCancelButton) : this(ParentForm, Title, Text, "OK", ShowCancelButton, "Cancel", false) + public MaterialDialog(ContainerControl ParentForm, string Title, string Text, bool ShowCancelButton) : this(ParentForm, Title, Text, "OK", ShowCancelButton, "Cancel", false) { } - public MaterialDialog(Form ParentForm, string Title, string Text, bool ShowCancelButton, string CancelButtonText) : this(ParentForm, Title, Text, "OK", ShowCancelButton, CancelButtonText, false) + public MaterialDialog(ContainerControl ParentForm, string Title, string Text, bool ShowCancelButton, string CancelButtonText) : this(ParentForm, Title, Text, "OK", ShowCancelButton, CancelButtonText, false) { } - public MaterialDialog(Form ParentForm, string Title, string Text, string ValidationButtonText, bool ShowCancelButton, string CancelButtonText) : this(ParentForm, Title, Text, ValidationButtonText, ShowCancelButton, CancelButtonText, false) + public MaterialDialog(ContainerControl ParentForm, string Title, string Text, string ValidationButtonText, bool ShowCancelButton, string CancelButtonText) : this(ParentForm, Title, Text, ValidationButtonText, ShowCancelButton, CancelButtonText, false) { } @@ -171,7 +174,7 @@ protected override void OnLoad(EventArgs e) { base.OnLoad(e); - Location = new Point(Convert.ToInt32(Owner.Location.X + (Owner.Width / 2) - (Width / 2)), Convert.ToInt32(Owner.Location.Y + (Owner.Height / 2) - (Height / 2))); + Location = new Point(Convert.ToInt32(_formOverlay.Location.X + (_formOverlay.Width / 2) - (Width / 2)), Convert.ToInt32(_formOverlay.Location.Y + (_formOverlay.Height / 2) - (Height / 2))); _AnimationManager.StartNewAnimation(AnimationDirection.In); } diff --git a/MaterialSkin/Controls/MaterialDrawer.cs b/MaterialSkin/Controls/MaterialDrawer.cs index 9c9bfed1..c37b1e8d 100644 --- a/MaterialSkin/Controls/MaterialDrawer.cs +++ b/MaterialSkin/Controls/MaterialDrawer.cs @@ -28,6 +28,10 @@ public bool ShowIconsWhenHidden if (_showIconsWhenHidden != value) { _showIconsWhenHidden = value; + + // control is still under initialization, ignore redraw + if (!_controlAddedToContainer) return; + UpdateTabRects(); preProcessIcons(); showHideAnimation(); @@ -49,6 +53,10 @@ public bool IsOpen set { _isOpen = value; + + // control is still under initialization, ignore UI change + if (!_controlAddedToContainer) return; + if (value) Show(); else @@ -74,6 +82,10 @@ public bool UseColors set { _useColors = value; + + // control is still under initialization, ignore redraw + if (!_controlAddedToContainer) return; + preProcessIcons(); Invalidate(); } @@ -91,6 +103,10 @@ public bool HighlightWithAccent set { _highlightWithAccent = value; + + // control is still under initialization, ignore redraw + if (!_controlAddedToContainer) return; + preProcessIcons(); Invalidate(); } @@ -108,6 +124,10 @@ public bool BackgroundWithAccent set { _backgroundWithAccent = value; + + // control is still under initialization, ignore redraw + if (!_controlAddedToContainer) return; + Invalidate(); } } @@ -184,6 +204,10 @@ public MaterialTabControl BaseTabControl { Invalidate(); }; + + // control is still under initialization, ignore redraw + if (!_controlAddedToContainer) return; + Invalidate(); } } @@ -311,6 +335,13 @@ private void preProcessIcons() private int _lastMouseY; private int _lastLocationY; + /// + /// defines if the MaterialDrawer has been added to container's collection of controls + /// Used to decide when changes on MaterialDrawer's properties should trigger a Paint event. + /// The goal is to reduce the number of "Redraws" (Paint event) while the control is being initialized by its container. + /// + private bool _controlAddedToContainer = false; + public MaterialDrawer() { SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); @@ -389,9 +420,15 @@ private void MaterialDrawer_MouseWheel(object sender, MouseEventArgs e) } } + /// + /// This method gets called when container adds this object to its collections of controls, ie, ContainerObject.Add({TLMaterialDrawer object}) + /// [EditorBrowsable(EditorBrowsableState.Advanced)] protected override void InitLayout() { + // MaterialDrawer has been added to its Container. From now on trigger "Paint" event if properties are changed + _controlAddedToContainer = true; + drawerItemHeight = Globals.TAB_HEADER_PADDING * 2 - SkinManager.FORM_PADDING / 2; MinWidth = (int)(SkinManager.FORM_PADDING * 1.5 + drawerItemHeight); _showHideAnimManager.SetProgress(_isOpen ? 0 : 1); diff --git a/MaterialSkin/Controls/MaterialForm.cs b/MaterialSkin/Controls/MaterialForm.cs index 9b281ad5..05eabb42 100644 --- a/MaterialSkin/Controls/MaterialForm.cs +++ b/MaterialSkin/Controls/MaterialForm.cs @@ -315,8 +315,9 @@ public MaterialForm() // Drawer Shown += (sender, e) => { - if (DesignMode || IsDisposed) - return; + //Disabled to improve design mode experience + //if (DesignMode || IsDisposed) + // return; AddDrawerOverlayForm(); }; } diff --git a/MaterialSkin/MaterialSkinManager.cs b/MaterialSkin/MaterialSkinManager.cs index e8ee507c..3192a43f 100644 --- a/MaterialSkin/MaterialSkinManager.cs +++ b/MaterialSkin/MaterialSkinManager.cs @@ -14,7 +14,11 @@ public class MaterialSkinManager { private static MaterialSkinManager _instance; - private readonly List _formsToManage = new List(); + + /// + /// List of Native-Forms, Material-Forms, Native-UserControls + /// + private readonly List _formsToManage = new List(); public delegate void SkinManagerEventHandler(object sender); @@ -29,7 +33,7 @@ public class MaterialSkinManager public static MaterialSkinManager Instance => _instance ?? (_instance = new MaterialSkinManager()); - public int FORM_PADDING = 14; + public int FORM_PADDING = 12; // Constructor private MaterialSkinManager() @@ -395,6 +399,51 @@ private IntPtr createLogicalFont(string fontName, int size, NativeTextRenderer.l return NativeWin.CreateFontIndirect(lfont); } + + + /// + /// Method added to suport "native" User Controls that contain MaterialSkin controls. Native User Controls must have "BackColor" property + /// + /// + public void AddFormToManage(UserControl nativeUserControl) + { + if (false == nativeUserControl.HasProperty("BackColor")) + { + return; + } + + _formsToManage.Add(nativeUserControl); + UpdateBackgrounds(); + + // Set background on newly added controls + nativeUserControl.ControlAdded += (sender, e) => + { + UpdateControlBackColor(e.Control, BackdropColor); + }; + } + + /// + /// Method added to suport "native" Forms that contain MaterialSkin controls. NativeForm must have "BackColor" property + /// + /// + public void AddFormToManage(Form nativeForm) + { + if (false == nativeForm.HasProperty("BackColor")) + { + return; + } + + _formsToManage.Add(nativeForm); + UpdateBackgrounds(); + + // Set background on newly added controls + nativeForm.ControlAdded += (sender, e) => + { + UpdateControlBackColor(e.Control, BackdropColor); + }; + } + + // Dyanmic Themes public void AddFormToManage(MaterialForm materialForm) { diff --git a/MaterialSkin/Properties/AssemblyInfo.cs b/MaterialSkin/Properties/AssemblyInfo.cs index ffa5ec7b..ad2ebe6e 100644 --- a/MaterialSkin/Properties/AssemblyInfo.cs +++ b/MaterialSkin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.1.3")] -[assembly: AssemblyFileVersion("2.3.1.3")] +[assembly: AssemblyVersion("2.3.1.4")] +[assembly: AssemblyFileVersion("2.3.1.4")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/MaterialSkinExample/MainForm.Designer.cs b/MaterialSkinExample/MainForm.Designer.cs index 8c81aa37..458e6865 100644 --- a/MaterialSkinExample/MainForm.Designer.cs +++ b/MaterialSkinExample/MainForm.Designer.cs @@ -1,4 +1,4 @@ -using System.Drawing; +using System.Drawing; using System.Windows.Forms; using MaterialSkin; using MaterialSkin.Controls; @@ -295,12 +295,12 @@ private void InitializeComponent() this.materialTabControl1.Depth = 0; this.materialTabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.materialTabControl1.ImageList = this.menuIconList; - this.materialTabControl1.Location = new System.Drawing.Point(3, 64); + this.materialTabControl1.Location = new System.Drawing.Point(52, 64); this.materialTabControl1.MouseState = MaterialSkin.MouseState.HOVER; this.materialTabControl1.Multiline = true; this.materialTabControl1.Name = "materialTabControl1"; this.materialTabControl1.SelectedIndex = 0; - this.materialTabControl1.Size = new System.Drawing.Size(1023, 555); + this.materialTabControl1.Size = new System.Drawing.Size(974, 555); this.materialTabControl1.TabIndex = 18; // // tabPage1 @@ -326,7 +326,7 @@ private void InitializeComponent() this.tabPage1.ImageKey = "round_assessment_white_24dp.png"; this.tabPage1.Location = new System.Drawing.Point(4, 31); this.tabPage1.Name = "tabPage1"; - this.tabPage1.Size = new System.Drawing.Size(1015, 520); + this.tabPage1.Size = new System.Drawing.Size(966, 520); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Home"; // @@ -342,7 +342,7 @@ private void InitializeComponent() this.materialButton25.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton25.Name = "materialButton25"; this.materialButton25.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton25.Size = new System.Drawing.Size(118, 36); + this.materialButton25.Size = new System.Drawing.Size(119, 36); this.materialButton25.TabIndex = 41; this.materialButton25.Text = "Show Dialog"; this.materialButton25.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -362,7 +362,7 @@ private void InitializeComponent() this.materialButton6.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton6.Name = "materialButton6"; this.materialButton6.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton6.Size = new System.Drawing.Size(142, 36); + this.materialButton6.Size = new System.Drawing.Size(144, 36); this.materialButton6.TabIndex = 41; this.materialButton6.Text = "Show SnackBar"; this.materialButton6.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -437,7 +437,7 @@ private void InitializeComponent() this.MaterialButton3.MouseState = MaterialSkin.MouseState.HOVER; this.MaterialButton3.Name = "MaterialButton3"; this.MaterialButton3.NoAccentTextColor = System.Drawing.Color.Empty; - this.MaterialButton3.Size = new System.Drawing.Size(160, 36); + this.MaterialButton3.Size = new System.Drawing.Size(163, 36); this.MaterialButton3.TabIndex = 36; this.MaterialButton3.Text = "Open Message box"; this.MaterialButton3.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -552,7 +552,7 @@ private void InitializeComponent() this.materialButton7.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton7.Name = "materialButton7"; this.materialButton7.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton7.Size = new System.Drawing.Size(132, 36); + this.materialButton7.Size = new System.Drawing.Size(133, 36); this.materialButton7.TabIndex = 0; this.materialButton7.Text = "Change Theme"; this.materialButton7.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Outlined; @@ -606,7 +606,7 @@ private void InitializeComponent() this.MaterialButton4.MouseState = MaterialSkin.MouseState.HOVER; this.MaterialButton4.Name = "MaterialButton4"; this.MaterialButton4.NoAccentTextColor = System.Drawing.Color.Empty; - this.MaterialButton4.Size = new System.Drawing.Size(138, 36); + this.MaterialButton4.Size = new System.Drawing.Size(140, 36); this.MaterialButton4.TabIndex = 22; this.MaterialButton4.Text = "Change Colors"; this.MaterialButton4.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -646,7 +646,7 @@ private void InitializeComponent() this.tabPage7.Location = new System.Drawing.Point(4, 31); this.tabPage7.Name = "tabPage7"; this.tabPage7.Padding = new System.Windows.Forms.Padding(3); - this.tabPage7.Size = new System.Drawing.Size(1015, 520); + this.tabPage7.Size = new System.Drawing.Size(966, 520); this.tabPage7.TabIndex = 6; this.tabPage7.Text = "Buttons Galore"; // @@ -1141,7 +1141,7 @@ private void InitializeComponent() this.tabPage2.Location = new System.Drawing.Point(4, 31); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(1015, 520); + this.tabPage2.Size = new System.Drawing.Size(966, 520); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Selection Controls"; // @@ -1774,7 +1774,7 @@ private void InitializeComponent() this.tabPage3.Location = new System.Drawing.Point(4, 31); this.tabPage3.Name = "tabPage3"; this.tabPage3.Padding = new System.Windows.Forms.Padding(3); - this.tabPage3.Size = new System.Drawing.Size(1015, 520); + this.tabPage3.Size = new System.Drawing.Size(966, 520); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "Textbox"; // @@ -1970,6 +1970,8 @@ private void InitializeComponent() // materialTextBox21 // this.materialTextBox21.AnimateReadOnly = false; + this.materialTextBox21.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.None; + this.materialTextBox21.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.None; this.materialTextBox21.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.materialTextBox21.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal; this.materialTextBox21.Depth = 0; @@ -2030,58 +2032,101 @@ private void InitializeComponent() // materialTextBox5 // this.materialTextBox5.AnimateReadOnly = false; + this.materialTextBox5.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.None; + this.materialTextBox5.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.None; + this.materialTextBox5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.materialTextBox5.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal; this.materialTextBox5.Cursor = System.Windows.Forms.Cursors.IBeam; this.materialTextBox5.Depth = 0; this.materialTextBox5.Enabled = false; this.materialTextBox5.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); - this.materialTextBox5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialTextBox5.HideSelection = true; this.materialTextBox5.Hint = "This is Disabled"; this.materialTextBox5.LeadingIcon = null; this.materialTextBox5.Location = new System.Drawing.Point(222, 170); this.materialTextBox5.MaxLength = 50; this.materialTextBox5.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox5.Name = "materialTextBox5"; - this.materialTextBox5.Size = new System.Drawing.Size(209, 50); + this.materialTextBox5.PasswordChar = '\0'; + this.materialTextBox5.PrefixSuffixText = null; + this.materialTextBox5.ReadOnly = false; + this.materialTextBox5.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.materialTextBox5.SelectedText = ""; + this.materialTextBox5.SelectionLength = 0; + this.materialTextBox5.SelectionStart = 0; + this.materialTextBox5.ShortcutsEnabled = true; + this.materialTextBox5.Size = new System.Drawing.Size(209, 48); this.materialTextBox5.TabIndex = 69; + this.materialTextBox5.TabStop = false; this.materialTextBox5.Text = "But with value"; + this.materialTextBox5.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; this.materialTextBox5.TrailingIcon = null; + this.materialTextBox5.UseSystemPasswordChar = false; // // materialTextBox4 // this.materialTextBox4.AnimateReadOnly = false; + this.materialTextBox4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.None; + this.materialTextBox4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.None; + this.materialTextBox4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.materialTextBox4.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal; this.materialTextBox4.Cursor = System.Windows.Forms.Cursors.IBeam; this.materialTextBox4.Depth = 0; this.materialTextBox4.Enabled = false; - this.materialTextBox4.Font = new System.Drawing.Font("Roboto", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.materialTextBox4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialTextBox4.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.materialTextBox4.HideSelection = true; this.materialTextBox4.Hint = "This is Disabled"; this.materialTextBox4.LeadingIcon = null; this.materialTextBox4.Location = new System.Drawing.Point(25, 170); this.materialTextBox4.MaxLength = 50; this.materialTextBox4.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox4.Name = "materialTextBox4"; - this.materialTextBox4.Size = new System.Drawing.Size(191, 50); + this.materialTextBox4.PasswordChar = '\0'; + this.materialTextBox4.PrefixSuffixText = null; + this.materialTextBox4.ReadOnly = false; + this.materialTextBox4.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.materialTextBox4.SelectedText = ""; + this.materialTextBox4.SelectionLength = 0; + this.materialTextBox4.SelectionStart = 0; + this.materialTextBox4.ShortcutsEnabled = true; + this.materialTextBox4.Size = new System.Drawing.Size(191, 48); this.materialTextBox4.TabIndex = 68; - this.materialTextBox4.Text = ""; + this.materialTextBox4.TabStop = false; + this.materialTextBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; this.materialTextBox4.TrailingIcon = null; + this.materialTextBox4.UseSystemPasswordChar = false; // // materialTextBox3 // this.materialTextBox3.AnimateReadOnly = false; + this.materialTextBox3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.None; + this.materialTextBox3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.None; + this.materialTextBox3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.materialTextBox3.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal; this.materialTextBox3.Cursor = System.Windows.Forms.Cursors.IBeam; this.materialTextBox3.Depth = 0; - this.materialTextBox3.Font = new System.Drawing.Font("Roboto", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.materialTextBox3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialTextBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.materialTextBox3.HideSelection = true; this.materialTextBox3.Hint = "This field has UseTallSize = false"; this.materialTextBox3.LeadingIcon = null; this.materialTextBox3.Location = new System.Drawing.Point(25, 338); this.materialTextBox3.MaxLength = 50; this.materialTextBox3.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox3.Name = "materialTextBox3"; + this.materialTextBox3.PasswordChar = '\0'; + this.materialTextBox3.PrefixSuffixText = null; + this.materialTextBox3.ReadOnly = false; + this.materialTextBox3.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.materialTextBox3.SelectedText = ""; + this.materialTextBox3.SelectionLength = 0; + this.materialTextBox3.SelectionStart = 0; + this.materialTextBox3.ShortcutsEnabled = true; this.materialTextBox3.Size = new System.Drawing.Size(406, 36); this.materialTextBox3.TabIndex = 67; - this.materialTextBox3.Text = ""; + this.materialTextBox3.TabStop = false; + this.materialTextBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; this.materialTextBox3.TrailingIcon = null; + this.materialTextBox3.UseSystemPasswordChar = false; this.materialTextBox3.UseTallSize = false; // // materialLabel27 @@ -2126,57 +2171,98 @@ private void InitializeComponent() // materialTextBox2 // this.materialTextBox2.AnimateReadOnly = false; + this.materialTextBox2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.None; + this.materialTextBox2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.None; + this.materialTextBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.materialTextBox2.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal; this.materialTextBox2.Cursor = System.Windows.Forms.Cursors.IBeam; this.materialTextBox2.Depth = 0; - this.materialTextBox2.Font = new System.Drawing.Font("Roboto", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.materialTextBox2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialTextBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.materialTextBox2.HideSelection = true; this.materialTextBox2.Hint = "Password"; this.materialTextBox2.LeadingIcon = global::MaterialSkinExample.Properties.Resources.baseline_fingerprint_black_24dp; this.materialTextBox2.Location = new System.Drawing.Point(25, 282); this.materialTextBox2.MaxLength = 50; this.materialTextBox2.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox2.Name = "materialTextBox2"; - this.materialTextBox2.UseSystemPasswordChar = true; - this.materialTextBox2.Size = new System.Drawing.Size(406, 50); + this.materialTextBox2.PasswordChar = '●'; + this.materialTextBox2.PrefixSuffixText = null; + this.materialTextBox2.ReadOnly = false; + this.materialTextBox2.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.materialTextBox2.SelectedText = ""; + this.materialTextBox2.SelectionLength = 0; + this.materialTextBox2.SelectionStart = 0; + this.materialTextBox2.ShortcutsEnabled = true; + this.materialTextBox2.Size = new System.Drawing.Size(406, 48); this.materialTextBox2.TabIndex = 3; - this.materialTextBox2.Text = ""; + this.materialTextBox2.TabStop = false; + this.materialTextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; this.materialTextBox2.TrailingIcon = null; + this.materialTextBox2.UseSystemPasswordChar = true; this.materialTextBox2.LeadingIconClick += new System.EventHandler(this.materialTextBox2_LeadingIconClick); // // materialTextBox1 // this.materialTextBox1.AnimateReadOnly = false; + this.materialTextBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.None; + this.materialTextBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.None; + this.materialTextBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.materialTextBox1.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal; this.materialTextBox1.Cursor = System.Windows.Forms.Cursors.IBeam; this.materialTextBox1.Depth = 0; - this.materialTextBox1.Font = new System.Drawing.Font("Roboto", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.materialTextBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialTextBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.materialTextBox1.HideSelection = true; this.materialTextBox1.LeadingIcon = null; this.materialTextBox1.Location = new System.Drawing.Point(25, 114); this.materialTextBox1.MaxLength = 50; this.materialTextBox1.MouseState = MaterialSkin.MouseState.OUT_; this.materialTextBox1.Name = "materialTextBox1"; - this.materialTextBox1.Size = new System.Drawing.Size(406, 50); + this.materialTextBox1.PasswordChar = '\0'; + this.materialTextBox1.PrefixSuffixText = null; + this.materialTextBox1.ReadOnly = false; + this.materialTextBox1.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.materialTextBox1.SelectedText = ""; + this.materialTextBox1.SelectionLength = 0; + this.materialTextBox1.SelectionStart = 0; + this.materialTextBox1.ShortcutsEnabled = true; + this.materialTextBox1.Size = new System.Drawing.Size(406, 48); this.materialTextBox1.TabIndex = 1; - this.materialTextBox1.Text = ""; + this.materialTextBox1.TabStop = false; + this.materialTextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; this.materialTextBox1.TrailingIcon = global::MaterialSkinExample.Properties.Resources.baseline_favorite_border_black_24dp; + this.materialTextBox1.UseSystemPasswordChar = false; // // materialSingleLineTextField2 // this.materialSingleLineTextField2.AnimateReadOnly = false; + this.materialSingleLineTextField2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.None; + this.materialSingleLineTextField2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.None; + this.materialSingleLineTextField2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.materialSingleLineTextField2.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal; this.materialSingleLineTextField2.Cursor = System.Windows.Forms.Cursors.IBeam; this.materialSingleLineTextField2.Depth = 0; - this.materialSingleLineTextField2.Font = new System.Drawing.Font("Roboto", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - this.materialSingleLineTextField2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.materialSingleLineTextField2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.materialSingleLineTextField2.HideSelection = true; this.materialSingleLineTextField2.Hint = "Type here"; this.materialSingleLineTextField2.LeadingIcon = null; this.materialSingleLineTextField2.Location = new System.Drawing.Point(25, 226); this.materialSingleLineTextField2.MaxLength = 50; this.materialSingleLineTextField2.MouseState = MaterialSkin.MouseState.OUT_; this.materialSingleLineTextField2.Name = "materialSingleLineTextField2"; - this.materialSingleLineTextField2.Size = new System.Drawing.Size(406, 50); + this.materialSingleLineTextField2.PasswordChar = '\0'; + this.materialSingleLineTextField2.PrefixSuffixText = null; + this.materialSingleLineTextField2.ReadOnly = false; + this.materialSingleLineTextField2.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.materialSingleLineTextField2.SelectedText = ""; + this.materialSingleLineTextField2.SelectionLength = 0; + this.materialSingleLineTextField2.SelectionStart = 0; + this.materialSingleLineTextField2.ShortcutsEnabled = true; + this.materialSingleLineTextField2.Size = new System.Drawing.Size(406, 48); this.materialSingleLineTextField2.TabIndex = 2; - this.materialSingleLineTextField2.Text = ""; + this.materialSingleLineTextField2.TabStop = false; + this.materialSingleLineTextField2.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; this.materialSingleLineTextField2.TrailingIcon = null; + this.materialSingleLineTextField2.UseSystemPasswordChar = false; // // tabPage4 // @@ -2188,7 +2274,7 @@ private void InitializeComponent() this.tabPage4.Location = new System.Drawing.Point(4, 31); this.tabPage4.Name = "tabPage4"; this.tabPage4.Padding = new System.Windows.Forms.Padding(3); - this.tabPage4.Size = new System.Drawing.Size(1015, 520); + this.tabPage4.Size = new System.Drawing.Size(966, 520); this.tabPage4.TabIndex = 3; this.tabPage4.Text = "Table Example"; // @@ -2280,7 +2366,7 @@ private void InitializeComponent() this.tabPage5.Location = new System.Drawing.Point(4, 31); this.tabPage5.Name = "tabPage5"; this.tabPage5.Padding = new System.Windows.Forms.Padding(3); - this.tabPage5.Size = new System.Drawing.Size(1015, 520); + this.tabPage5.Size = new System.Drawing.Size(966, 520); this.tabPage5.TabIndex = 4; this.tabPage5.Text = "Progress Bar"; // @@ -2321,7 +2407,7 @@ private void InitializeComponent() this.materialFlatButton2.MouseState = MaterialSkin.MouseState.HOVER; this.materialFlatButton2.Name = "materialFlatButton2"; this.materialFlatButton2.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialFlatButton2.Size = new System.Drawing.Size(107, 36); + this.materialFlatButton2.Size = new System.Drawing.Size(108, 36); this.materialFlatButton2.TabIndex = 1; this.materialFlatButton2.Text = "Remove"; this.materialFlatButton2.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Outlined; @@ -2339,7 +2425,7 @@ private void InitializeComponent() this.materialLabel50.Location = new System.Drawing.Point(29, 292); this.materialLabel50.MouseState = MaterialSkin.MouseState.HOVER; this.materialLabel50.Name = "materialLabel50"; - this.materialLabel50.Size = new System.Drawing.Size(821, 32); + this.materialLabel50.Size = new System.Drawing.Size(772, 32); this.materialLabel50.TabIndex = 3; this.materialLabel50.Text = "Sliders allow users to make selections from a range of values"; // @@ -2353,7 +2439,7 @@ private void InitializeComponent() this.materialLabel2.Location = new System.Drawing.Point(29, 76); this.materialLabel2.MouseState = MaterialSkin.MouseState.HOVER; this.materialLabel2.Name = "materialLabel2"; - this.materialLabel2.Size = new System.Drawing.Size(821, 63); + this.materialLabel2.Size = new System.Drawing.Size(772, 63); this.materialLabel2.TabIndex = 3; this.materialLabel2.Text = "Here we\'re showcasing the progressbar\r\nThis control is planned be improved with a" + "nimation and more status types\r\n"; @@ -2366,7 +2452,7 @@ private void InitializeComponent() this.MaterialButton2.Depth = 0; this.MaterialButton2.HighEmphasis = true; this.MaterialButton2.Icon = global::MaterialSkinExample.Properties.Resources.round_add_black_24dp; - this.MaterialButton2.Location = new System.Drawing.Point(755, 156); + this.MaterialButton2.Location = new System.Drawing.Point(706, 156); this.MaterialButton2.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); this.MaterialButton2.MouseState = MaterialSkin.MouseState.HOVER; this.MaterialButton2.Name = "MaterialButton2"; @@ -2387,7 +2473,7 @@ private void InitializeComponent() this.materialProgressBar1.Location = new System.Drawing.Point(29, 142); this.materialProgressBar1.MouseState = MaterialSkin.MouseState.HOVER; this.materialProgressBar1.Name = "materialProgressBar1"; - this.materialProgressBar1.Size = new System.Drawing.Size(804, 5); + this.materialProgressBar1.Size = new System.Drawing.Size(755, 5); this.materialProgressBar1.TabIndex = 0; this.materialProgressBar1.Value = 45; // @@ -2419,7 +2505,7 @@ private void InitializeComponent() this.tabPage6.Location = new System.Drawing.Point(4, 31); this.tabPage6.Margin = new System.Windows.Forms.Padding(0); this.tabPage6.Name = "tabPage6"; - this.tabPage6.Size = new System.Drawing.Size(1015, 520); + this.tabPage6.Size = new System.Drawing.Size(966, 520); this.tabPage6.TabIndex = 5; this.tabPage6.Text = "Containers"; // @@ -2655,7 +2741,7 @@ private void InitializeComponent() this.tabPage10.ImageKey = "round_bookmark_white_24dp.png"; this.tabPage10.Location = new System.Drawing.Point(4, 31); this.tabPage10.Name = "tabPage10"; - this.tabPage10.Size = new System.Drawing.Size(1015, 520); + this.tabPage10.Size = new System.Drawing.Size(966, 520); this.tabPage10.TabIndex = 7; this.tabPage10.Text = "ListBox"; // @@ -2832,7 +2918,7 @@ private void InitializeComponent() this.tabPage11.ImageKey = "round_http_white_24dp.png"; this.tabPage11.Location = new System.Drawing.Point(4, 31); this.tabPage11.Name = "tabPage11"; - this.tabPage11.Size = new System.Drawing.Size(1015, 520); + this.tabPage11.Size = new System.Drawing.Size(966, 520); this.tabPage11.TabIndex = 8; this.tabPage11.Text = "Expansion panel"; // @@ -2921,7 +3007,7 @@ private void InitializeComponent() this.tabPage12.ImageKey = "round_phone_black_24dp.png"; this.tabPage12.Location = new System.Drawing.Point(4, 31); this.tabPage12.Name = "tabPage12"; - this.tabPage12.Size = new System.Drawing.Size(1015, 520); + this.tabPage12.Size = new System.Drawing.Size(966, 520); this.tabPage12.TabIndex = 9; this.tabPage12.Text = "Label"; // @@ -3293,10 +3379,12 @@ private void InitializeComponent() this.ClientSize = new System.Drawing.Size(1029, 622); this.ContextMenuStrip = this.materialContextMenuStrip1; this.Controls.Add(this.materialTabControl1); + this.Cursor = System.Windows.Forms.Cursors.Default; this.DrawerShowIconsWhenHidden = true; this.DrawerTabControl = this.materialTabControl1; this.MinimumSize = new System.Drawing.Size(300, 200); this.Name = "MainForm"; + this.Padding = new System.Windows.Forms.Padding(52, 64, 3, 3); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "MaterialSkin Demo"; this.materialTabControl1.ResumeLayout(false); diff --git a/MaterialSkinExample/MainForm.resx b/MaterialSkinExample/MainForm.resx index e788af04..335c0b23 100644 --- a/MaterialSkinExample/MainForm.resx +++ b/MaterialSkinExample/MainForm.resx @@ -131,7 +131,7 @@ If any of the buttons looks weird while designing, change the tab background col AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABs - NgAAAk1TRnQBSQFMAgEBEgEAAZABBgGQAQYBGAEAARgBAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFg + NgAAAk1TRnQBSQFMAgEBEgEAAZgBBgGYAQYBGAEAARgBAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFg Aw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wMAAf8DOAH5A0MBdwMSARgDEgEYA0MBdwM4 + Af8DAAH/AwAB/wMAAf8MAANSAaYDAAH/A0ABcAgAAzABSwMAAf8DOgH5A0MBdwMSARgDEgEYA0MBdwM6 AfkDAAH/AwAB/wNIAYYDCwEPA0gBhgMAAf8DXAHMEAADUQGlAwAB/wMAAf8DAAH/AwAB/wNcAeoDHwEs BAADHwEsA1oB6QNaAekDHgErBAADHwEtA2AB6wMAAf8DAAH/AwAB/wMAAf8DUQGldwAB/wMAAf8DAAH/ AwAB/wMAAf8DCgENBAADXgHlAwAB/wMAAf8DAAH/AwAB/wNeAeUEAAMKAQ0DAAH/AwAB/wMAAf8DAAH/ @@ -206,71 +206,71 @@ If any of the buttons looks weird while designing, change the tab background col Az4B+BAAA1sB2AMAAf8DAAH/AwAB/wMAAf8DAAH/A1oB6QMfASwEAAMfASwDHwEsBAADHwEtA1wB6gMA Af8DAAH/AwAB/wMAAf8DAAH/A1sB2HcAAf8DAAH/AwAB/wMAAf8DAAH/AyoBQAQAA0kBiAMAAf8DAAH/ AwAB/wMAAf8DSQGIBAADKgFAAwAB/wMAAf8DAAH/AwAB/wMAAf8MAANPAfMDAAH/Aw8BFAgAA1YB8QMA - Af8DEgEZEAADEgEZAwAB/wMGAf4LAAEBAwAB/wMGAf4QAANYAfIDAAH/AwAB/wMAAf8DAAH/AwAB/wMA - Af8DWgHpAx8BLAgAAx8BLANcAeoDAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DWAHyLAADFAEcA1IBpgNh + Af8DEgEZEAADEgEZAwAB/wMGAf4LAAEBAwAB/wMGAf4QAANZAfIDAAH/AwAB/wMAAf8DAAH/AwAB/wMA + Af8DWgHpAx8BLAgAAx8BLANcAeoDAAH/AwAB/wMAAf8DAAH/AwAB/wMAAf8DWQHyLAADFAEcA1IBpgNh AeYDYQHmA1IBpgMUARwzAAH/AwAB/wMAAf8DAAH/AwAB/wNVAbIEAAMEAQYDSQGHA2EB5gNhAeYDSQGH AwQBBg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ECP8DRwGBQAADXAHcAwAB/wMA diff --git a/MaterialSkinExample/Properties/AssemblyInfo.cs b/MaterialSkinExample/Properties/AssemblyInfo.cs index ad78a5a6..3ab12ce3 100644 --- a/MaterialSkinExample/Properties/AssemblyInfo.cs +++ b/MaterialSkinExample/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.1.3")] -[assembly: AssemblyFileVersion("2.3.1.3")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.1.4")] +[assembly: AssemblyFileVersion("2.3.1.4")] \ No newline at end of file From 125ebe1c308d52eb6a79bffb46547736ef7ab5c2 Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Sun, 20 Feb 2022 15:10:05 +0000 Subject: [PATCH 3/3] 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 --- CHANGELOG.md | 13 +- MaterialSkin/Controls/MaterialComboBox.cs | 63 +++++- MaterialSkin/Properties/AssemblyInfo.cs | 4 +- MaterialSkinExample/MainForm.Designer.cs | 194 +++++++++--------- MaterialSkinExample/MainForm.resx | 72 +++---- .../Properties/AssemblyInfo.cs | 4 +- 6 files changed, 207 insertions(+), 143 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6049a25d..a5c06e89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ This repo is a fork obtained from https://github.com/leocb/MaterialSkin.git +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: @@ -26,7 +38,6 @@ build 2.3.1.4 [2022-02-20] - build 2.3.1.3 [2022-02-20] ------------------------- - Code Cleansing: diff --git a/MaterialSkin/Controls/MaterialComboBox.cs b/MaterialSkin/Controls/MaterialComboBox.cs index 84ac95fc..2eb346f4 100644 --- a/MaterialSkin/Controls/MaterialComboBox.cs +++ b/MaterialSkin/Controls/MaterialComboBox.cs @@ -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; @@ -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, @@ -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), @@ -367,7 +418,9 @@ public void recalculateAutoSize() var itemsList = this.Items.Cast().Select(item => item.ToString()); foreach (string s in itemsList) { - int newWidth = NativeText.MeasureLogString(s, SkinManager.getLogFontByType(MaterialSkinManager.fontType.Subtitle1)).Width + vertScrollBarWidth + padding; + // using new property "_itemMaterialFont" + int newWidth = NativeText.MeasureLogString(s, SkinManager.getLogFontByType(_itemMaterialFont)).Width + vertScrollBarWidth + padding; + if (w < newWidth) w = newWidth; } } diff --git a/MaterialSkin/Properties/AssemblyInfo.cs b/MaterialSkin/Properties/AssemblyInfo.cs index ad2ebe6e..175d3c50 100644 --- a/MaterialSkin/Properties/AssemblyInfo.cs +++ b/MaterialSkin/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.1.4")] -[assembly: AssemblyFileVersion("2.3.1.4")] +[assembly: AssemblyVersion("2.3.1.5")] +[assembly: AssemblyFileVersion("2.3.1.5")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/MaterialSkinExample/MainForm.Designer.cs b/MaterialSkinExample/MainForm.Designer.cs index 458e6865..84e6079e 100644 --- a/MaterialSkinExample/MainForm.Designer.cs +++ b/MaterialSkinExample/MainForm.Designer.cs @@ -35,24 +35,24 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); - MaterialSkin.MaterialListBoxItem materialListBoxItem1 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem2 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem3 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem4 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem5 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem6 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem7 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem8 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem9 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem10 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem11 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem12 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem13 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem14 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem15 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem16 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem17 = new MaterialSkin.MaterialListBoxItem(); - MaterialSkin.MaterialListBoxItem materialListBoxItem18 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem19 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem20 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem21 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem22 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem23 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem24 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem25 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem26 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem27 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem28 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem29 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem30 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem31 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem32 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem33 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem34 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem35 = new MaterialSkin.MaterialListBoxItem(); + MaterialSkin.MaterialListBoxItem materialListBoxItem36 = new MaterialSkin.MaterialListBoxItem(); this.materialCheckbox3 = new MaterialSkin.Controls.MaterialCheckbox(); this.materialCheckbox1 = new MaterialSkin.Controls.MaterialCheckbox(); this.materialTabControl1 = new MaterialSkin.Controls.MaterialTabControl(); @@ -1172,12 +1172,12 @@ private void InitializeComponent() this.materialComboBox6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.materialComboBox6.DropDownWidth = 121; this.materialComboBox6.Enabled = false; - this.materialComboBox6.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.materialComboBox6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.materialComboBox6.FormattingEnabled = true; this.materialComboBox6.Hint = "This is Disabled"; this.materialComboBox6.IntegralHeight = false; this.materialComboBox6.ItemHeight = 43; + this.materialComboBox6.ItemMaterialFont = MaterialSkin.MaterialSkinManager.fontType.Body1; this.materialComboBox6.Items.AddRange(new object[] { "But with value", "hi"}); @@ -1198,12 +1198,12 @@ private void InitializeComponent() this.materialComboBox2.DropDownHeight = 174; this.materialComboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.materialComboBox2.DropDownWidth = 435; - this.materialComboBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.materialComboBox2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.materialComboBox2.FormattingEnabled = true; this.materialComboBox2.Hint = "AutoResize = true"; this.materialComboBox2.IntegralHeight = false; this.materialComboBox2.ItemHeight = 43; + this.materialComboBox2.ItemMaterialFont = MaterialSkin.MaterialSkinManager.fontType.Body1; this.materialComboBox2.Items.AddRange(new object[] { "long item string that usually doesn\'t fit in the combobox", "Hello There, I hope you\'ll have a wonderfull day"}); @@ -1225,12 +1225,12 @@ private void InitializeComponent() this.materialComboBox5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.materialComboBox5.DropDownWidth = 121; this.materialComboBox5.Enabled = false; - this.materialComboBox5.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.materialComboBox5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.materialComboBox5.FormattingEnabled = true; this.materialComboBox5.Hint = "This is Disabled"; this.materialComboBox5.IntegralHeight = false; this.materialComboBox5.ItemHeight = 43; + this.materialComboBox5.ItemMaterialFont = MaterialSkin.MaterialSkinManager.fontType.Body1; this.materialComboBox5.Items.AddRange(new object[] { "When", "life", @@ -1318,12 +1318,12 @@ private void InitializeComponent() this.materialComboBox4.DropDownHeight = 174; this.materialComboBox4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.materialComboBox4.DropDownWidth = 121; - this.materialComboBox4.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.materialComboBox4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.materialComboBox4.FormattingEnabled = true; this.materialComboBox4.Hint = "Primary color"; this.materialComboBox4.IntegralHeight = false; this.materialComboBox4.ItemHeight = 43; + this.materialComboBox4.ItemMaterialFont = MaterialSkin.MaterialSkinManager.fontType.Body1; this.materialComboBox4.Items.AddRange(new object[] { "Long", "List", @@ -1414,12 +1414,12 @@ private void InitializeComponent() this.materialComboBox3.DropDownHeight = 118; this.materialComboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.materialComboBox3.DropDownWidth = 121; - this.materialComboBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.materialComboBox3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.materialComboBox3.FormattingEnabled = true; this.materialComboBox3.Hint = "small combo"; this.materialComboBox3.IntegralHeight = false; this.materialComboBox3.ItemHeight = 29; + this.materialComboBox3.ItemMaterialFont = MaterialSkin.MaterialSkinManager.fontType.Body1; this.materialComboBox3.Items.AddRange(new object[] { "Item 1", "Item 2", @@ -1476,12 +1476,12 @@ private void InitializeComponent() this.materialComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.materialComboBox1.DropDownWidth = 121; this.materialComboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.materialComboBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F); this.materialComboBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.materialComboBox1.FormattingEnabled = true; this.materialComboBox1.Hint = "ComboBox hints!"; this.materialComboBox1.IntegralHeight = false; this.materialComboBox1.ItemHeight = 43; + this.materialComboBox1.ItemMaterialFont = MaterialSkin.MaterialSkinManager.fontType.Body1; this.materialComboBox1.Items.AddRange(new object[] { "Item 1", "Item 2", @@ -1896,12 +1896,12 @@ private void InitializeComponent() this.materialComboBox7.DropDownHeight = 174; this.materialComboBox7.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.materialComboBox7.DropDownWidth = 121; - this.materialComboBox7.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel); this.materialComboBox7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.materialComboBox7.FormattingEnabled = true; this.materialComboBox7.Hint = "Set prefix or Suffix"; this.materialComboBox7.IntegralHeight = false; this.materialComboBox7.ItemHeight = 43; + this.materialComboBox7.ItemMaterialFont = MaterialSkin.MaterialSkinManager.fontType.Body1; this.materialComboBox7.Items.AddRange(new object[] { "None", "Prefix", @@ -2800,30 +2800,30 @@ private void InitializeComponent() this.materialListBox3.BorderColor = System.Drawing.Color.LightGray; this.materialListBox3.Depth = 0; this.materialListBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - materialListBoxItem1.SecondaryText = "A very very long secondary text to display 1 "; - materialListBoxItem1.Tag = null; - materialListBoxItem1.Text = "ListBoxItem1"; - materialListBoxItem2.SecondaryText = "A very very long secondary text to display 2"; - materialListBoxItem2.Tag = null; - materialListBoxItem2.Text = "ListBoxItem2"; - materialListBoxItem3.SecondaryText = "A very very long secondary text to display 3"; - materialListBoxItem3.Tag = null; - materialListBoxItem3.Text = "ListBoxItem3"; - materialListBoxItem4.SecondaryText = "A very very long secondary text to display 4"; - materialListBoxItem4.Tag = null; - materialListBoxItem4.Text = "ListBoxItem4"; - materialListBoxItem5.SecondaryText = "A very very long secondary text to display 5"; - materialListBoxItem5.Tag = null; - materialListBoxItem5.Text = "ListBoxItem5"; - materialListBoxItem6.SecondaryText = "A very very long secondary text to display 6"; - materialListBoxItem6.Tag = null; - materialListBoxItem6.Text = "ListBoxItem6"; - this.materialListBox3.Items.Add(materialListBoxItem1); - this.materialListBox3.Items.Add(materialListBoxItem2); - this.materialListBox3.Items.Add(materialListBoxItem3); - this.materialListBox3.Items.Add(materialListBoxItem4); - this.materialListBox3.Items.Add(materialListBoxItem5); - this.materialListBox3.Items.Add(materialListBoxItem6); + materialListBoxItem19.SecondaryText = "A very very long secondary text to display 1 "; + materialListBoxItem19.Tag = null; + materialListBoxItem19.Text = "ListBoxItem1"; + materialListBoxItem20.SecondaryText = "A very very long secondary text to display 2"; + materialListBoxItem20.Tag = null; + materialListBoxItem20.Text = "ListBoxItem2"; + materialListBoxItem21.SecondaryText = "A very very long secondary text to display 3"; + materialListBoxItem21.Tag = null; + materialListBoxItem21.Text = "ListBoxItem3"; + materialListBoxItem22.SecondaryText = "A very very long secondary text to display 4"; + materialListBoxItem22.Tag = null; + materialListBoxItem22.Text = "ListBoxItem4"; + materialListBoxItem23.SecondaryText = "A very very long secondary text to display 5"; + materialListBoxItem23.Tag = null; + materialListBoxItem23.Text = "ListBoxItem5"; + materialListBoxItem24.SecondaryText = "A very very long secondary text to display 6"; + materialListBoxItem24.Tag = null; + materialListBoxItem24.Text = "ListBoxItem6"; + this.materialListBox3.Items.Add(materialListBoxItem19); + this.materialListBox3.Items.Add(materialListBoxItem20); + this.materialListBox3.Items.Add(materialListBoxItem21); + this.materialListBox3.Items.Add(materialListBoxItem22); + this.materialListBox3.Items.Add(materialListBoxItem23); + this.materialListBox3.Items.Add(materialListBoxItem24); this.materialListBox3.Location = new System.Drawing.Point(579, 132); this.materialListBox3.MouseState = MaterialSkin.MouseState.HOVER; this.materialListBox3.Name = "materialListBox3"; @@ -2839,30 +2839,30 @@ private void InitializeComponent() this.materialListBox2.BorderColor = System.Drawing.Color.LightGray; this.materialListBox2.Depth = 0; this.materialListBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - materialListBoxItem7.SecondaryText = "Secondary text1"; - materialListBoxItem7.Tag = null; - materialListBoxItem7.Text = "ListBoxItem1"; - materialListBoxItem8.SecondaryText = "Secondary text2"; - materialListBoxItem8.Tag = null; - materialListBoxItem8.Text = "ListBoxItem2"; - materialListBoxItem9.SecondaryText = "Secondary text3"; - materialListBoxItem9.Tag = null; - materialListBoxItem9.Text = "ListBoxItem3"; - materialListBoxItem10.SecondaryText = "Secondary text4"; - materialListBoxItem10.Tag = null; - materialListBoxItem10.Text = "ListBoxItem4"; - materialListBoxItem11.SecondaryText = "Secondary text5"; - materialListBoxItem11.Tag = null; - materialListBoxItem11.Text = "ListBoxItem5"; - materialListBoxItem12.SecondaryText = "Secondary text6"; - materialListBoxItem12.Tag = null; - materialListBoxItem12.Text = "ListBoxItem6"; - this.materialListBox2.Items.Add(materialListBoxItem7); - this.materialListBox2.Items.Add(materialListBoxItem8); - this.materialListBox2.Items.Add(materialListBoxItem9); - this.materialListBox2.Items.Add(materialListBoxItem10); - this.materialListBox2.Items.Add(materialListBoxItem11); - this.materialListBox2.Items.Add(materialListBoxItem12); + materialListBoxItem25.SecondaryText = "Secondary text1"; + materialListBoxItem25.Tag = null; + materialListBoxItem25.Text = "ListBoxItem1"; + materialListBoxItem26.SecondaryText = "Secondary text2"; + materialListBoxItem26.Tag = null; + materialListBoxItem26.Text = "ListBoxItem2"; + materialListBoxItem27.SecondaryText = "Secondary text3"; + materialListBoxItem27.Tag = null; + materialListBoxItem27.Text = "ListBoxItem3"; + materialListBoxItem28.SecondaryText = "Secondary text4"; + materialListBoxItem28.Tag = null; + materialListBoxItem28.Text = "ListBoxItem4"; + materialListBoxItem29.SecondaryText = "Secondary text5"; + materialListBoxItem29.Tag = null; + materialListBoxItem29.Text = "ListBoxItem5"; + materialListBoxItem30.SecondaryText = "Secondary text6"; + materialListBoxItem30.Tag = null; + materialListBoxItem30.Text = "ListBoxItem6"; + this.materialListBox2.Items.Add(materialListBoxItem25); + this.materialListBox2.Items.Add(materialListBoxItem26); + this.materialListBox2.Items.Add(materialListBoxItem27); + this.materialListBox2.Items.Add(materialListBoxItem28); + this.materialListBox2.Items.Add(materialListBoxItem29); + this.materialListBox2.Items.Add(materialListBoxItem30); this.materialListBox2.Location = new System.Drawing.Point(306, 132); this.materialListBox2.MouseState = MaterialSkin.MouseState.HOVER; this.materialListBox2.Name = "materialListBox2"; @@ -2879,30 +2879,30 @@ private void InitializeComponent() this.materialListBox1.BorderColor = System.Drawing.Color.LightGray; this.materialListBox1.Depth = 0; this.materialListBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - materialListBoxItem13.SecondaryText = ""; - materialListBoxItem13.Tag = null; - materialListBoxItem13.Text = "ListBoxItem1"; - materialListBoxItem14.SecondaryText = ""; - materialListBoxItem14.Tag = null; - materialListBoxItem14.Text = "ListBoxItem2"; - materialListBoxItem15.SecondaryText = ""; - materialListBoxItem15.Tag = null; - materialListBoxItem15.Text = "ListBoxItem3"; - materialListBoxItem16.SecondaryText = ""; - materialListBoxItem16.Tag = null; - materialListBoxItem16.Text = "ListBoxItem4"; - materialListBoxItem17.SecondaryText = ""; - materialListBoxItem17.Tag = null; - materialListBoxItem17.Text = "ListBoxItem5"; - materialListBoxItem18.SecondaryText = ""; - materialListBoxItem18.Tag = null; - materialListBoxItem18.Text = "ListBoxItem6"; - this.materialListBox1.Items.Add(materialListBoxItem13); - this.materialListBox1.Items.Add(materialListBoxItem14); - this.materialListBox1.Items.Add(materialListBoxItem15); - this.materialListBox1.Items.Add(materialListBoxItem16); - this.materialListBox1.Items.Add(materialListBoxItem17); - this.materialListBox1.Items.Add(materialListBoxItem18); + materialListBoxItem31.SecondaryText = ""; + materialListBoxItem31.Tag = null; + materialListBoxItem31.Text = "ListBoxItem1"; + materialListBoxItem32.SecondaryText = ""; + materialListBoxItem32.Tag = null; + materialListBoxItem32.Text = "ListBoxItem2"; + materialListBoxItem33.SecondaryText = ""; + materialListBoxItem33.Tag = null; + materialListBoxItem33.Text = "ListBoxItem3"; + materialListBoxItem34.SecondaryText = ""; + materialListBoxItem34.Tag = null; + materialListBoxItem34.Text = "ListBoxItem4"; + materialListBoxItem35.SecondaryText = ""; + materialListBoxItem35.Tag = null; + materialListBoxItem35.Text = "ListBoxItem5"; + materialListBoxItem36.SecondaryText = ""; + materialListBoxItem36.Tag = null; + materialListBoxItem36.Text = "ListBoxItem6"; + this.materialListBox1.Items.Add(materialListBoxItem31); + this.materialListBox1.Items.Add(materialListBoxItem32); + this.materialListBox1.Items.Add(materialListBoxItem33); + this.materialListBox1.Items.Add(materialListBoxItem34); + this.materialListBox1.Items.Add(materialListBoxItem35); + this.materialListBox1.Items.Add(materialListBoxItem36); this.materialListBox1.Location = new System.Drawing.Point(38, 132); this.materialListBox1.MouseState = MaterialSkin.MouseState.HOVER; this.materialListBox1.Name = "materialListBox1"; diff --git a/MaterialSkinExample/MainForm.resx b/MaterialSkinExample/MainForm.resx index 335c0b23..43e042f7 100644 --- a/MaterialSkinExample/MainForm.resx +++ b/MaterialSkinExample/MainForm.resx @@ -117,12 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Here is a list of every variant a Material Button can be. Contained button's shadows are only drawn at run-time. -Click on them and checkout those sweet animations. Oh yeah, the buttons follow the theme and colors, try changing those too. -Normally the buttons should be AutoSize = true, but for the sake of my OCD, it's set to false here -If any of the buttons looks weird while designing, change the tab background color from transparent to white. - 219, 17 @@ -131,7 +125,7 @@ If any of the buttons looks weird while designing, change the tab background col AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABs - NgAAAk1TRnQBSQFMAgEBEgEAAZgBBgGYAQYBGAEAARgBAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFg + NgAAAk1TRnQBSQFMAgEBEgEAAaABBgGgAQYBGAEAARgBAAT/ASEBAAj/AUIBTQE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DAAH/AwAB/wMAAf8DAAH/AykB+gMyAVEfAAH/AwAB/wMAAf8DAAH/ AwAB/wNVAbIEAAMEAQYDSQGHA2EB5gNhAeYDSQGHAwQBBgQAA1UBsgMAAf8DAAH/AwAB/wMAAf8DAAH/ @@ -198,7 +192,7 @@ If any of the buttons looks weird while designing, change the tab background col AzUBVQMAAf8DAAH/AwAB/wMAAf8DRwGDBAADHwEsA1oB6QMAAf8DAAH/A1oB6QMeASsEAANIAYUDAAH/ AwAB/wMAAf8DAAH/AzUBVSQAAxkBIwM/AWwDVQGyA1sB2ANZAfIDAAH/A2AB4QNVAbIDPwFsAxkBIysA Af8DAAH/AwAB/wMAAf8DAAH/AwoBDQQAA14B5QMAAf8DAAH/AwAB/wMAAf8DXgHlBAADCgENAwAB/wMA - Af8DAAH/AwAB/wMAAf8MAANSAaYDAAH/A0ABcAgAAzABSwMAAf8DOgH5A0MBdwMSARgDEgEYA0MBdwM6 + Af8DAAH/AwAB/wMAAf8MAANSAaYDAAH/A0ABcAgAAzABSwMAAf8DPAH5A0MBdwMSARgDEgEYA0MBdwM8 AfkDAAH/AwAB/wNIAYYDCwEPA0gBhgMAAf8DXAHMEAADUQGlAwAB/wMAAf8DAAH/AwAB/wNcAeoDHwEs BAADHwEsA1oB6QNaAekDHgErBAADHwEtA2AB6wMAAf8DAAH/AwAB/wMAAf8DUQGldwAB/wMAAf8DAAH/ AwAB/wMAAf8DCgENBAADXgHlAwAB/wMAAf8DAAH/AwAB/wNeAeUEAAMKAQ0DAAH/AwAB/wMAAf8DAAH/ @@ -217,60 +211,60 @@ If any of the buttons looks weird while designing, change the tab background col ATgDAAH/A1sB0BAAA1sB2AMAAf8DAAH/AwAB/wMAAf8DAAH/A1wB6gMfAS0EAAMfASwDHwEsBAADHwEs A1oB6QMAAf8DAAH/AwAB/wMAAf8DAAH/A1sB2CgAA1IBpgMAAf8DAAH/AwAB/wMAAf8DAAH/AwAB/wNS AaYsAAMZASMDFAEcA1cBtwMAAf8DAAH/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@ -365,6 +359,12 @@ If any of the buttons looks weird while designing, change the tab background col AfgBAAEfAeABAAEHAf4BAAF/AfgB4AH/AfgBAAEfAeABAAEHAf8BAAL/AeEB/wH4AQABHwHgAQABBwT/ AeMB/wH4AQABHwf/Aecc/ws= + + + Here is a list of every variant a Material Button can be. Contained button's shadows are only drawn at run-time. +Click on them and checkout those sweet animations. Oh yeah, the buttons follow the theme and colors, try changing those too. +Normally the buttons should be AutoSize = true, but for the sake of my OCD, it's set to false here +If any of the buttons looks weird while designing, change the tab background color from transparent to white. 17, 17 diff --git a/MaterialSkinExample/Properties/AssemblyInfo.cs b/MaterialSkinExample/Properties/AssemblyInfo.cs index 3ab12ce3..c241158f 100644 --- a/MaterialSkinExample/Properties/AssemblyInfo.cs +++ b/MaterialSkinExample/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.1.4")] -[assembly: AssemblyFileVersion("2.3.1.4")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.1.5")] +[assembly: AssemblyFileVersion("2.3.1.5")] \ No newline at end of file