Hi Steve,
Thank you for your prompt reply!
>Is there a way to have a modeless topmost form (on screen keyboard) still
accept input (or at least fire an event when clicked) when a modal form is
opened with the modeless form already open?
As you have mentioned, you could show the screen keyboard form in a
seperate thread to get the above behavior. The following is a sample to do
this:
public partial class Form1 : Form
{
delegate void ShowKeyBoardDelegate();
private void Form1_Load(object sender, EventArgs e)
{
ShowKeyBoardDelegate dele = new
ShowKeyBoardDelegate(ShowKeyBoard);
// With the call to the BeginInvoke method of the delegate, the
ShowKeyBoard method will be execute in a seperate thread within the
application thread pool
dele.BeginInvoke(null, null);
}
private void ShowKeyBoard()
{
Form2 frm = new Form2();
frm.TopMost = true;
Application.Run(frm);
}
}
I don't suggest you to have the onscreen keyboard as a seperate
application, because this involves the intercommunicate between two
application, which will definitely add complication.
>I am looking for a way to put the code, to close the topmost form, in the
topmost form rather than having to put code in every form load event to
check if the topmost form is open then close it, as I have many forms in my
application
You can create a base form in your application and in its Load event
handler, check if the onscreen keyboard form is open and if yes, close it.
You need to derive all other forms(except the onscreen keyboard form) in
your application from this base form. Thus, when each derived form is
loaded, it will check if the onscreen keyboard form is open and you needn't
add code to every form to check this.
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support