|
-
Apr 28th, 2009, 01:11 PM
#1
Thread Starter
Addicted Member
How Do I Keep A Window As The Top-Most Window Only In My Application?
There doesn't seem to be anything about it :S
-
Apr 28th, 2009, 01:37 PM
#2
Addicted Member
Re: How Do I Keep A Window As The Top-Most Window Only In My Application?
 Originally Posted by Louix
There doesn't seem to be anything about it :S
I offer this feature in my latest app. Here's my code, verbatim:
vb.net Code:
Private Sub AlwaysOnTopToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AlwaysOnTopToolStripMenuItem.Click
'Save Setting
If SaveSettingsToolStripMenuItem.Checked Then My.Settings.setAlwaysOnTop_Checked = AlwaysOnTopToolStripMenuItem.Checked
Me.TopMost = Not Me.TopMost
End Sub
AlwaysOnTopToolStripMenuItem has the property CheckOnClick = True
-
Apr 28th, 2009, 01:44 PM
#3
Thread Starter
Addicted Member
Re: How Do I Keep A Window As The Top-Most Window Only In My Application?
Thanks, but this isn't what I'm looking for. I have a Toolbox form, and it's meant to stay on top of all other windows only in my application (not a dialog). When the application loses focus, this window is no longer topmost.
-
Apr 28th, 2009, 01:45 PM
#4
Re: How Do I Keep A Window As The Top-Most Window Only In My Application?
if you use .showdialog instead of .show, your form will stay topmost within your application. but, it'll be displayed as a modal dialog
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Apr 28th, 2009, 01:47 PM
#5
Addicted Member
Re: How Do I Keep A Window As The Top-Most Window Only In My Application?
 Originally Posted by Louix
Thanks, but this isn't what I'm looking for. I have a Toolbox form, and it's meant to stay on top of all other windows only in my application (not a dialog). When the application loses focus, this window is no longer topmost.
.ShowDialog() instead of .Show()
Edit: slower than paul.
-
Apr 28th, 2009, 01:52 PM
#6
Thread Starter
Addicted Member
Re: How Do I Keep A Window As The Top-Most Window Only In My Application?
 Originally Posted by Louix
Thanks, but this isn't what I'm looking for. I have a Toolbox form, and it's meant to stay on top of all other windows only in my application (not a dialog). When the application loses focus, this window is no longer topmost.
Thanks, but I said I didn't want a dialog, just a tool window that sticks on top of all the other windows in my application while my application has focus, then when another application is selected, this topmost property turns off.
-
Apr 28th, 2009, 02:01 PM
#7
Re: How Do I Keep A Window As The Top-Most Window Only In My Application?
I'm not sure if there's a specific way of detecting whether the application has "lost focus" in .Net, in the good old days of VB6 and beyond you would use sub-classing. There are plenty of examples that can probably be leveraged into .Net if needed.
If you can detect when your application loses focus you could then set the TopMost property of your form to False as necessary.
An example of how to trap that in VB6 is here.
-
Apr 28th, 2009, 02:08 PM
#8
Thread Starter
Addicted Member
Re: How Do I Keep A Window As The Top-Most Window Only In My Application?
Thank you , but the msghook library appears to be VB6 only
-
Apr 28th, 2009, 03:18 PM
#9
Re: How Do I Keep A Window As The Top-Most Window Only In My Application?
you can use a wndProc in vb.net to trap messages
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|