Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / WinForms / Managed / System / WinForms / PropertyGridInternal / ArrayElementGridEntry.cs / 1 / 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
- CannotUnloadAppDomainException.cs
- ConfigurationManagerHelperFactory.cs
- ValueUnavailableException.cs
- AccessorTable.cs
- CachedTypeface.cs
- TypeElementCollection.cs
- ClassHandlersStore.cs
- TemplatedMailWebEventProvider.cs
- CommandManager.cs
- ZipPackagePart.cs
- WebConfigurationHost.cs
- Nodes.cs
- KnownTypesProvider.cs
- bidPrivateBase.cs
- SqlCacheDependencyDatabaseCollection.cs
- DataObject.cs
- ApplicationFileParser.cs
- IdentifierCollection.cs
- BaseDataListDesigner.cs
- UrlMappingsSection.cs
- EncryptedKey.cs
- ReadOnlyPropertyMetadata.cs
- TTSEvent.cs
- GroupBox.cs
- InstanceKey.cs
- SafeMILHandle.cs
- Geometry3D.cs
- AddInToken.cs
- DefaultPropertyAttribute.cs
- ImageClickEventArgs.cs
- MimeTypeAttribute.cs
- Parsers.cs
- XmlSortKeyAccumulator.cs
- CatalogPart.cs
- BrowserCapabilitiesFactory35.cs
- ClientOptions.cs
- ToolTip.cs
- DataObjectFieldAttribute.cs
- ScrollItemProviderWrapper.cs
- MissingMemberException.cs
- DecoderFallbackWithFailureFlag.cs
- Type.cs
- Debugger.cs
- Border.cs
- ConnectionPool.cs
- URL.cs
- complextypematerializer.cs
- WindowsRebar.cs
- MetadataItem_Static.cs
- EventMappingSettingsCollection.cs
- ListView.cs
- DiffuseMaterial.cs
- ZipIOExtraField.cs
- WaitForChangedResult.cs
- TypeSystemProvider.cs
- String.cs
- Validator.cs
- LinqDataSourceView.cs
- CodeGroup.cs
- AxisAngleRotation3D.cs
- HttpRequest.cs
- BatchStream.cs
- EditorZoneBase.cs
- GACMembershipCondition.cs
- ThumbAutomationPeer.cs
- ConfigurationPermission.cs
- RegisteredExpandoAttribute.cs
- Size.cs
- WeakReferenceList.cs
- CryptoConfig.cs
- DeflateEmulationStream.cs
- _SecureChannel.cs
- ResourceContainerWrapper.cs
- ExecutionContext.cs
- XmlSchemaParticle.cs
- ItemCollection.cs
- StructuralObject.cs
- Lookup.cs
- SqlClientWrapperSmiStream.cs
- ToolStripLabel.cs
- XmlEnumAttribute.cs
- ButtonBase.cs
- WinEventTracker.cs
- ClientConfigPaths.cs
- DebugView.cs
- DeferrableContent.cs
- ProcessInfo.cs
- MiniLockedBorderGlyph.cs
- BidPrivateBase.cs
- KoreanLunisolarCalendar.cs
- ListViewUpdatedEventArgs.cs
- ScaleTransform3D.cs
- DesignerAttribute.cs
- WebConfigManager.cs
- QilPatternFactory.cs
- datacache.cs
- XXXInfos.cs
- RSAPKCS1KeyExchangeFormatter.cs
- ListViewHitTestInfo.cs
- ListViewItemSelectionChangedEvent.cs