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
- DataGridViewRowHeightInfoPushedEventArgs.cs
- sitestring.cs
- FontTypeConverter.cs
- Int64KeyFrameCollection.cs
- TranslateTransform.cs
- MappedMetaModel.cs
- StylusPointPropertyInfoDefaults.cs
- DateTimeStorage.cs
- MD5.cs
- BitmapDownload.cs
- XmlSchemaException.cs
- PageHandlerFactory.cs
- RenderCapability.cs
- MsmqNonTransactedPoisonHandler.cs
- TrackingServices.cs
- CacheMemory.cs
- ISAPIWorkerRequest.cs
- DeferredSelectedIndexReference.cs
- StringValueSerializer.cs
- InplaceBitmapMetadataWriter.cs
- GridViewRow.cs
- PartBasedPackageProperties.cs
- XhtmlBasicSelectionListAdapter.cs
- MultilineStringConverter.cs
- InputMethod.cs
- ArrangedElement.cs
- DbConnectionClosed.cs
- FixedDocumentPaginator.cs
- ParseHttpDate.cs
- SingleSelectRootGridEntry.cs
- IdlingCommunicationPool.cs
- DataGridViewCellConverter.cs
- SiteOfOriginPart.cs
- DateTimeEditor.cs
- SessionStateModule.cs
- SvcMapFileSerializer.cs
- AddIn.cs
- BypassElement.cs
- VisualBrush.cs
- WebContext.cs
- DataServiceStreamProviderWrapper.cs
- ToolTip.cs
- SingleObjectCollection.cs
- WebBrowserNavigatedEventHandler.cs
- BamlRecordWriter.cs
- XamlDesignerSerializationManager.cs
- Popup.cs
- PathData.cs
- OracleCommand.cs
- TemplateKeyConverter.cs
- BorderGapMaskConverter.cs
- ContentPosition.cs
- NativeCompoundFileAPIs.cs
- IsolatedStoragePermission.cs
- HtmlTitle.cs
- TextCharacters.cs
- SecureUICommand.cs
- FormatterServices.cs
- ApplicationContext.cs
- KeyTimeConverter.cs
- DiffuseMaterial.cs
- Listen.cs
- DecoderNLS.cs
- XmlSerializerVersionAttribute.cs
- Int32Rect.cs
- SafeMILHandle.cs
- CultureInfoConverter.cs
- CompilerResults.cs
- HttpCacheParams.cs
- AttributeInfo.cs
- Point.cs
- HtmlInputText.cs
- Stroke.cs
- embossbitmapeffect.cs
- SelectionHighlightInfo.cs
- SessionStateUtil.cs
- X509ServiceCertificateAuthenticationElement.cs
- WebDisplayNameAttribute.cs
- HttpInputStream.cs
- PopupEventArgs.cs
- SharedPersonalizationStateInfo.cs
- FormView.cs
- DispatcherExceptionFilterEventArgs.cs
- AnnotationMap.cs
- XmlSchemas.cs
- TextParagraphProperties.cs
- ConfigurationSchemaErrors.cs
- ClassDataContract.cs
- DataMemberFieldEditor.cs
- ListViewItem.cs
- HttpRuntime.cs
- RequestSecurityTokenForRemoteTokenFactory.cs
- RawStylusInput.cs
- HandledMouseEvent.cs
- EdmPropertyAttribute.cs
- CharUnicodeInfo.cs
- WindowsListViewSubItem.cs
- PageBreakRecord.cs
- Serializer.cs
- BaseInfoTable.cs