本文整理汇总了C#中DevComponents.DotNetBar.BaseItem.GetOwner方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItem.GetOwner方法的具体用法?C# BaseItem.GetOwner怎么用?C# BaseItem.GetOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevComponents.DotNetBar.BaseItem
的用法示例。
在下文中一共展示了BaseItem.GetOwner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
//.........这里部分代码省略.........
示例2: GetOwner
private static object GetOwner(BaseItem item)
{
object owner = item.GetOwner();
if (owner is RibbonBar && ((RibbonBar)owner).IsOverflowRibbon)
{
if (((RibbonBar)owner).IsOnQat)
owner = ((RibbonBar)owner).QatButtonParent.GetOwner();
else
owner = ((RibbonBar)owner).OverflowParent;
}
return owner;
}