本文整理汇总了C#中Gtk.Button类的典型用法代码示例。如果您正苦于以下问题:C# Button类的具体用法?C# Button怎么用?C# Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Button类属于Gtk命名空间,在下文中一共展示了Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
uint rows = 5;
uint columns = 5;
uint spacing = 2;
Application.Init ();
Window win = new Window ("Minesweeper");
var table = new global::Gtk.Table (rows, columns, false);
table.RowSpacing = (spacing);
table.ColumnSpacing = (spacing);
for (uint row = 0; row < rows; row++) {
for (uint column = 0; column < columns; column++) {
var button = new Button();
button.CanFocus = true;
button.Label = (string.Empty.PadLeft(5));
button.Clicked += new EventHandler(OnButtonClicked);
table.Attach(button, row, row+1,column, column+1);
}
}
table.ShowAll();
win.Add(table);
win.Show ();
Application.Run ();
}
示例2: MainWindow_Event
public MainWindow_Event()
: base("")
{
SetDefaultSize(250, 200);
SetPosition(WindowPosition.Center);
DeleteEvent += delegate { Application.Quit(); };
Fixed fix = new Fixed();
Button btn = new Button("Enter");
btn.EnterNotifyEvent += OnEnter;
_quit = new Button("Quit");
//_quit.Clicked += OnClick;
_quit.SetSizeRequest(80, 35);
CheckButton cb = new CheckButton("connect");
cb.Toggled += OnToggled;
fix.Put(btn, 50, 20);
fix.Put(_quit, 50, 50);
fix.Put(cb, 120, 20);
Add(fix);
ShowAll();
}
示例3: Button
void IPadContent.Initialize (IPadWindow window)
{
this.window = window;
window.Icon = icon;
DockItemToolbar toolbar = window.GetToolbar (PositionType.Right);
buttonStop = new Button (new Gtk.Image ("gtk-stop", IconSize.Menu));
buttonStop.Clicked += new EventHandler (OnButtonStopClick);
buttonStop.TooltipText = GettextCatalog.GetString ("Stop");
toolbar.Add (buttonStop);
buttonClear = new Button (new Gtk.Image ("gtk-clear", IconSize.Menu));
buttonClear.Clicked += new EventHandler (OnButtonClearClick);
buttonClear.TooltipText = GettextCatalog.GetString ("Clear console");
toolbar.Add (buttonClear);
buttonPin = new ToggleButton ();
buttonPin.Image = new Gtk.Image ((IconId)"md-pin-up", IconSize.Menu);
buttonPin.Image.ShowAll ();
buttonPin.Clicked += new EventHandler (OnButtonPinClick);
buttonPin.TooltipText = GettextCatalog.GetString ("Pin output pad");
toolbar.Add (buttonPin);
toolbar.ShowAll ();
}
示例4: BebidasCalientesView
public BebidasCalientesView(Label labelTotalMainWindow,Button botonNP)
: base(Gtk.WindowType.Toplevel)
{
this.Build ();
labelBebidasCalientes.Markup = "<span size='xx-large' weight='bold'>Bebidas Calientes</span>";
botonNuevoPedidoMainWindow = botonNP;
totalMainWindow = labelTotalMainWindow;
dbConnection = ApplicationContext.Instance.DbConnection;
//hacer la consulta bd
IDbCommand dbCommand = dbConnection.CreateCommand ();
dbCommand.CommandText =
"select * from bebidascalientes ";
IDataReader dataReader = dbCommand.ExecuteReader ();
//Aquí creamos un objeto de la clase RellenarTreeView y le pasamos a la clase el treeView y el dataReader
RellenarTreeView rellenar =new RellenarTreeView();
rellenar.llenarTreeView(treeView, dataReader);
//recogemos el listStore que usamos en la clase RellenarTreeView, para ser usada en los los métodos en esa clase
listStore = rellenar.get_ListStore();
dataReader.Close ();
}
示例5: creaVentanaArticulo
public void creaVentanaArticulo()
{
titulo="Añadir articulo";
ventana(titulo);
Label cat=new Label("Introduce el nombre del nuevo articulo: ");
text= new Entry();
ComboBox cb=new ComboBox();
Label cat2=new Label("Selecciona la categoria: ");
combot= new ComboBoxHelper(App.Instance.DbConnection,cb,"nombre","id",0,"categoria");
tabla.Attach(cat,0,1,0,1);
tabla.Attach(text,1,2,0,1);
tabla.Attach(cat2,0,1,1,2);
tabla.Attach(cb,1,2,1,2);
Label pre=new Label("Introduce el precio del nuevo articulo: ");
precio=new Entry();
tabla.Attach(pre,0,1,2,3);
tabla.Attach(precio,1,2,2,3);
Button button=new Button("Añadir");
button.Clicked +=delegate{
añadirArticulo(App.Instance.DbConnection);
if(!enBlanco){
window.Destroy();
refresh();
}
};
tabla.Attach(button,1,2,3,4);
window.Add(vbox);
window.ShowAll();
}
示例6: ProgressDialog
public ProgressDialog(string title, CancelButtonType cancel_button_type, int total_count, Gtk.Window parent_window)
{
Title = title;
this.total_count = total_count;
if (parent_window != null)
this.TransientFor = parent_window;
HasSeparator = false;
BorderWidth = 6;
SetDefaultSize (300, -1);
message_label = new Label (String.Empty);
VBox.PackStart (message_label, true, true, 12);
progress_bar = new ProgressBar ();
VBox.PackStart (progress_bar, true, true, 6);
switch (cancel_button_type) {
case CancelButtonType.Cancel:
button = (Gtk.Button)AddButton (Gtk.Stock.Cancel, (int) ResponseType.Cancel);
break;
case CancelButtonType.Stop:
button = (Gtk.Button)AddButton (Gtk.Stock.Stop, (int) ResponseType.Cancel);
break;
}
Response += new ResponseHandler (HandleResponse);
}
示例7: GetButton
public static Widget GetButton (Action action, bool label)
{
Widget w = action.CreateIcon (IconSize.Button);
if (label) {
HBox box = new HBox ();
box.PackStart (w, false, false, 0);
Label l = new Label ();
l.Markup = "<small>" + action.Label + "</small>";
box.PackStart (l);
w = box;
}
Button button;
if (action is ToggleAction) {
ToggleButton toggle = new ToggleButton ();
toggle.Active = ((ToggleAction)action).Active;
button = toggle;
} else {
button = new Button ();
}
button.Relief = ReliefStyle.None;
button.Add (w);
w.ShowAll ();
action.ConnectProxy (button);
tips.SetTip (button, action.Tooltip, String.Empty);
return button;
}
示例8: PulseExecute
//execution
public PulseExecute(int personID, string personName, int sessionID, string type, double fixedPulse, int totalPulsesNum,
Chronopic cp, Gtk.TextView event_execute_textview_message, Gtk.Window app, int pDN, bool volumeOn,
//double progressbarLimit,
ExecutingGraphData egd
)
{
this.personID = personID;
this.personName = personName;
this.sessionID = sessionID;
this.type = type;
this.fixedPulse = fixedPulse;
this.totalPulsesNum = totalPulsesNum;
this.cp = cp;
this.event_execute_textview_message = event_execute_textview_message;
this.app = app;
this.pDN = pDN;
this.volumeOn = volumeOn;
// this.progressbarLimit = progressbarLimit;
this.egd = egd;
fakeButtonUpdateGraph = new Gtk.Button();
fakeButtonEventEnded = new Gtk.Button();
fakeButtonFinished = new Gtk.Button();
simulated = false;
needUpdateEventProgressBar = false;
needUpdateGraph = false;
//initialize eventDone as a Pulse
eventDone = new Pulse();
}
示例9: Main15
//private static Gdk.Pixmap pixmap = null;
//private static Gtk.InputDialog inputDialog = null;
public static int Main15 (string[] args) {
Application.Init ();
win = new Gtk.Window ("Scribble XInput Demo");
win.DeleteEvent += new DeleteEventHandler (WindowDelete);
vBox = new VBox (false, 0);
win.Add (vBox);
darea = new Gtk.DrawingArea ();
darea.SetSizeRequest (200, 200);
// darea.ExtensionEvents=ExtensionMode.Cursor;
vBox.PackStart (darea, true, true, 0);
//darea.ExposeEvent += new ExposeEventHandler (ExposeEvent);
darea.ConfigureEvent += new ConfigureEventHandler (ConfigureEvent);
darea.MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotifyEvent);
darea.ButtonPressEvent += new ButtonPressEventHandler (ButtonPressEvent);
darea.Events = EventMask.ExposureMask | EventMask.LeaveNotifyMask |
EventMask.ButtonPressMask | EventMask.PointerMotionMask;
inputButton = new Button("Input Dialog");
vBox.PackStart (inputButton, false, false, 0);
inputButton.Clicked += new EventHandler (InputButtonClicked);
quitButton = new Button("Quit");
vBox.PackStart (quitButton, false, false, 0);
quitButton.Clicked += new EventHandler (QuitButtonClicked);
win.ShowAll ();
Application.Run ();
return 0;
}
示例10: ViewNameIcon
public ViewNameIcon() : base()
{
upbutton = new Button();
upbutton.Add( new Image(Stock.GoUp, IconSize.Button) );
upbutton.Clicked += OnUpClicked;
downbutton = new Button();
downbutton.Add( new Image(Stock.GoDown, IconSize.Button) );
downbutton.Clicked += OnDownClicked;
swindow = new ScrolledWindow();
view = new IconView();
CellRendererPixbuf cellicon= new CellRendererPixbuf();
CellRendererText celltext = new CellRendererText();
celltext.Xalign=0.5f;
view.PackStart(cellicon, false);
view.SetCellDataFunc(cellicon, CellRenderFunctions.RenderIcon);
view.PackStart(celltext, false);
view.SetCellDataFunc(celltext, CellRenderFunctions.RenderName);
view.SelectionMode = Gtk.SelectionMode.Browse;
view.SelectionChanged += OnSelectionChanged;
view.ItemActivated += OnRowActivated;
swindow.Add(view);
swindow.HscrollbarPolicy = PolicyType.Never;
swindow.VscrollbarPolicy = PolicyType.Automatic;
this.PackStart(upbutton, false, false, 0);
this.PackStart(swindow, true, true, 0);
this.PackStart(downbutton, false, false, 0);
store = new StoreBase();
view.Model=store.ViewModel;
ShowAll();
}
示例11: ExportDialog
public ExportDialog(Catalog catalog, bool searchOn)
: base(Mono.Posix.Catalog.GetString ("Export"), null, DialogFlags.NoSeparator | DialogFlags.Modal)
{
this.catalog = catalog;
this.templates = new Hashtable ();
this.searchOn = searchOn;
Glade.XML gxml = new Glade.XML (null, "dialogexport.glade", "hbox1", null);
gxml.Autoconnect(this);
cancelButton = (Button)this.AddButton (Gtk.Stock.Cancel, 0);
okButton = (Button)this.AddButton (Gtk.Stock.Ok, 1);
cancelButton.Clicked += OnCancelButtonClicked;
okButton.Clicked += OnOkButtonClicked;
VBox vBox = this.VBox;
vBox.Add ((Box)gxml["hbox1"]);
PopulateComboBox ();
if (!searchOn) {
radioButtonSearch.Sensitive = false;
}
radioButtonActive.Label = String.Format (Mono.Posix.Catalog.GetString ("Export the whole {0} catalog"),catalog.ShortDescription);
this.ShowAll();
}
示例12: MonoMacPackagingSettingsDialog
public MonoMacPackagingSettingsDialog ()
{
this.Title = GettextCatalog.GetString ("Create Mac Installer");
this.DestroyWithParent = true;
this.Modal = true;
settingsWidget.Show ();
var al = new Alignment (0.5f, 0.5f, 1.0f, 1.0f) {
TopPadding = 12,
BottomPadding = 12,
RightPadding = 12,
LeftPadding = 12,
Child = settingsWidget,
};
al.Show ();
this.VBox.PackStart (al, true, true, 0);
var okButton = new Button () {
Label = GettextCatalog.GetString ("Create Package")
};
var cancelButton = new Button (Stock.Cancel);
this.AddActionWidget (cancelButton, ResponseType.Cancel);
this.AddActionWidget (okButton, ResponseType.Ok);
this.ActionArea.ShowAll ();
}
示例13: Build
protected virtual void Build()
{
Gui.Initialize (this);
// Widget BolPatcher.MenuGameWidget
BinContainer.Attach (this);
Name = "BolPatcher.MenuGameWidget";
// Container child BolPatcher.MenuGameWidget.Gtk.Container+ContainerChild
_frame1 = new Frame ();
_frame1.Name = "frame1";
_frame1.ShadowType = 0;
// Container child frame1.Gtk.Container+ContainerChild
_gtkAlignment = new Alignment (0F, 0F, 1F, 1F);
_gtkAlignment.Name = "GtkAlignment";
_gtkAlignment.LeftPadding = 12;
// Container child GtkAlignment.Gtk.Container+ContainerChild
_button2 = new Button ();
_button2.CanFocus = true;
_button2.Name = "button2";
_button2.UseUnderline = true;
_button2.Label = Catalog.GetString ("GtkButton");
_gtkAlignment.Add (_button2);
_frame1.Add (_gtkAlignment);
_gtkLabel1 = new Label ();
_gtkLabel1.Name = "GtkLabel1";
_gtkLabel1.LabelProp = Catalog.GetString ("<b>GtkFrame</b>");
_gtkLabel1.UseMarkup = true;
_frame1.LabelWidget = _gtkLabel1;
Add (_frame1);
if ((Child != null)) {
Child.ShowAll ();
}
Hide ();
}
示例14: base
public AñadirNumPersonas(Label labelTotalMainWindow,Button botonNP)
: base(Gtk.WindowType.Toplevel)
{
this.Build ();
botonNuevoPedidoMainWindow = botonNP;
totalMainWindow = labelTotalMainWindow;
}
示例15: NotificationMessage
public NotificationMessage (string t, string m) : base (false, 5)
{
this.Style = style;
BorderWidth = 5;
icon = new Image (Stock.DialogInfo, IconSize.Dialog);
this.PackStart (icon, false, true, 5);
VBox vbox = new VBox (false, 5);
this.PackStart (vbox, true, true, 0);
title = new Label ();
title.SetAlignment (0.0f, 0.5f);
this.Title = t;
vbox.PackStart (title, false, true, 0);
message = new Label ();
message.LineWrap = true;
message.SetSizeRequest (500, -1); // ugh, no way to sanely reflow a gtk label
message.SetAlignment (0.0f, 0.0f);
this.Message = m;
vbox.PackStart (message, true, true, 0);
action_box = new HBox (false, 3);
Button hide_button = new Button (Catalog.GetString ("Hide"));
hide_button.Clicked += OnHideClicked;
action_box.PackEnd (hide_button, false, true, 0);
Alignment action_align = new Alignment (1.0f, 0.5f, 0.0f, 0.0f);
action_align.Add (action_box);
vbox.PackStart (action_align, false, true, 0);
}