PC Review


Reply
Thread Tools Rate Thread

display form into host

 
 
enrico
Guest
Posts: n/a
 
      3rd Sep 2003
Hi, I try to load csharp code from *.cs and show it into Host.
I got information from assembly, but I can't get the view.
why my view is always null, but m_rootDesigner have value?


Assembly assember = newcompilered.CompiledAssembly;
//取得typelist
this.richTextBox1.Clear();

foreach(Module module in assember.GetModules())
{
foreach(Type type in module.GetTypes())
{
if(type.IsSubclassOf(typeof(Control)))
{
Control c = assember.CreateInstance(type.FullName) as Control;
if(c is Form)
{
IComponent compForm = c as IComponent;
//if I direct add line after, I can see it appear in other , but I
want to see it in the panel
// host.Container.Add(c,c.Name);

designer =
TypeDescriptor.CreateDesigner(compForm,typeof(IRootDesigner));
m_rootDesigner = (IRootDesigner) designer;
m_designers[c] = m_rootDesigner;

if(m_rootDesigner == null)
{
MessageBox.Show("Can't create root designer!");
}
if(view != null)
{
pnlViewHost.Controls.Clear();
view.Dispose();
}
//設定Component
foreach(Control subc in c.Controls)
{
IComponent comp = subc as IComponent;
designer = TypeDescriptor.CreateDesigner(comp,typeof(IDesigner));
if(designer != null)
{
designer.Initialize(comp);
m_designers[comp] = designer;
}
}
//View未轉完成
view =
(Control)m_rootDesigner.GetView(ViewTechnology.WindowsForms);
if(view == null)
{
MessageBox.Show("Can't create view!");
}
//view.Dock = DockStyle.Fill;
pnlViewHost.Controls.Add(view);
}
}
}
}


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unlock host display kseger Windows XP Work Remotely 2 17th Apr 2009 05:31 AM
No Display on Host Computer After Remote Desktop Web Connection Tech109 Windows XP Work Remotely 0 5th Jun 2008 11:55 PM
mstsc messes up display on host computer? Evan Platt Windows Vista General Discussion 1 6th Dec 2006 03:41 AM
Remote Desktop kills host machine display GoDogGo Windows XP Work Remotely 2 19th Dec 2003 11:49 PM
Remote desktop casues display settings on host to go bad Matt Windows XP Work Remotely 1 21st Sep 2003 01:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:32 PM.