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...
}
///
///
///
/// 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.
//
//-----------------------------------------------------------------------------
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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RequestCache.cs
- ValidationSummary.cs
- AuthStoreRoleProvider.cs
- ServiceDesigner.cs
- TreeWalkHelper.cs
- updateconfighost.cs
- CreateParams.cs
- DataBindingCollection.cs
- IPCCacheManager.cs
- WsatConfiguration.cs
- CodeNamespace.cs
- ClrPerspective.cs
- AppearanceEditorPart.cs
- RichTextBox.cs
- WebZoneDesigner.cs
- IDReferencePropertyAttribute.cs
- ComponentRenameEvent.cs
- CounterSampleCalculator.cs
- DefaultPrintController.cs
- SqlCacheDependencyDatabaseCollection.cs
- OdbcEnvironment.cs
- SourceSwitch.cs
- FragmentNavigationEventArgs.cs
- NativeMethods.cs
- HttpContext.cs
- MemberAccessException.cs
- ipaddressinformationcollection.cs
- Transform3D.cs
- SrgsRule.cs
- bidPrivateBase.cs
- HuffCodec.cs
- AnimatedTypeHelpers.cs
- ServiceXNameTypeConverter.cs
- NameValueFileSectionHandler.cs
- SortQueryOperator.cs
- DateTimeConverter.cs
- RSATokenProvider.cs
- TypeToTreeConverter.cs
- DataGridLinkButton.cs
- PopupEventArgs.cs
- TextReader.cs
- AttributeEmitter.cs
- RecoverInstanceLocksCommand.cs
- ListDesigner.cs
- ClrProviderManifest.cs
- Options.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- AsymmetricSignatureDeformatter.cs
- SelfIssuedSamlTokenFactory.cs
- EntityContainerAssociationSetEnd.cs
- DataTableMappingCollection.cs
- WindowsListViewItemStartMenu.cs
- BuildProviderAppliesToAttribute.cs
- ApplicationSecurityManager.cs
- DataGridViewColumnTypePicker.cs
- DbException.cs
- SoapCodeExporter.cs
- StrokeNodeData.cs
- SpecialFolderEnumConverter.cs
- SoapIgnoreAttribute.cs
- FileDataSourceCache.cs
- WorkflowEventArgs.cs
- Publisher.cs
- __ComObject.cs
- ObjectHandle.cs
- FamilyMapCollection.cs
- IdentityNotMappedException.cs
- ResourceProviderFactory.cs
- xmlsaver.cs
- TcpConnectionPool.cs
- ClientBuildManager.cs
- InstanceLockedException.cs
- ContentValidator.cs
- EntityException.cs
- OdbcConnectionHandle.cs
- WhereQueryOperator.cs
- OptimizedTemplateContent.cs
- DbModificationCommandTree.cs
- SortedList.cs
- UnsettableComboBox.cs
- DesignerVerbToolStripMenuItem.cs
- BasicCommandTreeVisitor.cs
- SplineKeyFrames.cs
- TextEmbeddedObject.cs
- ReachObjectContext.cs
- SmiRequestExecutor.cs
- Style.cs
- WebServiceMethodData.cs
- BamlVersionHeader.cs
- XmlSerializer.cs
- CanonicalFormWriter.cs
- returneventsaver.cs
- RoleManagerEventArgs.cs
- SiteOfOriginContainer.cs
- DecimalConstantAttribute.cs
- RuntimeConfig.cs
- PageParser.cs
- OdbcCommandBuilder.cs
- InputBindingCollection.cs
- GridViewColumnCollection.cs