Click here to Skip to main content
15,881,424 members
Articles / Programming Languages / C#
Tip/Trick

Reducing flicker, blinking in DataGridView

Rate me:
Please Sign up or sign in to vote.
5.00/5 (25 votes)
23 May 2012CPOL 73.6K   28   25
Reducing flicker and blinking in DataGridView.

Introduction

One of my project requirement was to create a Output Window similar to Visual Studio. For that I used a DataGridView. But when I start my application, I found that there is lot of blinking, flicker, pulling... After badly hitting my head with Google, I found a very easy way. We just need to create a extension method to DataGridView and it's all done:

C#
public static void DoubleBuffered(this DataGridView dgv, bool setting) 
{ 
    Type dgvType = dgv.GetType(); 
    PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", 
          BindingFlags.Instance | BindingFlags.NonPublic); 
    pi.SetValue(dgv, setting, null); 
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions

 
Question5 STAR Pin
GEEDER9-Dec-18 19:26
GEEDER9-Dec-18 19:26 
QuestionThank you sir Pin
Member 135102279-Aug-18 1:37
Member 135102279-Aug-18 1:37 
PraiseThanks Pin
Marco Giovanni20-Jul-16 7:34
Marco Giovanni20-Jul-16 7:34 
QuestionGreat! Pin
Ocean Airdrop7-May-16 20:42
Ocean Airdrop7-May-16 20:42 
QuestionThanks! Pin
ElReverendo13-Oct-15 4:45
ElReverendo13-Oct-15 4:45 
QuestionThank you. That was very useful! Pin
Dreamer9329-Jul-15 23:30
Dreamer9329-Jul-15 23:30 
QuestionThank you Pin
Manuel Serrano Rojas19-May-14 2:38
Manuel Serrano Rojas19-May-14 2:38 
AnswerRe: Thank you Pin
Shweta Lodha3-Jun-14 8:05
Shweta Lodha3-Jun-14 8:05 
AnswerRe: Thank you Pin
Shweta Lodha16-Jun-14 2:13
Shweta Lodha16-Jun-14 2:13 
GeneralMany thanks! Pin
gmax7518-Mar-14 13:31
gmax7518-Mar-14 13:31 
You solved my problem with annoying flickering icons in DataGridView.
Thanks again! Big Grin | :-D
GeneralRe: Many thanks! Pin
Shweta Lodha28-Mar-14 16:28
Shweta Lodha28-Mar-14 16:28 
GeneralThanks! Pin
Luís Fernando Quitaiski22-Oct-13 2:03
Luís Fernando Quitaiski22-Oct-13 2:03 
GeneralRe: Thanks! Pin
Shweta Lodha24-Oct-13 7:30
Shweta Lodha24-Oct-13 7:30 
QuestionSolved my problem Pin
Soji Omiwade29-Aug-13 17:22
Soji Omiwade29-Aug-13 17:22 
AnswerRe: Solved my problem Pin
Shweta Lodha29-Aug-13 22:12
Shweta Lodha29-Aug-13 22:12 
QuestionHow to use? Pin
olssoninc20-Aug-13 21:04
olssoninc20-Aug-13 21:04 
QuestionSovled my flickering issues Pin
HHuysamen15-Aug-13 1:37
HHuysamen15-Aug-13 1:37 
AnswerRe: Sovled my flickering issues Pin
Shweta Lodha15-Aug-13 4:09
Shweta Lodha15-Aug-13 4:09 
GeneralMy vote of 5 Pin
HHuysamen15-Aug-13 1:36
HHuysamen15-Aug-13 1:36 
QuestionVote of 5 Pin
zeeshan dar2-Jul-13 0:36
zeeshan dar2-Jul-13 0:36 
AnswerRe: Vote of 5 Pin
Shweta Lodha4-Aug-13 2:21
Shweta Lodha4-Aug-13 2:21 
GeneralMy vote of 1 Pin
sandyellow29-Nov-12 19:36
sandyellow29-Nov-12 19:36 
GeneralMy vote of 5 Pin
Shantoh22-Sep-12 6:19
Shantoh22-Sep-12 6:19 
GeneralRe: My vote of 5 Pin
Shweta Lodha15-Aug-13 4:09
Shweta Lodha15-Aug-13 4:09 
GeneralMy vote of 5 Pin
honeysinghi23-May-12 17:11
honeysinghi23-May-12 17:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.