当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.Button类代码示例

本文整理汇总了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 ();
        }
开发者ID:HackerBaloo,项目名称:minesweeper,代码行数:25,代码来源:Main.cs

示例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();
        }
开发者ID:oraora81,项目名称:NOCmono,代码行数:26,代码来源:MainWindow_Event.cs

示例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 ();
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:25,代码来源:DefaultMonitorPad.cs

示例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 ();
        }
开发者ID:JulianaCFS,项目名称:Proyecto,代码行数:27,代码来源:BebidasCalientesView.cs

示例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();
        }
开发者ID:nerea123,项目名称:ad,代码行数:30,代码来源:ArticuloListView.cs

示例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);
        }
开发者ID:iainlane,项目名称:f-spot,代码行数:29,代码来源:ProgressDialog.cs

示例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;
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:27,代码来源:ItemAction.cs

示例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();
    }
开发者ID:dineshkummarc,项目名称:chronojump,代码行数:35,代码来源:pulse.cs

示例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;
		}
开发者ID:akrisiun,项目名称:gtk-sharp,代码行数:37,代码来源:ScribbleXInput.cs

示例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();
		}
开发者ID:hpbaotho,项目名称:supos,代码行数:33,代码来源:ViewNameIcon.cs

示例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();
    }
开发者ID:MonoBrasil,项目名称:historico,代码行数:28,代码来源:ExportDialog.cs

示例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 ();
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:27,代码来源:MonoMacPackagingSettingsDialog.cs

示例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 ();
 }
开发者ID:githuis,项目名称:BolPatcher,代码行数:33,代码来源:BolPatcher.MenuGameWidget.cs

示例14: base

 public AñadirNumPersonas(Label labelTotalMainWindow,Button botonNP)
     : base(Gtk.WindowType.Toplevel)
 {
     this.Build ();
     botonNuevoPedidoMainWindow = botonNP;
     totalMainWindow = labelTotalMainWindow;
 }
开发者ID:JulianaCFS,项目名称:Proyecto,代码行数:7,代码来源:AñadirNumPersonas.cs

示例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);
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:34,代码来源:NotificationArea.cs


注:本文中的Gtk.Button类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。