zoukankan      html  css  js  c++  java
  • WinFom解决最小化最大化后重绘窗口造成闪烁的问题

    网上两种方案(可协同)

    1 设置双缓冲:


    SetStyle(ControlStyles.UserPaint, true);
    SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
    SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲

    2 捕获最大化最小化事件,临时挂起布局逻辑

    const int WM_SYSCOMMAND = 0x112;
    const int SC_CLOSE = 0xF060;
    const int SC_MINIMIZE = 0xF020;
    const int SC_MAXIMIZE = 0xF030;
    protected override void WndProc(ref Message m)
    {
    if (m.Msg == WM_SYSCOMMAND)
    {
    if (m.WParam.ToInt32() == SC_MINIMIZE) //是否点击最小化
    {

    this.SuspendLayout();
    this.WindowState = FormWindowState.Minimized;
    this.ResumeLayout(false);
    }


    if (m.WParam.ToInt32() == SC_MAXIMIZE)
    {
    this.SuspendLayout();
    this.WindowState = FormWindowState.Maximized;
    this.ResumeLayout(false);
    }

    if (m.WParam.ToInt32() == SC_CLOSE)
    { //.....................
    }


    }
    base.WndProc(ref m);
    }

  • 相关阅读:
    点击退出 防止回退
    AngularJS select中ngOptions用法详解
    git hub
    .ashx datatable转excel
    写日志 log 到文件夹
    easyui layout 布局title
    easyui tree 折叠节点
    转json using指令
    Qt QWindow转QWidget
    CEF 重写弹窗事件
  • 原文地址:https://www.cnblogs.com/swobble/p/7474072.html
Copyright © 2011-2022 走看看