winform 船体最大化事件

Posted Restrain

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了winform 船体最大化事件相关的知识,希望对你有一定的参考价值。

protected override void WndProc(ref Message m)
        {
            FormWindowState previousWindowState = this.WindowState;

            base.WndProc(ref m);

            FormWindowState currentWindowState = this.WindowState;

            if (previousWindowState != currentWindowState && currentWindowState == FormWindowState.Maximized)
            {
                // TODO: Do something the window has been maximized

            }
        }
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.Visible = false;
            return;
        }
    }
    base.WndProc(ref m);
}//网上这个会出问题 应该是变量的问题

 

以上是关于winform 船体最大化事件的主要内容,如果未能解决你的问题,请参考以下文章