本文整理汇总了C#中Gtk.Window.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Dispose方法的具体用法?C# Window.Dispose怎么用?C# Window.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Window
的用法示例。
在下文中一共展示了Window.Dispose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNewWordToDic
public static void AddNewWordToDic(object sender, EventArgs e)
{
var win = new Gtk.Window("Přidej slovo");
win.SetPosition( WindowPosition.Mouse );
Label l = new Label();
l.Text = "Vloží slovo do aktuálně načteného slovníku, avšak nezmění zdroj (např. soubor dic.txt )";
Entry entry = new Entry();
Button b = new Button("Přidej");
VBox vbox = new VBox();
HBox hbox = new HBox();
vbox.BorderWidth = 10;
vbox.PackStart( l );
vbox.PackEnd( hbox );
hbox.PackStart( entry );
hbox.PackEnd( b );
b.Clicked += delegate {
game.dictionary.Add( entry.Text );
win.HideAll();
win.Destroy();
win.Dispose();
};
win.Add(vbox);
win.ShowAll();
}
示例2: CheckWordDialog
public static void CheckWordDialog(object sender, EventArgs e)
{
var lab = new Gtk.Label("Zadejte slovo: ");
var ent = new Gtk.Entry();
var but = new Gtk.Button("OK");
var div = new Gtk.HBox(false, 1 );
div.PackStart( lab );
div.Add( ent );
div.PackEnd( but );
var checkWin = new Gtk.Window( Gtk.WindowType.Popup );
checkWin.Add ( div );
checkWin.BorderWidth = 0;
checkWin.Modal = true;
checkWin.CanFocus = true;
checkWin.SetPosition( WindowPosition.Mouse );
checkWin.ShowAll();
ent.Activated += delegate {
but.Click();
};
but.Clicked += delegate {
checkWin.HideAll();
if( game.dictionary.Content( ent.Text ) ) {
Gtk.MessageDialog ans = new Gtk.MessageDialog(
game.Window,
DialogFlags.DestroyWithParent,
MessageType.Info,
ButtonsType.Close,
"Slovo \""+ent.Text+"\" <b>je</b> ve slovníku"
);
ans.Run();
ans.Destroy();
}
else {
Gtk.MessageDialog ans = new Gtk.MessageDialog(
game.Window,
DialogFlags.DestroyWithParent,
MessageType.Info,
ButtonsType.Close,
"Slovo \""+ent.Text+"\" <b>není</b> ve slovníku"
);
ans.Run();
ans.Destroy();
}
checkWin.Dispose();
checkWin.Destroy();
};
checkWin.KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
switch( args.Event.Key ) {
case Gdk.Key.Escape:
checkWin.HideAll();
checkWin.Dispose();
checkWin.Destroy();
break;
case Gdk.Key.ISO_Enter:
but.Click();
break;
}
};
}
示例3: NextPlayer
public static void NextPlayer(string name)
{
var but = new Gtk.Button( );
but.TooltipMarkup = "Po kliknutí bude hrát další hráč";
HBox hbox = new HBox();
global::Gtk.Image im = new global::Gtk.Image ();
Label l = new Label();
l.Markup = "Na tahu je hráč:\n <b>" + name + "</b>\n\nOK";
hbox.PackStart( im );
hbox.PackEnd( l );
but.Add( hbox );
var win = new Gtk.Window( Gtk.WindowType.Toplevel );
but.Clicked += delegate {
win.HideAll();
win.Dispose();
win.Destroy();
};
win.Add( but );
win.Fullscreen();
win.ShowAll();
}