Form.MaximizeBox and Form.MinimizeBox

T

Thomas

I have an application on Windows CE.NET 4.1 device running ARMv4T processor.
It runs well with the CF delivered from VS.NET 2003, however, it hangs after
I installed the CF SP1 (the installer chooses ARMv4I processor version for
me). I tried to located where the application hangs and I found that the
problem is from the statements in the constructor :

"this.MaximizeBox = false;"
"this.MinimizeBox = false;"

Can anyone kindly explain to me why these two statements cause the problem?
And how can I solve it?

Regards,
Thomas
 
T

Thomas

Hi Jamie,

Actually, I have located and fixed the bug of my code. The problem was not
caused to the two lines of codes in the constructor of the form, instead,
the problem was caused by the same two lines of codes in the resize event
handlers. When the program runs in .NET CF 1.0 for ARMv4T processor, this
does not cause any problem. On the other hand, when the program runs in .NET
CF 1.1, these two lines of codes will creat a resize event to the form, and
hence the program will enter a deadlock. Anyway, I have attached my buggy
codes below.

Thank you for you kindly help.

Regards,
Thomas Tse

/***************************************************************************
*****************************************************

****************************************************************************
*****************************************************/
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;

namespace Helloworld
{
public class Form : System.Windows.Forms.Form
{
public Form()
{
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.MaximizeBox = false;
this.MinimizeBox = false;

this.m_buttonBugForm = new System.Windows.Forms.Button();
this.m_buttonBugForm.Text = "Open Bug Form";
this.m_buttonBugForm.Bounds = new System.Drawing.Rectangle(16, 16, 128,
32);
this.m_buttonBugForm.Click += new EventHandler(m_buttonBugForm_Click);
this.Controls.Add(this.m_buttonBugForm);

}

protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}

private void m_buttonBugForm_Click(object sender, EventArgs e)
{
BugForm bugform = new BugForm();
bugform.ShowDialog();
}

protected System.Windows.Forms.Button m_buttonBugForm;

static void Main()
{
Application.Run(new Form());
}
}

public class BugForm : System.Windows.Forms.Form
{
public BugForm()
{
this.Text = "Bug Form";
this.Resize += new EventHandler(BugForm_Resize);
}

protected void BugForm_Resize(object sender, EventArgs e)
{
this.MaximizeBox = false;
this.MinimizeBox = false;

this.Bounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
}
}
}
/***************************************************************************
*****************************************************

****************************************************************************
*****************************************************/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top