Working on a Windows Mobile 6.5 application and having an issue that I would think would be handled automatically. I have a panel on the form and have it's AutoScroll property set to true. Have a textbox that shows an inputpanel on focus. For testing, I place the textbox outside of the visible panel to force the scrollbar. Clicking in the textbox pops the inputpanel which in it's EnabledChanged event resizes the panel. Since setting the focus to a control that is outside of the visible area forces the panel to scroll (I've tested this and it works as expected), I would expect that when the panel is resized, it would scroll to the focused texbox, but it doesn't.
Here is some quick demo code:
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
panel1.Size = this.ClientRectangle.Size;
TextBox t = new TextBox();
t.Size = new Size(100, 20);
// put it out of the panel's bounds
t.Location = new Point(10, 400);
t.GotFocus += new EventHandler(t_GotFocus);
t.LostFocus += new EventHandler(t_LostFocus);
panel1.Controls.Add(t);
t = new TextBox();
t.Size = new Size(100, 200);
t.Location = new Point(10,10);
panel1.Controls.Add(t);
}
void t_LostFocus(object sender, EventArgs e)
{
inputPanel1.Enabled = false;
}
void t_GotFocus(object sender, EventArgs e)
{
inputPanel1.Enabled = true;
}
private void inputPanel1_EnabledChanged(object sender, EventArgs e)
{
if (inputPanel1.Enabled)
panel1.Size = inputPanel1.VisibleDesktop.Size;
else
panel1.Size = this.ClientRectangle.Size;
}
}