Disable input to controls on a form without disabling?

Is there a way I prevent user input (mouse and key events) for a control (or all controls on a panel) without disabling it
I have a smart client application where accesses to the server are done on background threads. To prevent new interaction with the controls until the running access is done, I want to prevent new events. When disabling the panel all controls "blink" in a rather anoying way (when they are greyed out and then enabled). Instead an hourglass and a progress indicator should be enough to inform the user that it is working. I also have the impression that the enable/disable screen updates affects the performance for fast server accesses.

Regards
Tomas.


Answer this question

Disable input to controls on a form without disabling?

  • klabran

    A transparent BackColor just means the colour used is the same as the parent control.  Check out http://www.peterritchie.com/Hamlet/Articles/62.aspx of a sample transparent control in .NET in C# and VB.

  • Randy Jean

    Thanks! Now it works fine.



  • perri

    Sounds like a good idea. But I can't make it work...
    I created a usercontrol with BackColor=transparent,
    but when I place it over another control (i.e. a button)
    the button is hidden.
    What am I doing wrong

    Tomas.

  • LearnTheThings

    One way is to create a UserControl that is transparent, add it to your form (covering the controls you want to "disable") with Visible=false, set Cursor to WaitCursor (or something to give feedback to the user).  When the background processing starts set Visible to True; when done, set it back to False.

  • AGK

    Hello, I need to disable the userinput to a control too. I've tried the solution with the transparent control, but that works not correct, because the redering of a combobox (under a transparent control) is not correct and when I execute form.Refresh all controls which lay under a transparent control get invisible.

    so what can I do now

  • DawnJ

    Apparently Refresh() requires that the Opaque control style be set for the control as well.

    I've updated my page to reflect the change to the classes at http://www.peterritchie.com/Hamlet/Articles/62.aspx



  • Disable input to controls on a form without disabling?