Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ServiceDescriptionContext.cs
- WebPartHeaderCloseVerb.cs
- TimeoutException.cs
- CodeSnippetStatement.cs
- Int32CAMarshaler.cs
- IgnoreSection.cs
- EntityContainer.cs
- EventlogProvider.cs
- Queue.cs
- XmlArrayAttribute.cs
- XmlSchemaDatatype.cs
- HealthMonitoringSection.cs
- XmlDataLoader.cs
- StatusCommandUI.cs
- ExpressionVisitorHelpers.cs
- EntityDescriptor.cs
- ParseChildrenAsPropertiesAttribute.cs
- Point3DAnimationUsingKeyFrames.cs
- securitycriticaldataClass.cs
- SafePEFileHandle.cs
- SafeNativeMethodsOther.cs
- TextSimpleMarkerProperties.cs
- CheckBoxRenderer.cs
- TextDecoration.cs
- EllipticalNodeOperations.cs
- BasicAsyncResult.cs
- FixedSOMPage.cs
- IntegerFacetDescriptionElement.cs
- DbXmlEnabledProviderManifest.cs
- Invariant.cs
- XmlSerializerSection.cs
- KeyInterop.cs
- RequestCachePolicyConverter.cs
- PageThemeParser.cs
- SqlClientMetaDataCollectionNames.cs
- WizardDesigner.cs
- IIS7WorkerRequest.cs
- ListViewGroupConverter.cs
- CodeThrowExceptionStatement.cs
- QilValidationVisitor.cs
- SelectedDatesCollection.cs
- FileIOPermission.cs
- WindowsRichEditRange.cs
- SchemaImporterExtensionElementCollection.cs
- SqlBulkCopyColumnMapping.cs
- DataGridViewUtilities.cs
- XmlExceptionHelper.cs
- ListControlConvertEventArgs.cs
- EmptyElement.cs
- XsltQilFactory.cs
- EventLogTraceListener.cs
- mil_commands.cs
- MappingException.cs
- PathFigureCollection.cs
- ListSortDescriptionCollection.cs
- ApplicationProxyInternal.cs
- AssociatedControlConverter.cs
- BooleanToVisibilityConverter.cs
- InputLangChangeRequestEvent.cs
- BitmapEffectInput.cs
- SQLConvert.cs
- TextParagraphView.cs
- FlowDocumentReaderAutomationPeer.cs
- EnterpriseServicesHelper.cs
- DesignerOptionService.cs
- ContainerSelectorActiveEvent.cs
- DBConcurrencyException.cs
- OleAutBinder.cs
- DurableInstance.cs
- ExtractedStateEntry.cs
- DefaultExpressionVisitor.cs
- SerializationInfo.cs
- Operators.cs
- VersionedStream.cs
- WindowsFormsHostPropertyMap.cs
- XmlQuerySequence.cs
- DataKey.cs
- SimpleWorkerRequest.cs
- PenContexts.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- TaiwanLunisolarCalendar.cs
- PropertyDescriptorCollection.cs
- Simplifier.cs
- VersionPair.cs
- RegexStringValidator.cs
- AstNode.cs
- ControlParameter.cs
- ProxyGenerator.cs
- MatchingStyle.cs
- ComboBox.cs
- SHA384CryptoServiceProvider.cs
- StringComparer.cs
- BrowsableAttribute.cs
- ServiceRouteHandler.cs
- CryptoHelper.cs
- Quaternion.cs
- MissingMemberException.cs
- AttributeQuery.cs
- SpecularMaterial.cs
- HttpListenerResponse.cs