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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- URLMembershipCondition.cs
- DrawingCollection.cs
- ControlDesigner.cs
- Bookmark.cs
- WebBrowserHelper.cs
- InstanceOwner.cs
- IEnumerable.cs
- ExpressionValueEditor.cs
- RuleSetCollection.cs
- ToolStripItemCollection.cs
- ExternalDataExchangeService.cs
- GroupBoxAutomationPeer.cs
- WebPartCloseVerb.cs
- Rect3DValueSerializer.cs
- relpropertyhelper.cs
- SecurityRuntime.cs
- RoutedEventArgs.cs
- UnsafePeerToPeerMethods.cs
- SafeHandle.cs
- uribuilder.cs
- WindowProviderWrapper.cs
- NumberAction.cs
- LongValidatorAttribute.cs
- CryptoConfig.cs
- ToolStripSettings.cs
- InkCollectionBehavior.cs
- CFStream.cs
- XmlSchemaInfo.cs
- DateTimeParse.cs
- Item.cs
- OpenTypeLayout.cs
- IItemProperties.cs
- CompositeFontParser.cs
- ImageClickEventArgs.cs
- WebPartConnectionsCancelEventArgs.cs
- SrgsNameValueTag.cs
- DataContractSerializerMessageContractImporter.cs
- HelloMessage11.cs
- FactoryMaker.cs
- TextRunCacheImp.cs
- TextTabProperties.cs
- XmlSchema.cs
- securitycriticaldataClass.cs
- ToolStripSplitButton.cs
- IHttpResponseInternal.cs
- BamlMapTable.cs
- PageThemeParser.cs
- DataRowView.cs
- _RequestCacheProtocol.cs
- Block.cs
- RadioButton.cs
- ReadOnlyPermissionSet.cs
- ButtonAutomationPeer.cs
- ApplicationManager.cs
- HotSpotCollection.cs
- ToolStrip.cs
- InitializationEventAttribute.cs
- CurrencyWrapper.cs
- TextSimpleMarkerProperties.cs
- URLMembershipCondition.cs
- AsyncPostBackTrigger.cs
- EntityCommand.cs
- SqlCacheDependencySection.cs
- XmlTextReaderImpl.cs
- IconBitmapDecoder.cs
- LZCodec.cs
- CoTaskMemSafeHandle.cs
- ConstNode.cs
- TemplateContent.cs
- CacheOutputQuery.cs
- FileLevelControlBuilderAttribute.cs
- Image.cs
- TemplatedEditableDesignerRegion.cs
- UIElement.cs
- Model3DGroup.cs
- ToolTipAutomationPeer.cs
- GetChildSubtree.cs
- XmlDictionaryReader.cs
- SiteMapNodeCollection.cs
- MergePropertyDescriptor.cs
- HttpCapabilitiesBase.cs
- IndexerNameAttribute.cs
- LinqDataSourceView.cs
- PersonalizationProviderCollection.cs
- AsyncParams.cs
- X509IssuerSerialKeyIdentifierClause.cs
- UnionCodeGroup.cs
- PointHitTestResult.cs
- _OverlappedAsyncResult.cs
- Pen.cs
- Predicate.cs
- SmiMetaDataProperty.cs
- AttributeSetAction.cs
- WebServiceReceive.cs
- XmlSerializerFactory.cs
- Ppl.cs
- HttpCacheVary.cs
- TemplateControlCodeDomTreeGenerator.cs
- ChunkedMemoryStream.cs
- ParseChildrenAsPropertiesAttribute.cs