I have an application that I am writing in C#. The application has two forms, call them Form A and Form B. I want to display Form A on the monitor, while Form B is being displayed on a secondary output (such as a TV screen). Does anyone have any idea what I need to do to setup Form B to display to the secondary output? Do I need to do anything at the Application level?
Thanks,
Doug
Enumerate the set of monitors to find the size and offset of each within the virtual screen space. Then move your forms to the appropriate coordinates.
Related
Backgound :
I want to create moveable toolbars just like paint.NET or any other Designing application. A Toolbar which can be moved, closed and shown from the menubar.
i know how a toolstrip works but its permanent sort of thing. There is another way explained in some articles which uses panels to make toolbars.
While doing experiments on the toolstrip, idea came up in my mind to make two forms(one big size form and other small form) and run them simultaneously , one will act as main form and the other small form will act as a toolbar but it also didnot work. I am only able to run one form.
Requirement:
I just want to make an application look like Paint.net having different tools in a toolbar which can be used on drawing area.and when application starts, toolbar and drawing area both should be running just like in all graphics editing softwares.
Questions:
How to make a moveable toolbar that can be closed and viewed again?
How to run two forms of different sizes run simultaneously at the same time when application starts?
Note:
Need Guidance as well if i am not in the right direction, u can set my direction towards the right side.
Thanks
I'm writing a WPF application which has a main canvas area, where the user can open a number of windows, drag and drop them and generally move them around the application as he or she pleases.
What I've done so far basically opens windows using the Show() method, and I have hidden them from the taskbar. However, when the main application is minimised, the small windows which have been opened all appear on the desktop. What I am lookign for is basically a way to keep the windows contained within the application.
Is this possible?
Yes but you need to design some infrastructure to replace what MDI used to do ( though often quite badly)
So when you open a new window in your app, add it to a list.
When it closes, take it out
When your main app is minimised, minimise all the windows in the list as well.
You can also trap child window move events and keep them in bounds, take the children with you when the main app moves. Docking, cascade, tiling...
Key bit it to get this list of managed child windows going.
What you want to do is called MDI.
WPF MDI
I have a form that is on the 2nd monitor and full-screen. I want to prevent all other windows from accidently being moved into the second screen and over lapping my form.
I also need to make sure that if a window gets moved to the other window and I use topmost, I don't want the other window to get lost.
I want to make the 2nd monitor( or my app ) un-overlappable. Not necessarily make it the topmost app.
This is a c# form.
What would be the best way to do this?
Form.TopMost property:
A topmost form is a form that overlaps all the other (non-topmost)
forms even if it is not the active or foreground form. Topmost forms
are always displayed at the highest point in the z-order of the
windows on the desktop. You can use this property to create a form
that is always displayed in your application, such as a Find and
Replace tool window.
In a multi-monitor environment, how can I display a form on all the screens? Is it possible to get handles to the different screens available, and display a form in a different screen than where the main window lives?
What I really need to do is to clone a window on all displays.
A multi-monitor system effectively has a single, very large display area.
There is nothing different about a point in a different monitor; it will just be far to the right of the previous monitor.
You can use the Screen class to find all of the user's screens.
You can loop through Screen.AllScreens and create a new instance of the form for each screen, setting it's location to a point within that screen's WorkingArea.
We have a WPF application that has a main window, and 1 child window shown by ShowDialog with ShowInTaskBar set to false.
We save their positions on close, and set Window.Left and Top when re-opened.
Problem is, when you remote desktop into a computer with multiple monitors and then open the child window with a saved position offscreen, there is no way to bring it onto the single monitor.
Is there a something we can change on the child window to make windows handle this issue? The main window doesn't have this issue (I thought it might be related to ShowInTaskBar or the fact it is the main window).
Is there a better way for us to store the window location?
There is no default way within WPF to access any available screen other then the primary screen.
WPF does have SystemParameters.PrimaryScreenHeight and SystemParameters.PrimaryScreenWidth to work with the primary screen however to get information on screens excpluding the primary you would have to make use of the System.Windows.Forms.Screen class.
If you went the System.Windows.Forms.Screen class route you could save relevant data about the window based on the screen at which it resides. Then upon reading the values in you can force the window to the desired screen based on the number of screens residing in the System.Windows.Forms.Screen.AllScreens array. It gives you flexibility for placement as you can take advantage of all available screen within the system versus just the primary.
EDIT:
If you are not concerned with getting the screen information in a modular manner (information per screen versus the aggregate of all available screens) and do not want to make use of the System.Windows.Forms.Screen class you can make use of the SystemParameters.VirtualScreen* properties which will provide the aggregate of available screens.
It should always be possible to get any window back on screen. The following steps hook the currently active window to the mouse cursor:
Press Alt+Space to open the system menu
Press M for 'Move'
Press the right arrow key
now move the mouse