我看到了this个问题,并将CellBorderStyle
设置为None
,但由于某种原因,我仍然在我的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();
}
我在这里缺少什么?
答案 0 :(得分:0)
问题与自定义绘制的进度列单元格有关。
在它的单元格绘制方法中,我的代码类似于:
base.Paint(g, ...);
g.SmoothingMode = SmoothingMode.HighQuality;
if (value <= 0) return;
//paint the progress bar
g.SmoothingMode = SmoothingMode.None;
当方法退出而不绘制进度条时,会发生错误,使图形平滑模式处于错误状态。
仅在SmoothingMode
检查解决问题后设置Graphics
的{{1}}:
value <= 0