Code giao diện :
Giao diện chỉ dùng Timer và add WMP thôi !!!
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;
using WMPLib;
namespace doyouloveme
{
public partial class Form1 : Form
{
//System.Media.SoundPlayer m = new System.Media.SoundPlayer();
//System.Media.SoundPlayer m1 = new System.Media.SoundPlayer();
WMPLib.WindowsMediaPlayer m = new WindowsMediaPlayer();
WMPLib.WindowsMediaPlayer m1 = new WindowsMediaPlayer();
public Form1()
{
InitializeComponent();
m.URL = "nhac1.mp3";
m1.URL = "nhac2.mp3";
m1.controls.stop();
}
private void btnco_MouseHover(object sender, EventArgs e)
{
btnco.BackColor = Color.Pink;
}
private void btnkhong_MouseHover(object sender, EventArgs e)
{
Random rand = new Random();
Point pt = new Point(int.Parse(rand.Next(100).ToString()), int.Parse(rand.Next(250).ToString()));
btnkhong.Location = pt;
if (btnkhong.Location == btnco.Location)
{
btnkhong.Location = pt;
}
btnkhong.Text = "Có";
btnco.Text = "Không";
}
private void btnco_Click(object sender, EventArgs e)
{
hihahiha from = new hihahiha();
from.Show();
m1.controls.play();
m.controls.stop();
}
private void btnkhong_MouseLeave(object sender, EventArgs e)
{
btnco.Text = "Có";
btnkhong.Text = "Không";
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
Giao diện khi nhấn Có :
Dưới đây là link tải :