Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Media / DrawingContext.cs / 1 / DrawingContext.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2003 // // File: DrawingContext.cs // // History: // GSchneid: 04/19/2003 // Created it based on the RetainedDrawingContext used in the AvPhat branch. // adsmith: 07/02/2003 // Turned this class into an abstract base class for RetainedDrawingContext // and PaintingDrawingContext. // //----------------------------------------------------------------------------- using System; using System.Security.Permissions; using System.Windows; using System.Windows.Threading; using System.Windows.Media.Animation; using System.Windows.Media; using System.Diagnostics; using MS.Internal; using System.Runtime.InteropServices; using MS.Utility; namespace System.Windows.Media { ////// Drawing context. /// public abstract partial class DrawingContext : DispatcherObject, IDisposable { #region Constructors ////// Default constructor for DrawingContext - this uses the current Dispatcher. /// internal DrawingContext() { // Nothing to do here } #endregion Constructors #region Public Methods ////// Draw Text at the location specified. /// /// The FormattedText to draw. /// The location at which to draw the text. ////// This call is illegal if this object has already been closed or disposed. /// public void DrawText(FormattedText formattedText, Point origin) { if (EventTrace.IsEnabled(EventTrace.Flags.performance, EventTrace.Level.verbose)) { EventTrace.EventProvider.TraceEvent(EventTrace.GuidFromId(EventTraceGuidId.GENERICSTRINGGUID), EventType.StartEvent, "DrawingContext.DrawText Start"); } VerifyApiNonstructuralChange(); #if DEBUG MediaTrace.DrawingContextOp.Trace("DrawText(const)"); #endif if (formattedText == null) { return; } formattedText.Draw(this, origin); if (EventTrace.IsEnabled(EventTrace.Flags.performance, EventTrace.Level.verbose)) { EventTrace.EventProvider.TraceEvent(EventTrace.GuidFromId(EventTraceGuidId.GENERICSTRINGGUID), EventType.EndEvent, "DrawingContext.DrawText End"); } } ////// Closes the DrawingContext and flushes the content. /// Afterwards the DrawingContext can not be used anymore. /// This call does not require all Push calls to have been Popped. /// ////// This call is illegal if this object has already been closed or disposed. /// public abstract void Close(); ////// This is the same as the Close call: /// Closes the DrawingContext and flushes the content. /// Afterwards the DrawingContext can not be used anymore. /// This call does not require all Push calls to have been Popped. /// ////// This call is illegal if this object has already been closed or disposed. /// void IDisposable.Dispose() { // Call a virtual method for derived Dispose implementations // // Attempting to override a explicit interface member implementation causes // the most-derived implementation to always be called, and the base // implementation becomes uncallable. But FxCop requires the base Dispose // method is always be called. To avoid this situation, we use the *Core // pattern for derived classes, instead of attempting to override // IDisposable.Dispose. VerifyAccess(); DisposeCore(); } #endregion Public Methods #region Protected Methods ////// Dispose functionality implemented by subclasses /// ////// This call is illegal if this object has already been closed or disposed. /// protected abstract void DisposeCore(); ////// This verifies that the API can be called for read only access. /// protected virtual void VerifyApiNonstructuralChange() { this.VerifyAccess(); } #endregion Protected Methods } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2003 // // File: DrawingContext.cs // // History: // GSchneid: 04/19/2003 // Created it based on the RetainedDrawingContext used in the AvPhat branch. // adsmith: 07/02/2003 // Turned this class into an abstract base class for RetainedDrawingContext // and PaintingDrawingContext. // //----------------------------------------------------------------------------- using System; using System.Security.Permissions; using System.Windows; using System.Windows.Threading; using System.Windows.Media.Animation; using System.Windows.Media; using System.Diagnostics; using MS.Internal; using System.Runtime.InteropServices; using MS.Utility; namespace System.Windows.Media { ////// Drawing context. /// public abstract partial class DrawingContext : DispatcherObject, IDisposable { #region Constructors ////// Default constructor for DrawingContext - this uses the current Dispatcher. /// internal DrawingContext() { // Nothing to do here } #endregion Constructors #region Public Methods ////// Draw Text at the location specified. /// /// The FormattedText to draw. /// The location at which to draw the text. ////// This call is illegal if this object has already been closed or disposed. /// public void DrawText(FormattedText formattedText, Point origin) { if (EventTrace.IsEnabled(EventTrace.Flags.performance, EventTrace.Level.verbose)) { EventTrace.EventProvider.TraceEvent(EventTrace.GuidFromId(EventTraceGuidId.GENERICSTRINGGUID), EventType.StartEvent, "DrawingContext.DrawText Start"); } VerifyApiNonstructuralChange(); #if DEBUG MediaTrace.DrawingContextOp.Trace("DrawText(const)"); #endif if (formattedText == null) { return; } formattedText.Draw(this, origin); if (EventTrace.IsEnabled(EventTrace.Flags.performance, EventTrace.Level.verbose)) { EventTrace.EventProvider.TraceEvent(EventTrace.GuidFromId(EventTraceGuidId.GENERICSTRINGGUID), EventType.EndEvent, "DrawingContext.DrawText End"); } } ////// Closes the DrawingContext and flushes the content. /// Afterwards the DrawingContext can not be used anymore. /// This call does not require all Push calls to have been Popped. /// ////// This call is illegal if this object has already been closed or disposed. /// public abstract void Close(); ////// This is the same as the Close call: /// Closes the DrawingContext and flushes the content. /// Afterwards the DrawingContext can not be used anymore. /// This call does not require all Push calls to have been Popped. /// ////// This call is illegal if this object has already been closed or disposed. /// void IDisposable.Dispose() { // Call a virtual method for derived Dispose implementations // // Attempting to override a explicit interface member implementation causes // the most-derived implementation to always be called, and the base // implementation becomes uncallable. But FxCop requires the base Dispose // method is always be called. To avoid this situation, we use the *Core // pattern for derived classes, instead of attempting to override // IDisposable.Dispose. VerifyAccess(); DisposeCore(); } #endregion Public Methods #region Protected Methods ////// Dispose functionality implemented by subclasses /// ////// This call is illegal if this object has already been closed or disposed. /// protected abstract void DisposeCore(); ////// This verifies that the API can be called for read only access. /// protected virtual void VerifyApiNonstructuralChange() { this.VerifyAccess(); } #endregion Protected Methods } } // 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
- ChangeConflicts.cs
- Model3DGroup.cs
- DateTimeValueSerializerContext.cs
- ImageListUtils.cs
- CodeBlockBuilder.cs
- Int32RectValueSerializer.cs
- EnumMember.cs
- CacheMode.cs
- StrongNameMembershipCondition.cs
- FrameworkContentElement.cs
- ThreadPool.cs
- Win32KeyboardDevice.cs
- OpCodes.cs
- UrlAuthFailedErrorFormatter.cs
- XDeferredAxisSource.cs
- HatchBrush.cs
- ProgressBarRenderer.cs
- FramingChannels.cs
- LexicalChunk.cs
- PageContentCollection.cs
- _StreamFramer.cs
- RowCache.cs
- DataGridTextBoxColumn.cs
- OdbcCommandBuilder.cs
- ContractNamespaceAttribute.cs
- ViewgenContext.cs
- EnumValidator.cs
- GridViewUpdatedEventArgs.cs
- Rect3DConverter.cs
- MouseCaptureWithinProperty.cs
- RootDesignerSerializerAttribute.cs
- SurrogateSelector.cs
- InplaceBitmapMetadataWriter.cs
- PointHitTestParameters.cs
- FontStyle.cs
- XmlElementElement.cs
- ScrollItemPattern.cs
- RequestCacheEntry.cs
- MergeFailedEvent.cs
- ColorMatrix.cs
- ModelItemDictionary.cs
- StorageBasedPackageProperties.cs
- ToolBarButtonClickEvent.cs
- HtmlTableCell.cs
- HitTestParameters3D.cs
- QilXmlWriter.cs
- SoapFaultCodes.cs
- Serializer.cs
- sapiproxy.cs
- Hash.cs
- PauseStoryboard.cs
- DBCSCodePageEncoding.cs
- LoginView.cs
- PrinterSettings.cs
- SqlNotificationRequest.cs
- XmlDataSource.cs
- _CommandStream.cs
- BinaryWriter.cs
- BaseEntityWrapper.cs
- Random.cs
- UnhandledExceptionEventArgs.cs
- ListView.cs
- ContentPlaceHolder.cs
- KeyValueConfigurationElement.cs
- DrawingGroup.cs
- Unit.cs
- AppDomainAttributes.cs
- SessionSwitchEventArgs.cs
- UdpRetransmissionSettings.cs
- ShutDownListener.cs
- MergeEnumerator.cs
- HelloOperationCD1AsyncResult.cs
- path.cs
- NotCondition.cs
- Part.cs
- ColumnCollection.cs
- RowType.cs
- ElementHost.cs
- HybridWebProxyFinder.cs
- MessagePartProtectionMode.cs
- ToolStripSettings.cs
- WindowsScroll.cs
- CheckoutException.cs
- HotSpotCollectionEditor.cs
- BufferCache.cs
- ColumnTypeConverter.cs
- WaitHandleCannotBeOpenedException.cs
- TraceXPathNavigator.cs
- Sentence.cs
- GridViewColumnHeader.cs
- QuadraticBezierSegment.cs
- Label.cs
- ToolStripPanelRenderEventArgs.cs
- SspiNegotiationTokenProvider.cs
- GridViewCancelEditEventArgs.cs
- ToolStripScrollButton.cs
- DragDrop.cs
- SHA1.cs
- XMLSchema.cs
- Transactions.cs