Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / UserControlDocumentDesigner.cs / 1 / UserControlDocumentDesigner.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms.Design { using System.Collections; using System.ComponentModel; using System.Runtime.Serialization; using System.Diagnostics; using System; using System.Design; using System.ComponentModel.Design; using Microsoft.Win32; using System.Drawing; using System.Drawing.Design; using System.IO; using System.Windows.Forms; ////// /// [ ToolboxItemFilter("System.Windows.Forms.UserControl", ToolboxItemFilterType.Custom), ToolboxItemFilter("System.Windows.Forms.MainMenu", ToolboxItemFilterType.Prevent) ] internal class UserControlDocumentDesigner : DocumentDesigner { public UserControlDocumentDesigner() { AutoResizeHandles = true; } ///Provides a base implementation of a designer for user controls. ////// On user controls, size == client size. We do this so we can mess around /// with the non-client area of the user control when editing menus and not /// mess up the size property. /// private Size Size { get { return Control.ClientSize; } set { Control.ClientSize = value; } } internal override bool CanDropComponents(DragEventArgs de) { bool canDrop = base.CanDropComponents(de); if (canDrop) { // Figure out if any of the components in a main menu item. // We don't like main menus on UserControlDocumentDesigner. // OleDragDropHandler ddh = GetOleDragHandler(); object[] dragComps = ddh.GetDraggingObjects(de); if (dragComps != null) { IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); for (int i = 0; i < dragComps.Length; i++) { if (host == null || dragComps[i] == null || !(dragComps[i] is IComponent)) { continue; } if (dragComps[i] is MainMenu) return false; } } } return canDrop; } ////// /// Allows a designer to filter the set of properties /// the component it is designing will expose through the /// TypeDescriptor object. This method is called /// immediately before its corresponding "Post" method. /// If you are overriding this method you should call /// the base implementation before you perform your own /// filtering. /// protected override void PreFilterProperties(IDictionary properties) { PropertyDescriptor prop; base.PreFilterProperties(properties); // Handle shadowed properties // string[] shadowProps = new string[] { "Size" }; Attribute[] empty = new Attribute[0]; for (int i = 0; i < shadowProps.Length; i++) { prop = (PropertyDescriptor)properties[shadowProps[i]]; if (prop != null) { properties[shadowProps[i]] = TypeDescriptor.CreateProperty(typeof(UserControlDocumentDesigner), prop, empty); } } } } } // 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
- Native.cs
- SocketElement.cs
- TargetConverter.cs
- SoapSchemaMember.cs
- InvokeBase.cs
- SpecularMaterial.cs
- LocalValueEnumerator.cs
- RuntimeVariableList.cs
- DataServiceRequest.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- DesignerOptions.cs
- DataGridViewBand.cs
- Underline.cs
- ListBindableAttribute.cs
- DataObjectFieldAttribute.cs
- TransformerInfoCollection.cs
- ExceptionUtility.cs
- ListViewCommandEventArgs.cs
- PartialTrustVisibleAssembliesSection.cs
- BindToObject.cs
- iisPickupDirectory.cs
- HtmlLabelAdapter.cs
- RuntimeConfigLKG.cs
- CapabilitiesAssignment.cs
- FrameworkContentElement.cs
- GeneralTransform3DTo2D.cs
- RecognizedWordUnit.cs
- ObjectTag.cs
- DataRelation.cs
- CommonDialog.cs
- RelatedImageListAttribute.cs
- LicenseException.cs
- EventMappingSettings.cs
- ToolStripProgressBar.cs
- SignatureHelper.cs
- cache.cs
- Html32TextWriter.cs
- StringKeyFrameCollection.cs
- InfoCardBinaryReader.cs
- XmlNamespaceDeclarationsAttribute.cs
- AlternateView.cs
- COSERVERINFO.cs
- ProvidersHelper.cs
- TextSelectionProcessor.cs
- ServerIdentity.cs
- HttpCapabilitiesSectionHandler.cs
- InputProcessorProfiles.cs
- TransformPattern.cs
- ParserHooks.cs
- selecteditemcollection.cs
- PtsHost.cs
- MouseActionConverter.cs
- ListView.cs
- SqlRowUpdatingEvent.cs
- ReadWriteObjectLock.cs
- SimpleType.cs
- TabPage.cs
- Win32.cs
- TerminateWorkflow.cs
- BulletedListEventArgs.cs
- FrameworkTemplate.cs
- Int16AnimationUsingKeyFrames.cs
- HttpModuleAction.cs
- ArglessEventHandlerProxy.cs
- GroupItemAutomationPeer.cs
- AuthenticationModulesSection.cs
- AutomationProperties.cs
- AssemblyBuilder.cs
- ListenDesigner.cs
- shaperfactory.cs
- NameValueConfigurationElement.cs
- QueryOperationResponseOfT.cs
- XmlCollation.cs
- TextRangeEditLists.cs
- XmlArrayAttribute.cs
- Int32EqualityComparer.cs
- XmlReturnWriter.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- ArrayItemReference.cs
- Vector3dCollection.cs
- FormsAuthenticationEventArgs.cs
- EncoderNLS.cs
- XmlSchemaSimpleContent.cs
- X500Name.cs
- PropertyEmitter.cs
- RowsCopiedEventArgs.cs
- EntityCommandCompilationException.cs
- PropertyGridView.cs
- SortKey.cs
- Win32Exception.cs
- infer.cs
- PeerSecurityManager.cs
- AssemblyCache.cs
- NavigatorOutput.cs
- SQLMoneyStorage.cs
- NotFiniteNumberException.cs
- Expressions.cs
- XamlSerializerUtil.cs
- Image.cs
- TypeInformation.cs