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
- TableRow.cs
- WebPermission.cs
- Int32AnimationBase.cs
- DurableInstancingOptions.cs
- DriveNotFoundException.cs
- GridViewUpdatedEventArgs.cs
- Thread.cs
- SessionIDManager.cs
- EventMappingSettings.cs
- CompiledIdentityConstraint.cs
- RuntimeConfig.cs
- SpotLight.cs
- ListViewDeletedEventArgs.cs
- LinkArea.cs
- AssemblyInfo.cs
- CalendarDataBindingHandler.cs
- InputScope.cs
- RowToFieldTransformer.cs
- HitTestWithGeometryDrawingContextWalker.cs
- SmiEventStream.cs
- StylusPointPropertyId.cs
- MobileUITypeEditor.cs
- Misc.cs
- BindingExpression.cs
- MergeFailedEvent.cs
- SqlParameterizer.cs
- PageCatalogPartDesigner.cs
- ProgressBar.cs
- DbTypeMap.cs
- MemoryPressure.cs
- HtmlTextArea.cs
- ComUdtElement.cs
- ProbeMatchesCD1.cs
- SettingsBindableAttribute.cs
- JoinSymbol.cs
- SSmlParser.cs
- WorkflowApplicationCompletedEventArgs.cs
- CompatibleIComparer.cs
- BooleanToVisibilityConverter.cs
- ZipIOCentralDirectoryFileHeader.cs
- FixedDocumentPaginator.cs
- StackSpiller.Generated.cs
- SmtpNetworkElement.cs
- SchemaImporterExtensionElementCollection.cs
- WebPartDescription.cs
- XmlSchemaSequence.cs
- PaintValueEventArgs.cs
- SessionEndingCancelEventArgs.cs
- KeySplineConverter.cs
- TypeUtil.cs
- RangeContentEnumerator.cs
- Stacktrace.cs
- BooleanConverter.cs
- AspNetCacheProfileAttribute.cs
- OrthographicCamera.cs
- CheckedPointers.cs
- StorageScalarPropertyMapping.cs
- Speller.cs
- ToolStripManager.cs
- TagPrefixInfo.cs
- AdPostCacheSubstitution.cs
- WebBrowsableAttribute.cs
- ColorConvertedBitmap.cs
- RegistryPermission.cs
- AbstractDataSvcMapFileLoader.cs
- DataGridColumn.cs
- OutputCache.cs
- ScalarOps.cs
- SqlUserDefinedTypeAttribute.cs
- DecoderReplacementFallback.cs
- CodeAttachEventStatement.cs
- UIElementHelper.cs
- TemplateControlBuildProvider.cs
- TagMapInfo.cs
- HttpContext.cs
- EntityContainerRelationshipSetEnd.cs
- WebResourceUtil.cs
- PackageRelationship.cs
- StylusPointPropertyUnit.cs
- CheckBoxRenderer.cs
- SQLInt32Storage.cs
- Merger.cs
- TextEditorTables.cs
- Int32Collection.cs
- SessionState.cs
- CaseInsensitiveHashCodeProvider.cs
- IconConverter.cs
- ManagementExtension.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- UidManager.cs
- TimeSpanStorage.cs
- FamilyTypefaceCollection.cs
- CapabilitiesUse.cs
- ZipIOModeEnforcingStream.cs
- WebReferencesBuildProvider.cs
- WinFormsSpinner.cs
- StylusPointPropertyInfoDefaults.cs
- PackageRelationshipCollection.cs
- SystemIPAddressInformation.cs
- HorizontalAlignConverter.cs