Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- DispatchChannelSink.cs
- UpdateRecord.cs
- ThousandthOfEmRealDoubles.cs
- FormViewDesigner.cs
- MimeWriter.cs
- MaskedTextBoxTextEditorDropDown.cs
- ConfigurationValidatorBase.cs
- DiscardableAttribute.cs
- TableCellCollection.cs
- UInt16.cs
- DataSourceExpression.cs
- Atom10FeedFormatter.cs
- TableSectionStyle.cs
- ParseChildrenAsPropertiesAttribute.cs
- PrintDialog.cs
- SqlWebEventProvider.cs
- ModuleElement.cs
- DayRenderEvent.cs
- SchemaNamespaceManager.cs
- DataControlCommands.cs
- BoundPropertyEntry.cs
- GeometryConverter.cs
- ViewService.cs
- TimerEventSubscription.cs
- Misc.cs
- _ConnectionGroup.cs
- ContentType.cs
- safesecurityhelperavalon.cs
- BookmarkResumptionRecord.cs
- MailMessageEventArgs.cs
- PageClientProxyGenerator.cs
- BamlRecords.cs
- EntityDataSourceStatementEditor.cs
- CheckBoxFlatAdapter.cs
- BatchServiceHost.cs
- OrderedDictionary.cs
- WSSecurityXXX2005.cs
- MarkupExtensionParser.cs
- DataListItemEventArgs.cs
- DirectoryRedirect.cs
- ColorMatrix.cs
- CodeLinePragma.cs
- OleDbDataAdapter.cs
- CalculatedColumn.cs
- IntegerFacetDescriptionElement.cs
- PeerTransportListenAddressValidator.cs
- OracleDataReader.cs
- XmlEncodedRawTextWriter.cs
- DesignerWidgets.cs
- TextEditor.cs
- MgmtResManager.cs
- SqlInternalConnectionTds.cs
- InstanceLockLostException.cs
- InheritablePropertyChangeInfo.cs
- StringUtil.cs
- RemoteHelper.cs
- CreateParams.cs
- ExtendedProtectionPolicyTypeConverter.cs
- PreservationFileReader.cs
- WebBrowsableAttribute.cs
- HttpAsyncResult.cs
- EnumerableValidator.cs
- StickyNoteHelper.cs
- ScrollEvent.cs
- DocumentXPathNavigator.cs
- CodeAttributeDeclarationCollection.cs
- _UncName.cs
- EntityType.cs
- Group.cs
- CodePrimitiveExpression.cs
- TdsParserSessionPool.cs
- ListParaClient.cs
- ConfigurationConverterBase.cs
- TextSegment.cs
- ValidatorCollection.cs
- ExpressionVisitor.cs
- Token.cs
- GroupItem.cs
- WindowsPen.cs
- ScriptModule.cs
- Span.cs
- RuleSettings.cs
- Cell.cs
- TracingConnection.cs
- RubberbandSelector.cs
- MobileResource.cs
- Unit.cs
- Throw.cs
- InternalBase.cs
- XPathDocumentBuilder.cs
- PixelShader.cs
- querybuilder.cs
- SortFieldComparer.cs
- RangeValidator.cs
- ControlPersister.cs
- XmlSerializerSection.cs
- Logging.cs
- MetaTableHelper.cs
- HttpException.cs
- GridItemPatternIdentifiers.cs