Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CommonUI / System / Drawing / Advanced / FontCollection.cs / 2 / 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
- FilteredDataSetHelper.cs
- ToolStripDropDownClosedEventArgs.cs
- AuthStoreRoleProvider.cs
- AssemblyGen.cs
- TemplateControlBuildProvider.cs
- OdbcPermission.cs
- Track.cs
- ContextBase.cs
- SynchronizationLockException.cs
- NavigationProperty.cs
- RowBinding.cs
- TiffBitmapEncoder.cs
- Pkcs7Recipient.cs
- XmlExtensionFunction.cs
- StreamResourceInfo.cs
- DataGridViewCellPaintingEventArgs.cs
- embossbitmapeffect.cs
- ValidatorUtils.cs
- TextWriterEngine.cs
- LogEntrySerializationException.cs
- DBNull.cs
- DataMember.cs
- WebConfigurationManager.cs
- BookmarkList.cs
- InheritedPropertyChangedEventArgs.cs
- BuildDependencySet.cs
- WindowsSolidBrush.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- ValueProviderWrapper.cs
- SqlBulkCopyColumnMapping.cs
- CroppedBitmap.cs
- EncodingTable.cs
- Int64KeyFrameCollection.cs
- BatchServiceHost.cs
- ISAPIApplicationHost.cs
- VarInfo.cs
- WebServiceResponse.cs
- AssemblyBuilder.cs
- ECDiffieHellmanCng.cs
- WinCategoryAttribute.cs
- ItemsControlAutomationPeer.cs
- FileDialog_Vista_Interop.cs
- DrawingBrush.cs
- Camera.cs
- ProfileManager.cs
- COM2ComponentEditor.cs
- ToolStripItemRenderEventArgs.cs
- StatusBarAutomationPeer.cs
- ControllableStoryboardAction.cs
- GotoExpression.cs
- GenericParameterDataContract.cs
- FieldAccessException.cs
- PeerNameRegistration.cs
- DbConnectionStringCommon.cs
- DateTimeStorage.cs
- AuthorizationRuleCollection.cs
- MembershipSection.cs
- PersonalizationStateQuery.cs
- WmpBitmapDecoder.cs
- shaper.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- AsyncResult.cs
- SqlDataSource.cs
- MasterPageCodeDomTreeGenerator.cs
- ReflectTypeDescriptionProvider.cs
- DoubleIndependentAnimationStorage.cs
- PartBasedPackageProperties.cs
- BitmapPalettes.cs
- BaseCollection.cs
- RadioButtonPopupAdapter.cs
- RowVisual.cs
- TypeElementCollection.cs
- GridViewDeletedEventArgs.cs
- TypefaceMetricsCache.cs
- EventLogInternal.cs
- IPAddressCollection.cs
- KeyBinding.cs
- SrgsNameValueTag.cs
- TypeDelegator.cs
- MaskedTextBoxDesignerActionList.cs
- XmlCollation.cs
- FileNotFoundException.cs
- DbDataRecord.cs
- SizeFConverter.cs
- QilInvoke.cs
- ProfileModule.cs
- ResXDataNode.cs
- ConsumerConnectionPoint.cs
- SizeLimitedCache.cs
- UriParserTemplates.cs
- BidOverLoads.cs
- XmlTypeAttribute.cs
- EditorBrowsableAttribute.cs
- PartialCachingAttribute.cs
- WebBaseEventKeyComparer.cs
- MetadataCollection.cs
- ObjectNavigationPropertyMapping.cs
- GridViewColumnHeader.cs
- MatrixAnimationUsingKeyFrames.cs
- xdrvalidator.cs