Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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
Comments
Zoltán Zörgő 12-Aug-13 15:14pm    
What do you exactly mean by "computer startup"?
Sandra Ha 12-Aug-13 15:23pm    
When the computer completes booting
Zoltán Zörgő 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.
Dusara Maulik 12-Aug-13 15:15pm    
Did you set you graphics display settings to Dual-view mode?
Sergey Alexandrovich Kryukov 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

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.
 
Share this answer
 
v2
Comments
Sandra Ha 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.
Dusara Maulik 12-Aug-13 15:44pm    
can you post your code what you had done?
Sandra Ha 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
Dusara Maulik 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 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900