From cec1889cea28e1511ce80aed6353a770b2e97778 Mon Sep 17 00:00:00 2001 From: Chenx221 Date: Mon, 21 Aug 2023 18:45:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OTP/Form1.Designer.cs | 84 ++++++++++++++++++++++++++++++++++--------- OTP/Form1.cs | 6 ++-- OTP/OTP.csproj | 6 ++++ OTP/packages.config | 2 ++ 4 files changed, 78 insertions(+), 20 deletions(-) diff --git a/OTP/Form1.Designer.cs b/OTP/Form1.Designer.cs index 6d71b27..ca91e32 100644 --- a/OTP/Form1.Designer.cs +++ b/OTP/Form1.Designer.cs @@ -32,8 +32,10 @@ this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); - this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.label2 = new System.Windows.Forms.Label(); + this.circularProgressBar1 = new CircularProgressBar.CircularProgressBar(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // listBox1 @@ -47,10 +49,11 @@ // label1 // this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(582, 53); + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(549, 59); + this.label1.MinimumSize = new System.Drawing.Size(197, 37); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(125, 25); + this.label1.Size = new System.Drawing.Size(197, 37); this.label1.TabIndex = 1; this.label1.Text = "TOTP Code"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -71,38 +74,85 @@ this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(85, 51); this.button2.TabIndex = 3; - this.button2.Text = "button1"; + this.button2.Text = "Copy"; this.button2.UseVisualStyleBackColor = true; // - // progressBar1 - // - this.progressBar1.Location = new System.Drawing.Point(556, 161); - this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(176, 44); - this.progressBar1.TabIndex = 4; - // // label2 // this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(584, 174); + this.label2.Location = new System.Drawing.Point(584, 247); + this.label2.MinimumSize = new System.Drawing.Size(123, 20); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(123, 20); this.label2.TabIndex = 5; this.label2.Text = "Remaining Time"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // + // circularProgressBar1 + // + this.circularProgressBar1.AnimationFunction = WinFormAnimation.KnownAnimationFunctions.Liner; + this.circularProgressBar1.AnimationSpeed = 500; + this.circularProgressBar1.BackColor = System.Drawing.Color.Transparent; + this.circularProgressBar1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.circularProgressBar1.ForeColor = System.Drawing.Color.White; + this.circularProgressBar1.InnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(73)))), ((int)(((byte)(94))))); + this.circularProgressBar1.InnerMargin = 2; + this.circularProgressBar1.InnerWidth = -1; + this.circularProgressBar1.Location = new System.Drawing.Point(587, 124); + this.circularProgressBar1.MarqueeAnimationSpeed = 2000; + this.circularProgressBar1.Maximum = 30; + this.circularProgressBar1.Name = "circularProgressBar1"; + this.circularProgressBar1.OuterColor = System.Drawing.Color.White; + this.circularProgressBar1.OuterMargin = -25; + this.circularProgressBar1.OuterWidth = 26; + this.circularProgressBar1.ProgressColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(150)))), ((int)(((byte)(218))))); + this.circularProgressBar1.ProgressWidth = 20; + this.circularProgressBar1.SecondaryFont = new System.Drawing.Font("Microsoft Sans Serif", 36F); + this.circularProgressBar1.Size = new System.Drawing.Size(120, 120); + this.circularProgressBar1.StartAngle = 270; + this.circularProgressBar1.SubscriptColor = System.Drawing.Color.Transparent; + this.circularProgressBar1.SubscriptMargin = new System.Windows.Forms.Padding(10, -35, 0, 0); + this.circularProgressBar1.SubscriptText = ".23"; + this.circularProgressBar1.SuperscriptColor = System.Drawing.Color.Transparent; + this.circularProgressBar1.SuperscriptMargin = new System.Windows.Forms.Padding(10, 35, 0, 0); + this.circularProgressBar1.SuperscriptText = "°C"; + this.circularProgressBar1.TabIndex = 6; + this.circularProgressBar1.Text = "time"; + this.circularProgressBar1.TextMargin = new System.Windows.Forms.Padding(21, 2, 0, 0); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(556, 359); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(85, 23); + this.button3.TabIndex = 7; + this.button3.Text = "Settings"; + this.button3.UseVisualStyleBackColor = true; + // + // button4 + // + this.button4.Location = new System.Drawing.Point(647, 359); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(85, 23); + this.button4.TabIndex = 8; + this.button4.Text = "About"; + this.button4.UseVisualStyleBackColor = true; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(775, 400); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); this.Controls.Add(this.label2); - this.Controls.Add(this.progressBar1); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.label1); this.Controls.Add(this.listBox1); + this.Controls.Add(this.circularProgressBar1); this.Name = "Form1"; this.Text = "Main Window"; this.ResumeLayout(false); @@ -116,8 +166,10 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; - private System.Windows.Forms.ProgressBar progressBar1; private System.Windows.Forms.Label label2; + private CircularProgressBar.CircularProgressBar circularProgressBar1; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; } } diff --git a/OTP/Form1.cs b/OTP/Form1.cs index 0f9cfa0..f00d669 100644 --- a/OTP/Form1.cs +++ b/OTP/Form1.cs @@ -32,10 +32,8 @@ namespace OTP private void Timer_Tick(object sender, EventArgs e) { int remainingSeconds = totp.RemainingSeconds(); - int totalSeconds = 30; - - progressBar1.Value = (totalSeconds - remainingSeconds) * progressBar1.Maximum / totalSeconds; - label2.Text = remainingSeconds.ToString(); + circularProgressBar1.Text = remainingSeconds.ToString(); + circularProgressBar1.Value = remainingSeconds; if (remainingSeconds == 30) { GenerateAndDisplayTotp(); diff --git a/OTP/OTP.csproj b/OTP/OTP.csproj index 2569dbb..b25c7b5 100644 --- a/OTP/OTP.csproj +++ b/OTP/OTP.csproj @@ -33,6 +33,9 @@ 4 + + ..\packages\CircularProgressBar.2.8.0.16\lib\net40\CircularProgressBar.dll + ..\packages\Otp.NET.1.3.0\lib\net45\Otp.NET.dll @@ -52,6 +55,9 @@ + + ..\packages\WinFormAnimation.1.6.0.4\lib\net40\WinFormAnimation.dll + diff --git a/OTP/packages.config b/OTP/packages.config index 960b486..d33de52 100644 --- a/OTP/packages.config +++ b/OTP/packages.config @@ -1,5 +1,7 @@  + + \ No newline at end of file