当前位置: 首页>>代码示例>>C#>>正文


C# DragDrop.Package类代码示例

本文整理汇总了C#中Gwen.DragDrop.Package的典型用法代码示例。如果您正苦于以下问题:C# Package类的具体用法?C# Package怎么用?C# Package使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Package类属于Gwen.DragDrop命名空间,在下文中一共展示了Package类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DragAndDrop_HandleDrop

        public override bool DragAndDrop_HandleDrop(Package p, int x, int y)
        {
            Point LocalPos = CanvasPosToLocal(new Point(x, y));

            TabButton button = DragAndDrop.SourceControl as TabButton;
            TabControl tabControl = Parent as TabControl;
            if (tabControl != null && button != null)
            {
                if (button.TabControl != tabControl)
                {
                    // We've moved tab controls!
                    tabControl.AddPage(button);
                }
            }

            Base droppedOn = GetControlAt(LocalPos.X, LocalPos.Y);
            if (droppedOn != null)
            {
                Point dropPos = droppedOn.CanvasPosToLocal(new Point(x, y));
                DragAndDrop.SourceControl.BringNextToControl(droppedOn, dropPos.X > droppedOn.Width/2);
            }
            else
            {
                DragAndDrop.SourceControl.BringToFront();
            }
            return true;
        }
开发者ID:AreonDev,项目名称:NoWayOut,代码行数:27,代码来源:TabStrip.cs

示例2: DragAndDrop_CanAcceptPackage

        public override bool DragAndDrop_CanAcceptPackage(Package p)
        {
            if (!m_AllowReorder)
                return false;

            if (p.Name == "TabButtonMove")
                return true;

            return false;
        }
开发者ID:Sprunth,项目名称:gwen-dotnet,代码行数:10,代码来源:TabStrip.cs

示例3: onDrop

        private static bool onDrop(int x, int y)
        {
            bool success = false;

            if (HoveredControl != null)
            {
                HoveredControl.DragAndDrop_HoverLeave(CurrentPackage);
                success = HoveredControl.DragAndDrop_HandleDrop(CurrentPackage, x, y);
            }

            // Report back to the source control, to tell it if we've been successful.
            SourceControl.DragAndDrop_EndDragging(success, x, y);

            CurrentPackage = null;
            SourceControl = null;

            return true;
        }
开发者ID:BreyerW,项目名称:Sharp.Engine,代码行数:18,代码来源:DragAndDrop.cs

示例4: ControlDeleted

        public static void ControlDeleted(Base control)
        {
            if (SourceControl == control)
            {
                SourceControl = null;
                CurrentPackage = null;
                HoveredControl = null;
                m_LastPressedControl = null;
            }

            if (m_LastPressedControl == control)
                m_LastPressedControl = null;

            if (HoveredControl == control)
                HoveredControl = null;

            if (m_NewHoveredControl == control)
                m_NewHoveredControl = null;
        }
开发者ID:Sprunth,项目名称:gwen-dotnet,代码行数:19,代码来源:DragAndDrop.cs

示例5: ShouldStartDraggingControl

        private static bool ShouldStartDraggingControl( int x, int y )
        {
            // We're not holding a control down..
            if (m_LastPressedControl == null) 
                return false;

            // Not been dragged far enough
            int length = Math.Abs(x - m_LastPressedPos.X) + Math.Abs(y - m_LastPressedPos.Y);
            if (length < 5) 
                return false;

            // Create the dragging package

            CurrentPackage = m_LastPressedControl.DragAndDrop_GetPackage(m_LastPressedPos.X, m_LastPressedPos.Y);

            // We didn't create a package!
            if (CurrentPackage == null)
            {
                m_LastPressedControl = null;
                SourceControl = null;
                return false;
            }

            // Now we're dragging something!
            SourceControl = m_LastPressedControl;
            InputHandler.MouseFocus = null;
            m_LastPressedControl = null;
            CurrentPackage.DrawControl = null;

            // Some controls will want to decide whether they should be dragged at that moment.
            // This function is for them (it defaults to true)
            if (!SourceControl.DragAndDrop_ShouldStartDrag())
            {
                SourceControl = null;
                CurrentPackage = null;
                return false;
            }

            SourceControl.DragAndDrop_StartDragging(CurrentPackage, m_LastPressedPos.X, m_LastPressedPos.Y);

            return true;
        }
开发者ID:BreyerW,项目名称:Sharp.Engine,代码行数:42,代码来源:DragAndDrop.cs

示例6: DragAndDrop_HandleDrop

        public override bool DragAndDrop_HandleDrop (Package p, int x, int y)
        {
            var item = p.UserData as Tuple<int, int, InventoryButton, ItemComponent>;

            int pos_x = X / boxSize - item.Item1;
            int pos_y = Y / boxSize - item.Item2;
            int pos_w = item.Item3.Width / boxSize;
            int pos_h = item.Item3.Height / boxSize;

            if (pos_x < 0 || pos_x + pos_w >= inventory.Size.X || pos_y < 0 || pos_y + pos_h >= inventory.Size.Y)
                return false;

            var bar_pos = inventory.GetPositionOfBarItem(item.Item4);

            if (bar_pos < inventory.InventoryBar.Length)
                inventory.RemoveFromBar(bar_pos);

            var old_pos = inventory.GetPositionOfItem (item.Item4);
            inventory.TakeOut (item.Item4);

            if (inventory.Insert (item.Item4, new Vector2i (pos_x, pos_y)))
            {
                if (bar_pos < inventory.InventoryBar.Length)
                    inventory.PutInBar(pos_x, pos_y, bar_pos);
                
                item.Item3.X = pos_x * boxSize + 1;
                item.Item3.Y = pos_y * boxSize + 1;
                return true;
            }
            if (!inventory.Insert (item.Item4, old_pos))
            {
                Logger.Log.AddLogEntry (LogLevel.Error, "InventorySpace", "Lost an item from inventory!");
                item.Item3.DelayedDelete ();
            }
            return false;
        }
开发者ID:AreonDev,项目名称:NoWayOut,代码行数:36,代码来源:InventoryGUI.cs

示例7: DragAndDrop_HoverLeave

        // receiver
        public virtual void DragAndDrop_HoverLeave(Package p)
        {

        }
开发者ID:LawlietRyuuzaki,项目名称:gwen-dotnet,代码行数:5,代码来源:Base.cs

示例8: DragAndDrop_HandleDrop

 // receiver
 public virtual bool DragAndDrop_HandleDrop(Package p, int x, int y)
 {
     DragAndDrop.SourceControl.Parent = this;
     return true;
 }
开发者ID:LawlietRyuuzaki,项目名称:gwen-dotnet,代码行数:6,代码来源:Base.cs

示例9: DragAndDrop_Hover

        public override void DragAndDrop_Hover(Package p, int x, int y)
        {
            Point localPos = CanvasPosToLocal(new Point(x, y));

            Base droppedOn = GetControlAt(localPos.X, localPos.Y);
            if (droppedOn != null && droppedOn != this)
            {
                Point dropPos = droppedOn.CanvasPosToLocal(new Point(x, y));
                m_TabDragControl.SetBounds(new Rectangle(0, 0, 3, Height));
                m_TabDragControl.BringToFront();
                m_TabDragControl.SetPosition(droppedOn.X - 1, 0);

                if (dropPos.X > droppedOn.Width/2)
                {
                    m_TabDragControl.MoveBy(droppedOn.Width - 1, 0);
                }
                m_TabDragControl.Dock = Pos.None;
            }
            else
            {
                m_TabDragControl.Dock = Pos.Left;
                m_TabDragControl.BringToFront();
            }
        }
开发者ID:AreonDev,项目名称:NoWayOut,代码行数:24,代码来源:TabStrip.cs

示例10: DragAndDrop_StartDragging

 public override void DragAndDrop_StartDragging(Package package, int x, int y)
 {
     DragAndDrop.SourceControl = Parent;
     DragAndDrop.SourceControl.DragAndDrop_StartDragging(package, x, y);
 }
开发者ID:Sprunth,项目名称:gwen-dotnet,代码行数:5,代码来源:TabTitleBar.cs

示例11: DragAndDrop_Hover

        public override void DragAndDrop_Hover(Package p, int x, int y)
        {
            Point pos = CanvasPosToLocal(new Point(x, y));
            Pos dir = GetDroppedTabDirection(pos.X, pos.Y);

            if (dir == Pos.Fill)
            {
                if (null == m_DockedTabControl)
                {
                    m_HoverRect = Rectangle.Empty;
                    return;
                }

                m_HoverRect = InnerBounds;
                return;
            }

            m_HoverRect = RenderBounds;

            int HelpBarWidth = 0;

            if (dir == Pos.Left)
            {
                HelpBarWidth = (int)(m_HoverRect.Width * 0.25f);
                m_HoverRect.Width = HelpBarWidth;
            }

            if (dir == Pos.Right)
            {
                HelpBarWidth = (int)(m_HoverRect.Width * 0.25f);
                m_HoverRect.X = m_HoverRect.Width - HelpBarWidth;
                m_HoverRect.Width = HelpBarWidth;
            }

            if (dir == Pos.Top)
            {
                HelpBarWidth = (int)(m_HoverRect.Height * 0.25f);
                m_HoverRect.Height = HelpBarWidth;
            }

            if (dir == Pos.Bottom)
            {
                HelpBarWidth = (int)(m_HoverRect.Height * 0.25f);
                m_HoverRect.Y = m_HoverRect.Height - HelpBarWidth;
                m_HoverRect.Height = HelpBarWidth;
            }

            if ((dir == Pos.Top || dir == Pos.Bottom) && !m_DropFar)
            {
                if (m_Left != null && m_Left.IsVisible)
                {
                    m_HoverRect.X += m_Left.Width;
                    m_HoverRect.Width -= m_Left.Width;
                }

                if (m_Right != null && m_Right.IsVisible)
                {
                    m_HoverRect.Width -= m_Right.Width;
                }
            }

            if ((dir == Pos.Left || dir == Pos.Right) && !m_DropFar)
            {
                if (m_Top != null && m_Top.IsVisible)
                {
                    m_HoverRect.Y += m_Top.Height;
                    m_HoverRect.Height -= m_Top.Height;
                }

                if (m_Bottom != null && m_Bottom.IsVisible)
                {
                    m_HoverRect.Height -= m_Bottom.Height;
                }
            }
        }
开发者ID:WardBenjamin,项目名称:gwen-dotnet,代码行数:75,代码来源:DockBase.cs

示例12: DragAndDrop_HoverEnter

        public override void DragAndDrop_HoverEnter(Package p, int x, int y)
        {
            if (m_TabDragControl != null)
            {
                throw new InvalidOperationException("ERROR! TabStrip::DragAndDrop_HoverEnter");
            }

            m_TabDragControl = new Highlight(this);
            m_TabDragControl.MouseInputEnabled = false;
            m_TabDragControl.SetSize(3, Height);
        }
开发者ID:AreonDev,项目名称:NoWayOut,代码行数:11,代码来源:TabStrip.cs

示例13: DragAndDrop_HoverEnter

 public override void DragAndDrop_HoverEnter(Package p, int x, int y)
 {
     m_DrawHover = true;
 }
开发者ID:WardBenjamin,项目名称:gwen-dotnet,代码行数:4,代码来源:DockBase.cs

示例14: DragAndDrop_HoverLeave

 public override void DragAndDrop_HoverLeave(Package p)
 {
     m_DrawHover = false;
 }
开发者ID:WardBenjamin,项目名称:gwen-dotnet,代码行数:4,代码来源:DockBase.cs

示例15: DragAndDrop_HandleDrop

        public override bool DragAndDrop_HandleDrop(Package p, int x, int y)
        {
            Point pos = CanvasPosToLocal(new Point(x, y));
            Pos dir = GetDroppedTabDirection(pos.X, pos.Y);

            DockedTabControl addTo = m_DockedTabControl;
            if (dir == Pos.Fill && addTo == null)
                return false;

            if (dir != Pos.Fill)
            {
                DockBase dock = GetChildDock(dir);
                addTo = dock.m_DockedTabControl;

                if (!m_DropFar)
                    dock.BringToFront();
                else
                    dock.SendToBack();
            }

            if (p.Name == "TabButtonMove")
            {
                TabButton tabButton = DragAndDrop.SourceControl as TabButton;
                if (null == tabButton)
                    return false;

                addTo.AddPage(tabButton);
            }

            if (p.Name == "TabWindowMove")
            {
                DockedTabControl tabControl = DragAndDrop.SourceControl as DockedTabControl;
                if (null == tabControl)
                    return false;
                if (tabControl == addTo)
                    return false;

                tabControl.MoveTabsTo(addTo);
            }

            Invalidate();

            return true;
        }
开发者ID:WardBenjamin,项目名称:gwen-dotnet,代码行数:44,代码来源:DockBase.cs


注:本文中的Gwen.DragDrop.Package类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。