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
- FixedStringLookup.cs
- GridItemPattern.cs
- Misc.cs
- SimpleTypeResolver.cs
- RandomDelaySendsAsyncResult.cs
- validation.cs
- InnerItemCollectionView.cs
- ProgressBarBrushConverter.cs
- TailCallAnalyzer.cs
- GeometryGroup.cs
- FormViewCommandEventArgs.cs
- SoapReflectionImporter.cs
- RotationValidation.cs
- FormClosedEvent.cs
- DbReferenceCollection.cs
- ObjectQuery.cs
- ILGenerator.cs
- ClientApiGenerator.cs
- ZipIOExtraFieldPaddingElement.cs
- EditingScopeUndoUnit.cs
- TreeBuilderBamlTranslator.cs
- AbsoluteQuery.cs
- MenuItemBindingCollection.cs
- safelinkcollection.cs
- AttributeCollection.cs
- PersistenceTypeAttribute.cs
- TimelineCollection.cs
- SqlGatherProducedAliases.cs
- ConfigurationStrings.cs
- SimpleMailWebEventProvider.cs
- DiagnosticTrace.cs
- ContextMenuService.cs
- KeySpline.cs
- Normalization.cs
- MailWebEventProvider.cs
- AutoResetEvent.cs
- X509IssuerSerialKeyIdentifierClause.cs
- NamespaceEmitter.cs
- ExtenderControl.cs
- XmlSchemaAnyAttribute.cs
- PlainXmlSerializer.cs
- InvalidOperationException.cs
- _CommandStream.cs
- ErrorWrapper.cs
- brushes.cs
- XNodeSchemaApplier.cs
- LogSwitch.cs
- TdsParserStateObject.cs
- WsdlBuildProvider.cs
- ThousandthOfEmRealDoubles.cs
- dsa.cs
- AddInEnvironment.cs
- ActionMessageFilterTable.cs
- SafeCoTaskMem.cs
- IProducerConsumerCollection.cs
- ObjectMemberMapping.cs
- ApplicationContext.cs
- _DomainName.cs
- EditCommandColumn.cs
- UserNameSecurityTokenProvider.cs
- ExtensionElementCollection.cs
- ValidateNames.cs
- DefaultAssemblyResolver.cs
- SchemaReference.cs
- BuildProviderCollection.cs
- CmsInterop.cs
- OdbcStatementHandle.cs
- Pair.cs
- IUnknownConstantAttribute.cs
- Currency.cs
- XhtmlTextWriter.cs
- DurableTimerExtension.cs
- CharConverter.cs
- ActivityCompletionCallbackWrapper.cs
- AppDomainResourcePerfCounters.cs
- HtmlInputButton.cs
- HttpCapabilitiesSectionHandler.cs
- PolicyStatement.cs
- Int32EqualityComparer.cs
- DropShadowBitmapEffect.cs
- MissingSatelliteAssemblyException.cs
- X509Certificate.cs
- AnnotationComponentChooser.cs
- ToolStripCollectionEditor.cs
- AccessControlEntry.cs
- ControlLocalizer.cs
- CookieHandler.cs
- Slider.cs
- basecomparevalidator.cs
- WorkflowEnvironment.cs
- OleDbException.cs
- UserControlParser.cs
- ControlUtil.cs
- InternalTypeHelper.cs
- TableLayoutPanelDesigner.cs
- SubclassTypeValidatorAttribute.cs
- WebPartTransformerCollection.cs
- BitmapImage.cs
- HttpRuntime.cs
- X509Extension.cs