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
- PrintControllerWithStatusDialog.cs
- OperandQuery.cs
- BufferedStream.cs
- WindowsSpinner.cs
- RepeaterItemEventArgs.cs
- Int32Converter.cs
- DataGridHyperlinkColumn.cs
- ControlUtil.cs
- InheritanceAttribute.cs
- SingleResultAttribute.cs
- PasswordBoxAutomationPeer.cs
- PhysicalFontFamily.cs
- sitestring.cs
- ActivityCodeDomReferenceService.cs
- SmiRequestExecutor.cs
- LinqDataSourceView.cs
- PersonalizationStateInfo.cs
- TextBoxLine.cs
- Compiler.cs
- GridViewDeletedEventArgs.cs
- XPathBuilder.cs
- Win32.cs
- MouseDevice.cs
- WebPartConnection.cs
- PropertyCollection.cs
- ToolboxBitmapAttribute.cs
- AssemblyBuilderData.cs
- PerformanceCounterScope.cs
- CatalogPartCollection.cs
- IndexerNameAttribute.cs
- SerTrace.cs
- IndexExpression.cs
- HwndSourceParameters.cs
- CompositeKey.cs
- SamlDelegatingWriter.cs
- ResourceProviderFactory.cs
- StrongNameHelpers.cs
- EntityDataSourceDataSelection.cs
- ProtocolsConfiguration.cs
- XmlTextEncoder.cs
- SamlNameIdentifierClaimResource.cs
- EventWaitHandle.cs
- WindowsFormsHelpers.cs
- SqlXml.cs
- RolePrincipal.cs
- RadioButtonList.cs
- TextPointerBase.cs
- DataGridViewColumn.cs
- SqlWebEventProvider.cs
- GenericsInstances.cs
- DetailsViewPagerRow.cs
- ComboBox.cs
- StrokeRenderer.cs
- LinkUtilities.cs
- isolationinterop.cs
- ThreadSafeList.cs
- AutomationTextAttribute.cs
- StringToken.cs
- FixedTextContainer.cs
- CdpEqualityComparer.cs
- XmlTextAttribute.cs
- StrokeSerializer.cs
- QueryPageSettingsEventArgs.cs
- OdbcConnectionStringbuilder.cs
- RegexRunner.cs
- Form.cs
- UnionExpr.cs
- GetIndexBinder.cs
- EndpointInfo.cs
- HotSpot.cs
- Parsers.cs
- SystemFonts.cs
- EmbeddedMailObject.cs
- SQLMoney.cs
- StringAttributeCollection.cs
- CustomTypeDescriptor.cs
- RightsManagementInformation.cs
- NullableIntMinMaxAggregationOperator.cs
- IdentityHolder.cs
- Converter.cs
- AndMessageFilter.cs
- ActiveXContainer.cs
- NewArray.cs
- HttpListenerRequest.cs
- UniformGrid.cs
- SmiGettersStream.cs
- XmlSchemaComplexContentExtension.cs
- AutomationPattern.cs
- SQLDateTime.cs
- Freezable.cs
- CircleEase.cs
- FilterEventArgs.cs
- ZeroOpNode.cs
- Literal.cs
- ValidationPropertyAttribute.cs
- KeyedHashAlgorithm.cs
- GridViewRowPresenterBase.cs
- TextStore.cs
- Utility.cs
- ClientRuntimeConfig.cs