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


C# Button.SetValue方法代码示例

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


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

示例1: AddButtons

        private void AddButtons(int count)
        {
            for (int i = 0; i < count; i++)
            {
                this.GameBoard.ColumnDefinitions.Add(new ColumnDefinition());
                this.GameBoard.RowDefinitions.Add(new RowDefinition());
            }

            Button button;

            for (int x = 0; x < count; x++)
            {
                for (int y = 0; y < count; y++)
                {
                    button = new Button();
                    button.HorizontalAlignment = HorizontalAlignment.Stretch;
                    button.VerticalAlignment = VerticalAlignment.Stretch;
                    button.SetValue(Grid.ColumnProperty, x);
                    button.SetValue(Grid.RowProperty, y);

                    Thickness margin = new Thickness(10);
                    button.Margin = margin;

                    this.GameBoard.Children.Add(button);
                }
            }
        }
开发者ID:Caverat,项目名称:TicTacToe,代码行数:27,代码来源:MainPage.xaml.cs

示例2: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            
            var button = new Button{Content = "This is a button"};
            var textBlock = new TextBlock{Text="Test"};

            button.SetValue(Grid.ColumnProperty, 0);
            button.SetValue(Grid.RowProperty, 0);
            textBlock.SetValue(Grid.ColumnProperty, 1);
            textBlock.SetValue(Grid.RowProperty, 0);

            TheGrid.Children.Add(button);
            TheGrid.Children.Add(textBlock);

            //TheOrderedStackPanel.Order();
        }
开发者ID:jchristian,项目名称:wpf_experimentation,代码行数:17,代码来源:MainWindow.xaml.cs

示例3: add

 private void add(Grid grid, int column)
 {
     Button button = new Button()
     {
         Height = 80,
         Width = 20,
         FontSize = 10,
         Padding = new Thickness(0),
         Content = notes.Keys.ElementAt(column)
     };
     button.Click += (object sender, RoutedEventArgs e) =>
     {
         button = (Button)sender;
         int note = Grid.GetColumn(button);
         play(notes[notes.Keys.ElementAt(note)]);
     };
     button.SetValue(Grid.ColumnProperty, column);
     grid.Children.Add(button);
 }
开发者ID:RoguePlanetoid,项目名称:Windows-10-Universal-Windows-Platform,代码行数:19,代码来源:Library.cs

示例4: SetTable

        private void SetTable()
        {
            this.Phases.Children.Clear();
            this.Phases.RowDefinitions.Clear();
            this.Phases.ColumnDefinitions.Clear();
            var countCol = this.TemperaturesModels.First().FirstSystem.Phases.Count;
            countCol += this.TemperaturesModels.First().SecondSystem.Phases.Count;
            countCol++;
            for (int i = 0; i < countCol; i++)
            {
                this.Phases.ColumnDefinitions.Add(new ColumnDefinition(){Width = new GridLength(50)});
            }

            this.Phases.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(40) });

            foreach (var model in this.TemperaturesModels)
            {
                this.Phases.RowDefinitions.Add(new RowDefinition(){Height = new GridLength(25)});
            }

            this.Phases.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(25) });
            this.Phases.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(25) });
            this.Phases.RowDefinitions.Add(new RowDefinition());

            this.SetTitle("Фазовый состав в интервале температур", countCol);
            this.AddTextBlockInGrid("Temp", 1, 0, 1, 3, HorizontalAlignment.Center, true);
            this.AddTextBlockInGrid(this.TemperaturesModels.First().FirstSystem.Formula, 1, 1, this.TemperaturesModels.First().FirstSystem.Phases.Count, 1, HorizontalAlignment.Center, true);
            this.AddTextBlockInGrid(this.TemperaturesModels.First().SecondSystem.Formula, 1, 1 + this.TemperaturesModels.First().FirstSystem.Phases.Count, this.TemperaturesModels.First().SecondSystem.Phases.Count, 1, HorizontalAlignment.Center, true);
            var currentColumn = 1;
            foreach (var model in this.TemperaturesModels.First().FirstSystem.Phases)
            {
                this.AddTextBlockInGrid(model.Phase.Formula, 2, currentColumn, 1, 1, HorizontalAlignment.Center, true);
                currentColumn++;
            }

            foreach (var model in this.TemperaturesModels.First().SecondSystem.Phases)
            {
                this.AddTextBlockInGrid(model.Phase.Formula, 2, currentColumn, 1, 1, HorizontalAlignment.Center, true);
                currentColumn++;
            }

            var currentRow = 3;
            foreach (var model in this.TemperaturesModels)
            {
               currentColumn = 0;
               this.AddTextBlockInGrid(model.Temperature.ToString(), currentRow, currentColumn, 1, 1, HorizontalAlignment.Left, true);
                currentColumn++;
                foreach (var phase in model.FirstSystem.Phases)
                {
                    this.AddTextBoxInGrid(currentRow, currentColumn, phase);
                    currentColumn++;
                }
                foreach (var phase in model.SecondSystem.Phases)
                {
                    this.AddTextBoxInGrid(currentRow, currentColumn, phase);
                    currentColumn++;
                }
                currentRow++;
            }

            var backButton = new Button();
            backButton.Content = "Назад";
            backButton.Width = 145;
            backButton.Height = 30;
            backButton.FontSize = 18;
            backButton.Margin = new Thickness(0, 20, 0, 0);
            backButton.Click += BackToTemp;
            backButton.SetValue(Grid.RowProperty, currentRow);
            backButton.SetValue(Grid.ColumnProperty, 1);
            backButton.SetValue(Grid.ColumnSpanProperty, 3);
            this.Phases.Children.Add(backButton);

            var button = new Button();
            button.Content = "Рассчитать";
            button.Width = 145;
            button.Height = 30;
            button.FontSize = 18;
            button.Margin = new Thickness(0, 20, 0, 0);
            button.Click += PhaseGo;
            button.SetValue(Grid.RowProperty, currentRow);
            button.SetValue(Grid.ColumnProperty, countCol - 3);
            button.SetValue(Grid.ColumnSpanProperty, 3);
            this.Phases.Children.Add(button);
        }
开发者ID:bogdanovdotnet,项目名称:MeltProperties,代码行数:84,代码来源:MainWindow.xaml.cs

示例5: CreateButtons

		private void CreateButtons ()
		{
			prevButton = new Button (silver);
			nextButton = new Button (silver);

			prevButton.Text = "Previous";
			prevButton.SetValue (Canvas.TopProperty, 370);
			prevButton.SetValue (Canvas.LeftProperty, 20);
			prevButton.Clicked += OnPrevClicked;
			prevButton.Disabled = true;

			nextButton.Text = "Next";
			nextButton.SetValue (Canvas.TopProperty, 370);
			nextButton.SetValue (Canvas.LeftProperty, 170);
			nextButton.Clicked += OnNextClicked;
			nextButton.Disabled = true;

			silver.Canvas.Children.Add (prevButton);
			silver.Canvas.Children.Add (nextButton);
		}
开发者ID:dfr0,项目名称:moon,代码行数:20,代码来源:Window.cs


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