Form without focus/activation

后端 未结 2 590
广开言路
广开言路 2020-12-20 06:47

I want to implement intellisense-like feature for my multiline textbox. The intellisense control is placed in standard form without control box (so, no title or maximize/min

2条回答
  •  失恋的感觉
    2020-12-20 06:57

    To show the form without activation, override the ShowWithoutActivation property

    protected override bool ShowWithoutActivation
    {
      get { return true; }
    }
    

    And if you do not want to activate the form even on mouse clicks, override the CreateParams and set these styles

    protected override CreateParams CreateParams
    {
      get
      {
        CreateParams p = base.CreateParams;
    
        p.Style |= 0x40000000; // WS_CHILD
        p.ExStyle |= 0x8000000; // WS_EX_NOACTIVATE - requires Win 2000 or higher :)
    
        return p;
      }
    }
    

提交回复
热议问题