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
- ModelItemExtensions.cs
- CommandValueSerializer.cs
- CombinedGeometry.cs
- WebPermission.cs
- SafeHandles.cs
- TextRangeEditTables.cs
- InspectionWorker.cs
- IncrementalReadDecoders.cs
- OutputCacheProfileCollection.cs
- HorizontalAlignConverter.cs
- Route.cs
- ReflectTypeDescriptionProvider.cs
- ResourceReferenceKeyNotFoundException.cs
- ISFClipboardData.cs
- JournalEntryStack.cs
- DataGridHeaderBorder.cs
- Vector.cs
- RegistrationServices.cs
- ContainerParagraph.cs
- XmlElement.cs
- AnimationClock.cs
- DesignerUtils.cs
- CheckBoxField.cs
- MaskedTextBox.cs
- HtmlTableRowCollection.cs
- _NtlmClient.cs
- DesignTimeVisibleAttribute.cs
- PeerNameRecordCollection.cs
- MemoryFailPoint.cs
- AsymmetricKeyExchangeDeformatter.cs
- ReaderWriterLock.cs
- RepeaterItemCollection.cs
- SymLanguageVendor.cs
- DataGridPagerStyle.cs
- BadImageFormatException.cs
- Operator.cs
- XmlElement.cs
- StorageModelBuildProvider.cs
- Style.cs
- ErrorRuntimeConfig.cs
- StrokeNodeData.cs
- XmlNotation.cs
- GB18030Encoding.cs
- CacheSection.cs
- CommandHelpers.cs
- GeometryModel3D.cs
- _ProxyChain.cs
- EdmValidator.cs
- AvTraceFormat.cs
- TdsEnums.cs
- FilteredDataSetHelper.cs
- PackageRelationshipSelector.cs
- ThreadAbortException.cs
- NegotiateStream.cs
- GPStream.cs
- ComboBoxRenderer.cs
- FileLogRecordEnumerator.cs
- HelpEvent.cs
- ConditionValidator.cs
- ButtonColumn.cs
- DefaultSettingsSection.cs
- TextEditorTyping.cs
- EmissiveMaterial.cs
- LessThan.cs
- UserThread.cs
- CodeCompiler.cs
- ListDictionaryInternal.cs
- ShaderEffect.cs
- XmlArrayItemAttribute.cs
- BaseTemplateCodeDomTreeGenerator.cs
- Executor.cs
- RegexStringValidatorAttribute.cs
- RightsManagementPermission.cs
- XamlTreeBuilderBamlRecordWriter.cs
- RegexReplacement.cs
- TextElementEditingBehaviorAttribute.cs
- DashStyle.cs
- _ListenerAsyncResult.cs
- ImageListStreamer.cs
- HtmlButton.cs
- HwndSourceParameters.cs
- NativeCppClassAttribute.cs
- Fonts.cs
- ComplusTypeValidator.cs
- IfAction.cs
- ListItemCollection.cs
- CharEntityEncoderFallback.cs
- DrawListViewSubItemEventArgs.cs
- PrinterSettings.cs
- Translator.cs
- SafeUserTokenHandle.cs
- FlowNode.cs
- GenericUriParser.cs
- HtmlElementCollection.cs
- RemotingConfiguration.cs
- Inflater.cs
- DatatypeImplementation.cs
- TracePayload.cs
- AssertFilter.cs
- DatasetMethodGenerator.cs