Наследование WinForms и Визуальный дизайнер
От: e.slyusar  
Дата: 05.09.11 03:13
Оценка:
Добрый день. Возникла следующая проблемма:
Есть базовый класс:

internal abstract class BaseForm<T> : Form
 where T : BaseItem {...}


internal sealed class SpecificForm : BaseForm<MyNode> {}


при наследовании от этого типа, открыть форму (потомка) в дизайнере не получается (MS Visual Studio 2010)
возникает ошибка:


Illegal characters in path.    

Instances of this error (1)  
 
Call Stack:
 
at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.Combine(String path1, String path2)
at Microsoft.VisualStudio.Platform.VsAppDomainManager.d__1.MoveNext()
at Microsoft.VisualStudio.Platform.VsAppDomainManager.InnerResolveHandler(String name)
at Microsoft.VisualStudio.Platform.VsAppDomainManager.ResolveHandler(Object sender, ResolveEventArgs args)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)


вторя ошибка:

 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: UnitForm --- The base class 'PTeam.Mediaplan.MediaplanDictionaryItemForm' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.    
 
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 Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)



если же добавить в ирархию наследование новый (промежуточный) тип:

internal abstract class BaseSpecificForm : BaseForm<MyNode> {}


и унаследовать от этого типа

internal sealed class SpecificForm : BaseSpecificForm  {}


то форма SpecificForm открывается в дизайнере форм.

Как можно упростить иерархию наследования и обеспечить возможность редактирование макета формы через встроенный дизайнер MS VisualStudio?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.