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-08-17 00:00:00 发布
这篇博客详细介绍了如何在C#环境中利用编程技巧绘制表格,涵盖了相关的API使用和示例代码,帮助开发者掌握这一技能。
摘要由CSDN通过智能技术生成