Пример #1
0
        /// <summary>
        /// form加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            txtValue.Text   = MemoryValue.ToString();
            txtM.Text       = MemoryMinute.ToString();
            btnStop.Enabled = false;
            iActulaWidth    = Screen.PrimaryScreen.Bounds.Width;

            iActulaHeight = Screen.PrimaryScreen.Bounds.Height;
            try
            {
                RegistryKey rk  = Registry.LocalMachine;
                RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
                object      obj = rk2.GetValue("MemoryClear");
                if (obj != null)
                {
                    cboxStartBySelf.Checked = true;
                }
                else
                {
                    cboxStartBySelf.Checked = false;
                }
                rk2.Close();
                rk.Close();
            }
            catch (Exception)
            {
                cboxStartBySelf.Checked = false;
            }
            frm = new StatusPercent(this);
        }
Пример #2
0
 private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     this.Hide();
     if (frm == null)
     {
         frm = new StatusPercent(this);
     }
     frm.Show();
     e.Cancel = true;
 }
Пример #3
0
 public void Stop()
 {
     txtM.Enabled     = true;
     txtValue.Enabled = true;
     btnStart.Enabled = true;
     btnStop.Enabled  = false;
     Timer.Stop();
     if (frm == null)
     {
         frm = new StatusPercent(this);
     }
     frm.Hide();
     frm.IsAutoClear = false;
     contextMenuStrip1.Items[0].Enabled = true;
 }
Пример #4
0
        /// <summary>
        /// 开始
        /// </summary>
        public void Start()
        {
            SaveConfig("MemoryValue", MemoryValue.ToString());
            SaveConfig("MemoryMinute", MemoryMinute.ToString());

            txtM.Enabled     = false;
            txtValue.Enabled = false;
            btnStart.Enabled = false;
            btnStop.Enabled  = true;
            contextMenuStrip1.Items[0].Enabled = false;
            //设置timer
            Timer.Interval = (int)(MemoryMinute * 60 * 1000);
            Timer.Start();
            if (frm == null)
            {
                frm = new StatusPercent(this);
            }
            frm.IsAutoClear = true;
            frm.Show();
        }