0

大家好,

我正在玩monodevelop,并在窗口中使用gtk。目前我正在使用 Windows 7 x64。

我遇到的问题是,当我最大化窗口(手动或通过程序,没关系)时,页面顶部仍有一些空间。而且它在屏幕底部不能很好地连接。所以看起来整个程序被最大化了,然后放下了几个像素。

这是最大化窗口的屏幕截图: 最大化窗口

正如您在第二个打印屏幕中看到的那样,可以将程序置于该顶部: 可以到达顶部的小窗户

所以我的问题很简单......我怎样才能以正常的方式最大化窗口......

编辑 MainWindow.cs 中的代码( root/gtk-gui/MainWindow.cs )

// This file has been generated by the GUI designer. Do not modify.
public partial class MainWindow
{
    private global::Gtk.UIManager UIManager;
    private global::Gtk.Action FileAction;
    private global::Gtk.Action stopAction;
    private global::Gtk.HPaned hpaned1;
    private global::Gtk.VBox vbox1;
    private global::Gtk.MenuBar menubar2;
    private global::Gtk.HBox hbox1;
    private global::Gtk.Button button1;
    private global::Gtk.HPaned hpaned3;
    private global::Gtk.ScrolledWindow GtkScrolledWindow;
    private global::Gtk.TreeView treeview1;
    private global::Gtk.ProgressBar progressbar1;

    protected virtual void Build ()
    {
        global::Stetic.Gui.Initialize (this);
        // Widget MainWindow
        this.UIManager = new global::Gtk.UIManager ();
        global::Gtk.ActionGroup w1 = new global::Gtk.ActionGroup ("Default");
        this.FileAction = new global::Gtk.Action ("FileAction", global::Mono.Unix.Catalog.GetString ("File"), null, null);
        this.FileAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("File");
        w1.Add (this.FileAction, null);
        this.stopAction = new global::Gtk.Action ("stopAction", global::Mono.Unix.Catalog.GetString ("Exit"), null, "gtk-stop");
        this.stopAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Exit");
        w1.Add (this.stopAction, null);
        this.UIManager.InsertActionGroup (w1, 0);
        this.AddAccelGroup (this.UIManager.AccelGroup);
        this.Name = "MainWindow";
        this.Title = global::Mono.Unix.Catalog.GetString ("Maximized Window");
        this.WindowPosition = ((global::Gtk.WindowPosition)(3));
        this.AllowShrink = true;
        this.DefaultWidth = 1024;
        this.DefaultHeight = 768;
        // Container child MainWindow.Gtk.Container+ContainerChild
        this.hpaned1 = new global::Gtk.HPaned ();
        this.hpaned1.CanFocus = true;
        this.hpaned1.Name = "hpaned1";
        this.hpaned1.Position = 1;
        // Container child hpaned1.Gtk.Paned+PanedChild
        this.vbox1 = new global::Gtk.VBox ();
        this.vbox1.Name = "vbox1";
        this.vbox1.Spacing = 6;
        // Container child vbox1.Gtk.Box+BoxChild
        this.UIManager.AddUiFromString ("<ui><menubar name=\'menubar2\'><menu name=\'FileAction\' action=\'FileAction\'><menuite" +
                "m name=\'stopAction\' action=\'stopAction\'/></menu></menubar></ui>");
        this.menubar2 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget ("/menubar2")));
        this.menubar2.Name = "menubar2";
        this.vbox1.Add (this.menubar2);
        global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.menubar2]));
        w2.Position = 0;
        w2.Expand = false;
        w2.Fill = false;
        // Container child vbox1.Gtk.Box+BoxChild
        this.hbox1 = new global::Gtk.HBox ();
        this.hbox1.Name = "hbox1";
        this.hbox1.Spacing = 6;
        // Container child hbox1.Gtk.Box+BoxChild
        this.button1 = new global::Gtk.Button ();
        this.button1.CanFocus = true;
        this.button1.Name = "button1";
        this.button1.UseUnderline = true;
        this.button1.Label = global::Mono.Unix.Catalog.GetString ("GtkButton");
        this.hbox1.Add (this.button1);
        global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.button1]));
        w3.Position = 1;
        w3.Expand = false;
        w3.Fill = false;
        this.vbox1.Add (this.hbox1);
        global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox1]));
        w4.Position = 1;
        w4.Expand = false;
        w4.Fill = false;
        // Container child vbox1.Gtk.Box+BoxChild
        this.hpaned3 = new global::Gtk.HPaned ();
        this.hpaned3.CanFocus = true;
        this.hpaned3.Name = "hpaned3";
        this.hpaned3.Position = 91;
        this.hpaned3.BorderWidth = ((uint)(2));
        // Container child hpaned3.Gtk.Paned+PanedChild
        this.GtkScrolledWindow = new global::Gtk.ScrolledWindow ();
        this.GtkScrolledWindow.Name = "GtkScrolledWindow";
        this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
        // Container child GtkScrolledWindow.Gtk.Container+ContainerChild
        this.treeview1 = new global::Gtk.TreeView ();
        this.treeview1.CanFocus = true;
        this.treeview1.Name = "treeview1";
        this.GtkScrolledWindow.Add (this.treeview1);
        this.hpaned3.Add (this.GtkScrolledWindow);
        global::Gtk.Paned.PanedChild w6 = ((global::Gtk.Paned.PanedChild)(this.hpaned3 [this.GtkScrolledWindow]));
        w6.Resize = false;
        this.vbox1.Add (this.hpaned3);
        global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hpaned3]));
        w7.Position = 2;
        // Container child vbox1.Gtk.Box+BoxChild
        this.progressbar1 = new global::Gtk.ProgressBar ();
        this.progressbar1.Name = "progressbar1";
        this.vbox1.Add (this.progressbar1);
        global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.progressbar1]));
        w8.Position = 3;
        w8.Expand = false;
        w8.Fill = false;
        this.hpaned1.Add (this.vbox1);
        this.Add (this.hpaned1);
        if ((this.Child != null)) {
            this.Child.ShowAll ();
        }
        this.Show ();
        this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent);
        this.stopAction.Activated += new global::System.EventHandler (this.stopProgram);
    }
}
4

1 回答 1

1

我可以在我的 Windows 8 机器上成功重现此行为。

它似乎来自于WindowPositionset to CenterAlways。然而,文档警告我们使用:

请注意,使用GTK_WIN_POS_CENTER_ALWAYS几乎总是一个坏主意。它不一定适用于所有窗口管理器或所有窗口系统。

设置WindowPositionNone(0) 为我解决了这个问题。

于 2013-06-11T09:50:15.030 回答