Exemple #1
0
        /// <summary>
        /// Create a shadow thingy
        /// </summary>
        /// <param name="shadowValues">What value will be used</param>
        /// <param name="visualOrientation">What orientation for the shadow placement</param>
        public VisualShadowBase(ShadowValues shadowValues, VisualOrientation visualOrientation)
        {
            _shadowValues      = shadowValues;
            _visualOrientation = visualOrientation;
            // Update form properties so we do not have a border and do not show
            // in the task bar. We draw the background in Magenta and set that as
            // the transparency key so it is a see through window.
            CreateParams cp = new()
            {
                // Define the screen position/size
                X      = -2,
                Y      = -2,
                Height = 2,
                Width  = 2,

                Parent  = IntPtr.Zero,//_ownerHandle,
                Style   = unchecked ((int)(PI.WS_.DISABLED | PI.WS_.POPUP)),
                ExStyle = unchecked ((int)(PI.WS_EX_.LAYERED | PI.WS_EX_.NOACTIVATE | PI.WS_EX_.TRANSPARENT | PI.WS_EX_.NOPARENTNOTIFY))
            };

            _shadowClip = new Bitmap(1, 1);
            // Make the default transparent color transparent for myBitmap.
            _shadowClip.MakeTransparent();

            // Create the actual window
            CreateHandle(cp);
        }
Exemple #2
0
        public ShadowManager(VisualForm kryptonForm, ShadowValues shadowValues)
        {
            _parentForm   = kryptonForm;
            _shadowValues = shadowValues;

            _parentForm.Closing += KryptonFormOnClosing;
            _parentForm.Load    += FormLoaded;

            shadowValues.EnableShadowsChanged += ShadowValues_EnableShadowsChanged;
            shadowValues.MarginsChanged       += ShadowValues_MarginsChanged;
            shadowValues.BlurDistanceChanged  += ShadowValues_BlurDistanceChanged;
            shadowValues.ColourChanged        += ShadowValues_ColourChanged;
            shadowValues.OpacityChanged       += ShadowValues_OpacityChanged;
        }