Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XAMLParseException.cs
- WebPartConnectionsEventArgs.cs
- EntityDataSourceDesignerHelper.cs
- BooleanKeyFrameCollection.cs
- LinqDataSourceSelectEventArgs.cs
- SqlUserDefinedAggregateAttribute.cs
- ObjectManager.cs
- XmlParserContext.cs
- ReachSerializerAsync.cs
- IsolatedStorageFilePermission.cs
- UTF32Encoding.cs
- NotCondition.cs
- WebPartZone.cs
- CodeNamespace.cs
- StringUtil.cs
- mansign.cs
- PersonalizationProvider.cs
- PublishLicense.cs
- MetricEntry.cs
- EncoderNLS.cs
- WebPartVerbCollection.cs
- HighlightVisual.cs
- NumberFormatInfo.cs
- ZipIOLocalFileBlock.cs
- SerialReceived.cs
- SimpleType.cs
- DocumentAutomationPeer.cs
- SspiNegotiationTokenAuthenticatorState.cs
- GenericAuthenticationEventArgs.cs
- RemotingAttributes.cs
- Accessors.cs
- CompatibleComparer.cs
- ComplexBindingPropertiesAttribute.cs
- EventPrivateKey.cs
- DirtyTextRange.cs
- WinEventWrap.cs
- ServerValidateEventArgs.cs
- XmlAtomicValue.cs
- x509store.cs
- Asn1Utilities.cs
- LinqDataSourceDeleteEventArgs.cs
- Application.cs
- NegotiateStream.cs
- PeerContact.cs
- CodeArrayCreateExpression.cs
- SafeIUnknown.cs
- SrgsDocumentParser.cs
- DataGridViewTextBoxColumn.cs
- Ipv6Element.cs
- OfTypeExpression.cs
- SafeNativeMethods.cs
- TimeEnumHelper.cs
- PreviewPageInfo.cs
- UITypeEditors.cs
- streamingZipPartStream.cs
- GenericEnumConverter.cs
- columnmapfactory.cs
- IDispatchConstantAttribute.cs
- PasswordPropertyTextAttribute.cs
- RuleSetBrowserDialog.cs
- _ConnectOverlappedAsyncResult.cs
- XPathSingletonIterator.cs
- Label.cs
- TypedElement.cs
- XmlnsCompatibleWithAttribute.cs
- FixedSOMGroup.cs
- ResourceSetExpression.cs
- DateTimeFormatInfoScanner.cs
- DiagnosticStrings.cs
- DSASignatureFormatter.cs
- Section.cs
- ThreadExceptionDialog.cs
- ProjectionAnalyzer.cs
- TrackingMemoryStreamFactory.cs
- ToolStripItemEventArgs.cs
- PtsCache.cs
- MessageBox.cs
- PathTooLongException.cs
- BamlCollectionHolder.cs
- BindingGroup.cs
- MergeLocalizationDirectives.cs
- Rijndael.cs
- NameTable.cs
- EndPoint.cs
- Script.cs
- ImageFormat.cs
- EntityProviderServices.cs
- TextServicesCompartmentEventSink.cs
- documentsequencetextcontainer.cs
- ProfileParameter.cs
- Parallel.cs
- ISO2022Encoding.cs
- EntityWithKeyStrategy.cs
- GridViewEditEventArgs.cs
- DesignerRegionMouseEventArgs.cs
- FullTextBreakpoint.cs
- TrustManagerMoreInformation.cs
- CompilationPass2TaskInternal.cs
- MenuItemStyleCollection.cs
- CharacterBufferReference.cs