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


C# Alignment.Add方法代码示例

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


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

示例1: OnButtonClicked

    protected void OnButtonClicked(object sender, EventArgs e)
    {
        if (sender == button1)
        {

            Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog ("Choose item...", this, FileChooserAction.Open, "Cancel",  ResponseType.Cancel, "Insert Spacer",  ResponseType.None, "Add", ResponseType.Accept);

            Gtk.Alignment align = new Alignment (1, 0, 0, 1);
            Gtk.Frame frame = new Frame ("Position");
            Gtk.HBox hbox = new HBox (false, 4);

            RadioButton rbRight;
            rbRight = new RadioButton ("Right");
            hbox.PackEnd(rbRight, false, false, 1);
            hbox.PackEnd(new RadioButton (rbRight, "Left"), false, false, 1);

            frame.Add (hbox);
            align.Add (frame);
            align.ShowAll ();
            dialog.ExtraWidget = align;

            ResponseType response = (ResponseType)dialog.Run ();
            if (response == ResponseType.Accept) {
                RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>" + dialog.Filename + "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' && /bin/sleep 1 &&/usr/bin/killall Dock");
            } else if (response == ResponseType.None) {
                RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '{tile-data={}; tile-type=\"spacer-tile\";}' && /bin/sleep 1 &&/usr/bin/killall Dock");
            }
            dialog.Destroy ();

        }
    }
开发者ID:Eun,项目名称:AddAnyDock,代码行数:31,代码来源:MainWindow.cs

示例2: SharpApp

    public SharpApp()
        : base("Windows")
    {
        SetDefaultSize(300,250);
        SetPosition(WindowPosition.Center);
        BorderWidth=15;
        DeleteEvent += delegate{Application.Quit();};

        Table table = new Table(8, 4, false);

        table.ColumnSpacing = 3;

        Label title = new Label("Windows");

        Alignment halign = new Alignment(0,0,0,0);

        halign.Add(title);

        table.Attach(halign, 0,1,0,1, AttachOptions.Fill, AttachOptions.Fill, 0,0);

        TextView wins = new TextView();

        wins.ModifyFg(StateType.Normal, new Gdk.Color(20,20,20));
        wins.CursorVisible = false;
        table.Attach(wins, 0,2,1,3, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 1,1);
        Button activate = new Button("Activate");
        activate.SetSizeRequest(50,30);
        table.Attach(activate,3,4,1,2,AttachOptions.Fill, AttachOptions.Shrink,1,1);
        Alignment valign = new Alignment(0,0,0,0);
        Button close = new Button("Close");
        close.SetSizeRequest(70,30);
        valign.Add(close);
        table.SetRowSpacing(1,3);
        table.Attach(valign,3,4,2,3,AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand,1,1);

        Alignment halign2 =  new Alignment(0,1,0,0);
        Button help = new Button("Help");
        help.SetSizeRequest(70,30);
        halign2.Add(help);
        table.SetRowSpacing(3,6);
        table.Attach(halign2, 0,1,4,5, AttachOptions.Fill, AttachOptions.Fill, 0,0);

        Button ok = new Button("Ok");
        ok.SetSizeRequest(70,30);
        table.Attach(ok,3,4,4,5,AttachOptions.Fill, AttachOptions.Fill, 0,0);

        Add(table);
        ShowAll();
    }
开发者ID:Jimmyscene,项目名称:Random,代码行数:49,代码来源:windows.cs

示例3: GameEditor

            public GameEditor(GameViewer viewer)
                : base(Catalog.
								    GetString
								    ("Rating"))
            {
                this.viewer = viewer;
                viewer.ChessGameWidget.GameLoadedEvent +=
                    OnGameLoaded;
                combo = new ComboBox (new string[]
                              {
                              Catalog.
                              GetString
                              ("Not interested"),
                              Catalog.
                              GetString
                              ("Average Game"),
                              Catalog.
                              GetString ("Good Game"),
                              Catalog.
                              GetString
                              ("Excellent Game"),
                              Catalog.
                              GetString ("Must Have")}
                );
                save = new Button (Stock.Save);
                save.Sensitive = false;
                save.Clicked += OnSave;
                combo.Changed +=
                    delegate (object o, EventArgs args)
                {
                    save.Sensitive = true;
                };

                ratings = new GameRating[]
                {
                GameRating.Ignore,
                        GameRating.Average,
                        GameRating.Good,
                        GameRating.Excellent,
                        GameRating.MustHave};
                tagsStore = new ListStore (typeof (string));
                tagsCombo = new ComboBoxEntry (tagsStore, 0);
                tagsCombo.Entry.Activated +=
                    OnTagsComboActivated;

                Table table = new Table (3, 2, false);
                table.RowSpacing = 2;
                table.ColumnSpacing = 2;
                uint row = 0, col = 0;
                Label label =
                    new Label (Catalog.
                           GetString ("My Rating"));
                label.Xalign = 0;
                label.Yalign = 0;
                table.Attach (label, col, col + 1, row,
                          row + 1);
                col++;
                table.Attach (combo, col, col + 1, row,
                          row + 1);

                label = new Label (Catalog.
                           GetString ("Tags"));
                label.Xalign = 0;
                label.Yalign = 0;
                col = 0;
                row++;
                table.Attach (label, col, col + 1, row,
                          row + 1);
                col++;
                table.Attach (tagsCombo, col, col + 1, row,
                          row + 1);

                col = 1;
                row++;
                Alignment align = new Alignment (1, 0, 0, 0);
                align.Add (save);
                table.Attach (align, col, col + 1, row,
                          row + 1);

                Add (table);

                ShowAll ();
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:83,代码来源:GameDbPlugin.cs

示例4: ObservableGamesWidget

            public ObservableGamesWidget(GameObservationManager
						      observer)
            {
                obManager = observer;
                iters = new TreeIter[3, 4];
                gamesView = new TreeView ();
                infoLabel = new Label ();
                infoLabel.Xalign = 0;
                infoLabel.Xpad = 4;
                observer.ObservableGameEvent +=
                    OnObservableGameEvent;

                store = new TreeStore (typeof (string),	// used for filtering
                               typeof (int),	// gameid
                               typeof (string),	// markup
                               typeof (string),	//
                               typeof (string));

                  gamesView.HeadersVisible = true;
                  gamesView.HeadersClickable = true;

                  gamesView.AppendColumn (Catalog.
                              GetString ("Games"),
                              new
                              CellRendererText (),
                              "markup", 2);
                  gamesView.AppendColumn (Catalog.
                              GetString ("Time"),
                              new
                              CellRendererText (),
                              "markup", 3);
                  gamesView.AppendColumn (Catalog.
                              GetString
                              ("Category"),
                              new
                              CellRendererText (),
                              "markup", 4);

                ScrolledWindow win = new ScrolledWindow ();
                  win.HscrollbarPolicy =
                    win.VscrollbarPolicy =
                    PolicyType.Automatic;
                  win.Add (gamesView);

                  UpdateInfoLabel ();

                  filterEntry = new Entry ();
                  filterEntry.Changed += OnFilter;

                  filter = new TreeModelFilter (store, null);
                  filter.VisibleFunc = FilterFunc;
                  gamesView.Model = filter;

                  AddParentIters ();

                  infoLabel.UseMarkup = true;
                Button refreshButton =
                    new Button (Stock.Refresh);
                  refreshButton.Clicked +=
                    delegate (object o, EventArgs args)
                {
                    Clear ();
                    obManager.GetGames ();
                };
                Alignment align = new Alignment (0, 1, 0, 0);
                align.Add (refreshButton);

                HBox hbox = new HBox ();
                hbox.PackStart (infoLabel, true, true, 4);
                hbox.PackStart (align, false, false, 4);

                PackStart (hbox, false, true, 4);

                Label tipLabel = new Label ();
                tipLabel.Xalign = 0;
                tipLabel.Xpad = 4;
                tipLabel.Markup =
                    String.
                    Format ("<small><i>{0}</i></small>",
                        Catalog.
                        GetString
                        ("Press the refresh button to get an updated list of games.\nDouble click on a game to observe it."));
                PackStart (tipLabel, false, true, 4);
                PackStart (filterEntry, false, true, 4);
                PackStart (win, true, true, 4);

                gamesView.RowActivated += OnRowActivated;
                SetSizeRequest (600, 400);
                ShowAll ();
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:90,代码来源:ObservableGamesWidget.cs

示例5: AskSave

    // This returns ResponseType.Yes, No, or Cancel
    ResponseType AskSave(string info)
    {
        if (Project == null)
            return ResponseType.No;

        ResponseType response;
        Gtk.Dialog d = new Dialog("Save Project?", this,
                DialogFlags.DestroyWithParent,
                Gtk.Stock.Yes, ResponseType.Yes,
                Gtk.Stock.No, ResponseType.No,
                Gtk.Stock.Cancel, ResponseType.Cancel);
        Alignment a = new Alignment(1,0.25f,1,0);
        a.SetSizeRequest(0, 50);
        a.Add(new Gtk.Label(info));
        d.VBox.Add(a);
        d.VBox.ShowAll();
        response = (ResponseType)d.Run();
        d.Destroy();
        if (response == ResponseType.Yes) {
            Project.Save();
        }

        return response;
    }
开发者ID:Drenn1,项目名称:LynnaLab,代码行数:25,代码来源:MainWindow.cs

示例6: DialBOT

    // This requires that the perl program autorestart wraps this....
    public DialBOT()
        : base("DialBOT")
    {
        SetDefaultSize(800, 600);
        SetPosition(WindowPosition.Center);
        DeleteEvent += delegate { Application.Quit(); };

        // Top level container. This vertically divides the window into 3 sections:
        // Top is the 2 windows (balls-deep items and console output
        VBox topvbox = new VBox(false, 5);

        // Lets build the top 1/3rd here.
        Frame ballsdeepframe = new Frame("Balls-Deep Items");
        Frame consoleframe = new Frame("Console Output");
        // HBox mainhbox = new HBox(true,2);

        ballsdeeptree = new TreeView();

        bdstore = new TreeStore (typeof(string), typeof (string), typeof (string), typeof (string));
        LoadBalls();
        fillStore();

        // Put the TreeStore into a TreeModelSort so we can sort columns...
        // Sort by score for now
        bdsorted = new TreeModelSort(bdstore);
        bdsorted.SetSortColumnId(1,SortType.Descending);

        // Put the TreeModelSort into a TreeModelFilter so we can implement the filtering
        filterEntry = new Entry();
        // filter = new TreeModelFilter(bdsorted,null);
        // filter.VisibleFunc = FilterTreeFunc;   // Use this as the filter function.

        // And then set the visible TreeView to use the filter as it's store.
        ballsdeeptree.Model = bdsorted;

        ballsdeeptree.HeadersVisible = true;
        ballsdeeptree.HeadersClickable=true;
        ballsdeeptree.AppendColumn ("Added By", new CellRendererText (), "text", 0);
        ballsdeeptree.AppendColumn ("Score", new CellRendererText (), "text", 1);
        CellRendererText ballRenderer = new CellRendererText();
        ballsdeeptree.AppendColumn ("Text", ballRenderer, "text", 2);
        CellRendererText voteRenderer = new CellRendererText();
        voteRenderer.Editable=true;
        voteRenderer.Edited+=editVotes;
        ballsdeeptree.AppendColumn ("Votes", voteRenderer, "text", 3);

        TreeViewColumn col = ballsdeeptree.GetColumn(0);
        col.Clickable=true;
        col.Resizable = true;
        col.Clicked += new EventHandler (col_clicked0);

        col = ballsdeeptree.GetColumn(1);
        col.Resizable = true;
        col.Clickable=true;
        col.Clicked += new EventHandler (col_clicked1);

        col = ballsdeeptree.GetColumn(2);
        col.Resizable = true;
        col.Clickable=true;
        col.Clicked += new EventHandler (col_clicked2);

        col = ballsdeeptree.GetColumn(3);
        col.Clickable=true;
        col.Resizable = true;
        col.Clicked += new EventHandler (col_clicked3);

        ScrolledWindow ballsdeepscroll = new ScrolledWindow();

        ballsdeepscroll.Add(ballsdeeptree);

        Button deleteentry = new Button("Remove Entry");
        deleteentry.SetSizeRequest(70, 30);
        deleteentry.Clicked += new EventHandler(deleteBallMsg);

        ballsdeepframe.Add(ballsdeepscroll);
        ballsdeepframe.Add(deleteentry);

        // Entry box and label to filter on message as well as an HBox to put them next to each other
        filterEntry.Changed += OnFilterEntryTextChanged;
        Label filterLabel = new Label("Ball Message Search: ");
        HBox filterBox = new HBox();
        filterBox.PackStart(filterLabel,false,false,5);
        filterBox.PackStart(filterEntry,true,true,5);

        VBox ballvbox = new VBox(false,5);
        ballvbox.Add(ballsdeepframe);
        //ballvbox.PackStart(filterBox,false,false,1);

        topvbox.Add(ballvbox);

        consoleview = new TextView();
        consolebuffer=consoleview.Buffer;
        consolebuffer.Text = consoletext;

        ScrolledWindow consolescroll = new ScrolledWindow();
        consolescroll.SetPolicy(PolicyType.Automatic,PolicyType.Always);
        consolescroll.Add(consoleview);

        consoleframe.Add(consolescroll);
//.........这里部分代码省略.........
开发者ID:dialmaster,项目名称:DIALBOT,代码行数:101,代码来源:dialbotgui-6-1.cs

示例7: AddGameNavigationButtons

            private void AddGameNavigationButtons(VBox box)
            {
                firstButton = new Button ();
                firstButton.Clicked += OnClicked;
                firstButton.Image =
                    new Image (Stock.GotoFirst,
                           IconSize.Button);
                prevButton = new Button ();
                prevButton.Clicked += OnClicked;
                prevButton.Image =
                    new Image (Stock.GoBack,
                           IconSize.Button);
                nextButton = new Button ();
                nextButton.Clicked += OnClicked;
                nextButton.Image =
                    new Image (Stock.GoForward,
                           IconSize.Button);
                lastButton = new Button ();
                lastButton.Clicked += OnClicked;
                lastButton.Image =
                    new Image (Stock.GotoLast,
                           IconSize.Button);

                HBox hbox = new HBox ();
                hbox.PackStart (firstButton, false, false, 2);
                hbox.PackStart (prevButton, false, false, 2);
                hbox.PackStart (nextButton, false, false, 2);
                hbox.PackStart (lastButton, false, false, 2);

                Alignment align =
                    new Alignment (0.5f, 1, 1, 0);
                align.Add (hbox);
                box.PackStart (align, false, true, 2);
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:34,代码来源:ObservingGamePage.cs

示例8: GetRightPane

            private Widget GetRightPane()
            {
                VBox vbox = new VBox ();

                // labels
                moveNumberLabel = new Label ();
                nagCommentLabel = new Label ();
                nagCommentLabel.Xalign = 0;
                HBox hbox = new HBox ();
                hbox.PackStart (moveNumberLabel, false, false,
                        2);
                hbox.PackStart (nagCommentLabel, false, false,
                        2);

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

                // board
                chessGameDetailsBox = new VBox ();
                chessGameDetailsBox.PackStart (gameView,
                                   true, true, 4);

                vbox.PackStart (chessGameDetailsBox, true,
                        true, 2);

                // buttons
                playButton = new PlayPauseButton ();
                playButton.PlayNextEvent +=
                    on_play_next_event;

                firstButton = new Button ();
                firstButton.Clicked += on_first_clicked;
                firstButton.Image =
                    new Image (Stock.GotoFirst,
                           IconSize.Button);
                prevButton = new Button ();
                prevButton.Clicked += on_prev_clicked;
                prevButton.Image =
                    new Image (Stock.GoBack,
                           IconSize.Button);
                nextButton = new Button ();
                nextButton.Clicked += on_next_clicked;
                nextButton.Image =
                    new Image (Stock.GoForward,
                           IconSize.Button);
                lastButton = new Button ();
                lastButton.Clicked += on_last_clicked;
                lastButton.Image =
                    new Image (Stock.GotoLast,
                           IconSize.Button);

                HBox bbox = new HBox ();
                bbox.PackStart (firstButton, false, false, 1);
                bbox.PackStart (prevButton, false, false, 1);
                bbox.PackStart (playButton, false, false, 1);
                bbox.PackStart (nextButton, false, false, 1);
                bbox.PackStart (lastButton, false, false, 1);
                Alignment alignment =
                    new Alignment (0.5f, 1, 0, 0);
                alignment.Add (bbox);
                alignment.Show ();

                vbox.PackStart (alignment, false, false, 2);
                book.AppendPage (gamesListWidget,
                         new Label (Catalog.
                                GetString
                                ("Games")));
                book.AppendPage (vbox,
                         new Label (Catalog.
                                GetString
                                ("Current Game")));

                return book;
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:73,代码来源:ChessGameWidget.cs

示例9: Main

	static void Main (string [] args)
	{
		if (args.Length > 0 && args [0] == "debug")
			BoardPiece.Debug = true;
		Program fifteen = new Program ("Fifteen", "0.1", Modules.UI, args);
		
		window = new Gtk.Window ("Fifteen #");
		VBox box = new VBox (false, 0);
		window.Add (box);
		window.DefaultWidth = 300;
		window.DefaultHeight = 300;
		
		VBox vbox = new VBox (false, 4);
		vbox.BorderWidth = 4;

		MenuBar menu = Create_Menu ();
		box.PackStart (menu, false, false, 0);
		box.PackStart (vbox, false, false, 0);
		window.DeleteEvent += new DeleteEventHandler (Window_Delete);

		Alignment alignment = new Alignment (0.5f, 0.5f, 0.0f, 0.0f);
		vbox.PackStart (alignment, true, true, 4);

		Frame frame = new Frame (null);
		frame.ShadowType = ShadowType.In;
		alignment.Add (frame);

		canvas = new Canvas ();
		canvas.SetSizeRequest (BoardPiece.PIECE_SIZE * 4 + 1, BoardPiece.PIECE_SIZE * 4 + 1);
		canvas.SetScrollRegion (0, 0, BoardPiece.PIECE_SIZE * 4 + 1, BoardPiece.PIECE_SIZE * 4 + 1);
		frame.Add (canvas);
		
		board = new BoardPiece [16];

		for (int i = 0; i < 15; i ++) {					
			int y = i /4;
			int x = i % 4;
			board [i] = new BoardPiece (canvas.Root (), board, x, y, i);
		}

		box.PackStart (new HSeparator (), false, false, 0);
		HBox hbox = new HBox (false, 4);
		box.PackStart (hbox, true, false, 4);

		// Scramble button here.
		Button scramble = new Button ("_Scramble");
		scramble.BorderWidth = 8;
		scramble.Clicked += new EventHandler (Scramble);
		scramble.CanDefault = true;
		hbox.PackStart (scramble, true, true, 4);
		scramble.GrabDefault ();

		// Close button
		Button close = new Button ("_Close");
		close.BorderWidth = 8;
		close.Clicked += new EventHandler (Quit);
		hbox.PackStart (close, true, true, 4);
		
		window.ShowAll ();
		fifteen.Run ();
	}
开发者ID:directhex,项目名称:xamarin-gnome-sharp2,代码行数:61,代码来源:Fifteen.cs

示例10: GetRightPane

            private VBox GetRightPane()
            {
                VBox vbox = new VBox ();

                // labels
                moveNumberLabel = new Label ();
                nagCommentLabel = new Label ();
                nagCommentLabel.Xalign = 0;
                HBox hbox = new HBox ();
                hbox.PackStart (moveNumberLabel, false, false,
                        2);
                hbox.PackStart (nagCommentLabel, false, false,
                        2);

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

                // board
                chessGameDetailsBox = new VBox ();
                chessGameDetailsBox.PackStart (gameView,
                                   true, true, 4);

                vbox.PackStart (chessGameDetailsBox, true,
                        true, 2);

                // buttons
                firstButton = new Button ();
                firstButton.Clicked += on_first_clicked;
                firstButton.Image =
                    new Image (Stock.GotoFirst,
                           IconSize.Button);
                prevButton = new Button ();
                prevButton.Clicked += on_prev_clicked;
                prevButton.Image =
                    new Image (Stock.GoBack,
                           IconSize.Button);
                nextButton = new Button ();
                nextButton.Clicked += on_next_clicked;
                nextButton.Image =
                    new Image (Stock.GoForward,
                           IconSize.Button);
                lastButton = new Button ();
                lastButton.Clicked += on_last_clicked;
                lastButton.Image =
                    new Image (Stock.GotoLast,
                           IconSize.Button);

                HBox bbox = new HBox ();
                bbox.PackStart (firstButton, false, false, 1);
                bbox.PackStart (prevButton, false, false, 1);
                bbox.PackStart (nextButton, false, false, 1);
                bbox.PackStart (lastButton, false, false, 1);
                Alignment alignment =
                    new Alignment (0.5f, 1, 0, 0);
                alignment.Add (bbox);
                alignment.Show ();

                vbox.PackStart (alignment, false, false, 2);

                return vbox;
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:60,代码来源:ChessGameWidget.cs


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