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
- DocumentXPathNavigator.cs
- InfoCardTrace.cs
- XsltQilFactory.cs
- WasHttpModulesInstallComponent.cs
- TypeEnumerableViewSchema.cs
- QuaternionAnimation.cs
- IntegerValidator.cs
- DbExpressionBuilder.cs
- X509CertificateCollection.cs
- WebServiceErrorEvent.cs
- UnknownBitmapEncoder.cs
- ItemCollection.cs
- Char.cs
- HttpModuleActionCollection.cs
- SynchronizationScope.cs
- DesignerDataRelationship.cs
- DomainLiteralReader.cs
- HtmlInputControl.cs
- IsolationInterop.cs
- FileDialogCustomPlacesCollection.cs
- Debug.cs
- SqlParameterizer.cs
- IndexedGlyphRun.cs
- TimeSpanConverter.cs
- RadioButton.cs
- IdentitySection.cs
- PerformanceCounterPermission.cs
- DataGridViewImageColumn.cs
- WmfPlaceableFileHeader.cs
- uribuilder.cs
- WeakEventTable.cs
- MobileControlsSectionHandler.cs
- URLString.cs
- ClrProviderManifest.cs
- LoginUtil.cs
- Visual.cs
- SqlClientMetaDataCollectionNames.cs
- _ContextAwareResult.cs
- InvokeDelegate.cs
- DesignerExtenders.cs
- Rect3DValueSerializer.cs
- FilteredAttributeCollection.cs
- DefaultAutoFieldGenerator.cs
- PathSegmentCollection.cs
- IconConverter.cs
- FlowLayout.cs
- AccessControlEntry.cs
- DbConnectionPoolOptions.cs
- AssemblyUtil.cs
- TranslateTransform.cs
- DynamicPropertyHolder.cs
- Root.cs
- PropertyValueEditor.cs
- PrintPageEvent.cs
- _ChunkParse.cs
- OlePropertyStructs.cs
- PropertyBuilder.cs
- FrameworkObject.cs
- AspNetHostingPermission.cs
- SettingsProviderCollection.cs
- TaiwanCalendar.cs
- XslAstAnalyzer.cs
- WebControl.cs
- DBAsyncResult.cs
- FileUtil.cs
- DiagnosticsConfigurationHandler.cs
- SystemBrushes.cs
- WorkflowEnvironment.cs
- ExpressionBindingCollection.cs
- OutputScope.cs
- SimpleRecyclingCache.cs
- CompatibleComparer.cs
- ExternalException.cs
- NavigatingCancelEventArgs.cs
- SmtpFailedRecipientsException.cs
- SafeBitVector32.cs
- BamlLocalizabilityResolver.cs
- ConfigurationException.cs
- InfiniteIntConverter.cs
- XmlSchemaSequence.cs
- View.cs
- ServiceHostingEnvironment.cs
- Parameter.cs
- OciLobLocator.cs
- OutputCache.cs
- AssemblyBuilderData.cs
- TypeDescriptionProvider.cs
- versioninfo.cs
- Select.cs
- RadialGradientBrush.cs
- CachedTypeface.cs
- DesignerProperties.cs
- AssemblySettingAttributes.cs
- DataAccessor.cs
- TableCell.cs
- BufferModesCollection.cs
- SqlTransaction.cs
- DrawListViewColumnHeaderEventArgs.cs
- ReaderWriterLockWrapper.cs
- EntitySqlQueryCacheEntry.cs