Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- GradientStopCollection.cs
- Application.cs
- ContentFileHelper.cs
- NamespaceList.cs
- ReadingWritingEntityEventArgs.cs
- ACE.cs
- FieldBuilder.cs
- SqlReferenceCollection.cs
- MonitorWrapper.cs
- UnsafeNetInfoNativeMethods.cs
- RTLAwareMessageBox.cs
- ProgressChangedEventArgs.cs
- BlurBitmapEffect.cs
- ParameterReplacerVisitor.cs
- PerfCounterSection.cs
- COMException.cs
- HtmlButton.cs
- ParsedRoute.cs
- LocatorGroup.cs
- ClientRuntime.cs
- EncoderExceptionFallback.cs
- AutoGeneratedField.cs
- SerializerDescriptor.cs
- BlockCollection.cs
- EventMappingSettings.cs
- RuntimeResourceSet.cs
- PropertyDescriptorCollection.cs
- DataGridColumnReorderingEventArgs.cs
- RelationshipEndCollection.cs
- Vector.cs
- ServiceOperationParameter.cs
- PrefixHandle.cs
- TagNameToTypeMapper.cs
- DataBindingList.cs
- SystemResourceHost.cs
- InternalDispatchObject.cs
- BooleanExpr.cs
- ToggleButtonAutomationPeer.cs
- EmptyWorkItem.cs
- DataBoundControlHelper.cs
- MemberDescriptor.cs
- PropertyItem.cs
- XmlLanguage.cs
- ButtonField.cs
- RemotingHelper.cs
- mactripleDES.cs
- Int32Rect.cs
- SizeAnimationBase.cs
- DocumentCollection.cs
- XmlSequenceWriter.cs
- CustomErrorCollection.cs
- VectorAnimationBase.cs
- SqlVisitor.cs
- MetaDataInfo.cs
- CLSCompliantAttribute.cs
- X509CertificateClaimSet.cs
- ListBoxItemWrapperAutomationPeer.cs
- NamespaceQuery.cs
- Stylesheet.cs
- SqlCacheDependency.cs
- EventProviderClassic.cs
- TextSegment.cs
- RepeaterCommandEventArgs.cs
- WebChannelFactory.cs
- Point4D.cs
- LingerOption.cs
- SqlClientWrapperSmiStream.cs
- CodeAssignStatement.cs
- DataGridViewColumnTypePicker.cs
- ValidateNames.cs
- RootContext.cs
- BmpBitmapEncoder.cs
- DataGridToolTip.cs
- EasingFunctionBase.cs
- AdCreatedEventArgs.cs
- UniformGrid.cs
- ProfileWorkflowElement.cs
- SingleObjectCollection.cs
- ConnectionManagementSection.cs
- ConfigErrorGlyph.cs
- RectConverter.cs
- StylusTip.cs
- BinaryMessageFormatter.cs
- BamlResourceSerializer.cs
- ConnectionOrientedTransportElement.cs
- VectorAnimationUsingKeyFrames.cs
- Button.cs
- TemplatedMailWebEventProvider.cs
- ProfessionalColorTable.cs
- SqlDuplicator.cs
- ConsumerConnectionPoint.cs
- COM2EnumConverter.cs
- TextServicesCompartmentContext.cs
- UiaCoreApi.cs
- objectresult_tresulttype.cs
- ValidationError.cs
- DefaultBindingPropertyAttribute.cs
- FormViewDeletedEventArgs.cs
- DeflateStream.cs
- ReferencedCollectionType.cs