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
- SessionStateContainer.cs
- NameValueCollection.cs
- ClientSideProviderDescription.cs
- SystemTcpConnection.cs
- DebugTrace.cs
- Int64Animation.cs
- SqlUtil.cs
- PropertyGridEditorPart.cs
- StickyNoteHelper.cs
- ImageListImageEditor.cs
- NCryptSafeHandles.cs
- DBSqlParser.cs
- XXXInfos.cs
- ProtectedProviderSettings.cs
- EmptyEnumerable.cs
- ContextDataSourceContextData.cs
- NavigatingCancelEventArgs.cs
- PersistenceIOParticipant.cs
- COAUTHIDENTITY.cs
- RootBrowserWindow.cs
- WindowsListViewScroll.cs
- ListMarkerSourceInfo.cs
- SessionEndingEventArgs.cs
- ListContractAdapter.cs
- RoutedEvent.cs
- DataGridViewDataConnection.cs
- Base64Encoder.cs
- CodeGeneratorAttribute.cs
- AutoGeneratedFieldProperties.cs
- mediaeventargs.cs
- CodeDomSerializationProvider.cs
- StubHelpers.cs
- CatalogPartCollection.cs
- RTLAwareMessageBox.cs
- PropertyManager.cs
- AttachedPropertyBrowsableAttribute.cs
- XNodeNavigator.cs
- Stroke.cs
- GridViewColumnHeaderAutomationPeer.cs
- ShaderEffect.cs
- IConvertible.cs
- TaiwanLunisolarCalendar.cs
- EdmProviderManifest.cs
- X509Certificate.cs
- CmsInterop.cs
- SettingsProperty.cs
- MarkedHighlightComponent.cs
- PartialCachingControl.cs
- ComponentRenameEvent.cs
- VisemeEventArgs.cs
- ConfigErrorGlyph.cs
- XmlParser.cs
- TransformerConfigurationWizardBase.cs
- Encoder.cs
- DataGridState.cs
- BindableTemplateBuilder.cs
- XmlSchemaAttributeGroupRef.cs
- ProgressBarRenderer.cs
- CompositeActivityMarkupSerializer.cs
- SiteMembershipCondition.cs
- LineUtil.cs
- VirtualizingPanel.cs
- IdentityModelDictionary.cs
- CodeCommentStatementCollection.cs
- SafeMarshalContext.cs
- ClientRoleProvider.cs
- SmtpTransport.cs
- RangeValuePatternIdentifiers.cs
- TypeSystemHelpers.cs
- ExpressionPrefixAttribute.cs
- SelectionRangeConverter.cs
- FigureHelper.cs
- SubMenuStyleCollection.cs
- TdsParser.cs
- SelectionHighlightInfo.cs
- WebPartDeleteVerb.cs
- BinHexEncoder.cs
- MenuTracker.cs
- PathTooLongException.cs
- FontConverter.cs
- COM2PropertyDescriptor.cs
- SyndicationDeserializer.cs
- Stroke.cs
- SoapExtensionReflector.cs
- HandlerBase.cs
- Normalizer.cs
- StreamAsIStream.cs
- GuidTagList.cs
- OraclePermission.cs
- NativeObjectSecurity.cs
- AttachmentCollection.cs
- XmlDataSource.cs
- DocumentXPathNavigator.cs
- DataGridViewButtonColumn.cs
- RowUpdatingEventArgs.cs
- AssemblyAttributes.cs
- PersonalizablePropertyEntry.cs
- ConfigurationCollectionAttribute.cs
- PropertyMap.cs
- UnknownBitmapDecoder.cs