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
- LocatorManager.cs
- PeerApplication.cs
- InterleavedZipPartStream.cs
- CodeBlockBuilder.cs
- COM2Enum.cs
- KeyValuePairs.cs
- SizeAnimation.cs
- NavigationFailedEventArgs.cs
- Itemizer.cs
- CurrentChangedEventManager.cs
- MarkupCompilePass2.cs
- TypeConvertions.cs
- TypeToStringValueConverter.cs
- IsolatedStorageFileStream.cs
- PropertyKey.cs
- Attributes.cs
- PassportAuthentication.cs
- LocalFileSettingsProvider.cs
- AdornedElementPlaceholder.cs
- BufferedGraphics.cs
- XmlSchemaParticle.cs
- FrameworkPropertyMetadata.cs
- HtmlElement.cs
- TransportOutputChannel.cs
- XmlHierarchicalEnumerable.cs
- Matrix.cs
- SecurityRuntime.cs
- DataGridViewRowPostPaintEventArgs.cs
- ToolboxDataAttribute.cs
- TextRange.cs
- AccessedThroughPropertyAttribute.cs
- WindowPattern.cs
- DoubleLinkList.cs
- RadioButtonAutomationPeer.cs
- ProfilePropertySettings.cs
- WebPartCatalogCloseVerb.cs
- ClientOptions.cs
- CallContext.cs
- LinkLabelLinkClickedEvent.cs
- Encoder.cs
- DiagnosticEventProvider.cs
- PreviewPrintController.cs
- XmlnsCache.cs
- StatusBarPanelClickEvent.cs
- SamlAttributeStatement.cs
- BadImageFormatException.cs
- RotateTransform3D.cs
- ForwardPositionQuery.cs
- TabControl.cs
- DateTime.cs
- WindowsRegion.cs
- TemplateColumn.cs
- UrlMapping.cs
- ParentQuery.cs
- PlatformCulture.cs
- HttpModuleCollection.cs
- GridViewSelectEventArgs.cs
- BrowserCapabilitiesFactoryBase.cs
- CopyCodeAction.cs
- XmlHierarchyData.cs
- HiddenFieldPageStatePersister.cs
- TouchDevice.cs
- AttachedPropertyMethodSelector.cs
- Matrix.cs
- AnonymousIdentificationModule.cs
- SynchronizationContext.cs
- Repeater.cs
- TcpPortSharing.cs
- MarkupCompilePass2.cs
- CheckBox.cs
- FunctionImportElement.cs
- TopClause.cs
- DefaultBindingPropertyAttribute.cs
- SchemaSetCompiler.cs
- Int32KeyFrameCollection.cs
- SystemTcpStatistics.cs
- StringComparer.cs
- DataSourceCacheDurationConverter.cs
- FaultConverter.cs
- XmlSchemaException.cs
- TextOutput.cs
- SmtpDigestAuthenticationModule.cs
- RequiredFieldValidator.cs
- CodeLinePragma.cs
- SectionInformation.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- DataGridViewTopRowAccessibleObject.cs
- ClipboardData.cs
- NetworkInformationPermission.cs
- PeerEndPoint.cs
- Int32Rect.cs
- ToolBarTray.cs
- GrowingArray.cs
- DataService.cs
- DataColumnMapping.cs
- AdRotator.cs
- VariableQuery.cs
- MenuItemStyleCollection.cs
- TiffBitmapEncoder.cs
- ClientSponsor.cs