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
- CodePrimitiveExpression.cs
- DaylightTime.cs
- FullTextState.cs
- PlatformNotSupportedException.cs
- Rectangle.cs
- DummyDataSource.cs
- MarkupObject.cs
- SafeProcessHandle.cs
- OleDbParameter.cs
- CodeRegionDirective.cs
- HttpClientCertificate.cs
- DBSqlParser.cs
- QilFactory.cs
- DataSourceUtil.cs
- AbsoluteQuery.cs
- WindowsIPAddress.cs
- MetadataItemSerializer.cs
- WSMessageEncoding.cs
- StorageBasedPackageProperties.cs
- ProxySimple.cs
- ActivityDesigner.cs
- ExclusiveHandle.cs
- IndexerNameAttribute.cs
- BaseAppDomainProtocolHandler.cs
- ProxyManager.cs
- WindowInteractionStateTracker.cs
- DataServiceConfiguration.cs
- ToolBarButtonClickEvent.cs
- PropertyInfoSet.cs
- ReadOnlyMetadataCollection.cs
- Span.cs
- CallSite.cs
- DrawingGroupDrawingContext.cs
- TcpServerChannel.cs
- EncoderExceptionFallback.cs
- SynchronizedKeyedCollection.cs
- ListViewPagedDataSource.cs
- ByteAnimationUsingKeyFrames.cs
- CookieParameter.cs
- Trace.cs
- BitmapEffect.cs
- ECDsa.cs
- HttpFileCollection.cs
- _AuthenticationState.cs
- X509Certificate2.cs
- DesignerActionHeaderItem.cs
- MetadataExporter.cs
- Convert.cs
- Camera.cs
- WebUtility.cs
- StickyNoteContentControl.cs
- VisualTreeUtils.cs
- StateRuntime.cs
- SystemPens.cs
- Matrix3D.cs
- MemberAccessException.cs
- NativeMethods.cs
- Attributes.cs
- ObfuscateAssemblyAttribute.cs
- ScriptRegistrationManager.cs
- activationcontext.cs
- TypeRefElement.cs
- AssemblySettingAttributes.cs
- ValidationError.cs
- Button.cs
- FactoryMaker.cs
- InkPresenterAutomationPeer.cs
- TextSimpleMarkerProperties.cs
- ConsoleTraceListener.cs
- ClientRuntimeConfig.cs
- TableRowCollection.cs
- ContextQuery.cs
- BrowserInteropHelper.cs
- ResourceIDHelper.cs
- FactoryGenerator.cs
- IIS7WorkerRequest.cs
- CompilationRelaxations.cs
- InputLanguageEventArgs.cs
- ScrollPatternIdentifiers.cs
- SiteMapNode.cs
- InplaceBitmapMetadataWriter.cs
- FileDataSourceCache.cs
- SchemaTableColumn.cs
- DrawListViewColumnHeaderEventArgs.cs
- SaveFileDialog.cs
- ReferenceSchema.cs
- X509ChainPolicy.cs
- ReflectTypeDescriptionProvider.cs
- OleDbCommand.cs
- prompt.cs
- EventHandlingScope.cs
- ProcessHost.cs
- HttpResponseBase.cs
- RSAPKCS1KeyExchangeFormatter.cs
- WebPartAddingEventArgs.cs
- ScrollItemPattern.cs
- ConsoleCancelEventArgs.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- Decorator.cs
- RandomNumberGenerator.cs