100行C#代码实现经典扫雷游戏

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

100行C#代码实现经典扫雷游戏

微小冷   2023-03-23 我要评论

布局

布局效果如下,下面每个“网格”都是一个按钮,点击按钮,就会有相应的事件发生。

由于UniformGrid中每个Grid的尺寸相等,所以作为雷区的容器。

    <DockPanel>
        <DockPanel.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="Margin" Value="5"/>
            </Style>
            <Style TargetType="TextBox">
                <Setter Property="Margin" Value="5"/>
                <Setter Property="InputMethod.IsInputMethodEnabled" Value="False"/>
            </Style>

        </DockPanel.Resources>
        <ToolBar DockPanel.Dock="Top">
            <TextBlock Text="雷区尺寸"/>
            <TextBox Width="40" Text="20" x:Name="txtNumX"/>
            <TextBlock Text="×"/>
            <TextBox Width="40" Text="20" x:Name="txtNumY"/>
            <TextBlock Text="雷数"/>
            <TextBox Width="40" Text="20" x:Name="txtNumMine"/>
            <Button Content="
      

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们