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
- Win32SafeHandles.cs
- Attributes.cs
- Stylesheet.cs
- InvalidWMPVersionException.cs
- TabPage.cs
- LocalizedNameDescriptionPair.cs
- SizeValueSerializer.cs
- Menu.cs
- DistributedTransactionPermission.cs
- TypeToTreeConverter.cs
- TextEndOfParagraph.cs
- ChildrenQuery.cs
- cache.cs
- IDispatchConstantAttribute.cs
- ViewStateModeByIdAttribute.cs
- WinFormsSecurity.cs
- relpropertyhelper.cs
- ParagraphVisual.cs
- ConfigurationProperty.cs
- DataMemberListEditor.cs
- hresults.cs
- DirectionalLight.cs
- CmsInterop.cs
- OperatingSystem.cs
- IPAddressCollection.cs
- WorkflowMarkupSerializationProvider.cs
- NotifyInputEventArgs.cs
- StateInitialization.cs
- ListChangedEventArgs.cs
- GridViewEditEventArgs.cs
- coordinatorscratchpad.cs
- RowBinding.cs
- ExpressionEvaluator.cs
- SimplePropertyEntry.cs
- ModuleBuilder.cs
- LinkButton.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- __ComObject.cs
- WebPageTraceListener.cs
- AppSettingsExpressionBuilder.cs
- ButtonPopupAdapter.cs
- RemotingService.cs
- ObjectDataSourceFilteringEventArgs.cs
- HwndKeyboardInputProvider.cs
- BitmapMetadataEnumerator.cs
- Serializer.cs
- EncodingTable.cs
- ColumnWidthChangedEvent.cs
- BindMarkupExtensionSerializer.cs
- XamlPointCollectionSerializer.cs
- FormViewPagerRow.cs
- FixedSOMLineCollection.cs
- DragDrop.cs
- Preprocessor.cs
- NumericExpr.cs
- SystemWebSectionGroup.cs
- UpdateExpressionVisitor.cs
- FontFamilyConverter.cs
- TriState.cs
- _LocalDataStore.cs
- MessageQueueException.cs
- X509Utils.cs
- SoapMessage.cs
- Oid.cs
- SQLChars.cs
- PeerNameRecord.cs
- XmlDocument.cs
- MemoryResponseElement.cs
- SoapHeaderException.cs
- SerializableAttribute.cs
- AnnotationResourceCollection.cs
- DiscoveryClientOutputChannel.cs
- ListViewInsertedEventArgs.cs
- FlowchartDesigner.Helpers.cs
- CommandEventArgs.cs
- compensatingcollection.cs
- CodeStatement.cs
- Evaluator.cs
- ToolStripItemTextRenderEventArgs.cs
- ProcessHostConfigUtils.cs
- EncodingDataItem.cs
- RuleSetDialog.cs
- TextTabProperties.cs
- Route.cs
- FormatSettings.cs
- XNodeValidator.cs
- BatchStream.cs
- FontNameEditor.cs
- CoreSwitches.cs
- BrowserCapabilitiesFactory.cs
- BinaryFormatterWriter.cs
- WindowsBrush.cs
- GZipUtils.cs
- SmtpFailedRecipientException.cs
- SoapAttributeOverrides.cs
- Type.cs
- UICuesEvent.cs
- PersonalizableTypeEntry.cs
- EntityDataSourceChangedEventArgs.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs