⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.cs

📁 用C#实现了计事本的功能 对初学者相当有用的
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace jishiben
{
    public partial class Form2 : Form
    {
        private int num_old_x_length = 0;
        private int num_old_y_length = 0;
        private int num_new_x_length = 0;
        private int num_new_y_length = 0;
        public Form2()
        {
            InitializeComponent();
        }
        [System.Runtime.InteropServices.DllImportAttribute("user32.dll")]
        public static extern bool FlashWindow(IntPtr handle, bool bInvert);

        private void Form2_Load(object sender, EventArgs e)
        {
            FlashWindow(this.Handle, true);
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                VisitLink();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to open link that was clicked.");
            }
            this.Close();
   
        }
        private void VisitLink()
        {
            // Change the color of the link text by setting LinkVisited 
            // to true.
            linkLabel1.LinkVisited = true;
            //Call the Process.Start method to open the default browser 
            //with a URL:
            System.Diagnostics.Process.Start("http://www.baidu.com");
        }

        private void pictureBox1_DoubleClick(object sender, EventArgs e)
        {
            this.Close();
        }

        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Middle)
            {
 
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (sender == timer1)
            {
                num_new_x_length = Control.MousePosition.X - this.Location.X;
                num_new_y_length = Control.MousePosition.Y - this.Location.Y;

                this.Location = new Point(this.Location.X + num_new_x_length - num_old_x_length, this.Location.Y + num_new_y_length - num_old_y_length);

            }
        }

        
       
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -