[英]A Green Border Around My C# WinForm Application
我在 C# 中創建了一個最小的 WinForm 應用程序。 一切正常,但由於某種原因,我的應用程序周圍出現“綠色邊框” 。
我將代碼粘貼在下面。
[程序.cs]
namespace WinFormsApp1
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
}
[Form1.cs]
namespace WinFormsApp1
{
public partial class Form1 : Form
{
int counter = 0;
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.textanimationWorker = new System.ComponentModel.BackgroundWorker();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("Segoe UI", 40F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point);
this.label1.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.label1.Location = new System.Drawing.Point(543, 209);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(466, 72);
this.label1.TabIndex = 0;
this.label1.Text = "Uploading RootKit.";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// button1
//
this.button1.Font = new System.Drawing.Font("Segoe UI", 25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point);
this.button1.Location = new System.Drawing.Point(43, 508);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(222, 70);
this.button1.TabIndex = 1;
this.button1.Text = "Upload RootKit";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(43, 284);
this.progressBar1.MarqueeAnimationSpeed = 1;
this.progressBar1.Maximum = 10;
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(1037, 23);
this.progressBar1.Step = 1;
this.progressBar1.TabIndex = 2;
this.progressBar1.Click += new System.EventHandler(this.progressBar1_Click);
//
// backgroundWorker1
//
this.backgroundWorker1.WorkerReportsProgress = true;
this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
//
// textanimationWorker
//
this.textanimationWorker.WorkerReportsProgress = true;
this.textanimationWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.textanimationWorker_DoWork);
this.textanimationWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.textanimationWorker_ProgressChanged);
this.textanimationWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.textanimationWorker_RunWorkerCompleted);
//
// label2
//
this.label2.AutoSize = true;
this.label2.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.label2.Location = new System.Drawing.Point(1036, 594);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(86, 15);
this.label2.TabIndex = 3;
this.label2.Text = "DECRAT V1.0.0";
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// Form1
//
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(1134, 618);
this.Controls.Add(this.label2);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
private void Form1_Load(object sender, EventArgs e)
{
Console.WriteLine("Loading Form1.. Please wait..");
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
progressBar1.Value = 0;
progressBar1.Maximum = 10;
backgroundWorker1.RunWorkerAsync();
textanimationWorker.RunWorkerAsync();
}
private void progressBar1_Click(object sender, EventArgs e)
{
}
private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
for (int i = 0; i < 10; i++) {
backgroundWorker1.ReportProgress(0);
Thread.Sleep(1000);
}
}
private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{
counter = 50;
MessageBox.Show("Uploaded RootKit Successfully!");
counter = 0;
}
private void backgroundWorker1_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
{
progressBar1.Value += 1;
}
private void textanimationWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
while (counter <= 10)
{
if (counter <= 3)
{
counter++;
textanimationWorker.ReportProgress(0);
Thread.Sleep(500);
}
else if(counter == 50){
break;
}
else {
counter = 0;
textanimationWorker.ReportProgress(0);
}
}
}
private void textanimationWorker_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
{
if (counter == 1)
{
label1.Text = "Uploading RootKit";
}
else {
label1.Text += ".";
}
}
private void textanimationWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
}
}
僅供參考:我也將它發布到一個 exe 文件,但綠色邊框仍然沒有消失!
我以為只有在我編碼時才會出現綠色邊框,以便我知道邊框在哪里,但問題似乎與 C# 有關? 或者可能還有別的東西?
編輯[添加更多信息]:我希望綠色邊框消失。 這是應用程序的照片..
綠色框表示可執行文件或程序被沙盒化。 我正在使用COMODO Antivirus並將其沙盒化。
通過關閉防病毒程序一分鍾並運行程序,綠色框消失,表明可執行文件沒有被沙盒化。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.