Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CommonUI / System / Drawing / PropertyItemInternal.cs / 2 / 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
- LockCookie.cs
- XmlCodeExporter.cs
- PointAnimationUsingKeyFrames.cs
- BaseDataList.cs
- CharKeyFrameCollection.cs
- RadioButtonDesigner.cs
- XmlSchemaElement.cs
- GPPOINTF.cs
- DispatcherProcessingDisabled.cs
- Hash.cs
- QEncodedStream.cs
- TextFormatter.cs
- FormCollection.cs
- CodeDirectoryCompiler.cs
- CookieProtection.cs
- SiteIdentityPermission.cs
- DataGridState.cs
- GenericUI.cs
- LabelLiteral.cs
- MaskInputRejectedEventArgs.cs
- XslException.cs
- HttpHandler.cs
- MouseButtonEventArgs.cs
- ObjectViewQueryResultData.cs
- coordinatorscratchpad.cs
- DoubleAnimation.cs
- CommandTreeTypeHelper.cs
- EmptyImpersonationContext.cs
- DispatchOperation.cs
- DefaultAssemblyResolver.cs
- CustomPopupPlacement.cs
- SQLInt64Storage.cs
- ScopelessEnumAttribute.cs
- BooleanKeyFrameCollection.cs
- PhotoPrintingIntent.cs
- ConfigLoader.cs
- Matrix3DValueSerializer.cs
- ResourceDisplayNameAttribute.cs
- complextypematerializer.cs
- XmlSchemaGroup.cs
- XmlElementAttribute.cs
- UserPersonalizationStateInfo.cs
- HandoffBehavior.cs
- CodeMethodMap.cs
- XmlDataSourceNodeDescriptor.cs
- SqlDataSource.cs
- Condition.cs
- UnsafeNativeMethods.cs
- Proxy.cs
- CreatingCookieEventArgs.cs
- RegistrySecurity.cs
- InputBinding.cs
- GradientSpreadMethodValidation.cs
- TransactionProxy.cs
- HttpProfileBase.cs
- _ConnectStream.cs
- COSERVERINFO.cs
- ServiceReflector.cs
- PageAsyncTask.cs
- PropertyEntry.cs
- CompositeCollectionView.cs
- TextAutomationPeer.cs
- RegistryConfigurationProvider.cs
- PeerCollaborationPermission.cs
- NameScopePropertyAttribute.cs
- MethodToken.cs
- TileBrush.cs
- ComponentCommands.cs
- RouteItem.cs
- COM2IDispatchConverter.cs
- NonVisualControlAttribute.cs
- PointCollection.cs
- oledbmetadatacollectionnames.cs
- WorkflowInstanceProvider.cs
- PagedDataSource.cs
- CompilationLock.cs
- StreamMarshaler.cs
- MulticastDelegate.cs
- DynamicObject.cs
- EntityViewGenerationAttribute.cs
- LOSFormatter.cs
- GPRECTF.cs
- ExceptionRoutedEventArgs.cs
- BindableAttribute.cs
- ConstNode.cs
- SecurityAlgorithmSuiteConverter.cs
- ImageInfo.cs
- LogReservationCollection.cs
- WebPartEditorApplyVerb.cs
- RootContext.cs
- CqlParser.cs
- PeerNameRegistration.cs
- LiteralSubsegment.cs
- Evidence.cs
- AutoFocusStyle.xaml.cs
- Events.cs
- ConfigurationSectionGroupCollection.cs
- OleDbReferenceCollection.cs
- RijndaelManaged.cs
- DbReferenceCollection.cs