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
- UdpSocketReceiveManager.cs
- KnownBoxes.cs
- XmlLanguageConverter.cs
- Byte.cs
- Section.cs
- SspiHelper.cs
- Container.cs
- TextBounds.cs
- SetIterators.cs
- TableCell.cs
- TextChange.cs
- PermissionListSet.cs
- TypeTypeConverter.cs
- InkPresenterAutomationPeer.cs
- PrintControllerWithStatusDialog.cs
- DataColumnCollection.cs
- httpstaticobjectscollection.cs
- DetailsViewUpdatedEventArgs.cs
- StringHelper.cs
- Vector3DCollectionValueSerializer.cs
- EntityContainerEntitySet.cs
- _UriSyntax.cs
- ImageResources.Designer.cs
- AjaxFrameworkAssemblyAttribute.cs
- RoleManagerSection.cs
- ExtensionSimplifierMarkupObject.cs
- DataMemberFieldConverter.cs
- ParseChildrenAsPropertiesAttribute.cs
- ObjectDataSource.cs
- RSAOAEPKeyExchangeFormatter.cs
- DataGridCommandEventArgs.cs
- xmlfixedPageInfo.cs
- ObjectListTitleAttribute.cs
- EventWaitHandleSecurity.cs
- WindowsImpersonationContext.cs
- CodeExporter.cs
- WebPartsPersonalization.cs
- Convert.cs
- ExpressionLexer.cs
- ExpressionReplacer.cs
- DataObjectSettingDataEventArgs.cs
- RoutedEvent.cs
- PathFigureCollectionValueSerializer.cs
- PersonalizationStateQuery.cs
- ColorComboBox.cs
- FlowPosition.cs
- SigningDialog.cs
- PersonalizationStateInfo.cs
- DataErrorValidationRule.cs
- InternalUserCancelledException.cs
- KerberosTokenFactoryCredential.cs
- WebConfigurationFileMap.cs
- HandlerMappingMemo.cs
- ElementAtQueryOperator.cs
- MimeTypeMapper.cs
- HttpChannelHelper.cs
- ToggleProviderWrapper.cs
- HttpCookieCollection.cs
- TrustVersion.cs
- NonParentingControl.cs
- PrintPreviewControl.cs
- ConfigurationSchemaErrors.cs
- DefaultValueConverter.cs
- ImageListUtils.cs
- BehaviorEditorPart.cs
- StorageInfo.cs
- CachedFontFace.cs
- InvalidDataContractException.cs
- RegexBoyerMoore.cs
- CompilerGeneratedAttribute.cs
- CompositeScriptReferenceEventArgs.cs
- TypeDescriptor.cs
- Variant.cs
- DataTemplate.cs
- AddressingVersion.cs
- EncodingInfo.cs
- TextContainerChangedEventArgs.cs
- Literal.cs
- TextEffect.cs
- HorizontalAlignConverter.cs
- GlobalProxySelection.cs
- CodeTypeParameterCollection.cs
- HtmlContainerControl.cs
- FilteredAttributeCollection.cs
- ExecutionEngineException.cs
- InfoCardConstants.cs
- IOException.cs
- SessionKeyExpiredException.cs
- Axis.cs
- DeclarativeCatalogPart.cs
- LicenseManager.cs
- OleServicesContext.cs
- OpenTypeLayoutCache.cs
- SqlTypeConverter.cs
- XmlUrlResolver.cs
- SwitchDesigner.xaml.cs
- WebPartCollection.cs
- ItemAutomationPeer.cs
- MemberJoinTreeNode.cs
- ZipIOCentralDirectoryBlock.cs