HighTechTalks DotNet Forums  

ReadOnly mode for Forms Designer

Dotnet Framework (WinForms DesignTime) microsoft.public.dotnet.framework.windowsforms.designtime


Discuss ReadOnly mode for Forms Designer in the Dotnet Framework (WinForms DesignTime) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Bill Rust
 
Posts: n/a

Default ReadOnly mode for Forms Designer - 11-30-2007 , 02:10 PM






Hi,

I've embedded the .NET forms designer in my application and need it to
operate in ReadOnly mode in certain circumstances. I want the user to be
able to select different controls on the form and view their properties but
not make any changes. How can this be accomplished?

Thanks,
Bill

Reply With Quote
  #2  
Old   
Linda Liu[MSFT]
 
Posts: n/a

Default RE: ReadOnly mode for Forms Designer - 12-02-2007 , 11:20 PM






Hi Bill,

Based on my understanding, you implement a custom form designer in your
application and would like to make the controls you place on the form
designer readonly in the custom properties window in your application. If
I'm off base, please feel free to let me know.

I am performing research on this issue and would get the result back to you
ASAP.

I appreciate your patience!

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
  #3  
Old   
Bill Rust
 
Posts: n/a

Default RE: ReadOnly mode for Forms Designer - 12-03-2007 , 12:32 AM



Hi Linda,

Yes, that is essentially it. I want the user to be able to select controls
on the form in the form designer and view, but not change, the control's
properties. I also do not want them to be able to move or delete controls
from the form.

Thanks,
Bill


Reply With Quote
  #4  
Old   
Linda Liu[MSFT]
 
Posts: n/a

Default RE: ReadOnly mode for Forms Designer - 12-05-2007 , 02:20 AM



Hi Bill,

The solution to the problem is a little complex.

To prevent the user from moving or deleting controls on the form designer,
you can set the "Locked" property of the controls to true.

To make the properties of the controls/components are read-only, since
PropertyGrid is not part of the designer, you can use an object acting as a
property bag for the selected component and assign it to the SelectedObject
property of the PropertyGrid at the event when a component is selected in
the designer.

The property bag exposes all the properties of the selected component but
make them all read-only.

If you're using .NET 1.x, you create a class and implement the
ICustomTypeDescriptor interface in this class so as to add all the
PropertyDescriptor objects of the selected component to the custom class
and add ReadOnlyAttribute to each property.

If you're using .NET 2.0, you create a class and a separate class that
implements the ICustomTypeDescriptor interface and then register this class
as the provider of descriptions for the above custom type.

For more information on how to implement custom type descriptor, please
refer to the following blog article:

http://blogs.msdn.com/msdnts/archive...datagridview-c
olumn-to-a-second-level-property-of-a-data-source.aspx

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support


Reply With Quote
  #5  
Old   
Bill Rust
 
Posts: n/a

Default RE: ReadOnly mode for Forms Designer - 12-05-2007 , 07:43 PM



Thanks very much, Linda. I'll give it a try.
--
Bill



Reply With Quote
  #6  
Old   
Linda Liu[MSFT]
 
Posts: n/a

Default RE: ReadOnly mode for Forms Designer - 12-10-2007 , 05:47 AM



Hi Bill,

How about the problem now?

If you have any question, please feel free to let me know.

Thank you for using our MSDN Managed Newsgroup Support Service!

Sincerely,
Linda Liu
Microsoft Online Community Support


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.