Skip to content

Commit

Permalink
Merge pull request #138 from orapps44/patch-4
Browse files Browse the repository at this point in the history
Update MaterialFloatingActionButton.cs
  • Loading branch information
leocb authored Feb 13, 2021
2 parents 0f2a7da + 0e4e4de commit 632d148
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions MaterialSkin/Controls/MaterialFloatingActionButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ public class MaterialFloatingActionButton : Button, IMaterialControl
private const int FAB_MINI_ICON_MARGIN = 8;
private const int FAB_ICON_SIZE = 24;

[DefaultValue(true)]
[Category("Material Skin"), DisplayName("Draw Shadows")]
[Description("Draw Shadows around control")]
public bool DrawShadows { get; set; }

[DefaultValue(false)]
[Category("Material Skin"), DisplayName("Size Mini")]
[Description("Set control size to default or mini")]
public bool Mini
{
get { return _mini; }
Expand All @@ -37,12 +43,14 @@ public bool Mini
}
}

private bool _mini = false;
private bool _mini ;

[DefaultValue(false)]
[Category("Material Skin"), DisplayName("Animate Show HideButton")]
public bool AnimateShowHideButton
{
get { return _animateShowButton; }
set { _animateShowButton = value; }
set { _animateShowButton = value; Refresh(); }
}

private bool _animateShowButton;
Expand All @@ -63,6 +71,8 @@ public Image Icon

public MaterialFloatingActionButton()
{
AnimateShowHideButton = false;
Mini = false;
DrawShadows = true;
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);

Expand Down Expand Up @@ -221,6 +231,18 @@ protected override void OnMouseClick(MouseEventArgs mevent)
_animationManager.StartNewAnimation(AnimationDirection.In, mevent.Location);
}

protected override void OnResize(EventArgs e)
{
base.OnResize(e);

if (DrawShadows && Parent != null)
{
RemoveShadowPaintEvent(Parent, drawShadowOnParent);
AddShadowPaintEvent(Parent, drawShadowOnParent);
}
}


private Point origin;

public new void Hide()
Expand All @@ -242,4 +264,4 @@ protected override void OnMouseClick(MouseEventArgs mevent)
}
}
}
}
}

0 comments on commit 632d148

Please sign in to comment.