Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › [C#] [Solved] TreeView blinking when YouTube is open
New Posts  All Forums:Forum Nav:

[C#] [Solved] TreeView blinking when YouTube is open

post #1 of 9
Thread Starter 
There are already several occasions where YouTube refuses to play nice with the WebBrowser control, but this one is really weird.

I have a form, where I have 2 panels.
One of them contains 1-n webBrowser controls, the other - a treeview that represents a folder tree on the HDD.
Now, if I have 1 webbrowser that has opened YouTube, even if it is NOT on top (so even if it is not directly visible), my treeView starts blinking like hell.
The moment I close that YouTube webBrowser object, the blinking stops.

It's the same blinking you get when you resize the form.
form.DoubleBuffered = true does not fix it.

Anybody got a clue? Google is not fruitful so far.
Edited by ronnin426850 - 9/19/12 at 6:07am
R.E.D (dead)
(5 items)
 
Wife's D3 machine
(13 items)
 
 
CPUGraphicsRAMHard Drive
Core 2 Duo P8400 Nvidia 9600M GT 2x2Gb Hynx DDR2 WD Scorpio Blue 
OS
Windows 7 x64 Professional 
CPUMotherboardGraphicsRAM
Intel Pentium G840 DualCore SB 2.8Ghz AsRock H61M-VS Inno3D 8800 GTS 320 Kingston HyperX 1600 4Gb 
Hard DriveOptical DriveCoolingOS
WD Scorpio Blue 250Gb LiteOn DVD-RW stock Win 7 Home Premium 
MonitorKeyboardPowerCase
Acer 19" 1440x900 Logitech MX3200 beQuiet 300W MS-Tech CA-0130 Black 
Mouse
Logitech MX300 Laser 
  hide details  
Reply
R.E.D (dead)
(5 items)
 
Wife's D3 machine
(13 items)
 
 
CPUGraphicsRAMHard Drive
Core 2 Duo P8400 Nvidia 9600M GT 2x2Gb Hynx DDR2 WD Scorpio Blue 
OS
Windows 7 x64 Professional 
CPUMotherboardGraphicsRAM
Intel Pentium G840 DualCore SB 2.8Ghz AsRock H61M-VS Inno3D 8800 GTS 320 Kingston HyperX 1600 4Gb 
Hard DriveOptical DriveCoolingOS
WD Scorpio Blue 250Gb LiteOn DVD-RW stock Win 7 Home Premium 
MonitorKeyboardPowerCase
Acer 19" 1440x900 Logitech MX3200 beQuiet 300W MS-Tech CA-0130 Black 
Mouse
Logitech MX300 Laser 
  hide details  
Reply
post #2 of 9
Well I know the cause of it, the TreeView is getting re-drawn over and over, however I'm not sure of a solution.

Let me do some tinkering and see if I can come up with a solution.
Back in Black
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II X4 965 BE (C3) Biostar TA790GX A3+ Sapphire HD 5770 (v2) CORSAIR XMS3 4GB DDR3 
Hard DriveOptical DriveOSMonitor
WD Caviar Black 640GB Sony Optiarc CD/DVD RW Windows 7 Ultimate x64 NEC MultiSync LCD 1960NXi 
KeyboardPowerCaseMouse
Microsoft Comfort Curve Keyboard 2000 Corsair 650TX Cooler Master Storm Scout Logitech MX 400 Laser 
  hide details  
Reply
Back in Black
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II X4 965 BE (C3) Biostar TA790GX A3+ Sapphire HD 5770 (v2) CORSAIR XMS3 4GB DDR3 
Hard DriveOptical DriveOSMonitor
WD Caviar Black 640GB Sony Optiarc CD/DVD RW Windows 7 Ultimate x64 NEC MultiSync LCD 1960NXi 
KeyboardPowerCaseMouse
Microsoft Comfort Curve Keyboard 2000 Corsair 650TX Cooler Master Storm Scout Logitech MX 400 Laser 
  hide details  
Reply
post #3 of 9
Thread Starter 
Thank you. Yes, I figured a redraw might be causing it, and I know I'm not explicitly causing the redraw, I double-checked with the debugger tongue.gif Any idea on why specifically YouTube is triggering this?
R.E.D (dead)
(5 items)
 
Wife's D3 machine
(13 items)
 
 
CPUGraphicsRAMHard Drive
Core 2 Duo P8400 Nvidia 9600M GT 2x2Gb Hynx DDR2 WD Scorpio Blue 
OS
Windows 7 x64 Professional 
CPUMotherboardGraphicsRAM
Intel Pentium G840 DualCore SB 2.8Ghz AsRock H61M-VS Inno3D 8800 GTS 320 Kingston HyperX 1600 4Gb 
Hard DriveOptical DriveCoolingOS
WD Scorpio Blue 250Gb LiteOn DVD-RW stock Win 7 Home Premium 
MonitorKeyboardPowerCase
Acer 19" 1440x900 Logitech MX3200 beQuiet 300W MS-Tech CA-0130 Black 
Mouse
Logitech MX300 Laser 
  hide details  
Reply
R.E.D (dead)
(5 items)
 
Wife's D3 machine
(13 items)
 
 
CPUGraphicsRAMHard Drive
Core 2 Duo P8400 Nvidia 9600M GT 2x2Gb Hynx DDR2 WD Scorpio Blue 
OS
Windows 7 x64 Professional 
CPUMotherboardGraphicsRAM
Intel Pentium G840 DualCore SB 2.8Ghz AsRock H61M-VS Inno3D 8800 GTS 320 Kingston HyperX 1600 4Gb 
Hard DriveOptical DriveCoolingOS
WD Scorpio Blue 250Gb LiteOn DVD-RW stock Win 7 Home Premium 
MonitorKeyboardPowerCase
Acer 19" 1440x900 Logitech MX3200 beQuiet 300W MS-Tech CA-0130 Black 
Mouse
Logitech MX300 Laser 
  hide details  
Reply
post #4 of 9
Quote:
Originally Posted by ronnin426850 View Post

Thank you. Yes, I figured a redraw might be causing it, and I know I'm not explicitly causing the redraw, I double-checked with the debugger tongue.gif Any idea on why specifically YouTube is triggering this?

You will need to double buffer the tree view control. A little bit of reflection magic smile.gif
Code:
public static void SetDoubleBuffered( Control c )
{
        if ( SystemInformation.TerminalServerSession )
        {
                return;
        }

        PropertyInfo property = typeof( Control ).GetProperty(
                        "DoubleBuffered",
                        BindingFlags.NonPublic |
                        BindingFlags.Instance );

        property .SetValue( c, true, null );
}

// usage
SetDoubleBuffered( My_TreeViewControl );

Although this only solves the symptom... not sure why it is causing it to repaint.
Edited by tompsonn - 9/18/12 at 5:26pm
My System
(30 items)
 
"Zeus"
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i5 2500K (4.5ghz @ 1.320v) Gigabyte Z68X-UD3R-B3 MSI R7970 Lightning Corsair 16GB (4x4GB) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Crucial M4 128GB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 7 Ultimate 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2212HM Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Microsoft IntelliMouse Optical  XTRAC Ripper XXL 
AudioAudioAudioAudio
Westone W3 IEMs RE-272 IEMs Shure SE-215 IEMs Schiit Bifrost DAC 
AudioAudio
Schiit Asgard 2 amp HiVi Swan M50W 2.1 
CPUMotherboardGraphicsRAM
Intel Core i7 950 GA-X58-UD3R Radeon HD 5450  24GB Corsair @ 1333mhz 
Hard DriveOSPowerCase
4x WD Cavair Red 1TB in RAID 0 Windows Server 2008 R2 x64 Corsair HX-520 LianLi LanCool 
  hide details  
Reply
My System
(30 items)
 
"Zeus"
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i5 2500K (4.5ghz @ 1.320v) Gigabyte Z68X-UD3R-B3 MSI R7970 Lightning Corsair 16GB (4x4GB) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Crucial M4 128GB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 7 Ultimate 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2212HM Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Microsoft IntelliMouse Optical  XTRAC Ripper XXL 
AudioAudioAudioAudio
Westone W3 IEMs RE-272 IEMs Shure SE-215 IEMs Schiit Bifrost DAC 
AudioAudio
Schiit Asgard 2 amp HiVi Swan M50W 2.1 
CPUMotherboardGraphicsRAM
Intel Core i7 950 GA-X58-UD3R Radeon HD 5450  24GB Corsair @ 1333mhz 
Hard DriveOSPowerCase
4x WD Cavair Red 1TB in RAID 0 Windows Server 2008 R2 x64 Corsair HX-520 LianLi LanCool 
  hide details  
Reply
post #5 of 9
Thread Starter 
Quote:
Originally Posted by tompsonn View Post

You will need to double buffer the tree view control. A little bit of reflection magic smile.gif
Code:
public static void SetDoubleBuffered( Control c )
{
        if ( SystemInformation.TerminalServerSession )
        {
                return;
        }
        PropertyInfo property = typeof( Control ).GetProperty(
                        "DoubleBuffered",
                        BindingFlags.NonPublic |
                        BindingFlags.Instance );
        property .SetValue( c, true, null );
}
// usage
SetDoubleBuffered( My_TreeViewControl );
Although this only solves the symptom... not sure why it is causing it to repaint.

I'm afraid that doesn't do it either.. frown.gif
R.E.D (dead)
(5 items)
 
Wife's D3 machine
(13 items)
 
 
CPUGraphicsRAMHard Drive
Core 2 Duo P8400 Nvidia 9600M GT 2x2Gb Hynx DDR2 WD Scorpio Blue 
OS
Windows 7 x64 Professional 
CPUMotherboardGraphicsRAM
Intel Pentium G840 DualCore SB 2.8Ghz AsRock H61M-VS Inno3D 8800 GTS 320 Kingston HyperX 1600 4Gb 
Hard DriveOptical DriveCoolingOS
WD Scorpio Blue 250Gb LiteOn DVD-RW stock Win 7 Home Premium 
MonitorKeyboardPowerCase
Acer 19" 1440x900 Logitech MX3200 beQuiet 300W MS-Tech CA-0130 Black 
Mouse
Logitech MX300 Laser 
  hide details  
Reply
R.E.D (dead)
(5 items)
 
Wife's D3 machine
(13 items)
 
 
CPUGraphicsRAMHard Drive
Core 2 Duo P8400 Nvidia 9600M GT 2x2Gb Hynx DDR2 WD Scorpio Blue 
OS
Windows 7 x64 Professional 
CPUMotherboardGraphicsRAM
Intel Pentium G840 DualCore SB 2.8Ghz AsRock H61M-VS Inno3D 8800 GTS 320 Kingston HyperX 1600 4Gb 
Hard DriveOptical DriveCoolingOS
WD Scorpio Blue 250Gb LiteOn DVD-RW stock Win 7 Home Premium 
MonitorKeyboardPowerCase
Acer 19" 1440x900 Logitech MX3200 beQuiet 300W MS-Tech CA-0130 Black 
Mouse
Logitech MX300 Laser 
  hide details  
Reply
post #6 of 9
Quote:
Originally Posted by ronnin426850 View Post

I'm afraid that doesn't do it either.. frown.gif

Can I get the whole buildable source to test this out?
My System
(30 items)
 
"Zeus"
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i5 2500K (4.5ghz @ 1.320v) Gigabyte Z68X-UD3R-B3 MSI R7970 Lightning Corsair 16GB (4x4GB) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Crucial M4 128GB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 7 Ultimate 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2212HM Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Microsoft IntelliMouse Optical  XTRAC Ripper XXL 
AudioAudioAudioAudio
Westone W3 IEMs RE-272 IEMs Shure SE-215 IEMs Schiit Bifrost DAC 
AudioAudio
Schiit Asgard 2 amp HiVi Swan M50W 2.1 
CPUMotherboardGraphicsRAM
Intel Core i7 950 GA-X58-UD3R Radeon HD 5450  24GB Corsair @ 1333mhz 
Hard DriveOSPowerCase
4x WD Cavair Red 1TB in RAID 0 Windows Server 2008 R2 x64 Corsair HX-520 LianLi LanCool 
  hide details  
Reply
My System
(30 items)
 
"Zeus"
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i5 2500K (4.5ghz @ 1.320v) Gigabyte Z68X-UD3R-B3 MSI R7970 Lightning Corsair 16GB (4x4GB) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Crucial M4 128GB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 7 Ultimate 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2212HM Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Microsoft IntelliMouse Optical  XTRAC Ripper XXL 
AudioAudioAudioAudio
Westone W3 IEMs RE-272 IEMs Shure SE-215 IEMs Schiit Bifrost DAC 
AudioAudio
Schiit Asgard 2 amp HiVi Swan M50W 2.1 
CPUMotherboardGraphicsRAM
Intel Core i7 950 GA-X58-UD3R Radeon HD 5450  24GB Corsair @ 1333mhz 
Hard DriveOSPowerCase
4x WD Cavair Red 1TB in RAID 0 Windows Server 2008 R2 x64 Corsair HX-520 LianLi LanCool 
  hide details  
Reply
post #7 of 9
Thread Starter 
Quote:
Originally Posted by tompsonn View Post

Can I get the whole buildable source to test this out?

yeah, ok, sending PM
R.E.D (dead)
(5 items)
 
Wife's D3 machine
(13 items)
 
 
CPUGraphicsRAMHard Drive
Core 2 Duo P8400 Nvidia 9600M GT 2x2Gb Hynx DDR2 WD Scorpio Blue 
OS
Windows 7 x64 Professional 
CPUMotherboardGraphicsRAM
Intel Pentium G840 DualCore SB 2.8Ghz AsRock H61M-VS Inno3D 8800 GTS 320 Kingston HyperX 1600 4Gb 
Hard DriveOptical DriveCoolingOS
WD Scorpio Blue 250Gb LiteOn DVD-RW stock Win 7 Home Premium 
MonitorKeyboardPowerCase
Acer 19" 1440x900 Logitech MX3200 beQuiet 300W MS-Tech CA-0130 Black 
Mouse
Logitech MX300 Laser 
  hide details  
Reply
R.E.D (dead)
(5 items)
 
Wife's D3 machine
(13 items)
 
 
CPUGraphicsRAMHard Drive
Core 2 Duo P8400 Nvidia 9600M GT 2x2Gb Hynx DDR2 WD Scorpio Blue 
OS
Windows 7 x64 Professional 
CPUMotherboardGraphicsRAM
Intel Pentium G840 DualCore SB 2.8Ghz AsRock H61M-VS Inno3D 8800 GTS 320 Kingston HyperX 1600 4Gb 
Hard DriveOptical DriveCoolingOS
WD Scorpio Blue 250Gb LiteOn DVD-RW stock Win 7 Home Premium 
MonitorKeyboardPowerCase
Acer 19" 1440x900 Logitech MX3200 beQuiet 300W MS-Tech CA-0130 Black 
Mouse
Logitech MX300 Laser 
  hide details  
Reply
post #8 of 9
Quote:
Originally Posted by ronnin426850 View Post

yeah, ok, sending PM

Get rid of this:
Code:
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x02000000;  // Turn on WS_EX_COMPOSITED
                return cp;
            }
        }
My System
(30 items)
 
"Zeus"
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i5 2500K (4.5ghz @ 1.320v) Gigabyte Z68X-UD3R-B3 MSI R7970 Lightning Corsair 16GB (4x4GB) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Crucial M4 128GB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 7 Ultimate 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2212HM Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Microsoft IntelliMouse Optical  XTRAC Ripper XXL 
AudioAudioAudioAudio
Westone W3 IEMs RE-272 IEMs Shure SE-215 IEMs Schiit Bifrost DAC 
AudioAudio
Schiit Asgard 2 amp HiVi Swan M50W 2.1 
CPUMotherboardGraphicsRAM
Intel Core i7 950 GA-X58-UD3R Radeon HD 5450  24GB Corsair @ 1333mhz 
Hard DriveOSPowerCase
4x WD Cavair Red 1TB in RAID 0 Windows Server 2008 R2 x64 Corsair HX-520 LianLi LanCool 
  hide details  
Reply
My System
(30 items)
 
"Zeus"
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i5 2500K (4.5ghz @ 1.320v) Gigabyte Z68X-UD3R-B3 MSI R7970 Lightning Corsair 16GB (4x4GB) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Crucial M4 128GB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 7 Ultimate 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2212HM Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Microsoft IntelliMouse Optical  XTRAC Ripper XXL 
AudioAudioAudioAudio
Westone W3 IEMs RE-272 IEMs Shure SE-215 IEMs Schiit Bifrost DAC 
AudioAudio
Schiit Asgard 2 amp HiVi Swan M50W 2.1 
CPUMotherboardGraphicsRAM
Intel Core i7 950 GA-X58-UD3R Radeon HD 5450  24GB Corsair @ 1333mhz 
Hard DriveOSPowerCase
4x WD Cavair Red 1TB in RAID 0 Windows Server 2008 R2 x64 Corsair HX-520 LianLi LanCool 
  hide details  
Reply
post #9 of 9
Thread Starter 
That solved it! Thanks thumb.gif
R.E.D (dead)
(5 items)
 
Wife's D3 machine
(13 items)
 
 
CPUGraphicsRAMHard Drive
Core 2 Duo P8400 Nvidia 9600M GT 2x2Gb Hynx DDR2 WD Scorpio Blue 
OS
Windows 7 x64 Professional 
CPUMotherboardGraphicsRAM
Intel Pentium G840 DualCore SB 2.8Ghz AsRock H61M-VS Inno3D 8800 GTS 320 Kingston HyperX 1600 4Gb 
Hard DriveOptical DriveCoolingOS
WD Scorpio Blue 250Gb LiteOn DVD-RW stock Win 7 Home Premium 
MonitorKeyboardPowerCase
Acer 19" 1440x900 Logitech MX3200 beQuiet 300W MS-Tech CA-0130 Black 
Mouse
Logitech MX300 Laser 
  hide details  
Reply
R.E.D (dead)
(5 items)
 
Wife's D3 machine
(13 items)
 
 
CPUGraphicsRAMHard Drive
Core 2 Duo P8400 Nvidia 9600M GT 2x2Gb Hynx DDR2 WD Scorpio Blue 
OS
Windows 7 x64 Professional 
CPUMotherboardGraphicsRAM
Intel Pentium G840 DualCore SB 2.8Ghz AsRock H61M-VS Inno3D 8800 GTS 320 Kingston HyperX 1600 4Gb 
Hard DriveOptical DriveCoolingOS
WD Scorpio Blue 250Gb LiteOn DVD-RW stock Win 7 Home Premium 
MonitorKeyboardPowerCase
Acer 19" 1440x900 Logitech MX3200 beQuiet 300W MS-Tech CA-0130 Black 
Mouse
Logitech MX300 Laser 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Application Programming › [C#] [Solved] TreeView blinking when YouTube is open