Center/Right-justify GTK sharp 中的两个标签

Center/Right-justify two labels in GTK sharp

我有两个标签要在 window 内水平对齐,但需要一个居中,另一个右对齐。我如何使用 boxes and/or tables 完成此操作?

我最终创建了一个 HBox 并将其添加到 VBox。我向 HBox 添加了三个小部件:

var hBox = new HBox(true, 0);
hBox.PackStart(new Label(), true, true, 0);
hBox.PackStart(new Alignment(0.5f, 0, 0, 0) { new Label() }, true, true, 0);
hBox.PackStart(new Alignment(1, 0, 0, 0) { new Label() }, true, true, 0);

关键似乎是大小均匀(HBox 构造函数中的真实情况)以及居中和右对齐小部件。