Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / ColumnHeaderCollectionEditor.cs / 1 / ColumnHeaderCollectionEditor.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- 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.Design; using System.Drawing.Design; using System.Windows.Forms.ComponentModel; using System.Diagnostics.CodeAnalysis; ////// /// internal class ColumnHeaderCollectionEditor : CollectionEditor { ////// Provides an editor for an image collection. ////// /// //Called through reflection [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public ColumnHeaderCollectionEditor(Type type) : base(type){ } ///Initializes a new instance of the ///class. /// /// protected override string HelpTopic { get { return "net.ComponentModel.ColumnHeaderCollectionEditor"; } } ///Gets the help topic to display for the dialog help button or pressing F1. Override to /// display a different help topic. ////// /// protected override object SetItems(object editValue, object[] value) { if (editValue != null) { Array oldValue = (Array)GetItems(editValue); bool valueSame = (oldValue.Length == value.Length); // We look to see if the value implements IList, and if it does, // we set through that. // Debug.Assert(editValue is System.Collections.IList, "editValue is not an IList"); System.Windows.Forms.ListView.ColumnHeaderCollection list = editValue as System.Windows.Forms.ListView.ColumnHeaderCollection; if (editValue != null) { list.Clear(); System.Windows.Forms.ColumnHeader[] colHeaders = new System.Windows.Forms.ColumnHeader[value.Length]; Array.Copy(value, 0, colHeaders, 0, value.Length); list.AddRange( colHeaders ); } } return editValue; } ////// Sets /// the specified collection to have the specified array of items. /// ////// /// internal override void OnItemRemoving(object item) { ListView listview = this.Context.Instance as ListView; if (listview == null) { return; } System.Windows.Forms.ColumnHeader column = item as System.Windows.Forms.ColumnHeader; if (column != null) { IComponentChangeService cs = GetService(typeof(IComponentChangeService)) as IComponentChangeService; PropertyDescriptor itemsProp = null; if (cs != null) { itemsProp = TypeDescriptor.GetProperties(this.Context.Instance)["Columns"]; cs.OnComponentChanging(this.Context.Instance, itemsProp); } listview.Columns.Remove( column ); if (cs != null && itemsProp != null) { cs.OnComponentChanged(this.Context.Instance, itemsProp, null, null); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved./// Removes the item from listview column header collection /// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlUserDefinedAggregateAttribute.cs
- LayoutUtils.cs
- CqlParser.cs
- SeverityFilter.cs
- EventItfInfo.cs
- SymbolUsageManager.cs
- UserNamePasswordValidator.cs
- StateFinalizationActivity.cs
- control.ime.cs
- CommandEventArgs.cs
- Set.cs
- Vector3DConverter.cs
- HttpProfileGroupBase.cs
- WebPartEditVerb.cs
- ReaderWriterLockWrapper.cs
- XmlAttributeCollection.cs
- SourceLineInfo.cs
- AsyncResult.cs
- InlineObject.cs
- NativeMethods.cs
- ModelItemKeyValuePair.cs
- ShapeTypeface.cs
- TransformedBitmap.cs
- BindingOperations.cs
- IApplicationTrustManager.cs
- WebAdminConfigurationHelper.cs
- SmuggledIUnknown.cs
- PassportAuthenticationEventArgs.cs
- CodeBinaryOperatorExpression.cs
- TextEditorMouse.cs
- StrokeNodeOperations2.cs
- Parameter.cs
- WebBrowser.cs
- StreamWriter.cs
- AvTrace.cs
- AssemblyInfo.cs
- SchemaEntity.cs
- CatalogPartChrome.cs
- ContentElement.cs
- NativeMethodsOther.cs
- UnknownWrapper.cs
- HttpHostedTransportConfiguration.cs
- DirectoryNotFoundException.cs
- Geometry.cs
- CriticalHandle.cs
- Variable.cs
- ChtmlTextWriter.cs
- BidPrivateBase.cs
- Interlocked.cs
- MaskedTextBoxTextEditorDropDown.cs
- SqlCommandSet.cs
- IndexingContentUnit.cs
- Pointer.cs
- RoutedEvent.cs
- PathSegmentCollection.cs
- EqualityComparer.cs
- PtsHost.cs
- DataControlFieldTypeEditor.cs
- ISAPIWorkerRequest.cs
- ListParagraph.cs
- BinaryReader.cs
- ConnectorSelectionGlyph.cs
- EmbossBitmapEffect.cs
- HttpsHostedTransportConfiguration.cs
- BitVector32.cs
- Highlights.cs
- FragmentQueryProcessor.cs
- Inflater.cs
- MobilePage.cs
- ThreadInterruptedException.cs
- TextAdaptor.cs
- TypeElementCollection.cs
- XsltLoader.cs
- CompatibleComparer.cs
- NativeMethodsOther.cs
- NumberFunctions.cs
- StoreUtilities.cs
- RowToParametersTransformer.cs
- SequentialOutput.cs
- PropertyValueEditor.cs
- BlurBitmapEffect.cs
- TCPClient.cs
- BamlReader.cs
- SqlDesignerDataSourceView.cs
- FullTextLine.cs
- TextContainerChangeEventArgs.cs
- SafeEventHandle.cs
- TableLayoutPanelDesigner.cs
- TypeInfo.cs
- MultipartIdentifier.cs
- BulletedListEventArgs.cs
- _ConnectOverlappedAsyncResult.cs
- Properties.cs
- GeometryCollection.cs
- ResXBuildProvider.cs
- SurrogateChar.cs
- ProviderUtil.cs
- WebServiceErrorEvent.cs
- xdrvalidator.cs
- SingletonChannelAcceptor.cs