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


C# Window.Show方法代码示例

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


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

示例4: Initialize

        public void Initialize() {
            Window = (Window) _builder.GetObject("LauncherWindow");
            Window.Title = _setup.Title;
            Window.Hidden += (sender, eventArgs) => Application.Quit();
            Window.Show();
            PatchNotes = (TextView)_builder.GetObject("PatchNotes");
            ProgressBar = (ProgressBar) _builder.GetObject("ProgressBar");
            PlayButton = (Button) _builder.GetObject("PlayButton");
            PlayButton.Clicked += (sender, args) => {
                Program.StartGame(_setup);
            };

            HeaderImage = (Image)_builder.GetObject("HeaderImage");
            var headerLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LaunchHeader.png");
            if (File.Exists(headerLocation))
                HeaderImage.Pixbuf = new Gdk.Pixbuf(headerLocation);

            var changeLogFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "changelog.txt");
            string patchNotesText = "You're using a BETA version of our custom launcher. Please report all issues on the forum at http://onemoreblock.com/.";

            if (File.Exists(changeLogFile))
                patchNotesText += "\n\n" + File.ReadAllText(changeLogFile);

            PatchNotes.Buffer.Text = patchNotesText;

            Task.Run(() => CheckAndUpdate());
        }
开发者ID:Troposphir,项目名称:AtmoLauncher,代码行数:27,代码来源:Launcher.cs

示例5: Main

        public static void Main()
        {
            Application.Init ();
            // TODO encapsulate in Global ()
            GtkSharp.GtkGL.ObjectManager.Initialize ();

            Gtk.Window window = new Gtk.Window ("simple");
            window.ReallocateRedraws = true;
            window.DeleteEvent += new DeleteEventHandler (OnDeleteEvent);

            int[] attrlist = {4,
                      8, 1,
                      9, 1,
                      10, 1,
                      5,
                      0};

            glarea = new GtkGL.Area (attrlist);
            glarea.RequestSize = new System.Drawing.Size (200,200);

            glarea.Realized += new EventHandler (OnRealized);
            glarea.ConfigureEvent += new ConfigureEventHandler (OnConfigure);
            glarea.ExposeEvent += new ExposeEventHandler (OnExpose);

            window.Add (glarea);
            window.Show ();
            glarea.Show ();
            Application.Run ();
        }
开发者ID:BackupTheBerlios,项目名称:simetron,代码行数:29,代码来源:Simple.cs

示例6: Main

    public static void Main()
    {
        Gtk.Window window;
        Gtk.VBox   vbox;
        Crumbs     crumbs;

        Application.Init ();

        // Outer Window
        window = new Gtk.Window ("Crumbs Test");
        window.BorderWidth = 12;
        window.Destroyed += OnDestroy;

        // Main VBox
        vbox = new Gtk.VBox ();
        window.Add(vbox);
        vbox.Show ();

        // Crumbs widget
        crumbs = new Crumbs ();
        vbox.PackStart (crumbs, false, false, 0);

        // Home Button
        crumbs.Add (new Gtk.Image (Gtk.Stock.Home, Gtk.IconSize.Menu));

        // Folder1
        HBox hbox1 = new HBox ();
        hbox1.Spacing = 3;
        Gtk.Image img1 = new Gtk.Image (Stock.Directory, IconSize.Menu);
        hbox1.PackStart (img1, false, true, 0);
        hbox1.PackStart (new Label ("Documents"));
        hbox1.ShowAll ();
        crumbs.Add (hbox1);

        // Folder2
        HBox hbox2 = new HBox ();
        hbox2.Spacing = 3;
        Gtk.Image img2 = new Gtk.Image (Stock.Directory, IconSize.Menu);
        hbox2.PackStart (img2, false, true, 0);
        hbox2.PackStart (new Label ("Spreadsheets"));
        hbox2.ShowAll ();
        crumbs.Add (hbox2);

        // Worksheet
        crumbs.Add (new Label ("Worksheet"));

        crumbs.ShowAll ();
        window.Show ();

        Application.Run ();
    }
开发者ID:manicolosi,项目名称:manico-crumbs,代码行数:51,代码来源:EntryPoint.cs

示例7: Main

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

            Console.WriteLine ("Hello World!");

            Window window = new Window("Hello Window");

            //PlotSurface2D plot = new PlotSurface2D();

            NPlot.Bitmap.PlotSurface2D plot = new NPlot.Bitmap.PlotSurface2D(500, 500);

            window.Show ();
            Application.Run ();
        }
开发者ID:msphair,项目名称:MonoTesting,代码行数:15,代码来源:Main.cs

示例8: Main

        static void Main(string[] args)
        {
            Application app = new Application("org.gtk.test34", 0);
            app.Activated += delegate {
                var list = app.Windows;
                if (list != null && list.Length > 0) {
                    list[0].Present ();
                }
                else {
                    var window = new Window(WindowType.Toplevel);
                    window.Application = app;
                    window.Show ();
                }
            };

            app.Run (0, "");
        }
开发者ID:mono-soc-2012,项目名称:Tasque,代码行数:17,代码来源:Gtk3SingleInstanceSolution.cs

示例9: Main

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

            var window = new Gtk.Window (Gtk.WindowType.Toplevel) {
                Title       = "Treemap Example",
                BorderWidth = 0,//12,
            };
            window.SetDefaultSize (640, 480);
            window.DeleteEvent += delegate {
                Gtk.Application.Quit ();
            };
            window.Show ();

            var vbox = new Gtk.VBox (false, 6);
            window.Add (vbox);
            vbox.Show ();

            var treemap = new TreeMap.TreeMap () {
                Model        = BuildModel (),
                TextColumn   = 0,
                WeightColumn = 1,
                Title        = "Treemap Example",
            };
            vbox.PackStart (treemap, true, true, 0);
            treemap.Show ();

            var buttonbox = new Gtk.HButtonBox ();
            buttonbox.BorderWidth = 12;
            buttonbox.Layout = Gtk.ButtonBoxStyle.End;
            vbox.PackStart (buttonbox, false, true, 0);
            buttonbox.Show ();

            var close = new Gtk.Button (Gtk.Stock.Close);
            close.CanDefault = true;
            close.Clicked += delegate { Gtk.Application.Quit (); };
            buttonbox.PackStart (close, false, true, 0);
            window.Default = close;
            close.Show ();

            Application.Run ();
        }
开发者ID:chergert,项目名称:custom-gtk-widgets,代码行数:42,代码来源:Main.cs

示例10: SqlBuilderUI

        public SqlBuilderUI()
        {
            Window win = new Window("SQL Builder");
            win.Show();
            win.BorderWidth = 10;
            win.Resizable = false;

            VBox box = new VBox();
            box.Show();
            win.Add(box);
            box.Spacing = 10;

            model = new TracksQueryModel();
            builder = new QueryBuilder(model);
            builder.Show();
            builder.Spacing = 4;

            box.PackStart(builder, true, true, 0);

            Button btn = new Button("Generate Query");
            btn.Show();
            box.PackStart(btn, false, false, 0);
            btn.Clicked += OnButtonClicked;
        }
开发者ID:jrmuizel,项目名称:banshee-unofficial-plugins,代码行数:24,代码来源:QueryBuilderModel.cs

示例11: ShowCalendar

        private void ShowCalendar()
        {
            popup = new Window(WindowType.Popup);
            popup.Screen = tree.Screen;

            Frame frame = new Frame();
            frame.Shadow = ShadowType.Out;
            frame.Show();

            popup.Add(frame);

            VBox box = new VBox(false, 0);
            box.Show();
            frame.Add(box);

            cal = new Calendar();
            cal.DisplayOptions = CalendarDisplayOptions.ShowHeading
                                 | CalendarDisplayOptions.ShowDayNames
                                 | CalendarDisplayOptions.ShowWeekNumbers;

            cal.KeyPressEvent += OnCalendarKeyPressed;
            popup.ButtonPressEvent += OnButtonPressed;

            cal.Show();

            Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
            calAlignment.Show();
            calAlignment.SetPadding(4, 4, 4, 4);
            calAlignment.Add(cal);

            box.PackStart(calAlignment, false, false, 0);

            // FIXME: Make the popup appear directly below the date
            Gdk.Rectangle allocation = tree.Allocation;
            //   Gtk.Requisition req = tree.SizeRequest ();
            int x = 0, y = 0;
            tree.GdkWindow.GetOrigin(out x, out y);
            //   popup.Move(x + allocation.X, y + allocation.Y + req.Height + 3);
            popup.Move(x + allocation.X, y + allocation.Y);
            popup.Show();
            popup.GrabFocus();

            Grab.Add(popup);

            Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true,
                                     Gdk.EventMask.ButtonPressMask
                                     | Gdk.EventMask.ButtonReleaseMask
                                     | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);

            if (grabbed == Gdk.GrabStatus.Success) {
                grabbed = Gdk.Keyboard.Grab(popup.GdkWindow,
                                            true, CURRENT_TIME);

                if (grabbed != Gdk.GrabStatus.Success) {
                    Grab.Remove(popup);
                    popup.Destroy();
                    popup = null;
                }
            } else {
                Grab.Remove(popup);
                popup.Destroy();
                popup = null;
            }

            cal.DaySelectedDoubleClick += OnCalendarDaySelected;
            cal.ButtonPressEvent += OnCalendarButtonPressed;

            cal.Date = date == DateTime.MinValue ? DateTime.Now : date;
        }
开发者ID:GNOME,项目名称:tasque,代码行数:69,代码来源:CellRendererDate.cs

示例12: OpenFile

    protected void OpenFile(object sender, EventArgs e)
    {
        FileChooserDialog fc = new FileChooserDialog ("Choose the directory containing the hives to open",
                                                        this,
                                                        FileChooserAction.SelectFolder,
                                                        "Cancel", ResponseType.Cancel,
                                                        "Open", ResponseType.Accept);

        if (fc.Run () == (int)ResponseType.Accept) {
            string dir = fc.Filename;
            fc.Destroy();
            List<Thread> threads = new List<Thread>();
            Window window = new Gtk.Window(Gtk.WindowType.Toplevel);
            VBox progressBox = new VBox(false, 5);
            reading = new Label("Reading hives, please wait...");
            pulseBar = new ProgressBar();
            progressBox.PackStart(reading, true, true, 0);
            progressBox.PackStart(pulseBar, true, true, 0);
            reading.Show();
            pulseBar.Show ();
            progressBox.Show();
            window.Add(progressBox);
            window.SetPosition(Gtk.WindowPosition.CenterOnParent);
            window.SetSizeRequest(500,100);
            window.Title = "Loading...";
            window.Show();
            _hives = new List<RegistryHive>();
            _filenames = new List<string>();
            foreach (var file in System.IO.Directory.GetFiles(dir))
            {
                using (BinaryReader reader = new BinaryReader(File.OpenRead(file)))
                {
                    reader.BaseStream.Position = 0;

                    if (reader.BaseStream.Length > 4)
                    {
                        byte[] magic = reader.ReadBytes(4);
                        if (magic[0] == 'r' && magic[1] == 'e' && magic[2] == 'g' && magic[3] == 'f')
                        {
                            _total += reader.BaseStream.Length;
                            _filenames.Add(file);
                        }
                    }
                }
            }

            threads = GetReadThreads ();
            foreach (Thread thread in threads)
                thread.Start();

            new Thread(new ThreadStart(delegate {
                foreach (Thread thread in threads)
                {
                    while (thread.IsAlive)
                    {
                        Application.Invoke(delegate {
                            pulseBar.Pulse();
                        });
                        System.Threading.Thread.Sleep(100);
                    }
                }

                Application.Invoke(delegate {
                    window.Destroy();
                    Populate();
                });
            })).Start();
        }
        else
            fc.Destroy();
    }
开发者ID:brandonprry,项目名称:volatile_reader,代码行数:71,代码来源:MainWindow.cs

示例13: Main


//.........这里部分代码省略.........
                        inputTabLabel.Text = "Input ("
                            + (leftToRight ? teh.getLeftLanguageName() : teh.getRightLanguageName())
                            + ")";

                        Gtk.Label outputTabLabel = (Gtk.Label)nb.GetTabLabel(nb.GetNthPage(1));
                        outputTabLabel.Text = "Output ("
                            + (leftToRight ? teh.getRightLanguageName() : teh.getLeftLanguageName())
                            + ")";
                    }
                    catch (Exception eee)
                    {
                        Console.WriteLine("boo");
                    }
                };

                Gtk.RadioButton rightButton = (Gtk.RadioButton) xml.GetWidget("RightButton");
                rightButton.Toggled += delegate(object sender, EventArgs e) {
                    leftToRight = false;

                    try {
                    Gtk.Label inputTabLabel = (Gtk.Label) nb.GetTabLabel(nb.GetNthPage(0));
                    inputTabLabel.Text = "Input ("
                        + (leftToRight ? teh.getLeftLanguageName() : teh.getRightLanguageName())
                        + ")";

                    Gtk.Label outputTabLabel = (Gtk.Label) nb.GetTabLabel(nb.GetNthPage(1));
                    outputTabLabel.Text = "Output ("
                        + (leftToRight ? teh.getRightLanguageName() : teh.getLeftLanguageName())
                        + ")";
                    }
                    catch (Exception eee)
                    {
                        Console.WriteLine("boo");
                    }
                };

                Gtk.Entry input = (Gtk.Entry) xml.GetWidget("Input");
                input.KeyReleaseEvent += delegate(object _o, KeyReleaseEventArgs _args) {
                    if(_args.Event.Key == Gdk.Key.Return && input.Text.Length > 0)
                    {
                        string translated = teh.translate(input.Text, leftToRight ? TranslateDirection.LeftToRight : TranslateDirection.RightToLeft);
                        inputView.Buffer.Text += input.Text + Environment.NewLine;
                        outputView.Buffer.Text += translated + Environment.NewLine;
                        input.Text = "";
                    }
                };

                Gtk.Button send = (Gtk.Button) xml.GetWidget("Send");
                send.Pressed += delegate(object sender, EventArgs e) {
                    string translated = teh.translate(input.Text, leftToRight ? TranslateDirection.LeftToRight : TranslateDirection.RightToLeft);
                    inputView.Buffer.Text += input.Text + Environment.NewLine;
                    outputView.Buffer.Text += translated + Environment.NewLine;
                    input.Text = "";
                };

                input.Sensitive = false;
                send.Sensitive = false;
                input.IsEditable = false;

                Gtk.MenuItem open = (Gtk.MenuItem) xml.GetWidget("Open");
                open.Activated += delegate(object sender, EventArgs e) {
                    int retval = fcd.Run();

                    fcd.Hide();

                    if((int) Gtk.ResponseType.Accept != retval)
                    {
                        return;
                    }

                    initialize(new FileInfo(fcd.Filename), input, send, nb, leftButton, rightButton);
                };

                //If the settings file already has the name of a dictionary, try to open it.
                //We just want to read the file at this point, not write it.
                if(settingsFile.Exists)
                {
                    TextReader tr = new StreamReader(settingsFile.OpenRead());
                    String settingsLine = tr.ReadLine();
                    tr.Close();
                    if(settingsLine != null)
                    {
                        FileInfo sett = new FileInfo(settingsLine);
                        if(sett.Exists)
                        {
                            initialize(sett, input, send, nb, leftButton, rightButton);
                        }
                    }
                }

                mainwindow.Show();
            }

            Application.Run ();
            if(monitor != null && monitor.IsAlive)
            {
                monitor.Join(500);
                monitor.Abort();
            }
        }
开发者ID:allquixotic,项目名称:libtehthu,代码行数:101,代码来源:Main.cs

示例14: DetachPlayer

        void DetachPlayer(bool detach)
        {
            if (detach == detachedPlayer)
                return;

            detachedPlayer = detach;

            if (detach) {
                EventBox box;
                Log.Debug("Detaching player");

                playerWindow = new Gtk.Window(Constants.SOFTWARE_NAME);
                playerWindow.Icon = Stetic.IconLoader.LoadIcon(this, "longomatch", IconSize.Button);
                playerWindow.DeleteEvent += (o, args) => DetachPlayer(false);
                box = new EventBox();

                box.KeyPressEvent += (o, args) => OnKeyPressEvent(args.Event);
                playerWindow.Add(box);

                box.Show();
                playerWindow.Show();

                player.Reparent(box);
                buttonswidget.Visible = true;
                timeline.Visible = true;
                if (Config.useGameUnits) {
                    guTimeline.Visible = true;
                    gameunitstaggerwidget1.Visible = true;
                }
            } else {
                ToggleAction action;

                Log.Debug("Attaching player again");
                player.Reparent(this.videowidgetsbox);
                playerWindow.Destroy();

                if (ManualTaggingViewAction.Active)
                    action = ManualTaggingViewAction;
                else if (TimelineViewAction.Active)
                    action = TimelineViewAction;
                else if (GameUnitsViewAction.Active)
                    action = GameUnitsViewAction;
                else
                    action = TaggingViewAction;
                OnViewToggled(action, new EventArgs());
            }
        }
开发者ID:dineshkummarc,项目名称:longomatch,代码行数:47,代码来源:MainWindow.cs

示例15: Attach

        public void Attach(IWorkbench wb)
        {
            DefaultWorkbench workbench = (DefaultWorkbench) wb;

            this.workbench = workbench;
            wbWindow = (Window) workbench;

            Gtk.VBox vbox = new VBox (false, 0);
            rootWidget = vbox;

            vbox.PackStart (workbench.TopMenu, false, false, 0);

            toolbarFrame = new CommandFrame (Runtime.Gui.CommandService.CommandManager);
            vbox.PackStart (toolbarFrame, true, true, 0);

            if (workbench.ToolBars != null) {
                for (int i = 0; i < workbench.ToolBars.Length; i++) {
                    toolbarFrame.AddBar ((DockToolbar)workbench.ToolBars[i]);
                }
            }

            // Create the docking widget and add it to the window.
            dock = new Dock ();
            DockBar dockBar = new DockBar (dock);
            Gtk.HBox dockBox = new HBox (false, 5);
            dockBox.PackStart (dockBar, false, true, 0);
            dockBox.PackStart (dock, true, true, 0);
            toolbarFrame.AddContent (dockBox);

            // Create the notebook for the various documents.
            tabControl = new DragNotebook ();
            tabControl.Scrollable = true;
            tabControl.SwitchPage += new SwitchPageHandler (ActiveMdiChanged);
            tabControl.TabsReordered += new TabsReorderedHandler (OnTabsReordered);
            DockItem item = new DockItem ("Documents", "Documents",
                              DockItemBehavior.Locked | DockItemBehavior.NoGrip);
            item.PreferredWidth = -2;
            item.PreferredHeight = -2;
            item.Add (tabControl);
            item.Show ();
            dock.AddItem (item, DockPlacement.Center);

            workbench.Add (vbox);

            vbox.PackEnd (Runtime.Gui.StatusBar.Control, false, true, 0);
            workbench.ShowAll ();

            foreach (IViewContent content in workbench.ViewContentCollection)
                ShowView (content);

            // by default, the active pad collection is the full set
            // will be overriden in CreateDefaultLayout() below
            activePadCollection = workbench.PadContentCollection;

            // create DockItems for all the pads
            foreach (IPadContent content in workbench.PadContentCollection)
            {
                AddPad (content, content.DefaultPlacement);
            }

            CreateDefaultLayout();
            //RedrawAllComponents();
            wbWindow.Show ();

            workbench.ContextChanged += contextChangedHandler;
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:66,代码来源:SdiWorkspaceLayout.cs


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