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


C# Window.Add方法代码示例

本文整理汇总了C#中Gtk.Window.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Add方法的具体用法?C# Window.Add怎么用?C# Window.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Window的用法示例。


在下文中一共展示了Window.Add方法的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: Main

        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        private static void Main()
        {
            Application.Init();

            var window = new Window("GtkSharpDemo");
            var plotModel = new PlotModel
                         {
                             Title = "Trigonometric functions",
                             Subtitle = "Example using the FunctionSeries",
                             PlotType = PlotType.Cartesian,
                             Background = OxyColors.White
                         };
            plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)") { Color = OxyColors.Black });
            plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)") { Color = OxyColors.Green });
            plotModel.Series.Add(new FunctionSeries(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 0.1, "cos(t),sin(t)") { Color = OxyColors.Yellow });
            
            var plotView = new OxyPlot.GtkSharp.PlotView { Model = plotModel };
            plotView.SetSizeRequest(400, 400);
            plotView.Visible = true;

            window.SetSizeRequest(600, 600);
            window.Add(plotView);
            window.Focus = plotView;
            window.Show();
            window.DeleteEvent += (s, a) =>
                {
                    Application.Quit();
                    a.RetVal = true;
                };

            Application.Run();
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:35,代码来源:Program.cs

示例3: Main21

		public static void Main21 (string[] args)
		{
			Application.Init();
			Window win = new Window ("Menu Sample App");
			win.DeleteEvent += new DeleteEventHandler (delete_cb);
			win.DefaultWidth = 200;
			win.DefaultHeight = 150;

			VBox box = new VBox (false, 2);

			MenuBar mb = new MenuBar ();
			Menu file_menu = new Menu ();
			MenuItem exit_item = new MenuItem("Exit");
			exit_item.Activated += new EventHandler (exit_cb);
			file_menu.Append (exit_item);
			MenuItem file_item = new MenuItem("File");
			file_item.Submenu = file_menu;
			mb.Append (file_item);
			box.PackStart(mb, false, false, 0);

			Button btn = new Button ("Yep, that's a menu");
			box.PackStart(btn, true, true, 0);
			
			win.Add (box);
			win.ShowAll ();

			Application.Run ();
		}
开发者ID:akrisiun,项目名称:gtk-sharp,代码行数:28,代码来源:Menu.cs

示例4: HeightMapSizeDialog

		public HeightMapSizeDialog( DoneCallback source )
		{
            this.source = source;

			window = new Window ("Heightmap width and height:");
			window.SetDefaultSize (200, 100);

            Table table = new Table( 3, 2, false );
            table.BorderWidth = 20;
            table.RowSpacing = 20;
            table.ColumnSpacing = 20;
            window.Add(table);

            table.Attach(new Label("Width:"), 0, 1, 0, 1);
            table.Attach(new Label("Height:"), 0, 1, 1, 2);

            widthcombo = new Combo();
            widthcombo.PopdownStrings = new string[]{"4","8","12","16","20","24","28","32"};
            table.Attach(widthcombo, 1, 2, 0, 1);

            heightcombo = new Combo();
            heightcombo.PopdownStrings = new string[]{"4","8","12","16","20","24","28","32"};
            table.Attach(heightcombo, 1, 2, 1, 2);

			Button button = new Button (Stock.Ok);
			button.Clicked += new EventHandler (OnOkClicked);
			button.CanDefault = true;
			
            table.Attach(button, 1, 2, 2, 3);

            window.Modal = true;
            window.ShowAll();
		}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:33,代码来源:MainUI.cs

示例5: DoWork

        /// <summary>
        /// Runs in a separate thread.
        /// </summary>
        public void DoWork()
        {
            Application.Init();

            //Create the Window
            myWin = new Window("N'Oubliez pas les paroles  - Fenêtre de contrôle");
            myWin.DeleteEvent += this.OnWindowDeleteEvent;

            vBox = new VBox();
            myWin.Add(vBox);

            myPlayerScoreController = new PlayerScoreController(this);
            vBox.Add(myPlayerScoreController.GetPaneBox());

            mySongTestController = new SongTestController(this);
            vBox.Add(mySongTestController.GetPaneBox());

            // Rend tout visible
            myWin.ShowAll();

            // start the message pump
            messagePumper.Start();

            Application.Run();
        }
开发者ID:Ziple,项目名称:NOubliezPas,代码行数:28,代码来源:GUILauncher.cs

示例6: Main

	static void Main (string [] args)
	{
		Application.Init ();

		if (args.Length <= 0) {
			Console.WriteLine ("\nUSAGE: ImageBrowser.exe <directory>\n");
			return;
		}
	
		string dir = args [0];

		Gtk.Window window = new Gtk.Window ("Image Browser");
		Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow (new Adjustment (IntPtr.Zero), new Adjustment (IntPtr.Zero));

		ArrayList images = GetItemsFromDirectory (dir);
		
		Gtk.Table table = PopulateTable (images);
		
		window.Title = String.Format ("{0}: {1} ({2} images)", window.Title, dir, images.Count);
		window.SetDefaultSize (300, 200);
		window.DeleteEvent += Window_Delete;
		scroll.AddWithViewport (table);
		scroll.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
		window.Add (scroll);
		window.ShowAll ();
		Application.Run ();
	}
开发者ID:emtees,项目名称:old-code,代码行数:27,代码来源:ImageBrowserGtk.cs

示例7: SetView

		protected virtual void SetView (PhotoImageView view)
		{
			if (controls != null)
				controls.Destroy ();

			controls = null;

			this.view = view;
			if (view == null)
				return;

			Widget w = CreateControls ();

			if (w != null) {
#if false
				ControlOverlay c = new ControlOverlay (view);
				c.AutoHide = false;
				w.ShowAll ();
				c.Add (w);
				c.Visibility = ControlOverlay.VisibilityType.Full;
				controls = c;
#else
				Window win = new Window (String.Format ("{0}", GetTitle ()));
				win.TransientFor = (Gtk.Window) view.Toplevel;
				win.Add (w);
				win.ShowAll ();
				win.DeleteEvent += delegate { Destroy (); };
				controls = win;
#endif
			}
			
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:32,代码来源:Editor.cs

示例8: TabbedSkin

		public TabbedSkin(BasilProject project, ITaskBuilder taskBuilder)
		{
			_project = project;
			_tabsToTools = new System.Collections.Hashtable();

			window = new Gtk.Window ("WeSay");
			window.SetDefaultSize (600, 400);
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);

			HBox hbox = new HBox (false, 0);
			window.Add (hbox);

			Notebook notebook = new Notebook ();
			notebook.SwitchPage += new SwitchPageHandler(OnNotebookSwitchPage);
			hbox.PackStart(notebook, true, true, 0);
			foreach (ITask t in taskBuilder.Tasks)
			{
				VBox container = new VBox();
				t.Container = container;
				int i = notebook.AppendPage(container, new Label(t.Label));
				_tabsToTools.Add(i, t);
			}

			window.ShowAll ();
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:25,代码来源:TabbedSkin.cs

示例9: CanvasExample

		public CanvasExample () {
			Gtk.Window win = new Gtk.Window ("Canvas example");
			win.DeleteEvent += new DeleteEventHandler (Window_Delete);

			VBox vbox = new VBox (false, 0);
			win.Add (vbox);

			vbox.PackStart (new Label ("Drag - move object.\n" +
						   "Double click - change color\n" +
						   "Right click - delete object"),
					false, false, 0);
			
			canvas = new Canvas ();
			canvas.SetSizeRequest (width, height);
			canvas.SetScrollRegion (0.0, 0.0, (double) width, (double) height);
			vbox.PackStart (canvas, false, false, 0);

			HBox hbox = new HBox (false, 0);
			vbox.PackStart (hbox, false, false, 0);

			Button add_button = new Button ("Add an object");
			add_button.Clicked += new EventHandler (AddObject);
			hbox.PackStart (add_button, false, false, 0);

			Button quit_button = new Button ("Quit");
			quit_button.Clicked += new EventHandler (Quit);
			hbox.PackStart (quit_button, false, false, 0);

			win.ShowAll ();
		}
开发者ID:directhex,项目名称:xamarin-gnome-sharp2,代码行数:30,代码来源:CanvasExample.cs

示例10: Lesson06

        float rtri; // Angle For The Triangle

        #endregion Fields

        #region Constructors

        public Lesson06()
        {
            // Create a new GLArea widget and request a size
            glarea = new GLArea (attrlist);
            glarea.SetSizeRequest (300, 300);

            // Set some event handlers
            glarea.ExposeEvent += OnExposed;
            glarea.Realized += OnRealized;
            glarea.Unrealized += OnUnrealized;
            glarea.ConfigureEvent += OnConfigure;

            // Create a new Vertical Box that the GLArea can live in
            VBox vb = new VBox (false, 0);

            // Pack the GLArea widget into the VBox
            vb.PackStart (glarea, true, true, 0);

            // Create a new window and name it appropriately
            Window win = new Window ("NeHe Lesson06");

            // Pack the VBox into the window
            win.Add (vb);

            // Show all of win's contained widgets
            win.ShowAll ();
        }
开发者ID:mono,项目名称:gtkglarea-sharp,代码行数:33,代码来源:Lesson06.cs

示例11: Main

    public static void Main(string[] args)
    {
        Gtk.Window window;
          EventBox eventbox;
          Label label;

          Application.Init();

          window = new Gtk.Window ("Eventbox");
          window.DeleteEvent += new DeleteEventHandler (delete_event);

          window.BorderWidth = 10;
          window.Resize(400,300);

          eventbox = new EventBox ();
          window.Add (eventbox);
          eventbox.Show();

          label = new Label ("Click here to quit");
          eventbox.Add(label);
          label.Show();

          label.SetSizeRequest(110, 20);

          eventbox.ButtonPressEvent += new ButtonPressEventHandler (exitbutton_event);

          eventbox.Realize();

          window.Show();

          Application.Run();
    }
开发者ID:BackupTheBerlios,项目名称:genaro,代码行数:32,代码来源:eventBox.cs

示例12: GetToken

        public void GetToken()
        {
            window = new Gtk.Window ("packingdemo");
            window.Title = "CircleCi Indicator Configuration";
            window.WindowPosition = WindowPosition.Center;

            HBox hbox = new HBox ();

            VBox vbox = new VBox (false, 0);

            Label label = new Label ();
            label.Markup = "Please provide your CircleCi token.\nYou can get one <a href=\"https://circleci.com/account/api\">here</a>.";

            entry = new Entry ();

            Button okButton = new Button ("OK");

            vbox.PackStart (label, false, false, 20);
            vbox.PackStart (entry, false, false, 0);
            vbox.PackStart (okButton, false, false, 20);

            hbox.PackStart (vbox, false, false, 50);

            window.Add(hbox);

            entry.KeyReleaseEvent += HandleKeyReleaseEvent;
            okButton.Clicked += HandleClicked;;

            window.ShowAll ();
        }
开发者ID:rossille,项目名称:circleci-notification,代码行数:30,代码来源:TokenInput.cs

示例13: NowPlayingInterface

        public NowPlayingInterface ()
        {
            GtkElementsService service = ServiceManager.Get<GtkElementsService> ();
            primary_window = service.PrimaryWindow;

            Contents = new NowPlayingContents ();

            // This is my really sweet hack - it's where the video widget
            // is sent when the source is not active. This keeps the video
            // widget from being completely destroyed, causing problems with
            // its internal windowing and GstXOverlay. It's also conveniently
            // the window that is used to do fullscreen video. Sweeeeeeeeeet.
            video_window = new FullscreenWindow (service.PrimaryWindow);
            video_window.Hidden += OnFullscreenWindowHidden;
            video_window.Realize ();
            video_window.Add (Contents);

            frame = new Hyena.Widgets.RoundedFrame ();
            frame.SetFillColor (new Cairo.Color (0, 0, 0));
            frame.DrawBorder = false;
            frame.Show ();

            PackStart (frame, true, true, 0);

            fullscreen_adapter = new FullscreenAdapter ();
            fullscreen_adapter.SuggestUnfullscreen += OnAdapterSuggestUnfullscreen;
            screensaver = new ScreensaverManager ();
        }
开发者ID:gclark916,项目名称:banshee,代码行数:28,代码来源:NowPlayingInterface.cs

示例14: Create

		public static Gtk.Window Create ()
		{
			window = new Window ("GtkCombo");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			combo = new Gtk.Combo ();
			string[] pop = {"Foo", "Bar"};
			combo.PopdownStrings = pop;
			combo.Entry.Activated += new EventHandler (OnComboActivated);
			box2.PackStart (combo, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:34,代码来源:TestCombo.cs

示例15: Create

		public static Gtk.Window Create ()
		{
			window = new Window ("GtkComboBox");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			ComboBoxText combo = ComboBoxText.NewWithEntry ();
			combo.AppendText ("Foo");
			combo.AppendText ("Bar");
			combo.Changed += new EventHandler (OnComboActivated);
			combo.Entry.Changed += new EventHandler (OnComboEntryChanged);
			box2.PackStart (combo, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:35,代码来源:TestComboBox.cs


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