Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / WinForms / Managed / System / WinForms / ProgressBarRenderer.cs / 1 / ProgressBarRenderer.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.Drawing; using System.Diagnostics.CodeAnalysis; using System.Windows.Forms.VisualStyles; using Microsoft.Win32; ////// /// public sealed class ProgressBarRenderer { //Make this per-thread, so that different threads can safely use these methods. [ThreadStatic] private static VisualStyleRenderer visualStyleRenderer = null; //cannot instantiate private ProgressBarRenderer() { } ////// This is a rendering class for the ProgressBar control. /// ////// /// public static bool IsSupported { get { return VisualStyleRenderer.IsSupported; // no downlevel support } } ////// Returns true if this class is supported for the current OS and user/application settings, /// otherwise returns false. /// ////// /// [ SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters") // Using Graphics instead of IDeviceContext intentionally ] public static void DrawHorizontalBar(Graphics g, Rectangle bounds) { InitializeRenderer(VisualStyleElement.ProgressBar.Bar.Normal); visualStyleRenderer.DrawBackground(g, bounds); } ////// Renders a horizontal bar. /// ////// /// [ SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters") // Using Graphics instead of IDeviceContext intentionally ] public static void DrawVerticalBar(Graphics g, Rectangle bounds) { InitializeRenderer(VisualStyleElement.ProgressBar.BarVertical.Normal); visualStyleRenderer.DrawBackground(g, bounds); } ////// Renders a vertical bar. /// ////// /// [ SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters") // Using Graphics instead of IDeviceContext intentionally ] public static void DrawHorizontalChunks(Graphics g, Rectangle bounds) { InitializeRenderer(VisualStyleElement.ProgressBar.Chunk.Normal); visualStyleRenderer.DrawBackground(g, bounds); } ////// Renders a number of constant size horizontal chunks in the given bounds. /// ////// /// [ SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters") // Using Graphics instead of IDeviceContext intentionally ] public static void DrawVerticalChunks(Graphics g, Rectangle bounds) { InitializeRenderer(VisualStyleElement.ProgressBar.ChunkVertical.Normal); visualStyleRenderer.DrawBackground(g, bounds); } ////// Renders a number of constant size vertical chunks in the given bounds. /// ////// /// public static int ChunkThickness { get { InitializeRenderer(VisualStyleElement.ProgressBar.Chunk.Normal); return (visualStyleRenderer.GetInteger(IntegerProperty.ProgressChunkSize)); } } ////// Returns the width/height of a single horizontal/vertical progress bar chunk. /// ////// /// public static int ChunkSpaceThickness { get { InitializeRenderer(VisualStyleElement.ProgressBar.Chunk.Normal); return (visualStyleRenderer.GetInteger(IntegerProperty.ProgressSpaceSize)); } } private static void InitializeRenderer(VisualStyleElement element) { if (visualStyleRenderer == null) { visualStyleRenderer = new VisualStyleRenderer(element); } else { visualStyleRenderer.SetParameters(element); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved./// Returns the width/height of the space between horizontal/vertical progress bar chunks. /// ///
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BaseCollection.cs
- FillErrorEventArgs.cs
- ObjectDisposedException.cs
- State.cs
- AsymmetricSignatureDeformatter.cs
- ResourcePart.cs
- BatchParser.cs
- MetadataItemSerializer.cs
- PenCursorManager.cs
- CodeGroup.cs
- MessageEncoderFactory.cs
- CheckableControlBaseAdapter.cs
- AlgoModule.cs
- CompiledELinqQueryState.cs
- HtmlAnchor.cs
- ToolStripContainerActionList.cs
- PathSegment.cs
- CapabilitiesPattern.cs
- BuildManagerHost.cs
- Roles.cs
- RelationshipWrapper.cs
- TablePattern.cs
- WhitespaceRule.cs
- DrawingContextWalker.cs
- IsolatedStoragePermission.cs
- NavigationService.cs
- GeneralTransformCollection.cs
- TraceSection.cs
- FlowLayout.cs
- _CacheStreams.cs
- diagnosticsswitches.cs
- TextSelectionHelper.cs
- Utils.cs
- Operand.cs
- SymbolTable.cs
- RenderContext.cs
- BitmapDownload.cs
- ChannelSinkStacks.cs
- MaskedTextBoxDesignerActionList.cs
- SqlServer2KCompatibilityCheck.cs
- XamlStackWriter.cs
- Opcode.cs
- DesignSurfaceCollection.cs
- EnvelopedSignatureTransform.cs
- CompensationToken.cs
- AsymmetricAlgorithm.cs
- XmlCDATASection.cs
- FontFamilyConverter.cs
- NativeMethods.cs
- ToolTipService.cs
- DictionaryBase.cs
- ServiceReference.cs
- CacheDependency.cs
- NetTcpBinding.cs
- XmlSerializationGeneratedCode.cs
- XmlWrappingWriter.cs
- EventSource.cs
- FlowDecisionLabelFeature.cs
- ToolStripScrollButton.cs
- TriggerBase.cs
- HScrollBar.cs
- UICuesEvent.cs
- PictureBox.cs
- AsymmetricSignatureDeformatter.cs
- SynchronizedRandom.cs
- Timeline.cs
- Currency.cs
- TreeViewItemAutomationPeer.cs
- ProviderConnectionPoint.cs
- DbProviderConfigurationHandler.cs
- WebConvert.cs
- MessageQueuePermissionEntry.cs
- Queue.cs
- WindowsSecurityTokenAuthenticator.cs
- SQLGuid.cs
- ReversePositionQuery.cs
- EventHandlingScope.cs
- ProviderIncompatibleException.cs
- Int64Storage.cs
- SHA1.cs
- AccessibleObject.cs
- SqlMultiplexer.cs
- BufferModeSettings.cs
- SerializableTypeCodeDomSerializer.cs
- serverconfig.cs
- OracleException.cs
- SessionParameter.cs
- HGlobalSafeHandle.cs
- XmlHierarchicalEnumerable.cs
- BitmapEffectInputData.cs
- DrawingGroupDrawingContext.cs
- DataBoundControlParameterTarget.cs
- SyntaxCheck.cs
- iisPickupDirectory.cs
- COM2IDispatchConverter.cs
- ColorConvertedBitmap.cs
- WindowPatternIdentifiers.cs
- KeyEventArgs.cs
- PageCodeDomTreeGenerator.cs
- SerializerProvider.cs