Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CommonUI / System / Drawing / Advanced / AdjustableArrowCap.cs / 2 / AdjustableArrowCap.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Drawing.Drawing2D {
using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Internal;
using System.Runtime.InteropServices;
///
///
/// Represents an adjustable arrow-shaped line
/// cap.
///
public sealed class AdjustableArrowCap : CustomLineCap {
internal AdjustableArrowCap(IntPtr nativeCap) :
base(nativeCap) {}
///
///
/// Initializes a new instance of the class with the specified width and
/// height.
///
public AdjustableArrowCap(float width,
float height) :
this(width, height, true) {}
///
///
///
/// Initializes a new instance of the class with the specified width,
/// height, and fill property.
///
///
public AdjustableArrowCap(float width,
float height,
bool isFilled)
{
IntPtr nativeCap = IntPtr.Zero;
int status = SafeNativeMethods.Gdip.GdipCreateAdjustableArrowCap(
height, width, isFilled, out nativeCap);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
SetNativeLineCap(nativeCap);
}
private void _SetHeight(float height)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapHeight(new HandleRef(this, nativeCap), height);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetHeight()
{
float height;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapHeight(new HandleRef(this, nativeCap), out height);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return height;
}
///
///
/// Gets or sets the height of the arrow cap.
///
public float Height
{
get { return _GetHeight(); }
set { _SetHeight(value); }
}
private void _SetWidth(float width)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapWidth(new HandleRef(this, nativeCap), width);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetWidth()
{
float width;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapWidth(new HandleRef(this, nativeCap), out width);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return width;
}
///
///
/// Gets or sets the width of the arrow cap.
///
public float Width
{
get { return _GetWidth(); }
set { _SetWidth(value); }
}
private void _SetMiddleInset(float middleInset)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapMiddleInset(new HandleRef(this, nativeCap), middleInset);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetMiddleInset()
{
float middleInset;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapMiddleInset(new HandleRef(this, nativeCap), out middleInset);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return middleInset;
}
///
///
///
/// Gets or set the number of pixels between the outline of the arrow cap and the fill.
///
///
public float MiddleInset
{
get { return _GetMiddleInset(); }
set { _SetMiddleInset(value); }
}
private void _SetFillState(bool isFilled)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapFillState(new HandleRef(this, nativeCap), isFilled);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private bool _IsFilled()
{
bool isFilled = false;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapFillState(new HandleRef(this, nativeCap), out isFilled);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return isFilled;
}
///
///
/// Gets or sets a value indicating whether the
/// arrow cap is filled.
///
public bool Filled
{
get { return _IsFilled(); }
set { _SetFillState(value); }
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Drawing.Drawing2D {
using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Internal;
using System.Runtime.InteropServices;
///
///
/// Represents an adjustable arrow-shaped line
/// cap.
///
public sealed class AdjustableArrowCap : CustomLineCap {
internal AdjustableArrowCap(IntPtr nativeCap) :
base(nativeCap) {}
///
///
/// Initializes a new instance of the class with the specified width and
/// height.
///
public AdjustableArrowCap(float width,
float height) :
this(width, height, true) {}
///
///
///
/// Initializes a new instance of the class with the specified width,
/// height, and fill property.
///
///
public AdjustableArrowCap(float width,
float height,
bool isFilled)
{
IntPtr nativeCap = IntPtr.Zero;
int status = SafeNativeMethods.Gdip.GdipCreateAdjustableArrowCap(
height, width, isFilled, out nativeCap);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
SetNativeLineCap(nativeCap);
}
private void _SetHeight(float height)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapHeight(new HandleRef(this, nativeCap), height);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetHeight()
{
float height;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapHeight(new HandleRef(this, nativeCap), out height);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return height;
}
///
///
/// Gets or sets the height of the arrow cap.
///
public float Height
{
get { return _GetHeight(); }
set { _SetHeight(value); }
}
private void _SetWidth(float width)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapWidth(new HandleRef(this, nativeCap), width);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetWidth()
{
float width;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapWidth(new HandleRef(this, nativeCap), out width);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return width;
}
///
///
/// Gets or sets the width of the arrow cap.
///
public float Width
{
get { return _GetWidth(); }
set { _SetWidth(value); }
}
private void _SetMiddleInset(float middleInset)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapMiddleInset(new HandleRef(this, nativeCap), middleInset);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private float _GetMiddleInset()
{
float middleInset;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapMiddleInset(new HandleRef(this, nativeCap), out middleInset);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return middleInset;
}
///
///
///
/// Gets or set the number of pixels between the outline of the arrow cap and the fill.
///
///
public float MiddleInset
{
get { return _GetMiddleInset(); }
set { _SetMiddleInset(value); }
}
private void _SetFillState(bool isFilled)
{
int status = SafeNativeMethods.Gdip.GdipSetAdjustableArrowCapFillState(new HandleRef(this, nativeCap), isFilled);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
}
private bool _IsFilled()
{
bool isFilled = false;
int status = SafeNativeMethods.Gdip.GdipGetAdjustableArrowCapFillState(new HandleRef(this, nativeCap), out isFilled);
if (status != SafeNativeMethods.Gdip.Ok)
throw SafeNativeMethods.Gdip.StatusException(status);
return isFilled;
}
///
///
/// Gets or sets a value indicating whether the
/// arrow cap is filled.
///
public bool Filled
{
get { return _IsFilled(); }
set { _SetFillState(value); }
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SecurityKeyIdentifier.cs
- CalendarAutomationPeer.cs
- SingleObjectCollection.cs
- ToolStripSeparator.cs
- Menu.cs
- WebPartZoneBase.cs
- PageTheme.cs
- CodeEntryPointMethod.cs
- StyleHelper.cs
- AuthorizationSection.cs
- RuleRefElement.cs
- WindowsPen.cs
- SectionInformation.cs
- SafeUserTokenHandle.cs
- SimpleType.cs
- MappedMetaModel.cs
- DesignerProperties.cs
- ContainerControlDesigner.cs
- XmlSchemaComplexContentRestriction.cs
- ElementUtil.cs
- FactoryGenerator.cs
- XmlEncodedRawTextWriter.cs
- CultureTableRecord.cs
- SchemaElementLookUpTable.cs
- EventQueueState.cs
- EndOfStreamException.cs
- ArrayHelper.cs
- Size.cs
- DynamicDataRouteHandler.cs
- ValidatedControlConverter.cs
- ConnectorRouter.cs
- GifBitmapDecoder.cs
- WindowsListViewGroupHelper.cs
- _WinHttpWebProxyDataBuilder.cs
- ItemMap.cs
- Lease.cs
- SerializationEventsCache.cs
- ToolStripArrowRenderEventArgs.cs
- ResourceReferenceExpressionConverter.cs
- OleDbConnection.cs
- SurrogateEncoder.cs
- TreeViewCancelEvent.cs
- PtsHost.cs
- ContentElement.cs
- MemberExpression.cs
- CanonicalFormWriter.cs
- XmlUtilWriter.cs
- EndpointAddress.cs
- RowToFieldTransformer.cs
- GrammarBuilderPhrase.cs
- RSAOAEPKeyExchangeDeformatter.cs
- CreateParams.cs
- ToolStripPanelRenderEventArgs.cs
- CodeDefaultValueExpression.cs
- ToolStripControlHost.cs
- NameTable.cs
- NativeStructs.cs
- FormViewDeleteEventArgs.cs
- ReferencedType.cs
- XmlImplementation.cs
- ColumnTypeConverter.cs
- DateTimePicker.cs
- SymDocumentType.cs
- CodeTypeOfExpression.cs
- LinqDataSourceValidationException.cs
- ProfileEventArgs.cs
- DataViewSettingCollection.cs
- AssemblyFilter.cs
- CatalogZoneBase.cs
- ReliableMessagingVersionConverter.cs
- LostFocusEventManager.cs
- SizeConverter.cs
- ListBindableAttribute.cs
- NotifyCollectionChangedEventArgs.cs
- CodeRegionDirective.cs
- ElementProxy.cs
- CompilationRelaxations.cs
- WeakReference.cs
- ProgressBar.cs
- ActivityBindForm.Designer.cs
- KnownColorTable.cs
- ServiceElementCollection.cs
- CanonicalFontFamilyReference.cs
- SafeFileHandle.cs
- TraceSource.cs
- OrthographicCamera.cs
- ResourceManagerWrapper.cs
- XmlSerializationWriter.cs
- ControlCachePolicy.cs
- Highlights.cs
- ApplicationGesture.cs
- FontCollection.cs
- EqualityArray.cs
- IndentTextWriter.cs
- figurelengthconverter.cs
- OpacityConverter.cs
- ExpressionEditor.cs
- DataGridColumn.cs
- MaskedTextProvider.cs
- _SingleItemRequestCache.cs