DoubleBufferedPanel.cs 680 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. namespace HXX.Scanner.Client
  8. {
  9. public class DoubleBufferedPanel : Panel
  10. {
  11. public DoubleBufferedPanel()
  12. {
  13. // 为Panel开启双缓冲
  14. this.DoubleBuffered = true;
  15. this.SetStyle(
  16. ControlStyles.UserPaint |
  17. ControlStyles.AllPaintingInWmPaint |
  18. ControlStyles.OptimizedDoubleBuffer |
  19. ControlStyles.ResizeRedraw |
  20. ControlStyles.DoubleBuffer, true);
  21. this.UpdateStyles();
  22. }
  23. }
  24. }