本文整理汇总了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));
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
}
}
}
}