Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / CommonUI / System / Drawing / Advanced / FontCollection.cs / 1 / 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
- SafeHandles.cs
- BaseProcessProtocolHandler.cs
- VerificationAttribute.cs
- DataExpression.cs
- SymbolPair.cs
- _Win32.cs
- XPathAxisIterator.cs
- BitmapInitialize.cs
- BezierSegment.cs
- FontUnitConverter.cs
- InteropAutomationProvider.cs
- ISAPIWorkerRequest.cs
- GradientStop.cs
- DocumentEventArgs.cs
- ParallelTimeline.cs
- Version.cs
- DependencyStoreSurrogate.cs
- XmlObjectSerializerWriteContextComplex.cs
- CfgSemanticTag.cs
- ImageListImageEditor.cs
- ParameterBuilder.cs
- DataGridViewIntLinkedList.cs
- MsmqProcessProtocolHandler.cs
- PointAnimationUsingPath.cs
- SubtreeProcessor.cs
- FontInfo.cs
- AsyncStreamReader.cs
- WebBrowserNavigatedEventHandler.cs
- RangeEnumerable.cs
- ActivationServices.cs
- RecipientIdentity.cs
- XmlSchemaSimpleContentExtension.cs
- RotateTransform.cs
- XmlSubtreeReader.cs
- OutputCacheSettingsSection.cs
- ObjectToken.cs
- ResourcePart.cs
- DesignTimeTemplateParser.cs
- Scheduling.cs
- UiaCoreApi.cs
- LinqToSqlWrapper.cs
- AncillaryOps.cs
- WebExceptionStatus.cs
- TimeIntervalCollection.cs
- TdsRecordBufferSetter.cs
- EastAsianLunisolarCalendar.cs
- KeyValuePairs.cs
- BitConverter.cs
- SqlConnectionStringBuilder.cs
- SmtpMail.cs
- RawStylusActions.cs
- UIPermission.cs
- LocatorManager.cs
- CellTreeNode.cs
- TextFindEngine.cs
- SmiXetterAccessMap.cs
- XmlSchemaAnnotation.cs
- DockPanel.cs
- NameValueFileSectionHandler.cs
- QueryOperator.cs
- ConfigurationCollectionAttribute.cs
- SmtpSection.cs
- BaseCollection.cs
- DiffuseMaterial.cs
- WebConfigurationHost.cs
- DropDownButton.cs
- XslTransform.cs
- VisualProxy.cs
- Logging.cs
- ReadContentAsBinaryHelper.cs
- CodeExporter.cs
- PropertyGrid.cs
- FtpWebResponse.cs
- RegexReplacement.cs
- CustomTypeDescriptor.cs
- StrokeNodeOperations.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- WebServiceData.cs
- ListViewGroupItemCollection.cs
- ObjectDataSourceFilteringEventArgs.cs
- SqlClientWrapperSmiStream.cs
- Exceptions.cs
- LogStore.cs
- CustomAttributeFormatException.cs
- PropertyTabAttribute.cs
- PKCS1MaskGenerationMethod.cs
- TextRunCacheImp.cs
- Viewport3DAutomationPeer.cs
- BinHexDecoder.cs
- WebPartConnectionCollection.cs
- ObjectSecurity.cs
- PeerCollaborationPermission.cs
- FormViewUpdatedEventArgs.cs
- HttpStreamXmlDictionaryWriter.cs
- GiveFeedbackEvent.cs
- AuthenticatedStream.cs
- PeerCollaborationPermission.cs
- ResourceReferenceExpression.cs
- CodeGenerator.cs
- WorkflowEnvironment.cs