hi,
i am struggling to develop screen orientation awareness application. to solve
this problem a have create two function portrait() and landscape() both function set the size and location of control when form re size i call this function on form resize event.
problem is taht when form is resize then it call the function more then one time.
and take more time to execute.
what is reason behind this behavior i don't know.
please help me.
below some code which i am using
-
public void portrait()
-
{
-
pnlmenu.Size = new Size((frrm.ClientRectangle.Width * 88 / 100), (frrm.ClientRectangle.Height * 27 / 100));
-
}
-
public void landscap()
-
{
-
pnlmenu.Size = new Size((frrm.ClientRectangle.Width * 88 / 100), (frrm.ClientRectangle.Height * 27 / 100));
-
-
-
}
-
private void Form_Resize(object sender, EventArgs e)
-
{
-
if (Screen.PrimaryScreen.Bounds.Height >
-
Screen.PrimaryScreen.Bounds.Width) Portrait();
-
else Landscape();
-
-
-
-
}
-
please help me why this function called one then more time at atime when function is resized.