Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MaterialFloatingActionButton.cs #138

Merged
merged 1 commit into from
Feb 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}
}
}
}