Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Advanced / FontCollection.cs / 1305376 / 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; using System.Runtime.Versioning; ////// /// 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 { [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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; using System.Runtime.Versioning; ////// /// 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 { [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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
- CookielessData.cs
- ResourcesChangeInfo.cs
- DoWorkEventArgs.cs
- DocumentSequence.cs
- MenuItemBindingCollection.cs
- CodeCompiler.cs
- FileLoadException.cs
- LinkDesigner.cs
- ActionFrame.cs
- BinaryMethodMessage.cs
- PolyBezierSegmentFigureLogic.cs
- ConditionalWeakTable.cs
- _RequestLifetimeSetter.cs
- XmlSchemaRedefine.cs
- SourceElementsCollection.cs
- RoutedCommand.cs
- GenericIdentity.cs
- InvalidCastException.cs
- SafeRegistryHandle.cs
- TokenizerHelper.cs
- Overlapped.cs
- DataGridViewCellStyle.cs
- FixedDocument.cs
- OdbcConnectionHandle.cs
- DynamicResourceExtensionConverter.cs
- MachineKeyConverter.cs
- Matrix.cs
- UpdatePanelTriggerCollection.cs
- BitmapEffectState.cs
- FacetDescription.cs
- Int32Collection.cs
- DataSourceSelectArguments.cs
- NamespaceQuery.cs
- CodeTypeReferenceSerializer.cs
- ObjectStateManagerMetadata.cs
- DataShape.cs
- DetailsViewPagerRow.cs
- IntSecurity.cs
- SettingsPropertyValueCollection.cs
- HandledEventArgs.cs
- VisualBasicImportReference.cs
- DetailsViewInsertEventArgs.cs
- FontStretch.cs
- CustomAssemblyResolver.cs
- ClientBuildManager.cs
- ContextProperty.cs
- LoadedOrUnloadedOperation.cs
- PolyLineSegmentFigureLogic.cs
- VirtualDirectoryMapping.cs
- ArrayList.cs
- RegionIterator.cs
- PageStatePersister.cs
- BigInt.cs
- MenuTracker.cs
- ServiceRouteHandler.cs
- FieldDescriptor.cs
- PropertyGridEditorPart.cs
- MembershipValidatePasswordEventArgs.cs
- OleDbCommandBuilder.cs
- SHA512Cng.cs
- SoapReflectionImporter.cs
- Variant.cs
- FilterableAttribute.cs
- HtmlMeta.cs
- XmlUnspecifiedAttribute.cs
- ReflectTypeDescriptionProvider.cs
- ExpressionVisitor.cs
- EvidenceBase.cs
- NGCSerializer.cs
- HttpDictionary.cs
- PeerDuplexChannel.cs
- SqlWebEventProvider.cs
- LambdaCompiler.Binary.cs
- CodeAttributeArgument.cs
- ManipulationDevice.cs
- CodeEntryPointMethod.cs
- SearchForVirtualItemEventArgs.cs
- relpropertyhelper.cs
- MemberProjectionIndex.cs
- TimeEnumHelper.cs
- UnsafeNativeMethods.cs
- ActivitySurrogate.cs
- UInt32.cs
- SQLRoleProvider.cs
- WindowAutomationPeer.cs
- ComponentEvent.cs
- RegexFCD.cs
- DependencyStoreSurrogate.cs
- TabControlAutomationPeer.cs
- LinkLabelLinkClickedEvent.cs
- InvalidOleVariantTypeException.cs
- LiteralLink.cs
- MemoryPressure.cs
- PropertyMetadata.cs
- Int32Storage.cs
- SqlBuffer.cs
- X509CertificateStore.cs
- NumberFunctions.cs
- ResourceSet.cs
- BufferAllocator.cs