winforms - Use custom on-screen keyboard form with OpenFileDialog and SaveFileDialog -
winforms - Use custom on-screen keyboard form with OpenFileDialog and SaveFileDialog -
we have custom on-screen keyboard (osk) form part of our .net windows forms application. keyboard useful come in info datagridview
, other textboxes. want able utilize come in file name openfiledialog
or savefiledialog
.
however, when either dialog shows up, form containing osk stops responding input. tried creating new form
used osk's owner. utilize new form , phone call keyboard.show(owner)
. still doesn't prevent keyboard beingness unable used while openfiledialog
or savefiledialog
in showdialog
method.
how can utilize on-screen keyboard form on top of openfiledialog
or savefiledialog
without having keyboard hosted in separate process?
well, running osk window in process is fine idea. free running osk.exe, provided windows. technically run sta thread that's advanced technique, many ways systemevents class can ruin life.
but can solve problem sliver of code, need re-enable osk window right after dialog displayed. elegantly done begininvoke() method:
private void openbutton_click(object sender, eventargs e) { this.begininvoke(new action(() => enablewindow(osk.handle, true))); if (openfiledialog1.showdialog(this) == dialogresult.ok) { // etc... } } [system.runtime.interopservices.dllimport("user32.dll")] private static extern bool enablewindow(intptr hwnd, bool enable);
with assumption osk
variable stores reference osk form.
winforms on-screen-keyboard
Comments
Post a Comment