Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / WebParts / DesignerWebPartChrome.cs / 1 / DesignerWebPartChrome.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design.WebControls.WebParts { using System.Design; using System.Globalization; using System.IO; using System.Web.UI; using System.Web.UI.Design; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; ////// [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)] internal class DesignerWebPartChrome : WebPartChrome { private ViewRendering _partViewRendering; public DesignerWebPartChrome(WebPartZoneBase zone) : base(zone, null) { } public ViewRendering GetViewRendering(Control control) { string designTimeHtml; DesignerRegionCollection regions; try { _partViewRendering = ControlDesigner.GetViewRendering(control); regions = _partViewRendering.Regions; WebPart webPart = control as WebPart; if (webPart == null) { // We should not reparent the control, so we must use the DesignerGenericWebPart instead // of the regular GenericWebPart. // Pass in the ViewControl instead of the Control, so that design-time themes are // reflected in the Chrome rendering webPart = new DesignerGenericWebPart(PartDesigner.GetViewControl(control)); } StringWriter innerWriter = new StringWriter(CultureInfo.InvariantCulture); // Pass in the ViewControl instead of the WebPart, so that design-time themes are // reflected in the Chrome rendering RenderWebPart(new DesignTimeHtmlTextWriter(innerWriter), (WebPart)PartDesigner.GetViewControl(webPart)); designTimeHtml = innerWriter.ToString(); } catch (Exception e) { designTimeHtml = ControlDesigner.CreateErrorDesignTimeHtml( SR.GetString(SR.ControlDesigner_UnhandledException), e, control); regions = new DesignerRegionCollection(); } StringWriter writer = new StringWriter(CultureInfo.InvariantCulture); DesignTimeHtmlTextWriter htmlTextWriter = new DesignTimeHtmlTextWriter(writer); bool horizontal = (Zone.LayoutOrientation == Orientation.Horizontal); if (horizontal) { htmlTextWriter.AddStyleAttribute("display", "inline-block"); htmlTextWriter.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%"); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Span); } htmlTextWriter.Write(designTimeHtml); if (horizontal) { htmlTextWriter.RenderEndTag(); } return new ViewRendering(writer.ToString(), regions); } protected override void RenderPartContents(HtmlTextWriter writer, WebPart webPart) { writer.Write(_partViewRendering.Content); } } } // 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
- ThemeDictionaryExtension.cs
- EntityExpressionVisitor.cs
- SrgsItemList.cs
- RightsManagementUser.cs
- TextServicesPropertyRanges.cs
- iisPickupDirectory.cs
- BuildManagerHost.cs
- DataSourceView.cs
- Crypto.cs
- SafeNativeMethods.cs
- AssemblyResourceLoader.cs
- WindowsEditBoxRange.cs
- HandlerElement.cs
- CodeValidator.cs
- LambdaCompiler.Expressions.cs
- HtmlShim.cs
- TextServicesCompartmentContext.cs
- fixedPageContentExtractor.cs
- TextComposition.cs
- DispatcherProcessingDisabled.cs
- PolicyManager.cs
- Subtree.cs
- SerialStream.cs
- WindowsListViewItemCheckBox.cs
- WindowsAltTab.cs
- GraphicsPath.cs
- Registration.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- PanelContainerDesigner.cs
- HtmlFormWrapper.cs
- RbTree.cs
- CompareInfo.cs
- TableCell.cs
- ImageClickEventArgs.cs
- TypeUnloadedException.cs
- AesManaged.cs
- SystemWebSectionGroup.cs
- WindowsRegion.cs
- PageBuildProvider.cs
- ResourceDescriptionAttribute.cs
- UrlUtility.cs
- Switch.cs
- TokenBasedSetEnumerator.cs
- WindowsRichEdit.cs
- RegexCompilationInfo.cs
- ProfileBuildProvider.cs
- SecurityState.cs
- DeleteMemberBinder.cs
- FrameworkContentElement.cs
- OleDbWrapper.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- ManagementObject.cs
- CompletedAsyncResult.cs
- InvalidWMPVersionException.cs
- PerformanceCounterPermissionAttribute.cs
- SafeHandles.cs
- BlobPersonalizationState.cs
- HostExecutionContextManager.cs
- OutputBuffer.cs
- ResourceManagerWrapper.cs
- SwitchCase.cs
- InputLangChangeEvent.cs
- WindowInteractionStateTracker.cs
- WebFormDesignerActionService.cs
- RegistryConfigurationProvider.cs
- TrackingProfile.cs
- FileReservationCollection.cs
- EncoderNLS.cs
- XmlNullResolver.cs
- SqlDataSourceStatusEventArgs.cs
- XmlSchema.cs
- DataTableTypeConverter.cs
- HttpCookieCollection.cs
- ExpressionLexer.cs
- ApplicationInfo.cs
- TemplateControl.cs
- TextCollapsingProperties.cs
- RepeatButtonAutomationPeer.cs
- DataSourceCacheDurationConverter.cs
- MarkupProperty.cs
- UserControlParser.cs
- UInt16Storage.cs
- Item.cs
- BaseTemplateParser.cs
- NonParentingControl.cs
- CodeSubDirectory.cs
- InstanceKeyView.cs
- UnsafeNativeMethods.cs
- Single.cs
- ScriptingProfileServiceSection.cs
- EventSetter.cs
- errorpatternmatcher.cs
- GenericRootAutomationPeer.cs
- TraceData.cs
- RestHandlerFactory.cs
- ColumnBinding.cs
- FieldNameLookup.cs
- Translator.cs
- StylusButton.cs
- TransformValueSerializer.cs