Displays a shadow effect for a visual popup.
Inheritance: System.Windows.Forms.Form
Example #1
0
        /// <summary>
        /// Initialize a new instance of the VisualPopup class.
        /// </summary>
        /// <param name="viewManager">View manager instance for managing view display.</param>
        /// <param name="renderer">Drawing renderer.</param>
        /// <param name="shadow">Does the popup need a shadow effect.</param>
        public VisualPopup(ViewManager viewManager,
                           IRenderer renderer,
                           bool shadow)
        {
            #region Default ControlStyle Values
            // Default style values for Control are:-
            //    True  - AllPaintingInWmPaint
            //    False - CacheText
            //    False - ContainerControl
            //    False - EnableNotifyMessage
            //    False - FixedHeight
            //    False - FixedWidth
            //    False - Opaque
            //    False - OptimizedDoubleBuffer
            //    False - ResizeRedraw
            //    False - Selectable
            //    True  - StandardClick
            //    True  - StandardDoubleClick
            //    False - SupportsTransparentBackColor
            //    False - UserMouse
            //    True  - UserPaint
            //    True  - UseTextForAccessibility
            #endregion

            // We use double buffering to reduce drawing flicker
            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // We need to repaint entire control whenever resized
            SetStyle(ControlStyles.ResizeRedraw, true);

            // Cannot select control by using mouse to click it
            SetStyle(ControlStyles.Selectable, false);

            // Cache incoming references
            Renderer    = renderer;
            ViewManager = viewManager;

            // Setup the need paint delegate
            NeedPaintDelegate = OnNeedPaint;

            // Setup the invokes
            _refreshCall = OnPerformRefresh;

            // Default other properties
            _layoutDirty = true;
            _refresh     = true;

            // Create the shadow control
            if (shadow)
            {
                _shadow = new VisualPopupShadow();
            }
        }
Example #2
0
        /// <summary>
        /// Initialize a new instance of the VisualPopup class.
        /// </summary>
        /// <param name="viewManager">View manager instance for managing view display.</param>
        /// <param name="renderer">Drawing renderer.</param>
        /// <param name="shadow">Does the popup need a shadow effect.</param>
        public VisualPopup(ViewManager viewManager,
                           IRenderer renderer,
                           bool shadow)
        {
            #region Default ControlStyle Values
            // Default style values for Control are:-
            //	True  - AllPaintingInWmPaint
            //	False - CacheText
            //	False - ContainerControl
            //	False - EnableNotifyMessage
            //	False - FixedHeight
            //	False - FixedWidth
            //	False - Opaque
            //	False - OptimizedDoubleBuffer
            //	False - ResizeRedraw
            //	False - Selectable
            //	True  - StandardClick
            //	True  - StandardDoubleClick
            //	False - SupportsTransparentBackColor
            //	False - UserMouse
            //	True  - UserPaint
            //	True  - UseTextForAccessibility
            #endregion

            // We use double buffering to reduce drawing flicker
            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // We need to repaint entire control whenever resized
            SetStyle(ControlStyles.ResizeRedraw, true);

            // Cannot select control by using mouse to click it
            SetStyle(ControlStyles.Selectable, false);

            // Cache incoming references
            _renderer = renderer;
            _viewManager = viewManager;

            // Setup the need paint delegate
            _needPaintDelegate = new NeedPaintHandler(OnNeedPaint);

            // Setup the invokes
            _refreshCall = new SimpleCall(OnPerformRefresh);

            // Default other properties
            _layoutDirty = true;
            _refresh = true;

            // Create the shadow control
            if (shadow)
                _shadow = new VisualPopupShadow();
        }
Example #3
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                // Remove our show instance
                if (_shadow != null)
                {
                    _shadow.Dispose();
                    _shadow = null;
                }
            }

            base.Dispose(disposing);

            // Remove the active view, so the last view element to
            // have mouse input has a chance to cleanup processing
            if (ViewManager != null)
            {
                ViewManager.ActiveView = null;
                ViewManager.Dispose();
            }

            // Do we have a delegate to fire when popup is dismissed?
            if (_dismissedDelegate != null)
            {
                _dismissedDelegate(this, EventArgs.Empty);
                _dismissedDelegate = null;
            }
        }