Introduction This HowTo is based on the article "C # / Net -. create screen saver on .
Application - Scenario
Why create a transparent screen saver? A possible application - scenario for a transparent screen saver could be the following:you want to offer high safety at work. No one should be able to do stuff on their computers when they are absent for longer. At the same time you want at any time what's on your computer is operating. Now they can simply activate the banners screen saver and enter the time after which the screen saver is activated. Any data or other activities such as videos are always visible further. However, once someone wants to do something on the computer, this is locked and a password inquiry initiated
This can be very useful in the business environment. In production, it is often the case that the user does not own a computer, but it needs the computer anyway, because running out data.
preparation
This HowTo is based on the article "C # / Net - Create a screen saver." on.transparency. Net / C #
Now that we have programmed the basic screen saver, we'll add transparency. At. Net, there are several types of transparency. Although one variant works as we want.Opacity Value = 40% |
see the code in the following way then:
this.Opacity = 0.2;
The following options do not work because you create a transparency but that also applies to user interactions. That is, if something is clicking then the event at the window behind it passed.
- The properties of the created form, TransparencyKey to the background color of the form . Switch
- Another option is the
this.BackColorvalue
this.BackColor = System.Drawing.Color.Transparent; to set. This, we must allow more transparency with the following code:
this.SetStyle (ControlStyles.SupportsTransparentBackColor, True); - Furthermore you can set the transparency with the alpha channel:
this.BackColor = System.Drawing. can lock
screen
Windows you can lock the screen when the screen saver is ended, Color.FromArgb (100, 255, 255, 255). This setting can directly activate the screen saver menu. The problem Here, however, that is hidden in this variant of the whole Explorer.To get around this I lock the computer directly from the screen saver.
be made available first, the required function from the Windows system. This goes as follows:
class Win32
{[DllImport ("user32.dll")] public static extern bool
LockWorkstation ();}
You simply import the user32.dll in the Win32 folder system. {[DllImport ("user32.dll")] public static extern bool
LockWorkstation ();}
Then you can use this function from your code. To achieve this I created the following method: private void
lockStation () {
Win32.LockWorkStation ();
Close ();
} First, the workstation is locked, after which the screen saver stops. This function is now calling instead of Close () on all user events. Win32.LockWorkStation ();
Close ();
0 comments:
Post a Comment