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


C# Button.AddHandler方法代码示例

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


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

示例1: PlayAction

 public PlayAction(Button stopAudioButton)
 {
     stopAudioButton.AddHandler(Button.ClickEvent, new RoutedEventHandler(StopAudioButton_Click));
 }
开发者ID:BBuchholz,项目名称:NineWorldsDeep,代码行数:4,代码来源:PlayAction.cs

示例2: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            _controlBarGrid = Template.FindName("PART_ControlBarGrid", this) as Grid;
            _fadeInStoryboard = Template.Resources["FadeInStoryboard"] as Storyboard;
            _fadeOutStoryboard = Template.Resources["FadeOutStoryboard"] as Storyboard;

            MouseEnter += OnGadgetContainerMouseEnter;
            MouseLeave += OnGadgeContainerMouseLeave;
            PreviewMouseLeftButtonDown += OnGadgetContainerPreviewMouseLeftButtonDown;

            _closeButton = Template.FindName("PART_CloseButton", this) as Button;

            if (_closeButton != null)
            {
                _closeButton.AddHandler(MouseLeftButtonUpEvent, new RoutedEventHandler(OnCloseButtonClick), true);
            }

            _optionButton = Template.FindName("PART_OptionButton", this) as Button;

            if (_optionButton != null)
            {
                _optionButton.AddHandler(MouseLeftButtonUpEvent, new RoutedEventHandler(OnOptionButtonClick), true);
            }
        }
开发者ID:gitter-badger,项目名称:UROCare,代码行数:24,代码来源:GadgetContainer.cs

示例3: PrepareCompleteBox

 private void PrepareCompleteBox()
 {
     clearbutton = new Button();
     clearbutton.Style = FindResource("ClearButtonStyle") as Style;
     clearbutton.Content = "\xE10A";
     clearbutton.FontFamily = new FontFamily("Segoe UI Symbol");
     clearbutton.FontSize = 9;
     clearbutton.AddHandler(MouseDownEvent, new MouseButtonEventHandler(clearbutton_Click), true);
 }
开发者ID:angela-1,项目名称:aec,代码行数:9,代码来源:AHome.xaml.cs

示例4: exitButton

		private System.Windows.Controls.Button exitButton(int id)
		{
			System.Windows.Controls.Image img = new System.Windows.Controls.Image();
			BitmapImage image = new BitmapImage(new Uri("/Resources/delete.ico", UriKind.Relative));
			img.Source=image;
			
			StackPanel bsp = new StackPanel();
			bsp.Children.Add(img);
			
    		System.Windows.Controls.Button b = new System.Windows.Controls.Button();
    		b.AddHandler(System.Windows.Controls.Button.ClickEvent, new RoutedEventHandler(closeTab));
    		b.Content=bsp;
    		b.Height=16;
    		b.Width=16;
    		b.Padding = new Thickness(0, 0, 0, 0);
    		
    		Thickness thick = new Thickness();
    		thick.Bottom = 0;
    		thick.Top = 0;
    		thick.Left = 0;
    		thick.Right = 0;
    		SolidColorBrush scb = new SolidColorBrush();
    		scb.Color = Color.FromArgb(0,0,0,0);
    		
    		b.Background = scb;
    		b.BorderThickness = thick;
    		b.Name = "_" + id + "b";
    		
    		return b;
		}
开发者ID:Team624,项目名称:2015Beta,代码行数:30,代码来源:Window1.xaml.cs

示例5: render

        private void render()
        {
            Board.Children.Clear();
            for (int r = 0; r < board.numberRows; r++)
            {
                for (int c = 0; c < board.numberCols; c++)
                {
                    Grid cell = new Grid();
                    if (board.boardSpace(r, c).isMoveOption)
                    {
                        cell.Background = moveOption;
                        Button button = new Button();
                        button.Opacity = 0.0;
                        button.AddHandler(Button.ClickEvent, new RoutedEventHandler(MoveOption_Click));
                        Board.Children.Add(cell);
                        cell.Children.Add(button);
                    }
                    else
                    {
                        switch (board.boardSpace(r, c).tileTerrain)
                        {
                            case 0: //grass tile
                                cell.Background = grass;
                                Board.Children.Add(cell);
                                break;
                            case 1: //mountain tile
                                cell.Background = mountain;
                                Board.Children.Add(cell);
                                break;
                            case 2: //water tile
                                cell.Background = water;
                                Board.Children.Add(cell);
                                break;
                            case 3: //swamp tile
                                cell.Background = swamp;
                                Board.Children.Add(cell);
                                break;
                        }
                    }

                    if(board.boardSpace(r,c).containsCharacter() == true)
                    {
                        if (board.boardSpace(r, c).tileCharacter.GetType() == typeof(GameBoard.Player))
                        {
                            Ellipse circle = new Ellipse();
                            Button button = new Button();
                            circle.Fill = black;
                            button.Opacity = 0.0;
                            button.AddHandler(Button.ClickEvent, new RoutedEventHandler(Player_Click));
                            cell.Children.Add(circle);
                            cell.Children.Add(button);
                        }
                        else if(board.boardSpace(r, c).tileCharacter.GetType() == typeof(GameBoard.Enemy))
                        {
                            Ellipse circle = new Ellipse();
                            circle.Fill = red;
                            cell.Children.Add(circle);
                        }
                    }
                }
            }
        }
开发者ID:insonia78,项目名称:project,代码行数:62,代码来源:MainWindow.xaml_backup.cs


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