我们的应用程序在我们的 Windows 应用程序中使用 MonoDevelop.Components.Docking 框架。我们上次更新到最新版本是在 2010 年 11 月。我遇到了一些有趣的行为,这些行为发生在以下情况:
按 DockGroupType.Tabbed ParentGroup 中第一个面板的自动隐藏按钮
将鼠标悬停在折叠的面板上,直到它展开
将面板拖到选项卡组的中心(回到原始位置)并放下
此时,面板调整为显示面板将被放置的位置的蓝色矩形的大小,然后从主窗口取消停靠以浮动在该大小。这仅发生在选项卡式组中的第一项上。我在 DockGroupItem.cs(第 112 行,GetDockTarget(..))中发现了一段被注释掉的代码,似乎它可以处理这个问题。但是,它引用了一个未定义的 DockPosition 类型,CenterAfter。该方法如下,注释掉的部分以粗体显示:
public bool GetDockTarget (DockItem item, int px, int py, Gdk.Rectangle rect, out DockDelegate dockDelegate, out Gdk.Rectangle outrect)
{
dockDelegate = null;
if (item != this.item && this.item.Visible && rect.Contains (px,py)) {
int xdockMargin = (int) ((double)rect.Width * (1.0 - DockFrame.ItemDockCenterArea)) / 2;
int ydockMargin = (int) ((double)rect.Height * (1.0 - DockFrame.ItemDockCenterArea)) / 2;
DockPosition pos;
/* if (ParentGroup.Type == DockGroupType.Tabbed) {
rect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin,rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);
pos = DockPosition.CenterAfter;
}
*/ if (px <= rect.X + xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {
outrect = new Gdk.Rectangle (rect.X, rect.Y, xdockMargin, rect.Height);
pos = DockPosition.Left;
}
else if (px >= rect.Right - xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {
outrect = new Gdk.Rectangle (rect.Right - xdockMargin, rect.Y, xdockMargin, rect.Height);
pos = DockPosition.Right;
}
else if (py <= rect.Y + ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {
outrect = new Gdk.Rectangle (rect.X, rect.Y, rect.Width, ydockMargin);
pos = DockPosition.Top;
}
else if (py >= rect.Bottom - ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {
outrect = new Gdk.Rectangle (rect.X, rect.Bottom - ydockMargin, rect.Width, ydockMargin);
pos = DockPosition.Bottom;
}
else {
outrect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);
pos = DockPosition.Center;
}
dockDelegate = delegate (DockItem dit) {
DockGroupItem it = ParentGroup.AddObject (dit, pos, Id);
it.SetVisible (true);
ParentGroup.FocusItem (it);
};
return true;
}
outrect = Gdk.Rectangle.Zero;
return false;
}
我已经尝试了一些小事情,但到目前为止没有任何影响行为。关于我可以编辑什么以使其正常工作的任何想法?谢谢!