yss729
V2EX  ›  问与答

winform treenode 重绘 DrawNode 闪烁并且 CPU 负载高的问题

  •  
  •   yss729 · Sep 11, 2019 · 2042 views
    This topic created in 2440 days ago, the information mentioned may be changed or developed.

    网上看了很多相关的解决方式,无非是用以下形式来解决闪烁问题

    this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer , true)

    这两个样式的前置条件是 ControlStyles.UserPaint,但是加了这个样式,就必须全部重画,但我的模式是 DrawMode = OwnerDrawText,不需要全部重绘。

    这种闪烁很奇怪,只有在我窗体最小化后,再恢复窗口,就会闪烁。

    我的窗体是全屏的,无边框,如果这时候窗体上层 Z 轴上再开个任意窗口,关键 CPU 是高负荷的,均值在 30%左右,treeview 一直闪烁。

    真的很无解,有没有大神指点一下。

    1 replies    2019-09-11 20:39:00 +08:00
    ysc3839
        1
    ysc3839  
       Sep 11, 2019
    录个视频看看是怎么个闪?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3664 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 04:52 · PVG 12:52 · LAX 21:52 · JFK 00:52
    ♥ Do have faith in what you're doing.