无缝网格 [英] Seamless Grids
问题描述
大家好!我正在尝试创建一个无缝的网格视图以在我的C#应用程序中显示数据.我希望能够在背景图片上方看到数字-没有网格线或框等.仅显示数字.
有任何想法吗?
非常感谢您提前抽出时间,
Dusty
Hello all! I''m trying to create a seamless grid view to display data within my C# application. I want to be able to see the numbers on top of my background image- no gridlines or boxes, etc. Just the number display.
Any ideas?
I appreciate your time in advance,
Dusty
推荐答案
右键单击DataGridView控件,单击属性",找到"CellBorderStyle"并设置为"None"……看是否可以解决这个问题
Right-click on DataGridView control, click "Properties", find "CellBorderStyle" and set to "None" ... see if that takes care of it.
今天我遇到了一个有趣的问题,因为我目前正在研究A *变体网格搜索以在下周教我的学生...为了测试目的,我制作了一个WinForm使用一个400 x 400的FlowLayoutPanel控件,并将其分为8x8网格和一个50x50的单元格.
然后,我编写了以下代码来填充面板.
Funny thing I came across this question today as I am currently working on an A* variation Grid-Search to teach my students next week... Just for testing purposes I made a WinForm with a FlowLayoutPanel control that was 400 x 400 and divided it into and 8x8 Grid resulting in a 50x50 Cell.
I then wrote the following code to populate the panel.
protected List<string> Colors;
protected Color RandomColor()
{
Color ret;
/* Truncated Code */
return ret;
}
private void Form1_Load(object sender, EventArgs e)
{
Colors = new List<string>();
Grid8x8.Margin = new System.Windows.Forms.Padding(0);
Grid8x8.Padding = new System.Windows.Forms.Padding(0);
Grid8x8.BorderStyle = BorderStyle.FixedSingle;
Initialize();
}
private void Initialize()
{
Colors.Clear();
Grid8x8.Controls.Clear();
int i;
for (i = 0; i < 64; i++)
{
cell = new Label();
cell.Text = i.ToString();
cell.AutoSize = false;
cell.BorderStyle = BorderStyle.None;
cell.TextAlign = ContentAlignment.MiddleCenter;
cell.Width = 50;
cell.Height = 50;
cell.Margin = new System.Windows.Forms.Padding(0);
currentColor = RandomColor();
previousColor = currentColor;
cell.BackColor = currentColor;
Grid8x8.Controls.Add(cell);
Colors.Add(currentColor.ToString());
}
}
由于List是从0开始的索引,而不是多维数组,因此可以肯定地说,如果X == CurrentCellIndex,则X + 8等于直接在CurrentCellIndex下面的单元格.
希望这会有所帮助,
-ArtificerGM
Since the List is 0-based index instead of a multi-dimensional array its safe to say that if X == CurrentCellIndex then X + 8 will equal the Cell Directly below the CurrentCellIndex.
Hope this helps,
-ArtificerGM
这篇关于无缝网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!