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
- DelegateArgumentReference.cs
- StackOverflowException.cs
- LineBreakRecord.cs
- WebDescriptionAttribute.cs
- SystemGatewayIPAddressInformation.cs
- sqlcontext.cs
- WindowsImpersonationContext.cs
- DesignerForm.cs
- FamilyTypefaceCollection.cs
- RegionIterator.cs
- ImageList.cs
- DrawToolTipEventArgs.cs
- RoutedEventHandlerInfo.cs
- ObjectDisposedException.cs
- messageonlyhwndwrapper.cs
- _ConnectionGroup.cs
- PublisherMembershipCondition.cs
- LineGeometry.cs
- WizardPanelChangingEventArgs.cs
- PageParserFilter.cs
- DataGridTableCollection.cs
- TextEndOfParagraph.cs
- KeyboardDevice.cs
- ObjectStateEntryDbDataRecord.cs
- EntityDataSourceState.cs
- StringExpressionSet.cs
- XmlDataSourceNodeDescriptor.cs
- URIFormatException.cs
- LayoutTable.cs
- PrintPreviewControl.cs
- SqlErrorCollection.cs
- ResourceBinder.cs
- EntityTransaction.cs
- UICuesEvent.cs
- entityreference_tresulttype.cs
- SimplePropertyEntry.cs
- WebPartRestoreVerb.cs
- QueryOutputWriter.cs
- linebase.cs
- GridEntryCollection.cs
- XmlBinaryWriterSession.cs
- EnumerableRowCollection.cs
- BaseParser.cs
- SQLMoney.cs
- HealthMonitoringSection.cs
- EndpointNameMessageFilter.cs
- DtdParser.cs
- ToolStripSeparatorRenderEventArgs.cs
- ChainedAsyncResult.cs
- ReachVisualSerializerAsync.cs
- CollectionConverter.cs
- Math.cs
- ListViewTableRow.cs
- DataBindingExpressionBuilder.cs
- HuffCodec.cs
- ListMarkerSourceInfo.cs
- ResourceReferenceKeyNotFoundException.cs
- RegionData.cs
- SR.cs
- BindStream.cs
- LiteralControl.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- DataGridLinkButton.cs
- SubMenuStyle.cs
- XmlAttributeOverrides.cs
- OdbcConnectionString.cs
- AssociationType.cs
- FigureParagraph.cs
- StyleSelector.cs
- VisualStyleElement.cs
- SqlUtils.cs
- DesignerExtenders.cs
- IndexingContentUnit.cs
- DocumentSchemaValidator.cs
- Types.cs
- WebServiceErrorEvent.cs
- CursorConverter.cs
- NegationPusher.cs
- FrameworkEventSource.cs
- ClientFormsAuthenticationCredentials.cs
- PKCS1MaskGenerationMethod.cs
- SkewTransform.cs
- DataSourceViewSchemaConverter.cs
- SQLDecimalStorage.cs
- SchemaTableColumn.cs
- Array.cs
- ThemeableAttribute.cs
- ListViewCancelEventArgs.cs
- SectionInput.cs
- RenamedEventArgs.cs
- ToolStripEditorManager.cs
- OracleEncoding.cs
- ListCollectionView.cs
- WebServiceHostFactory.cs
- WindowsEditBoxRange.cs
- SecurityTokenRequirement.cs
- ProcessHostConfigUtils.cs
- DataReceivedEventArgs.cs
- DataGridViewMethods.cs
- DataViewSetting.cs