Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / CommonUI / System / Drawing / Advanced / AdjustableArrowCap.cs / 1 / AdjustableArrowCap.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*************************************************************************\
*
* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* AdjustableArrowCap.cs
*
* Abstract:
*
* Native GDI+ AdjustableArrowCap structure.
*
* Revision History:
*
* 3/14/2k [....]
* Created it.
*
\**************************************************************************/
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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataGridViewElement.cs
- MILUtilities.cs
- SelectionProviderWrapper.cs
- BevelBitmapEffect.cs
- ListViewUpdatedEventArgs.cs
- BinaryReader.cs
- InternalControlCollection.cs
- CharAnimationBase.cs
- WindowsComboBox.cs
- ThreadPoolTaskScheduler.cs
- HttpWebResponse.cs
- AccessDataSource.cs
- filewebresponse.cs
- CodeConstructor.cs
- StylusButton.cs
- ContextProperty.cs
- CollectionViewGroup.cs
- AsymmetricKeyExchangeFormatter.cs
- ToolZone.cs
- PrePrepareMethodAttribute.cs
- __TransparentProxy.cs
- Types.cs
- RequestResizeEvent.cs
- IntSecurity.cs
- ACL.cs
- ConfigPathUtility.cs
- XmlComplianceUtil.cs
- Journaling.cs
- MasterPage.cs
- CommandLibraryHelper.cs
- Italic.cs
- SQLBoolean.cs
- SemanticAnalyzer.cs
- MobileRedirect.cs
- NativeMethods.cs
- FloaterBaseParaClient.cs
- ProtectedProviderSettings.cs
- ProviderBase.cs
- ClientRuntimeConfig.cs
- XmlSchemaGroup.cs
- RangeContentEnumerator.cs
- BinaryFormatterSinks.cs
- WebSysDescriptionAttribute.cs
- SystemUnicastIPAddressInformation.cs
- DispatcherExceptionEventArgs.cs
- SiteMembershipCondition.cs
- sqlnorm.cs
- Transactions.cs
- ThaiBuddhistCalendar.cs
- _DigestClient.cs
- SimpleHandlerBuildProvider.cs
- WSFederationHttpBinding.cs
- GlyphRunDrawing.cs
- CellIdBoolean.cs
- TypeDependencyAttribute.cs
- ProfileGroupSettings.cs
- RankException.cs
- AuthenticationModuleElement.cs
- ForwardPositionQuery.cs
- CreateParams.cs
- CfgRule.cs
- DbMetaDataCollectionNames.cs
- DataSetMappper.cs
- SamlAuthenticationStatement.cs
- WebPartActionVerb.cs
- Bezier.cs
- XmlReflectionMember.cs
- CloseCryptoHandleRequest.cs
- UpdatePanelTriggerCollection.cs
- ManagedWndProcTracker.cs
- Stylesheet.cs
- FlowDecisionDesigner.xaml.cs
- ModifiableIteratorCollection.cs
- StreamInfo.cs
- EditorZone.cs
- StringUtil.cs
- SvcMapFile.cs
- HelpProvider.cs
- DesignConnection.cs
- DataGridSortCommandEventArgs.cs
- WrappedIUnknown.cs
- XsltInput.cs
- FixedLineResult.cs
- ConfigDefinitionUpdates.cs
- XmlWrappingReader.cs
- Verify.cs
- DirectoryLocalQuery.cs
- XmlDataSourceView.cs
- EnumUnknown.cs
- FixedSOMPageElement.cs
- NodeFunctions.cs
- TextProperties.cs
- IncrementalCompileAnalyzer.cs
- DispatchProxy.cs
- PrefixHandle.cs
- PerfCounterSection.cs
- Timeline.cs
- SiteMapNodeItemEventArgs.cs
- ToolStripItemGlyph.cs
- Error.cs