Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CommonUI / System / Drawing / PropertyItemInternal.cs / 1 / PropertyItemInternal.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Imaging { using System.Runtime.InteropServices; using System; using System.Drawing; // sdkinc\imaging.h [StructLayout(LayoutKind.Sequential)] internal sealed class PropertyItemInternal : IDisposable { public int id; public int len; public short type; public IntPtr value = IntPtr.Zero; internal PropertyItemInternal() { } ~PropertyItemInternal() { Dispose(false); } public void Dispose() { Dispose(true); } private void Dispose(bool disposing) { if (value != IntPtr.Zero) { Marshal.FreeHGlobal(value); value = IntPtr.Zero; } if( disposing ) { GC.SuppressFinalize(this); } } internal static PropertyItemInternal ConvertFromPropertyItem(PropertyItem propItem) { PropertyItemInternal propItemInternal = new PropertyItemInternal(); propItemInternal.id = propItem.Id; propItemInternal.len = propItem.Len; propItemInternal.type = propItem.Type; byte[] propItemValue = propItem.Value; if (propItemValue != null) { propItemInternal.value = Marshal.AllocHGlobal(propItemValue.Length); Marshal.Copy(propItemValue, 0, propItemInternal.value, propItemValue.Length); } return propItemInternal; } internal static PropertyItem[] ConvertFromMemory(IntPtr propdata, int count) { PropertyItem[] props = new PropertyItem[count]; for (int i=0; i// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Imaging { using System.Runtime.InteropServices; using System; using System.Drawing; // sdkinc\imaging.h [StructLayout(LayoutKind.Sequential)] internal sealed class PropertyItemInternal : IDisposable { public int id; public int len; public short type; public IntPtr value = IntPtr.Zero; internal PropertyItemInternal() { } ~PropertyItemInternal() { Dispose(false); } public void Dispose() { Dispose(true); } private void Dispose(bool disposing) { if (value != IntPtr.Zero) { Marshal.FreeHGlobal(value); value = IntPtr.Zero; } if( disposing ) { GC.SuppressFinalize(this); } } internal static PropertyItemInternal ConvertFromPropertyItem(PropertyItem propItem) { PropertyItemInternal propItemInternal = new PropertyItemInternal(); propItemInternal.id = propItem.Id; propItemInternal.len = propItem.Len; propItemInternal.type = propItem.Type; byte[] propItemValue = propItem.Value; if (propItemValue != null) { propItemInternal.value = Marshal.AllocHGlobal(propItemValue.Length); Marshal.Copy(propItemValue, 0, propItemInternal.value, propItemValue.Length); } return propItemInternal; } internal static PropertyItem[] ConvertFromMemory(IntPtr propdata, int count) { PropertyItem[] props = new PropertyItem[count]; for (int i=0; i
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LineUtil.cs
- ListDesigner.cs
- Transform.cs
- CancellableEnumerable.cs
- ExpressionContext.cs
- RoleManagerModule.cs
- SqlFlattener.cs
- DeferredReference.cs
- AssemblyHelper.cs
- GridLength.cs
- DrawingCollection.cs
- LocalizableResourceBuilder.cs
- NopReturnReader.cs
- UTF7Encoding.cs
- httpapplicationstate.cs
- ProfileGroupSettings.cs
- ContextMenu.cs
- ExpressionBinding.cs
- SqlDataSourceView.cs
- EventDescriptor.cs
- ZipIOExtraFieldPaddingElement.cs
- PropertyChangeTracker.cs
- SqlDataSourceEnumerator.cs
- TypeListConverter.cs
- WorkflowViewElement.cs
- OdbcParameter.cs
- WriteFileContext.cs
- MsmqInputSessionChannelListener.cs
- OracleParameterBinding.cs
- CollectionChangeEventArgs.cs
- DataGridCell.cs
- EventRecord.cs
- DataControlHelper.cs
- Crc32.cs
- PrimitiveXmlSerializers.cs
- SqlDependency.cs
- OdbcInfoMessageEvent.cs
- CommonGetThemePartSize.cs
- RealizationContext.cs
- PermissionSetEnumerator.cs
- RemotingAttributes.cs
- ConnectionManagementSection.cs
- BitmapVisualManager.cs
- OracleBinary.cs
- SqlDataSourceFilteringEventArgs.cs
- Cursor.cs
- ObjectContextServiceProvider.cs
- FacetValueContainer.cs
- ColumnMapProcessor.cs
- SchemaNotation.cs
- FlowDocument.cs
- parserscommon.cs
- VersionPair.cs
- CssClassPropertyAttribute.cs
- DesignerProperties.cs
- ViewBox.cs
- MetadataProperty.cs
- TypedElement.cs
- HostedAspNetEnvironment.cs
- XamlPoint3DCollectionSerializer.cs
- Selection.cs
- EntityProviderFactory.cs
- XmlUrlResolver.cs
- EntityDataSourceValidationException.cs
- RemoteTokenFactory.cs
- AsymmetricSignatureDeformatter.cs
- BinaryKeyIdentifierClause.cs
- Point3DIndependentAnimationStorage.cs
- BaseTemplateCodeDomTreeGenerator.cs
- TabPanel.cs
- SystemException.cs
- SqlFlattener.cs
- DataRelationPropertyDescriptor.cs
- SortedDictionary.cs
- HttpProfileGroupBase.cs
- Size3DValueSerializer.cs
- BamlRecordHelper.cs
- ThreadPool.cs
- ListViewInsertionMark.cs
- PropertyToken.cs
- SoapUnknownHeader.cs
- NameValueCollection.cs
- ExpressionPrinter.cs
- LeftCellWrapper.cs
- peersecuritysettings.cs
- DataAdapter.cs
- HelpProvider.cs
- PenThreadWorker.cs
- HttpContextServiceHost.cs
- MiniCustomAttributeInfo.cs
- TypeUtils.cs
- UnsafeNativeMethodsMilCoreApi.cs
- RepeatInfo.cs
- ArraySet.cs
- StringAnimationUsingKeyFrames.cs
- TabItem.cs
- ColorContextHelper.cs
- MarkupExtensionReturnTypeAttribute.cs
- ProtectedConfigurationSection.cs
- Formatter.cs