Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / AutoSizeToolBoxItem.cs / 1 / AutoSizeToolBoxItem.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.Design { using System.Runtime.InteropServices; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; 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; using System.Runtime.Serialization; // For Whidbey, we want to turn on AutoSize, AutoRelocate, and change the DefaultPadding // from the values we shipped in RTM/Everett. To avoid a breaking change, we use a // custom toolbox item to apply these changes when the control is dropped. // [Serializable] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] // this class is instantiated. internal class AutoSizeToolboxItem : ToolboxItem { public AutoSizeToolboxItem(){} public AutoSizeToolboxItem(Type toolType) : base (toolType) { } [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] // it's internal and nobody derives from this. private AutoSizeToolboxItem(SerializationInfo info, StreamingContext context) { Deserialize(info, context); } protected override IComponent[] CreateComponentsCore(IDesignerHost host) { IComponent[] components = base.CreateComponentsCore(host); Debug.Assert(components != null && components.Length > 0, "ControlToolboxItem failed to create component."); Debug.Assert(components.Length == 1, "ControlToolboxItem did not create the correct number of components."); Debug.Assert(components.Length > 0 && components[0] is Control, "ControlToolboxItem did not create a control."); if (components != null && components.Length > 0 && components[0] is Control) { Control control = components[0] as Control; control.AutoSize = true; } return components; } } } // 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
- Main.cs
- HttpVersion.cs
- XmlSchemaGroup.cs
- ToolStripItemImageRenderEventArgs.cs
- ValidatorCompatibilityHelper.cs
- GradientStopCollection.cs
- StoryFragments.cs
- IMembershipProvider.cs
- DesignerDataColumn.cs
- WindowsEditBoxRange.cs
- Clipboard.cs
- RuleRefElement.cs
- InstancePersistenceCommand.cs
- XmlSchemaAll.cs
- Schedule.cs
- WebPartHeaderCloseVerb.cs
- RegistryConfigurationProvider.cs
- DeclaredTypeElementCollection.cs
- LabelLiteral.cs
- Blend.cs
- milexports.cs
- OrderablePartitioner.cs
- DecimalAnimation.cs
- GPRECTF.cs
- GZipStream.cs
- StrongNameUtility.cs
- XmlNodeComparer.cs
- Calendar.cs
- XmlDataSource.cs
- DataGridTableCollection.cs
- SingleBodyParameterMessageFormatter.cs
- CharacterHit.cs
- HashStream.cs
- XmlAnyElementAttributes.cs
- DataFormat.cs
- SortKey.cs
- TaiwanCalendar.cs
- UIElement3D.cs
- Journal.cs
- StringAnimationUsingKeyFrames.cs
- CommandBinding.cs
- IDictionary.cs
- TrackingRecord.cs
- XamlVector3DCollectionSerializer.cs
- DrawingAttributeSerializer.cs
- xamlnodes.cs
- ColorMatrix.cs
- DES.cs
- MetadataPropertyCollection.cs
- FormsIdentity.cs
- SelectionItemPattern.cs
- ValidationErrorEventArgs.cs
- WebMessageEncodingElement.cs
- SqlInternalConnectionSmi.cs
- BamlVersionHeader.cs
- StringHandle.cs
- CriticalExceptions.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- EntitySetBaseCollection.cs
- SurrogateDataContract.cs
- ParseChildrenAsPropertiesAttribute.cs
- SQLGuidStorage.cs
- ToolboxDataAttribute.cs
- GradientBrush.cs
- ConfigurationElementProperty.cs
- SqlAliaser.cs
- MatrixAnimationUsingPath.cs
- HttpApplication.cs
- Size3DConverter.cs
- PageThemeParser.cs
- remotingproxy.cs
- TypeLibConverter.cs
- ScrollChangedEventArgs.cs
- CommonProperties.cs
- SchemaImporter.cs
- XmlObjectSerializerReadContextComplex.cs
- Atom10ItemFormatter.cs
- XmlNodeChangedEventArgs.cs
- ImageKeyConverter.cs
- SmtpReplyReader.cs
- ExternalException.cs
- DataServiceResponse.cs
- XmlWriterSettings.cs
- RequiredAttributeAttribute.cs
- GridViewUpdateEventArgs.cs
- XmlAtomErrorReader.cs
- ByteStorage.cs
- AppSettingsSection.cs
- WorkflowExecutor.cs
- AsymmetricKeyExchangeDeformatter.cs
- PointConverter.cs
- AssertFilter.cs
- MenuAdapter.cs
- Annotation.cs
- ClassData.cs
- DefaultPrintController.cs
- ParameterEditorUserControl.cs
- TypeBuilderInstantiation.cs
- Restrictions.cs
- WindowPatternIdentifiers.cs