Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / CommonUI / System / Drawing / PropertyItemInternal.cs / 1 / 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
- DesignerSerializationVisibilityAttribute.cs
- TimeSpanSecondsConverter.cs
- ServiceBehaviorAttribute.cs
- CodeTypeReferenceCollection.cs
- InternalTypeHelper.cs
- DummyDataSource.cs
- ImageSourceValueSerializer.cs
- WebPartVerbsEventArgs.cs
- LinqDataSourceView.cs
- TableAdapterManagerHelper.cs
- RevocationPoint.cs
- StructuralType.cs
- DataRowView.cs
- CultureSpecificStringDictionary.cs
- EditorAttribute.cs
- HtmlButton.cs
- KernelTypeValidation.cs
- ThrowHelper.cs
- GlobalEventManager.cs
- EditingMode.cs
- SerTrace.cs
- BitmapDownload.cs
- MailWebEventProvider.cs
- SupportsEventValidationAttribute.cs
- RightsManagementInformation.cs
- DataObjectMethodAttribute.cs
- Authorization.cs
- WindowsStartMenu.cs
- ComponentConverter.cs
- ColumnWidthChangedEvent.cs
- Utils.cs
- CharacterMetrics.cs
- CatalogPart.cs
- PropertyBuilder.cs
- PersonalizationProviderCollection.cs
- WindowsFormsSectionHandler.cs
- StoreContentChangedEventArgs.cs
- KnownColorTable.cs
- _AcceptOverlappedAsyncResult.cs
- BufferModesCollection.cs
- ParseNumbers.cs
- ListViewEditEventArgs.cs
- DataColumnPropertyDescriptor.cs
- DetailsViewRowCollection.cs
- Vector3DIndependentAnimationStorage.cs
- PeerNameRecord.cs
- VisualTreeHelper.cs
- OutputCacheProfileCollection.cs
- SessionIDManager.cs
- RequestResizeEvent.cs
- Hashtable.cs
- XsltLoader.cs
- IOException.cs
- Exceptions.cs
- MailBnfHelper.cs
- Tool.cs
- columnmapkeybuilder.cs
- designeractionlistschangedeventargs.cs
- CqlLexer.cs
- SignatureGenerator.cs
- CodeAccessPermission.cs
- Annotation.cs
- PerformanceCounter.cs
- CodeDOMProvider.cs
- GetWinFXPath.cs
- TransformValueSerializer.cs
- PointAnimationClockResource.cs
- ResolveNameEventArgs.cs
- RegexMatchCollection.cs
- LinkClickEvent.cs
- ResourceDescriptionAttribute.cs
- BindingExpressionUncommonField.cs
- DoubleAnimation.cs
- ScriptReferenceEventArgs.cs
- httpstaticobjectscollection.cs
- SqlConnectionHelper.cs
- DispatcherFrame.cs
- JsonDataContract.cs
- BaseCollection.cs
- DBDataPermissionAttribute.cs
- CapabilitiesPattern.cs
- ToolStripProgressBar.cs
- MetabaseSettingsIis7.cs
- SecureStringHasher.cs
- EncodingTable.cs
- SiteMapDataSource.cs
- ResourceExpressionBuilder.cs
- XmlQueryOutput.cs
- DataServiceQuery.cs
- SQLResource.cs
- HttpVersion.cs
- SchemaObjectWriter.cs
- DependencyPropertyKind.cs
- BaseTreeIterator.cs
- ResourcePermissionBase.cs
- StreamWithDictionary.cs
- SamlSubject.cs
- SoapInteropTypes.cs
- GeometryDrawing.cs
- EdmItemError.cs