Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / ListViewGroupCollectionEditor.cs / 1 / ListViewGroupCollectionEditor.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.Design.ListViewGroupCollectionEditor..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.ComponentModel.Design.Serialization;
using System.Windows.Forms;
using System.Drawing;
using System.Design;
using System.Drawing.Design;
using System.Windows.Forms.ComponentModel;
///
///
///
/// Provides an editor for an image collection.
///
internal class ListViewGroupCollectionEditor : CollectionEditor {
object editValue;
///
///
///
public ListViewGroupCollectionEditor(Type type) : base(type){
}
///
///
/// Creates a ListViewGroup instance.
///
protected override object CreateInstance(Type itemType) {
ListViewGroup lvg = (ListViewGroup) base.CreateInstance(itemType);
// Create an unique name for the list view group.
lvg.Name = CreateListViewGroupName((ListViewGroupCollection) this.editValue);
return lvg;
}
private string CreateListViewGroupName(ListViewGroupCollection lvgCollection) {
string lvgName = "ListViewGroup";
string resultName;
INameCreationService ncs = this.GetService(typeof(INameCreationService)) as INameCreationService;
IContainer container = this.GetService(typeof(IContainer)) as IContainer;
if (ncs != null && container != null) {
lvgName = ncs.CreateName(container, typeof(ListViewGroup));
}
// strip the digits from the end.
while (Char.IsDigit(lvgName[lvgName.Length - 1])) {
lvgName = lvgName.Substring(0, lvgName.Length - 1);
}
int i = 1;
resultName = lvgName + i.ToString(System.Globalization.CultureInfo.CurrentCulture);
while (lvgCollection[resultName] != null) {
i ++;
resultName = lvgName + i.ToString(System.Globalization.CultureInfo.CurrentCulture);
}
return resultName;
}
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) {
this.editValue = value;
object ret;
// This will block while the ListViewGroupCollectionDialog is running.
ret = base.EditValue(context, provider, value);
// The user is done w/ the ListViewGroupCollectionDialog.
// Don't need the edit value any longer
this.editValue = null;
return ret;
}
}
}
// 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
- ToolStripPanelCell.cs
- DefaultHttpHandler.cs
- TextBounds.cs
- PrePostDescendentsWalker.cs
- CompModSwitches.cs
- SiteMapHierarchicalDataSourceView.cs
- ToolBar.cs
- DetailsViewRowCollection.cs
- HwndProxyElementProvider.cs
- ApplicationManager.cs
- TraceSwitch.cs
- InvalidContentTypeException.cs
- GregorianCalendar.cs
- Int64AnimationBase.cs
- documentsequencetextview.cs
- TabRenderer.cs
- RequestCacheEntry.cs
- BinaryUtilClasses.cs
- WebService.cs
- shaper.cs
- ArrangedElementCollection.cs
- Pts.cs
- TypeDescriptionProviderAttribute.cs
- TimelineClockCollection.cs
- Odbc32.cs
- PathHelper.cs
- GenericTypeParameterConverter.cs
- XmlSchemaAttribute.cs
- ConnectionStringSettingsCollection.cs
- XmlValidatingReaderImpl.cs
- COM2PropertyDescriptor.cs
- SystemIPGlobalStatistics.cs
- XmlCountingReader.cs
- DesignerDataStoredProcedure.cs
- SmtpTransport.cs
- SerialStream.cs
- FacetChecker.cs
- OrderedDictionary.cs
- BatchStream.cs
- StorageComplexPropertyMapping.cs
- ReliableOutputConnection.cs
- TreeNodeBinding.cs
- SqlStatistics.cs
- TreeViewImageIndexConverter.cs
- KoreanLunisolarCalendar.cs
- OrderPreservingPipeliningMergeHelper.cs
- AspNetSynchronizationContext.cs
- WindowsStatic.cs
- FixUp.cs
- ConvertEvent.cs
- ProgressiveCrcCalculatingStream.cs
- HttpModuleActionCollection.cs
- LassoHelper.cs
- XamlWriter.cs
- ZipIOExtraFieldZip64Element.cs
- ArgumentOutOfRangeException.cs
- TreeNodeSelectionProcessor.cs
- IgnoreFlushAndCloseStream.cs
- RelationshipDetailsRow.cs
- DataGridViewDataConnection.cs
- DesignerCommandSet.cs
- EncodingNLS.cs
- GroupItemAutomationPeer.cs
- SqlExpander.cs
- ControlUtil.cs
- Point4D.cs
- ICspAsymmetricAlgorithm.cs
- EdmItemError.cs
- CustomCategoryAttribute.cs
- OutputCacheSection.cs
- ClientSettingsSection.cs
- TimersDescriptionAttribute.cs
- SmtpTransport.cs
- MessageHeaderAttribute.cs
- HttpResponseHeader.cs
- Baml6ConstructorInfo.cs
- UndoEngine.cs
- CanonicalFontFamilyReference.cs
- DataGridViewRowCollection.cs
- CommunicationException.cs
- BooleanConverter.cs
- HTMLTagNameToTypeMapper.cs
- CellLabel.cs
- QueryContinueDragEventArgs.cs
- ChtmlTextWriter.cs
- RuntimeCompatibilityAttribute.cs
- WebPartManager.cs
- TrackingDataItem.cs
- SecurityException.cs
- SatelliteContractVersionAttribute.cs
- DecoderFallbackWithFailureFlag.cs
- ViewStateModeByIdAttribute.cs
- ExceptionUtility.cs
- XamlPoint3DCollectionSerializer.cs
- TreeWalkHelper.cs
- XsltInput.cs
- TypeBinaryExpression.cs
- GraphicsPathIterator.cs
- ZipIOCentralDirectoryFileHeader.cs
- CompensableActivity.cs