本文整理汇总了C#中Gtk.Button.Click方法的典型用法代码示例。如果您正苦于以下问题:C# Button.Click方法的具体用法?C# Button.Click怎么用?C# Button.Click使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Button
的用法示例。
在下文中一共展示了Button.Click方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
};
}
示例2: NoteRenameDialog
public NoteRenameDialog (IList<Note> notes, string oldTitle, Note renamedNote) :
base (Catalog.GetString ("Rename Note Links?"), renamedNote.Window, 0)
{
this.DefaultResponse = ResponseType.Cancel;
this.BorderWidth = 10;
var renameButton = (Button)
AddButton (Catalog.GetString ("_Rename Links"),
ResponseType.Yes);
var dontRenameButton = (Button)
AddButton (Catalog.GetString ("_Don't Rename Links"),
ResponseType.No);
this.notes = notes;
notesModel = new Gtk.TreeStore (typeof (bool), typeof (string), typeof (Note));
foreach (var note in notes)
notesModel.AppendValues (true, note.Title, note);
var labelText = Catalog.GetString ("Rename links in other notes from \"<span underline=\"single\">{0}</span>\" " +
"to \"<span underline=\"single\">{1}</span>\"?\n\n" +
"If you do not rename the links, " +
"they will no longer link to anything.");
var label = new Label ();
label.UseMarkup = true;
label.Markup = String.Format (labelText,
GLib.Markup.EscapeText (oldTitle),
GLib.Markup.EscapeText (renamedNote.Title));
label.LineWrap = true;
ContentArea.PackStart (label, false, true, 5);
var notesView = new TreeView (notesModel);
notesView.SetSizeRequest (-1, 200);
var toggleCell = new CellRendererToggle ();
toggleCell.Activatable = true;
var column = new TreeViewColumn (Catalog.GetString ("Rename Links"),
toggleCell, "active", 0);
column.SortColumnId = 0;
column.Resizable = true;
notesView.AppendColumn (column);
toggleCell.Toggled += (o, args) => {
TreeIter iter;
if (!notesModel.GetIterFromString (out iter, args.Path))
return;
bool val = (bool) notesModel.GetValue (iter, 0);
notesModel.SetValue (iter, 0, !val);
};
column = new TreeViewColumn (Catalog.GetString ("Note Title"),
new CellRendererText (), "text", 1);
column.SortColumnId = 1;
column.Resizable = true;
notesView.AppendColumn (column);
notesView.RowActivated += (o, args) => {
TreeIter iter;
if (!notesModel.GetIter (out iter, args.Path))
return;
Note note = (Note) notesModel.GetValue (iter, 2);
if (note != null) {
note.Window.Present ();
NoteFindBar find = note.Window.Find;
find.ShowAll ();
find.Visible = true;
find.SearchText = "\"" + oldTitle + "\"";
}
};
var notesBox = new VBox (false, 5);
var selectAllButton = new Button ();
// Translators: This button causes all notes in the list to be selected
selectAllButton.Label = Catalog.GetString ("Select All");
selectAllButton.Clicked += (o, e) => {
notesModel.Foreach ((model, path, iter) => {
notesModel.SetValue (iter, 0, true);
return false;
});
};
var selectNoneButton = new Button ();
// Translators: This button causes all notes in the list to be unselected
selectNoneButton.Label = Catalog.GetString ("Select None");
selectNoneButton.Clicked += (o, e) => {
notesModel.Foreach ((model, path, iter) => {
notesModel.SetValue (iter, 0, false);
return false;
});
};
var notesButtonBox = new HButtonBox ();
notesButtonBox.Add (selectNoneButton);
notesButtonBox.Add (selectAllButton);
notesButtonBox.Spacing = 5;
notesButtonBox.LayoutStyle = ButtonBoxStyle.End;
var notesScroll = new ScrolledWindow ();
notesScroll.Add (notesView);
notesBox.PackStart (notesScroll, true, true, 0);
notesBox.PackStart (notesButtonBox, false, true, 0);
var advancedExpander = new Expander (Catalog.GetString ("Ad_vanced"));
var expandBox = new VBox ();
expandBox.PackStart (notesBox, true, true, 0);
alwaysShowDlgRadio = new RadioButton (Catalog.GetString ("Always show this _window"));
alwaysShowDlgRadio.Clicked += (o, e) => {
//.........这里部分代码省略.........