Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CommonUI / System / Drawing / Advanced / HatchBrush.cs / 1 / HatchBrush.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /*************************************************************************\ * * Copyright (c) 1998-1999, Microsoft Corp. All Rights Reserved. * * Module Name: * * HatchBrush.cs * * Abstract: * * COM+ wrapper for GDI+ HatchBrush objects * * Revision History: * * 12/15/1998 [....] * Created it. * \**************************************************************************/ namespace System.Drawing.Drawing2D { using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.Drawing; using System.ComponentModel; using Microsoft.Win32; using System.Drawing.Internal; /** * Represent a HatchBrush brush object */ ////// /// Defines a rectangular brush with a hatch /// style, a foreground color, and a background color. /// public sealed class HatchBrush : Brush { /** * Create a new hatch brush object */ ////// /// public HatchBrush(HatchStyle hatchstyle, Color foreColor) : this(hatchstyle, foreColor, Color.FromArgb( (int) unchecked( (int) 0xff000000) ) ) { } ////// Initializes a new instance of the ///class with the specified and foreground color. /// /// /// public HatchBrush(HatchStyle hatchstyle, Color foreColor, Color backColor) { IntPtr brush = IntPtr.Zero; int status = SafeNativeMethods.Gdip.GdipCreateHatchBrush((int) hatchstyle, foreColor.ToArgb(), backColor.ToArgb(), out brush); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); SetNativeBrush(brush); } ////// Initializes a new instance of the ///class with the specified , /// foreground color, and background color. /// /// Constructor to initialize this object from a GDI+ native reference. /// internal HatchBrush(IntPtr nativeBrush ) { Debug.Assert( nativeBrush != IntPtr.Zero, "Initializing native brush with null." ); SetNativeBrush( nativeBrush ); } ////// /// Creates an exact copy of this public override object Clone() { IntPtr cloneBrush = IntPtr.Zero; int status = SafeNativeMethods.Gdip.GdipCloneBrush(new HandleRef(this, this.NativeBrush), out cloneBrush); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return new HatchBrush(cloneBrush); } /** * Get hatch brush object attributes */ ///. /// /// /// Gets the hatch style of this public HatchStyle HatchStyle { get { int hatchStyle = 0; int status = SafeNativeMethods.Gdip.GdipGetHatchStyle(new HandleRef(this, this.NativeBrush), out hatchStyle); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return (HatchStyle) hatchStyle; } } ///. /// /// /// Gets the color of hatch lines drawn by this /// public Color ForegroundColor { get { int forecol; int status = SafeNativeMethods.Gdip.GdipGetHatchForegroundColor(new HandleRef(this, this.NativeBrush), out forecol); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return Color.FromArgb(forecol); } } ///. /// /// /// public Color BackgroundColor { get { int backcol; int status = SafeNativeMethods.Gdip.GdipGetHatchBackgroundColor(new HandleRef(this, this.NativeBrush), out backcol); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); return Color.FromArgb(backcol); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved./// Gets the color of spaces between the hatch /// lines drawn by this ///. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- validationstate.cs
- _ConnectStream.cs
- ViewPort3D.cs
- DbCommandTree.cs
- WindowsSspiNegotiation.cs
- ProgressBarHighlightConverter.cs
- DesigntimeLicenseContextSerializer.cs
- SessionParameter.cs
- ScrollBarRenderer.cs
- CodeCastExpression.cs
- DataGridTableStyleMappingNameEditor.cs
- Splitter.cs
- EntityConnection.cs
- TypedRowHandler.cs
- DragDrop.cs
- StructuredProperty.cs
- SiteMapPath.cs
- DataGridViewCellStateChangedEventArgs.cs
- ThreadStateException.cs
- FtpCachePolicyElement.cs
- WebEncodingValidator.cs
- ResXResourceReader.cs
- FileDetails.cs
- RoleGroup.cs
- Attributes.cs
- ResourcesGenerator.cs
- MasterPage.cs
- MSAANativeProvider.cs
- PerfService.cs
- DataGridItem.cs
- WeakHashtable.cs
- DataGridViewCellConverter.cs
- WebRequest.cs
- MobileListItemCollection.cs
- ItemChangedEventArgs.cs
- DefaultEventAttribute.cs
- Tokenizer.cs
- AdapterDictionary.cs
- TypeDelegator.cs
- CodeGroup.cs
- Model3DGroup.cs
- SimpleFieldTemplateUserControl.cs
- MenuBase.cs
- EntityDataSourceState.cs
- SQLInt64Storage.cs
- DoubleAnimationUsingPath.cs
- DBDataPermission.cs
- SqlConnectionPoolGroupProviderInfo.cs
- mediapermission.cs
- XmlSortKeyAccumulator.cs
- DataGridViewRowPostPaintEventArgs.cs
- BatchParser.cs
- OdbcPermission.cs
- AutoCompleteStringCollection.cs
- InternalsVisibleToAttribute.cs
- XmlUTF8TextReader.cs
- StrokeIntersection.cs
- UnaryNode.cs
- PackUriHelper.cs
- ReferentialConstraint.cs
- LiteralControl.cs
- ObjectDataSourceDisposingEventArgs.cs
- StatusBarAutomationPeer.cs
- PublisherMembershipCondition.cs
- isolationinterop.cs
- FontNamesConverter.cs
- OleDbFactory.cs
- HtmlElement.cs
- PipelineModuleStepContainer.cs
- PageSettings.cs
- ObjectConverter.cs
- PathSegment.cs
- InfoCardServiceInstallComponent.cs
- BamlReader.cs
- SelectionRange.cs
- HttpModuleActionCollection.cs
- Comparer.cs
- XmlCountingReader.cs
- KeyValuePairs.cs
- EndpointNameMessageFilter.cs
- SystemException.cs
- CancellationTokenSource.cs
- DelayedRegex.cs
- EdmRelationshipRoleAttribute.cs
- _ConnectOverlappedAsyncResult.cs
- OptimisticConcurrencyException.cs
- SymbolType.cs
- ContextMenu.cs
- BrowserDefinition.cs
- WindowsSolidBrush.cs
- DesignBindingPropertyDescriptor.cs
- AnnotationObservableCollection.cs
- XmlDataSource.cs
- FormClosingEvent.cs
- DesignerTransaction.cs
- StrongNameUtility.cs
- FocusWithinProperty.cs
- PathFigure.cs
- SessionState.cs
- WebProxyScriptElement.cs