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
- ISFTagAndGuidCache.cs
- Stack.cs
- FirewallWrapper.cs
- NetworkInterface.cs
- DbMetaDataColumnNames.cs
- TypeLoadException.cs
- TextTabProperties.cs
- RegexGroup.cs
- SystemUnicastIPAddressInformation.cs
- DrawingImage.cs
- RequestResizeEvent.cs
- WorkflowMessageEventHandler.cs
- DataSourceControlBuilder.cs
- PolicyException.cs
- RegistrationServices.cs
- NeutralResourcesLanguageAttribute.cs
- TcpChannelHelper.cs
- ListBoxChrome.cs
- ConnectionPoolManager.cs
- DataGridToolTip.cs
- Configuration.cs
- EnumValidator.cs
- WebColorConverter.cs
- QuaternionAnimationBase.cs
- MethodBody.cs
- FixedDSBuilder.cs
- JsonWriter.cs
- LineServices.cs
- tooltip.cs
- BinaryCommonClasses.cs
- JoinGraph.cs
- SymmetricKey.cs
- FormsAuthenticationUserCollection.cs
- Base64Decoder.cs
- XmlUtilWriter.cs
- BitmapFrameDecode.cs
- OracleConnectionFactory.cs
- DbDataAdapter.cs
- CatalogZoneBase.cs
- DecoderFallbackWithFailureFlag.cs
- DbProviderSpecificTypePropertyAttribute.cs
- ConnectionConsumerAttribute.cs
- MailDefinition.cs
- VariableAction.cs
- XsdBuildProvider.cs
- DesignerAdapterUtil.cs
- HttpPostProtocolImporter.cs
- PropertyGroupDescription.cs
- SystemWebCachingSectionGroup.cs
- ColumnMapVisitor.cs
- SQLCharsStorage.cs
- TypeDescriptorContext.cs
- DesignerToolStripControlHost.cs
- XmlDocument.cs
- WindowsFormsEditorServiceHelper.cs
- DesignerSerializerAttribute.cs
- EditorAttributeInfo.cs
- XmlParser.cs
- Constraint.cs
- EmptyImpersonationContext.cs
- AssemblyBuilderData.cs
- FreezableDefaultValueFactory.cs
- TraceXPathNavigator.cs
- MonitorWrapper.cs
- TransformProviderWrapper.cs
- WindowsFormsHost.cs
- SerializationInfoEnumerator.cs
- StopStoryboard.cs
- CaseInsensitiveComparer.cs
- CellParagraph.cs
- XmlNode.cs
- XPathScanner.cs
- Win32SafeHandles.cs
- _NestedMultipleAsyncResult.cs
- XPathExpr.cs
- SQLResource.cs
- Psha1DerivedKeyGenerator.cs
- IsolatedStorage.cs
- TdsParserSafeHandles.cs
- GridPatternIdentifiers.cs
- TypedElement.cs
- HttpContextServiceHost.cs
- WebPartMenu.cs
- XmlKeywords.cs
- Slider.cs
- TableItemProviderWrapper.cs
- GeneratedCodeAttribute.cs
- ContentValidator.cs
- CompositeTypefaceMetrics.cs
- KoreanCalendar.cs
- FieldToken.cs
- QueueProcessor.cs
- WebZone.cs
- TextAdaptor.cs
- _Events.cs
- ImageFormatConverter.cs
- ConfigurationLockCollection.cs
- ExplicitDiscriminatorMap.cs
- OracleBinary.cs
- Math.cs