在VS2010中制作WINFORM时,如何画出这样的表格?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在VS2010中制作WINFORM时,如何画出这样的表格?相关的知识,希望对你有一定的参考价值。
新建一个picturebox,调整大小,在picturebox1_Paint事件中输入以下代码:
e.Graphics.DrawLine(Pens.Black, grid_w, 0, grid_w, grid_h * 7);
for (int i = 2; i < 6; i++)
e.Graphics.DrawLine(Pens.Black, grid_w * i, 0, grid_w * i, grid_h);
e.Graphics.DrawLine(Pens.Black, grid_w * i, grid_h * 2, grid_w * i, grid_h * 3);
e.Graphics.DrawLine(Pens.Black, grid_w * i, grid_h * 5, grid_w * i, grid_h * 7);
e.Graphics.DrawLine(Pens.Black, grid_w * 6, grid_h * 5, grid_w * 6, grid_h * 7);
e.Graphics.DrawLine(Pens.Black, grid_w * 7, grid_h * 5, grid_w * 7, grid_h * 7);
e.Graphics.DrawLine(Pens.Black, grid_w * 8, grid_h * 5, grid_w * 8, grid_h * 7);
e.Graphics.DrawLine(Pens.Black, grid_w * 6, 0, grid_w * 6, grid_h * 3);
e.Graphics.DrawLine(Pens.Black, grid_w, grid_h * 11, grid_w, pictureBox1.Height);
e.Graphics.DrawLine(Pens.Black, 0, grid_h, grid_w * 6, grid_h);
e.Graphics.DrawLine(Pens.Black, 0, grid_h * 2, grid_w * 6, grid_h * 2);
for (int i = 3;i<6;i++)
e.Graphics.DrawLine(Pens.Black, 0, grid_h * i, pictureBox1.Width, grid_h * i);
e.Graphics.DrawLine(Pens.Black, grid_w, grid_h * 6, pictureBox1.Width, grid_h * 6);
e.Graphics.DrawLine(Pens.Black, 0, grid_h * 7 + Font.Height+4, pictureBox1.Width, grid_h * 7 + Font.Height+4);
e.Graphics.DrawLine(Pens.Black, 0, grid_h * 7, pictureBox1.Width, grid_h * 7);
e.Graphics.DrawLine(Pens.Black, 0, grid_h * 11, pictureBox1.Width, grid_h * 11); 参考技术A 使用报表控件吧。追问
非常感谢,能具体说下是哪个报表控件吗?
以上是关于在VS2010中制作WINFORM时,如何画出这样的表格?的主要内容,如果未能解决你的问题,请参考以下文章
vs2010在win10中打包winform程序,无法在win7上运行,win10正常运行。