-
Jan 14th, 2018, 01:33 PM
#1
Thread Starter
Addicted Member
Form - TopMost
hello
i have a question about a forms topmost for say if i have a settings window or a about window and i want it to be topmost over the main forms window
but i would like it to only top most within the application itself so its not showing over top of other programs on my pc any ideas how i can do this?
see like in this pic here my settings will stay on top of my main form but will stay on top of other pc programs like the web browser i don't want that is there a workaround for this i have my settings window in the pic set to show in taskbar false does that have to do with it or is it the forms border style?
Last edited by sinner0636; Jan 14th, 2018 at 02:16 PM.
-
Jan 14th, 2018, 04:12 PM
#2
Re: Form - TopMost
Just specify the owner form in show method
Code:
Form2.Show(Me)' Me refers to Form1
BTW: usually forms like About & Settings are shown modal, so they will be app's top most.
Last edited by 4x2y; Jan 14th, 2018 at 08:28 PM.
-
Jan 14th, 2018, 06:58 PM
#3
Re: Form - TopMost
What you're talking about is a modeless dialogue or, in .NET parlance, an owned form. As 4x2y has demonstrated, you can create an owned form by passing the owner as an argument when calling Show or ShowDialogue (although it's generally pointless when calling ShowDialogue). You can also simply assign the owner to the dialogue's Owner property, or you can call AddOwnedForm on the owner. That will cause the owned form to remain above it's owner at all times. The owned form will also minimise, restore and close when it's owner does. It is a relationship between two forms only, not a form to every other form in the application. There's no easy way to keep a form that isn't a modal dialogue in front of all other forms in the application, but you'd rarely, if ever, want to.
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
|