zoukankan      html  css  js  c++  java
  • wpf 分别用前台和后台 两种方法 绘制矩形 填充

    xaml:

    <Window x:Class="WpfApplication1.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">
        <UniformGrid x:Name="CheckeBoard">
            <!--<Rectangle Fill="Black"/>
            <Rectangle Fill="White" />
            <Rectangle Fill="White" />
            <Rectangle Fill="Black"/>-->
        </UniformGrid>
    </Window>


     

    后台:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    
    namespace WpfApplication1
    {
        /// <summary>
        /// MainWindow.xaml 的交互逻辑
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
                CheckeBoard.Rows = 7;
                CheckeBoard.Columns = 7;
    
                for (int i = 0; i <= 24; i++) {
                    CheckeBoard.Children.Add(new Rectangle() { Fill = Brushes.Black });
                    CheckeBoard.Children.Add(new Rectangle() { Fill = Brushes.White });
                }
            }
        }
    }
    


     

  • 相关阅读:
    php 字符串
    iOS copy&mutableCopy理解
    Swift学习(二)
    Swift 学习一函数&函数属性&懒加载
    LICEcap GIF 屏幕录制工具
    UIApplication介绍
    进度条渐变色
    -(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
    DedeCms 5.7友情链接模块注入漏洞
    phpcms v9会员中心文件上传漏洞
  • 原文地址:https://www.cnblogs.com/snake-hand/p/3190161.html
Copyright © 2011-2022 走看看