Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > How to make IDesignerHost implementation read only, in Designer Host Sample?
 

How to make IDesignerHost implementation read only, in Designer Host Sample?

Hello,

I am using the "Form Designer Host" applicationwhich I found from this link, provided by Microsoft:http://support.microsoft.com/?id=813808 . I need to customise this application such that, after regenerating the form, from the XML file, the user should not be allowed to edit the controls on the form, but should only be allowed to input data not edit the control properties.

How do I disable the Designer features like, Adoners, Snaplines, resizing etc in this applciaiton?

Any help would be apprerciated.

Please respond ASAP, it is urgent.

Thanks,

~Aditya

AdiiS  Thursday, December 13, 2007 2:10 PM

You can derive from the ControlDesigner class and override its SelectionRules property to get the feature you want, I write the following code snippet for your information, for more information, you can refer this document: SelectionRules Enumeration


Code Block

Designer(typeof(myDesigner))]

class myControl : UserControl

{

}

class myDesigner : ControlDesigner

{

public override SelectionRules SelectionRules

{

get

{

return SelectionRules.Locked;

}

}

}

Zhi-Xin Ye  Tuesday, December 18, 2007 7:06 AM

Hello,

I am using the "Form Designer Host" applicationwhich I found from this link, provided by Microsoft:http://support.microsoft.com/?id=813808 . I need to customise this application such that, after regenerating the form, from the XML file, the user should not be allowed to edit the controls on the form, but should only be allowed to input data not edit the control properties.

How do I disable the Designer features like, Adoners, Snaplines, resizing etc in this applciaiton?

Any help would be apprerciated.

Please respond ASAP, it is urgent.

Thanks,

~Aditya

AdiiS  Thursday, December 13, 2007 2:00 PM
I'm not 100% sure what you're trying to do here - the whole point of designer hosting is all of that runtime user-modifyable stuff.

If you don't want that stuff, it's probably best to recreate the contents of the (Designer control/XML file) within a normal windows Form.

If you want to copy the contents of the designer, you should be able to loop through the contents of the designer control and add them to a normal form.

If recreating from the XML file, it would probably be best to use Reflection (google it for more info) to go from the strings in the XML (object names and properties) to creating objects and setting properties on them.
You would then be able to add these controls to a Form object.

If you want some more help, I've been working on a project involving this stuff for a while now, so let me kow.

Ben
EvilPenguin  Thursday, December 13, 2007 10:33 PM

Thanks for your reply, But if the user has designed a form with multiple controls inside it, Is it possible to recreate that Form inside another form where user can input his data into the controls (I need to create whole form containing controls and add the form to another Form, which has default control and events attached to it)? Will MDI be required?

AdiiS  Friday, December 14, 2007 4:06 AM

You can derive from the ControlDesigner class and override its SelectionRules property to get the feature you want, I write the following code snippet for your information, for more information, you can refer this document: SelectionRules Enumeration


Code Block

Designer(typeof(myDesigner))]

class myControl : UserControl

{

}

class myDesigner : ControlDesigner

{

public override SelectionRules SelectionRules

{

get

{

return SelectionRules.Locked;

}

}

}

Zhi-Xin Ye  Tuesday, December 18, 2007 7:06 AM

You can use google to search for other answers

Custom Search

More Threads

• Could anyone answer this client error msg? tx
• Xpander controls license
• TaskVision Source Code Installation Error
• Work Offline
• From TaskVision to WeRock
• Msn mesennger troughput isa server 2004
• Just try too...
• Real time updates?
• open web appl from win all
• How to get a thumbnail image for a screen shots for a website