[英]A Green Border Around My C# WinForm Application
I created a minimal WinForm Application in C# .我在 C# 中创建了一个最小的 WinForm 应用程序。 Everything Works Fine but for some reason a "Green border" Surrounds My Application .一切正常,但由于某种原因,我的应用程序周围出现“绿色边框” 。
I Pasted the code down below.我将代码粘贴在下面。
[program.cs] [程序.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] [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)
{
}
}
}
FYI: I also published it to an exe file but still the green border does not disappear!仅供参考:我也将它发布到一个 exe 文件,但绿色边框仍然没有消失!
I Thought the green border appears just when I code so that I know where the border is but the issue seems with C# ?我以为只有在我编码时才会出现绿色边框,以便我知道边框在哪里,但问题似乎与 C# 有关? or probably with something else ?或者可能还有别的东西?
EDIT [Adding More information]: I want the green border to disappear.编辑[添加更多信息]:我希望绿色边框消失。 Here is a photo of the Application..这是应用程序的照片..
Green box Indicates The Executable or the program is sandboxed.绿色框表示可执行文件或程序被沙盒化。 I am using COMODO Antivirus and it sandboxed it.我正在使用COMODO Antivirus并将其沙盒化。
By Turning the antivirus off for a min and running the program the green box disappeared indicating that the executable is not sandboxed.通过关闭防病毒程序一分钟并运行程序,绿色框消失,表明可执行文件没有被沙盒化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.