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
- Brush.cs
- BitmapImage.cs
- BehaviorEditorPart.cs
- Item.cs
- DetailsViewUpdatedEventArgs.cs
- WriteFileContext.cs
- CollectionsUtil.cs
- PropertyDescriptorComparer.cs
- Convert.cs
- SourceCollection.cs
- TablePattern.cs
- SqlConnectionPoolProviderInfo.cs
- DateTimeOffset.cs
- MessageDescriptionCollection.cs
- ListViewItemEventArgs.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- NamespaceEmitter.cs
- ControlEvent.cs
- TreeNodeBinding.cs
- NameNode.cs
- DataBoundControl.cs
- AssemblySettingAttributes.cs
- DocumentOrderQuery.cs
- DelayedRegex.cs
- BuildProvidersCompiler.cs
- SyndicationSerializer.cs
- IsolatedStorageException.cs
- DataGridViewEditingControlShowingEventArgs.cs
- CommandHelpers.cs
- XmlSortKeyAccumulator.cs
- ClientBuildManagerCallback.cs
- ManipulationLogic.cs
- WebConfigurationHost.cs
- StylusButtonEventArgs.cs
- CommandTreeTypeHelper.cs
- AnnotationObservableCollection.cs
- EntityClassGenerator.cs
- SqlDataAdapter.cs
- XPathParser.cs
- BufferedMessageData.cs
- AppSettingsExpressionBuilder.cs
- ContextProperty.cs
- RightNameExpirationInfoPair.cs
- CodeExporter.cs
- UrlPath.cs
- EntityDescriptor.cs
- BeginEvent.cs
- XmlSerializerAssemblyAttribute.cs
- GridViewDeletedEventArgs.cs
- TableLayoutCellPaintEventArgs.cs
- OdbcError.cs
- ValidateNames.cs
- BindingMAnagerBase.cs
- ReflectEventDescriptor.cs
- WebPartDisplayMode.cs
- TextTreeRootNode.cs
- XamlBrushSerializer.cs
- VisualStateGroup.cs
- SqlBooleanMismatchVisitor.cs
- DescendantOverDescendantQuery.cs
- ScriptIgnoreAttribute.cs
- DrawListViewColumnHeaderEventArgs.cs
- CommentEmitter.cs
- CorrelationManager.cs
- Int16Storage.cs
- MobileResource.cs
- Socket.cs
- XmlChildNodes.cs
- WebServiceTypeData.cs
- SoapElementAttribute.cs
- NotSupportedException.cs
- ChtmlCommandAdapter.cs
- InteropEnvironment.cs
- ResourceExpressionBuilder.cs
- SiteIdentityPermission.cs
- FlatButtonAppearance.cs
- ObjectDataSource.cs
- DataGridViewTextBoxCell.cs
- FixedPage.cs
- PointKeyFrameCollection.cs
- TimelineCollection.cs
- NewArrayExpression.cs
- HttpServerVarsCollection.cs
- X509Certificate.cs
- peersecuritysettings.cs
- AspProxy.cs
- RuleEngine.cs
- IisTraceListener.cs
- StdValidatorsAndConverters.cs
- SaveFileDialog.cs
- mediapermission.cs
- RecordConverter.cs
- NullableDoubleAverageAggregationOperator.cs
- SafePEFileHandle.cs
- RoleGroupCollection.cs
- RightsManagementInformation.cs
- DynamicPropertyHolder.cs
- SynchronizationContext.cs
- InputReportEventArgs.cs
- AssemblyBuilder.cs