Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / ImageCollectionEditor.cs / 1 / ImageCollectionEditor.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.Design.ImageCollectionEditor..ctor(System.Type)")] namespace System.Windows.Forms.Design { using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.IO; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Windows.Forms; using System.Drawing; using System.Drawing.Design; using System.Design; using System.Windows.Forms.ComponentModel; ////// /// internal class ImageCollectionEditor : CollectionEditor { ////// Provides an editor for an image collection. ////// /// public ImageCollectionEditor(Type type) : base(type){ } ///Initializes a new instance of the ///class. /// /// Retrieves the display text for the given list item. /// protected override string GetDisplayText(object value) { string text; if (value == null) { return string.Empty; } PropertyDescriptor prop = TypeDescriptor.GetProperties(value)["Name"]; if (prop != null) { text = (string) prop.GetValue( value ); if (text != null && text.Length > 0) { return text; } } // If we want to show any type information - pretend we're an image. if (value is ImageListImage) { value = ((ImageListImage)value).Image; } text = TypeDescriptor.GetConverter(value).ConvertToString(value); if (text == null || text.Length == 0) { text = value.GetType().Name; } return text; } ////// /// protected override object CreateInstance(Type type) { UITypeEditor editor = (UITypeEditor) TypeDescriptor.GetEditor(typeof(ImageListImage), typeof(UITypeEditor)); return editor.EditValue(this.Context, null); } ///Creates an instance of the specified type in the collection. ////// /// protected override CollectionForm CreateCollectionForm() { CollectionForm form = base.CreateCollectionForm(); // We want to switch the title to ImageCollection Editor instead of ImageListImage Editor. // The collection editor is actually using ImageListImages, while the collection we're actually editing is the Image collection. form.Text = SR.GetString(SR.ImageCollectionEditorFormText); return form; } ///Creates a /// new form to show the current collection. ////// /// protected override IList GetObjectsFromInstance(object instance) { ArrayList value = instance as ArrayList; if (value != null) { return value; } else return null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved./// This Function gets the images from the givem object. The input is an ArrayList as an object. /// The output is a arraylist which contains the individual images that need to be created. /// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IFlowDocumentViewer.cs
- CompilationSection.cs
- ProcessHost.cs
- ToolStrip.cs
- PageCache.cs
- PersistenceParticipant.cs
- WebControlParameterProxy.cs
- JsonWriterDelegator.cs
- HttpInputStream.cs
- BezierSegment.cs
- HighContrastHelper.cs
- ManipulationDeltaEventArgs.cs
- TextEditorThreadLocalStore.cs
- sqlmetadatafactory.cs
- ConfigurationPropertyAttribute.cs
- HttpApplicationFactory.cs
- WebSysDisplayNameAttribute.cs
- ToolStripDropTargetManager.cs
- ConvertBinder.cs
- _BasicClient.cs
- NotifyInputEventArgs.cs
- WebAdminConfigurationHelper.cs
- GeometryGroup.cs
- Exceptions.cs
- ClientClassGenerator.cs
- PropertyItemInternal.cs
- AmbientValueAttribute.cs
- TextRangeBase.cs
- recordstatefactory.cs
- XmlResolver.cs
- EdmTypeAttribute.cs
- TraceHelpers.cs
- _AuthenticationState.cs
- InstanceNormalEvent.cs
- HttpWrapper.cs
- ImageClickEventArgs.cs
- PingReply.cs
- ThaiBuddhistCalendar.cs
- SessionParameter.cs
- NavigatorInput.cs
- NamespaceExpr.cs
- ModifierKeysValueSerializer.cs
- SelectedDatesCollection.cs
- NativeMethods.cs
- ButtonField.cs
- BinaryUtilClasses.cs
- KeyNotFoundException.cs
- LongPath.cs
- QilCloneVisitor.cs
- SafeUserTokenHandle.cs
- SoapFault.cs
- basevalidator.cs
- GraphicsState.cs
- AsyncDataRequest.cs
- FormParameter.cs
- MatrixAnimationBase.cs
- GridViewAutomationPeer.cs
- NotFiniteNumberException.cs
- KeyValueConfigurationCollection.cs
- ProtocolsSection.cs
- XmlSchemaImporter.cs
- MatrixTransform3D.cs
- PropertyInformation.cs
- XmlJsonWriter.cs
- CqlLexerHelpers.cs
- Item.cs
- SafeRegistryHandle.cs
- GridViewUpdateEventArgs.cs
- Parsers.cs
- Base64Stream.cs
- RegexCode.cs
- MemoryRecordBuffer.cs
- UnsafeMethods.cs
- DisableDpiAwarenessAttribute.cs
- CheckBoxList.cs
- PackageFilter.cs
- SecurityKeyUsage.cs
- TextShapeableCharacters.cs
- SafeRegistryHandle.cs
- OracleException.cs
- HybridCollection.cs
- PostBackOptions.cs
- SelectiveScrollingGrid.cs
- AliasExpr.cs
- FindCriteriaElement.cs
- SoapRpcMethodAttribute.cs
- ControlAdapter.cs
- ParallelActivityDesigner.cs
- Graphics.cs
- EventWaitHandle.cs
- Exceptions.cs
- FontNameEditor.cs
- NumberFormatter.cs
- TypeLibConverter.cs
- TileBrush.cs
- SqlMetaData.cs
- BStrWrapper.cs
- InputLanguageCollection.cs
- StyleXamlTreeBuilder.cs
- Automation.cs