Topmost Form should never get focus

B

Beren

Hello

I'm having a form that acts as some kind of OSD layer on top of the current
active window, however when I alt tab or click it, the focus can still be
given to that form. I don't want to happen.

I've been experimenting with the focus / enter / validating events, but I
don't seem to get it working.

Can someone help me ?

Thanks in advance,

Beren.
 
B

Bob Powell [MVP]

Did you ensure that the "ShowInTaskbar" property is false?

--
Bob Powell [MVP]
Visual C#, System.Drawing

The Image Transition Library wraps up and LED style instrumentation is
available in the June of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 
B

Beren

Yes I have set the property to false, but alt tabbing still shows the form
icon in the list.
 
B

Bob Powell [MVP]

Set the form border style to ToolWindow. That should fix it.

--
Bob Powell [MVP]
Visual C#, System.Drawing

The Image Transition Library wraps up and LED style instrumentation is
available in the June of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 
B

Bob Powell [MVP]

Thinking about your requirements a bit more deeply it seems to me that you
probably need a different sort of window entirely.

Consider making the window based on NativeWindow and using p/invoke to show
the window with the SW_NOACTIVATE style.

--
Bob Powell [MVP]
Visual C#, System.Drawing

The Image Transition Library wraps up and LED style instrumentation is
available in the June of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 
B

Beren

Hmm as you might have noticed I'm not that experienced yet...
If I make a new form class inheriting from nativewindow, how could I use the
invoke and that window message ?

Thanks for helping this clueless person

ps. the toolwindow setting solved the alt-tab issue, but then I had the
titlebar and borders ofcourse...
 
G

Gerrit Schunk

Set Form.Text = "" and Form.ControlBox = False to remove the title bar. You
still will have a small border around the form, but maybe this is OK for
you.

Gerrit
 
B

Beren

Nah that looks too nasty :)

Gerrit Schunk said:
Set Form.Text = "" and Form.ControlBox = False to remove the title bar. You
still will have a small border around the form, but maybe this is OK for
you.

Gerrit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top