Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CommonUI / System / Drawing / Advanced / FontCollection.cs / 1 / FontCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Text { using System.Diagnostics; using System; using System.Drawing; using System.Drawing.Internal; using System.Runtime.InteropServices; using System.ComponentModel; using Microsoft.Win32; ////// /// When inherited, enumerates the FontFamily /// objects in a collection of fonts. /// public abstract class FontCollection : IDisposable { internal IntPtr nativeFontCollection; internal FontCollection() { nativeFontCollection = IntPtr.Zero; } ////// /// Disposes of this public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } ////// protected virtual void Dispose(bool disposing) { // nothing... } /// /// /// public FontFamily[] Families { get { int numSought = 0; int status = SafeNativeMethods.Gdip.GdipGetFontCollectionFamilyCount(new HandleRef(this, nativeFontCollection), out numSought); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); IntPtr[] gpfamilies = new IntPtr[numSought]; int numFound = 0; status = SafeNativeMethods.Gdip.GdipGetFontCollectionFamilyList(new HandleRef(this, nativeFontCollection), numSought, gpfamilies, out numFound); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); Debug.Assert(numSought == numFound, "GDI+ can't give a straight answer about how many fonts there are"); FontFamily[] families = new FontFamily[numFound]; for (int f = 0; f < numFound; f++) { IntPtr native; SafeNativeMethods.Gdip.GdipCloneFontFamily(new HandleRef(null, (IntPtr)gpfamilies[f]), out native); families[f] = new FontFamily(native); } return families; } } /** * Object cleanup */ ////// Gets the array of ////// objects associated with this . /// /// /// ~FontCollection() { Dispose(false); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Allows an object to free resources before the object is /// reclaimed by the Garbage Collector ( ///). /// // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Text { using System.Diagnostics; using System; using System.Drawing; using System.Drawing.Internal; using System.Runtime.InteropServices; using System.ComponentModel; using Microsoft.Win32; ////// /// When inherited, enumerates the FontFamily /// objects in a collection of fonts. /// public abstract class FontCollection : IDisposable { internal IntPtr nativeFontCollection; internal FontCollection() { nativeFontCollection = IntPtr.Zero; } ////// /// Disposes of this public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } ////// protected virtual void Dispose(bool disposing) { // nothing... } /// /// /// public FontFamily[] Families { get { int numSought = 0; int status = SafeNativeMethods.Gdip.GdipGetFontCollectionFamilyCount(new HandleRef(this, nativeFontCollection), out numSought); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); IntPtr[] gpfamilies = new IntPtr[numSought]; int numFound = 0; status = SafeNativeMethods.Gdip.GdipGetFontCollectionFamilyList(new HandleRef(this, nativeFontCollection), numSought, gpfamilies, out numFound); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); Debug.Assert(numSought == numFound, "GDI+ can't give a straight answer about how many fonts there are"); FontFamily[] families = new FontFamily[numFound]; for (int f = 0; f < numFound; f++) { IntPtr native; SafeNativeMethods.Gdip.GdipCloneFontFamily(new HandleRef(null, (IntPtr)gpfamilies[f]), out native); families[f] = new FontFamily(native); } return families; } } /** * Object cleanup */ ////// Gets the array of ////// objects associated with this . /// /// /// ~FontCollection() { Dispose(false); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Allows an object to free resources before the object is /// reclaimed by the Garbage Collector ( ///). ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Frame.cs
- Screen.cs
- MethodAccessException.cs
- XmlSchemaCompilationSettings.cs
- EventWaitHandleSecurity.cs
- ReadOnlyMetadataCollection.cs
- RefreshEventArgs.cs
- HttpListenerRequest.cs
- _TimerThread.cs
- CustomError.cs
- EdmRelationshipRoleAttribute.cs
- OptimisticConcurrencyException.cs
- XmlReturnReader.cs
- SafeArrayTypeMismatchException.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- OutKeywords.cs
- DnsEndPoint.cs
- LineGeometry.cs
- AttributedMetaModel.cs
- FlowchartDesigner.Helpers.cs
- CodeBlockBuilder.cs
- StringComparer.cs
- HttpRuntime.cs
- Double.cs
- ReflectEventDescriptor.cs
- SelectionUIHandler.cs
- XmlnsDictionary.cs
- PolygonHotSpot.cs
- Environment.cs
- HuffModule.cs
- ObjectDataSourceWizardForm.cs
- EdmConstants.cs
- RadioButtonPopupAdapter.cs
- NegotiateStream.cs
- XamlInterfaces.cs
- SocketException.cs
- AlignmentYValidation.cs
- SystemIPv4InterfaceProperties.cs
- DataGridViewTextBoxCell.cs
- PointLightBase.cs
- HttpListenerPrefixCollection.cs
- ResourcePermissionBase.cs
- SQLUtility.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- MenuStrip.cs
- TrackingMemoryStreamFactory.cs
- DependencyObjectProvider.cs
- AsymmetricSignatureDeformatter.cs
- ProjectionRewriter.cs
- OutputCacheProfileCollection.cs
- ToolStripGrip.cs
- AbandonedMutexException.cs
- RemoteTokenFactory.cs
- XmlCharType.cs
- Identity.cs
- FixedPageAutomationPeer.cs
- ChildTable.cs
- PersonalizationEntry.cs
- TabPanel.cs
- RectAnimation.cs
- DataGridViewRowHeaderCell.cs
- ProtocolsSection.cs
- RawStylusSystemGestureInputReport.cs
- DataSourceProvider.cs
- VSWCFServiceContractGenerator.cs
- AppDomainUnloadedException.cs
- TextDocumentView.cs
- OleDbEnumerator.cs
- Operators.cs
- ObjectTokenCategory.cs
- UnaryNode.cs
- controlskin.cs
- FileSecurity.cs
- ObjectToModelValueConverter.cs
- ThrowHelper.cs
- WindowsUpDown.cs
- DateTimeConverter2.cs
- KeyManager.cs
- XmlSchemaAny.cs
- ToolBarDesigner.cs
- SynthesizerStateChangedEventArgs.cs
- HttpModuleAction.cs
- IsolatedStorageFileStream.cs
- CodeMemberProperty.cs
- CriticalHandle.cs
- TargetInvocationException.cs
- WebPartDisplayModeEventArgs.cs
- OrthographicCamera.cs
- GenericAuthenticationEventArgs.cs
- CaseStatement.cs
- ComponentRenameEvent.cs
- FilterQueryOptionExpression.cs
- TextEncodedRawTextWriter.cs
- AsymmetricKeyExchangeFormatter.cs
- Int64.cs
- DynamicDocumentPaginator.cs
- TreeNodeStyleCollection.cs
- XmlSerializer.cs
- CreateUserWizardDesigner.cs
- StateMachineWorkflowDesigner.cs