Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- CuspData.cs
- CodeEntryPointMethod.cs
- SingleStorage.cs
- LambdaCompiler.Logical.cs
- ToolBar.cs
- SoapBinding.cs
- Schedule.cs
- EndpointReference.cs
- DomNameTable.cs
- Highlights.cs
- SortedList.cs
- WindowsGrip.cs
- DefaultEventAttribute.cs
- WebReferencesBuildProvider.cs
- MonitoringDescriptionAttribute.cs
- ZipIORawDataFileBlock.cs
- UrlMappingsSection.cs
- SchemaObjectWriter.cs
- Control.cs
- XmlWrappingReader.cs
- HttpPostedFile.cs
- Stylesheet.cs
- RoleManagerSection.cs
- DesignerForm.cs
- DeclaredTypeElement.cs
- SamlEvidence.cs
- KnownTypesHelper.cs
- TreeViewItem.cs
- PrintEvent.cs
- CounterSample.cs
- BamlRecordHelper.cs
- CellParagraph.cs
- StickyNoteHelper.cs
- Logging.cs
- MD5CryptoServiceProvider.cs
- ApplicationServiceHelper.cs
- DrawListViewItemEventArgs.cs
- PermissionToken.cs
- MultiTargetingUtil.cs
- ForceCopyBuildProvider.cs
- ADRoleFactoryConfiguration.cs
- MeasureData.cs
- PropertyMapper.cs
- ResourceReferenceKeyNotFoundException.cs
- XPathNavigator.cs
- FixedPageStructure.cs
- DateRangeEvent.cs
- WeakHashtable.cs
- MediaCommands.cs
- ScrollEventArgs.cs
- _ShellExpression.cs
- TextEditorContextMenu.cs
- TimeEnumHelper.cs
- XamlFilter.cs
- ConfigXmlCDataSection.cs
- TimeSpanConverter.cs
- FormsAuthenticationTicket.cs
- WebPartConnectionsCancelEventArgs.cs
- AssemblyContextControlItem.cs
- PrintEvent.cs
- HighlightVisual.cs
- XmlNamespaceManager.cs
- RowsCopiedEventArgs.cs
- ServiceParser.cs
- RayHitTestParameters.cs
- ScriptControlManager.cs
- RepeaterDataBoundAdapter.cs
- ResourceManagerWrapper.cs
- TextBox.cs
- ApplicationHost.cs
- SchemaElementDecl.cs
- RadioButton.cs
- OracleBoolean.cs
- MemberMaps.cs
- AnimationClock.cs
- SerializationObjectManager.cs
- SrgsNameValueTag.cs
- CompilerErrorCollection.cs
- GeometryDrawing.cs
- ActiveXHost.cs
- NativeMethods.cs
- ProfileParameter.cs
- Exception.cs
- AssertFilter.cs
- WorkflowServiceHostFactory.cs
- LinqDataSourceDisposeEventArgs.cs
- xsdvalidator.cs
- EmbeddedMailObjectsCollection.cs
- RegexInterpreter.cs
- TextSelectionProcessor.cs
- PartialTrustVisibleAssembliesSection.cs
- wgx_sdk_version.cs
- PolyQuadraticBezierSegment.cs
- VirtualDirectoryMapping.cs
- ConfigurationPermission.cs
- ScrollContentPresenter.cs
- DbParameterCollection.cs
- XmlSchemaSubstitutionGroup.cs
- IdleTimeoutMonitor.cs
- SamlSecurityToken.cs