WPF中的棋盘 [英] Chessboard in WPF
问题描述
多年来,我一直使用Winforms进行开发,现在我想切换到WPF并制作棋盘。不幸的是,我不知道从哪里开始。使用WPF使我非常不确定,我感觉又像是菜鸟。有人可以概述基本设计吗?我想我会从8x8网格开始,将矩形用作正方形,将图像用作块。接着?我会丢失什么吗?
For years I've developed with Winforms, now I want to switch to WPF and make a chessboard. Unfortunately I have no idea where to start. Using WPF makes me very unsure, I'm feeling like a noob again. Can someone outline a basic design? I guess I would start with a 8x8 Grid and use rectangles for the squares, images for pieces. And then? Am I missing something?
编辑:这只是关于用户界面;
It's just about the user interface; what goes on behind the scenes is no problem.
推荐答案
标准网格的替代方法是使用 UniformGrid
( msdn链接)。
An alternative to the standard grid, is the use of a UniformGrid
(msdn link).
(我认为)它可能更适合于此,因为它将始终为您提供相同大小的像元。
It's probably more suited to this (in my opinion) as it will ALWAYS give you the same size cells.
使用的ala:
<UniformgGrid Columns="8" Rows="8">
<Control1/>
<Control2/>
<Control3/>
</UniformGrid>
这些答案中的任何一个都会给您您想要的结果。
any of these answers will give you the results you desire.
这篇关于WPF中的棋盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!