Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Misc / GDI / WindowsSolidBrush.cs / 1 / WindowsSolidBrush.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- #if WINFORMS_NAMESPACE namespace System.Windows.Forms.Internal #elif DRAWING_NAMESPACE namespace System.Drawing.Internal #else namespace System.Experimental.Gdi #endif { using System; using System.Internal; using System.Runtime.InteropServices; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Globalization; #if WINFORMS_PUBLIC_GRAPHICS_LIBRARY public #else internal #endif sealed class WindowsSolidBrush : WindowsBrush { protected override void CreateBrush() { IntPtr nativeHandle = IntSafeNativeMethods.CreateSolidBrush(ColorTranslator.ToWin32( this.Color)); if(nativeHandle == IntPtr.Zero) // Don't use Debug.Assert, DbgUtil.GetLastErrorStr would always be evaluated. { Debug.Fail("CreateSolidBrush failed : " + DbgUtil.GetLastErrorStr()); } this.NativeHandle = nativeHandle; // sets the handle value in the base class. } public WindowsSolidBrush(DeviceContext dc) : base(dc) { // CreateBrush() on demand. } public WindowsSolidBrush(DeviceContext dc, Color color) : base( dc, color ) { // CreateBrush() on demand. } public override object Clone() { return new WindowsSolidBrush(this.DC, this.Color); } public override string ToString() { return String.Format( CultureInfo.InvariantCulture, "{0}: Color={1}", this.GetType().Name, this.Color ); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- #if WINFORMS_NAMESPACE namespace System.Windows.Forms.Internal #elif DRAWING_NAMESPACE namespace System.Drawing.Internal #else namespace System.Experimental.Gdi #endif { using System; using System.Internal; using System.Runtime.InteropServices; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Globalization; #if WINFORMS_PUBLIC_GRAPHICS_LIBRARY public #else internal #endif sealed class WindowsSolidBrush : WindowsBrush { protected override void CreateBrush() { IntPtr nativeHandle = IntSafeNativeMethods.CreateSolidBrush(ColorTranslator.ToWin32( this.Color)); if(nativeHandle == IntPtr.Zero) // Don't use Debug.Assert, DbgUtil.GetLastErrorStr would always be evaluated. { Debug.Fail("CreateSolidBrush failed : " + DbgUtil.GetLastErrorStr()); } this.NativeHandle = nativeHandle; // sets the handle value in the base class. } public WindowsSolidBrush(DeviceContext dc) : base(dc) { // CreateBrush() on demand. } public WindowsSolidBrush(DeviceContext dc, Color color) : base( dc, color ) { // CreateBrush() on demand. } public override object Clone() { return new WindowsSolidBrush(this.DC, this.Color); } public override string ToString() { return String.Format( CultureInfo.InvariantCulture, "{0}: Color={1}", this.GetType().Name, this.Color ); } } } // 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
- StringCollectionEditor.cs
- HandleCollector.cs
- WmlFormAdapter.cs
- DataPagerFieldCollection.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- NativeCppClassAttribute.cs
- ALinqExpressionVisitor.cs
- CryptoApi.cs
- StreamAsIStream.cs
- OleDbEnumerator.cs
- IdentityManager.cs
- OpCopier.cs
- URLBuilder.cs
- ParserStreamGeometryContext.cs
- Calendar.cs
- QuotedStringFormatReader.cs
- TitleStyle.cs
- TokenBasedSetEnumerator.cs
- HtmlInputReset.cs
- XpsDocument.cs
- ManipulationDeltaEventArgs.cs
- EntityDataSourceMemberPath.cs
- DataServiceRequestArgs.cs
- RangeValidator.cs
- ExpressionBuilder.cs
- XamlClipboardData.cs
- DbConnectionClosed.cs
- DelayedRegex.cs
- SqlNotificationRequest.cs
- SchemaImporterExtension.cs
- SystemInfo.cs
- UnitySerializationHolder.cs
- ExecutionTracker.cs
- SqlCacheDependency.cs
- InputMethod.cs
- ExpandCollapseProviderWrapper.cs
- TextDecorationCollection.cs
- EntityTypeEmitter.cs
- FixedSOMContainer.cs
- SystemIPInterfaceProperties.cs
- StorageEntitySetMapping.cs
- PeerObject.cs
- DefaultBinder.cs
- DataBindingCollection.cs
- ProjectionPlan.cs
- DesignRelation.cs
- Transform.cs
- CategoryNameCollection.cs
- ArgumentOutOfRangeException.cs
- XmlTextEncoder.cs
- BaseCodeDomTreeGenerator.cs
- DesignTimeXamlWriter.cs
- FontDialog.cs
- ReverseQueryOperator.cs
- BoundsDrawingContextWalker.cs
- QilParameter.cs
- PersonalizableAttribute.cs
- TreeNodeCollectionEditorDialog.cs
- StorageTypeMapping.cs
- SafeBuffer.cs
- TextHidden.cs
- KnownBoxes.cs
- ExceptQueryOperator.cs
- diagnosticsswitches.cs
- URI.cs
- ParsedAttributeCollection.cs
- TextBlock.cs
- TextTreeObjectNode.cs
- SortExpressionBuilder.cs
- SimpleFileLog.cs
- Registry.cs
- SmtpClient.cs
- TraceListener.cs
- RawAppCommandInputReport.cs
- DefaultEventAttribute.cs
- ParameterInfo.cs
- TraceContext.cs
- BitStack.cs
- LinkedList.cs
- ListenerSessionConnectionReader.cs
- WsiProfilesElement.cs
- NameSpaceEvent.cs
- BinHexEncoding.cs
- TextEditorCopyPaste.cs
- DbProviderFactoriesConfigurationHandler.cs
- VerticalAlignConverter.cs
- DataStorage.cs
- KnownColorTable.cs
- sqlcontext.cs
- BufferedReceiveManager.cs
- SizeValueSerializer.cs
- StartUpEventArgs.cs
- UnmanagedMarshal.cs
- ISAPIRuntime.cs
- StreamWriter.cs
- _KerberosClient.cs
- XPathExpr.cs
- DataGridView.cs
- PageSetupDialog.cs
- DataServiceBuildProvider.cs