C#, FormBorderStyle:None Restore Issue

I have an app that uses Forms with FormBorderStyle set to "None."

The issue with this is that if a user hits the "Show Desktop" button (which effectively minimizes all opened windows) and then restores one of the Forms from the taskbar, all of the borderless forms will be restored.

Note: If the form was explicitly minimized (i.e. WindowState = FormWindowState.Minimized) before the Show Desktop button is clicked, then it results in expected behavior for that particular form.

Also note that this is not the case for regular forms or even WPF windows without borders.

Form.Designer.cs:

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

Form.cs:

private void MinimizeButton_Click(object sender, EventArgs e)
{
    // If minimized explicitly, form behaves appropriately
    WindowState = FormWindowState.Minimized;
}

Any ideas on why this is the case/how to fix it?

Answers


I believe that this is just the default behavior since border-less form is not supposed to be minimized.

Check out this post. Hopefully it will help you change this default behavior.

From the post (add to the Form):

const int WS_MINIMIZEBOX = 0x20000;
const int CS_DBLCLKS = 0x8;
protected override CreateParams CreateParams
{
    get
    {
        CreateParams cp = base.CreateParams;
        cp.Style |= WS_MINIMIZEBOX;
        cp.ClassStyle |= CS_DBLCLKS;
        return cp;
    }
}

Need Your Help

Convert festival tts to flite tts

text-to-speech speech-synthesis festival flite

i currently have a tts which is built using festival and festvox. i need to convert these voices and build a TTS in flite. apparently you can do the conversion using festvox (the festvox and flite

How to clear Error in asp.net

c# .net asp.net ado.net

I have designing my web page The page is run but value are not stored in database

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.