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... } /// /// /// 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 */ ////// Gets the array of ////// objects associated with this . /// /// /// ~FontCollection() { Dispose(false); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Allows an object to free resources before the object is /// reclaimed by the Garbage Collector ( ///). /// // 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... } /// /// /// 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 */ ////// Gets the array of ////// objects associated with this . /// /// /// ~FontCollection() { Dispose(false); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Allows an object to free resources before the object is /// reclaimed by the Garbage Collector ( ///). ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- InvokeMethodActivity.cs
- RoutedCommand.cs
- Enum.cs
- TimeSpanValidator.cs
- CompareValidator.cs
- ToolStripRendererSwitcher.cs
- MethodInfo.cs
- InputReferenceExpression.cs
- SupportsEventValidationAttribute.cs
- DataSourceCache.cs
- JournalEntryListConverter.cs
- DictionaryManager.cs
- WebBaseEventKeyComparer.cs
- LayoutManager.cs
- Collection.cs
- CopyNamespacesAction.cs
- AssertSection.cs
- PassportAuthenticationModule.cs
- VideoDrawing.cs
- DBSqlParserColumn.cs
- LogicalExpr.cs
- SequenceDesignerAccessibleObject.cs
- Trustee.cs
- EncodingInfo.cs
- SoapFault.cs
- NetNamedPipeSecurityMode.cs
- ImpersonateTokenRef.cs
- SqlDataSourceParameterParser.cs
- TargetConverter.cs
- EllipseGeometry.cs
- StreamFormatter.cs
- RegexReplacement.cs
- XsltConvert.cs
- OAVariantLib.cs
- TextRunCacheImp.cs
- activationcontext.cs
- WebResponse.cs
- DataGridViewTextBoxCell.cs
- GeneratedView.cs
- RemotingException.cs
- CachingHintValidation.cs
- QueryAccessibilityHelpEvent.cs
- SqlComparer.cs
- Operator.cs
- ScriptReference.cs
- EnvironmentPermission.cs
- SwitchElementsCollection.cs
- CodeSnippetStatement.cs
- ResizeGrip.cs
- WmlTextViewAdapter.cs
- ObjectViewEntityCollectionData.cs
- CapabilitiesPattern.cs
- CommonDialog.cs
- LassoSelectionBehavior.cs
- EventToken.cs
- safemediahandle.cs
- WorkflowOwnershipException.cs
- IteratorFilter.cs
- APCustomTypeDescriptor.cs
- SelectManyQueryOperator.cs
- CloudCollection.cs
- ProtocolsConfigurationEntry.cs
- TransformValueSerializer.cs
- Transform3D.cs
- SharedUtils.cs
- ActiveDocumentEvent.cs
- TabletDeviceInfo.cs
- DragEvent.cs
- DataGridComboBoxColumn.cs
- UnwrappedTypesXmlSerializerManager.cs
- AnonymousIdentificationSection.cs
- DesignerView.cs
- BrowserCapabilitiesFactory.cs
- DataGridViewComboBoxColumn.cs
- ProbeDuplexCD1AsyncResult.cs
- Models.cs
- SimpleType.cs
- XmlSchemaElement.cs
- ToolStripDropDownButton.cs
- MarkerProperties.cs
- HttpProfileBase.cs
- Point3DCollectionValueSerializer.cs
- PageOutputQuality.cs
- SqlBuilder.cs
- DBCSCodePageEncoding.cs
- OneOfScalarConst.cs
- RtfControlWordInfo.cs
- ButtonFlatAdapter.cs
- HyperLinkDesigner.cs
- StyleSheetComponentEditor.cs
- ApplicationProxyInternal.cs
- PerfCounters.cs
- UriTemplateDispatchFormatter.cs
- HuffmanTree.cs
- Win32.cs
- WindowsTooltip.cs
- SiteIdentityPermission.cs
- XmlWriterSettings.cs
- ContextConfiguration.cs
- PerformanceCounter.cs