Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Dears,
 
I have a kiosk that has 2 monitors.
I want to display a GIF image on computer startup on one of the monitors to run an ad.
How can I program that in C#?
How can I run the image on a specific monitor?
Posted 12-Aug-13 9:12am
Comments
Zoltán Zörgő at 12-Aug-13 15:14pm
   
What do you exactly mean by "computer startup"?
Sandra Ha at 12-Aug-13 15:23pm
   
When the computer completes booting
Zoltán Zörgő at 12-Aug-13 15:26pm
   
You mean when Windows is also loaded, and normally you should see the desktop? You want to start an application automatically after Windows started? Because you can hardly start something before that point - well, you could but it is really-really complicated.
maulikdusara at 12-Aug-13 15:15pm
   
Did you set you graphics display settings to Dual-view mode?
Sergey Alexandrovich Kryukov at 12-Aug-13 16:40pm
   
First of all, you need to tag the UI library or application type you want to use. What does it mean, "run an image"? :-)
"How can I program" is not a valid question. Who knows how you can program it (probably, badly :-)? You need to explain your specific concerns.
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
Before work with multiple monitors you need to have some knowledge about Screen[^] class. To display any screen on other monitor you need All active monitors Screen Resolutions.
 
For Retrieving the screen resolution, you're going to want to use the System.Windows.Forms.Screen[^] class. The Screen.AllScreens[^] property can be used to access a collection of all of the displays on the system, or you can use the Screen.PrimaryScreen property to access the primary display.
 
For setup your application on window's startup please refer below links.
http://stackoverflow.com/questions/674628/how-do-i-set-a-program-to-launch-at-startup[^]
http://stackoverflow.com/questions/5394098/how-to-make-an-exe-start-at-the-windows-startup[^]
http://www.geekpedia.com/tutorial151_Run-the-application-at-Windows-startup.html[^]
You also can refer Dynamic Screen Resolution[^] article.
  Permalink  
v2
Comments
Sandra Ha at 12-Aug-13 15:33pm
   
Actually I read about this class and I used the AllScreens() method to get the monitors details. But I was stuck, I need to display the gif image on one of the monitors in the list I have.
maulikdusara at 12-Aug-13 15:44pm
   
can you post your code what you had done?
Sandra Ha at 12-Aug-13 15:49pm
   
Ok, i made a small windows application just to test. I added a combobox and filled it with the monitors I have. foreach(Screen screen in System.Windows.Forms.Screen.AllScreens)
{
ddlScreens.Items.Add(screen.DeviceName);
 
}
 
In this way the user will select a specific monitor.
 
the second step is to run an image on the selected monior.
 

Let's say I have the image path , I can't see any method for the screen that says display or show
maulikdusara at 12-Aug-13 16:08pm
   
Ok, below code will help you.
 
private void Form1_Load(object sender, EventArgs e)
{
//Fill all screens in drop down list
foreach (Screen item in Screen.AllScreens)
{
cboScreens.Items.Add(item.DeviceName);
}
}
 
private void btnConvert_Click(object sender, EventArgs e)
{
//Rectangle object for selected screen
Rectangle recSelScreen = new Rectangle();
int intLeft = 0;
foreach (Screen item in Screen.AllScreens)
{
//Match if selected screen is current screen
if (item.DeviceName == cboScreens.SelectedText)
recSelScreen = item.WorkingArea;
else
intLeft += item.WorkingArea.Width;//Need to get left of selected screens
}
 
this.Left = recSelScreen.Left; //move current form to selected screen
}
Sergey Alexandrovich Kryukov at 12-Aug-13 16:41pm
   
This would be good if we knew that OP wanted to work with System.Windows.Forms, but how do we know that?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 468
1 Sergey Alexandrovich Kryukov 305
2 PhilLenoir 115
3 RajeeshMenoth 110
4 Uma Shankar Patel 80
0 Sergey Alexandrovich Kryukov 6,557
1 OriginalGriff 5,966
2 CPallini 2,473
3 Richard MacCutchan 1,687
4 Abhinav S 1,540


Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 12 Aug 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100