Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- SignatureHelper.cs
- GridViewRowEventArgs.cs
- SocketStream.cs
- RawStylusInputCustomData.cs
- EpmTargetPathSegment.cs
- UriTemplateVariableQueryValue.cs
- ListManagerBindingsCollection.cs
- translator.cs
- XmlSchemaExternal.cs
- CqlParserHelpers.cs
- Identity.cs
- BitmapEffect.cs
- ErrorWrapper.cs
- GroupBox.cs
- PtsPage.cs
- EdmItemCollection.OcAssemblyCache.cs
- Serializer.cs
- EventProvider.cs
- TextSelection.cs
- GridEntry.cs
- SafeBitVector32.cs
- TableRowGroup.cs
- DefaultSerializationProviderAttribute.cs
- HttpConfigurationContext.cs
- StringUtil.cs
- SafeEventLogWriteHandle.cs
- VBCodeProvider.cs
- AssemblyResourceLoader.cs
- ValidationErrorInfo.cs
- SymmetricCryptoHandle.cs
- CurrentChangingEventArgs.cs
- MimePart.cs
- EmissiveMaterial.cs
- ProviderBase.cs
- InternalBase.cs
- DBCommand.cs
- DataGridHeaderBorder.cs
- VersionValidator.cs
- Adorner.cs
- ResourceReader.cs
- EntityWithKeyStrategy.cs
- XmlSchemaSimpleType.cs
- DecoderBestFitFallback.cs
- LongTypeConverter.cs
- BridgeDataReader.cs
- WhitespaceSignificantCollectionAttribute.cs
- DocumentXPathNavigator.cs
- IisTraceWebEventProvider.cs
- InvalidComObjectException.cs
- RegexTypeEditor.cs
- CodeDomDesignerLoader.cs
- TextProperties.cs
- webclient.cs
- StaticContext.cs
- OleDbSchemaGuid.cs
- Resources.Designer.cs
- MultiView.cs
- RelationshipEndMember.cs
- ClientBuildManager.cs
- DiscoveryOperationContextExtension.cs
- HostUtils.cs
- ProcessModelSection.cs
- EmptyReadOnlyDictionaryInternal.cs
- TypeBuilderInstantiation.cs
- QilIterator.cs
- KeyProperty.cs
- RectangleHotSpot.cs
- RadialGradientBrush.cs
- ColumnBinding.cs
- ColumnMapProcessor.cs
- ContentWrapperAttribute.cs
- ObjectDataSource.cs
- SqlProcedureAttribute.cs
- PaintEvent.cs
- RMPublishingDialog.cs
- ResponseBodyWriter.cs
- WebPartCancelEventArgs.cs
- LineProperties.cs
- Accessors.cs
- XPathEmptyIterator.cs
- LeaseManager.cs
- Unit.cs
- ZoomingMessageFilter.cs
- SafeFileMappingHandle.cs
- EventRecordWrittenEventArgs.cs
- XmlNotation.cs
- UserMapPath.cs
- RequestUriProcessor.cs
- PasswordRecovery.cs
- StateManagedCollection.cs
- AuthenticatingEventArgs.cs
- WebPartConnection.cs
- WebServiceTypeData.cs
- SystemBrushes.cs
- ListViewGroupItemCollection.cs
- GlyphInfoList.cs
- WorkflowOperationInvoker.cs
- EventMappingSettings.cs
- BlurEffect.cs
- counter.cs