Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CommonUI / System / Drawing / Advanced / FontCollection.cs / 1 / FontCollection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*************************************************************************\
*
* Copyright (c) 1998-1999, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* font.cs
*
* Abstract:
*
* COM+ wrapper for GDI+ font objects
*
* Revision History:
*
* 3/16/2000 [...]
* Created it.
*
\**************************************************************************/
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...
}
///
///
///
/// Gets the array of
/// objects associated with this .
///
///
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
*/
///
///
///
/// Allows an object to free resources before the object is
/// reclaimed by the Garbage Collector ( ).
///
///
~FontCollection() {
Dispose(false);
}
}
}
// 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
- smtpconnection.cs
- ThousandthOfEmRealPoints.cs
- ObjectSet.cs
- PathGradientBrush.cs
- CqlGenerator.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- ObsoleteAttribute.cs
- UniqueEventHelper.cs
- WrappedIUnknown.cs
- CompareInfo.cs
- ProcessStartInfo.cs
- ToolboxComponentsCreatedEventArgs.cs
- KeyConverter.cs
- arc.cs
- MissingSatelliteAssemblyException.cs
- _LoggingObject.cs
- FusionWrap.cs
- Semaphore.cs
- GeneralTransform3DTo2DTo3D.cs
- ExpressionBindingCollection.cs
- EntityCollection.cs
- Thickness.cs
- EncoderNLS.cs
- RtfToXamlLexer.cs
- SafePEFileHandle.cs
- XmlSchemaObjectTable.cs
- XLinq.cs
- DbConnectionInternal.cs
- COM2PropertyBuilderUITypeEditor.cs
- Color.cs
- IdnMapping.cs
- StringConcat.cs
- SendingRequestEventArgs.cs
- PrintPreviewDialog.cs
- ComponentResourceKeyConverter.cs
- DesignerCommandSet.cs
- RangeValueProviderWrapper.cs
- ErrorRuntimeConfig.cs
- XPathDocumentBuilder.cs
- ElementNotEnabledException.cs
- DataGridrowEditEndingEventArgs.cs
- ParameterBuilder.cs
- StorageEntitySetMapping.cs
- Paragraph.cs
- GB18030Encoding.cs
- LinqDataSourceContextEventArgs.cs
- TagElement.cs
- OleDbConnectionInternal.cs
- CookielessHelper.cs
- TextStore.cs
- StoragePropertyMapping.cs
- ActionNotSupportedException.cs
- QueryResponse.cs
- DependencyPropertyDescriptor.cs
- ConfigXmlComment.cs
- FormsAuthenticationEventArgs.cs
- MetadataSerializer.cs
- ManagedIStream.cs
- HttpChannelFactory.cs
- SymbolMethod.cs
- TypeConverterAttribute.cs
- XmlTextReader.cs
- PolicyManager.cs
- Internal.cs
- GridViewAutomationPeer.cs
- ProtocolsSection.cs
- HtmlElementErrorEventArgs.cs
- PageContent.cs
- Handle.cs
- ToolStripContentPanelRenderEventArgs.cs
- SignerInfo.cs
- RowUpdatingEventArgs.cs
- ApplicationFileCodeDomTreeGenerator.cs
- SystemShuttingDownException.cs
- EventProvider.cs
- AdornerDecorator.cs
- MaskDescriptor.cs
- WebServiceParameterData.cs
- VariableQuery.cs
- InfoCardRSACryptoProvider.cs
- EncodingDataItem.cs
- HtmlLink.cs
- TreeIterators.cs
- ClonableStack.cs
- WebDescriptionAttribute.cs
- TextTreeUndo.cs
- complextypematerializer.cs
- ActivationServices.cs
- _BasicClient.cs
- ReaderWriterLockWrapper.cs
- MultiSelectRootGridEntry.cs
- SecurityTokenTypes.cs
- PropertyTabChangedEvent.cs
- LogConverter.cs
- WebServiceParameterData.cs
- WindowsGrip.cs
- FormViewUpdateEventArgs.cs
- DbCommandTree.cs
- BrushMappingModeValidation.cs
- ReachPrintTicketSerializer.cs