C # How to override "minimization" by reloading wndproc

Source: Internet
Author: User

Code #1 CopyCode The Code is as follows: Private void form1_sizechanged (Object sender, eventargs e) // minimizes the hidden form.
{
If (this. windowstate = formwindowstate. Minimized) // The form state is minimized.
{
Stoprecttimer. Enabled = false;
This. Visible = false;
This. policyicon1.visible = true; // The System Tray Icon is displayed.
This. policyicon1.text = This. Text; // you can specify the text displayed on the icon.
This. showintaskbar = false; // hide the form in the task tag.
Reghotkey ();
Open otoolstripmenuitem. Text = "open (& O )";
}
}

obviously, if you open the lyrics, how can we minimize the size of the form without changing it? I thought of "minimizing" the reload, but how can I reload it? Here is a scheme to overload wndproc: copy Code : 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)
{< br> If (M. MSG = wm_syscommand)
{< br> If (M. wparam. toint32 () = SC _minimize)
{< br> This. visible = false;
return;
}< BR >}< br> base. wndproc (ref m);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.