Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / PropertyItemInternal.cs / 1305376 / 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
- AudioFormatConverter.cs
- Processor.cs
- SmiMetaDataProperty.cs
- DrawingGroupDrawingContext.cs
- DecimalAnimation.cs
- Scene3D.cs
- VariableExpressionConverter.cs
- ErasingStroke.cs
- WriteLineDesigner.xaml.cs
- HttpListener.cs
- Vector3DAnimationBase.cs
- listitem.cs
- OleDbSchemaGuid.cs
- TextRange.cs
- WindowsTooltip.cs
- PenLineCapValidation.cs
- DefaultObjectMappingItemCollection.cs
- BaseEntityWrapper.cs
- BulletDecorator.cs
- DataObjectPastingEventArgs.cs
- CheckBox.cs
- MethodInfo.cs
- TransformProviderWrapper.cs
- ContentPropertyAttribute.cs
- ProvidePropertyAttribute.cs
- SHA384Managed.cs
- namescope.cs
- BuildProviderAppliesToAttribute.cs
- DataGridSortingEventArgs.cs
- CompoundFileStorageReference.cs
- HttpResponseHeader.cs
- ColumnPropertiesGroup.cs
- SslStream.cs
- ContainerActivationHelper.cs
- SoapInteropTypes.cs
- ResourcesChangeInfo.cs
- LoginName.cs
- RectangleGeometry.cs
- ConfigurationLocationCollection.cs
- BulletChrome.cs
- GridViewPageEventArgs.cs
- ConfigurationPropertyCollection.cs
- SharedHttpTransportManager.cs
- HtmlImage.cs
- StrokeIntersection.cs
- QueryCacheManager.cs
- SqlDataSourceCustomCommandEditor.cs
- Int16Animation.cs
- SqlTransaction.cs
- ComplexPropertyEntry.cs
- SocketCache.cs
- BooleanFacetDescriptionElement.cs
- RootBrowserWindowProxy.cs
- TcpClientSocketManager.cs
- ClientBuildManagerCallback.cs
- SourceSwitch.cs
- StateElementCollection.cs
- CookielessHelper.cs
- TraceSource.cs
- GeneralTransformGroup.cs
- BrowserCapabilitiesCodeGenerator.cs
- Variable.cs
- XmlText.cs
- ASCIIEncoding.cs
- MessageDesigner.cs
- ConfigurationLockCollection.cs
- AsyncResult.cs
- MobileUserControlDesigner.cs
- DiscardableAttribute.cs
- Rect3D.cs
- FunctionDescription.cs
- PropertyChangeTracker.cs
- MessageDescription.cs
- XmlValidatingReader.cs
- Page.cs
- __Error.cs
- ProtocolState.cs
- SqlTriggerContext.cs
- SerialStream.cs
- HttpApplication.cs
- CompilerTypeWithParams.cs
- CngAlgorithmGroup.cs
- SafeHandle.cs
- ServiceReference.cs
- SessionParameter.cs
- MethodRental.cs
- ColorBlend.cs
- GenerateTemporaryTargetAssembly.cs
- WindowsButton.cs
- _NegotiateClient.cs
- CultureMapper.cs
- ObjectDataSourceStatusEventArgs.cs
- DataStorage.cs
- TextRenderer.cs
- __Filters.cs
- CategoryNameCollection.cs
- Symbol.cs
- RecordBuilder.cs
- ViewUtilities.cs
- Simplifier.cs