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
- CalendarDay.cs
- EventWaitHandle.cs
- Expressions.cs
- RuntimeIdentifierPropertyAttribute.cs
- SmtpException.cs
- MultiSelectRootGridEntry.cs
- DataGridCell.cs
- ValidationPropertyAttribute.cs
- ProvideValueServiceProvider.cs
- ImageDrawing.cs
- SqlDataSourceFilteringEventArgs.cs
- SetIterators.cs
- OdbcConnection.cs
- ViewSimplifier.cs
- BuilderInfo.cs
- ProvidersHelper.cs
- SubMenuStyleCollection.cs
- CacheManager.cs
- ServiceSecurityAuditBehavior.cs
- DBAsyncResult.cs
- XmlSignificantWhitespace.cs
- Matrix.cs
- CreateUserWizard.cs
- SimpleHandlerBuildProvider.cs
- PngBitmapEncoder.cs
- ListenerElementsCollection.cs
- Control.cs
- PropertyState.cs
- Context.cs
- BasicHttpMessageSecurity.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- HttpRawResponse.cs
- EnumType.cs
- DbConnectionPoolGroupProviderInfo.cs
- log.cs
- RegistrationServices.cs
- HostProtectionPermission.cs
- ResumeStoryboard.cs
- _IPv6Address.cs
- UpWmlMobileTextWriter.cs
- ToolStripDropTargetManager.cs
- InternalCache.cs
- StylusEventArgs.cs
- TextEditorTables.cs
- XPathItem.cs
- BrushMappingModeValidation.cs
- EventDescriptorCollection.cs
- PolicyManager.cs
- BypassElementCollection.cs
- XmlSchema.cs
- ScrollEventArgs.cs
- DrawingGroupDrawingContext.cs
- WinEventQueueItem.cs
- ScrollProviderWrapper.cs
- RadialGradientBrush.cs
- MemberDescriptor.cs
- DynamicUpdateCommand.cs
- BlurBitmapEffect.cs
- Point3DKeyFrameCollection.cs
- SmiEventSink_Default.cs
- XmlQualifiedNameTest.cs
- CodeGroup.cs
- FileBasedResourceGroveler.cs
- DynamicValueConverter.cs
- DbProviderFactory.cs
- DataGridViewButtonColumn.cs
- Control.cs
- PropertyDescriptorGridEntry.cs
- Metadata.cs
- WindowsProgressbar.cs
- CheckBoxStandardAdapter.cs
- DockingAttribute.cs
- FlowDocumentView.cs
- XamlClipboardData.cs
- IDQuery.cs
- DispatcherExceptionFilterEventArgs.cs
- XmlTextAttribute.cs
- ParameterInfo.cs
- CatchBlock.cs
- ValueConversionAttribute.cs
- AtomPub10ServiceDocumentFormatter.cs
- Shape.cs
- GacUtil.cs
- BitmapEffectDrawing.cs
- Style.cs
- _NtlmClient.cs
- MethodImplAttribute.cs
- HwndProxyElementProvider.cs
- TypeForwardedFromAttribute.cs
- ValidationSummary.cs
- EditingCoordinator.cs
- Baml2006Reader.cs
- FaultReason.cs
- SectionRecord.cs
- ReachIDocumentPaginatorSerializerAsync.cs
- ChannelManager.cs
- StateWorkerRequest.cs
- HandoffBehavior.cs
- InheritanceContextChangedEventManager.cs
- BinaryMessageEncodingBindingElement.cs