⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 redockercontent.cs

📁 Magic Library 1.7,有说明文档
💻 CS
📖 第 1 页 / 共 2 页
字号:

            // If an outer control has been specified then use this as the limit
            if (outerControl != null)
                outerIndex = _container.Controls.IndexOf(outerControl);

            return outerIndex;
        }

        protected void GenerateHotZonesForLeft(ArrayList leftList, Rectangle formClient, int vector, int outerIndex)
        {
            foreach(Control c in leftList)
            {	
                bool ignoreType = (c is AutoHidePanel);
            
                int controlIndex = _container.Controls.IndexOf(c);

                if (!ignoreType && (controlIndex < outerIndex))
                {
                    // Grab the screen rectangle of the Control being processed
                    Rectangle hotArea = c.RectangleToScreen(c.ClientRectangle);

                    // Create the rectangle for the hot area
                    hotArea.Width = _hotVectorBeforeControl;

                    // Create the rectangle for the insertion indicator
                    Rectangle newSize = new Rectangle(hotArea.X, hotArea.Y, vector, hotArea.Height);
					
					hotArea.X += _hotVectorFromEdge;

                    // Create the new HotZone used to reposition a docking content/windowcontent
                    _hotZones.Add(new HotZoneReposition(hotArea, newSize, State.DockLeft, controlIndex));

                    IHotZoneSource ag = c as IHotZoneSource;

                    // Does this control expose an interface for its own HotZones?
                    if (ag != null)
                        ag.AddHotZones(this, _hotZones);
                }
            }

            // Grab the screen rectangle of the Control being processed
            Rectangle fullArea = _outsideRect;

            // Create the rectangle for the hot area
            fullArea.Width = _hotVectorFromEdge;

            // Create the rectangle for the insertion indicator
            Rectangle fillSize = new Rectangle(fullArea.X, fullArea.Y, vector, fullArea.Height);

            _hotZones.Add(new HotZoneReposition(fullArea, fillSize, State.DockLeft, false));

			// If performing our own InsideFill then do not dock at inner positions
			if (!_dockingManager.InsideFill)
			{
				// Create the HotArea at the left side of the inner rectangle
				Rectangle innerHotArea = new Rectangle(_insideRect.X, _insideRect.Y, _hotVectorBeforeControl, _insideRect.Height);

				// Create the rectangle for tgqhe insertion indicator
				Rectangle innerNewSize = new Rectangle(innerHotArea.X, innerHotArea.Y, vector, innerHotArea.Height);

				// Create a HotZone for docking to the Left at the innermost position
				_hotZones.Add(new HotZoneReposition(innerHotArea, innerNewSize, State.DockLeft, true));
			}
        }

        protected void GenerateHotZonesForRight(ArrayList rightList, Rectangle formClient, int vector, int outerIndex)
        {
            foreach(Control c in rightList)
            {	
                bool ignoreType = (c is AutoHidePanel);
            
                int controlIndex = _container.Controls.IndexOf(c);

                if (!ignoreType && (controlIndex < outerIndex))
                {
                    // Grab the screen rectangle of the Control being processed
                    Rectangle hotArea = c.RectangleToScreen(c.ClientRectangle);

                    // Create the rectangle for the hot area
                    hotArea.X = hotArea.Right - _hotVectorBeforeControl;
                    hotArea.Width = _hotVectorBeforeControl;

                    // Create the rectangle for the insertion indicator
                    Rectangle newSize = new Rectangle(hotArea.Right - vector, hotArea.Y, vector, hotArea.Height);
					
					hotArea.X -= _hotVectorFromEdge;

                    // Create the new HotZone used to reposition a docking content/windowcontent
                    _hotZones.Add(new HotZoneReposition(hotArea, newSize, State.DockRight, controlIndex));

                    IHotZoneSource ag = c as IHotZoneSource;

                    // Does this control expose an interface for its own HotZones?
                    if (ag != null)
                        ag.AddHotZones(this, _hotZones);
                }
            }

            // Grab the screen rectangle of the Control being processed
            Rectangle fullArea = _outsideRect;

            // Create the rectangle for the hot area
            fullArea.X = fullArea.Right - _hotVectorFromEdge;
            fullArea.Width = _hotVectorFromEdge;

            // Create the rectangle for the insertion indicator
            Rectangle fillSize = new Rectangle(fullArea.Right - vector, fullArea.Y, vector, fullArea.Height);

            _hotZones.Add(new HotZoneReposition(fullArea, fillSize, State.DockRight, false));

			// If performing our own InsideFill then do not dock at inner positions
			if (!_dockingManager.InsideFill)
			{
				// Create the HotArea at the right side of the inner rectangle
				Rectangle innerHotArea = new Rectangle(_insideRect.Right - _hotVectorBeforeControl, _insideRect.Y, _hotVectorBeforeControl, _insideRect.Height);

				// Create the rectangle for the insertion indicator
				Rectangle innerNewSize = new Rectangle(innerHotArea.Right - vector, innerHotArea.Y, vector, innerHotArea.Height);

				// Create a HotZone for docking to the Left at the innermost position
				_hotZones.Add(new HotZoneReposition(innerHotArea, innerNewSize, State.DockRight, true));
			}
        }

        protected void GenerateHotZonesForTop(ArrayList topList, Rectangle formClient, int vector, int outerIndex)
        {
            foreach(Control c in topList)
            {	
                bool ignoreType = (c is AutoHidePanel);
            
                int controlIndex = _container.Controls.IndexOf(c);

                if (!ignoreType && (controlIndex < outerIndex))
                {
                    // Grab the screen rectangle of the Control being processed
                    Rectangle hotArea = c.RectangleToScreen(c.ClientRectangle);

                    // Create the rectangle for the hot area
                    hotArea.Height = _hotVectorBeforeControl;

                    // Create the rectangle for the insertion indicator
                    Rectangle newSize = new Rectangle(hotArea.X, hotArea.Y, hotArea.Width, vector);
					
					hotArea.Y += _hotVectorFromEdge;

                    // Create the new HotZone used to reposition a docking content/windowcontent
                    _hotZones.Add(new HotZoneReposition(hotArea, newSize, State.DockTop, controlIndex));

                    IHotZoneSource ag = c as IHotZoneSource;

                    // Does this control expose an interface for its own HotZones?
                    if (ag != null)
                        ag.AddHotZones(this, _hotZones);
                }
            }

            // Grab the screen rectangle of the Control being processed
            Rectangle fullArea = _outsideRect;

            // Create the rectangle for the hot area
            fullArea.Height = _hotVectorFromEdge;

            // Create the rectangle for the insertion indicator
            Rectangle fillSize = new Rectangle(fullArea.X, fullArea.Y, fullArea.Width, vector);

            _hotZones.Add(new HotZoneReposition(fullArea, fillSize, State.DockTop, false));

			// If performing our own InsideFill then do not dock at inner positions
			if (!_dockingManager.InsideFill)
			{
				// Create the HotArea at the left side of the inner rectangle
				Rectangle innerHotArea = new Rectangle(_insideRect.X, _insideRect.Y, _insideRect.Width, _hotVectorBeforeControl);

				// Create the rectangle for the insertion indicator
				Rectangle innerNewSize = new Rectangle(innerHotArea.X, innerHotArea.Y, innerHotArea.Width, vector);

				// Create a HotZone for docking to the Left at the innermost position
				_hotZones.Add(new HotZoneReposition(innerHotArea, innerNewSize, State.DockTop, true));
			}
        }

        protected void GenerateHotZonesForBottom(ArrayList bottomList, Rectangle formClient, int vector, int outerIndex)
        {
            foreach(Control c in bottomList)
            {	
                bool ignoreType = (c is AutoHidePanel);
            
                int controlIndex = _container.Controls.IndexOf(c);

                if (!ignoreType && (controlIndex < outerIndex))
                {
                    // Grab the screen rectangle of the Control being processed
                    Rectangle hotArea = c.RectangleToScreen(c.ClientRectangle);

                    // Create the rectangle for the hot area
                    hotArea.Y = hotArea.Bottom - _hotVectorBeforeControl;
                    hotArea.Height = _hotVectorBeforeControl;

                    // Create the rectangle for the insertion indicator
                    Rectangle newSize = new Rectangle(hotArea.X, hotArea.Bottom - vector, hotArea.Width, vector);
					
					hotArea.Y -= _hotVectorFromEdge;

                    // Create the new HotZone used to reposition a docking content/windowcontent
                    _hotZones.Add(new HotZoneReposition(hotArea, newSize, State.DockBottom, controlIndex));

                    IHotZoneSource ag = c as IHotZoneSource;

                    // Does this control expose an interface for its own HotZones?
                    if (ag != null)
                        ag.AddHotZones(this, _hotZones);
                }
            }

            // Grab the screen rectangle of the Control being processed
            Rectangle fullArea = _outsideRect;

            // Create the rectangle for the hot area
            fullArea.Y = fullArea.Bottom - _hotVectorFromEdge;
            fullArea.Height = _hotVectorFromEdge;

            // Create the rectangle for the insertion indicator
            Rectangle fillSize = new Rectangle(fullArea.X, fullArea.Bottom - vector, fullArea.Width, vector);

            _hotZones.Add(new HotZoneReposition(fullArea, fillSize, State.DockBottom, false));

			// If performing our own InsideFill then do not dock at inner positions
			if (!_dockingManager.InsideFill)
			{
				// Create the HotArea at the bottom of the inner rectangle
				Rectangle innerHotArea = new Rectangle(_insideRect.X, _insideRect.Bottom - _hotVectorBeforeControl, _insideRect.Width, _hotVectorBeforeControl);

				// Create the rectangle for the insertion indicator
				Rectangle innerNewSize = new Rectangle(innerHotArea.X, innerHotArea.Bottom - vector, innerHotArea.Width, vector);

				// Create a HotZone for docking to the Left at the innermost position
				_hotZones.Add(new HotZoneReposition(innerHotArea, innerNewSize, State.DockBottom, true));
			}
        }

        protected void GenerateHotZonesForFill(ArrayList fillList, int outerIndex)
        {
            foreach(Control c in fillList)
            {	
                bool ignoreType = (c is AutoHidePanel);
            
                int controlIndex = _container.Controls.IndexOf(c);

                if (controlIndex < outerIndex)
                {
                    IHotZoneSource ag = c as IHotZoneSource;

                    // Does this control expose an interface for its own HotZones?
                    if (ag != null)
                        ag.AddHotZones(this, _hotZones);
                }
            }
        }

        protected void GenerateHotZonesForFloating(Size sourceSize)
        {
            ContainerControl main = _dockingManager.Container;
            
            foreach(Form f in main.FindForm().OwnedForms)
            {
                // Cannot redock entire Floatin form onto itself
                if (f != _floatingForm)
                {
                    IHotZoneSource ag = f as IHotZoneSource;

                    // Does this Form expose an interface for its own HotZones?
                    if (ag != null)
                        ag.AddHotZones(this, _hotZones);
                }
            }
             
            // Applies to the entire desktop area
            Rectangle hotArea = new Rectangle(0, 0, 
                                              SystemInformation.MaxWindowTrackSize.Width,
                                              SystemInformation.MaxWindowTrackSize.Height);

            // Position is determined by HotZone dynamically but the size is defined now
            Rectangle newSize = new Rectangle(0, 0, sourceSize.Width, sourceSize.Height);

            // Generate a catch all HotZone for floating a Content
            _hotZones.Add(new HotZoneFloating(hotArea, newSize, _offset, this)); 
        }

        protected void VectorDependsOnSourceAndState(out int vectorH, out int vectorV)
        {
            Size sourceSize = SizeDependsOnSource();

            switch(_source)
            {
                case Source.FloatingForm:
					// Make sure the vector is the smaller of the two dimensions
					if (sourceSize.Width > sourceSize.Height)
						sourceSize.Width = sourceSize.Height;

					if (sourceSize.Height > sourceSize.Width)
						sourceSize.Height = sourceSize.Width;

					// Do not let the new vector extend beyond halfway
					if (sourceSize.Width > (_container.Width / 2))
						sourceSize.Width = _container.Width / 2;

					if (sourceSize.Height > (_container.Height / 2))
						sourceSize.Height = _container.Height / 2;
					break;
                case Source.WindowContent:
                case Source.ContentInsideWindow:
                switch(_windowContent.State)
                {
                    case State.DockLeft:
                    case State.DockRight:
                        vectorH = sourceSize.Width;
                        vectorV = vectorH;
                        return;
                    case State.DockTop:
                    case State.DockBottom:
                        vectorH = sourceSize.Height;
                        vectorV = vectorH;
                        return;
                }
                break;
            }

            vectorV = sourceSize.Height;
            vectorH = sourceSize.Width;
        }

        protected Size SizeDependsOnSource()
        {
            switch(_source)
            {
                case Source.WindowContent:
                    return _windowContent.Size;
                case Source.FloatingForm:
                    return _floatingForm.Size;
                case Source.RawContent:
                case Source.ContentInsideWindow:
                default:
                    return _content.DisplaySize;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -