因为C1FlexGrid不支持修改边框颜色,所以我们在Paint事件中重绘了表格控件的边框,正常情况下绘制没有问题,
但是如果在固定行和固定列的交汇处有合并,绘制就会出现问题,如上图所示,
测试代码:(c1FlexGrid1是向窗体拖的Grid控件)
private void Form1_Load(object sender, EventArgs e)
{
c1FlexGrid1.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None;
c1FlexGrid1.AllowMerging = AllowMergingEnum.Custom;
c1FlexGrid1.ScrollBars = ScrollBars.None;
c1FlexGrid1.Rows.Count = 0;
c1FlexGrid1.Cols.Count = 0;
c1FlexGrid1.Rows.Count = 50;
c1FlexGrid1.Cols.Count = 50;
c1FlexGrid1.Rows.Fixed = 3;
c1FlexGrid1.Cols.Fixed = 1;
c1FlexGrid1.Width = 500;
c1FlexGrid1.Height = 200;
c1FlexGrid1.MergedRanges.Add(0, 0, 2, 0);
c1FlexGrid1.MergedRanges.Add(5, 0, 7, 0);
c1FlexGrid1.MergedRanges.Add(0, 3, 0, 5);
c1FlexGrid1[0, 0] = "索引";
c1FlexGrid1.Paint += (s1, e1) =>
{
e1.Graphics.DrawRectangle(new Pen(Color.Red, 1), 0, 0, c1FlexGrid1.Width - 1, c1FlexGrid1.Height - 1);
};
}
|