2013-07-29 1 views
-4

내 프로젝트에서 InitializeComponent(); 방법은 여러 번 사용되었습니다. 내 질문은 정확히 구성 요소 초기화 메서드는 무엇입니까?구성 요소 초기화 메소드가 정확히 무엇입니까?

+1

처럼 간단한 MSDN Google 검색을 할 수있는 것처럼 들리지만 초보자를위한 C#은 소프트웨어 개발처럼 들리지 않습니다/코딩은 올바른 경력 경로입니다 .. 죄송합니다. – MethodMan

+0

마우스 오른쪽 버튼으로 클릭하고 "이동"을 선택하십시오. 정의 ", ** 편집 ** (이것은 무엇에 대해 광범위하고 불분명합니까? ...) – Sayse

답변

1

VS에서 파일을 보면 옆에 작은 "+"기호가 표시되어 디자이너가 열릴 수 있습니다. 거기 당신은 예를 들어 양식

을 설계 할 때 양식에 넣어 한 제어에 따라 InitializeComponent이 VS에 의해 생성되는

당신이 당신의 형태로 넣어 한 컨트롤을 시작 InitializeComponent 방법을 찾을 것입니다 내 양식은 다음과 같이되어있는 경우 :

enter image description here 다음 InitializeComponent

은 다음과 같습니다

private void InitializeComponent() 
    { 
    this.button1 = new System.Windows.Forms.Button(); 
    this.SuspendLayout(); 
    // 
    // button1 
    // 
    this.button1.Location = new System.Drawing.Point(85, 36); 
    this.button1.Name = "button1"; 
    this.button1.Size = new System.Drawing.Size(75, 23); 
    this.button1.TabIndex = 0; 
    this.button1.Text = "MY BTN"; 
    this.button1.UseVisualStyleBackColor = true; 
    // 
    // Form1 
    // 
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 
    this.ClientSize = new System.Drawing.Size(284, 262); 
    this.Controls.Add(this.button1); 
    this.Name = "Form1"; 
    this.Text = "Form1"; 
    this.ResumeLayout(false); 

    } 
관련 문제