1
내 고객이 내 소프트웨어에서 그래픽 오류를보고 한 후 샘플 프로젝트를 만들었으므로 쉽게 문제를 재현 할 수있었습니다. 나는 형태의 간단한 도킹 된 DataGridView를 작성하고 I는 다음과 같이 임의의 데이터로 채우기 :DataGridView의 그래픽 오류
var ds = new DataSet();
var table = ds.Tables.Add();
Enumerable.Range(0, 100).ForEach(i => table.Columns.Add(i.ToString()));
Enumerable.Range(0, 100).ForEach(i =>
{
var row = table.NewRow();
Enumerable.Range(0, 100).ForEach(j => row[j.ToString()] = Guid.NewGuid().ToString());
table.Rows.Add(row);
});
dataGridView1.DataSource = table;
지금 나는 나의 프로그램을 실행 그것의 일부가 내 작업 표시 줄에 포함되도록 창을 이동하고 스크롤 막대를 사용 . 갑자기 모든 데이터가 엉망 :
UPDATE :
partial class Form1
{
/// <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.dataGridView1 = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// dataGridView1
//
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(986, 758);
this.dataGridView1.TabIndex = 0;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(986, 758);
this.Controls.Add(this.dataGridView1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView dataGridView1;
}
이 뒤에 이유는 무엇입니까?
위 코드는 언제 실행됩니까? – Alex
@Alex 디자이너를 통해 양식에 도킹 된 DataGridView에 데이터를 추가합니다. 그것은 폼의 생성자 중에 발생합니다. –
질문은 "이유"가 아니라 "때"입니다. 이 메소드가 호출 될 때 내부 메소드. 여러 번 실행되지 않는지 확인하기 위해 중단 점을 넣을 것입니다. – Alex