Browse Source

增加菜单栏拖动

liuyuqi-dellpc 3 years ago
parent
commit
45aa9b4f23

+ 2 - 2
PackagingProj/Package.appxmanifest

@@ -31,8 +31,8 @@
       Executable="$targetnametoken$.exe"
       EntryPoint="$targetentrypoint$">
       <uap:VisualElements
-        DisplayName="PackagingProj"
-        Description="PackagingProj"
+        DisplayName="Wifi QRCode"
+        Description="Mobile phone scan qrcode to connect Wifi."
         BackgroundColor="transparent"
         Square150x150Logo="Images\Square150x150Logo.png"
         Square44x44Logo="Images\Square44x44Logo.png">

+ 4 - 1
ShareWifi/MainForm.Designer.cs

@@ -92,6 +92,9 @@
             this.plTitle.Name = "plTitle";
             this.plTitle.Size = new System.Drawing.Size(800, 37);
             this.plTitle.TabIndex = 1;
+            this.plTitle.MouseDown += new System.Windows.Forms.MouseEventHandler(this.plTitle_MouseDown);
+            this.plTitle.MouseMove += new System.Windows.Forms.MouseEventHandler(this.plTitle_MouseMove);
+            this.plTitle.MouseUp += new System.Windows.Forms.MouseEventHandler(this.plTitle_MouseUp);
             // 
             // btnMini
             // 
@@ -122,7 +125,7 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("Sitka Banner", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-            this.label1.Location = new System.Drawing.Point(31, 3);
+            this.label1.Location = new System.Drawing.Point(13, 3);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(117, 30);
             this.label1.TabIndex = 0;

+ 28 - 1
ShareWifi/MainForm.cs

@@ -4,6 +4,7 @@ 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;
@@ -58,7 +59,7 @@ namespace ShareWifi
 
         private void btnMini_Click(object sender, EventArgs e)
         {
-
+            Hide();
         }
 
         private void btnClose_Click(object sender, EventArgs e)
@@ -70,5 +71,31 @@ namespace ShareWifi
         {
             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;
+            }
+        }
     }
 }

+ 2 - 2
ShareWifi/Views/Home.Designer.cs

@@ -47,9 +47,9 @@
             this.label4.ForeColor = System.Drawing.Color.Red;
             this.label4.Location = new System.Drawing.Point(81, 351);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(262, 23);
+            this.label4.Size = new System.Drawing.Size(308, 23);
             this.label4.TabIndex = 4;
-            this.label4.Text = "Phone Scan the QRCode to Connect Wifi.";
+            this.label4.Text = "Mobile Phone Scan the QRCode to Connect Wifi.";
             // 
             // panel2
             //