123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- 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;
- }
- }
- }
- }
|