Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / ComponentModel / COM2Interop / COM2IProvidePropertyBuilderHandler.cs / 1305376 / COM2IProvidePropertyBuilderHandler.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.ComponentModel.Com2Interop { using System.ComponentModel; using System.Diagnostics; using System; using System.Collections; using Microsoft.Win32; using System.Drawing.Design; [System.Security.SuppressUnmanagedCodeSecurityAttribute()] internal class Com2IProvidePropertyBuilderHandler : Com2ExtendedBrowsingHandler { public override Type Interface { get { return typeof(NativeMethods.IProvidePropertyBuilder); } } private bool GetBuilderGuidString(NativeMethods.IProvidePropertyBuilder target, int dispid, ref string strGuidBldr, int[] bldrType) { bool valid = false; string[] pGuidBldr = new string[1]; if (NativeMethods.Failed(target.MapPropertyToBuilder(dispid, bldrType, pGuidBldr, ref valid))) { valid = false; } if (valid && (bldrType[0] & _CTLBLDTYPE.CTLBLDTYPE_FINTERNALBUILDER) == 0) { valid = false; Debug.Fail("Property Browser doesn't support standard builders -- NYI"); } if (!valid) { return false; } if (pGuidBldr[0] == null) { strGuidBldr = Guid.Empty.ToString(); } else { strGuidBldr = pGuidBldr[0]; } return true; } public override void SetupPropertyHandlers(Com2PropertyDescriptor[] propDesc) { if (propDesc == null) { return; } for (int i = 0; i < propDesc.Length; i++) { propDesc[i].QueryGetBaseAttributes += new GetAttributesEventHandler(this.OnGetBaseAttributes); propDesc[i].QueryGetTypeConverterAndTypeEditor += new GetTypeConverterAndTypeEditorEventHandler(this.OnGetTypeConverterAndTypeEditor); } } ////// /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo and IVsPerPropertyBrowsing. HideProperty /// such as IPerPropertyBrowsing, IProvidePropertyBuilder, etc. /// private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent) { NativeMethods.IProvidePropertyBuilder target = sender.TargetObject as NativeMethods.IProvidePropertyBuilder; if (target != null ) { string s = null; bool builderValid = GetBuilderGuidString(target, sender.DISPID, ref s, new int[1]); // we hide IDispatch props by default, we we need to force showing them here if (sender.CanShow && builderValid) { if (typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType)) { attrEvent.Add(BrowsableAttribute.Yes); } } } } private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { object target = sender.TargetObject; if (target is NativeMethods.IProvidePropertyBuilder) { NativeMethods.IProvidePropertyBuilder propBuilder = (NativeMethods.IProvidePropertyBuilder)target; int[] pctlBldType = new int[1]; string guidString = null; if (GetBuilderGuidString(propBuilder, sender.DISPID, ref guidString, pctlBldType)) { gveevent.TypeEditor = new Com2PropertyBuilderUITypeEditor(sender, guidString, pctlBldType[0], (UITypeEditor)gveevent.TypeEditor); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GetKeyedHashRequest.cs
- externdll.cs
- TagMapCollection.cs
- NetStream.cs
- ControlValuePropertyAttribute.cs
- ParallelForEach.cs
- CompleteWizardStep.cs
- MobileCategoryAttribute.cs
- ProfileSection.cs
- ToolStripArrowRenderEventArgs.cs
- TargetException.cs
- ProfileModule.cs
- ZipIOCentralDirectoryBlock.cs
- MsmqOutputChannel.cs
- RequestUriProcessor.cs
- ObjectMemberMapping.cs
- Menu.cs
- externdll.cs
- DataGridViewComboBoxEditingControl.cs
- formatter.cs
- ViewCellRelation.cs
- StylusDevice.cs
- FolderBrowserDialog.cs
- MgmtConfigurationRecord.cs
- DependencyPropertyChangedEventArgs.cs
- MultipleViewProviderWrapper.cs
- FocusWithinProperty.cs
- ObjectViewFactory.cs
- TaskExtensions.cs
- Quad.cs
- DictionaryMarkupSerializer.cs
- ZoneButton.cs
- StylusPointProperty.cs
- PasswordTextNavigator.cs
- WindowsBrush.cs
- RegistrySecurity.cs
- HttpDictionary.cs
- safelink.cs
- CompositeDataBoundControl.cs
- SqlServer2KCompatibilityCheck.cs
- WebConfigurationManager.cs
- BinaryObjectReader.cs
- RawStylusSystemGestureInputReport.cs
- MtomMessageEncodingElement.cs
- FamilyMap.cs
- SqlClientMetaDataCollectionNames.cs
- TextCharacters.cs
- SelectorAutomationPeer.cs
- FontFamilyValueSerializer.cs
- InheritanceContextHelper.cs
- Rijndael.cs
- ScrollProperties.cs
- KeyboardDevice.cs
- AttachedPropertiesService.cs
- WorkflowPrinting.cs
- WizardPanel.cs
- Item.cs
- Underline.cs
- SystemInformation.cs
- HandlerBase.cs
- TemplateControlCodeDomTreeGenerator.cs
- DesignerTransaction.cs
- AcceleratedTokenProvider.cs
- TextElement.cs
- RuleRefElement.cs
- XamlUtilities.cs
- HttpListenerContext.cs
- IdentityHolder.cs
- ColorConvertedBitmap.cs
- CodeCastExpression.cs
- EndEvent.cs
- StoryFragments.cs
- WebZone.cs
- ExpressionBinding.cs
- FormatConvertedBitmap.cs
- RegistrySecurity.cs
- XmlElementAttributes.cs
- SimpleNameService.cs
- SQLBinary.cs
- RewritingPass.cs
- WebConfigurationHost.cs
- ToolStripDropDownItem.cs
- LocalBuilder.cs
- QueryOutputWriter.cs
- Trace.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- ComponentResourceKey.cs
- PageAsyncTaskManager.cs
- CacheOutputQuery.cs
- TextSyndicationContentKindHelper.cs
- xsdvalidator.cs
- AddInDeploymentState.cs
- TrustLevel.cs
- ClassHandlersStore.cs
- Publisher.cs
- SuppressMergeCheckAttribute.cs
- TextSelectionHelper.cs
- InteropAutomationProvider.cs
- DataRowView.cs
- OleDbReferenceCollection.cs