1

我已经看到了这个问题,并已设置CellBorderStyleNone,但由于某种原因,我的网格线仍然存在DataGridView

在此处输入图像描述

这是我用来初始化控件的代码:

public FtpTransferGridView()
{
    this.AutoGenerateColumns = false;
    this.DoubleBuffered = true;
    this.ReadOnly = true;
    this.AllowUserToAddRows = false;
    this.AllowUserToDeleteRows = false;
    this.AllowUserToResizeRows = false;
    this.ShowEditingIcon = false;
    this.RowHeadersVisible = false;
    this.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
    this.AlternatingRowsDefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(240, 240, 225);
    this.RowTemplate.Height = 20;
    this.CellBorderStyle = DataGridViewCellBorderStyle.None;
    this.BackgroundColor = System.Drawing.SystemColors.Window;

    InitializeColumns();
}

我在这里想念什么?

4

1 回答 1

1

该问题与自定义绘制的进度列单元格有关。

在它的单元格绘制方法中,我的代码类似于:

base.Paint(g, ...);
g.SmoothingMode = SmoothingMode.HighQuality;
if (value <= 0) return;

//paint the progress bar

g.SmoothingMode = SmoothingMode.None;

当方法退出而不绘制进度条时会发生错误,从而使图形平滑模式处于不正确的状态。

只有在检查解决问题后SmoothingMode的设置:Graphicsvalue <= 0

base.Paint(g, ...);
if (value <= 0) return;
g.SmoothingMode = SmoothingMode.HighQuality;

//paint the progress bar

g.SmoothingMode = SmoothingMode.None;
于 2013-01-28T07:01:26.447 回答