2012-05-03 2 views
2

내가 묻는 이유는 "Add new Item"을 선택할 때 Visual Studio Express이 누락되었습니다.Visual Studio에서 "새 항목 추가"가 선택되고 "구성 요소 클래스"가 선택되면 어떤 코드가 생성됩니까?

나는 수동으로 작성하고 싶지만 추가 할 코드를 모르겠습니다.

전문 또는 그 이상 버전을 가진 사람은 "구성 요소 클래스"시각 구하는하지만 대답

솔루션

를 사용하여 코드를 추가 할 때 생성되는 C# 코드를 붙여한다면 정말 appriciate 것 구성 요소의 일부인 사용자 정의 컨트롤은 일반 클래스뿐만 아니라 만들어야합니다.

답변

3

코드 부분

Component1.cs

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Diagnostics; 
using System.Linq; 
using System.Text; 

namespace blabla 
{ 
    public partial class Component1 : Component 
    { 
     public Component1() 
     { 
      InitializeComponent(); 
     } 

     public Component1(IContainer container) 
     { 
      container.Add(this); 

      InitializeComponent(); 
     } 
    } 
} 

편집 :

Component1.Designer.cs

namespace blabla 
{ 
    partial class Component1 
    { 
     /// <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 Component 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() 
     { 
      components = new System.ComponentModel.Container(); 
     } 

     #endregion 
    } 
} 

그러나 당신이 그리워하는 시각적 인 부분이있다

.. .

관련 문제