Top window shape

I am creating a window form application that displays a message such as msn warning in the right corner of the desktop. I set the topmost property to true, but it steals a different application focus while I work on them. I do not want the application to color the focus, which is annoying. How can I solve this problem. Any suggestion?

Sincerely.

+2
source share
1 answer

Override the CreateParams and ShowWithoutActivation properties, for example:

protected override CreateParams CreateParams
{
  get
  {
    CreateParams baseParams = base.CreateParams;

    // WS_EX_NOACTIVATE = 0x08000000,
    // WS_EX_TOOLWINDOW = 0x00000080,
    baseParams.ExStyle |= ( int )( 
      Win32.ExtendedWindowStyles.WS_EX_NOACTIVATE | 
      Win32.ExtendedWindowStyles.WS_EX_TOOLWINDOW );

    return baseParams;
  }
}

protected override bool ShowWithoutActivation
{
  get { return true; }
}
+4
source

Source: https://habr.com/ru/post/1710640/


All Articles