【h5游戏开发】窗体中拖放一个标签
form1.cs
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 XNAGame_004 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_KeyDown(object sender, KeyEventArgs e) { //按键改变标签颜色 switch (e.KeyCode) { case Keys.R: label1.ForeColor = Color.Blue; break; case Keys.B: label1.ForeColor = Color.Black; break; default: label1.Text = "按键无效"; break; } } } }