1234567891011121314151617181920212223242526272829303132333435363738 |
- using KeepScreenLight.Utils;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace KeepScreenLight
- {
- public partial class MainForm : Form
- {
- bool flag = false;
- public MainForm()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (!flag)
- {
- // 让屏幕常亮
- SystemSleep.PreventForCurrentThread();
- button1.Text = "Stop";
-
- }
- else
- {
- SystemSleep.RestoreForCurrentThread();
- button1.Text = "Start";
- }
- }
- }
- }
|