Re-pro步骤:
观察撕裂/伪影。我该怎么做才能解决这个问题?
代码:
partial class TestForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.oFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
// oFlowLayoutPanel
//
this.oFlowLayoutPanel.AutoScroll = true;
this.oFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.oFlowLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.oFlowLayoutPanel.Name = "oFlowLayoutPanel";
this.oFlowLayoutPanel.Size = new System.Drawing.Size(166, 263);
this.oFlowLayoutPanel.TabIndex = 0;
//
// TestForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(166, 263);
this.Controls.Add(this.oFlowLayoutPanel);
this.DoubleBuffered = true;
this.Name = "TestForm";
this.Text = "TestForm";
this.ResumeLayout(false);
}
#endregion
private FlowLayoutPanel oFlowLayoutPanel;
}
public partial class TestForm : Form
{
public TestForm()
{
InitializeComponent();
AddPanels();
}
private void AddPanels()
{
for (int i = 0; i < 200; i++)
{
var oPanel = new Panel();
oPanel.BorderStyle = BorderStyle.FixedSingle;
oPanel.BackColor = Color.DarkSlateGray;
oFlowLayoutPanel.Controls.Add(oPanel);
}
}
}
多数民众赞成