.NET CF -- Set Form height based on InputPanel state

Posted by user354941 on Stack Overflow See other posts from Stack Overflow or by user354941
Published on 2010-06-01T03:19:24Z Indexed on 2010/06/01 3:23 UTC
Read the original article Hit count: 384

Filed under:
|
|

Hi, So, I've got a C# project for Windows Mobile phones and I'm trying to work with the InputPanel. Specifically, I've got one form with a stack of Labels and TextBoxes that collect user input. I have an InputPanel that alerts me when the user opens the SIP. Everything works fine so far. When I get messages that the SIP status has changed, I want to change the height of the Form, which doesn't seem possible.

Here's my event handler for my InputPanel:

void m_InputPanel_EnabledChanged(object sender, EventArgs e)
{
    // :(  this assignment operation doesn't work and it doesn't               
    this.ClientSize = inputPanel1.VisibleDesktop.Size;
    // doesn't work
    this.Size = inputPanel1.VisibleDesktop.Size;
    // assignment operation works, but isn't very useful
    this.visibleHeight = inputPanel1.VisibleDesktop.Height;
    this.InitializeUI();
}

When I say that the assignment operation doesn't work, I mean that the values don't change in the debugger. I can understand that maybe I can't change the size of a Form, but I can't understand why trying to change it wouldn't throw an exception, or give a compiler error.

I have my Form WindowState set to Normal instead of Maximized, but it doesn't make a difference.

Also, I have read http://www.christec.co.nz/blog/archives/42 this page that tells me how I'm supposed to do this, but I can't easily put all of my controls in a Panel because I'm using a bunch of custom stuff to do alpha background controls.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET