【问题标题】:How do I resize a NSWindow when the ContentView is assigned?分配 ContentView 时如何调整 NSWindow 的大小?
【发布时间】:2013-09-25 20:52:12
【问题描述】:

我的 ContentView 可能比我的 NSWindow 稍大。设置新的 ContentView 时如何自动调整大小?

【问题讨论】:

    标签: cocoa xamarin nswindow monomac


    【解决方案1】:

    我不知道自动执行此操作的方法。如果您使用的是 Cocoa 自动布局,这可能是可能的。

    如果您使用常规 springs 和 struts 布局,只需在更改内容视图时调整窗口大小。您可以使用SetFrame 方法调整窗口大小。

    在Objective C中,NSWindow上的相关方法有:

    setFrame:display:

    setFrame:display:animate:

    以及他们在 C# 中的 monomac 等价物:

    public void SetFrame (RectangleF frameRect, bool display)

    public void SetFrame (RectangleF frameRect, bool display, bool animate)

    【讨论】:

      猜你喜欢
      • 2012-08-14
      • 2016-06-18
      • 1970-01-01
      • 2020-05-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多