I have a form which has only tab control in it. I want to fix the location of the form on windows desktop according to the screen size of the users pc.
The form looks like windows task bar and it should be docked on top of windows desktop.
For this i set dock = top property in my form. But still it is not perfectly on top.
How to over come these melodramatically.
You can use the
Form.DesktopLocation Property
you can use the SHAppBarMessage API (C# definition) to register your form as an application bar. This would properly change the desktop workspace size to ensure other programs don't obscure your app. This approach though requires a bit more work to implement it properly.
If you just want to position yourself at the top, you can also use the Form.DesktopLocation property (as #phoenix also mentioned). You will also have to calculate your size based on the primary monitor size. And if you don't want to be at the primary monitor you will have to do some additional calculations. For these, you will need to use the proper Multiple Display Monitor functions.
Related
I have written a program in C# (Visual Studio) which makes use of multiple forms. The problem occurs whenever the program is run on a different computer which has a different screen resolution. The contents of the form do not fit into the form whenever the program is run on a computer with a smaller screen resolution. What can I do to make the CONTENTS of the form resize accordingly, depending on the screen resolution so that the contents of the form will always fit, irrelevant of the screen resolution/size of the computer on which it is being run?
Thanks a lot!
Assuming you are using WinForms, your best bet in this case is to make use of the various container controls included in the framework, like the FLowLayoutPanel and TableLayoutPanel.
If you want to avoid these, use the standard Panel control and make use of Dock property to ensure it fills the required areas correctly. Then use the Dock property on all your controls to make the layout more responsive to different resolutions, and more importantly different DPI settings in Windows.
I have a winforms app which functions as an alert system, however a lot of the people who will use my program will have multiple screens. The alerts are time sensitive, so ideally I'd like them to appear on all screen, or to be able to specify a screen, so the user is more likely to notice it. By default the message boxes appear on the main screen, and I can't find any info on anything really to do with winforms and different monitors.
The doesn't even have to be a message box, if there is another winform function which can be made to do the same functionality but also multiple screens that'd be great.
On a side note is it possible to close multiple messageboxes from only 1 being accepted?
I think the easiest thing to do is create a custom form rather than using the existing message box. That way you can use the Show method rather than ShowDialog. This would allow you show multiple forms and close all of them from a single response.
As to placing them on multiple screens: You can find the existing screens with System.Windows.Forms.Screen.AllScreens. Each one of those has a Bounds property which will show you what the coordinates and size of each screen is. After you create each custom form you can specify it's Location property to place it on the screen of your choice.
Is there a way to create an app on .NET that will be used when connected with projector/external PC but will be shown only on main screen?
Thanks.
I don't think this is possible. Powerpoint has the functionality of showing notes just on the primary display. But this is only possible when the desktop gets extended and not mirrored to the beamer.
So you shold have to extend the desktop to the beamer and then place the App window on the main screen manually.
System.Windows.Forms.Screen.AllScreens gives you access to monitor information in C#. The PrimaryScreen Property tells you, which screen is the main Screen. You may move the window from one screen to another by respecting the screen widths.
I'd like to create an app that I can dock to my screen such that when other windows are maximized they neither obscure my app, nor are they hidden behind my app. "Always on top" is not good enough since other windows can still hide behind it. It should effectively reduce the available size of my monitor and behave like a toolbar. Full screen apps should obscure my "toolbar".
So, eg, if I dock my app to the right side of my 1920 x 1080 monitor and size it to be 200px wide, the largest window I can have open on that monitor would be 1720 x 1080 (or shorter if it is the main monitor with the Windows task bar).
I remember doing this in Windows XP with just an HTML file and some ActiveX controls. XP had some shortcut to use that file as a "toolbar". I can't remember exactly how I did it now.
I haven't seen anything exactly like this on Windows 7. If the HTML hack is still possible (I believe it isn't) that would be ok, but I'd rather create a native, compiled application. Is it possible?
There's an article on CodeProject which seems to provide a sample for what you're looking for. The project is to create a desktop-toolbar which remains docked beside other windows on the screen, even if they're maximized.
During this article we will develop a class named ApplicationDesktopToolbar. This class inherits
System.Windows.Forms.Form. So when we want to make our application to
behave like an appbar all we need to do is inherit from
ApplicationDesktopToolbar instead of System.Windows.Forms.Form.
Original article author: Arik Poznanski
My C# Window Form size is 1364,835.It is shown perfectly in my PC.But while running with my Laptop(small screen size),only part of my form has shown in the visible area.How can able to fit this size issue among all systems.
do i need to add verticall scroll bar to my form?
Please Guide me to get out of this issue...
Saravanan.P
If you have not done much work on the windows application in that case you can think of using WPF, as WPF is more capable to handle this.
Still if you want to use Window application then make sure that your controls layout properly when their size changes. Use the Anchor and Dock properties. You can also use TableLayoutPanel in GrowAndShrink mode, but remember you might face some flickering issues if you use TableLayoutPanel in excess.
You can check MSDN for Auto Scaling here
you can set one property of form
WindowState = Maximized
just try this...
useanchoring, docking and etc.
look at microsoft outlook when you resize the window it changes looking another softwares can help you