Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / DrawingContext.cs / 1305600 / DrawingContext.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2003 // // File: DrawingContext.cs // // History: // [....]: 04/19/2003 // Created it based on the RetainedDrawingContext used in the AvPhat branch. // [....]: 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) { EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Verbose, EventTrace.Event.WClientStringBegin, "DrawingContext.DrawText Start"); VerifyApiNonstructuralChange(); #if DEBUG MediaTrace.DrawingContextOp.Trace("DrawText(const)"); #endif if (formattedText == null) { return; } formattedText.Draw(this, origin); EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Verbose, EventTrace.Event.WClientStringEnd, "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(); GC.SuppressFinalize(this); } #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: // [....]: 04/19/2003 // Created it based on the RetainedDrawingContext used in the AvPhat branch. // [....]: 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) { EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Verbose, EventTrace.Event.WClientStringBegin, "DrawingContext.DrawText Start"); VerifyApiNonstructuralChange(); #if DEBUG MediaTrace.DrawingContextOp.Trace("DrawText(const)"); #endif if (formattedText == null) { return; } formattedText.Draw(this, origin); EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordGeneral, EventTrace.Level.Verbose, EventTrace.Event.WClientStringEnd, "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(); GC.SuppressFinalize(this); } #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
- PointHitTestResult.cs
- BigInt.cs
- DeclarativeCatalogPart.cs
- SQLMoney.cs
- DbSourceCommand.cs
- DependencyPropertyDescriptor.cs
- CardSpaceSelector.cs
- CompiledAction.cs
- DoubleAnimationUsingPath.cs
- QueryableFilterUserControl.cs
- ZipIOCentralDirectoryBlock.cs
- FunctionImportElement.cs
- IdentityManager.cs
- WorkflowRuntimeServicesBehavior.cs
- httpstaticobjectscollection.cs
- TreeNode.cs
- ProcessHost.cs
- DataGridViewComboBoxEditingControl.cs
- ClaimTypeRequirement.cs
- TempFiles.cs
- DetailsViewUpdatedEventArgs.cs
- DragStartedEventArgs.cs
- UrlPath.cs
- XmlSchemaAttribute.cs
- XPathNodeHelper.cs
- RSACryptoServiceProvider.cs
- SystemMulticastIPAddressInformation.cs
- ProcessStartInfo.cs
- Console.cs
- Pair.cs
- ImageButton.cs
- UnsafeNativeMethods.cs
- DocumentXPathNavigator.cs
- DataServiceContext.cs
- HttpCookieCollection.cs
- DataBindingCollection.cs
- ColumnResult.cs
- DataGridViewCellMouseEventArgs.cs
- Transactions.cs
- CodeDomComponentSerializationService.cs
- DockPanel.cs
- IIS7UserPrincipal.cs
- DesignRelation.cs
- DynamicFilter.cs
- CodeParameterDeclarationExpressionCollection.cs
- SingleObjectCollection.cs
- ApplicationServiceHelper.cs
- DataGridViewComboBoxCell.cs
- xmlfixedPageInfo.cs
- TextTrailingCharacterEllipsis.cs
- Parameter.cs
- WebPartEventArgs.cs
- Queue.cs
- ExpressionWriter.cs
- OdbcInfoMessageEvent.cs
- SchemaCollectionCompiler.cs
- PassportPrincipal.cs
- RecordBuilder.cs
- Context.cs
- WebPartEventArgs.cs
- securitycriticaldataformultiplegetandset.cs
- StackOverflowException.cs
- XomlCompilerHelpers.cs
- BitmapMetadataBlob.cs
- CompilerTypeWithParams.cs
- ScopedKnownTypes.cs
- Win32KeyboardDevice.cs
- SecurityKeyType.cs
- FileFormatException.cs
- VirtualizingStackPanel.cs
- PngBitmapEncoder.cs
- ThousandthOfEmRealPoints.cs
- Bits.cs
- InProcStateClientManager.cs
- SchemaTypeEmitter.cs
- RecordConverter.cs
- IPAddressCollection.cs
- ScriptControl.cs
- OleDbStruct.cs
- ArgumentNullException.cs
- HttpGetProtocolImporter.cs
- TCEAdapterGenerator.cs
- ProgressBarRenderer.cs
- BuildProvider.cs
- PerformanceCountersElement.cs
- DynamicRenderer.cs
- MouseGestureValueSerializer.cs
- Solver.cs
- HttpResponseWrapper.cs
- FlagsAttribute.cs
- Accessors.cs
- UiaCoreProviderApi.cs
- SocketAddress.cs
- SqlDataSourceConfigureFilterForm.cs
- ClusterSafeNativeMethods.cs
- BinaryParser.cs
- DataSourceGeneratorException.cs
- DataGridViewColumnHeaderCell.cs
- ProvidersHelper.cs
- TextLineResult.cs