Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / ButtonInternal / RadioButtonStandardAdapter.cs / 1 / RadioButtonStandardAdapter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.ButtonInternal { using System; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing.Text; using System.Windows.Forms; internal class RadioButtonStandardAdapter : RadioButtonBaseAdapter { internal RadioButtonStandardAdapter(ButtonBase control) : base(control) {} internal override void PaintUp(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBox(e, layout); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } private new ButtonStandardAdapter ButtonAdapter { get { return ((ButtonStandardAdapter)base.ButtonAdapter); } } protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonStandardAdapter(Control); } #region Temp protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = CommonLayout(); layout.hintTextUp = false; layout.everettButtonCompat = !Application.RenderWithVisualStyles; // VSWhidbey 420870 if (Application.RenderWithVisualStyles) { using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics()) { layout.checkSize = RadioButtonRenderer.GetGlyphSize(g, RadioButtonRenderer.ConvertFromButtonState(GetState(), Control.MouseIsOver)).Width; } } return layout; } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.ButtonInternal { using System; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing.Text; using System.Windows.Forms; internal class RadioButtonStandardAdapter : RadioButtonBaseAdapter { internal RadioButtonStandardAdapter(ButtonBase control) : base(control) {} internal override void PaintUp(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { ColorData colors = PaintRender(e.Graphics).Calculate(); LayoutData layout = Layout(e).Layout(); PaintButtonBackground(e, Control.ClientRectangle, null); PaintImage(e, layout); DrawCheckBox(e, layout); PaintField(e, layout, colors, colors.windowText, true); } } internal override void PaintDown(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintDown(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } internal override void PaintOver(PaintEventArgs e, CheckState state) { if (Control.Appearance == Appearance.Button) { ButtonAdapter.PaintOver(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked); } else { PaintUp(e, state); } } private new ButtonStandardAdapter ButtonAdapter { get { return ((ButtonStandardAdapter)base.ButtonAdapter); } } protected override ButtonBaseAdapter CreateButtonAdapter() { return new ButtonStandardAdapter(Control); } #region Temp protected override LayoutOptions Layout(PaintEventArgs e) { LayoutOptions layout = CommonLayout(); layout.hintTextUp = false; layout.everettButtonCompat = !Application.RenderWithVisualStyles; // VSWhidbey 420870 if (Application.RenderWithVisualStyles) { using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics()) { layout.checkSize = RadioButtonRenderer.GetGlyphSize(g, RadioButtonRenderer.ConvertFromButtonState(GetState(), Control.MouseIsOver)).Width; } } return layout; } #endregion } } // 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
- HtmlTable.cs
- CacheAxisQuery.cs
- WMICapabilities.cs
- JsonGlobals.cs
- BackoffTimeoutHelper.cs
- CompiledAction.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- DomNameTable.cs
- AtomParser.cs
- MediaCommands.cs
- NavigationWindow.cs
- AsyncResult.cs
- XmlUtf8RawTextWriter.cs
- DataGridParentRows.cs
- ConfigXmlElement.cs
- StringArrayConverter.cs
- EditorPartChrome.cs
- EventListenerClientSide.cs
- LocatorPart.cs
- InsufficientMemoryException.cs
- ProcessHost.cs
- DesignTable.cs
- SimpleRecyclingCache.cs
- TransformedBitmap.cs
- ConstraintConverter.cs
- TableCellCollection.cs
- PackageController.cs
- GenericIdentity.cs
- DataList.cs
- DefaultPropertyAttribute.cs
- TypeInitializationException.cs
- DriveInfo.cs
- DoubleConverter.cs
- SoapHttpTransportImporter.cs
- RadioButtonAutomationPeer.cs
- HttpCacheVaryByContentEncodings.cs
- x509utils.cs
- Polyline.cs
- ParenthesizePropertyNameAttribute.cs
- StructuredTypeInfo.cs
- ObjectMemberMapping.cs
- RoutedUICommand.cs
- EdgeProfileValidation.cs
- EmptyCollection.cs
- RoutedPropertyChangedEventArgs.cs
- FilterEventArgs.cs
- SafeFileMappingHandle.cs
- XmlSchemaException.cs
- RunInstallerAttribute.cs
- DecoderFallback.cs
- WebEventTraceProvider.cs
- EntityDataSourceViewSchema.cs
- SetIterators.cs
- DetailsViewInsertEventArgs.cs
- BinaryFormatter.cs
- TimerEventSubscription.cs
- NavigationPropertySingletonExpression.cs
- LicenseProviderAttribute.cs
- PeerNearMe.cs
- TextRunTypographyProperties.cs
- DataSourceCacheDurationConverter.cs
- GridViewColumnHeaderAutomationPeer.cs
- WsatEtwTraceListener.cs
- SecureConversationServiceCredential.cs
- X509SubjectKeyIdentifierClause.cs
- Activator.cs
- InternalConfigRoot.cs
- IOException.cs
- GeometryHitTestParameters.cs
- SqlRewriteScalarSubqueries.cs
- TimelineGroup.cs
- BitSet.cs
- ConnectionsZoneDesigner.cs
- ObfuscationAttribute.cs
- METAHEADER.cs
- StatusBarItemAutomationPeer.cs
- CompilerParameters.cs
- PropertyIDSet.cs
- BrowserInteropHelper.cs
- BitmapDownload.cs
- ToolStripLocationCancelEventArgs.cs
- DataGridCellClipboardEventArgs.cs
- NonVisualControlAttribute.cs
- CultureInfo.cs
- ConnectionStringsSection.cs
- HeaderCollection.cs
- ProtectedConfiguration.cs
- AnimationTimeline.cs
- TextCharacters.cs
- XmlException.cs
- OutputCacheSettings.cs
- BlobPersonalizationState.cs
- OleServicesContext.cs
- FieldCollectionEditor.cs
- SafeRightsManagementPubHandle.cs
- PolicyReader.cs
- StateBag.cs
- ExponentialEase.cs
- StylusLogic.cs
- HotSpotCollection.cs