帮助我添加使用标签来解决我的问题 [英] help me to add to use tag for solve my proplem

查看:79
本文介绍了帮助我添加使用标签来解决我的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有这个简单游戏的代码,但不能完全正常工作,
当孩子选择错误的答案时,我想添加rong_anr计数器来完成这项工作..我非常需要它..
我有解决此问题的代码,但是使用内容我需要使用标签的其他代码.


谢谢

致以最诚挚的问候




Hi,,

I have this code this simple game but not work fully ,
I want to add wrong_anr counter this work when child choose wrong answer..I need it so much..
I have code solve to this problem but that using content I need another code using tags.


Thanks

with my Best Regards




<Window x:Class="letters_Game.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
   
        <Grid removed="#FFFFC4C4">
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <Button x:Name="btn1" Content="A" Click="btn1_Click" Height="25" Width="100" Grid.Row="0"></Button>
            <Button x:Name="btn2" Content="Apple" Click="btn1_Click" Height="25" Width="100" Grid.Row="1"></Button>
            <Button x:Name="btn3" Content="correct" Height="25" Width="100" Grid.Row="2" Visibility="Collapsed"></Button>
        <TextBlock HorizontalAlignment="Left" Margin="93,5,0,0" Name="textBlock1" Text="" Width="38" Height="24" VerticalAlignment="Top" />
        <Label Content="correct answer" Height="28" HorizontalAlignment="Left" Name="label1" VerticalAlignment="Top" />
        <Button Content="B" Height="25" HorizontalAlignment="Left" Margin="316,39,0,0" Name="button1" VerticalAlignment="Top" Width="100" />
        <Button Content="Ball" Grid.Row="1" Height="25" HorizontalAlignment="Left" Margin="317,39,0,0" Name="button2" VerticalAlignment="Top" Width="100" />
    </Grid>
 
</Window>
 

The code behind,,
namespace letters_Game
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        string decision = string.Empty;
        int corr_anr;
        public MainWindow()
        {
            InitializeComponent();
        }
 
        private void btn1_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;
            if (btn != null)
            {
                if (btn.Name.Equals(decision))
                {
                    decision = string.Empty;
                }
 
                if (string.IsNullOrEmpty(decision))
                {
                    decision = btn.Name;
                }
 
                if (!(btn.Name.Equals(decision)))
                {
                    btn3.Visibility = Visibility.Visible;
                    corr_anr++;
                    textBlock1.Text = corr_anr.ToString();
 
                }
            }
        }
 
    }
}

推荐答案

首先无法识别以下情况:

removed="#FFFFC4C4"

去掉它.似乎可以正常工作.
First of all the follwowing is not recognized:

removed="#FFFFC4C4"

Remove it. Seems to work except for that.


这篇关于帮助我添加使用标签来解决我的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆