Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Misc / GDI / WindowsSolidBrush.cs / 1305376 / WindowsSolidBrush.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- #if [....]_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; using System.Runtime.Versioning; #if [....]_PUBLIC_GRAPHICS_LIBRARY public #else internal #endif sealed class WindowsSolidBrush : WindowsBrush { [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public WindowsSolidBrush(DeviceContext dc) : base(dc) { // CreateBrush() on demand. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public WindowsSolidBrush(DeviceContext dc, Color color) : base( dc, color ) { // CreateBrush() on demand. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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 [....]_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; using System.Runtime.Versioning; #if [....]_PUBLIC_GRAPHICS_LIBRARY public #else internal #endif sealed class WindowsSolidBrush : WindowsBrush { [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public WindowsSolidBrush(DeviceContext dc) : base(dc) { // CreateBrush() on demand. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] public WindowsSolidBrush(DeviceContext dc, Color color) : base( dc, color ) { // CreateBrush() on demand. } [ResourceExposure(ResourceScope.Process)] [ResourceConsumption(ResourceScope.Process)] 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
- WorkItem.cs
- LiteralControl.cs
- DataServiceRequestOfT.cs
- ProtectedConfigurationProviderCollection.cs
- WindowsSolidBrush.cs
- FixedTextPointer.cs
- PngBitmapDecoder.cs
- SafeBitVector32.cs
- Size3D.cs
- DataGridItemCollection.cs
- ReflectPropertyDescriptor.cs
- SynchronousChannelMergeEnumerator.cs
- XPathBuilder.cs
- Part.cs
- Activity.cs
- SimpleTypeResolver.cs
- FontFamily.cs
- RepeatButtonAutomationPeer.cs
- EncryptedKey.cs
- Wizard.cs
- ServiceAppDomainAssociationProvider.cs
- DesignerHierarchicalDataSourceView.cs
- DecoderBestFitFallback.cs
- ToolboxItemAttribute.cs
- precedingsibling.cs
- SqlWebEventProvider.cs
- GiveFeedbackEventArgs.cs
- DesignerCapabilities.cs
- HasCopySemanticsAttribute.cs
- HttpCookie.cs
- ThreadBehavior.cs
- ThousandthOfEmRealDoubles.cs
- TimeoutHelper.cs
- WebPartUtil.cs
- RectConverter.cs
- LicenseContext.cs
- FormViewModeEventArgs.cs
- Point4DValueSerializer.cs
- ObjectAnimationUsingKeyFrames.cs
- SelectedDatesCollection.cs
- RemotingAttributes.cs
- CloseCryptoHandleRequest.cs
- SourceChangedEventArgs.cs
- GuidelineCollection.cs
- ThreadNeutralSemaphore.cs
- ResourceAttributes.cs
- Manipulation.cs
- WinFormsUtils.cs
- WindowsFormsSynchronizationContext.cs
- SerializableAttribute.cs
- MaterialCollection.cs
- SlipBehavior.cs
- DataControlFieldHeaderCell.cs
- XamlContextStack.cs
- DataIdProcessor.cs
- WindowsRichEdit.cs
- StateValidator.cs
- StateManagedCollection.cs
- ByteRangeDownloader.cs
- Calendar.cs
- PointCollectionValueSerializer.cs
- ItemChangedEventArgs.cs
- MdbDataFileEditor.cs
- PrimarySelectionGlyph.cs
- ManagementQuery.cs
- EditorServiceContext.cs
- CapabilitiesRule.cs
- PrefixQName.cs
- DataRow.cs
- ReadOnlyDataSource.cs
- Solver.cs
- CatalogZone.cs
- PnrpPeerResolverBindingElement.cs
- EventDescriptor.cs
- Root.cs
- InfoCardRequestException.cs
- WebSysDescriptionAttribute.cs
- CategoryEditor.cs
- Comparer.cs
- DisplayMemberTemplateSelector.cs
- TiffBitmapEncoder.cs
- WebPartsPersonalization.cs
- XmlSchemaAnyAttribute.cs
- CollectionViewSource.cs
- XPathChildIterator.cs
- SubpageParaClient.cs
- Context.cs
- PersonalizationProviderCollection.cs
- WCFServiceClientProxyGenerator.cs
- ReflectPropertyDescriptor.cs
- DrawingDrawingContext.cs
- UriTemplateVariablePathSegment.cs
- DynamicExpression.cs
- iisPickupDirectory.cs
- X509ChainPolicy.cs
- DeclarativeConditionsCollection.cs
- AsymmetricCryptoHandle.cs
- DocumentSequenceHighlightLayer.cs
- SmiContextFactory.cs
- SetStateDesigner.cs