Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / CommonUI / System / Drawing / Advanced / MetafileHeader.cs / 1 / MetafileHeader.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Imaging { using System.Configuration.Assemblies; using System.Diagnostics; using System; using System.Drawing; using System.Runtime.InteropServices; using System.Drawing.Internal; ////// /// Contains attributes of an /// associated [StructLayout(LayoutKind.Sequential)] public sealed class MetafileHeader { // determine which to use by nullity internal MetafileHeaderWmf wmf; internal MetafileHeaderEmf emf; internal MetafileHeader() { } ///. /// /// /// Gets the type of the associated public MetafileType Type { get { return IsWmf() ? wmf.type : emf.type; } } ///. /// /// /// public int MetafileSize { get { return IsWmf() ? wmf.size : emf.size; } } ////// Gets the size, in bytes, of the associated /// ///. /// /// /// Gets the version number of the associated /// public int Version { get { return IsWmf() ? wmf.version : emf.version; } } /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future. private EmfPlusFlags EmfPlusFlags { get { return IsWmf() ? wmf.emfPlusFlags : emf.emfPlusFlags; } } */ ///. /// /// /// Gets the horizontal resolution, in /// dots-per-inch, of the associated public float DpiX { get { return IsWmf() ? wmf.dpiX : emf.dpiX; } } ///. /// /// /// Gets the vertical resolution, in /// dots-per-inch, of the associated public float DpiY { get { return IsWmf() ? wmf.dpiY : emf.dpiY; } } ///. /// /// /// Gets a public Rectangle Bounds { get { return IsWmf() ? new Rectangle(wmf.X, wmf.Y, wmf.Width, wmf.Height) : new Rectangle(emf.X, emf.Y, emf.Width, emf.Height); } } ///that bounds the associated /// . /// /// /// Returns a value indicating whether the /// associated public bool IsWmf() { if ((wmf == null) && (emf == null)) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); if ((wmf != null) && ((wmf.type == MetafileType.Wmf) || (wmf.type == MetafileType.WmfPlaceable))) return true; else return false; } ///is in the Windows metafile /// format. /// /// /// public bool IsWmfPlaceable() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((wmf != null) && (wmf.type == MetafileType.WmfPlaceable)); } ////// Returns a value indicating whether the /// associated ///is in the Windows Placeable metafile /// format. /// /// /// Returns a value indicating whether the /// associated public bool IsEmf() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((emf != null) && (emf.type == MetafileType.Emf)); } ///is in the Windows enhanced metafile /// format. /// /// /// Returns a value indicating whether the /// associated public bool IsEmfOrEmfPlus() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((emf != null) && (emf.type >= MetafileType.Emf)); } ///is in the Windows enhanced metafile /// format or the Windows enhanced metafile plus. /// /// /// Returns a value indicating whether the /// associated public bool IsEmfPlus() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((emf != null) && (emf.type >= MetafileType.EmfPlusOnly)); } ///is in the Windows enhanced metafile /// plus format. /// /// /// Returns a value indicating whether the /// associated public bool IsEmfPlusDual() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((emf != null) && (emf.type == MetafileType.EmfPlusDual)); } ///is in the Dual enhanced /// metafile format. This format supports both the enhanced and the enhanced /// plus format. /// /// /// public bool IsEmfPlusOnly() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((emf != null) && (emf.type == MetafileType.EmfPlusOnly)); } ////// Returns a value indicating whether the associated ///supports only the Windows /// enhanced metafile plus format. /// /// /// public bool IsDisplay() { return IsEmfPlus() && ((((int)emf.emfPlusFlags) & ((int)EmfPlusFlags.Display)) != 0); } ////// Returns a value indicating whether the associated ///is device-dependent. /// /// /// Gets the WMF header file for the associated /// public MetaHeader WmfHeader { get { if (wmf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return wmf.WmfHeader; } } ///. /// /// /// /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future. internal SafeNativeMethods.ENHMETAHEADER EmfHeader { get { if (emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return emf.EmfHeader; } } */ ////// Gets the WMF header file for the associated ///. /// /// /// Gets the size, in bytes, of the /// enhanced metafile plus header file. /// public int EmfPlusHeaderSize { get { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return IsWmf() ? wmf.EmfPlusHeaderSize : emf.EmfPlusHeaderSize; } } ////// /// public int LogicalDpiX { get { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return IsWmf() ? wmf.LogicalDpiX : emf.LogicalDpiX; } } ////// Gets the logical horizontal resolution, in /// dots-per-inch, of the associated ///. /// /// /// Gets the logical vertical resolution, in /// dots-per-inch, of the associated public int LogicalDpiY { get { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return IsWmf() ? wmf.LogicalDpiY : emf.LogicalDpiX; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //. /// // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Imaging { using System.Configuration.Assemblies; using System.Diagnostics; using System; using System.Drawing; using System.Runtime.InteropServices; using System.Drawing.Internal; ////// /// Contains attributes of an /// associated [StructLayout(LayoutKind.Sequential)] public sealed class MetafileHeader { // determine which to use by nullity internal MetafileHeaderWmf wmf; internal MetafileHeaderEmf emf; internal MetafileHeader() { } ///. /// /// /// Gets the type of the associated public MetafileType Type { get { return IsWmf() ? wmf.type : emf.type; } } ///. /// /// /// public int MetafileSize { get { return IsWmf() ? wmf.size : emf.size; } } ////// Gets the size, in bytes, of the associated /// ///. /// /// /// Gets the version number of the associated /// public int Version { get { return IsWmf() ? wmf.version : emf.version; } } /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future. private EmfPlusFlags EmfPlusFlags { get { return IsWmf() ? wmf.emfPlusFlags : emf.emfPlusFlags; } } */ ///. /// /// /// Gets the horizontal resolution, in /// dots-per-inch, of the associated public float DpiX { get { return IsWmf() ? wmf.dpiX : emf.dpiX; } } ///. /// /// /// Gets the vertical resolution, in /// dots-per-inch, of the associated public float DpiY { get { return IsWmf() ? wmf.dpiY : emf.dpiY; } } ///. /// /// /// Gets a public Rectangle Bounds { get { return IsWmf() ? new Rectangle(wmf.X, wmf.Y, wmf.Width, wmf.Height) : new Rectangle(emf.X, emf.Y, emf.Width, emf.Height); } } ///that bounds the associated /// . /// /// /// Returns a value indicating whether the /// associated public bool IsWmf() { if ((wmf == null) && (emf == null)) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); if ((wmf != null) && ((wmf.type == MetafileType.Wmf) || (wmf.type == MetafileType.WmfPlaceable))) return true; else return false; } ///is in the Windows metafile /// format. /// /// /// public bool IsWmfPlaceable() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((wmf != null) && (wmf.type == MetafileType.WmfPlaceable)); } ////// Returns a value indicating whether the /// associated ///is in the Windows Placeable metafile /// format. /// /// /// Returns a value indicating whether the /// associated public bool IsEmf() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((emf != null) && (emf.type == MetafileType.Emf)); } ///is in the Windows enhanced metafile /// format. /// /// /// Returns a value indicating whether the /// associated public bool IsEmfOrEmfPlus() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((emf != null) && (emf.type >= MetafileType.Emf)); } ///is in the Windows enhanced metafile /// format or the Windows enhanced metafile plus. /// /// /// Returns a value indicating whether the /// associated public bool IsEmfPlus() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((emf != null) && (emf.type >= MetafileType.EmfPlusOnly)); } ///is in the Windows enhanced metafile /// plus format. /// /// /// Returns a value indicating whether the /// associated public bool IsEmfPlusDual() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((emf != null) && (emf.type == MetafileType.EmfPlusDual)); } ///is in the Dual enhanced /// metafile format. This format supports both the enhanced and the enhanced /// plus format. /// /// /// public bool IsEmfPlusOnly() { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return ((emf != null) && (emf.type == MetafileType.EmfPlusOnly)); } ////// Returns a value indicating whether the associated ///supports only the Windows /// enhanced metafile plus format. /// /// /// public bool IsDisplay() { return IsEmfPlus() && ((((int)emf.emfPlusFlags) & ((int)EmfPlusFlags.Display)) != 0); } ////// Returns a value indicating whether the associated ///is device-dependent. /// /// /// Gets the WMF header file for the associated /// public MetaHeader WmfHeader { get { if (wmf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return wmf.WmfHeader; } } ///. /// /// /// /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future. internal SafeNativeMethods.ENHMETAHEADER EmfHeader { get { if (emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return emf.EmfHeader; } } */ ////// Gets the WMF header file for the associated ///. /// /// /// Gets the size, in bytes, of the /// enhanced metafile plus header file. /// public int EmfPlusHeaderSize { get { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return IsWmf() ? wmf.EmfPlusHeaderSize : emf.EmfPlusHeaderSize; } } ////// /// public int LogicalDpiX { get { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return IsWmf() ? wmf.LogicalDpiX : emf.LogicalDpiX; } } ////// Gets the logical horizontal resolution, in /// dots-per-inch, of the associated ///. /// /// /// Gets the logical vertical resolution, in /// dots-per-inch, of the associated public int LogicalDpiY { get { if (wmf == null && emf == null) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); return IsWmf() ? wmf.LogicalDpiY : emf.LogicalDpiX; } } } } // 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
- CheckBoxAutomationPeer.cs
- XsltCompileContext.cs
- RequestCachePolicy.cs
- Cursor.cs
- ProgressBarAutomationPeer.cs
- VisualStyleInformation.cs
- ToolStripComboBox.cs
- PartialToken.cs
- StdValidatorsAndConverters.cs
- DataGridViewAutoSizeModeEventArgs.cs
- RecipientInfo.cs
- _PooledStream.cs
- XmlUnspecifiedAttribute.cs
- PanelContainerDesigner.cs
- LinkedResource.cs
- SafeProcessHandle.cs
- XmlAnyAttributeAttribute.cs
- Block.cs
- TextProviderWrapper.cs
- MsmqQueue.cs
- EventHandlersStore.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- XmlSchemaRedefine.cs
- ServicesUtilities.cs
- ExpressionDumper.cs
- ShaderEffect.cs
- Drawing.cs
- ChannelSinkStacks.cs
- PropertyDescriptorCollection.cs
- SoapInteropTypes.cs
- SafeProcessHandle.cs
- ServiceEndpointCollection.cs
- Misc.cs
- IODescriptionAttribute.cs
- EventLogPropertySelector.cs
- EditableRegion.cs
- BitArray.cs
- GroupByExpressionRewriter.cs
- HtmlTableRow.cs
- ProgramPublisher.cs
- XMLUtil.cs
- WSFederationHttpSecurityElement.cs
- DataGridTablesFactory.cs
- PageClientProxyGenerator.cs
- EventLogPropertySelector.cs
- TimeStampChecker.cs
- TabItemAutomationPeer.cs
- UpdateProgress.cs
- TemplateColumn.cs
- PropertyMetadata.cs
- ReadOnlyHierarchicalDataSource.cs
- _CacheStreams.cs
- CompiledQuery.cs
- FileLogRecord.cs
- PassportAuthentication.cs
- ForEach.cs
- EventLogInternal.cs
- Utils.cs
- EntityCommandCompilationException.cs
- ConstNode.cs
- LineUtil.cs
- DataTemplate.cs
- Vector3DValueSerializer.cs
- BitmapScalingModeValidation.cs
- Vector.cs
- ComAdminInterfaces.cs
- IndentedWriter.cs
- CriticalFinalizerObject.cs
- LoginView.cs
- Size3D.cs
- PieceDirectory.cs
- CryptoProvider.cs
- ProxyManager.cs
- WinHttpWebProxyFinder.cs
- TypeInfo.cs
- EntityViewContainer.cs
- MsdtcWrapper.cs
- documentsequencetextview.cs
- StrongNameKeyPair.cs
- DataBindingList.cs
- QuaternionAnimationBase.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- Binding.cs
- EdmFunction.cs
- DataBoundControl.cs
- QilPatternFactory.cs
- ScrollChrome.cs
- ArglessEventHandlerProxy.cs
- InstanceDataCollection.cs
- SqlDataSourceCommandEventArgs.cs
- TraceData.cs
- PagedControl.cs
- AccessibilityHelperForXpWin2k3.cs
- TreeNode.cs
- ButtonField.cs
- FieldNameLookup.cs
- ImageSource.cs
- WindowsRichEditRange.cs
- TableLayoutPanel.cs
- UnSafeCharBuffer.cs