glade gui编辑器为gtk-sharp3

时间:2016-12-29 07:25:34

标签: user-interface gtk3 gtk# glade

我遵循了这个官方指南:http://www.mono-project.com/docs/gui/gtksharp/beginners-guide/

正如该教程所说,我的gui.glade是:

<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>

<widget class="GtkWindow" id="window1">
  <property name="visible">True</property>
  <property name="title" translatable="yes">Glade Window</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_CENTER</property>
  <property name="modal">False</property>
  <property name="default_width">256</property>
  <property name="default_height">256</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
  <property name="focus_on_map">True</property>

  <child>
    <widget class="GtkScrolledWindow" id="scrolledwindow1">
      <property name="visible">True</property>
      <property name="can_focus">True</property>
      <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
      <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
      <property name="shadow_type">GTK_SHADOW_IN</property>
      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>

      <child>
    <widget class="GtkLayout" id="layout1">
      <property name="visible">True</property>
      <property name="width">400</property>
      <property name="height">400</property>
      <property name="hadjustment">0 0 400 10 212.4 236</property>
      <property name="vadjustment">0 0 400 10 212.4 236</property>

      <child>
        <widget class="GtkLabel" id="label1">
          <property name="width_request">38</property>
          <property name="height_request">17</property>
          <property name="visible">True</property>
          <property name="label" translatable="yes">label1</property>
          <property name="use_underline">False</property>
          <property name="use_markup">False</property>
          <property name="justify">GTK_JUSTIFY_LEFT</property>
          <property name="wrap">False</property>
          <property name="selectable">False</property>
          <property name="xalign">0.5</property>
          <property name="yalign">0.5</property>
          <property name="xpad">0</property>
          <property name="ypad">0</property>
          <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
          <property name="width_chars">-1</property>
          <property name="single_line_mode">False</property>
          <property name="angle">0</property>
        </widget>
        <packing>
          <property name="x">96</property>
          <property name="y">88</property>
        </packing>
      </child>

      <child>
        <widget class="GtkButton" id="button1">
          <property name="width_request">60</property>
          <property name="height_request">27</property>
          <property name="visible">True</property>
          <property name="can_focus">True</property>
          <property name="label" translatable="yes">button1</property>
          <property name="use_underline">True</property>
          <property name="relief">GTK_RELIEF_NORMAL</property>
          <property name="focus_on_click">True</property>
        </widget>
        <packing>
          <property name="x">88</property>
          <property name="y">168</property>
        </packing>
      </child>
    </widget>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>

编译命令:

mcs -pkg:glade-sharp-2.0 -resource:gui.glade glade.cs

我很高兴它工作正常。但是,当然,我不想在没有设计师的情况下编写gui设计器代码,所以我安装了Glade编辑器(版本3.20)。但是Glade拒绝打开上面的文件。我还注意到Glade生成的语法完全不同:glade标签而不是glade-interface,object而不是widget等。

你能否提供一些技巧,让gui设计师适合gtk-sharp3?此外,Glade生成的.glade文件不能与gtk#3.0一起使用。

0 个答案:

没有答案