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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExpressionBuilder.cs
- ObjectListField.cs
- LayoutManager.cs
- SubqueryTrackingVisitor.cs
- ReadOnlyDataSourceView.cs
- SapiRecoContext.cs
- SynchronousSendBindingElement.cs
- Int16AnimationBase.cs
- ChtmlTextWriter.cs
- FrameworkElement.cs
- CellIdBoolean.cs
- NumberFunctions.cs
- CompiledELinqQueryState.cs
- SoapCodeExporter.cs
- ObjectDataSourceDisposingEventArgs.cs
- InkCanvasSelectionAdorner.cs
- OleDbParameterCollection.cs
- PresentationUIStyleResources.cs
- CalendarDay.cs
- ObjectDataSourceMethodEventArgs.cs
- GreenMethods.cs
- ResourcesChangeInfo.cs
- Hashtable.cs
- StylusCaptureWithinProperty.cs
- RegisteredArrayDeclaration.cs
- LostFocusEventManager.cs
- WebPartEditorApplyVerb.cs
- SqlDependencyUtils.cs
- UrlPropertyAttribute.cs
- HtmlTextArea.cs
- NamedPermissionSet.cs
- XLinq.cs
- CheckableControlBaseAdapter.cs
- TextEndOfSegment.cs
- XmlSerializationReader.cs
- ServicePoint.cs
- DataGrid.cs
- HorizontalAlignConverter.cs
- ContentIterators.cs
- RuntimeHelpers.cs
- PrePrepareMethodAttribute.cs
- SmtpSection.cs
- SiblingIterators.cs
- SoapExtensionStream.cs
- WindowsAuthenticationEventArgs.cs
- WorkflowLayouts.cs
- CroppedBitmap.cs
- XmlTextWriter.cs
- NamedPipeAppDomainProtocolHandler.cs
- SevenBitStream.cs
- UnhandledExceptionEventArgs.cs
- PreviewKeyDownEventArgs.cs
- bindurihelper.cs
- EFAssociationProvider.cs
- AnnotationResource.cs
- CodeGotoStatement.cs
- DoubleAnimationClockResource.cs
- Misc.cs
- OdbcCommand.cs
- XamlDesignerSerializationManager.cs
- Substitution.cs
- WebBrowserBase.cs
- Geometry.cs
- JoinGraph.cs
- wgx_render.cs
- AssertFilter.cs
- RegistryKey.cs
- FrameAutomationPeer.cs
- FileEnumerator.cs
- MemberNameValidator.cs
- JapaneseCalendar.cs
- IPEndPoint.cs
- ListParaClient.cs
- PriorityQueue.cs
- ArgumentDesigner.xaml.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- Attachment.cs
- SqlErrorCollection.cs
- BindingContext.cs
- EntityContainerEntitySetDefiningQuery.cs
- ScriptBehaviorDescriptor.cs
- SchemaSetCompiler.cs
- TextContainerChangeEventArgs.cs
- DBCommandBuilder.cs
- PersistenceException.cs
- MemberAccessException.cs
- PageThemeBuildProvider.cs
- HttpModulesSection.cs
- InputLanguageCollection.cs
- TabControlAutomationPeer.cs
- SafeRightsManagementSessionHandle.cs
- XmlDataSource.cs
- IOThreadScheduler.cs
- CheckBoxPopupAdapter.cs
- FlowDocumentReader.cs
- DocumentApplicationJournalEntryEventArgs.cs
- ConfigXmlAttribute.cs
- MultiSelectRootGridEntry.cs
- ViewStateModeByIdAttribute.cs
- StreamInfo.cs