Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

[New Feature Request] Drop shadow parameters #121

Closed
amagico opened this issue Apr 3, 2019 · 11 comments
Closed

[New Feature Request] Drop shadow parameters #121

amagico opened this issue Apr 3, 2019 · 11 comments
Labels
done The issue has been solved enhancement suggestion

Comments

@amagico
Copy link

amagico commented Apr 3, 2019

Drop shadow is an important part of the UX. Today #56 the fixed shadow is pretty sharp and will in some use cases blend into the background.
I suggest a feature that you can set the shadow properties:

  1. Blur 0-100 px
  2. Opacity 0-100 %
  3. Offset 0-100 px
  4. Offset angle 0-360° (nice to have feature)

This is a more contemporary drop shadow produced with the above parameters:

image

Many thanks!

@amagico
Copy link
Author

amagico commented Apr 3, 2019

Or, can we today change the current drop shadow properties ourselves? @Wagnerp :-)

@NatasaJ17
Copy link

I agree with amagico, it would be much better with 4-sides shadow, I really want this shadow, but unfortunately solutions that I found don't work.

@PWagner1
Copy link
Collaborator

PWagner1 commented Apr 3, 2019

Hi @amagico and @MACE17

It isn't available yet, however it could be a feature for a future update. Incidentally, I was thinking about this a few weeks ago.

@PWagner1 PWagner1 changed the title Drop shadow parameters [New Feature Request] Drop shadow parameters Apr 3, 2019
@amagico
Copy link
Author

amagico commented Apr 3, 2019

Hi @amagico and @MACE17

It isn't available yet, however it could be a feature for a future update. Incidentally, I was thinking about this a few weeks ago.

@Wagnerp that would be much appreciated and a big lift for the overall look and feel of Krypton.
There is quite a lot of sample code out there but by overriding Krypton we encounter trouble such as window resizing (a feature that is very important to keep). A K-integrated shadow would be clever.

Thanks a lot

@Smurf-IV Smurf-IV self-assigned this Apr 6, 2019
@Smurf-IV
Copy link
Collaborator

Smurf-IV commented Apr 6, 2019

https://www.w3schools.com/cssref/playit.asp?filename=playcss_box-shadow&preval=20px%2020px%2050px%20grey

H-offset : The horizontal offset of the shadow. A positive value puts the shadow on the right side of the box, a negative value puts the shadow on the left side of the box. 0 can be used
V-offset : The vertical offset of the shadow. A positive value puts the shadow below the box, a negative value puts the shadow above the box. 0 can be used
Blur 	(Optional) The blur radius. The higher the number, the more blurred the shadow will be 	
Spread 	(Optional) The spread radius. A positive value increases the size of the shadow, a negative value decreases the size of the shadow 	
Color 	(Optional) The color of the shadow. The default value is the system dark grey.

@Smurf-IV
Copy link
Collaborator

Smurf-IV commented Apr 7, 2019

I have been playing with several implementations and have been fighting all sorts of wonderful edge cases e.g.

  • What happens when the form is moved over a screen edge,
  • What happens when the form is being used for docking,
  • Max and minimising
  • What about other controls (like panels)
  • Pop-up windows also have shadows (i.e. menus / tooltips / popup navigator windows / etc)
  • Use of DWM
  • Use of Overlays
  • Native Vs GDI Vs embedding WPF
  • Resizing

Anyway, after all this, I think I have a design that should work for most of the above use cases for Forms except the other existing Krypton Controls (Initially)

@Smurf-IV
Copy link
Collaborator

Smurf-IV commented Apr 7, 2019

I agree with amagico, it would be much better with 4-sides shadow, I really want this shadow, but unfortunately solutions that I found don't work.

OK, I think I will drop the css styling, and allow the above to happen, i.e. specify all 4 side offsets, and a negative will impact the side that it would touch. So a standard diagonal blur would be something like (-10, -10, 10, 10)

    /// <param name="left">The padding size, in pixels, for the left edge.</param>
    /// <param name="top">The padding size, in pixels, for the top edge.</param>
    /// <param name="right">The padding size, in pixels, for the right edge.</param>
    /// <param name="bottom">The padding size, in pixels, for the bottom edge.</param>

@PWagner1
Copy link
Collaborator

PWagner1 commented Apr 7, 2019

Hi @Smurf-IV

Maybe it could work when the WindowState is restored. i.e:

if (WindowState == FormWindowState.Normal)
{
      DrawBorderBlur(10, 10, -10, -10);
}
else
{
      DrawBorderBlur(0, 0, 0, 0);
}

@Smurf-IV Smurf-IV added in progress under investigation Investigation of bugs/issues and removed help wanted labels Apr 7, 2019
@amagico
Copy link
Author

amagico commented Apr 8, 2019

to be specific, we use WinForms... thanks for doing this tho

@Smurf-IV
Copy link
Collaborator

Smurf-IV commented Apr 14, 2019

Nearly there:
image

Currently fighting the loss and regain of focus, which makes the shading go behind the previous active window !!

@amagico
Copy link
Author

amagico commented Apr 14, 2019 via email

Smurf-IV added a commit that referenced this issue Apr 14, 2019
Fix Drop shadow parameters #121
@Smurf-IV Smurf-IV added done The issue has been solved and removed in progress under investigation Investigation of bugs/issues labels Apr 14, 2019
@Smurf-IV Smurf-IV removed their assignment Apr 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
done The issue has been solved enhancement suggestion
Projects
None yet
Development

No branches or pull requests

4 participants