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


C# BaseItem.ExpandedItem方法代码示例

本文整理汇总了C#中DevComponents.DotNetBar.BaseItem.ExpandedItem方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItem.ExpandedItem方法的具体用法?C# BaseItem.ExpandedItem怎么用?C# BaseItem.ExpandedItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DevComponents.DotNetBar.BaseItem的用法示例。


在下文中一共展示了BaseItem.ExpandedItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetInsertPosition

		/// <summary>
		/// Returns information about insertion position for an item given screen coordinates. Used internally for drag&drop support.
		/// </summary>
		/// <param name="containerItem">Container item</param>
		/// <param name="pScreen">Screen coordinates</param>
		/// <param name="DragItem">Item that is being dragged</param>
		/// <returns>Information about insertion position or null if item cannot be inserted to the container.</returns>
		public static InsertPosition GetInsertPosition(BaseItem containerItem, Point pScreen, BaseItem DragItem)
		{
			InsertPosition objInsertPos=null;
            Control objContainer = null;

            if (containerItem is PopupItem && containerItem.Expanded)
                objContainer = ((PopupItem)containerItem).PopupControl;
            else
                objContainer = containerItem.ContainerControl as Control;

            if (objContainer == null)
				return null;

			Point pClient=objContainer.PointToClient(pScreen);
			Rectangle thisRect=containerItem.DisplayRectangle;
            if (containerItem is PopupItem && containerItem.Expanded)
                thisRect = objContainer.DisplayRectangle;
			if(thisRect.Contains(pClient) || containerItem.SubItems.Count==0 && objContainer.ClientRectangle.Contains(pClient) || containerItem is ItemContainer && ((ItemContainer)containerItem).SystemContainer && objContainer.ClientRectangle.Contains(pClient))
			{
				Rectangle r;
				BaseItem objItem;
				// Check first inside any expanded items
				objItem=containerItem.ExpandedItem();
				if(objItem!=null)
				{
					IDesignTimeProvider provider=objItem as IDesignTimeProvider;
					if(provider!=null)
					{
						objInsertPos=provider.GetInsertPosition(pScreen, DragItem);
						if(objInsertPos!=null)
							return objInsertPos;
					}
				}

				for(int i=0;i<containerItem.SubItems.Count;i++)
				{
					objItem=containerItem.SubItems[i];
					r=objItem.DisplayRectangle;
					r.Inflate(2,2);
					if(objItem.Visible && r.Contains(pClient))
					{
						if(objItem.SystemItem && containerItem.SubItems.Count!=1)
						{
							return null;
						}
						if(objItem==DragItem)
							return new InsertPosition();
						
						if(objItem.IsContainer && objItem is IDesignTimeProvider)
						{
							Rectangle inner=r;
							inner.Inflate(-8,-8);
                            if (inner.Contains(pClient))
                            {
                                return ((IDesignTimeProvider)objItem).GetInsertPosition(pScreen, DragItem);
                            }
						}
                        if (containerItem.AllowDrop)
                        {
                            objInsertPos = new InsertPosition();
                            objInsertPos.TargetProvider = (IDesignTimeProvider)containerItem;
                            objInsertPos.Position = i;
                            if (objItem.Orientation == eOrientation.Horizontal && !objItem.IsOnMenu)
                            {
                                if (pClient.X <= objItem.LeftInternal + objItem.WidthInternal / 2 || objItem.SystemItem)
                                    objInsertPos.Before = true;
                            }
                            else
                            {
                                if (pClient.Y <= objItem.TopInternal + objItem.HeightInternal / 2 || objItem.SystemItem)
                                    objInsertPos.Before = true;
                            }

                            // We need to collapse any expanded items that are not on this bar
                            IOwner owner = containerItem.GetOwner() as IOwner;
                            if (owner != null)
                            {
                                BaseItem objExp = owner.GetExpandedItem();
                                if (objExp != null)
                                {
                                    while (objExp.Parent != null)
                                        objExp = objExp.Parent;
                                    BaseItem objParent = objItem;
                                    while (objParent.Parent != null)
                                        objParent = objParent.Parent;
                                    if (objExp != objParent)
                                        owner.SetExpandedItem(null);
                                }
                            }

                            if (objItem is PopupItem && (objItem.SubItems.Count > 0 || objItem.IsOnMenuBar))
                            {
                                if (!objItem.Expanded && objItem.CanCustomize)
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: InsertItemAt

		/// <summary>
		/// Inserts drag&drop item at specified position.
		/// </summary>
		/// <param name="containerItem">Container item.</param>
		/// <param name="objItem">Item being inserted</param>
		/// <param name="iPos">Insertion position</param>
		/// <param name="Before">Indicates whether item is inserted before the specified insertion position</param>
		public static void InsertItemAt(BaseItem containerItem, BaseItem objItem, int iPos, bool Before)
		{
			if(containerItem.ExpandedItem()!=null)
			{
				containerItem.ExpandedItem().Expanded=false;
			}
			if(!Before)
			{
				if(iPos+1>=containerItem.SubItems.Count)
				{
					containerItem.SubItems.Add(objItem,GetAppendPosition(containerItem));
				}
				else
				{
					containerItem.SubItems.Add(objItem,iPos+1);
				}
			}
			else
			{
				if(iPos>=containerItem.SubItems.Count)
				{
					containerItem.SubItems.Add(objItem, GetAppendPosition(containerItem));
				}
				else
				{
					containerItem.SubItems.Add(objItem,iPos);
				}
			}
			if(containerItem.ContainerControl is Bar)
				((Bar)containerItem.ContainerControl).RecalcLayout();
			else if(containerItem.ContainerControl is MenuPanel)
				((MenuPanel)containerItem.ContainerControl).RecalcSize();
			else if(containerItem.ContainerControl is BarBaseControl)
				((BarBaseControl)containerItem.ContainerControl).RecalcLayout();
			else if(containerItem.ContainerControl is ItemControl)
				((ItemControl)containerItem.ContainerControl).RecalcLayout();
			else
			{
				containerItem.RecalcSize();
				containerItem.Refresh();
			}
		}
开发者ID:,项目名称:,代码行数:49,代码来源:

示例3: ProcessKeyDown

        internal static void ProcessKeyDown(BaseItem container, System.Windows.Forms.KeyEventArgs objArg)
        {
            if (container.SubItems.Count == 0 || objArg.Handled)
                return;

            BaseItem objExpanded = container.ExpandedItem();

            if (objExpanded != null)
            {
                objExpanded.InternalKeyDown(objArg);
                if (objArg.Handled)
                    return;
            }

            eOrientation containerOrientation = container.Orientation;
            if (container is ItemContainer)
                containerOrientation = ((ItemContainer)container).LayoutOrientation;

            if (containerOrientation == eOrientation.Horizontal && (objArg.KeyCode == Keys.Left || objArg.KeyCode == Keys.Right || container.HotSubItem == null && (objArg.KeyCode == Keys.Down || objArg.KeyCode == Keys.Up)) ||
               (containerOrientation == eOrientation.Vertical && (objArg.KeyCode == Keys.Up || objArg.KeyCode == Keys.Down || container.HotSubItem == null && (objArg.KeyCode == Keys.Right || objArg.KeyCode == Keys.Left))))
            {
                // Select next object
                if (container.HotSubItem != null)
                {
                    container.HotSubItem.InternalMouseLeave();
                    if (container.AutoExpand && container.HotSubItem.Expanded)
                    {
                        container.HotSubItem.Expanded = false;
                    }
                }
                if (objArg.KeyCode == System.Windows.Forms.Keys.Left || objArg.KeyCode == Keys.Up)
                {
                    int iIndex = 0;
                    if (container.HotSubItem != null)
                        iIndex = container.SubItems.IndexOf(container.HotSubItem) - 1;
                    if (iIndex < 0)
                        iIndex = container.SubItems.Count - 1;
                    BaseItem objNew = null;
                    bool bRepeat = false;
                    do
                    {
                        for (int i = iIndex; i >= 0; i--)
                        {
                            objNew = container.SubItems[i];
                            if (CanFocus(objNew))
                            {
                                iIndex = i;
                                break;
                            }
                        }
                        if (!CanFocus(container.SubItems[iIndex]))
                        {
                            if (!bRepeat)
                            {
                                iIndex = container.SubItems.Count - 1;
                                bRepeat = true;
                            }
                            else
                                bRepeat = false;
                        }
                        else
                            bRepeat = false;
                    } while (bRepeat);
                    container.HotSubItem = container.SubItems[iIndex];
                }
                else
                {
                    int iIndex = 0;
                    if (container.HotSubItem != null)
                        iIndex = container.SubItems.IndexOf(container.HotSubItem) + 1;

                    while (iIndex < container.SubItems.Count && !CanFocus(container.SubItems[iIndex]))
                        iIndex++;
                    if (iIndex >= container.SubItems.Count)
                        iIndex = 0;
                    BaseItem objNew = null;
                    for (int i = iIndex; i < container.SubItems.Count; i++)
                    {
                        objNew = container.SubItems[i];
                        if (CanFocus(objNew))
                        {
                            iIndex = i;
                            break;
                        }
                    }
                    container.HotSubItem = container.SubItems[iIndex];
                }
                
                if (container.HotSubItem != null)
                {
                    if (container.HotSubItem is ItemContainer)
                    {
                        ((ItemContainer)container.HotSubItem).SelectFirstItem();
                    }
                    else
                    {
                        container.HotSubItem.InternalMouseEnter();
                        container.HotSubItem.InternalMouseMove(new MouseEventArgs(MouseButtons.None, 0, container.HotSubItem.LeftInternal + 1, container.HotSubItem.TopInternal + 1, 0));
                        IScrollableItemControl isc = container.ContainerControl as IScrollableItemControl;
                        if (isc != null)
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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