2010-01-12 5 views
12

에서 상속 폼로드 실패하고 난 조립 내 프로젝트에 다양한 형태의 기본 클래스 역할을 System.Windows.Forms.Form에서 상속에 클래스를 생성, 기본 클래스는 뭔가 같은 : 이제비주얼 스튜디오 2008의 WinForm 디자이너 내가 윈폼 프로젝트가 제네릭 클래스

public partial class DataForm<T> : Form where T : class 
{ 

    T currentRecord; 

    protected T CurrentRecord 
    { 
     get 
     { 
      return currentRecord; 
     } 
     set 
     { 
      currentRecord = value; 
      CurrentRecordChanged(); 
     } 
    } 
} 

, 난 내 DATAFORM 디자이너가로드되지 않습니다 상속,하지만 난 그것을 컴파일하는 경우 응용 프로그램이 잘 실행 조립 B에 양식을 만들 때.

public partial class SomeTableWindow : DataForm<SomeTable> 
{ 
    public SomeTableWindow() 
    { 
     InitializeComponent(); 
    } 
} 

내가지고있어 오류는 다음과 같습니다 :

The designer could not be shown for this file because none of the classes within it can be designed. 
The designer inspected the following classes in the file: CultivosWindow --- The base 
class 'TripleH.Erp.Controls.DataForm' could not be loaded. Ensure the assembly has 
been referenced and that all projects have been built.  


Instances of this error (1) 

1. Hide Call Stack 

at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager) 
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager) 
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) 
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) 

이가?, 내가 뭔가 잘못하고 있는가 디자이너에 버그가

형태는 같다? 일부 해결 방법이 있습니까?

도움 주셔서 감사합니다.

답변

16

알려진 제한 사항입니다. 기본적으로 일반 클래스에서 상속받은 다른 클래스를 선언하여이 문제를 해결할 수 있습니다. 예를 들어

:

class Generic<T> : UserControl 
{ 
} 

class GenericInt : Generic<int> { } 

는 GenericInt 대신 일반을 사용합니다. 나는 알고있다.

+0

대단히 감사합니다. – albertein

+0

이 해결 방법이 작동하는지 확인할 수 있습니다. 그리고 그것은 어셈블리 ** A ** 또는 어셈블리 ** B **에 중간 클래스 (예 : GenericInt)를 넣었는지 여부에 관계없이 작동합니다. –

관련 문제