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
- FillErrorEventArgs.cs
- FloaterParagraph.cs
- ErrorHandler.cs
- COM2Enum.cs
- basenumberconverter.cs
- EventLogPermissionHolder.cs
- COAUTHINFO.cs
- BrowserCapabilitiesFactoryBase.cs
- VScrollBar.cs
- BindToObject.cs
- HtmlGenericControl.cs
- CorrelationToken.cs
- ControlAdapter.cs
- _FtpControlStream.cs
- ImageListDesigner.cs
- TextTreeTextNode.cs
- FrameworkElement.cs
- ConnectionStringsExpressionBuilder.cs
- Pool.cs
- LayoutTable.cs
- SoapExtensionTypeElementCollection.cs
- SettingsSavedEventArgs.cs
- RolePrincipal.cs
- TypeGeneratedEventArgs.cs
- ToolStripPanel.cs
- DomainConstraint.cs
- ImageAnimator.cs
- EventRouteFactory.cs
- CustomExpressionEventArgs.cs
- SingleKeyFrameCollection.cs
- EntityModelSchemaGenerator.cs
- SafeCoTaskMem.cs
- ButtonRenderer.cs
- ServiceChannelProxy.cs
- DesignerUtility.cs
- AddInStore.cs
- ReadOnlyTernaryTree.cs
- EditCommandColumn.cs
- XmlAttributeHolder.cs
- Matrix3D.cs
- DataGridState.cs
- SafeRightsManagementEnvironmentHandle.cs
- WeakHashtable.cs
- XPathChildIterator.cs
- SizeAnimationBase.cs
- Matrix.cs
- RealizationContext.cs
- Win32.cs
- RadioButtonAutomationPeer.cs
- ExeContext.cs
- PageAsyncTaskManager.cs
- DbMetaDataCollectionNames.cs
- SqlBulkCopy.cs
- StateChangeEvent.cs
- XamlHttpHandlerFactory.cs
- SecurityCriticalDataForSet.cs
- ObjectHelper.cs
- ColumnTypeConverter.cs
- Table.cs
- ResourcesChangeInfo.cs
- EndOfStreamException.cs
- Page.cs
- Decimal.cs
- SHA384Cng.cs
- FormViewInsertedEventArgs.cs
- Byte.cs
- WebResourceAttribute.cs
- GenerateHelper.cs
- XmlQueryType.cs
- EasingFunctionBase.cs
- CompositeFontParser.cs
- ArgumentFixer.cs
- EntityStoreSchemaGenerator.cs
- Rect.cs
- DefaultPropertiesToSend.cs
- DbDataAdapter.cs
- ObjectMaterializedEventArgs.cs
- WebRequestModulesSection.cs
- ConstructorExpr.cs
- NativeMethods.cs
- XmlSiteMapProvider.cs
- WebBrowserDocumentCompletedEventHandler.cs
- SoapAttributeAttribute.cs
- ScrollEventArgs.cs
- DataGridViewControlCollection.cs
- EntryPointNotFoundException.cs
- basemetadatamappingvisitor.cs
- FormsAuthenticationTicket.cs
- formatter.cs
- PolyLineSegment.cs
- ViewStateException.cs
- DisableDpiAwarenessAttribute.cs
- LinqExpressionNormalizer.cs
- MessagePropertyAttribute.cs
- Line.cs
- ChangeConflicts.cs
- ParseElementCollection.cs
- ExceptionHandler.cs
- IMembershipProvider.cs
- RayHitTestParameters.cs