using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
...
private void Generate(int rowCount, int colCount, int cellHeight, int cellWidth, Color bg, Color border)
{
int height = rowCount * (cellHeight + 1);
int width = colCount * (cellWidth + 1);
Image image = new Bitmap(colCount * (cellWidth + 1) + 1, rowCount * (cellHeight + 1) + 1);
Graphics g = Graphics.FromImage(image);
//g.Clear(Color.FromArgb(255, 99, 98, 100));
g.Clear(bg);
g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.AntiAlias;
//Pen pen = new Pen(Color.FromArgb(255, 110, 110, 110));
Pen pen = new Pen(border);
for (int i = 0; i <= colCount; i++)
{
g.DrawLine(pen, i * (cellWidth + 1), 0, i * (cellWidth + 1), height);
}
for (int i = 0; i <= rowCount; i++)
{
g.DrawLi
【C#】 画表格
最新推荐文章于 2024-01-03 18:56:03 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)