»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books
»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects
»Competition
Community
Winners
Prizes
Write For Us
Members
»Other Resources
Links
Dotnet Resources
|
C# How to Show windows form on dual monitor
This sample code shows how to Show windows form on dual monitor
function void showOnMonitor1()
{
Screen[] sc;
sc = Screen.AllScreens;
//get all the screen width and heights
Form2 f = new Form2();
f.FormBorderStyle = FormBorderStyle.None;
f.Left = sc[0].Bounds.Width;
f.Top = sc[0].Bounds.Height;
f.StartPosition = FormStartPosition.Manual;
f.Location = sc[0].Bounds.Location;
Point p = new Point(sc[0].Bounds.Location.X, sc[0].Bounds.Location.Y);
f.Location = p;
f.WindowState = FormWindowState.Maximized;
f.Show();
}
function void showOnMonitor2()
{
Screen[] sc;
sc = Screen.AllScreens;
//get all the screen width and heights
Form2 f = new Form2();
f.FormBorderStyle = FormBorderStyle.None;
f.Left = sc[1].Bounds.Width;
f.Top = sc[1].Bounds.Height;
f.StartPosition = FormStartPosition.Manual;
f.Location = sc[1].Bounds.Location;
Point p = new Point(sc[1].Bounds.Location.X, sc[1].Bounds.Location.Y);
f.Location = p;
f.WindowState = FormWindowState.Maximized;
f.Show();
}
|