2016-06-03 10 views
0

현재 사용자 지정 컨트롤을 작성하고 있지만 Visual Studio의 속성 탐색기에서 사용자 지정 클래스를 볼 수 없도록 노력하고 있습니다. 누구든지 내가 뭘 잘못하고있다 제안 할 수 있습니다. 다른 사람이 문제가있는 경우사용자 지정 컨트롤 : 사용자 지정 컨트롤을 사용하여 속성 탐색기에 표시

View from VS 2010

public class GelButton : Button 
    { 
     private Appearance _ButtonAppearance = new Appearance(); 

     [Category("Appearance"), Description("Appearance.")] 
     public Appearance ButtonAppearance 
     { 
      get { return this._ButtonAppearance; } 
      set 
      { 
       this._ButtonAppearance = value; 
       this.Invalidate(); 
      } 
     } 
    } 

public class Appearance 
     { 
      private Color _Top = Color.FromArgb(255, 44, 85, 177); 
      private Color _Bottom = Color.FromArgb(255, 153, 198, 241); 
      private Color _Colour3 = Color.White; 
      LinearGradientMode _GradientMode = LinearGradientMode.Vertical; 

      [Category("Appearance"), Description("The Color to use for the top portion of the gradient fill of the component.")] 
      public Color Top { get { return _Top; } set { _Top = value; } } 
      [Category("Appearance"), Description("The Color to use for the Bottom portion of the gradient fill of the component.")] 
      public Color Bottom { get { return _Bottom; } set { _Bottom = value; } } 
      [Category("Appearance"), Description("Gradient fill colour 3 of the component.")] 
      public Color Colour3 { get { return _Colour3; } set { _Colour3 = value; } } 
      [Category("Appearance"), Description("The gradient fill mode of the component.")] 
      public LinearGradientMode GradientMode { get { return _GradientMode; } set { _GradientMode = value; } } 

     } 

답변

0

나는 다음과 같은 해결책을 발견

[TypeConverter(typeof(ButAppearance))]  
public class GelButton : Button 
    { 
     private Appearance _ButtonAppearance = new Appearance(); 

     [Category("Appearance"), Description("Appearance.")] 
     public Appearance ButtonAppearance 
     { 
      get { return this._ButtonAppearance; } 
      set 
      { 
       this._ButtonAppearance = value; 
       this.Invalidate(); 
      } 
     } 
    } 

public class Appearance 
     { 
      private Color _Top = Color.FromArgb(255, 44, 85, 177); 
      private Color _Bottom = Color.FromArgb(255, 153, 198, 241); 
      private Color _Colour3 = Color.White; 
      LinearGradientMode _GradientMode = LinearGradientMode.Vertical; 

      [Category("Appearance"), Description("The Color to use for the top portion of the gradient fill of the component.")] 
      public Color Top { get { return _Top; } set { _Top = value; } } 
      [Category("Appearance"), Description("The Color to use for the Bottom portion of the gradient fill of the component.")] 
      public Color Bottom { get { return _Bottom; } set { _Bottom = value; } } 
      [Category("Appearance"), Description("Gradient fill colour 3 of the component.")] 
      public Color Colour3 { get { return _Colour3; } set { _Colour3 = value; } } 
      [Category("Appearance"), Description("The gradient fill mode of the component.")] 
      public LinearGradientMode GradientMode { get { return _GradientMode; } set { _GradientMode = value; } } 

     } 

internal class ButAppearance : ExpandableObjectConverter 
{ 
} 
관련 문제