G
Guest
Hi
I'm developping a WinCE 5.0 app using VS 2003, C# and CF 2.0 SP3.
I'm currently testing on the WinCE 4.1 Emulator but a quick check on the
CE 5.0 Device confirmed the behaviour.
I create a full screen Form setting:
ControlBox = False
FormBorderStyle = None
WindowState = Maximmized
I add 3 buttons (button1, button2, button3) and add the following :
private void button1_Click(object sender, System.EventArgs e)
{
this.Controls.Clear();
}
private void Form1_Click(object sender, System.EventArgs e)
{
this.Controls.Add(button1);
this.Controls.Add(button2);
this.Controls.Add(button3);
this.Refresh();
// this.Invalidate();
// button1.Invalidate();
// button2.Invalidate();
// button3.Invalidate();
// this.Invalidate();
// button1.Visible = true;
// button2.Visible = true;
// button3.Visible = true;
// button1.BringToFront();
// button2.BringToFront();
// button3.BringToFront();
}
As you see I clear the controls with the first button and then try to
reasign the 2 controls to the form on the OnClick event of the form.
Guess what happens ?
No controls appear on the first clieck, button2 and button3 on the second
click and all of them on the third click.
But there's more:
The controls don't show, but they are there: I click where I remeber the
control was and I get the button.OnClick event !!!!!!
As you see I've tried everithing I know (visible, invalidate, refresh etc
etc) but I allways get the same behaviour.
Do you khnow how I can get the right behaviour ?
Please note that this is just a TEST APP, the real app must asign
dinamically the controls so Controls.Clear() and Controls.Add() MUST be used
Please help
Ciao
Marco
I'm developping a WinCE 5.0 app using VS 2003, C# and CF 2.0 SP3.
I'm currently testing on the WinCE 4.1 Emulator but a quick check on the
CE 5.0 Device confirmed the behaviour.
I create a full screen Form setting:
ControlBox = False
FormBorderStyle = None
WindowState = Maximmized
I add 3 buttons (button1, button2, button3) and add the following :
private void button1_Click(object sender, System.EventArgs e)
{
this.Controls.Clear();
}
private void Form1_Click(object sender, System.EventArgs e)
{
this.Controls.Add(button1);
this.Controls.Add(button2);
this.Controls.Add(button3);
this.Refresh();
// this.Invalidate();
// button1.Invalidate();
// button2.Invalidate();
// button3.Invalidate();
// this.Invalidate();
// button1.Visible = true;
// button2.Visible = true;
// button3.Visible = true;
// button1.BringToFront();
// button2.BringToFront();
// button3.BringToFront();
}
As you see I clear the controls with the first button and then try to
reasign the 2 controls to the form on the OnClick event of the form.
Guess what happens ?
No controls appear on the first clieck, button2 and button3 on the second
click and all of them on the third click.
But there's more:
The controls don't show, but they are there: I click where I remeber the
control was and I get the button.OnClick event !!!!!!
As you see I've tried everithing I know (visible, invalidate, refresh etc
etc) but I allways get the same behaviour.
Do you khnow how I can get the right behaviour ?
Please note that this is just a TEST APP, the real app must asign
dinamically the controls so Controls.Clear() and Controls.Add() MUST be used
Please help
Ciao
Marco