Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- CompletedAsyncResult.cs
- PresentationAppDomainManager.cs
- DrawingVisualDrawingContext.cs
- WebPartMenuStyle.cs
- SoapRpcMethodAttribute.cs
- NavigationWindow.cs
- DynamicRouteExpression.cs
- CharStorage.cs
- TextBoxBase.cs
- System.Data_BID.cs
- SourceFileBuildProvider.cs
- NetCodeGroup.cs
- ApplyTemplatesAction.cs
- SqlUserDefinedTypeAttribute.cs
- PeerName.cs
- DebugHandleTracker.cs
- LabelExpression.cs
- Configuration.cs
- AvTraceFormat.cs
- DependencyPropertyKey.cs
- RoutedEventValueSerializer.cs
- UndoEngine.cs
- IdentityReference.cs
- CachedPathData.cs
- InternalDispatchObject.cs
- ConfigurationSettings.cs
- RadioButton.cs
- HandlerMappingMemo.cs
- _StreamFramer.cs
- UrlMappingsSection.cs
- Point.cs
- SerializationFieldInfo.cs
- AsyncOperationManager.cs
- SystemWebSectionGroup.cs
- EdmValidator.cs
- SiteMapHierarchicalDataSourceView.cs
- LockedBorderGlyph.cs
- EntityDataSourceDataSelectionPanel.cs
- SessionStateItemCollection.cs
- JoinGraph.cs
- HttpTransportSecurity.cs
- TextRangeProviderWrapper.cs
- PixelFormats.cs
- ApplicationManager.cs
- bidPrivateBase.cs
- GiveFeedbackEventArgs.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- AppAction.cs
- Mutex.cs
- Timer.cs
- WindowsSolidBrush.cs
- XmlWhitespace.cs
- MeshGeometry3D.cs
- TextEditorContextMenu.cs
- TdsRecordBufferSetter.cs
- DataGridViewRowStateChangedEventArgs.cs
- OdbcErrorCollection.cs
- ButtonAutomationPeer.cs
- ItemType.cs
- ReadWriteSpinLock.cs
- ThicknessConverter.cs
- AccessDataSource.cs
- DefaultTextStoreTextComposition.cs
- MultipartContentParser.cs
- EntityContainerEmitter.cs
- WhitespaceReader.cs
- WinEventHandler.cs
- IdnElement.cs
- PartialList.cs
- TextEditor.cs
- JournalEntryListConverter.cs
- _AutoWebProxyScriptHelper.cs
- IdnElement.cs
- CompiledRegexRunner.cs
- ReachPageContentCollectionSerializer.cs
- PlainXmlWriter.cs
- WebConfigurationManager.cs
- OdbcFactory.cs
- FirstMatchCodeGroup.cs
- SqlTransaction.cs
- WindowsAuthenticationModule.cs
- SystemNetHelpers.cs
- MultipleViewPattern.cs
- DisposableCollectionWrapper.cs
- MemberPath.cs
- FreezableDefaultValueFactory.cs
- ListViewSortEventArgs.cs
- ObjectViewFactory.cs
- DateTimeFormatInfo.cs
- MediaSystem.cs
- CodeSnippetExpression.cs
- MemberHolder.cs
- TableCellCollection.cs
- ControlCollection.cs
- FileSystemEventArgs.cs
- MsdtcClusterUtils.cs
- DmlSqlGenerator.cs
- WsatRegistrationHeader.cs
- SqlFormatter.cs
- PresentationAppDomainManager.cs