using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ShareWifi.Views; namespace ShareWifi { public partial class MainForm : Form { HomeControl home; AboutMe aboutMe; Button activeMenu; public MainForm() { InitializeComponent(); } private void label3_Click(object sender, EventArgs e) { } private void btnGenerate_Click(object sender, EventArgs e) { } private void btnHome_Click(object sender, EventArgs e) { interHome(); activeMenu = btnHome; changeMenuTab(); } public void changeMenuTab() { if (activeMenu == btnHome) { }else if (activeMenu == btnAboutMe) { btnHome.BackColor = Color.Aquamarine; } else { activeMenu.BackColor = Color.AliceBlue; } } public void interHome() { if (home == null) { home = HomeControl.getInstance(); } plContent.Controls.Clear(); plContent.Controls.Add(home); } private void btnAboutMe_Click(object sender, EventArgs e) { if (aboutMe == null) { aboutMe = AboutMe.getInstance(); } plContent.Controls.Clear(); plContent.Controls.Add(aboutMe); activeMenu = btnAboutMe; } private void btnMini_Click(object sender, EventArgs e) { Hide(); } private void btnClose_Click(object sender, EventArgs e) { Application.Exit(); } private void MainForm_Load(object sender, EventArgs e) { interHome(); } private static bool IsDrag = false; private int enterX; private int enterY; private void plTitle_MouseDown(object sender, MouseEventArgs e) { IsDrag = true; enterX = e.Location.X; enterY = e.Location.Y; } private void plTitle_MouseUp(object sender, MouseEventArgs e) { IsDrag = false; enterX = 0; enterY = 0; } private void plTitle_MouseMove(object sender, MouseEventArgs e) { if (IsDrag) { this.Left += e.Location.X - enterX; this.Top += e.Location.Y - enterY; } } } }