473,785 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Screen Coordinates of Secondary Screen

In a multi-monitor environment, a form I am creating at run time keeps
placing itself on the primary screen, even if the main form of the program
making the call is on the secondary screen.

How do I place a form on the secondary screen (monitor)?

--
--Zorpie
Jan 4 '06 #1
4 8096
Zorpiedoman,
I normally set the bounds of my form to the bounds of the secondary screen.

Something like (VB.NET):

Protected Overrides Sub OnLoad(ByVal e As System.EventArg s)
MyBase.OnLoad(e )
Dim s As Screen
For Each s In Screen.AllScree ns
If Not s.Primary Then Exit For
Next
Me.Bounds = s.Bounds
Me.WindowState = FormWindowState .Maximized
End Sub

NOTE: I look for the non primary screen, rather then assume AllScreens[1] is
the second screen... The above code works if there is no secondary monitor
(it just uses the primary).
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Zorpiedoma n" <no*********@be atles.com> wrote in message
news:1A******** *************** ***********@mic rosoft.com...
| In a multi-monitor environment, a form I am creating at run time keeps
| placing itself on the primary screen, even if the main form of the program
| making the call is on the secondary screen.
|
| How do I place a form on the secondary screen (monitor)?
|
|
|
| --
| --Zorpie
Jan 4 '06 #2
Jay,
NOTE: I look for the non primary screen, rather then assume AllScreens[1] is
the second screen... The above code works if there is no secondary monitor
(it just uses the primary).


But it seems to assume that there is at most one secondary monitor,
what if you have more than that? If you have one form and want another
to appear on the same screen wouldn't it be better to do something
like

form2.Bounds = Screen.FromCont rol(form1).Boun ds
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jan 4 '06 #3
| But it seems to assume that there is at most one secondary monitor,
| what if you have more than that?
Yes my code is written to find the first secondary monitor.
| form2.Bounds = Screen.FromCont rol(form1).Boun ds

Doh! I miss read the original question. Screen.FromCont rol would be better
to find the screen where a form is currently displayed.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Mattias Sjögren" <ma************ ********@mvps.o rg> wrote in message
news:ez******** ******@TK2MSFTN GP15.phx.gbl...
| Jay,
|
| >NOTE: I look for the non primary screen, rather then assume AllScreens[1]
is
| >the second screen... The above code works if there is no secondary
monitor
| >(it just uses the primary).
|
| But it seems to assume that there is at most one secondary monitor,
| what if you have more than that? If you have one form and want another
| to appear on the same screen wouldn't it be better to do something
| like
|
| form2.Bounds = Screen.FromCont rol(form1).Boun ds
|
|
| Mattias
|
| --
| Mattias Sjögren [C# MVP] mattias @ mvps.org
| http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
| Please reply only to the newsgroup.
Jan 4 '06 #4
Thanks Guys!
Jan 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1369
by: phil cunningham | last post by:
Hello, I am looking for a good way to scale real objects on to the screen/printer In our project, objects are created assuming the units are meters. For example, I may have a rectangluar shape that is 10.2m x7.3m Part1 I want to be able to set a user defined scale (say 100 to 1) so that the box appears on screen at 10.2cm x 7.3cm (i.e. 100 times smaller than it really is) This scale should be changeable to any value betwee 1 to 400...
2
4579
by: Dan Sikorsky | last post by:
How do you get the x,y pixel location of a textbox so that you can position the Web Date Control popup nearby the associated textbox that will contain the date selected by the Web Date Control? -- Thank you kindly, Dan Sikorsky BAB, BScE, MSC
3
5756
by: ZorpiedoMan | last post by:
Help... I need the screen coordinates of a control so I can place a pop up form underneath it. --Zorpy *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
1
1692
by: zoneal | last post by:
OS: Win XP Language: VB.net or C# I have a program where I need to launch 2 separate instances of an App called "Main.exe". Each instance will need to be piped to there own video display. Both displays need to be running at a screen resolution of 640x480. I am able to force to screen resolution of the display that the app is
3
5416
by: steve | last post by:
Hi All I have textboxes within a TableLayoutpanel and I want to be able to position an independant control adjacent to a selected textbox This independent control allows selection of text to insert into the textbox I am having trouble achieving this, see code below, the x position is too far to the right and the y position is close to the bottom of the textbox and I want it to be side by side.
11
5326
by: AliR | last post by:
Hi everybody! I need a script, which calculates screen coordinates of given object (e.g. textbox or div). By "screen coordinates" I mean offset from upper left corner of the screen (not frame or browser window). Thanks in advance.
3
1484
by: Peter Oliphant | last post by:
I'm programming using MS VS VC++ 2008 Express (Beta 2) in /Cli pure mode. I've found the Screen class. With it I can very easily get the count and all the data on the various Screens attached to a system, whether it be a single screen or multiple screen system. I believe the FromControl method of the Screen class can be used to determine which Screen a Form is on. But I can't find how I can place or move a Form onto the Screen of my...
0
8951
by: raylopez99 | last post by:
keywords: logical coordinates, page coordinates, world coordinates, device coordinates, physical coordinates, screen coordinates, client coordinates. offset rectangle. WYSIWYG rubber rectangle problem, bounded rectangle problem. PointToClient, PointToScreen Beware this newbie trap for the unwary. It goes by various names (in some old MFC literature I saw some of the keywords above). Whenever doing comparisons between points,...
10
44087
by: =?Utf-8?B?UmljaA==?= | last post by:
A lot of users at my workplace use different screen resolutions, and I build apps to use 1680 x 1050 pixels res by default. But some users are using 800 x 600, and the apps are too large for their screen. I used to write code in Java a few years ago (2005), and you could stretch a form with the mouse and all the controls and fonts would resize to larger or smaller size. Does .Net framework 3.5 support this kind of functionality? Or -...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8973
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.