`

图片切换(C#)

    博客分类:
  • C#
阅读更多
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 button1
{
    public partial class Form1 : Form
    {
        int i = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            if(this.button1.Text == "关闭")
            {
                btnButton.Visible = false;
                button1.Text = "显示";
            }
            else
            {
                btnButton.Visible = true;
                button1.Text = "关闭";
            }
        }

        private void button1_MouseEnter(object sender, EventArgs e)
        {
            i++;
            this.Text = "MouseEnter" + i.ToString();
        }

        private void button1_MouseLeave(object sender, EventArgs e)
        {
            i++;
            this.Text = "MouseLeave" + i.ToString();
        }

        private void button1_MouseMove(object sender, MouseEventArgs e)
        {
            i++;
            // this.Text = "MouseMove" + i.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult re = MessageBox.Show("Hello World!", "消息", MessageBoxButtons.YesNoCancel,
                MessageBoxIcon.Error);
            if(re == DialogResult.Yes)
            {
                this.Text = "你点了'是'按钮";
            }
            else if(re == DialogResult.No)
            {
                this.Text = "你点了'否'按钮";
            }
            else
            {
                this.Text = "你点了'取消'按钮";
            }
        }
    }
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics