Example #1
0
        /// <summary>
        /// Initialize a new instance of the DropDockingIndicatorsSquare class.
        /// </summary>
        /// <param name="paletteDragDrop">Drawing palette.</param>
        /// <param name="renderer">Drawing renderer.</param>
        /// <param name="showLeft">Show left hot area.</param>
        /// <param name="showRight">Show right hot area.</param>
        /// <param name="showTop">Show top hot area.</param>
        /// <param name="showBottom">Show bottom hot area.</param>
        /// <param name="showMiddle">Show middle hot area.</param>
        public DropDockingIndicatorsSquare(IPaletteDragDrop paletteDragDrop,
                                           IRenderer renderer,
                                           bool showLeft, bool showRight,
                                           bool showTop, bool showBottom,
                                           bool showMiddle)
        {
            _paletteDragDrop = paletteDragDrop;
            _renderer        = renderer;

            // Initialize the drag data that indicators which docking indicators are needed
            _dragData = new RenderDragDockingData(showLeft, showRight, showTop, showBottom, showMiddle);

            // Ask the renderer to measure the sizing of the indicators that are displayed
            _renderer.RenderGlyph.MeasureDragDropDockingGlyph(_dragData, _paletteDragDrop, PaletteDragFeedback.Square);

            // Setup window so that it is transparent to the Silver color and does not have any borders etc...
            BackColor       = Color.Silver;
            ClientSize      = _dragData.DockWindowSize;
            ControlBox      = false;
            FormBorderStyle = FormBorderStyle.None;
            Location        = new Point(100, 200);
            MaximizeBox     = false;
            MinimizeBox     = false;
            MinimumSize     = Size.Empty;
            Name            = "DropIndicators";
            ShowInTaskbar   = false;
            SizeGripStyle   = SizeGripStyle.Hide;
            StartPosition   = FormStartPosition.Manual;
            Text            = "DropIndicators";
            TransparencyKey = Color.Silver;
            Paint          += DropIndicators_Paint;
        }
        /// <summary>
        /// Initialize a new instance of the DropDockingIndicatorsRounded class.
        /// </summary>
        /// <param name="paletteDragDrop">Drawing palette.</param>
        /// <param name="renderer">Drawing renderer.</param>
        /// <param name="showLeft">Show left hot area.</param>
        /// <param name="showRight">Show right hot area.</param>
        /// <param name="showTop">Show top hot area.</param>
        /// <param name="showBottom">Show bottom hot area.</param>
        /// <param name="showMiddle">Show middle hot area.</param>
        public DropDockingIndicatorsRounded(IPaletteDragDrop paletteDragDrop,
                                            IRenderer renderer,
                                            bool showLeft, bool showRight,
                                            bool showTop, bool showBottom,
                                            bool showMiddle)
        {
            _paletteDragDrop = paletteDragDrop;
            _renderer        = renderer;

            // Initialize the drag data that indicators which docking indicators are needed
            _dragData = new RenderDragDockingData(showLeft, showRight, showTop, showBottom, showMiddle);

            // Ask the renderer to measure the sizing of the indicators that are displayed
            _renderer.RenderGlyph.MeasureDragDropDockingGlyph(_dragData, _paletteDragDrop, PaletteDragFeedback.Rounded);
            _showRect = new Rectangle(Point.Empty, _dragData.DockWindowSize);

            // Any old title will do as it will not be shown
            CreateParams cp = new CreateParams
            {
                Caption = "DropDockingIndicatorsRounded",

                // Define the screen position/size
                X      = _showRect.X,
                Y      = _showRect.Y,
                Height = _showRect.Width,
                Width  = _showRect.Height,

                // As a top-level window it has no parent
                Parent = IntPtr.Zero,

                // Appear as a top-level window
                Style = unchecked ((int)PI.WS_.POPUP),

                // Set styles so that it does not have a caption bar and is above all other
                // windows in the ZOrder, i.e. TOPMOST
                ExStyle = PI.WS_EX_.TOPMOST |
                          PI.WS_EX_.TOOLWINDOW
            };

            // We are going to use per-pixel alpha blending and so need a layered window
            cp.ExStyle |= PI.WS_EX_.LAYERED;

            // Create the actual window
            CreateHandle(cp);
        }