Solved

Using .jpg as screensaver in windows application

Posted on 2009-05-14
6
233 Views
Last Modified: 2012-05-07
Hi experts,

          I have a .jpg file, which i want to show as screen saver using a
C# windows application [VS 2008].
          Another requirement is Hot Keys are not allowed to deactivate
the screen saver.

          I have no idea about this. Please help me on this....
0
Comment
Question by:srk1982
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:xnatex21
ID: 24391626
What's the real question here?

You want a screensaver with a certain jpg? Or you've written a C# program (odd b/c I always thought of C# was used for client/server stuff) that is a screen saver program and you need help with it?
0
 

Author Comment

by:srk1982
ID: 24391661
Hi xnatex21,

         I have a windows application coded in c#, when the user is
inactive for 30 seconds, i want to show a .jpg file in my application
folder as screensaver.

thanks for your immediate responce...
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 24391799
Create a new form and set its image property to the .jpg you desire (you can import a .jpg as a resource). Set the properties of your new form as such:
////////////////////////////////////////////////////////////////////
// New Form Code
////////////////////////////////////////////////////////////////////
public Form1()
{
    InitializeComponent();
    this.FormBorderStyle = FormBorderStyle.None;
    this.WindowState = FormWindowState.Maximized;
    this.MouseMove += Form1_MouseMove;
}
 
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
    this.Close();
}
 
////////////////////////////////////////////////////////////////////
//  From main application
////////////////////////////////////////////////////////////////////
// After 30 seconds elapses (use a timer)
 
public void SomeFunction()
{
    (new ScreenSaverForm()).ShowDialog();
}

Open in new window

0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 24391817
My mistake:  The MouseMove handler should be on the picturebox, not the form. See below.
public Form1()
{
    InitializeComponent();
    this.FormBorderStyle = FormBorderStyle.None;
    this.WindowState = FormWindowState.Maximized;
    this.Size = new Size(this.Size.Width * 2, this.Size.Height);
    this.pictureBox1.MouseMove += pictureBox1_MouseMove;
}
 
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
    this.Close();
}

Open in new window

0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 24391827
Sorry I didn't include this before (I just re-read your question). As far as preventing hotkeys, you can handle the KeyDown event of the form and check if Alt is pressed:
////////////////////////////////////////////////////////////////////
// Everything together
////////////////////////////////////////////////////////////////////
public Form1()
{
    InitializeComponent();
    this.FormBorderStyle = FormBorderStyle.None;
    this.WindowState = FormWindowState.Maximized;
    this.Size = new Size(this.Size.Width * 2, this.Size.Height);
    this.pictureBox1.MouseMove += pictureBox1_MouseMove;
    this.KeyDown += new KeyEventHandler(Form1_KeyDown);
}
 
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
    this.Close();
}
 
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Alt)
        e.Handled = true;
}

Open in new window

0
 

Author Comment

by:srk1982
ID: 24391964
Hi kaufmed,

     Thanks for your prompt reply. I am in halfway.
     For now screen saver is disappering when there is a mouse movement.
     I also want to functionality for the screen saver to vanish in case there
     is a key press in keyboard except hot keys.

Thanks....
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Starting up a Project

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question