0

我对 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;
    }
}

但是,通过这种方法, my 的MaximizeBoxandMinimizeBox属性DockContent不受尊重。我将如何实现这一点?

4

1 回答 1

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();
于 2018-07-28T15:57:33.113 回答