当前位置: 首页 > article >正文

65.棋盘 C#例子 WPF例子

这是一个不具备任何功能的UI设计,使用矩形和边界和文字块。通过这些可以自由的创建不同显示效果的内容。

棋盘展示:

代码展示:

<Window x:Class="棋盘设计.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:棋盘设计"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Border Margin="10" Grid.Column="1" Grid.Row="1" Grid.RowSpan="4" Grid.ColumnSpan="4" Background="LightBlue">
            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="此片区域覆盖显示为蓝色" FontSize="24"/>
        </Border>
        
        <Rectangle Grid.Column="1" Grid.Row="0" Fill="Red" Margin="0,10,0,0"/>
        <Rectangle Grid.Column="0" Grid.Row="0" Fill="Red" Margin="10,10,0,0"/>
        <Rectangle Grid.Column="0" Grid.Row="1" Fill="Red" Margin="10,0,0,0"/>
        <Rectangle Grid.Column="0" Grid.Row="2" Fill="Red" Margin="10,0,0,0"/>
        <Rectangle Grid.Column="0" Grid.Row="3" Fill="Red" Margin="10,0,0,0"/>
        <Rectangle Grid.Column="0" Grid.Row="4" Fill="Red" Margin="10,0,0,0"/>
        <Rectangle Grid.Column="0" Grid.Row="5" Fill="Red" Margin="10,0,0,10"/>
        <Rectangle Grid.Column="1" Grid.Row="5" Fill="Red" Margin="0,0,0,10"/>
        <Rectangle Grid.Column="2" Grid.Row="5" Fill="LightGreen" Margin="0,0,0,10" Stroke="Yellow"/>
        <Rectangle Grid.Column="3" Grid.Row="5" Fill="LightGreen" Margin="0,0,0,10" Stroke="Yellow"/>
        <Rectangle Grid.Column="4" Grid.Row="5" Fill="LightGreen" Margin="0,0,0,10" Stroke="Yellow"/>
        <Rectangle Grid.Column="5" Grid.Row="5" Fill="LightGreen" Margin="0,0,10,10" Stroke="Yellow"/>
        <Rectangle Grid.Column="5" Grid.Row="4" Fill="LightGreen" Margin="0,0,10,0" Stroke="Yellow"/>
        <Border Grid.Column="5" Grid.Row="0" Background="WhiteSmoke" Margin="5">
            <TextBlock Text="棋盘显示" HorizontalAlignment="Center" VerticalAlignment="Center"/>
        </Border>
    </Grid>
</Window>


http://www.kler.cn/a/536919.html

相关文章:

  • MacOS 安装NVM
  • 什么是自动化测试?自动化测试的作用
  • 当代编程语言的新思路:废除独立关键字,使用时加标志
  • 【医院绩效管理专题】2.绩效管理:医院发展的核心驱动力
  • 当今前沿技术:改变未来的核心力量
  • LPJ-GUESS模型入门(一)
  • 计算机考研复试上机02
  • 网安三剑客:DNS、CDN、VPN
  • 一文讲解Spring中事务的传播机制
  • vue组件间的数据传递:自定义输入组件(v-model/defineModel)
  • Android显示原理
  • SqlServer查看锁表与解锁
  • 零基础构建开源项目OpenIM桌面应用和pc web- Electron篇
  • 备赛蓝桥杯之第十五届职业院校组省赛第四题:多表单校验
  • Android开发签名校验
  • 新能源产业的质量革命:六西格玛培训如何重塑制造竞争力
  • uniapp实现人脸识别(不使用三方插件)
  • ISP代理与住宅代理的区别
  • MySQL——数据库的操作
  • 【重新认识C语言----文件管理篇】
  • 【面试场景】MySQL分布式主键选取
  • C++,设计模式,【单例模式】
  • NetCore Consul动态伸缩+Ocelot 网关 缓存 自定义缓存 + 限流、熔断、超时 等服务治理 + ids4鉴权
  • 学习率调整策略 | PyTorch 深度学习实战
  • IntelliJ IDEA新版本的底部version control(或git)里local change窗口显示配置修改详细教程
  • PHP填表统计预约打卡表单系统小程序