Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CommonUI / System / Drawing / Advanced / HatchBrush.cs / 2 / HatchBrush.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- 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. //------------------------------------------------------------------------------ ///// Gets the color of spaces between the hatch /// lines drawn by this ///. /// // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- 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./// 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
- SizeConverter.cs
- ReadOnlyCollectionBase.cs
- DbTypeMap.cs
- NameTable.cs
- Registry.cs
- TransformProviderWrapper.cs
- CharUnicodeInfo.cs
- ClientCultureInfo.cs
- XamlClipboardData.cs
- UseLicense.cs
- TraceFilter.cs
- EntityContainerEmitter.cs
- fixedPageContentExtractor.cs
- DirectoryNotFoundException.cs
- HwndProxyElementProvider.cs
- diagnosticsswitches.cs
- VisualTarget.cs
- SoapCodeExporter.cs
- EditBehavior.cs
- HybridDictionary.cs
- GenericUriParser.cs
- MultiPropertyDescriptorGridEntry.cs
- TextServicesPropertyRanges.cs
- HtmlInputHidden.cs
- RichListBox.cs
- PropVariant.cs
- FlowDocumentView.cs
- StateDesigner.cs
- DebugView.cs
- UDPClient.cs
- IdentifierCollection.cs
- Calendar.cs
- WeakReference.cs
- XmlSerializableServices.cs
- WebConvert.cs
- VisualStyleInformation.cs
- ObjectViewFactory.cs
- SafeThreadHandle.cs
- ThrowOnMultipleAssignment.cs
- XmlSchemaResource.cs
- DefinitionBase.cs
- AutomationIdentifier.cs
- ToggleButtonAutomationPeer.cs
- DialogResultConverter.cs
- SetUserLanguageRequest.cs
- StreamReader.cs
- ListViewCommandEventArgs.cs
- ImageConverter.cs
- String.cs
- InputScopeAttribute.cs
- NameValueFileSectionHandler.cs
- DataBindingList.cs
- SimpleRecyclingCache.cs
- DBSqlParserColumn.cs
- Module.cs
- PropertyValueChangedEvent.cs
- TextTreeText.cs
- CriticalFinalizerObject.cs
- PerformanceCountersElement.cs
- ObjectList.cs
- QilTypeChecker.cs
- RoleManagerModule.cs
- PointF.cs
- RIPEMD160Managed.cs
- XMLDiffLoader.cs
- PrimarySelectionGlyph.cs
- EntityDataSourceChangedEventArgs.cs
- Maps.cs
- StylusPointPropertyInfoDefaults.cs
- ApplicationGesture.cs
- StylusPointProperties.cs
- XmlDataImplementation.cs
- PrivateFontCollection.cs
- ReferentialConstraintRoleElement.cs
- Evidence.cs
- CodeSubDirectory.cs
- Debugger.cs
- EntityKey.cs
- CompilationUtil.cs
- PeerApplicationLaunchInfo.cs
- TypeLibraryHelper.cs
- _ScatterGatherBuffers.cs
- FrameworkPropertyMetadata.cs
- QilIterator.cs
- DataGridViewRowsAddedEventArgs.cs
- DataBindingHandlerAttribute.cs
- RowTypePropertyElement.cs
- MaterialCollection.cs
- Visual3D.cs
- WindowInteropHelper.cs
- ReadOnlyCollection.cs
- SoapObjectInfo.cs
- TimelineGroup.cs
- WebPartEditorCancelVerb.cs
- AuthenticationModulesSection.cs
- RadioButtonFlatAdapter.cs
- BrowserCapabilitiesCodeGenerator.cs
- XmlSchemaAnnotation.cs
- SqlWriter.cs
- OleDbCommand.cs