문제

I am running into a strange problem and seem to have to hunted down to the following root cause. Environment C# (.NET 2.0):

My code is using some vendor's framework and at one time opens a modal dialog. It seems that the framework is filtering on the Application's "Enter" Keypresses (probably by implementing IMessageFilter). As a consequence, closing my dialog by pressing the "OK" button leads to strange behaviour - closing via mouse-click on "OK" works fine. Changing the framework's code is unfortunately not an option. So I'd like to disable that the framework notices "Enter" (and probably "ESC") keypresses in my dialog. Does anyone know how this can be done?

EDIT:

I "solved" the issue. Please refer the Accepted Answer below.

도움이 되었습니까?

해결책

I "solved" the issue. Here's the solution for future reference: setting the Form's (which was created in the modal dialog) FormBorderStyle property to FormBorderStyle.FixedDialog resolved the issue. Yes, this is a typical case of Cargo-Cult-Programming, but after thorough testing the fix works reliably.

다른 팁

Make a javascript file that keys in on the enter key being pressed, have it execute the ok event on your modal. Just make sure your javascript is above all the other javascript in the applicaiton and it should fire first.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top