本文整理汇总了C#中Gtk.Table.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Table.Add方法的具体用法?C# Table.Add怎么用?C# Table.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Table
的用法示例。
在下文中一共展示了Table.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TableAddRow
static void TableAddRow (Table table, uint row, Widget column1, Widget column2)
{
uint rows = table.NRows;
Table.TableChild tr;
table.NRows = rows + 1;
foreach (var child in table.Children) {
tr = (Table.TableChild) table[child];
uint bottom = tr.BottomAttach;
uint top = tr.TopAttach;
if (top >= row && top < rows) {
tr.BottomAttach = bottom + 1;
tr.TopAttach = top + 1;
}
}
if (column1 != null) {
table.Add (column1);
tr = (Table.TableChild) table[column1];
tr.XOptions = (AttachOptions) 4;
tr.YOptions = (AttachOptions) 4;
tr.BottomAttach = row + 1;
tr.TopAttach = row;
tr.LeftAttach = 0;
tr.RightAttach = 1;
}
if (column2 != null) {
table.Add (column2);
tr = (Table.TableChild) table[column2];
tr.XOptions = (AttachOptions) 4;
tr.YOptions = (AttachOptions) 4;
tr.BottomAttach = row + 1;
tr.TopAttach = row;
tr.LeftAttach = 1;
tr.RightAttach = 2;
}
}
示例2: ConfigWindow
public ConfigWindow(Window owner)
: base("config")
{
this.WidthRequest = 500;
this.HeightRequest = 300;
this.ShowMinimize = false;
this.Modal = true;
this.WindowPosition = Gtk.WindowPosition.None;
int root_x, root_y;
owner.GetPosition(out root_x, out root_y);
this.Move(root_x + (owner.WidthRequest / 2) - (this.WidthRequest / 2),
root_y + (owner.HeightRequest / 2) - (this.HeightRequest / 2));
this.lblPort = new global::Gtk.Label();
this.lblPort.LabelProp = "Server Port:";
this.GridMain.Add(this.lblPort);
global::Gtk.Fixed.FixedChild w2 = ((global::Gtk.Fixed.FixedChild)(this.GridMain[this.lblPort]));
w2.X = 40;
w2.Y = 62;
this.txtPort = new global::Gtk.Entry();
this.txtPort.WidthRequest = 100;
this.GridMain.Add(this.txtPort);
w2 = ((global::Gtk.Fixed.FixedChild)(this.GridMain[this.txtPort]));
w2.X = 110;
w2.Y = 60;
this.cbStartup = new CheckButton();
this.cbStartup.Label = "Start the web server when the PC starts up";
this.GridMain.Add(this.cbStartup);
w2 = ((global::Gtk.Fixed.FixedChild)(this.GridMain[this.cbStartup]));
w2.X = 40;
w2.Y = 85;
this.cbMinimize = new CheckButton();
this.cbMinimize.Label = "Minimize on startup";
this.GridMain.Add(this.cbMinimize);
w2 = ((global::Gtk.Fixed.FixedChild)(this.GridMain[this.cbMinimize]));
w2.X = 40;
w2.Y = 105;
this.swNetworkCards = new ScrolledWindow();
this.swNetworkCards.WidthRequest = 400;
this.swNetworkCards.HeightRequest = 100;
this.swNetworkCards.ShadowType = ((global::Gtk.ShadowType)(1));
this.GridMain.Add(this.swNetworkCards);
w2 = ((global::Gtk.Fixed.FixedChild)(this.GridMain[this.swNetworkCards]));
w2.X = 40;
w2.Y = 130;
this.tNetworkCards = new Table(6, 2, false);
this.tNetworkCards.RowSpacing = (6);
this.tNetworkCards.ColumnSpacing = (6);
global::Gtk.Viewport w1 = new global::Gtk.Viewport();
w1.ShadowType = ((global::Gtk.ShadowType)(0));
w1.Add(tNetworkCards);
this.swNetworkCards.Add(w1);
_lstNetworkCards = new List<NetworkCard>();
List<string> ids = Globals.ReadEnvironmentVariables(Globals.V_NetworkID);
IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName());
NetworkInterface[] netInterfaces = NetworkInterface.GetAllNetworkInterfaces();
uint i = 0;
foreach (NetworkInterface adapter in netInterfaces)
{
var ipProps = adapter.GetIPProperties();
foreach (var ip in ipProps.UnicastAddresses)
{
if (ip.Address.AddressFamily == AddressFamily.InterNetwork)
{
CheckButton cbNetworkCard = new CheckButton();
cbNetworkCard.Active = ids.Contains(adapter.Id);
cbNetworkCard.Label = String.Format("{0} - {1}", adapter.Name, ip.Address.ToString());
this.tNetworkCards.Add(cbNetworkCard);
tNetworkCards.Add(cbNetworkCard);
global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.tNetworkCards[cbNetworkCard]));
w3.TopAttach = i++;
w3.YOptions = ((global::Gtk.AttachOptions)(4));
NetworkCard networkCard = new NetworkCard();
networkCard.ID = adapter.Id;
networkCard.NetworkName = adapter.Name;
networkCard.IPAddress = ip.Address.ToString();
networkCard.CheckBox = cbNetworkCard;
_lstNetworkCards.Add(networkCard);
}
}
}
this.btnApply = new Button();
this.btnApply.Clicked += btnApply_Clicked;
this.btnApply.Label = "Apply";
this.btnApply.WidthRequest = 100;
this.GridMain.Add(this.btnApply);
w2 = ((global::Gtk.Fixed.FixedChild)(this.GridMain[this.btnApply]));
w2.X = 150;
//.........这里部分代码省略.........