Tech Off Post

Single Post Permalink

View Thread: WinForms question - Preventing focus from being set to a Form
  • User profile image
    BitFlipper

    I got tired of ToolTip flashing when you update it's location (I want it to follow the mouse pointer), so I decided to create my own tooltip derived from Form. It works well, smooth as butter with no flashing, however I ran into the following problem:

    Whenever the tooltip is showm it takes the focus and the main form loses focus. I can manually set focus back to the main window after showing the tooltip, but there is a noticeable flash as the main form loses/regains focus.

    I'm trying to figure out how to prevent focus to shift to the custom tooltip. I tried setting various properties related to being selectable, enabled etc but nothing works. I also tried SetStyle(ControlStyles.Selectable, false) but that didn't make any difference.

    Any suggestions?