Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / PropertyGridInternal / ArrayElementGridEntry.cs / 1305376 / ArrayElementGridEntry.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms.PropertyGridInternal { using System.Diagnostics; using System; using System.Collections; using System.Reflection; using System.ComponentModel; using System.ComponentModel.Design; using System.Windows.Forms; using System.Drawing; using Microsoft.Win32; using System.Globalization; internal class ArrayElementGridEntry : GridEntry { protected int index; public ArrayElementGridEntry(PropertyGrid ownerGrid, GridEntry peParent, int index) : base(ownerGrid, peParent) { this.index = index; this.SetFlag(FLAG_RENDER_READONLY, (peParent.Flags & FLAG_RENDER_READONLY) != 0 || peParent.ForceReadOnly); } public override GridItemType GridItemType { get { return GridItemType.ArrayValue; } } public override bool IsValueEditable { get{ return ParentGridEntry.IsValueEditable; } } public override string PropertyLabel { get { return "[" + index.ToString(CultureInfo.CurrentCulture) + "]"; } } public override Type PropertyType { get { return parentPE.PropertyType.GetElementType(); } } public override object PropertyValue { get { object owner = GetValueOwner(); Debug.Assert(owner is Array, "Owner is not array type!"); return((Array)owner).GetValue(index); } set { object owner = GetValueOwner(); Debug.Assert(owner is Array, "Owner is not array type!"); ((Array)owner).SetValue(value,index); } } public override bool ShouldRenderReadOnly { get { return ParentGridEntry.ShouldRenderReadOnly; } } /* ////// Checks if the value of the current item can be modified by the user. /// ////// True if the value can be modified /// public override bool CanSetPropertyValue() { return this.ParentGridEntry.CanSetPropertyValue(); } */ /* ////// Returns if it's an editable item. An example of a readonly /// editable item is a collection property -- the property itself /// can not be modified, but it's value (e.g. it's children) can, so /// we don't want to draw it as readonly. /// ////// True if the value associated with this property (e.g. it's children) can be modified even if it's readonly. /// public override bool CanSetReadOnlyPropertyValue() { return this.ParentGridEntry.CanSetReadOnlyPropertyValue(); }*/ } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms.PropertyGridInternal { using System.Diagnostics; using System; using System.Collections; using System.Reflection; using System.ComponentModel; using System.ComponentModel.Design; using System.Windows.Forms; using System.Drawing; using Microsoft.Win32; using System.Globalization; internal class ArrayElementGridEntry : GridEntry { protected int index; public ArrayElementGridEntry(PropertyGrid ownerGrid, GridEntry peParent, int index) : base(ownerGrid, peParent) { this.index = index; this.SetFlag(FLAG_RENDER_READONLY, (peParent.Flags & FLAG_RENDER_READONLY) != 0 || peParent.ForceReadOnly); } public override GridItemType GridItemType { get { return GridItemType.ArrayValue; } } public override bool IsValueEditable { get{ return ParentGridEntry.IsValueEditable; } } public override string PropertyLabel { get { return "[" + index.ToString(CultureInfo.CurrentCulture) + "]"; } } public override Type PropertyType { get { return parentPE.PropertyType.GetElementType(); } } public override object PropertyValue { get { object owner = GetValueOwner(); Debug.Assert(owner is Array, "Owner is not array type!"); return((Array)owner).GetValue(index); } set { object owner = GetValueOwner(); Debug.Assert(owner is Array, "Owner is not array type!"); ((Array)owner).SetValue(value,index); } } public override bool ShouldRenderReadOnly { get { return ParentGridEntry.ShouldRenderReadOnly; } } /* ////// Checks if the value of the current item can be modified by the user. /// ////// True if the value can be modified /// public override bool CanSetPropertyValue() { return this.ParentGridEntry.CanSetPropertyValue(); } */ /* ////// Returns if it's an editable item. An example of a readonly /// editable item is a collection property -- the property itself /// can not be modified, but it's value (e.g. it's children) can, so /// we don't want to draw it as readonly. /// ////// True if the value associated with this property (e.g. it's children) can be modified even if it's readonly. /// public override bool CanSetReadOnlyPropertyValue() { return this.ParentGridEntry.CanSetReadOnlyPropertyValue(); }*/ } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BrowserTree.cs
- DesignTimeHTMLTextWriter.cs
- processwaithandle.cs
- Int16.cs
- XmlWrappingWriter.cs
- TextEditorCharacters.cs
- DataListItemEventArgs.cs
- Location.cs
- ResourceDescriptionAttribute.cs
- SQLDoubleStorage.cs
- InfoCardSymmetricCrypto.cs
- RegularExpressionValidator.cs
- RtfControlWordInfo.cs
- URLEditor.cs
- PageSettings.cs
- SoapCodeExporter.cs
- DrawingGroup.cs
- TypeCodeDomSerializer.cs
- SuppressMessageAttribute.cs
- SqlErrorCollection.cs
- EastAsianLunisolarCalendar.cs
- ArraySegment.cs
- ProviderConnectionPointCollection.cs
- SmtpTransport.cs
- CalculatedColumn.cs
- XmlNamespaceMappingCollection.cs
- WorkflowDesignerColors.cs
- UnauthorizedAccessException.cs
- MessageQueuePermissionAttribute.cs
- Brushes.cs
- Hash.cs
- XmlAnyAttributeAttribute.cs
- StructuredTypeInfo.cs
- XXXOnTypeBuilderInstantiation.cs
- RootBrowserWindow.cs
- X509Utils.cs
- XmlSchemaNotation.cs
- remotingproxy.cs
- DiagnosticsConfigurationHandler.cs
- CompositeClientFormatter.cs
- SchemaImporterExtensionsSection.cs
- StructureChangedEventArgs.cs
- DataRelationPropertyDescriptor.cs
- BindingEntityInfo.cs
- HashHelpers.cs
- ScrollViewerAutomationPeer.cs
- SelfIssuedAuthProofToken.cs
- FormViewPageEventArgs.cs
- IntranetCredentialPolicy.cs
- BasicHttpBindingCollectionElement.cs
- TextSelectionProcessor.cs
- sqlpipe.cs
- TreeChangeInfo.cs
- DiscoveryInnerClientManaged11.cs
- XhtmlBasicSelectionListAdapter.cs
- FixUp.cs
- PageCodeDomTreeGenerator.cs
- ObjectQueryExecutionPlan.cs
- SiteMapDataSourceView.cs
- PeerName.cs
- ConfigXmlReader.cs
- DictionaryBase.cs
- Camera.cs
- NTAccount.cs
- templategroup.cs
- WebConfigurationHost.cs
- WindowsGrip.cs
- SqlWebEventProvider.cs
- CollectionBase.cs
- RoleBoolean.cs
- LayoutSettings.cs
- CollectionViewGroupInternal.cs
- DocumentGridContextMenu.cs
- Byte.cs
- DesignerSerializationOptionsAttribute.cs
- StyleXamlTreeBuilder.cs
- PathSegmentCollection.cs
- TargetInvocationException.cs
- OracleCommand.cs
- AttributeCollection.cs
- DisplayMemberTemplateSelector.cs
- Metadata.cs
- ToolStripDropDown.cs
- TopClause.cs
- ModelPropertyImpl.cs
- XmlDataImplementation.cs
- PointCollection.cs
- TimeoutValidationAttribute.cs
- FullTextState.cs
- DockAndAnchorLayout.cs
- RowToParametersTransformer.cs
- ReachDocumentSequenceSerializerAsync.cs
- GridViewCommandEventArgs.cs
- PropertyCollection.cs
- RegexGroup.cs
- CommandTreeTypeHelper.cs
- SqlDataRecord.cs
- LinqDataSourceValidationException.cs
- ParsedAttributeCollection.cs
- WindowsFormsHelpers.cs