我是DockPanel Suite的新手。我已经创建了一个自定义的FloatWindow和IFloatWindowFactory:
public class MapFloatWindowFactory : DockPanelExtender.IFloatWindowFactory
{
public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
{
return new MapFloatWindow(dockPanel, pane, bounds);
}
public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane)
{
return new MapFloatWindow(dockPanel, pane);
}
}
public class MapFloatWindow : FloatWindow
{
public MapFloatWindow(DockPanel dockPanel, DockPane pane) : base(dockPanel, pane)
{
FormBorderStyle = FormBorderStyle.Sizable;
}
public MapFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds) : base(dockPanel, pane, bounds)
{
FormBorderStyle = FormBorderStyle.Sizable;
}
}
但是,使用此方法,我的MaximizeBox
的{{1}}和MinimizeBox
属性不受尊重。我该如何实现呢?
答案 0 :(得分:0)
根据DockPanel Suite文档(http://docs.dockpanelsuite.com/en/latest/tutorials/customizing-floatwindow.html),您确实需要创建自定义浮动窗口工厂:
接下来,创建一个工厂类以创建CustomFloatWindow。这是 通过实现IFloatWindowFactory接口来完成
public class CustomFloatWindowFactory : DockPanelExtender.IFloatWindowFactory { public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds) { return new CustomFloatWindow(dockPanel, pane, bounds); } public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane) { return new CustomFloatWindow(dockPanel, pane); } }
最后,将新工厂附加到DockPanel控件上,
this.dockPanel.Extender.FloatWindowFactory = new CustomFloatWindowFactory();