Code:
/ FX-1434 / FX-1434 / 1.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
- FontFamily.cs
- RadioButtonAutomationPeer.cs
- TextOutput.cs
- DataGridViewRowConverter.cs
- CompleteWizardStep.cs
- XmlSiteMapProvider.cs
- TargetConverter.cs
- LineGeometry.cs
- IndentedTextWriter.cs
- ToolboxItemCollection.cs
- Expression.cs
- OletxDependentTransaction.cs
- EntityDataReader.cs
- QilParameter.cs
- UInt32.cs
- Metadata.cs
- NumberSubstitution.cs
- Queue.cs
- HyperLinkStyle.cs
- WebPartDeleteVerb.cs
- RegionData.cs
- ExpressionList.cs
- CharStorage.cs
- RequestDescription.cs
- ToolStripDesignerAvailabilityAttribute.cs
- IpcPort.cs
- SqlDataSourceQueryEditorForm.cs
- Options.cs
- ExecutionEngineException.cs
- XmlFormatReaderGenerator.cs
- BaseProcessor.cs
- RunClient.cs
- PageContentAsyncResult.cs
- DocumentPaginator.cs
- RemoveStoryboard.cs
- EncryptedXml.cs
- Point3DCollectionConverter.cs
- CodeTypeDeclaration.cs
- PrintPreviewControl.cs
- Schema.cs
- StringSorter.cs
- PropertyInfoSet.cs
- XPathNavigatorKeyComparer.cs
- AggregateNode.cs
- XmlExpressionDumper.cs
- Rectangle.cs
- XmlNotation.cs
- DictionaryBase.cs
- RolePrincipal.cs
- PtsContext.cs
- DbBuffer.cs
- CheckBoxPopupAdapter.cs
- FlowchartSizeFeature.cs
- HttpCookiesSection.cs
- UdpRetransmissionSettings.cs
- OdbcConnectionPoolProviderInfo.cs
- CollectionEditVerbManager.cs
- SqlSelectStatement.cs
- ParseHttpDate.cs
- EdgeModeValidation.cs
- X509ThumbprintKeyIdentifierClause.cs
- SecurityContext.cs
- ContactManager.cs
- ListComponentEditorPage.cs
- InternalSafeNativeMethods.cs
- SparseMemoryStream.cs
- MobileUserControl.cs
- XmlSignificantWhitespace.cs
- ExceptionRoutedEventArgs.cs
- DataChangedEventManager.cs
- FileDialog_Vista_Interop.cs
- CodeSpit.cs
- SoapTransportImporter.cs
- ResourceAttributes.cs
- XPathMessageFilter.cs
- RenderData.cs
- WeakReferenceKey.cs
- XmlValidatingReaderImpl.cs
- ConnectionStringSettings.cs
- AnnotationDocumentPaginator.cs
- Function.cs
- MetadataItemEmitter.cs
- SQLResource.cs
- FunctionDetailsReader.cs
- OleDbEnumerator.cs
- ConfigXmlComment.cs
- DataGridViewDataConnection.cs
- RectangleHotSpot.cs
- XmlSerializationWriter.cs
- SqlNotificationRequest.cs
- FormViewDesigner.cs
- IdentitySection.cs
- Stack.cs
- MsmqAppDomainProtocolHandler.cs
- PriorityRange.cs
- WorkflowDispatchContext.cs
- Calendar.cs
- TagNameToTypeMapper.cs
- ToolStripGrip.cs
- ContainerAction.cs