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


C# Window.SetPosition方法代码示例

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


在下文中一共展示了Window.SetPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddNewWordToDic

        public static void AddNewWordToDic(object sender, EventArgs e)
        {
            var win = new Gtk.Window("Přidej slovo");
            win.SetPosition( WindowPosition.Mouse );
            Label l = new Label();
            l.Text = "Vloží slovo do aktuálně načteného slovníku, avšak nezmění zdroj (např. soubor dic.txt )";

            Entry entry = new Entry();
            Button b = new Button("Přidej");
            VBox vbox = new VBox();
            HBox hbox = new HBox();
            vbox.BorderWidth = 10;

            vbox.PackStart( l );
            vbox.PackEnd( hbox );

            hbox.PackStart( entry );
            hbox.PackEnd( b );

            b.Clicked += delegate {
                game.dictionary.Add( entry.Text );
                win.HideAll();
                win.Destroy();
                win.Dispose();
            };

            win.Add(vbox);
            win.ShowAll();
        }
开发者ID:Kedrigern,项目名称:scrabble,代码行数:29,代码来源:staticWindows.cs

示例2: creaVentana

 private void creaVentana()
 {
     window=new Window("Editar categoria");
     window.SetDefaultSize (300, 100);
     window.SetPosition(WindowPosition.Center);
     VBox vbox=new VBox();
     tabla=new Table(2,2,false);
     separaFilas(tabla,10);
     vbox.PackStart(tabla,false,false,0);
     window.Add(vbox);
 }
开发者ID:nerea123,项目名称:ad,代码行数:11,代码来源:CategoriaListView.cs

示例3: LoSDemo

        public LoSDemo()
        {
            win = new Window ("main window");
            win.SetDefaultSize(width, height);

            win.SetPosition(WindowPosition.Center);
            win.DeleteEvent += delegate { Application.Quit(); };

            win.Add(drawArea);

            win.KeyPressEvent += onKeyPress;

            win.ButtonPressEvent += onButtonPress;
            drawArea.AddEvents ((int)Gdk.EventMask.ButtonPressMask);

            win.ShowAll();

            player.setPosition (new PointD (80, 40));

            GLib.Timeout.Add (frameTime, update);
        }
开发者ID:latestversion,项目名称:projects,代码行数:21,代码来源:Main.cs

示例4: ShowSongInfoPopup

        public void ShowSongInfoPopup(string filepath)
        {
            string sDuration 	= _parent.SecondsToHumanTime(_parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "duration"));
            string songInfo		= "\n\nartist: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "artist");
            songInfo 			+= "\ntitle: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "title");
            songInfo 			+= "\nalbum: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "album");
            songInfo 			+= "\ngenre: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "genre");
            songInfo 			+= "\nduration: " + sDuration;

            Gtk.Window wSongInfo = new Gtk.Window("Song Info");
            wSongInfo.SetPosition(WindowPosition.CenterAlways);
            wSongInfo.SetIconFromFile("images/icon.png");

            Pango.FontDescription fd = Pango.FontDescription.FromString("Verdana Bold 9");

            /*
            string thumbLocation = _parent.oXbmc.Media.GetFileThumbnailLocation(filepath);

            if (thumbLocation != null)
            {
                MemoryStream msThumbnail = _parent.oXbmc.Media.FileDownload(thumbLocation);

                if (msThumbnail != null)
                    wSongInfo.Add(new Gtk.Image(new Gdk.Pixbuf(msThumbnail)));
            }
            */

            Label lArtist = new Label(songInfo);
            lArtist.ModifyFont(fd);
            lArtist.Xpad = 20;
            lArtist.Ypad = 20;

            wSongInfo.Add(lArtist);

            //Gtk.Image iCoverart = new Gtk.Image(new Gdk.Pixbuf(_parent.oXbmc.Media.GetFileThumbnailLocation(filepath)));
            //wSongInfo.Add(iCoverart);

            wSongInfo.ShowAll();
        }
开发者ID:Bram77,项目名称:xbmcontrol-evo,代码行数:39,代码来源:MediaInfo.cs

示例5: Main

        public static void Main()
        {
            Application.Init ();

            //Create the new window
            Window myWindow = new Window ("");
            myWindow.Resize (300, 300);
            myWindow.SetPosition (WindowPosition.Center);
            myWindow.ModifyBg (StateType.Normal, new Gdk.Color (174, 229, 218));

            //Creamos una etiqueta

            Label label = new Label ();
            label.Text = "Mi 1.º aplicación con GTK";

            //Añadimos la etiqueta al formulario
            myWindow.Add (label);

            //Ver todo
            myWindow.ShowAll ();

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

示例6: GetFileInfo

        public void GetFileInfo()
        {
            TreeModel selectedModel;
            TreeIter selectedIter	= new TreeIter();

            if (_parent._tvShares.Selection.GetSelected(out selectedModel, out selectedIter))
            {
                string filepath = selectedModel.GetValue(selectedIter, 2).ToString();

                string sDuration = _parent.oHelper.SecondsToHumanTime(_parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "duration"));

                string songInfo = "artist: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "artist");
                songInfo += "\ntitle: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "title");
                songInfo += "\nalbum: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "album");
                songInfo += "\ngenre: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "genre");
                songInfo += "\nduration: " + sDuration;

                Window wSongInfo = new Window("Song Info");
                wSongInfo.SetPosition(WindowPosition.CenterAlways);
                wSongInfo.SetIconFromFile("images/icon.png");

                Pango.FontDescription fd = Pango.FontDescription.FromString("Verdana Bold 9");

                Label lArtist = new Label(songInfo);
                lArtist.ModifyFont(fd);
                lArtist.Xpad = 20;
                lArtist.Ypad = 20;

                wSongInfo.Add(lArtist);

                //Gtk.Image iCoverart = new Gtk.Image(new Gdk.Pixbuf(_parent.oXbmc.Media.GetFileThumbnailLocation(filepath)));
                //wSongInfo.Add(iCoverart);

                wSongInfo.ShowAll();
                //_parent.Messagebox(songInfo);
            }
        }
开发者ID:Bram77,项目名称:xbmcontrol-evo,代码行数:37,代码来源:Controls.cs

示例7: ClientErrorMessages

 public ClientErrorMessages(string Msg)
 {
     try
     {
         msgwindow    = new Gtk.Window("Error");
         vbox         = new Gtk.VBox(false, 0);
         hbox         = new Gtk.HBox(true, 1);
         label			   = new Gtk.Label(Msg);
         buttonAccept = new Button("Aceptar");
         msgwindow.DeleteEvent += new DeleteEventHandler(OnDelete);
         msgwindow.DestroyEvent += new DestroyEventHandler(OnContinue);
         buttonAccept.Clicked += new EventHandler(OnContinue);
         msgwindow.Modal = true;
         msgwindow.Add(vbox);
         vbox.Spacing = 20;
         vbox.PackStart(label, false, false, 10);
         vbox.PackEnd(hbox, false, false, 10);
         hbox.PackEnd(buttonAccept, false, false, 10);
         //msgwindow.DefaultHeight = 150;
         //msgwindow.DefaultWidth  = 400;
         msgwindow.SetPosition(WindowPosition.Center);
         msgwindow.ShowAll();
         msgwindow.Present();
     }
     catch (Exception ex)
     {
         Console.WriteLine("Excepcion grave");
     }
 }
开发者ID:BackupTheBerlios,项目名称:boxerp-svn,代码行数:29,代码来源:ClientExceptions.cs

示例8: Start

        public void Start()
        {
            window = new Window(WindowType.Toplevel);
            window.SetPosition(WindowPosition.Mouse);
            window.KeepAbove = true;
            window.Resize(200, 150);
            window.Title = "Dimensions";
            window.Deletable = false;

            Fixed fix = new Fixed();

            // width
            widthLabel = new Label();
            widthLabel.Text = "Width";
            fix.Put(widthLabel, 15, 25);

            widthInputEntry = new Entry();
            widthInputEntry.SetSizeRequest(100, 25);
            widthInputEntry.TextInserted += OnlyNumber;
            widthInputEntry.TextInserted += ChangeWidth;
            widthInputEntry.TextDeleted += ChangeWidth;
            fix.Put(widthInputEntry, 80, 20);

            // height
            heightLabel = new Label();
            heightLabel.Text = "Height";
            fix.Put(heightLabel, 15, 75);

            heightInputEntry = new Entry();
            heightInputEntry.SetSizeRequest(100, 25);
            heightInputEntry.TextInserted += OnlyNumber;
            heightInputEntry.TextInserted += ChangeHeight;
            heightInputEntry.TextDeleted += ChangeHeight;
            fix.Put(heightInputEntry, 80, 70);

            // Buttons
            okButton = new Button();
            okButton.Label = "OK";
            okButton.SetSizeRequest(80, 30);
            okButton.Clicked += okButton_Clicked;
            fix.Put(okButton, 10, 110);

            cancelButton = new Button();
            cancelButton.Label = "Cancel";
            cancelButton.SetSizeRequest(80, 30);
            cancelButton.Clicked += cancelButton_Clicked;
            fix.Put(cancelButton, 110, 110);

            window.Add(fix);
            window.ShowAll();

            widthInputEntry.Text = "" + width;
            heightInputEntry.Text = "" + height;
        }
开发者ID:JacquesLucke,项目名称:Collage,代码行数:54,代码来源:DimensionsDialog.cs

示例9: ensure_error_window

        void ensure_error_window()
        {
            if (error_window != null)
                return;

            TextView text_view;
            ScrolledWindow sw;

            error_window = new Window (Mono.Unix.Catalog.GetString ("Errors from the capture process"));
            error_window.SetDefaultSize (400, 300); /* this sucks */
            error_window.TransientFor = this;
            error_window.SetPosition (WindowPosition.CenterOnParent);

            sw = new ScrolledWindow (null, null);
            sw.HscrollbarPolicy = PolicyType.Automatic;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            error_window.Add (sw);

            text_view = new TextView ();
            text_view.Editable = false;
            text_view.WrapMode = WrapMode.WordChar;
            sw.Add (text_view);
            sw.ShowAll ();

            error_buffer = text_view.Buffer;
        }
开发者ID:GNOME,项目名称:mortadelo,代码行数:26,代码来源:main-window.cs

示例10: ventana

 private void ventana(string titulo)
 {
     window = new Window (titulo);
     window.SetDefaultSize (300, 200);
     window.SetPosition(WindowPosition.Center);
     vbox=new VBox();
     tabla=new Table(4,2,false);
     separaFilas(tabla,10);
     vbox.PackStart(tabla,false,false,0);
 }
开发者ID:nerea123,项目名称:ad,代码行数:10,代码来源:ArticuloListView.cs

示例11: okButton_Clicked

        void okButton_Clicked(object sender, EventArgs e)
        {
            if(width > max || height > max)
            {
                Window messageWindow = new Window("Info");
                messageWindow.SetSizeRequest(250, 100);
                messageWindow.SetPosition(WindowPosition.Mouse);

                MessageDialog messageDialog = new MessageDialog(messageWindow, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "Width and height have to be below 6000");
                messageDialog.Run();
                messageDialog.Destroy();
                return;
            }
            response = ResponseType.Ok;
        }
开发者ID:JacquesLucke,项目名称:Collage,代码行数:15,代码来源:DimensionsDialog.cs

示例12: LoginRequest

		static void LoginRequest(){
			form = new LoginFormUI ();
			form.Build ();
			start = new Gtk.Window ("ログインフォーム");
			start.SetPosition(Gtk.WindowPosition.Center);
			start.Add (form.table1);
			start.DeleteEvent += new DeleteEventHandler (OnQuit);
			start.ShowAll ();
		}
开发者ID:takoyaki-hunter,项目名称:niconama-feeder,代码行数:9,代码来源:Program.cs

示例13: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();
        InfoAction.Sensitive=false;
        addAction.Sensitive=true;
        deleteAction.Sensitive=false;
        refreshAction.Sensitive=true;
        mySqlConnection.Open();
        string sql="Select * from categoria";
        string sql2="Select * from articulo";
        if(notebook1.GetTabLabelText(notebook1.GetNthPage(0)).Equals("Categoria")){

            tree1=new TreeViewHelper(treeview2,mySqlConnection,sql);

        }
        if(notebook1.GetTabLabelText(notebook1.GetNthPage(1)).Equals("Articulo")){

            tree2=new TreeViewHelper(treeview1,mySqlConnection,sql2);

        }

        InfoAction.Activated +=delegate{

                listStore=creaListStore();
                string op=listStore.GetValue(iter,1).ToString();

                    MessageDialog md = new MessageDialog
                        (this, DialogFlags.Modal, MessageType.Info, ButtonsType.Close,op);
                    md.Run();
                    md.Destroy();
        };

        addAction.Activated +=delegate{

                win = new Window ("Test");
                win.SetDefaultSize (300, 100);
                win.SetPosition(WindowPosition.Center);
                hbox=new HBox(false,0);
                vbox=new VBox(false,0);
                vbox2=new VBox(false,0);

                win.Add(hbox);
                hbox.PackStart(vbox,false,false,0);

                //hbox.PackStart(vbox2,false,false,0);
            if(esCategoria()){

                creaVentanaCategoria();

            }
            else{
                win.SetDefaultSize (300, 200);
                creaVentanaArticulo();
            }
        };

        deleteAction.Activated +=delegate{
            if(esCategoria()){
                listStore=creaListStore();
                string nombre=listStore.GetValue(iter,1).ToString();
                MessageDialog md2 = new MessageDialog
                        (this, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo,"¿Seguro que quieres borrarlo? \n Borrar: "+nombre);

            ResponseType result = (ResponseType)md2.Run ();
            string op=listStore.GetValue(iter,0).ToString();

            if (result == ResponseType.Yes){
                MySqlCommand delete=mySqlConnection.CreateCommand();
                delete.CommandText= "Delete from categoria where id="+op+"";
                delete.ExecuteNonQuery();
                md2.Destroy();
            }
            else{
                md2.Destroy();

            }
            }
            else{

                listStore=creaListStore();
                string nombre=listStore.GetValue(iter,1).ToString();
                MessageDialog md2 = new MessageDialog
                        (this, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo,"¿Seguro que quieres borrarlo? \n Borrar: "+nombre);

                ResponseType result = (ResponseType)md2.Run ();
                string op=listStore.GetValue(iter,0).ToString();

                if (result == ResponseType.Yes){
                    MySqlCommand delete=mySqlConnection.CreateCommand();
                    delete.CommandText= "Delete from articulo where id="+op+"";
                    delete.ExecuteNonQuery();
                    md2.Destroy();
                }
                else{
                md2.Destroy();

                }
            }
        };
//.........这里部分代码省略.........
开发者ID:nerea123,项目名称:ad,代码行数:101,代码来源:MainWindow.cs

示例14: 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;
                }
            };
        }
开发者ID:Kedrigern,项目名称:scrabble,代码行数:61,代码来源:staticWindows.cs

示例15: ThrowMessage

        ////////////////////////////////////////////////////////////////////
        ///<summary>
        ///ThrowMessage receives a msg and show a window. 
        ///Is intended to show exception messages
        ///</summary>
        // FIXME: Draw a better interface with l10n messages
        public static void ThrowMessage(string Msg, string short_msg)
        {
            Gtk.Window msgwindow = new Gtk.Window("Exception");
                Gtk.VBox box = new Gtk.VBox(false, 0);
                Gtk.ScrolledWindow scrWin = new Gtk.ScrolledWindow();
                Gtk.TextView txtView = new Gtk.TextView();
                Gtk.TextBuffer buffer = txtView.Buffer;
                buffer.Text = "Critical exception: " + short_msg;
                buffer.Text += "\r\n \r\nReport for developers : " + Msg;
                Gtk.Button buttonAccept = new Button("Accept");
                Gtk.Button buttonExit = new Button("Exit");

                msgwindow.DeleteEvent += new DeleteEventHandler(OnDelete);
                buttonExit.Clicked += new EventHandler(OnDelete);
                msgwindow.DestroyEvent += new DestroyEventHandler(OnContinue);
                buttonAccept.Clicked += new EventHandler(OnContinue);
                msgwindow.Add(scrWin);
                scrWin.Add(txtView);
                box.Spacing = 20;
                box.PackStart(scrWin);
                box.PackStart(buttonExit);
                box.PackStart(buttonAccept);
                //txtView.Show();
                //buttonExit.Show();
                //box.Show();
                msgwindow.DefaultHeight = 300;
                msgwindow.DefaultWidth  = 600;
                msgwindow.SetPosition(WindowPosition.Center);
                msgwindow.ShowAll();
                msgwindow.Present();
        }
开发者ID:BackupTheBerlios,项目名称:boxerp-svn,代码行数:37,代码来源:ClientExceptions.cs


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