C# Showing Form with WS_EX_NOACTIVATE flag
        Posted  
        
            by Maks
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Maks
        
        
        
        Published on 2010-06-03T20:52:31Z
        Indexed on 
            2010/06/03
            20:54 UTC
        
        
        Read the original article
        Hit count: 1486
        
c#
I have a borderless form which is always on top and with WS_EX_NOACTIVATE flag set to prevent it for gaining focus. const int WS_EX_NOACTIVATE = 0x08000000;
protected override CreateParams CreateParams {
    get {
        CreateParams param = base.CreateParams;
        param.ExStyle |= WS_EX_NOACTIVATE;
        return param;
    }
}
Form contains small picture box for moving (since it's borderless): private void pictureBox4_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { ReleaseCapture(); SendMessage(this.Handle, 0xa1, 0x2, 0); } }
However when I move the window it doesn't get redrawn/shown, only when I release the mouse button it moves form to that location. I saw some application which are are working in a similar fashion but they are showing the window while moving (like some virtual keyboards I saw) and also many questions on net about this issue but no answer. Can someone please tell me is it possible to show window/form like this while moving (like "normal" window) and if yes, how to do it?
Thanks.
© Stack Overflow or respective owner