all groups > dotnet windows forms designtime > may 2005 >
You're in the

dotnet windows forms designtime

group:

Designer visible property


Designer visible property Mital
5/5/2005 12:00:00 AM
dotnet windows forms designtime:
Hi,

I am creating my own designer using
http://www.divil.co.uk/net/articles/designers/hosting.asp (Also reading
through open source #Develop project.)

I can change Visible property of the control using propertygrid without any
problem, but if I change Visible property value to false using code, control
is hidden on the screen, and square control selection is apprer only.

How do I change property visible = false into propertgrid, but control is
still visible on the screen like visual studio does.

Kind Regards.

Mital


Re: Designer visible property news.microsoft.com
5/6/2005 10:18:24 PM
How are you setting the Visible property in your code ? Have you tried
raising ComponentChanging/ComponentChanged (IComponentChangeService) ?

Using TypeDescriptor to set the property is equivalent.

Are you overriding the Visible property ? Are you calling base.Visible ?

--
Francisco Padron
www.chartfx.com
[quoted text, click to view]

Re: Designer visible property Mital
5/8/2005 12:00:00 AM
Hi,

Thanks for reply. I have added context menu to the designer as "Implements
IMenuCommandService.ShowContextMenu". It means when user right click on the
control, it will show specific context menu based on control selection.

Based on click event of context menu I have done as follow inside class
MenuCommandService Implements IMenuCommandService:

Private sub mnuVisible_Click()
Dim selectionService As ISelectionService =
CType(Me._host.GetService(GetType(ISelectionService)), ISelectionService)
Dim selectedComponent As System.ComponentModel.Component =
CType(selectionService.PrimarySelection, System.ComponentModel.Component)
selectedControl.Visible = False '''<= This makes control invisible.
End Sub

I did not raised ComponentChanged event. Also, can you please provide code
snippet, how to set visible property using TypeDescriptor inside
MenuCommandService class?

Thanks again for your help.

Kind Regards.
Mital

[quoted text, click to view]

Re: Designer visible property Mital
5/8/2005 12:00:00 AM
Hi,

I have implemented TypeDescriptor as follow, which updates Visible property:

Dim oPropertyDescriptorCollection As
System.ComponentModel.PropertyDescriptorCollection =
System.ComponentModel.TypeDescriptor.GetProperties(selectedControl, True)
If Not oPropertyDescriptorCollection.Item("Visible") Is Nothing Then
oPropertyDescriptorCollection.Item("Visible").SetValue(selectedControl,
False)
End If

I hope this is right way to implement Visible property as you specified.

Thanks & regards.
Mital

[quoted text, click to view]

Re: Designer visible property Francisco Padron
5/11/2005 3:01:28 PM
That is exactly what I meant.

Did it work ?

--
Francisco Padron
www.chartfx.com

AddThis Social Bookmark Button