dataGridView1_CellPainting导致flickinger视图并影响其他控件 [英] dataGridView1_CellPainting causes flickinger view and effects other control

查看:129
本文介绍了dataGridView1_CellPainting导致flickinger视图并影响其他控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用dataGridView1_CellPainting删除合并单元格的边框。该视图工作正常,除了最后一行"e.AdvancedBorderStyle.Top
= DataGridViewAdvancedCellBorderStyle.Single;"语句,导致视图闪烁和奇怪的行为到另一个面板中的另一个DateTime选择器控件。  当网格中显示值时,似乎会发生闪烁。  与DateTime选择器相同
,当网格中显示值时,它不会在文本框中显示日期。  但是没有最后一行,没有闪烁,DateTime控件文本框显示正常,但我根本没有任何边框。
请帮助。





        private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
            if (e.RowIndex < 1 || e.ColumnIndex < 0)  return;

            e.AdvancedBorderStyle.Bottom = DataGridViewAdvancedCellBorderStyle.None;

            if (cellTopBorderLines[e.RowIndex, e.ColumnIndex])
                e.AdvancedBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.None;
            else 
                e.AdvancedBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.Single;  // Causes flickering and effects other control
        }


推荐答案

嗨2k3_to_2k8_dummy,

Hi 2k3_to_2k8_dummy,

谢谢你在这里发帖。

根据你的问题与Winform有关,我将其移至
Windows Forms General
论坛支持。

According to your question is more related to Winform, I will move it to Windows Forms General forum for suitable support.

Visual C#讨论并询问C#编程语言,IDE,库,示例和工具。

The Visual C# discuss and ask the C# programming language, IDE, libraries, samples and tools.

如果你有一些语法或代码错误,请随时与我们联系。我们将尽力为您提供解决方案。

If you have some grammar or code errors, please feel free to contact us. We will try our best to give you a solution.

感谢您的理解与合作。

最诚挚的问候,

Wendy


这篇关于dataGridView1_CellPainting导致flickinger视图并影响其他控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆