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


C# BaseItem.RecalcSize方法代码示例

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


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

示例1: 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,代码来源:

示例2: OnSubItemExpandChange

		protected internal override void OnSubItemExpandChange(BaseItem objChildItem)
		{
			base.OnSubItemExpandChange(objChildItem);
			ExplorerBar exbar=this.ContainerControl as ExplorerBar;
			try
			{
				if(exbar!=null && exbar.AnimationEnabled)
				{
					TimeSpan totalAnimationTime = new TimeSpan(0, 0, 0, 0, exbar.AnimationTime);
					_Animating=true;
					int iStep=1;
					DateTime startTime=DateTime.Now;
					if(objChildItem.Expanded)
					{
						int initalHeight=objChildItem.HeightInternal;
						objChildItem.RecalcSize();
						int targetHeight=objChildItem.HeightInternal;
						for(int i=initalHeight;i<targetHeight;i+=iStep)
						{
							DateTime startPerMove = DateTime.Now;
							objChildItem.HeightInternal=i;
							foreach(BaseItem item in objChildItem.SubItems)
							{
								if(!objChildItem.DisplayRectangle.Contains(item.DisplayRectangle))
									item.Displayed=false;
								else
									item.Displayed=true;
							}
							for(int pos=this.SubItems.IndexOf(objChildItem)+1;pos<this.SubItems.Count;pos++)
								this.SubItems[pos].TopInternal+=iStep;
							
//							float perc=(float)i/targetHeight+1;
//							iStep=(int)Math.Exp(perc);
							exbar.Refresh();

							TimeSpan elapsedPerMove = DateTime.Now - startPerMove;
							TimeSpan elapsedTime = DateTime.Now - startTime;
                            int totalMs = (int)(totalAnimationTime - elapsedTime).TotalMilliseconds;
							if (totalMs <= 0)
							{
								iStep=targetHeight-i;
							}
                            else if (totalMs == 0)
								iStep=1;
							else
							{
								iStep=(targetHeight-i)*(int)elapsedPerMove.TotalMilliseconds / totalMs;
								if(iStep<=0) iStep=1;

							}
							if(iStep<=0)
								iStep=targetHeight-i;
						}
					}
					else
					{
						int initalHeight=objChildItem.HeightInternal;
						objChildItem.RecalcSize();
						int targetHeight=objChildItem.HeightInternal;
						for(int i=initalHeight;i>targetHeight;i-=iStep)
						{
							DateTime startPerMove = DateTime.Now;
							objChildItem.HeightInternal=i;
							foreach(BaseItem item in objChildItem.SubItems)
							{
								if(!objChildItem.DisplayRectangle.Contains(item.DisplayRectangle))
									item.Displayed=false;
								else
									item.Displayed=true;
							}
							for(int pos=this.SubItems.IndexOf(objChildItem)+1;pos<this.SubItems.Count;pos++)
								this.SubItems[pos].TopInternal-=iStep;
//							float perc=(float)targetHeight/i+1;
//							iStep=(int)Math.Exp(perc);
							exbar.Refresh();

							TimeSpan elapsedPerMove = DateTime.Now - startPerMove;
							TimeSpan elapsedTime = DateTime.Now - startTime;
							if ((totalAnimationTime - elapsedTime).TotalMilliseconds <= 0)
							{
								iStep=i-targetHeight;
							}
							else if((totalAnimationTime - elapsedTime).TotalMilliseconds==0)
								iStep=1;
							else
							{
								iStep=(i-targetHeight)*(int)elapsedPerMove.TotalMilliseconds / Math.Max(1,(int)((totalAnimationTime - elapsedTime).TotalMilliseconds));
								if(iStep<=0) iStep=1;
							}
							if(iStep<=0)
								iStep=i-targetHeight;
						}
					}
				}
			}
			finally
			{
				_Animating=false;
			}
			if(exbar!=null)
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例3: LayoutBaseItem

        private void LayoutBaseItem(BaseItem item)
        {
            Size size = new Size();
            Rectangle bounds = Rectangle.Empty;
            
            if (_FixedTabSize.Width <= 0 || _FixedTabSize.Height <= 0 || item is ButtonItem && !((ButtonItem)item).FixedSize.IsEmpty)
            {
                item.RecalcSize();

                size = item.Bounds.Size;
                
                size.Width += _TabLayoutOffset.Width;
                size.Height += _TabLayoutOffset.Height;

                size.Width += _TabStripItem.ItemPadding.Horizontal;
                size.Height += _TabStripItem.ItemPadding.Vertical;
            }

            if (_FixedTabSize.Width > 0)
                size.Width = _FixedTabSize.Width;

            if (_FixedTabSize.Height > 0)
                size.Height = _FixedTabSize.Height;

            if (!(item is ButtonItem && !((ButtonItem)item).FixedSize.IsEmpty))
            {
                bounds.Size = size;
                item.Bounds = bounds;
            }

            if (item.Stretch == false)
                _List[item] = size;
        }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例4: LayoutItem

        /// <summary>
        /// Performs individual running layout processing for the given BaseItem
        /// </summary>
        /// <param name="item">Item to Layout</param>
        /// <param name="size">Running Layout Size</param>
        /// <param name="recalc">Whether a recalcSize is needed</param>
        /// <returns>New running Size</returns>
        private Size LayoutItem(BaseItem item, Size size, bool recalc)
        {
            if (item.Visible == true)
            {
                // Recalc if requested

                if (recalc == true)
                    item.RecalcSize();

                // If this is the first item, then give
                // us a little padding around the ControlBox

                if (size.IsEmpty == true)
                {
                    if (Orientation == eOrientation.Horizontal)
                        size.Width += 5;
                    else
                        size.Height += 5;
                }

                // Get the item Bounds

                Rectangle r = new Rectangle(Bounds.X, Bounds.Y, item.WidthInternal, item.HeightInternal);

                // Set the item location

                if (_TabStripItem.IsVertical == true)
                {
                    r.Y += size.Height;
                    r.X += (Bounds.Width - r.Width) / 2;
                }
                else
                {
                    r.X += size.Width;
                    r.Y += (Bounds.Height - r.Height) / 2;
                }

                // Set the Bounds

                item.Bounds = r;

                // Set the item Size

                if (_TabStripItem.IsVertical == true)
                {
                    size.Height += item.HeightInternal + 2;

                    if (item.WidthInternal > size.Width)
                        size.Width = item.WidthInternal;
                }
                else
                {
                    size.Width += item.WidthInternal + 2;

                    if (item.HeightInternal > size.Height)
                        size.Height = item.HeightInternal;
                }

                // Set its display status

                if (DesignMode == false)
                    item.Displayed = true;
            }

            return (size);
        }
开发者ID:,项目名称:,代码行数:73,代码来源:


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